added option for magic wall timer of zero for native BD engine
authorHolger Schemel <info@artsoft.org>
Tue, 2 Apr 2024 08:43:47 +0000 (10:43 +0200)
committerHolger Schemel <info@artsoft.org>
Tue, 2 Apr 2024 08:43:47 +0000 (10:43 +0200)
src/editor.c
src/files.c
src/game_bd/bd_c64import.c
src/game_bd/bd_cave.h
src/game_bd/bd_cavedb.c
src/game_bd/bd_caveengine.c
src/main.h

index 54ef18b83ddfca8704f17fcd30b37850e2f2cef8..a91aba1d93ac3ea7e1dfe1429723b27b024cbdf9 100644 (file)
@@ -749,6 +749,7 @@ enum
   GADGET_ID_BD_DIAGONAL_MOVEMENTS,
   GADGET_ID_BD_TOPMOST_PLAYER_ACTIVE,
   GADGET_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET,
+  GADGET_ID_BD_MAGIC_WALL_ZERO_INFINITE,
   GADGET_ID_BD_MAGIC_WALL_WAIT_HATCHING,
   GADGET_ID_BD_MAGIC_WALL_STOPS_AMOEBA,
   GADGET_ID_BD_AMOEBA_WAIT_FOR_HATCHING,
@@ -1105,6 +1106,7 @@ enum
   ED_CHECKBUTTON_ID_BD_DIAGONAL_MOVEMENTS,
   ED_CHECKBUTTON_ID_BD_TOPMOST_PLAYER_ACTIVE,
   ED_CHECKBUTTON_ID_BD_PUSH_MEGA_ROCK_WITH_SWEET,
+  ED_CHECKBUTTON_ID_BD_MAGIC_WALL_ZERO_INFINITE,
   ED_CHECKBUTTON_ID_BD_MAGIC_WALL_WAIT_HATCHING,
   ED_CHECKBUTTON_ID_BD_MAGIC_WALL_STOPS_AMOEBA,
   ED_CHECKBUTTON_ID_BD_AMOEBA_WAIT_FOR_HATCHING,
@@ -3824,8 +3826,16 @@ static struct
     "Mega rocks pushable with sweet",          "Push mega rocks after eating sweet"
   },
   {
-    ED_CHECKBUTTON_ID_BD_MAGIC_WALL_WAIT_HATCHING,
+    ED_CHECKBUTTON_ID_BD_MAGIC_WALL_ZERO_INFINITE,
     ED_ELEMENT_SETTINGS_XPOS(0),               ED_ELEMENT_SETTINGS_YPOS(2),
+    GADGET_ID_BD_MAGIC_WALL_ZERO_INFINITE,     GADGET_ID_NONE,
+    &level.bd_magic_wall_zero_infinite,
+    NULL, NULL,
+    "Run forever if duration is zero",         "Run infinitely if timer is zero"
+  },
+  {
+    ED_CHECKBUTTON_ID_BD_MAGIC_WALL_WAIT_HATCHING,
+    ED_ELEMENT_SETTINGS_XPOS(0),               ED_ELEMENT_SETTINGS_YPOS(3),
     GADGET_ID_BD_MAGIC_WALL_WAIT_HATCHING,     GADGET_ID_NONE,
     &level.bd_magic_wall_wait_hatching,
     NULL, NULL,
@@ -3833,7 +3843,7 @@ static struct
   },
   {
     ED_CHECKBUTTON_ID_BD_MAGIC_WALL_STOPS_AMOEBA,
-    ED_ELEMENT_SETTINGS_XPOS(0),               ED_ELEMENT_SETTINGS_YPOS(3),
+    ED_ELEMENT_SETTINGS_XPOS(0),               ED_ELEMENT_SETTINGS_YPOS(4),
     GADGET_ID_BD_MAGIC_WALL_STOPS_AMOEBA,      GADGET_ID_NONE,
     &level.bd_magic_wall_stops_amoeba,
     NULL, NULL,
@@ -4477,7 +4487,7 @@ static struct
 
   {
     ED_DRAWING_ID_BD_MAGIC_WALL_DIAMOND_TO,
-    ED_AREA_1X1_SETTINGS_XPOS(0),              ED_AREA_1X1_SETTINGS_YPOS(4),
+    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_DIAMOND_TO,                GADGET_ID_NONE,
     &level.bd_magic_wall_diamond_to,           1, 1,
@@ -4485,7 +4495,7 @@ static struct
   },
   {
     ED_DRAWING_ID_BD_MAGIC_WALL_ROCK_TO,
-    ED_AREA_1X1_SETTINGS_XPOS(0),              ED_AREA_1X1_SETTINGS_YPOS(5),
+    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_ROCK_TO,           GADGET_ID_NONE,
     &level.bd_magic_wall_rock_to,              1, 1,
@@ -4493,7 +4503,7 @@ static struct
   },
   {
     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_XPOS(0),              ED_AREA_1X1_SETTINGS_YPOS(7),
     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,
@@ -4501,7 +4511,7 @@ static struct
   },
   {
     ED_DRAWING_ID_BD_MAGIC_WALL_NUT_TO,
-    ED_AREA_1X1_SETTINGS_XPOS(0),              ED_AREA_1X1_SETTINGS_YPOS(7),
+    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_NUT_TO,            GADGET_ID_NONE,
     &level.bd_magic_wall_nut_to,               1, 1,
@@ -4509,7 +4519,7 @@ static struct
   },
   {
     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_XPOS(0),              ED_AREA_1X1_SETTINGS_YPOS(9),
     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,
@@ -4517,7 +4527,7 @@ static struct
   },
   {
     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_XPOS(0),              ED_AREA_1X1_SETTINGS_YPOS(10),
     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,
@@ -4525,7 +4535,7 @@ static struct
   },
   {
     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_XPOS(0),              ED_AREA_1X1_SETTINGS_YPOS(11),
     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,
@@ -11925,6 +11935,7 @@ static void DrawPropertiesConfig(void)
     // draw stickybutton gadget
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_STICK_ELEMENT);
 
+    MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_ZERO_INFINITE);
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_WAIT_HATCHING);
     MapCheckbuttonGadget(ED_CHECKBUTTON_ID_BD_MAGIC_WALL_STOPS_AMOEBA);
 
index cf35328611c6f57ced6a641035bd02ae00eff9bf..25943b63f123b597870bcc4a56141b6d48997023 100644 (file)
@@ -737,6 +737,11 @@ 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_BOOLEAN,                      CONF_VALUE_8_BIT(3),
+    &li.bd_magic_wall_zero_infinite,   TRUE
+  },
   {
     EL_BD_MAGIC_WALL,                  -1,
     TYPE_ELEMENT,                      CONF_VALUE_16_BIT(1),
@@ -4264,6 +4269,7 @@ static void CopyNativeLevel_RND_to_BD(struct LevelInfo *level)
   cave->voodoo_disappear_in_explosion  = level->bd_voodoo_vanish_by_explosion;
   cave->level_penalty_time[0]          = level->bd_voodoo_penalty_time;
   cave->level_magic_wall_time[0]       = level->time_magic_wall;
+  cave->magic_timer_zero_is_infinite   = level->bd_magic_wall_zero_infinite;
   cave->magic_timer_wait_for_hatching  = level->bd_magic_wall_wait_hatching;
   cave->magic_wall_stops_amoeba                = level->bd_magic_wall_stops_amoeba;
 
@@ -4427,6 +4433,7 @@ static void CopyNativeLevel_BD_to_RND(struct LevelInfo *level)
   level->bd_voodoo_vanish_by_explosion = cave->voodoo_disappear_in_explosion;
   level->bd_voodoo_penalty_time                = cave->level_penalty_time[bd_level_nr];
   level->time_magic_wall               = cave->level_magic_wall_time[bd_level_nr];
+  level->bd_magic_wall_zero_infinite   = cave->magic_timer_zero_is_infinite;
   level->bd_magic_wall_wait_hatching   = cave->magic_timer_wait_for_hatching;
   level->bd_magic_wall_stops_amoeba    = cave->magic_wall_stops_amoeba;
 
index 8ff3e1834e32e512a6f8714693a7ede83d63c5d9..61486da72d855af6564beb56174f165116e78a60 100644 (file)
@@ -221,6 +221,7 @@ GdPropertyDefault gd_defaults_bd1[] =
   {CAVE_OFFSET(intermission_instantlife), TRUE},
   {CAVE_OFFSET(intermission_rewardlife), FALSE},
   {CAVE_OFFSET(magic_wall_stops_amoeba), TRUE},
+  {CAVE_OFFSET(magic_timer_zero_is_infinite), TRUE},
   {CAVE_OFFSET(magic_timer_wait_for_hatching), FALSE},
   {CAVE_OFFSET(pushing_stone_prob), 250000},
   {CAVE_OFFSET(pushing_stone_prob_sweet), 1000000},
@@ -257,6 +258,7 @@ GdPropertyDefault gd_defaults_bd2[] =
   {CAVE_OFFSET(intermission_instantlife), TRUE},
   {CAVE_OFFSET(intermission_rewardlife), FALSE},
   {CAVE_OFFSET(magic_wall_stops_amoeba), FALSE},    // marek roth bd inside faq 3.0
+  {CAVE_OFFSET(magic_timer_zero_is_infinite), TRUE},
   {CAVE_OFFSET(magic_timer_wait_for_hatching), FALSE},
   {CAVE_OFFSET(pushing_stone_prob), 250000},
   {CAVE_OFFSET(pushing_stone_prob_sweet), 1000000},
@@ -293,6 +295,7 @@ GdPropertyDefault gd_defaults_plck[] =
   {CAVE_OFFSET(intermission_instantlife), TRUE},
   {CAVE_OFFSET(intermission_rewardlife), FALSE},
   {CAVE_OFFSET(magic_wall_stops_amoeba), FALSE},
+  {CAVE_OFFSET(magic_timer_zero_is_infinite), TRUE},
   {CAVE_OFFSET(magic_timer_wait_for_hatching), FALSE},
   {CAVE_OFFSET(pushing_stone_prob), 250000},
   {CAVE_OFFSET(pushing_stone_prob_sweet), 1000000},
@@ -323,6 +326,7 @@ GdPropertyDefault gd_defaults_1stb[] =
   {CAVE_OFFSET(level_hatching_delay_time[0]), 2},
   {CAVE_OFFSET(intermission_instantlife), FALSE},
   {CAVE_OFFSET(intermission_rewardlife), TRUE},
+  {CAVE_OFFSET(magic_timer_zero_is_infinite), TRUE},
   {CAVE_OFFSET(magic_timer_wait_for_hatching), TRUE},
   {CAVE_OFFSET(pushing_stone_prob), 250000},
   {CAVE_OFFSET(pushing_stone_prob_sweet), 1000000},
@@ -356,6 +360,7 @@ GdPropertyDefault gd_defaults_crdr_7[] =
   {CAVE_OFFSET(level_hatching_delay_time[0]), 2},
   {CAVE_OFFSET(intermission_instantlife), FALSE},
   {CAVE_OFFSET(intermission_rewardlife), TRUE},
+  {CAVE_OFFSET(magic_timer_zero_is_infinite), FALSE},
   {CAVE_OFFSET(magic_timer_wait_for_hatching), TRUE},
   {CAVE_OFFSET(pushing_stone_prob), 250000},
   {CAVE_OFFSET(pushing_stone_prob_sweet), 1000000},
@@ -391,6 +396,7 @@ GdPropertyDefault gd_defaults_crli[] =
   {CAVE_OFFSET(level_hatching_delay_time[0]), 2},
   {CAVE_OFFSET(intermission_instantlife), FALSE},
   {CAVE_OFFSET(intermission_rewardlife), TRUE},
+  {CAVE_OFFSET(magic_timer_zero_is_infinite), FALSE},
   {CAVE_OFFSET(magic_timer_wait_for_hatching), TRUE},
   {CAVE_OFFSET(pushing_stone_prob), 250000},
   {CAVE_OFFSET(pushing_stone_prob_sweet), 1000000},
index b1ec47f398f0b38334c09812b7b7012682038245..d8f4559175d8e93f900d9a0c13f8022122ea1d5c 100644 (file)
@@ -394,6 +394,7 @@ typedef struct _gd_cave
   int level_magic_wall_time[5];         // magic wall 'on' state for each level (seconds)
   boolean magic_wall_stops_amoeba;      // Turning on magic wall changes amoeba to diamonds.
                                         // Original BD: yes, constkit: no
+  boolean magic_timer_zero_is_infinite;        // magic wall timer 0 is interpreted as infinite
   boolean magic_timer_wait_for_hatching;// magic wall timer does not start before player's birth
   boolean magic_wall_sound;             // magic wall has sound
 
index 34084767e5d4610cdb8401473480229212c824af..b54eff89e2e434274d165331eb25c712c4a3d521 100644 (file)
@@ -547,6 +547,7 @@ const GdStructDescriptor gd_cave_properties[] =
   {"", GD_TAB, 0, N_("Magic Wall")},
   {"", GD_LABEL, GD_SHOW_LEVEL_LABEL, N_("Timing")},
   {"MagicWallTime", GD_TYPE_INT, 0, N_("Milling time (s)"), CAVE_OFFSET(level_magic_wall_time), 5, N_("Magic wall will stop after this time, and it cannot be activated again."), 0, 999},
+  {"MagicWallProperties.zeroisinfinite", GD_TYPE_BOOLEAN, 0, N_("Milling time 0 is infinite"), CAVE_OFFSET(magic_timer_zero_is_infinite), 1, N_("This determines if the magic wall timer 0 is interpreted as infinite.")},
   {"MagicWallProperties.waitforhatching", GD_TYPE_BOOLEAN, 0, N_("Timer waits for hatching"), CAVE_OFFSET(magic_timer_wait_for_hatching), 1, N_("This determines if the magic wall timer starts before the player appearing. Magic can always be activated before that; but if this is set to true, the timer will not start.")},
   {"MagicWallProperties.convertamoeba", GD_TYPE_BOOLEAN, 0, N_("Stops amoeba"), CAVE_OFFSET(magic_wall_stops_amoeba), 1, N_("When the magic wall is activated, it can convert amoeba into diamonds.")},
   {"", GD_LABEL, 0, N_("Conversions")},
@@ -796,6 +797,7 @@ GdPropertyDefault gd_cave_defaults_gdash[] =
   {CAVE_OFFSET(magic_flying_stone_to), O_FLYING_DIAMOND_F},
   {CAVE_OFFSET(magic_flying_diamond_to), O_FLYING_STONE_F},
   {CAVE_OFFSET(magic_wall_stops_amoeba), TRUE},
+  {CAVE_OFFSET(magic_timer_zero_is_infinite), TRUE},
   {CAVE_OFFSET(magic_timer_wait_for_hatching), FALSE},
 
   // amoeba
index e95236ce6b73c8a5994635adf1d08ee76fc82ebf..46c97e57551043390c027b787f9cacadbfeff6a6 100644 (file)
@@ -3713,7 +3713,8 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
 
   // magic wall; if active&wait or not wait for hatching
   if (cave->magic_wall_state == GD_MW_ACTIVE &&
-      (cave->hatched || !cave->magic_timer_wait_for_hatching))
+      (cave->hatched || !cave->magic_timer_wait_for_hatching) &&
+      !(cave->magic_wall_time == 0 && cave->magic_timer_zero_is_infinite))
   {
     cave->magic_wall_time -= cave->speed;
     if (cave->magic_wall_time < 0)
index 04b6021aed78e26600ff8c9b6a2ccd01c342a1c0..4472b912575e4337dafbbf20700bd9f6a73df8ba 100644 (file)
@@ -3662,6 +3662,7 @@ struct LevelInfo
   int bd_pushing_prob;                 // BD player probability to push rocks
   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_zero_infinite; // BD magic wall with timer of zero runs infinitely
   boolean bd_magic_wall_wait_hatching; // BD magic wall waits for player's birth
   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