From ae07939fdbf2fa154d9ba2c57685c5d765c12eec Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 24 Mar 2024 15:20:01 +0100 Subject: [PATCH] extended support for slime settings in BD engine to level editor --- src/editor.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++- src/files.c | 42 ++++++++++++++++++++++++++++++++ src/init.c | 1 + src/main.c | 2 +- src/main.h | 6 +++++ 5 files changed, 118 insertions(+), 2 deletions(-) diff --git a/src/editor.c b/src/editor.c index 5420a477..68b7e903 100644 --- a/src/editor.c +++ b/src/editor.c @@ -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)) diff --git a/src/files.c b/src/files.c index 1b634690..0e9da238 100644 --- a/src/files.c +++ b/src/files.c @@ -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; diff --git a/src/init.c b/src/init.c index f7f7d383..975f1cbc 100644 --- a/src/init.c +++ b/src/init.c @@ -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, diff --git a/src/main.c b/src/main.c index 3c4eea7a..dd4014bf 100644 --- a/src/main.c +++ b/src/main.c @@ -6705,7 +6705,7 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] = { "bd_nut", "bd_nut", - "Nut" + "Nut (BD style)" }, { "bd_amoeba_2", diff --git a/src/main.h b/src/main.h index c6b9ab99..5630efe4 100644 --- a/src/main.h +++ b/src/main.h @@ -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) -- 2.34.1