extended support for explosion settings in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Mon, 25 Mar 2024 17:31:36 +0000 (18:31 +0100)
committerHolger Schemel <info@artsoft.org>
Mon, 25 Mar 2024 17:31:36 +0000 (18:31 +0100)
src/editor.c
src/files.c
src/main.h

index f2b1485e6065f49e90bb512f52b1db2dcf3c811f..d229a0eb493ebebeeb26ab84dc659a1405352704 100644 (file)
@@ -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 ||
index 71c2c52d857b98200f7c427db7daeedfc56ace6a..a0c0564cb99a1e2215169e8ec59b2a23186a8c00 100644 (file)
@@ -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);
 
index e0dcb0ec5f333d00f356d0957a7226cf9e0a0139..2a630a1e887614d9b5d7cbffa8422f3aa453dae7 100644 (file)
@@ -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