added support for expanding wall settings in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Wed, 20 Mar 2024 23:40:44 +0000 (00:40 +0100)
committerHolger Schemel <info@artsoft.org>
Wed, 20 Mar 2024 23:40:46 +0000 (00:40 +0100)
src/editor.c
src/files.c
src/main.h

index 2ca3dfba9b78b79f44b409c4af2b4a7cbdba8258..391aae986ad2e72c54fe0658f92050c002db2756 100644 (file)
@@ -729,6 +729,7 @@ enum
   GADGET_ID_BD_VOODOO_DIES_BY_ROCK,
   GADGET_ID_BD_VOODOO_VANISH_BY_EXPLOSION,
   GADGET_ID_BD_SLIME_IS_PREDICTABLE,
+  GADGET_ID_BD_CHANGE_EXPANDING_WALL,
   GADGET_ID_ENVELOPE_AUTOWRAP,
   GADGET_ID_ENVELOPE_CENTERED,
   GADGET_ID_MM_LASER_RED,
@@ -1074,6 +1075,7 @@ enum
   ED_CHECKBUTTON_ID_BD_VOODOO_DIES_BY_ROCK,
   ED_CHECKBUTTON_ID_BD_VOODOO_VANISH_BY_EXPLOSION,
   ED_CHECKBUTTON_ID_BD_SLIME_IS_PREDICTABLE,
+  ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL,
   ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
   ED_CHECKBUTTON_ID_ENVELOPE_CENTERED,
   ED_CHECKBUTTON_ID_MM_LASER_RED,
@@ -3810,6 +3812,14 @@ static struct
     NULL, NULL,
     "Slime is predictable",            "Use predictable random numbers"
   },
+  {
+    ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL,
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(0),
+    GADGET_ID_BD_CHANGE_EXPANDING_WALL, GADGET_ID_NONE,
+    &level.bd_change_expanding_wall,
+    NULL, NULL,
+    "Change direction",                        "Switch horizontal/vertical direction"
+  },
   {
     ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP,
     ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
@@ -11083,6 +11093,7 @@ static boolean checkPropertiesConfig(int element)
       IS_DF_LASER(element) ||
       IS_PLAYER_ELEMENT(element) ||
       IS_BD_PLAYER_ELEMENT(element) ||
+      IS_BD_EXPANDABLE_WALL(properties_element) ||
       IS_SOKOBAN_OBJECT_OR_FIELD(element) ||
       HAS_EDITOR_CONTENT(element) ||
       CAN_GROW(element) ||
@@ -11440,6 +11451,11 @@ static void DrawPropertiesConfig(void)
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_STOPS_AMOEBA);
   }
 
+  if (IS_BD_EXPANDABLE_WALL(properties_element))
+  {
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL);
+  }
+
   // 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)
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS);
index 1128b9e093d312e5ab53f639540189e65179d915..489565f976255aaf1c22679ebd70fb23fbaa533d 100644 (file)
@@ -742,6 +742,12 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     &li.bd_bladder_converts_by_element,        EL_BD_VOODOO_DOLL
   },
 
+  {
+    EL_BD_EXPANDABLE_WALL_ANY,         -1,
+    TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(1),
+    &li.bd_change_expanding_wall,      FALSE
+  },
+
   // (the following values are related to various game elements)
 
   {
@@ -4037,6 +4043,8 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
 
   cave->bladder_converts_by        = map_element_RND_to_BD(level->bd_bladder_converts_by_element);
 
+  cave->expanding_wall_changed         = level->bd_change_expanding_wall;
+
   // level name
   strncpy(cave->name, level->name, sizeof(GdString));
   cave->name[sizeof(GdString) - 1] = '\0';
@@ -4136,6 +4144,8 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
 
   level->bd_bladder_converts_by_element        = map_element_BD_to_RND(cave->bladder_converts_by);
 
+  level->bd_change_expanding_wall      = cave->expanding_wall_changed;
+
   // level name
   char *cave_name = getStringPrint("%s / %d", cave->name, bd_level_nr + 1);
 
index 8f53e89daf091101eac19c2396f4c4df7f49b119..13217f5034e3e2a32647393451741ecbd0bb9c44 100644 (file)
                                         (e) == EL_BD_BITER_LEFT ||             \
                                         (e) == EL_BD_BITER_DOWN)
 
+#define IS_BD_EXPANDABLE_WALL(e)       ((e) == EL_BD_EXPANDABLE_WALL_HORIZONTAL ||     \
+                                        (e) == EL_BD_EXPANDABLE_WALL_VERTICAL ||       \
+                                        (e) == EL_BD_EXPANDABLE_WALL_ANY ||            \
+                                        (e) == EL_BD_EXPANDABLE_STEELWALL_HORIZONTAL ||\
+                                        (e) == EL_BD_EXPANDABLE_STEELWALL_VERTICAL ||  \
+                                        (e) == EL_BD_EXPANDABLE_STEELWALL_ANY)
+
 #define IS_SOKOBAN_OBJECT_OR_FIELD(e)  ((e) == EL_SOKOBAN_OBJECT ||            \
                                         (e) == EL_SOKOBAN_FIELD_EMPTY ||       \
                                         (e) == EL_SOKOBAN_FIELD_FULL)
@@ -3540,6 +3547,7 @@ struct LevelInfo
   int bd_biter_move_delay;             // BD biter delay between movements (in BD frames)
   int bd_biter_eats_element;           // BD biter eats this game element when moving
   int bd_bladder_converts_by_element;  // BD bladder converts to clock by touching this element
+  boolean bd_change_expanding_wall;    // BD expanding wall direction is changed if enabled
 
   boolean em_slippery_gems;            // EM style "gems slip from wall" behaviour
   boolean em_explodes_by_fire;         // EM style chain explosion behaviour