added support for pneumatic hammer settings in BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Sun, 24 Mar 2024 18:48:57 +0000 (19:48 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 24 Mar 2024 18:48:59 +0000 (19:48 +0100)
src/editor.c
src/files.c
src/main.h

index 68b7e9039ba362e9ebbcf31ddeddf736826cb1ce..fe03baf3b22c1652331d69191bcd3e3942f70ce6 100644 (file)
@@ -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);
index 0e9da238f1c22476a455c9219fd29b015b002ed3..be20c5b2643798682446afc4bb30ed8b9d8057e4 100644 (file)
@@ -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);
 
index 5630efe48b97ede514463ab827e78a7aa58a4d04..e89e2d1f15aa1611f8e70e5b1109e86c83c95dfc 100644 (file)
@@ -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