extended support for slime settings in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Sun, 24 Mar 2024 14:20:01 +0000 (15:20 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 24 Mar 2024 14:20:01 +0000 (15:20 +0100)
src/editor.c
src/files.c
src/init.c
src/main.c
src/main.h

index 5420a477979da1fb48a00079652c81789e85d260..68b7e9039ba362e9ebbcf31ddeddf736826cb1ce 100644 (file)
@@ -570,6 +570,12 @@ 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_SLIME_EATS_ELEMENT_1,
+  GADGET_ID_BD_SLIME_CONVERTS_TO_ELEMENT_1,
+  GADGET_ID_BD_SLIME_EATS_ELEMENT_2,
+  GADGET_ID_BD_SLIME_CONVERTS_TO_ELEMENT_2,
+  GADGET_ID_BD_SLIME_EATS_ELEMENT_3,
+  GADGET_ID_BD_SLIME_CONVERTS_TO_ELEMENT_3,
   GADGET_ID_BD_ACID_EATS_ELEMENT,
   GADGET_ID_BD_ACID_TURNS_TO_ELEMENT,
   GADGET_ID_BD_BITER_EATS_ELEMENT,
@@ -1201,6 +1207,12 @@ 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_SLIME_EATS_ELEMENT_1,
+  ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_1,
+  ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_2,
+  ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_2,
+  ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_3,
+  ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_3,
   ED_DRAWING_ID_BD_ACID_EATS_ELEMENT,
   ED_DRAWING_ID_BD_ACID_TURNS_TO_ELEMENT,
   ED_DRAWING_ID_BD_BITER_EATS_ELEMENT,
@@ -3830,7 +3842,7 @@ static struct
   },
   {
     ED_CHECKBUTTON_ID_BD_SLIME_IS_PREDICTABLE,
-    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(0),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
     GADGET_ID_BD_SLIME_IS_PREDICTABLE, GADGET_ID_NONE,
     &level.bd_slime_is_predictable,
     NULL, NULL,
@@ -4470,6 +4482,54 @@ 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_SLIME_EATS_ELEMENT_1,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(5),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_SLIME_EATS_ELEMENT_1, GADGET_ID_NONE,
+    &level.bd_slime_eats_element_1,    1, 1,
+    "Can eat:", NULL, NULL, NULL,      "Element that can be eaten"
+  },
+  {
+    ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_1,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(5),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_SLIME_CONVERTS_TO_ELEMENT_1, GADGET_ID_BD_SLIME_EATS_ELEMENT_1,
+    &level.bd_slime_converts_to_element_1,     1, 1,
+    " and convert to:", NULL, NULL, NULL,      "Eaten element is converted to"
+  },
+  {
+    ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_2,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(6),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_SLIME_EATS_ELEMENT_2, GADGET_ID_NONE,
+    &level.bd_slime_eats_element_2,    1, 1,
+    "Can eat:", NULL, NULL, NULL,      "Element that can be eaten"
+  },
+  {
+    ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_2,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(6),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_SLIME_CONVERTS_TO_ELEMENT_2, GADGET_ID_BD_SLIME_EATS_ELEMENT_2,
+    &level.bd_slime_converts_to_element_2,     1, 1,
+    " and convert to:", NULL, NULL, NULL,      "Eaten element is converted to"
+  },
+  {
+    ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_3,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(7),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_SLIME_EATS_ELEMENT_3, GADGET_ID_NONE,
+    &level.bd_slime_eats_element_3,    1, 1,
+    "Can eat:", NULL, NULL, NULL,      "Element that can be eaten"
+  },
+  {
+    ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_3,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(7),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_SLIME_CONVERTS_TO_ELEMENT_3, GADGET_ID_BD_SLIME_EATS_ELEMENT_3,
+    &level.bd_slime_converts_to_element_3,     1, 1,
+    " and convert to:", NULL, NULL, NULL,      "Eaten element is converted to"
+  },
   {
     ED_DRAWING_ID_BD_ACID_EATS_ELEMENT,
     ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(1),
@@ -11790,6 +11850,13 @@ static void DrawPropertiesConfig(void)
   if (properties_element == EL_BD_SLIME)
   {
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_SLIME_IS_PREDICTABLE);
+
+    MapDrawingArea(ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_1);
+    MapDrawingArea(ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_1);
+    MapDrawingArea(ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_2);
+    MapDrawingArea(ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_2);
+    MapDrawingArea(ED_DRAWING_ID_BD_SLIME_EATS_ELEMENT_3);
+    MapDrawingArea(ED_DRAWING_ID_BD_SLIME_CONVERTS_TO_ELEMENT_3);
   }
 
   if (IS_BD_EXPANDABLE_WALL(properties_element))
index 1b6346906e00f28aa078dee3c5bf4907cd84f315..0e9da238f1c22476a455c9219fd29b015b002ed3 100644 (file)
@@ -743,6 +743,36 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     TYPE_INTEGER,                      CONF_VALUE_32_BIT(1),
     &li.bd_slime_random_seed_c64,      -1
   },
+  {
+    EL_BD_SLIME,                       -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(1),
+    &li.bd_slime_eats_element_1,       EL_BD_DIAMOND
+  },
+  {
+    EL_BD_SLIME,                       -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(2),
+    &li.bd_slime_converts_to_element_1,        EL_BD_DIAMOND_FALLING
+  },
+  {
+    EL_BD_SLIME,                       -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(3),
+    &li.bd_slime_eats_element_2,       EL_BD_ROCK
+  },
+  {
+    EL_BD_SLIME,                       -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(4),
+    &li.bd_slime_converts_to_element_2,        EL_BD_ROCK_FALLING
+  },
+  {
+    EL_BD_SLIME,                       -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(5),
+    &li.bd_slime_eats_element_3,       EL_BD_NUT
+  },
+  {
+    EL_BD_SLIME,                       -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(6),
+    &li.bd_slime_converts_to_element_3,        EL_BD_NUT_FALLING
+  },
 
   {
     EL_BD_ACID,                                -1,
@@ -4111,6 +4141,12 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
   cave->level_slime_permeability_c64[0]        = level->bd_slime_permeability_bits_c64;
   cave->level_slime_seed_c64[0]                = level->bd_slime_random_seed_c64;
   cave->level_rand[0]                  = level->bd_cave_random_seed_c64;
+  cave->slime_eats_1                   = map_element_RND_to_BD_cave(level->bd_slime_eats_element_1);
+  cave->slime_converts_1               = map_element_RND_to_BD_cave(level->bd_slime_converts_to_element_1);
+  cave->slime_eats_2                   = map_element_RND_to_BD_cave(level->bd_slime_eats_element_2);
+  cave->slime_converts_2               = map_element_RND_to_BD_cave(level->bd_slime_converts_to_element_2);
+  cave->slime_eats_3                   = map_element_RND_to_BD_cave(level->bd_slime_eats_element_3);
+  cave->slime_converts_3               = map_element_RND_to_BD_cave(level->bd_slime_converts_to_element_3);
 
   cave->acid_eats_this                 = map_element_RND_to_BD_cave(level->bd_acid_eats_element);
   cave->acid_spread_ratio              = level->bd_acid_spread_rate * 10000;
@@ -4231,6 +4267,12 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   level->bd_slime_permeability_bits_c64        = cave->level_slime_permeability_c64[bd_level_nr];
   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_slime_eats_element_1       = map_element_BD_to_RND_cave(cave->slime_eats_1);
+  level->bd_slime_converts_to_element_1        = map_element_BD_to_RND_cave(cave->slime_converts_1);
+  level->bd_slime_eats_element_2       = map_element_BD_to_RND_cave(cave->slime_eats_2);
+  level->bd_slime_converts_to_element_2        = map_element_BD_to_RND_cave(cave->slime_converts_2);
+  level->bd_slime_eats_element_3       = map_element_BD_to_RND_cave(cave->slime_eats_3);
+  level->bd_slime_converts_to_element_3        = map_element_BD_to_RND_cave(cave->slime_converts_3);
 
   level->bd_acid_eats_element          = map_element_BD_to_RND_cave(cave->acid_eats_this);
   level->bd_acid_spread_rate           = cave->acid_spread_ratio / 10000;
index f7f7d383bcef7593367be358a3a9b36e94510f02..975f1cbce85c7c69d62b4005b1061ad5633c379d 100644 (file)
@@ -4292,6 +4292,7 @@ void InitElementPropertiesStatic(void)
     EL_AMOEBA_FULL,
     EL_BD_AMOEBA,
     EL_BD_AMOEBA_2,
+    EL_BD_SLIME,
     EL_BD_ACID,
     EL_BD_BITER,
     EL_BD_BITER_RIGHT,
index 3c4eea7a3dd98c3ae95616ee82e6580556ef0dff..dd4014bf508e35f8061269fe71ad3703a0467ecf 100644 (file)
@@ -6705,7 +6705,7 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
   {
     "bd_nut",
     "bd_nut",
-    "Nut"
+    "Nut (BD style)"
   },
   {
     "bd_amoeba_2",
index c6b9ab99abc58e884ea99e26465a76b6d352935a..5630efe48b97ede514463ab827e78a7aa58a4d04 100644 (file)
@@ -3656,6 +3656,12 @@ struct LevelInfo
   int bd_slime_permeability_rate;      // BD slime permeability rate for unpredictable slime
   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_slime_eats_element_1;         // BD slime can eat and convert this game element
+  int bd_slime_converts_to_element_1;  // BD slime can convert eaten element to this game element
+  int bd_slime_eats_element_2;         // BD slime can eat and convert this game element
+  int bd_slime_converts_to_element_2;  // BD slime can convert eaten element to this game element
+  int bd_slime_eats_element_3;         // BD slime can eat and convert this game element
+  int bd_slime_converts_to_element_3;  // BD slime can convert eaten element to this game element
   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)