added support for acid settings in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Tue, 19 Mar 2024 20:47:06 +0000 (21:47 +0100)
committerHolger Schemel <info@artsoft.org>
Tue, 19 Mar 2024 20:47:06 +0000 (21:47 +0100)
src/editor.c
src/files.c
src/init.c
src/main.h

index 025de3a70c1fb5d643c6bdeb8d0c7ea55fd83ea6..9345d1b12862002208ffcfd188218e91e5a4805d 100644 (file)
@@ -563,6 +563,8 @@ enum
   GADGET_ID_BD_AMOEBA_2_CONTENT_ENCLOSED,
   GADGET_ID_BD_AMOEBA_2_CONTENT_EXPLODING,
   GADGET_ID_BD_AMOEBA_2_CONTENT_LOOKS_LIKE,
+  GADGET_ID_BD_ACID_EATS_ELEMENT,
+  GADGET_ID_BD_ACID_TURNS_TO_ELEMENT,
   GADGET_ID_START_ELEMENT,
   GADGET_ID_ARTWORK_ELEMENT,
   GADGET_ID_EXPLOSION_ELEMENT,
@@ -1172,6 +1174,8 @@ enum
   ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_ENCLOSED,
   ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_EXPLODING,
   ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_LOOKS_LIKE,
+  ED_DRAWING_ID_BD_ACID_EATS_ELEMENT,
+  ED_DRAWING_ID_BD_ACID_TURNS_TO_ELEMENT,
   ED_DRAWING_ID_START_ELEMENT,
   ED_DRAWING_ID_ARTWORK_ELEMENT,
   ED_DRAWING_ID_EXPLOSION_ELEMENT,
@@ -4337,6 +4341,22 @@ static struct
     &level.bd_amoeba_2_content_looks_like,     1, 1,
     "use graphic of element:", NULL, NULL, NULL,       "BD amoeba 2 looks like this element"
   },
+  {
+    ED_DRAWING_ID_BD_ACID_EATS_ELEMENT,
+    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_ACID_EATS_ELEMENT,    GADGET_ID_NONE,
+    &level.bd_acid_eats_element,       1, 1,
+    "can eat:", NULL, NULL, NULL,              "eats this element when spreading"
+  },
+  {
+    ED_DRAWING_ID_BD_ACID_TURNS_TO_ELEMENT,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(3),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_ACID_TURNS_TO_ELEMENT,        GADGET_ID_NONE,
+    &level.bd_acid_turns_to_element,   1, 1,
+    "can leave behind:", NULL, NULL, NULL,     "turns to this element after spreading"
+  },
 
   // ---------- level start element -------------------------------------------
 
@@ -10854,6 +10874,7 @@ static void DrawPropertiesInfo(void)
 #define TEXT_PERMEABILITY_RATE "slime permeability rate"
 #define TEXT_PERMEABILITY_BITS "slime permeability bits"
 #define TEXT_RANDOM_SEED       "slime random number seed"
+#define TEXT_ACID_SPREAD_RATE  "Spread rate (percent)"
 
 static struct
 {
@@ -10976,6 +10997,8 @@ static struct
                                0, 255                                                          },
   { EL_BD_SLIME,               &level.bd_slime_random_seed_c64,        TEXT_RANDOM_SEED,
                                -1, 65535                                                       },
+  { EL_BD_ACID,                        &level.bd_acid_spread_rate,             TEXT_ACID_SPREAD_RATE,
+                               0, 100                                                          },
   { EL_EXTRA_TIME,             &level.extra_time,                      TEXT_TIME_BONUS         },
   { EL_TIME_ORB_FULL,          &level.time_orb_time,                   TEXT_TIME_BONUS         },
   { EL_GAME_OF_LIFE,           &level.game_of_life[0],                 TEXT_GAME_OF_LIFE_1,0,8 },
@@ -11158,6 +11181,7 @@ static void DrawPropertiesConfig(void)
                               (MAYBE_DONT_COLLIDE_WITH(properties_element) ? 1 : 0) +
                               (properties_element == EL_BD_VOODOO_DOLL     ? 4 : 0) +
                               (properties_element == EL_BD_SLIME           ? 1 : 0) +
+                              (properties_element == EL_BD_ACID            ? 1 : 0) +
                               (properties_element == EL_EMC_MAGIC_BALL     ? 2 : 0) +
                               num_element_counters);
 
@@ -11208,6 +11232,11 @@ static void DrawPropertiesConfig(void)
     }
     else if (IS_AMOEBOID(properties_element))
       MapDrawingArea(ED_DRAWING_ID_AMOEBA_CONTENT);
+    else if (properties_element == EL_BD_ACID)
+    {
+      MapDrawingArea(ED_DRAWING_ID_BD_ACID_EATS_ELEMENT);
+      MapDrawingArea(ED_DRAWING_ID_BD_ACID_TURNS_TO_ELEMENT);
+    }
     else if (properties_element == EL_YAMYAM ||
             properties_element == EL_YAMYAM_LEFT ||
             properties_element == EL_YAMYAM_RIGHT ||
index a150f89146217d1842a5ab5c32157be031638d14..1f1bd843d166f5d3f7a7ca1aa97ed9242471ffa6 100644 (file)
@@ -709,6 +709,22 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     &li.bd_slime_random_seed_c64,      -1
   },
 
+  {
+    EL_BD_ACID,                                -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(1),
+    &li.bd_acid_eats_element,          EL_BD_SAND
+  },
+  {
+    EL_BD_ACID,                                -1,
+    TYPE_INTEGER,                      CONF_VALUE_8_BIT(1),
+    &li.bd_acid_spread_rate,           3
+  },
+  {
+    EL_BD_ACID,                                -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(2),
+    &li.bd_acid_turns_to_element,      EL_EMPTY
+  },
+
   // (the following values are related to various game elements)
 
   {
@@ -3995,6 +4011,10 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
   cave->level_slime_seed_c64[0]                = level->bd_slime_random_seed_c64;
   cave->level_rand[0]                  = level->bd_cave_random_seed_c64;
 
+  cave->acid_eats_this                 = map_element_RND_to_BD(level->bd_acid_eats_element);
+  cave->acid_spread_ratio              = level->bd_acid_spread_rate * 10000;
+  cave->acid_turns_to                  = map_element_RND_to_BD(level->bd_acid_turns_to_element);
+
   // level name
   strncpy(cave->name, level->name, sizeof(GdString));
   cave->name[sizeof(GdString) - 1] = '\0';
@@ -4085,6 +4105,10 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   level->bd_slime_random_seed_c64      = cave->level_slime_seed_c64[bd_level_nr];
   level->bd_cave_random_seed_c64       = cave->level_rand[bd_level_nr];
 
+  level->bd_acid_eats_element          = map_element_BD_to_RND(cave->acid_eats_this);
+  level->bd_acid_spread_rate           = cave->acid_spread_ratio / 10000;
+  level->bd_acid_turns_to_element      = map_element_BD_to_RND(cave->acid_turns_to);
+
   // level name
   char *cave_name = getStringPrint("%s / %d", cave->name, bd_level_nr + 1);
 
index f53022f7dad8d0d8dc11b572891b85350777f2b8..340a00db3ea9e44a170905b3a05d39e608fe6219 100644 (file)
@@ -4279,6 +4279,7 @@ void InitElementPropertiesStatic(void)
     EL_AMOEBA_FULL,
     EL_BD_AMOEBA,
     EL_BD_AMOEBA_2,
+    EL_BD_ACID,
     EL_EMC_MAGIC_BALL,
     EL_EMC_ANDROID,
     EL_MM_GRAY_BALL,
index 36fbdb5cdc6783ea3700e37caed5cc7860f2e680..f65f53c2cd1c3b4020063c8f9949a8d39e58380e 100644 (file)
@@ -3528,6 +3528,10 @@ struct LevelInfo
   int bd_slime_permeability_bits_c64;  // BD slime permeability bits for predictable slime
   int bd_slime_random_seed_c64;                // BD slime random number seed for predictable slime
   int bd_cave_random_seed_c64;         // BD cave random number seed for predictable slime
+  int bd_acid_eats_element;            // BD acid eats this game element when spreading
+  int bd_acid_spread_rate;             // BD acid probability of spreading (in percent)
+  int bd_acid_turns_to_element;                // BD acid target element after spreading
+
   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