Fix the options menu on first boot bug.

- Was reproducible by spamming back button events during game launch.
- Caused by the way profile data was initialised - D_StartTitle was calling a function with too many side effects.
- In addition, never instantly skip the title screen when the above occours.
    - This would be enough to patch over the mentioned bug, but I made sure to solve it properly so it won't break when we touch this again later.
This commit is contained in:
toaster 2022-09-04 21:08:44 +01:00
parent acd777a77a
commit de5370b134
2 changed files with 9 additions and 4 deletions

View file

@ -1003,9 +1003,6 @@ void D_StartTitle(void)
advancedemo = false; advancedemo = false;
F_StartTitleScreen(); F_StartTitleScreen();
M_InitOptions(0); // Make sure the option menu is ready to go since we need to select a profile.
currentMenu = &MAIN_ProfilesDef; // reset the current menu ID
// Reset the palette // Reset the palette
if (rendermode != render_none) if (rendermode != render_none)
V_SetPaletteLump("PLAYPAL"); V_SetPaletteLump("PLAYPAL");

View file

@ -87,7 +87,7 @@ boolean menuactive = false;
boolean fromlevelselect = false; boolean fromlevelselect = false;
// current menudef // current menudef
menu_t *currentMenu = &OPTIONS_ProfilesDef; menu_t *currentMenu = &MAIN_ProfilesDef;
char dummystaffname[22]; char dummystaffname[22];
@ -925,6 +925,11 @@ void M_StartControlPanel(void)
menucmd[i].delay = MENUDELAYTIME; menucmd[i].delay = MENUDELAYTIME;
} }
// No instantly skipping the titlescreen.
// (We can change this timer later when extra animation is added.)
if (gamestate == GS_TITLESCREEN && finalecount < 1)
return;
// intro might call this repeatedly // intro might call this repeatedly
if (menuactive) if (menuactive)
{ {
@ -949,6 +954,9 @@ void M_StartControlPanel(void)
{ {
if (cv_currprofile.value == -1) // Only ask once per session. if (cv_currprofile.value == -1) // Only ask once per session.
{ {
// Make sure the profile data is ready now since we need to select a profile.
M_ResetOptions();
// we need to do this before setting ApplyProfile otherwise funky things are going to happen. // we need to do this before setting ApplyProfile otherwise funky things are going to happen.
currentMenu = &MAIN_ProfilesDef; currentMenu = &MAIN_ProfilesDef;
optionsmenu.profilen = cv_ttlprofilen.value; optionsmenu.profilen = cv_ttlprofilen.value;