fixed (not) resuming game from hall of fame after playing
authorHolger Schemel <info@artsoft.org>
Sun, 10 Apr 2022 11:52:34 +0000 (13:52 +0200)
committerHolger Schemel <info@artsoft.org>
Sun, 10 Apr 2022 11:52:49 +0000 (13:52 +0200)
src/files.c
src/main.h
src/screens.c

index 3278b0c6313441f19ef4535e6e2bd0ddce34fe9c..6866a4b64ebed84ea96ecebf5e5526fabbd4bd79 100644 (file)
@@ -8682,6 +8682,11 @@ static void setScoreInfoToDefaultsExt(struct ScoreInfo *scores)
   scores->uploaded = FALSE;
   scores->tape_downloaded = FALSE;
   scores->force_last_added = FALSE;
+
+  // The following values are intentionally not reset here:
+  // - last_level_nr
+  // - last_entry_nr
+  // - was_just_playing
 }
 
 static void setScoreInfoToDefaults(void)
index 797a3350f8243f933cd9f081ae60a94c32618e02..881b7863493250cf60a783166deb85bd29d92204 100644 (file)
@@ -3128,6 +3128,7 @@ struct ScoreInfo
   boolean uploaded;
   boolean tape_downloaded;
   boolean force_last_added;
+  boolean was_just_playing;
 
   struct ScoreEntry entry[MAX_SCORE_ENTRIES];
 };
index 9055a88aff1992e4984eed819c24252c7fa640ad..7fed3310e23c45aea463bdf95a64130003b76e3b 100644 (file)
@@ -4778,6 +4778,8 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
 
   if (mx || my)                // mouse input
   {
+    scores.was_just_playing = FALSE;
+
     x = (mx - amSX) / 32;
     y = (my - amSY) / 32 - MENU_SCREEN_START_YPOS;
 
@@ -4786,6 +4788,8 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
   }
   else if (dx || dy)   // keyboard or scrollbar/scrollbutton input
   {
+    scores.was_just_playing = FALSE;
+
     // move cursor instead of scrolling when already at start/end of list
     if (dy == -1 * SCROLL_LINE && ti->cl_first == 0)
       dy = -1;
@@ -5054,16 +5058,16 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
          }
          else if (game_status == GAME_MODE_SCORES)
          {
-           if (game_status_last_screen == GAME_MODE_PLAYING &&
-               setup.auto_play_next_level && setup.increment_levels &&
+           if (setup.auto_play_next_level && setup.increment_levels &&
                scores.last_level_nr < leveldir_current->last_level &&
+               scores.was_just_playing &&
                !network_playing)
            {
              StartGameActions(network.enabled, setup.autorecord,
                               level.random_seed);
              return;
            }
-           else
+           else if (!scores.was_just_playing)
            {
              SetGameStatus(GAME_MODE_SCOREINFO);
 
@@ -5263,6 +5267,7 @@ static void DrawHallOfFame_setScoreEntries(void)
 void DrawHallOfFame(int level_nr)
 {
   scores.last_level_nr = level_nr;
+  scores.was_just_playing = (game_status_last_screen == GAME_MODE_PLAYING);
 
   // (this is needed when called from GameEnd() after winning a game)
   KeyboardAutoRepeatOn();
@@ -5569,7 +5574,7 @@ void HandleScoreInfo(int mx, int my, int dx, int dy, int button)
 
     SetGameStatus(GAME_MODE_SCORES);
 
-    DrawHallOfFame(level_nr);
+    DrawHallOfFame(scores.last_level_nr);
   }
   else if (dx)
   {