M_SpecificMenuRestore: Move all conditional sets of restoreMenu inside this function

In the case of returning from the Challenges grid, restoreMenu would not actually match the condition - preventing the relevant code from running.
This commit is contained in:
toaster 2023-01-31 12:54:11 +00:00
parent 8d6be5e662
commit 0947ed5eec
3 changed files with 17 additions and 12 deletions

View file

@ -368,6 +368,8 @@ menu_t *M_SpecificMenuRestore(menu_t *torestore)
|| torestore == &PLAY_TimeAttackDef)
{
// Handle unlock restrictions
cupheader_t *currentcup = levellist.levelsearch.cup;
M_SetupGametypeMenu(-1);
M_SetupRaceMenu(-1);
@ -382,15 +384,27 @@ menu_t *M_SpecificMenuRestore(menu_t *torestore)
torestore = PLAY_LevelSelectDef.prevMenu;
}
}
else if (torestore == &PLAY_TimeAttackDef)
else
{
M_PrepareTimeAttack(0);
if (currentcup != NULL && levellist.levelsearch.cup == NULL)
{
torestore = &PLAY_CupSelectDef;
}
else if (torestore == &PLAY_TimeAttackDef)
{
M_PrepareTimeAttack(0);
}
}
}
else if (torestore == &EXTRAS_ReplayHutDef)
{
// Handle modifications to the folder while playing
M_ReplayHut(0);
if (demo.inreplayhut == false)
{
torestore = &EXTRAS_MainDef;
}
}
if (setup_numplayers == 0)

View file

@ -116,12 +116,7 @@ void M_ReplayHut(INT32 choice)
if (!preparefilemenu(false, true))
{
M_StartMessage("No replays found.\n\nPress (B)\n", NULL, MM_NOTHING);
if (restoreMenu == &EXTRAS_ReplayHutDef)
{
restoreMenu = &EXTRAS_MainDef;
}
demo.inreplayhut = false;
return;
}
else if (!demo.inreplayhut)

View file

@ -321,10 +321,6 @@ boolean M_LevelListFromGametype(INT16 gt)
if (currentvalid == false)
{
levellist.levelsearch.cup = NULL;
if (gt == -1 && restoreMenu != &PLAY_CupSelectDef)
{
restoreMenu = &PLAY_CupSelectDef;
}
}
cupgrid.numpages = (highestunlockedid / (CUPMENU_COLUMNS * CUPMENU_ROWS)) + 1;