added support for sand (dirt) settings in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Sun, 24 Mar 2024 23:12:14 +0000 (00:12 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 24 Mar 2024 23:12:30 +0000 (00:12 +0100)
src/editor.c
src/files.c
src/main.h

index a09e20acf2f1307a69d63bad64251abec08f5336..73d2c36f336d13cedc4b39741d0823a8b06670b7 100644 (file)
@@ -582,6 +582,7 @@ enum
   GADGET_ID_BD_BLADDER_CONVERTS_BY_ELEMENT,
   GADGET_ID_BD_NUT_CONTENT,
   GADGET_ID_BD_EXPANDING_WALL_LOOKS_LIKE,
+  GADGET_ID_BD_SAND_LOOKS_LIKE,
   GADGET_ID_START_ELEMENT,
   GADGET_ID_ARTWORK_ELEMENT,
   GADGET_ID_EXPLOSION_ELEMENT,
@@ -1222,6 +1223,7 @@ enum
   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_BD_SAND_LOOKS_LIKE,
   ED_DRAWING_ID_START_ELEMENT,
   ED_DRAWING_ID_ARTWORK_ELEMENT,
   ED_DRAWING_ID_EXPLOSION_ELEMENT,
@@ -4590,6 +4592,14 @@ static struct
     &level.bd_expanding_wall_looks_like,       1, 1,
     "Use graphic of element:", NULL, NULL, NULL,       "Expanding wall looks like this element"
   },
+  {
+    ED_DRAWING_ID_BD_SAND_LOOKS_LIKE,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(0),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_SAND_LOOKS_LIKE, GADGET_ID_NONE,
+    &level.bd_sand_looks_like, 1, 1,
+    "Use graphic of element:", NULL, NULL, NULL,       "Sand looks like this element"
+  },
 
   // ---------- level start element -------------------------------------------
 
@@ -11518,6 +11528,7 @@ static boolean checkPropertiesConfig(int element)
       CAN_GROW(element) ||
       COULD_MOVE_INTO_ACID(element) ||
       MAYBE_DONT_COLLIDE_WITH(element) ||
+      element == EL_BD_SAND ||
       element == EL_BD_ROCK ||
       element == EL_BD_MEGA_ROCK ||
       element == EL_BD_SWEET ||
@@ -11855,6 +11866,11 @@ static void DrawPropertiesConfig(void)
     MapDrawingArea(ED_DRAWING_ID_BD_SNAP_ELEMENT);
   }
 
+  if (properties_element == EL_BD_SAND)
+  {
+    MapDrawingArea(ED_DRAWING_ID_BD_SAND_LOOKS_LIKE);
+  }
+
   if (properties_element == EL_BD_ROCK && level.game_engine_type == GAME_ENGINE_TYPE_BD)
   {
     counterbutton_info[ED_COUNTER_ID_BD_PUSHING_PROB].y =
index 4e70f9eff6490ad413dfc04a731a649e209e06bd..1f01d8bb2dfd262f36cde7a9898a2453f1181b44 100644 (file)
@@ -879,6 +879,12 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     &li.bd_skeleton_worth_num_diamonds,        0
   },
 
+  {
+    EL_BD_SAND,                                -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(1),
+    &li.bd_sand_looks_like,            EL_BD_SAND
+  },
+
   // (the following values are related to various game elements)
 
   {
@@ -4209,6 +4215,7 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
   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);
+  cave->dirt_looks_like                        = map_element_RND_to_BD_cave(level->bd_sand_looks_like);
 
   // level name
   strncpy(cave->name, level->name, sizeof(GdString));
@@ -4344,6 +4351,7 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   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->bd_sand_looks_like            = map_element_BD_to_RND_cave(cave->dirt_looks_like);
 
   // level name
   char *cave_name = getStringPrint("%s / %d", cave->name, bd_level_nr + 1);
index 6ec00ec1ad4189670df34fad38be504c00c2dbb6..2481f3da9eaf5eb1b0cfd579437d63eecdc00fd0 100644 (file)
@@ -3683,6 +3683,7 @@ struct LevelInfo
   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
+  int bd_sand_looks_like;              // BD sand 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