From: Holger Schemel Date: Sat, 9 Jan 2021 18:10:49 +0000 (+0100) Subject: fixed displaying new high score entry if not on first page X-Git-Tag: 4.2.2.1~1 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=668d05fbdb883eb630700f4df445f77abe599498;p=rocksndiamonds.git fixed displaying new high score entry if not on first page --- diff --git a/src/screens.c b/src/screens.c index 8af84590..39650b5c 100644 --- a/src/screens.c +++ b/src/screens.c @@ -5080,9 +5080,15 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) if (button == MB_MENU_INITIALIZE) { level_nr = mx; - first_entry = 0; highlight_position = my; + first_entry = highlight_position - (NUM_MENU_ENTRIES_ON_SCREEN + 1) / 2 + 1; + + if (first_entry < 0) + first_entry = 0; + else if (first_entry + NUM_MENU_ENTRIES_ON_SCREEN > MAX_SCORE_ENTRIES) + first_entry = MAX(0, MAX_SCORE_ENTRIES - NUM_MENU_ENTRIES_ON_SCREEN); + drawHallOfFameList(level_nr, first_entry, highlight_position); return;