From f86b45bef20957bce2bca71880becbbb145203b1 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 21 Mar 2024 00:26:49 +0100 Subject: [PATCH] added support for bladder settings in BD engine to level editor --- src/editor.c | 14 ++++++++++++++ src/files.c | 10 ++++++++++ src/init.c | 1 + src/main.h | 1 + 4 files changed, 26 insertions(+) diff --git a/src/editor.c b/src/editor.c index 4411b199..2ca3dfba 100644 --- a/src/editor.c +++ b/src/editor.c @@ -566,6 +566,7 @@ enum GADGET_ID_BD_ACID_EATS_ELEMENT, GADGET_ID_BD_ACID_TURNS_TO_ELEMENT, GADGET_ID_BD_BITER_EATS_ELEMENT, + GADGET_ID_BD_BLADDER_CONVERTS_BY_ELEMENT, GADGET_ID_START_ELEMENT, GADGET_ID_ARTWORK_ELEMENT, GADGET_ID_EXPLOSION_ELEMENT, @@ -1178,6 +1179,7 @@ enum ED_DRAWING_ID_BD_ACID_EATS_ELEMENT, ED_DRAWING_ID_BD_ACID_TURNS_TO_ELEMENT, ED_DRAWING_ID_BD_BITER_EATS_ELEMENT, + ED_DRAWING_ID_BD_BLADDER_CONVERTS_BY_ELEMENT, ED_DRAWING_ID_START_ELEMENT, ED_DRAWING_ID_ARTWORK_ELEMENT, ED_DRAWING_ID_EXPLOSION_ELEMENT, @@ -4367,6 +4369,14 @@ static struct &level.bd_biter_eats_element, 1, 1, "Can eat:", NULL, NULL, NULL, "Eats this element when moving" }, + { + ED_DRAWING_ID_BD_BLADDER_CONVERTS_BY_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_BLADDER_CONVERTS_BY_ELEMENT, GADGET_ID_NONE, + &level.bd_bladder_converts_by_element, 1, 1, + "Turns to clock by touching:", NULL, NULL, NULL, "Turns to clock by touching element" + }, // ---------- level start element ------------------------------------------- @@ -11263,6 +11273,10 @@ static void DrawPropertiesConfig(void) { MapDrawingArea(ED_DRAWING_ID_BD_BITER_EATS_ELEMENT); } + else if (properties_element == EL_BD_BLADDER) + { + MapDrawingArea(ED_DRAWING_ID_BD_BLADDER_CONVERTS_BY_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 3f2f69dd..1128b9e0 100644 --- a/src/files.c +++ b/src/files.c @@ -736,6 +736,12 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = &li.bd_biter_eats_element, EL_BD_DIAMOND }, + { + EL_BD_BLADDER, -1, + TYPE_ELEMENT, CONF_VALUE_16_BIT(1), + &li.bd_bladder_converts_by_element, EL_BD_VOODOO_DOLL + }, + // (the following values are related to various game elements) { @@ -4029,6 +4035,8 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level) cave->biter_delay_frame = level->bd_biter_move_delay; cave->biter_eat = map_element_RND_to_BD(level->bd_biter_eats_element); + cave->bladder_converts_by = map_element_RND_to_BD(level->bd_bladder_converts_by_element); + // level name strncpy(cave->name, level->name, sizeof(GdString)); cave->name[sizeof(GdString) - 1] = '\0'; @@ -4126,6 +4134,8 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level) level->bd_biter_move_delay = cave->biter_delay_frame; level->bd_biter_eats_element = map_element_BD_to_RND(cave->biter_eat); + level->bd_bladder_converts_by_element = map_element_BD_to_RND(cave->bladder_converts_by); + // 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 ba509b7b..0233351e 100644 --- a/src/init.c +++ b/src/init.c @@ -4285,6 +4285,7 @@ void InitElementPropertiesStatic(void) EL_BD_BITER_UP, EL_BD_BITER_LEFT, EL_BD_BITER_DOWN, + EL_BD_BLADDER, EL_EMC_MAGIC_BALL, EL_EMC_ANDROID, EL_MM_GRAY_BALL, diff --git a/src/main.h b/src/main.h index cf694a78..8f53e89d 100644 --- a/src/main.h +++ b/src/main.h @@ -3539,6 +3539,7 @@ struct LevelInfo int bd_acid_turns_to_element; // BD acid target element after spreading int bd_biter_move_delay; // BD biter delay between movements (in BD frames) int bd_biter_eats_element; // BD biter eats this game element when moving + int bd_bladder_converts_by_element; // BD bladder converts to clock by touching this element boolean em_slippery_gems; // EM style "gems slip from wall" behaviour boolean em_explodes_by_fire; // EM style chain explosion behaviour -- 2.34.1