From b42a6c7424acfeb34020e22df4fd984fc5f2eb2e Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 24 Mar 2024 19:48:57 +0100 Subject: [PATCH] added support for pneumatic hammer settings in BD engine to level editor --- src/editor.c | 25 +++++++++++++++++++++++++ src/files.c | 24 ++++++++++++++++++++++++ src/main.h | 3 +++ 3 files changed, 52 insertions(+) diff --git a/src/editor.c b/src/editor.c index 68b7e903..fe03baf3 100644 --- a/src/editor.c +++ b/src/editor.c @@ -748,6 +748,7 @@ enum GADGET_ID_BD_CONVEYOR_BELTS_ACTIVE, GADGET_ID_BD_CONVEYOR_BELTS_CHANGED, GADGET_ID_BD_WATER_CANNOT_FLOW_DOWN, + GADGET_ID_BD_HAMMER_WALLS_REAPPEAR, GADGET_ID_ENVELOPE_AUTOWRAP, GADGET_ID_ENVELOPE_CENTERED, GADGET_ID_MM_LASER_RED, @@ -1098,6 +1099,7 @@ enum ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_ACTIVE, ED_CHECKBUTTON_ID_BD_CONVEYOR_BELTS_CHANGED, ED_CHECKBUTTON_ID_BD_WATER_CANNOT_FLOW_DOWN, + ED_CHECKBUTTON_ID_BD_HAMMER_WALLS_REAPPEAR, ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP, ED_CHECKBUTTON_ID_ENVELOPE_CENTERED, ED_CHECKBUTTON_ID_MM_LASER_RED, @@ -3888,6 +3890,14 @@ static struct NULL, NULL, "Does not flow downwards", "Water can only flow up, left and right" }, + { + ED_CHECKBUTTON_ID_BD_HAMMER_WALLS_REAPPEAR, + ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1), + GADGET_ID_BD_HAMMER_WALLS_REAPPEAR, GADGET_ID_NONE, + &level.bd_hammer_walls_reappear, + NULL, NULL, + "Hammered walls reappear", "Hammered walls reappear after delay" + }, { ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP, ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(1), @@ -11287,6 +11297,8 @@ static void DrawPropertiesInfo(void) #define TEXT_ACID_SPREAD_RATE "Spread rate (percent)" #define TEXT_BITER_MOVE_DELAY "Move delay (BD frames)" #define TEXT_REPLICATION_DELAY "Create delay (BD frames)" +#define TEXT_HAMMER_BREAK_DELAY "Delay for breaking walls" +#define TEXT_HAMMER_REAPPEAR_DELAY "Delay for reappearing walls" static struct { @@ -11423,6 +11435,10 @@ static struct 0, 3 }, { EL_BD_REPLICATOR, &level.bd_replicator_create_delay, TEXT_REPLICATION_DELAY, 0, 100 }, + { EL_BD_PNEUMATIC_HAMMER, &level.bd_hammer_walls_break_delay, TEXT_HAMMER_BREAK_DELAY, + 1, 100 }, + { EL_BD_PNEUMATIC_HAMMER, &level.bd_hammer_walls_reappear_delay, TEXT_HAMMER_REAPPEAR_DELAY, + 1, 200 }, { 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 }, @@ -11623,6 +11639,10 @@ static void DrawPropertiesConfig(void) (properties_element == EL_BD_AMOEBA_2)) counterbutton_info[counter_id].y = ED_ELEMENT_SETTINGS_YPOS(3 + num_element_counters); + // special case: set position for delay counter for reappearing hammered walls + if (properties_element == EL_BD_PNEUMATIC_HAMMER && num_element_counters > 0) + counterbutton_info[counter_id].y += 1; + counterbutton_info[counter_id].value = elements_with_counter[i].value; counterbutton_info[counter_id].text_right = elements_with_counter[i].text; counterbutton_info[counter_id].min_value = elements_with_counter[i].min_value; @@ -11881,6 +11901,11 @@ static void DrawPropertiesConfig(void) MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_WATER_CANNOT_FLOW_DOWN); } + if (properties_element == EL_BD_PNEUMATIC_HAMMER) + { + MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_HAMMER_WALLS_REAPPEAR); + } + if (properties_element == EL_BD_NUT) { MapDrawingArea(ED_DRAWING_ID_BD_NUT_CONTENT); diff --git a/src/files.c b/src/files.c index 0e9da238..be20c5b2 100644 --- a/src/files.c +++ b/src/files.c @@ -847,6 +847,22 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = &li.bd_nut_content, EL_BD_NUT_BREAKING_1 }, + { + EL_BD_PNEUMATIC_HAMMER, -1, + TYPE_INTEGER, CONF_VALUE_8_BIT(1), + &li.bd_hammer_walls_break_delay, 5 + }, + { + EL_BD_PNEUMATIC_HAMMER, -1, + TYPE_BOOLEAN, CONF_VALUE_8_BIT(2), + &li.bd_hammer_walls_reappear, FALSE + }, + { + EL_BD_PNEUMATIC_HAMMER, -1, + TYPE_INTEGER, CONF_VALUE_8_BIT(3), + &li.bd_hammer_walls_reappear_delay, 100 + }, + // (the following values are related to various game elements) { @@ -4169,6 +4185,10 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level) cave->nut_turns_to_when_crushed = map_element_RND_to_BD_cave(level->bd_nut_content); + cave->pneumatic_hammer_frame = level->bd_hammer_walls_break_delay; + cave->hammered_walls_reappear = level->bd_hammer_walls_reappear; + cave->hammered_wall_reappear_frame = level->bd_hammer_walls_reappear_delay; + // level name strncpy(cave->name, level->name, sizeof(GdString)); cave->name[sizeof(GdString) - 1] = '\0'; @@ -4295,6 +4315,10 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level) level->bd_nut_content = map_element_BD_to_RND_cave(cave->nut_turns_to_when_crushed); + level->bd_hammer_walls_break_delay = cave->pneumatic_hammer_frame; + level->bd_hammer_walls_reappear = cave->hammered_walls_reappear; + level->bd_hammer_walls_reappear_delay = cave->hammered_wall_reappear_frame; + // 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 5630efe4..e89e2d1f 100644 --- a/src/main.h +++ b/src/main.h @@ -3676,6 +3676,9 @@ struct LevelInfo boolean bd_conveyor_belts_changed; // BD conveyor belts direction is changed if enabled boolean bd_water_cannot_flow_down; // BD water does not flow downwards if enabled boolean bd_nut_content; // BD nut contains the specified game element + int bd_hammer_walls_break_delay; // BD hammer time for breaking walls (in BD frames) + boolean bd_hammer_walls_reappear; // BD hammered walls are reappearing after some delay + int bd_hammer_walls_reappear_delay; // BD hammer time for reappearing walls (in BD frames) boolean em_slippery_gems; // EM style "gems slip from wall" behaviour boolean em_explodes_by_fire; // EM style chain explosion behaviour -- 2.34.1