From e5ee3648da48f552b47616247ca6ef447200b333 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 19 Mar 2024 21:47:06 +0100 Subject: [PATCH] added support for acid settings in BD engine to level editor --- src/editor.c | 29 +++++++++++++++++++++++++++++ src/files.c | 24 ++++++++++++++++++++++++ src/init.c | 1 + src/main.h | 4 ++++ 4 files changed, 58 insertions(+) diff --git a/src/editor.c b/src/editor.c index 025de3a7..9345d1b1 100644 --- a/src/editor.c +++ b/src/editor.c @@ -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 || diff --git a/src/files.c b/src/files.c index a150f891..1f1bd843 100644 --- a/src/files.c +++ b/src/files.c @@ -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); diff --git a/src/init.c b/src/init.c index f53022f7..340a00db 100644 --- a/src/init.c +++ b/src/init.c @@ -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, diff --git a/src/main.h b/src/main.h index 36fbdb5c..f65f53c2 100644 --- a/src/main.h +++ b/src/main.h @@ -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 -- 2.34.1