extended support for expanding wall settings in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Sun, 24 Mar 2024 23:03:17 +0000 (00:03 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 24 Mar 2024 23:03:19 +0000 (00:03 +0100)
src/editor.c
src/files.c
src/main.h

index c3a951165d0e16c4f6b95d45b0fcaea625df0bdb..a09e20acf2f1307a69d63bad64251abec08f5336 100644 (file)
@@ -581,6 +581,7 @@ enum
   GADGET_ID_BD_BITER_EATS_ELEMENT,
   GADGET_ID_BD_BLADDER_CONVERTS_BY_ELEMENT,
   GADGET_ID_BD_NUT_CONTENT,
+  GADGET_ID_BD_EXPANDING_WALL_LOOKS_LIKE,
   GADGET_ID_START_ELEMENT,
   GADGET_ID_ARTWORK_ELEMENT,
   GADGET_ID_EXPLOSION_ELEMENT,
@@ -1220,6 +1221,7 @@ enum
   ED_DRAWING_ID_BD_BITER_EATS_ELEMENT,
   ED_DRAWING_ID_BD_BLADDER_CONVERTS_BY_ELEMENT,
   ED_DRAWING_ID_BD_NUT_CONTENT,
+  ED_DRAWING_ID_BD_EXPANDING_WALL_LOOKS_LIKE,
   ED_DRAWING_ID_START_ELEMENT,
   ED_DRAWING_ID_ARTWORK_ELEMENT,
   ED_DRAWING_ID_EXPLOSION_ELEMENT,
@@ -4580,6 +4582,14 @@ static struct
     &level.bd_nut_content,             1, 1,
     "When breaking, changes to:", NULL, NULL, NULL,    "Element created when breaking nut"
   },
+  {
+    ED_DRAWING_ID_BD_EXPANDING_WALL_LOOKS_LIKE,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(1),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_EXPANDING_WALL_LOOKS_LIKE, GADGET_ID_NONE,
+    &level.bd_expanding_wall_looks_like,       1, 1,
+    "Use graphic of element:", NULL, NULL, NULL,       "Expanding wall looks like this element"
+  },
 
   // ---------- level start element -------------------------------------------
 
@@ -11500,6 +11510,7 @@ static boolean checkPropertiesConfig(int element)
       IS_PLAYER_ELEMENT(element) ||
       IS_BD_PLAYER_ELEMENT(element) ||
       IS_BD_EXPANDABLE_WALL(properties_element) ||
+      IS_BD_EXPANDABLE_STEELWALL(properties_element) ||
       IS_BD_CONVEYOR_BELT(properties_element) ||
       IS_BD_CONVEYOR_BELT_SWITCH(properties_element) ||
       IS_SOKOBAN_OBJECT_OR_FIELD(element) ||
@@ -11887,9 +11898,13 @@ static void DrawPropertiesConfig(void)
     MapDrawingArea(ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_3);
   }
 
-  if (IS_BD_EXPANDABLE_WALL(properties_element))
+  if (IS_BD_EXPANDABLE_WALL(properties_element) ||
+      IS_BD_EXPANDABLE_STEELWALL(properties_element))
   {
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL);
+
+    if (IS_BD_EXPANDABLE_WALL(properties_element))
+      MapDrawingArea(ED_DRAWING_ID_BD_EXPANDING_WALL_LOOKS_LIKE);
   }
 
   if (properties_element == EL_BD_REPLICATOR)
index 628f577e34ab29bca43fdba3ea10c7ba0ebb2d77..4e70f9eff6490ad413dfc04a731a649e209e06bd 100644 (file)
@@ -812,6 +812,11 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(1),
     &li.bd_change_expanding_wall,      FALSE
   },
+  {
+    EL_BD_EXPANDABLE_WALL_ANY,         -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(1),
+    &li.bd_expanding_wall_looks_like,  EL_BD_WALL
+  },
 
   {
     EL_BD_REPLICATOR,                  -1,
@@ -4203,6 +4208,8 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
   cave->skeletons_needed_for_pot       = level->bd_num_skeletons_needed_for_pot;
   cave->skeletons_worth_diamonds       = level->bd_skeleton_worth_num_diamonds;
 
+  cave->expanding_wall_looks_like      = map_element_RND_to_BD_cave(level->bd_expanding_wall_looks_like);
+
   // level name
   strncpy(cave->name, level->name, sizeof(GdString));
   cave->name[sizeof(GdString) - 1] = '\0';
@@ -4336,6 +4343,8 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   level->bd_num_skeletons_needed_for_pot= cave->skeletons_needed_for_pot;
   level->bd_skeleton_worth_num_diamonds        = cave->skeletons_worth_diamonds;
 
+  level->bd_expanding_wall_looks_like  = map_element_BD_to_RND_cave(cave->expanding_wall_looks_like);
+
   // level name
   char *cave_name = getStringPrint("%s / %d", cave->name, bd_level_nr + 1);
 
index 61ced8454c0cbb1380cc4b341cb7bdc31680fe29..6ec00ec1ad4189670df34fad38be504c00c2dbb6 100644 (file)
 
 #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_WALL_ANY)
+
+#define IS_BD_EXPANDABLE_STEELWALL(e)  ((e) == EL_BD_EXPANDABLE_STEELWALL_HORIZONTAL ||\
                                         (e) == EL_BD_EXPANDABLE_STEELWALL_VERTICAL ||  \
                                         (e) == EL_BD_EXPANDABLE_STEELWALL_ANY)
 
@@ -3681,6 +3682,7 @@ struct LevelInfo
   int bd_hammer_walls_reappear_delay;  // BD hammer time for reappearing walls (in BD frames)
   int bd_num_skeletons_needed_for_pot; // BD skeletons amount must be collected to use a pot
   int bd_skeleton_worth_num_diamonds;  // BD skeleton collected is worth this number of diamonds
+  int bd_expanding_wall_looks_like;    // BD expanding wall looks like this other game element
 
   boolean em_slippery_gems;            // EM style "gems slip from wall" behaviour
   boolean em_explodes_by_fire;         // EM style chain explosion behaviour