Linear Level Select polish

- Even if there's only one level in the group, only skip over the mini linear list in a Time Attack mode
    - Improves some of the jumpscare of looking into Lost and Found and being blasted to TEST RUN
- Fix lists of one map being wedged against the bottom of the screen
- Precache valid map count
This commit is contained in:
toaster 2023-03-13 18:20:50 +00:00
parent 0f14079555
commit 492babd73d
3 changed files with 8 additions and 6 deletions

View file

@ -737,6 +737,7 @@ extern struct levellist_s {
UINT16 y; UINT16 y;
UINT16 dest; UINT16 dest;
UINT16 choosemap; UINT16 choosemap;
UINT16 mapcount;
UINT8 newgametype; UINT8 newgametype;
UINT8 guessgt; UINT8 guessgt;
levelsearch_t levelsearch; levelsearch_t levelsearch;

View file

@ -161,7 +161,7 @@ void M_CupSelectHandler(INT32 choice)
restoreMenu = &PLAY_CupSelectDef; restoreMenu = &PLAY_CupSelectDef;
} }
else if (count == 1) else if (count == 1 && levellist.levelsearch.timeattack == true)
{ {
PLAY_TimeAttackDef.transitionID = currentMenu->transitionID+1; PLAY_TimeAttackDef.transitionID = currentMenu->transitionID+1;
M_LevelSelected(0); M_LevelSelected(0);
@ -174,6 +174,7 @@ void M_CupSelectHandler(INT32 choice)
levellist.cursor = 0; levellist.cursor = 0;
} }
levellist.mapcount = count;
M_LevelSelectScrollDest(); M_LevelSelectScrollDest();
levellist.y = levellist.dest; levellist.y = levellist.dest;

View file

@ -195,14 +195,14 @@ UINT16 M_GetNextLevelInList(UINT16 mapnum, UINT8 *i, levelsearch_t *levelsearch)
void M_LevelSelectScrollDest(void) void M_LevelSelectScrollDest(void)
{ {
UINT16 m = M_CountLevelsToShowInList(&levellist.levelsearch)-1; UINT16 m = levellist.mapcount-1;
levellist.dest = (6*levellist.cursor); levellist.dest = (6*levellist.cursor);
if (levellist.dest < 3) if (levellist.dest < 3)
levellist.dest = 3; levellist.dest = 3;
if (levellist.dest > (6*m)-3) if (m && levellist.dest > (6*m)-3)
levellist.dest = (6*m)-3; levellist.dest = (6*m)-3;
} }
@ -400,6 +400,7 @@ boolean M_LevelListFromGametype(INT16 gt)
levellist.levelsearch.cup = NULL; levellist.levelsearch.cup = NULL;
} }
levellist.mapcount = M_CountLevelsToShowInList(&levellist.levelsearch);
M_LevelSelectScrollDest(); M_LevelSelectScrollDest();
levellist.y = levellist.dest; levellist.y = levellist.dest;
@ -562,7 +563,6 @@ void M_LevelSelected(INT16 add)
void M_LevelSelectHandler(INT32 choice) void M_LevelSelectHandler(INT32 choice)
{ {
INT16 maxlevels = M_CountLevelsToShowInList(&levellist.levelsearch);
const UINT8 pid = 0; const UINT8 pid = 0;
(void)choice; (void)choice;
@ -575,7 +575,7 @@ void M_LevelSelectHandler(INT32 choice)
if (menucmd[pid].dpad_ud > 0) if (menucmd[pid].dpad_ud > 0)
{ {
levellist.cursor++; levellist.cursor++;
if (levellist.cursor >= maxlevels) if (levellist.cursor >= levellist.mapcount)
levellist.cursor = 0; levellist.cursor = 0;
S_StartSound(NULL, sfx_s3k5b); S_StartSound(NULL, sfx_s3k5b);
M_SetMenuDelay(pid); M_SetMenuDelay(pid);
@ -584,7 +584,7 @@ void M_LevelSelectHandler(INT32 choice)
{ {
levellist.cursor--; levellist.cursor--;
if (levellist.cursor < 0) if (levellist.cursor < 0)
levellist.cursor = maxlevels-1; levellist.cursor = levellist.mapcount-1;
S_StartSound(NULL, sfx_s3k5b); S_StartSound(NULL, sfx_s3k5b);
M_SetMenuDelay(pid); M_SetMenuDelay(pid);
} }