From 83d91d3f8821255e649663935445873c5b11dce1 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Thu, 21 Mar 2024 00:40:44 +0100 Subject: [PATCH] added support for expanding wall settings in BD engine to level editor --- src/editor.c | 16 ++++++++++++++++ src/files.c | 10 ++++++++++ src/main.h | 8 ++++++++ 3 files changed, 34 insertions(+) diff --git a/src/editor.c b/src/editor.c index 2ca3dfba..391aae98 100644 --- a/src/editor.c +++ b/src/editor.c @@ -729,6 +729,7 @@ enum GADGET_ID_BD_VOODOO_DIES_BY_ROCK, GADGET_ID_BD_VOODOO_VANISH_BY_EXPLOSION, GADGET_ID_BD_SLIME_IS_PREDICTABLE, + GADGET_ID_BD_CHANGE_EXPANDING_WALL, GADGET_ID_ENVELOPE_AUTOWRAP, GADGET_ID_ENVELOPE_CENTERED, GADGET_ID_MM_LASER_RED, @@ -1074,6 +1075,7 @@ enum ED_CHECKBUTTON_ID_BD_VOODOO_DIES_BY_ROCK, ED_CHECKBUTTON_ID_BD_VOODOO_VANISH_BY_EXPLOSION, ED_CHECKBUTTON_ID_BD_SLIME_IS_PREDICTABLE, + ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL, ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP, ED_CHECKBUTTON_ID_ENVELOPE_CENTERED, ED_CHECKBUTTON_ID_MM_LASER_RED, @@ -3810,6 +3812,14 @@ static struct NULL, NULL, "Slime is predictable", "Use predictable random numbers" }, + { + ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL, + ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(0), + GADGET_ID_BD_CHANGE_EXPANDING_WALL, GADGET_ID_NONE, + &level.bd_change_expanding_wall, + NULL, NULL, + "Change direction", "Switch horizontal/vertical direction" + }, { ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP, ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1), @@ -11083,6 +11093,7 @@ static boolean checkPropertiesConfig(int element) IS_DF_LASER(element) || IS_PLAYER_ELEMENT(element) || IS_BD_PLAYER_ELEMENT(element) || + IS_BD_EXPANDABLE_WALL(properties_element) || IS_SOKOBAN_OBJECT_OR_FIELD(element) || HAS_EDITOR_CONTENT(element) || CAN_GROW(element) || @@ -11440,6 +11451,11 @@ static void DrawPropertiesConfig(void) MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_STOPS_AMOEBA); } + if (IS_BD_EXPANDABLE_WALL(properties_element)) + { + MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL); + } + // special case: slippery walls option for gems only available in R'n'D game engine if (IS_GEM(properties_element) && level.game_engine_type == GAME_ENGINE_TYPE_RND) MapCheckbuttonGadget(ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS); diff --git a/src/files.c b/src/files.c index 1128b9e0..489565f9 100644 --- a/src/files.c +++ b/src/files.c @@ -742,6 +742,12 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = &li.bd_bladder_converts_by_element, EL_BD_VOODOO_DOLL }, + { + EL_BD_EXPANDABLE_WALL_ANY, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(1), + &li.bd_change_expanding_wall, FALSE + }, + // (the following values are related to various game elements) { @@ -4037,6 +4043,8 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level) cave->bladder_converts_by = map_element_RND_to_BD(level->bd_bladder_converts_by_element); + cave->expanding_wall_changed = level->bd_change_expanding_wall; + // level name strncpy(cave->name, level->name, sizeof(GdString)); cave->name[sizeof(GdString) - 1] = '\0'; @@ -4136,6 +4144,8 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level) level->bd_bladder_converts_by_element = map_element_BD_to_RND(cave->bladder_converts_by); + level->bd_change_expanding_wall = cave->expanding_wall_changed; + // level name char *cave_name = getStringPrint("%s / %d", cave->name, bd_level_nr + 1); diff --git a/src/main.h b/src/main.h index 8f53e89d..13217f50 100644 --- a/src/main.h +++ b/src/main.h @@ -911,6 +911,13 @@ (e) == EL_BD_BITER_LEFT || \ (e) == EL_BD_BITER_DOWN) +#define IS_BD_EXPANDABLE_WALL(e) ((e) == EL_BD_EXPANDABLE_WALL_HORIZONTAL || \ + (e) == EL_BD_EXPANDABLE_WALL_VERTICAL || \ + (e) == EL_BD_EXPANDABLE_WALL_ANY || \ + (e) == EL_BD_EXPANDABLE_STEELWALL_HORIZONTAL ||\ + (e) == EL_BD_EXPANDABLE_STEELWALL_VERTICAL || \ + (e) == EL_BD_EXPANDABLE_STEELWALL_ANY) + #define IS_SOKOBAN_OBJECT_OR_FIELD(e) ((e) == EL_SOKOBAN_OBJECT || \ (e) == EL_SOKOBAN_FIELD_EMPTY || \ (e) == EL_SOKOBAN_FIELD_FULL) @@ -3540,6 +3547,7 @@ struct LevelInfo 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 bd_change_expanding_wall; // BD expanding wall direction is changed if enabled boolean em_slippery_gems; // EM style "gems slip from wall" behaviour boolean em_explodes_by_fire; // EM style chain explosion behaviour -- 2.34.1