added support for zero delay for gravitation switch in BD engine
authorHolger Schemel <holger.schemel@virtion.de>
Wed, 3 Jul 2024 08:39:21 +0000 (10:39 +0200)
committerHolger Schemel <holger.schemel@virtion.de>
Wed, 3 Jul 2024 08:39:31 +0000 (10:39 +0200)
src/editor.c
src/game_bd/bd_caveengine.c

index 77f8d3289653c47ab389602b9d0d668ea8ea5679..539bce3b95383f32b1caa7305f3540757e701783 100644 (file)
@@ -12199,7 +12199,7 @@ static struct
                                0, 10                                                           },
   { EL_BDX_CREATURE_SWITCH,    &level.bd_creatures_auto_turn_delay,    TEXT_AUTO_TURN_DELAY    },
   { EL_BDX_GRAVITY_SWITCH,     &level.bd_gravity_switch_delay,         TEXT_GRAVITY_DELAY,
-                               1, 60                                                           },
+                               0, 60                                                           },
   { 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 },
index 85d9241177390caf66223bbab9caf7acc9fdafab..a5a18787781c0864f9dd12e1c5a0a12091353c87 100644 (file)
@@ -1855,8 +1855,9 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
                       player_move == GD_MV_DOWN))
                  {
                    gd_sound_play(cave, GD_S_SWITCH_GRAVITY, what, x, y);
+                    // (use 1 instead of 0 for immediate gravitation change)
                    cave->gravity_will_change =
-                     cave->gravity_change_time * cave->timing_factor;
+                     MAX(1, cave->gravity_change_time * cave->timing_factor);
                    cave->gravity_next_direction = player_move;
                    cave->gravity_switch_active = FALSE;
                  }
@@ -1961,8 +1962,9 @@ void gd_cave_iterate(GdCave *cave, GdDirection player_move, boolean player_fire,
                       player_move == GD_MV_DOWN))
                  {
                    gd_sound_play(cave, GD_S_SWITCH_GRAVITY, what, x, y);
+                    // (use 1 instead of 0 for immediate gravitation change)
                    cave->gravity_will_change =
-                     cave->gravity_change_time * cave->timing_factor;
+                     MAX(1, cave->gravity_change_time * cave->timing_factor);
                    cave->gravity_next_direction = player_move;
                    cave->gravity_switch_active = FALSE;
                  }