extended support for magic wall settings in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Sun, 24 Mar 2024 13:31:08 +0000 (14:31 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 24 Mar 2024 13:31:13 +0000 (14:31 +0100)
src/editor.c
src/files.c
src/main.c
src/main.h

index 5da47e5ecaccc60da999a2d97af0e0bf1cdf4ff7..54b5373bc63755f1f0c44e7a4b20ba5ff52e39e4 100644 (file)
@@ -557,6 +557,13 @@ enum
   GADGET_ID_ANDROID_CONTENT,
   GADGET_ID_AMOEBA_CONTENT,
   GADGET_ID_BD_SNAP_ELEMENT,
+  GADGET_ID_BD_MAGIC_WALL_DIAMOND_TO,
+  GADGET_ID_BD_MAGIC_WALL_ROCK_TO,
+  GADGET_ID_BD_MAGIC_WALL_MEGA_ROCK_TO,
+  GADGET_ID_BD_MAGIC_WALL_NUT_TO,
+  GADGET_ID_BD_MAGIC_WALL_NITRO_PACK_TO,
+  GADGET_ID_BD_MAGIC_WALL_FLYING_DIAMOND_TO,
+  GADGET_ID_BD_MAGIC_WALL_FLYING_ROCK_TO,
   GADGET_ID_BD_AMOEBA_CONTENT_TOO_BIG,
   GADGET_ID_BD_AMOEBA_CONTENT_ENCLOSED,
   GADGET_ID_BD_AMOEBA_2_CONTENT_TOO_BIG,
@@ -1180,6 +1187,13 @@ enum
   ED_DRAWING_ID_ANDROID_CONTENT,
   ED_DRAWING_ID_AMOEBA_CONTENT,
   ED_DRAWING_ID_BD_SNAP_ELEMENT,
+  ED_DRAWING_ID_BD_MAGIC_WALL_DIAMOND_TO,
+  ED_DRAWING_ID_BD_MAGIC_WALL_ROCK_TO,
+  ED_DRAWING_ID_BD_MAGIC_WALL_MEGA_ROCK_TO,
+  ED_DRAWING_ID_BD_MAGIC_WALL_NUT_TO,
+  ED_DRAWING_ID_BD_MAGIC_WALL_NITRO_PACK_TO,
+  ED_DRAWING_ID_BD_MAGIC_WALL_FLYING_DIAMOND_TO,
+  ED_DRAWING_ID_BD_MAGIC_WALL_FLYING_ROCK_TO,
   ED_DRAWING_ID_BD_AMOEBA_CONTENT_TOO_BIG,
   ED_DRAWING_ID_BD_AMOEBA_CONTENT_ENCLOSED,
   ED_DRAWING_ID_BD_AMOEBA_2_CONTENT_TOO_BIG,
@@ -3742,7 +3756,7 @@ static struct
   },
   {
     ED_CHECKBUTTON_ID_BD_MAGIC_WALL_WAIT_HATCHING,
-    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(1),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(2),
     GADGET_ID_BD_MAGIC_WALL_WAIT_HATCHING, GADGET_ID_NONE,
     &level.bd_magic_wall_wait_hatching,
     NULL, NULL,
@@ -3750,7 +3764,7 @@ static struct
   },
   {
     ED_CHECKBUTTON_ID_BD_MAGIC_WALL_STOPS_AMOEBA,
-    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(2),
+    ED_ELEMENT_SETTINGS_XPOS(0),       ED_ELEMENT_SETTINGS_YPOS(3),
     GADGET_ID_BD_MAGIC_WALL_STOPS_AMOEBA, GADGET_ID_NONE,
     &level.bd_magic_wall_stops_amoeba,
     NULL, NULL,
@@ -4342,6 +4356,65 @@ static struct
     "Snap element:", NULL, NULL, NULL, "Element created when snapping"
   },
 
+  // ---------- BD magic wall elements ----------------------------------------
+
+  {
+    ED_DRAWING_ID_BD_MAGIC_WALL_DIAMOND_TO,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(4),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_MAGIC_WALL_DIAMOND_TO, GADGET_ID_NONE,
+    &level.bd_magic_wall_diamond_to,   1, 1,
+    "Changes diamonds to:", NULL, NULL, NULL,  "Element to turn diamonds to"
+  },
+  {
+    ED_DRAWING_ID_BD_MAGIC_WALL_ROCK_TO,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(5),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_MAGIC_WALL_ROCK_TO, GADGET_ID_NONE,
+    &level.bd_magic_wall_rock_to,      1, 1,
+    "Changes rocks to:", NULL, NULL, NULL,     "Element to turn rocks to"
+  },
+  {
+    ED_DRAWING_ID_BD_MAGIC_WALL_MEGA_ROCK_TO,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(6),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_MAGIC_WALL_MEGA_ROCK_TO, GADGET_ID_NONE,
+    &level.bd_magic_wall_mega_rock_to, 1, 1,
+    "Changes mega rocks to:", NULL, NULL, NULL,        "Element to turn mega rocks to"
+  },
+  {
+    ED_DRAWING_ID_BD_MAGIC_WALL_NUT_TO,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(7),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_MAGIC_WALL_NUT_TO, GADGET_ID_NONE,
+    &level.bd_magic_wall_nut_to,       1, 1,
+    "Changes nuts to:", NULL, NULL, NULL,      "Element to turn nuts to"
+  },
+  {
+    ED_DRAWING_ID_BD_MAGIC_WALL_NITRO_PACK_TO,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(8),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_MAGIC_WALL_NITRO_PACK_TO, GADGET_ID_NONE,
+    &level.bd_magic_wall_nitro_pack_to,        1, 1,
+    "Changes nitro packs to:", NULL, NULL, NULL,       "Element to turn nitro packs to"
+  },
+  {
+    ED_DRAWING_ID_BD_MAGIC_WALL_FLYING_DIAMOND_TO,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(9),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_MAGIC_WALL_FLYING_DIAMOND_TO, GADGET_ID_NONE,
+    &level.bd_magic_wall_flying_diamond_to, 1, 1,
+    "Changes flying diamonds to:", NULL, NULL, NULL,   "Element to turn flying diamonds to"
+  },
+  {
+    ED_DRAWING_ID_BD_MAGIC_WALL_FLYING_ROCK_TO,
+    ED_AREA_1X1_SETTINGS_XPOS(0),      ED_AREA_1X1_SETTINGS_YPOS(10),
+    ED_AREA_1X1_SETTINGS_XOFF,         ED_AREA_1X1_SETTINGS_YOFF,
+    GADGET_ID_BD_MAGIC_WALL_FLYING_ROCK_TO, GADGET_ID_NONE,
+    &level.bd_magic_wall_flying_rock_to, 1, 1,
+    "Changes flying rocks to:", NULL, NULL, NULL,      "Element to turn flying rocks to"
+  },
+
   // ---------- BD amoeba content ---------------------------------------------
 
   {
@@ -11460,6 +11533,10 @@ static void DrawPropertiesConfig(void)
                               (properties_element == EL_EMC_MAGIC_BALL     ? 2 : 0) +
                               num_element_counters);
 
+    // special case: set magic wall counter for BD game engine separately
+    if (properties_element == EL_BD_MAGIC_WALL && level.game_engine_type == GAME_ENGINE_TYPE_BD)
+      counterbutton_info[counter_id].y = ED_ELEMENT_SETTINGS_YPOS(1);
+
     // special case: set amoeba counters for BD game engine separately
     if ((properties_element == EL_BD_AMOEBA && level.game_engine_type == GAME_ENGINE_TYPE_BD) ||
        (properties_element == EL_BD_AMOEBA_2))
@@ -11481,6 +11558,23 @@ static void DrawPropertiesConfig(void)
       break;
   }
 
+  if (properties_element == EL_BD_MAGIC_WALL && level.game_engine_type == GAME_ENGINE_TYPE_BD)
+  {
+    // draw stickybutton gadget
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
+
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_WAIT_HATCHING);
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_STOPS_AMOEBA);
+
+    MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_DIAMOND_TO);
+    MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_ROCK_TO);
+    MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_MEGA_ROCK_TO);
+    MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_NUT_TO);
+    MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_NITRO_PACK_TO);
+    MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_FLYING_DIAMOND_TO);
+    MapDrawingArea(ED_DRAWING_ID_BD_MAGIC_WALL_FLYING_ROCK_TO);
+  }
+
   if (HAS_EDITOR_CONTENT(properties_element))
   {
     // draw stickybutton gadget
@@ -11677,12 +11771,6 @@ static void DrawPropertiesConfig(void)
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_SLIME_IS_PREDICTABLE);
   }
 
-  if (properties_element == EL_BD_MAGIC_WALL)
-  {
-    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_WAIT_HATCHING);
-    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_STOPS_AMOEBA);
-  }
-
   if (IS_BD_EXPANDABLE_WALL(properties_element))
   {
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_CHANGE_EXPANDING_WALL);
index 9fcc9e4054a82127d028973d69a42f78cf145a1e..c7a523f69982e9e55cc5dd60a13c6828a6f99d57 100644 (file)
@@ -655,6 +655,41 @@ static struct LevelFileConfigInfo chunk_config_ELEM[] =
     TYPE_BOOLEAN,                      CONF_VALUE_8_BIT(2),
     &li.bd_magic_wall_stops_amoeba,    TRUE
   },
+  {
+    EL_BD_MAGIC_WALL,                  -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(1),
+    &li.bd_magic_wall_diamond_to,      EL_BD_ROCK_FALLING
+  },
+  {
+    EL_BD_MAGIC_WALL,                  -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(2),
+    &li.bd_magic_wall_rock_to,         EL_BD_DIAMOND_FALLING
+  },
+  {
+    EL_BD_MAGIC_WALL,                  -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(3),
+    &li.bd_magic_wall_mega_rock_to,    EL_BD_NITRO_PACK_FALLING
+  },
+  {
+    EL_BD_MAGIC_WALL,                  -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(4),
+    &li.bd_magic_wall_nut_to,          EL_BD_NUT_FALLING
+  },
+  {
+    EL_BD_MAGIC_WALL,                  -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(5),
+    &li.bd_magic_wall_nitro_pack_to,   EL_BD_MEGA_ROCK_FALLING
+  },
+  {
+    EL_BD_MAGIC_WALL,                  -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(6),
+    &li.bd_magic_wall_flying_diamond_to, EL_BD_FLYING_ROCK_FLYING
+  },
+  {
+    EL_BD_MAGIC_WALL,                  -1,
+    TYPE_ELEMENT,                      CONF_VALUE_16_BIT(7),
+    &li.bd_magic_wall_flying_rock_to,  EL_BD_FLYING_DIAMOND_FLYING
+  },
 
   {
     EL_BD_CLOCK,                       -1,
@@ -4036,6 +4071,15 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
   cave->level_magic_wall_time[0]       = level->time_magic_wall;
   cave->magic_timer_wait_for_hatching  = level->bd_magic_wall_wait_hatching;
   cave->magic_wall_stops_amoeba                = level->bd_magic_wall_stops_amoeba;
+
+  cave->magic_diamond_to               = map_element_RND_to_BD_cave(level->bd_magic_wall_diamond_to);
+  cave->magic_stone_to                 = map_element_RND_to_BD_cave(level->bd_magic_wall_rock_to);
+  cave->magic_mega_stone_to            = map_element_RND_to_BD_cave(level->bd_magic_wall_mega_rock_to);
+  cave->magic_nut_to                   = map_element_RND_to_BD_cave(level->bd_magic_wall_nut_to);
+  cave->magic_nitro_pack_to            = map_element_RND_to_BD_cave(level->bd_magic_wall_nitro_pack_to);
+  cave->magic_flying_diamond_to                = map_element_RND_to_BD_cave(level->bd_magic_wall_flying_diamond_to);
+  cave->magic_flying_stone_to          = map_element_RND_to_BD_cave(level->bd_magic_wall_flying_rock_to);
+
   cave->amoeba_timer_wait_for_hatching = level->bd_amoeba_wait_for_hatching;
   cave->amoeba_timer_started_immediately= level->bd_amoeba_start_immediately;
   cave->amoeba_2_explodes_by_amoeba    = level->bd_amoeba_2_explode_by_amoeba;
@@ -4145,6 +4189,15 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   level->time_magic_wall               = cave->level_magic_wall_time[bd_level_nr];
   level->bd_magic_wall_wait_hatching   = cave->magic_timer_wait_for_hatching;
   level->bd_magic_wall_stops_amoeba    = cave->magic_wall_stops_amoeba;
+
+  level->bd_magic_wall_diamond_to      = map_element_BD_to_RND_cave(cave->magic_diamond_to);
+  level->bd_magic_wall_rock_to         = map_element_BD_to_RND_cave(cave->magic_stone_to);
+  level->bd_magic_wall_mega_rock_to    = map_element_BD_to_RND_cave(cave->magic_mega_stone_to);
+  level->bd_magic_wall_nut_to          = map_element_BD_to_RND_cave(cave->magic_nut_to);
+  level->bd_magic_wall_nitro_pack_to   = map_element_BD_to_RND_cave(cave->magic_nitro_pack_to);
+  level->bd_magic_wall_flying_diamond_to= map_element_BD_to_RND_cave(cave->magic_flying_diamond_to);
+  level->bd_magic_wall_flying_rock_to  = map_element_BD_to_RND_cave(cave->magic_flying_stone_to);
+
   level->bd_amoeba_wait_for_hatching   = cave->amoeba_timer_wait_for_hatching;
   level->bd_amoeba_start_immediately   = cave->amoeba_timer_started_immediately;
   level->bd_amoeba_2_explode_by_amoeba = cave->amoeba_2_explodes_by_amoeba;
index 44d3e11eda341599450383fdbb6c861710928f86..3c4eea7a3dd98c3ae95616ee82e6580556ef0dff 100644 (file)
@@ -6705,7 +6705,7 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
   {
     "bd_nut",
     "bd_nut",
-    "Nut with diamond"
+    "Nut"
   },
   {
     "bd_amoeba_2",
@@ -7165,7 +7165,7 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
   {
     "bd_nut.falling",
     "bd_nut",
-    "Nut with diamond (falling)"
+    "Nut (falling)"
   },
   {
     "bd_falling_wall.falling",
index 6c1408267abbbded15a8949b5e3fed2393ad8979..7191591934a3f0ea634eb5edc7dce246ef804570 100644 (file)
@@ -3620,7 +3620,14 @@ struct LevelInfo
   int bd_pushing_prob_with_sweet;      // BD player probability to push rocks after eating sweet
   boolean bd_push_mega_rock_with_sweet;        // BD player can push mega rocks after eating sweet
   boolean bd_magic_wall_wait_hatching; // BD magic wall waits for player's birth
-  boolean bd_magic_wall_stops_amoeba;  // BD magic wall turns amoeba to diamonds
+  boolean bd_magic_wall_stops_amoeba;  // BD magic wall can stop amoeba and turn to diamonds
+  int bd_magic_wall_diamond_to;                // BD magic wall turns diamonds to specified element
+  int bd_magic_wall_rock_to;           // BD magic wall turns rocks to specified element
+  int bd_magic_wall_mega_rock_to;      // BD magic wall turns mega rocks to specified element
+  int bd_magic_wall_nut_to;            // BD magic wall turns nuts to specified element
+  int bd_magic_wall_nitro_pack_to;     // BD magic wall turns nitro packs to specified element
+  int bd_magic_wall_flying_diamond_to; // BD magic wall turns flying diamonds to specified element
+  int bd_magic_wall_flying_rock_to;    // BD magic wall turns flying rocks to specified element
   boolean bd_amoeba_wait_for_hatching; // BD amoeba waits for player's birth
   boolean bd_amoeba_start_immediately; // BD amoeba growth starts immediately
   boolean bd_amoeba_2_explode_by_amoeba;// BD amoeba 2 explodes if touched by BD amoeba