From ab1bba1943ba57ced8771804b322f371c295bb9e Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 25 Mar 2024 18:31:36 +0100 Subject: [PATCH] extended support for explosion settings in BD engine to level editor --- src/editor.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/files.c | 34 ++++++++++++++++++++++++++ src/main.h | 4 ++++ 3 files changed, 105 insertions(+) diff --git a/src/editor.c b/src/editor.c index f2b1485e..d229a0eb 100644 --- a/src/editor.c +++ b/src/editor.c @@ -593,6 +593,10 @@ enum GADGET_ID_BD_BUTTERFLY_2_EXPLODES_TO, GADGET_ID_BD_STONEFLY_EXPLODES_TO, GADGET_ID_BD_DRAGONFLY_EXPLODES_TO, + GADGET_ID_BD_DIAMOND_BIRTH_TURNS_TO, + GADGET_ID_BD_BOMB_EXPLOSION_TURNS_TO, + GADGET_ID_BD_NITRO_EXPLOSION_TURNS_TO, + GADGET_ID_BD_EXPLOSION_TURNS_TO, GADGET_ID_START_ELEMENT, GADGET_ID_ARTWORK_ELEMENT, GADGET_ID_EXPLOSION_ELEMENT, @@ -1252,6 +1256,10 @@ enum ED_DRAWING_ID_BD_BUTTERFLY_2_EXPLODES_TO, ED_DRAWING_ID_BD_STONEFLY_EXPLODES_TO, ED_DRAWING_ID_BD_DRAGONFLY_EXPLODES_TO, + ED_DRAWING_ID_BD_DIAMOND_BIRTH_TURNS_TO, + ED_DRAWING_ID_BD_BOMB_EXPLOSION_TURNS_TO, + ED_DRAWING_ID_BD_NITRO_EXPLOSION_TURNS_TO, + ED_DRAWING_ID_BD_EXPLOSION_TURNS_TO, ED_DRAWING_ID_START_ELEMENT, ED_DRAWING_ID_ARTWORK_ELEMENT, ED_DRAWING_ID_EXPLOSION_ELEMENT, @@ -4751,6 +4759,38 @@ static struct &level.bd_dragonfly_explodes_to, 1, 1, "Explodes to:", NULL, NULL, NULL, "Changes to this when exploding" }, + { + ED_DRAWING_ID_BD_DIAMOND_BIRTH_TURNS_TO, + 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_DIAMOND_BIRTH_TURNS_TO, GADGET_ID_NONE, + &level.bd_diamond_birth_turns_to, 1, 1, + "Explosion ends in:", NULL, NULL, NULL, "Changes to this after explosion" + }, + { + ED_DRAWING_ID_BD_BOMB_EXPLOSION_TURNS_TO, + ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(0), + ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF, + GADGET_ID_BD_BOMB_EXPLOSION_TURNS_TO, GADGET_ID_NONE, + &level.bd_bomb_explosion_turns_to, 1, 1, + "Explosion ends in:", NULL, NULL, NULL, "Changes to this after explosion" + }, + { + ED_DRAWING_ID_BD_NITRO_EXPLOSION_TURNS_TO, + ED_AREA_1X1_SETTINGS_XPOS(0), ED_AREA_1X1_SETTINGS_YPOS(0), + ED_AREA_1X1_SETTINGS_XOFF, ED_AREA_1X1_SETTINGS_YOFF, + GADGET_ID_BD_NITRO_EXPLOSION_TURNS_TO, GADGET_ID_NONE, + &level.bd_nitro_explosion_turns_to, 1, 1, + "Explosion ends in:", NULL, NULL, NULL, "Changes to this after explosion" + }, + { + ED_DRAWING_ID_BD_EXPLOSION_TURNS_TO, + 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_EXPLOSION_TURNS_TO, GADGET_ID_NONE, + &level.bd_explosion_turns_to, 1, 1, + "Explosion ends in:", NULL, NULL, NULL, "Changes to this after explosion" + }, // ---------- level start element ------------------------------------------- @@ -11693,6 +11733,8 @@ static boolean checkPropertiesConfig(int element) element == EL_BD_SAND || element == EL_BD_ROCK || element == EL_BD_MEGA_ROCK || + element == EL_BD_BOMB || + element == EL_BD_NITRO_PACK || element == EL_BD_SWEET || element == EL_BD_VOODOO_DOLL || element == EL_BD_WATER || @@ -12067,17 +12109,42 @@ static void DrawPropertiesConfig(void) if (level.game_engine_type == GAME_ENGINE_TYPE_BD) { if (IS_BD_FIREFLY(properties_element)) + { MapDrawingArea(ED_DRAWING_ID_BD_FIREFLY_EXPLODES_TO); + MapDrawingArea(ED_DRAWING_ID_BD_EXPLOSION_TURNS_TO); + } else if (IS_BD_FIREFLY_2(properties_element)) + { MapDrawingArea(ED_DRAWING_ID_BD_FIREFLY_2_EXPLODES_TO); + MapDrawingArea(ED_DRAWING_ID_BD_EXPLOSION_TURNS_TO); + } else if (IS_BD_BUTTERFLY(properties_element)) + { MapDrawingArea(ED_DRAWING_ID_BD_BUTTERFLY_EXPLODES_TO); + MapDrawingArea(ED_DRAWING_ID_BD_DIAMOND_BIRTH_TURNS_TO); + } else if (IS_BD_BUTTERFLY_2(properties_element)) + { MapDrawingArea(ED_DRAWING_ID_BD_BUTTERFLY_2_EXPLODES_TO); + MapDrawingArea(ED_DRAWING_ID_BD_DIAMOND_BIRTH_TURNS_TO); + } else if (IS_BD_STONEFLY(properties_element)) + { MapDrawingArea(ED_DRAWING_ID_BD_STONEFLY_EXPLODES_TO); + } else if (IS_BD_DRAGONFLY(properties_element)) + { MapDrawingArea(ED_DRAWING_ID_BD_DRAGONFLY_EXPLODES_TO); + MapDrawingArea(ED_DRAWING_ID_BD_EXPLOSION_TURNS_TO); + } + else if (properties_element == EL_BD_BOMB) + { + MapDrawingArea(ED_DRAWING_ID_BD_BOMB_EXPLOSION_TURNS_TO); + } + else if (properties_element == EL_BD_NITRO_PACK) + { + MapDrawingArea(ED_DRAWING_ID_BD_NITRO_EXPLOSION_TURNS_TO); + } } if (properties_element == EL_BD_MEGA_ROCK || diff --git a/src/files.c b/src/files.c index 71c2c52d..a0c0564c 100644 --- a/src/files.c +++ b/src/files.c @@ -703,6 +703,30 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] = &li.bd_dragonfly_explodes_to, EL_BD_EXPLODING_1 }, + { + EL_BD_DIAMOND_GROWING_5, -1, + TYPE_ELEMENT, CONF_VALUE_16_BIT(1), + &li.bd_diamond_birth_turns_to, EL_BD_DIAMOND + }, + + { + EL_BD_BOMB_EXPLODING_4, -1, + TYPE_ELEMENT, CONF_VALUE_16_BIT(1), + &li.bd_bomb_explosion_turns_to, EL_BD_WALL + }, + + { + EL_BD_NITRO_PACK_EXPLODING_4, -1, + TYPE_ELEMENT, CONF_VALUE_16_BIT(1), + &li.bd_nitro_explosion_turns_to, EL_EMPTY + }, + + { + EL_BD_EXPLODING_5, -1, + TYPE_ELEMENT, CONF_VALUE_16_BIT(1), + &li.bd_explosion_turns_to, EL_EMPTY + }, + { EL_BD_MAGIC_WALL, -1, TYPE_BOOLEAN, CONF_VALUE_8_BIT(1), @@ -4329,6 +4353,11 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level) cave->stonefly_explode_to = LEVEL_TO_CAVE(level->bd_stonefly_explodes_to); cave->dragonfly_explode_to = LEVEL_TO_CAVE(level->bd_dragonfly_explodes_to); + cave->diamond_birth_effect = LEVEL_TO_CAVE(level->bd_diamond_birth_turns_to); + cave->bomb_explosion_effect = LEVEL_TO_CAVE(level->bd_bomb_explosion_turns_to); + cave->nitro_explosion_effect = LEVEL_TO_CAVE(level->bd_nitro_explosion_turns_to); + cave->explosion_effect = LEVEL_TO_CAVE(level->bd_explosion_turns_to); + // level name strncpy(cave->name, level->name, sizeof(GdString)); cave->name[sizeof(GdString) - 1] = '\0'; @@ -4485,6 +4514,11 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level) level->bd_stonefly_explodes_to = CAVE_TO_LEVEL(cave->stonefly_explode_to); level->bd_dragonfly_explodes_to = CAVE_TO_LEVEL(cave->dragonfly_explode_to); + level->bd_diamond_birth_turns_to = CAVE_TO_LEVEL(cave->diamond_birth_effect); + level->bd_bomb_explosion_turns_to = CAVE_TO_LEVEL(cave->bomb_explosion_effect); + level->bd_nitro_explosion_turns_to = CAVE_TO_LEVEL(cave->nitro_explosion_effect); + level->bd_explosion_turns_to = CAVE_TO_LEVEL(cave->explosion_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 e0dcb0ec..2a630a1e 100644 --- a/src/main.h +++ b/src/main.h @@ -3736,6 +3736,10 @@ struct LevelInfo int bd_butterfly_2_explodes_to; // BD butterfly 2 explodes to specified element int bd_stonefly_explodes_to; // BD stonefly explodes to specified element int bd_dragonfly_explodes_to; // BD dragonfly explodes to specified element + int bd_diamond_birth_turns_to; // BD diamond birth changes to specified element + int bd_bomb_explosion_turns_to; // BD bomb explosion changes to specified element + int bd_nitro_explosion_turns_to; // BD nitro pack explosion changes to specified element + int bd_explosion_turns_to; // BD other explosions change to specified 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