From: Holger Schemel Date: Sun, 10 Apr 2022 11:52:34 +0000 (+0200) Subject: fixed (not) resuming game from hall of fame after playing X-Git-Tag: 4.3.2.0~25 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=affaf3f773dd4cbd843bc38e3798930427c27d9d;p=rocksndiamonds.git fixed (not) resuming game from hall of fame after playing --- diff --git a/src/files.c b/src/files.c index 3278b0c6..6866a4b6 100644 --- a/src/files.c +++ b/src/files.c @@ -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) diff --git a/src/main.h b/src/main.h index 797a3350..881b7863 100644 --- a/src/main.h +++ b/src/main.h @@ -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]; }; diff --git a/src/screens.c b/src/screens.c index 9055a88a..7fed3310 100644 --- a/src/screens.c +++ b/src/screens.c @@ -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) {