From a169289be8b2c03c427dc057e01d78671cc2283d Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 25 Mar 2024 15:33:38 +0100 Subject: [PATCH] extended support for rock/diamond settings in BD engine to level editor --- src/editor.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ src/files.c | 31 +++++++++++++++++++++++++++++++ src/main.h | 4 ++++ 3 files changed, 84 insertions(+) diff --git a/src/editor.c b/src/editor.c index afd58ff7..2e637396 100644 --- a/src/editor.c +++ b/src/editor.c @@ -583,6 +583,10 @@ enum GADGET_ID_BD_NUT_CONTENT, GADGET_ID_BD_EXPANDING_WALL_LOOKS_LIKE, GADGET_ID_BD_SAND_LOOKS_LIKE, + GADGET_ID_BD_ROCK_TURNS_TO_ON_FALLING, + GADGET_ID_BD_ROCK_TURNS_TO_ON_IMPACT, + GADGET_ID_BD_DIAMOND_TURNS_TO_ON_FALLING, + GADGET_ID_BD_DIAMOND_TURNS_TO_ON_IMPACT, GADGET_ID_START_ELEMENT, GADGET_ID_ARTWORK_ELEMENT, GADGET_ID_EXPLOSION_ELEMENT, @@ -1232,6 +1236,10 @@ enum ED_DRAWING_ID_BD_NUT_CONTENT, ED_DRAWING_ID_BD_EXPANDING_WALL_LOOKS_LIKE, ED_DRAWING_ID_BD_SAND_LOOKS_LIKE, + ED_DRAWING_ID_BD_ROCK_TURNS_TO_ON_FALLING, + ED_DRAWING_ID_BD_ROCK_TURNS_TO_ON_IMPACT, + ED_DRAWING_ID_BD_DIAMOND_TURNS_TO_ON_FALLING, + ED_DRAWING_ID_BD_DIAMOND_TURNS_TO_ON_IMPACT, ED_DRAWING_ID_START_ELEMENT, ED_DRAWING_ID_ARTWORK_ELEMENT, ED_DRAWING_ID_EXPLOSION_ELEMENT, @@ -4651,6 +4659,38 @@ static struct &level.bd_sand_looks_like, 1, 1, "Use graphic of element:", NULL, NULL, NULL, "Sand looks like this element" }, + { + ED_DRAWING_ID_BD_ROCK_TURNS_TO_ON_FALLING, + ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(2), + ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF, + GADGET_ID_BD_ROCK_TURNS_TO_ON_FALLING, GADGET_ID_NONE, + &level.bd_rock_turns_to_on_falling, 1, 1, + "Turns to when falling:", NULL, NULL, NULL, "Changes to this when falling starts" + }, + { + ED_DRAWING_ID_BD_ROCK_TURNS_TO_ON_IMPACT, + 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_ROCK_TURNS_TO_ON_IMPACT, GADGET_ID_NONE, + &level.bd_rock_turns_to_on_impact, 1, 1, + "Turns to on impact:", NULL, NULL, NULL, "Changes to this when falling stops" + }, + { + ED_DRAWING_ID_BD_DIAMOND_TURNS_TO_ON_FALLING, + ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(2), + ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF, + GADGET_ID_BD_DIAMOND_TURNS_TO_ON_FALLING, GADGET_ID_NONE, + &level.bd_diamond_turns_to_on_falling, 1, 1, + "Turns to when falling:", NULL, NULL, NULL, "Changes to this when falling starts" + }, + { + ED_DRAWING_ID_BD_DIAMOND_TURNS_TO_ON_IMPACT, + 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_DIAMOND_TURNS_TO_ON_IMPACT, GADGET_ID_NONE, + &level.bd_diamond_turns_to_on_impact, 1, 1, + "Turns to on impact:", NULL, NULL, NULL, "Changes to this when falling stops" + }, // ---------- level start element ------------------------------------------- @@ -11939,6 +11979,15 @@ static void DrawPropertiesConfig(void) MapCounterButtons(ED_COUNTER_ID_BD_PUSHING_PROB); MapCounterButtons(ED_COUNTER_ID_BD_PUSHING_PROB_WITH_SWEET); + + MapDrawingArea(ED_DRAWING_ID_BD_ROCK_TURNS_TO_ON_FALLING); + MapDrawingArea(ED_DRAWING_ID_BD_ROCK_TURNS_TO_ON_IMPACT); + } + + if (properties_element == EL_BD_DIAMOND && level.game_engine_type == GAME_ENGINE_TYPE_BD) + { + MapDrawingArea(ED_DRAWING_ID_BD_DIAMOND_TURNS_TO_ON_FALLING); + MapDrawingArea(ED_DRAWING_ID_BD_DIAMOND_TURNS_TO_ON_IMPACT); } if (properties_element == EL_BD_MEGA_ROCK || diff --git a/src/files.c b/src/files.c index 92dfbcea..67f3f3e1 100644 --- a/src/files.c +++ b/src/files.c @@ -634,11 +634,32 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = &li.bd_snap_element, EL_EMPTY }, + { + EL_BD_ROCK, -1, + TYPE_ELEMENT, CONF_VALUE_16_BIT(1), + &li.bd_rock_turns_to_on_falling, EL_BD_ROCK_FALLING + }, + { + EL_BD_ROCK, -1, + TYPE_ELEMENT, CONF_VALUE_16_BIT(2), + &li.bd_rock_turns_to_on_impact, EL_BD_ROCK + }, + { EL_BD_DIAMOND, -1, TYPE_INTEGER, CONF_VALUE_16_BIT(1), &li.score[SC_DIAMOND_EXTRA], 20 }, + { + EL_BD_DIAMOND, -1, + TYPE_ELEMENT, CONF_VALUE_16_BIT(2), + &li.bd_diamond_turns_to_on_falling, EL_BD_DIAMOND_FALLING + }, + { + EL_BD_DIAMOND, -1, + TYPE_ELEMENT, CONF_VALUE_16_BIT(3), + &li.bd_diamond_turns_to_on_impact, EL_BD_DIAMOND + }, { EL_BD_MAGIC_WALL, -1, @@ -4260,6 +4281,11 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level) cave->gravity_change_time = level->bd_gravity_switch_delay; cave->gravity_affects_all = level->bd_gravity_affects_all; + cave->stone_falling_effect = LEVEL_TO_CAVE(level->bd_rock_turns_to_on_falling); + cave->stone_bouncing_effect = LEVEL_TO_CAVE(level->bd_rock_turns_to_on_impact); + cave->diamond_falling_effect = LEVEL_TO_CAVE(level->bd_diamond_turns_to_on_falling); + cave->diamond_bouncing_effect = LEVEL_TO_CAVE(level->bd_diamond_turns_to_on_impact); + // level name strncpy(cave->name, level->name, sizeof(GdString)); cave->name[sizeof(GdString) - 1] = '\0'; @@ -4404,6 +4430,11 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level) level->bd_gravity_switch_delay = cave->gravity_change_time; level->bd_gravity_affects_all = cave->gravity_affects_all; + level->bd_rock_turns_to_on_falling = CAVE_TO_LEVEL(cave->stone_falling_effect); + level->bd_rock_turns_to_on_impact = CAVE_TO_LEVEL(cave->stone_bouncing_effect); + level->bd_diamond_turns_to_on_falling = CAVE_TO_LEVEL(cave->diamond_falling_effect); + level->bd_diamond_turns_to_on_impact = CAVE_TO_LEVEL(cave->diamond_bouncing_effect); + // 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 0a5f1471..f9624fb8 100644 --- a/src/main.h +++ b/src/main.h @@ -3690,6 +3690,10 @@ struct LevelInfo boolean bd_gravity_switch_active; // BD engine gravity switch starts in active state int bd_gravity_switch_delay; // BD engine gravity change delay for switch (in seconds) boolean bd_gravity_affects_all; // BD engine gravity affects all falling objects + int bd_rock_turns_to_on_falling; // BD rock changes to specified element when falling + int bd_rock_turns_to_on_impact; // BD rock changes to specified element on impact + int bd_diamond_turns_to_on_falling; // BD diamond changes to specified element when falling + int bd_diamond_turns_to_on_impact; // BD diamond changes to specified element on impact boolean em_slippery_gems; // EM style "gems slip from wall" behaviour boolean em_explodes_by_fire; // EM style chain explosion behaviour -- 2.34.1