added special handling of BD intermission levels on game over
authorHolger Schemel <info@artsoft.org>
Fri, 8 Mar 2024 19:30:17 +0000 (20:30 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 8 Mar 2024 19:58:16 +0000 (20:58 +0100)
This change is required if asking for restart after gave over is
disabled in the setup menu.

src/game.c

index db689084c64fa6802d465fa4b5be9e34b4365b7b..9127a1b6a5be48bc22c593b6ff728b8a02269192 100644 (file)
@@ -5162,7 +5162,11 @@ void GameEnd(void)
   int last_level_nr = levelset.level_nr;
   boolean tape_saved = FALSE;
 
-  game.LevelSolved_GameEnd = TRUE;
+  // Important note: This function is not only called after "GameWon()", but also after
+  // "game over" (if automatically asking for restarting the game is disabled in setup)
+
+  if (game.LevelSolved)
+    game.LevelSolved_GameEnd = TRUE;
 
   if (game.LevelSolved_SaveTape && !score_info_tape_play)
   {
@@ -5189,7 +5193,7 @@ void GameEnd(void)
     return;
   }
 
-  if (!game.LevelSolved_SaveScore)
+  if (!game.GamePlayed || (!game.LevelSolved_SaveScore && !level.bd_intermission))
   {
     SetGameStatus(GAME_MODE_MAIN);
 
@@ -5206,12 +5210,13 @@ void GameEnd(void)
   }
 
   // save score and score tape before potentially erasing tape below
-  NewHighScore(last_level_nr, tape_saved);
+  if (game.LevelSolved_SaveScore)
+    NewHighScore(last_level_nr, tape_saved);
 
   // increment and load next level (if possible and not configured otherwise)
   AdvanceToNextLevel();
 
-  if (scores.last_added >= 0 && setup.show_scores_after_game)
+  if (game.LevelSolved_SaveScore && scores.last_added >= 0 && setup.show_scores_after_game)
   {
     SetGameStatus(GAME_MODE_SCORES);