added support for active player in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Mon, 11 Mar 2024 18:40:10 +0000 (19:40 +0100)
committerHolger Schemel <info@artsoft.org>
Mon, 11 Mar 2024 18:40:10 +0000 (19:40 +0100)
src/editor.c
src/files.c
src/main.h

index 0db1f716337dca926a423dcf27605e397d45bd28..a9ef7e5e57aee657b2de8d3acb5c485b89e8cde3 100644 (file)
@@ -700,6 +700,7 @@ enum
   GADGET_ID_CAN_MOVE_INTO_ACID,
   GADGET_ID_DONT_COLLIDE_WITH,
   GADGET_ID_BD_DIAGONAL_MOVEMENTS,
+  GADGET_ID_BD_TOPMOST_PLAYER_ACTIVE,
   GADGET_ID_ENVELOPE_AUTOWRAP,
   GADGET_ID_ENVELOPE_CENTERED,
   GADGET_ID_MM_LASER_RED,
@@ -1031,6 +1032,7 @@ enum
   ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID,
   ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH,
   ED_CHECKBUTTON_ID_BD_DIAGONAL_MOVEMENTS,
+  ED_CHECKBUTTON_ID_BD_TOPMOST_PLAYER_ACTIVE,
   ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
   ED_CHECKBUTTON_ID_ENVELOPE_CENTERED,
   ED_CHECKBUTTON_ID_MM_LASER_RED,
@@ -3642,6 +3644,14 @@ static struct
     NULL, NULL,
     "can move diagonally",             "player can move diagonally"
   },
+  {
+    ED_CHECKBUTTON_ID_BD_TOPMOST_PLAYER_ACTIVE,
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
+    GADGET_ID_BD_TOPMOST_PLAYER_ACTIVE,        GADGET_ID_NONE,
+    &level.bd_topmost_player_active,
+    NULL, NULL,
+    "topmost player is active",                "use first player found on playfield"
+  },
   {
     ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
     ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
@@ -11033,7 +11043,10 @@ static void DrawPropertiesConfig(void)
   }
 
   if (IS_BD_PLAYER_ELEMENT(properties_element))
+  {
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_DIAGONAL_MOVEMENTS);
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_TOPMOST_PLAYER_ACTIVE);
+  }
 
   // special case: slippery walls option for gems only available in R'n'D game engine
   if (IS_GEM(properties_element) && level.game_engine_type == GAME_ENGINE_TYPE_RND)
index 0c75667c9c50aa102bd7ce3f360c16a1232187e2..0a9f3a5c272ea464e553aefca207ec6554e9aa99 100644 (file)
@@ -641,6 +641,11 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(1),
     &li.bd_diagonal_movements,         FALSE
   },
+  {
+    EL_BD_PLAYER,                      -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(2),
+    &li.bd_topmost_player_active,      TRUE
+  },
 
   {
     EL_BD_DIAMOND,                     -1,
@@ -3797,6 +3802,7 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
   cave->pal_timing                     = level->bd_pal_timing;
   cave->intermission                   = level->bd_intermission;
   cave->diagonal_movements             = level->bd_diagonal_movements;
+  cave->active_is_first_found          = level->bd_topmost_player_active;
 
   cave->lineshift                      = level->bd_line_shifting_borders;
   cave->wraparound_objects             = level->bd_wraparound_objects;
@@ -3839,6 +3845,7 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   level->bd_pal_timing                 = cave->pal_timing;
   level->bd_intermission               = cave->intermission;
   level->bd_diagonal_movements         = cave->diagonal_movements;
+  level->bd_topmost_player_active      = cave->active_is_first_found;
 
   level->bd_line_shifting_borders      = cave->lineshift;
   level->bd_wraparound_objects         = cave->wraparound_objects;
index 85b69174b1e7fc1efc629550a7d43b5fcff753fc..77f15e42659c88391de4acbbe80ed79ba2734310 100644 (file)
@@ -3493,6 +3493,7 @@ struct LevelInfo
   boolean bd_gravity_affects_all;      // BD engine gravity affects all falling objects
   boolean bd_intermission;             // BD level is intermission
   boolean bd_diagonal_movements;       // BD style diagonal movements
+  boolean bd_topmost_player_active;    // BD engine uses first player found on playfield
   boolean em_slippery_gems;            // EM style "gems slip from wall" behaviour
   boolean em_explodes_by_fire;         // EM style chain explosion behaviour
   boolean use_spring_bug;              // for compatibility with old levels