fixed fast-forwarding BD game engine when skipping player hatching
authorHolger Schemel <info@artsoft.org>
Wed, 22 Jan 2025 07:46:12 +0000 (08:46 +0100)
committerHolger Schemel <info@artsoft.org>
Wed, 22 Jan 2025 08:52:29 +0000 (09:52 +0100)
Without this change, tape replay times with "skip hatching" enabled or
disabled differ by one frame, causing failed tape validations on the
high score server for tapes recorded with "skip hatching" enabled.

src/game_bd/main_bd.c

index 290b6cb50ef4723a2954099ddbe0ada5557ca721..1c80dc01f20906b1dd761811cfaa3a33e8357719 100644 (file)
@@ -415,21 +415,21 @@ void GameActions_BD(byte action[MAX_PLAYERS])
                     player_x,
                     player_y);
 
+  play_game_func(game_bd.game, action[0]);
+
   if (setup.bd_skip_hatching && !game_bd.game->cave->hatched &&
       game_bd.game->state_counter == GAME_INT_CAVE_RUNNING)
   {
     // fast-forward game engine until player hatched
     while (!game_bd.game->cave->hatched)
     {
-      play_game_func(game_bd.game, 0);
-
       // also record or replay tape action during fast-forward
       action = TapeCorrectAction_BD(action);
+
+      play_game_func(game_bd.game, 0);
     }
   }
 
-  play_game_func(game_bd.game, action[0]);
-
   // scroll without iterating engine if player out of sight (mainly due to wrap-around)
   // (this is needed to prevent broken tapes in case of viewport or tile size changes)
   while (game_bd.game->out_of_window)