added showing game actions after game end when request door opens/closes
authorHolger Schemel <info@artsoft.org>
Sat, 2 Dec 2023 11:20:26 +0000 (12:20 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 2 Dec 2023 11:20:26 +0000 (12:20 +0100)
src/game.c
src/game.h
src/tools.c

index a2dcd13dc1de0a4dda3060a3182d7c83cd343223..d1bf2d7d0f2a334760196aab48140344b55d1ba2 100644 (file)
@@ -3870,6 +3870,8 @@ void InitGame(void)
   game.LevelSolved_CountingScore = 0;
   game.LevelSolved_CountingHealth = 0;
 
+  game.RestartGameRequested = FALSE;
+
   game.panel.active = TRUE;
 
   game.no_level_time_limit = (level.time == 0);
@@ -15806,6 +15808,10 @@ boolean CheckRestartGame(void)
   if (game.request_active)
     return FALSE;
 
+  // do not ask to play again if request dialog already handled
+  if (game.RestartGameRequested)
+    return FALSE;
+
   // do not ask to play again if game was never actually played
   if (!game.GamePlayed)
     return FALSE;
@@ -15814,6 +15820,8 @@ boolean CheckRestartGame(void)
   if (!setup.ask_on_game_over)
     return FALSE;
 
+  game.RestartGameRequested = TRUE;
+
   RequestRestartGame();
 
   return TRUE;
index 8fdfbdc83f95595383d60026d9eb5da009b82775..c555578b4ae8ce4a2f8755d380e51bcb18d7aced 100644 (file)
@@ -275,6 +275,8 @@ struct GameInfo
   int LevelSolved_CountingTime;
   int LevelSolved_CountingScore;
   int LevelSolved_CountingHealth;
+
+  boolean RestartGameRequested;
 };
 
 struct PlayerInfo
index 8a8924e3c58646f4f34309a3eafad5e496dc6d1d..b366a6088c11f67e17eb00dfbee2993e305ee8a1 100644 (file)
@@ -5407,6 +5407,8 @@ unsigned int MoveDoor(unsigned int door_state)
 
   if (door_state & DOOR_ACTION)
   {
+    boolean game_just_ended = (game_status == GAME_MODE_PLAYING &&
+                              checkGameEnded());
     boolean door_panel_drawn[NUM_DOORS];
     boolean panel_has_doors[NUM_DOORS];
     boolean door_part_skip[MAX_DOOR_PARTS];
@@ -5673,6 +5675,9 @@ unsigned int MoveDoor(unsigned int door_state)
 
       if (!(door_state & DOOR_NO_DELAY))
       {
+       if (game_just_ended)
+         HandleGameActions();
+
        BackToFront();
 
        SkipUntilDelayReached(&door_delay, &k, last_frame);
@@ -5696,7 +5701,12 @@ unsigned int MoveDoor(unsigned int door_state)
        door_delay.value = door_2.post_delay;
 
       while (!DelayReached(&door_delay))
+      {
+       if (game_just_ended)
+         HandleGameActions();
+
        BackToFront();
+      }
     }
   }