- fixed: The skill menu did not remember its last selection.

This commit is contained in:
Christoph Oelckers 2022-04-12 00:04:45 +02:00
parent 36245ae598
commit f3d557bcf5
1 changed files with 4 additions and 1 deletions

View File

@ -81,6 +81,7 @@ void I_WaitVBL(int count);
FNewGameStartup NewGameStartupInfo;
int LastSkill = -1;
bool M_SetSpecialMenu(FName& menu, int param)
@ -147,6 +148,7 @@ bool M_SetSpecialMenu(FName& menu, int param)
{
// sent from the skill menu for a skill that needs to be confirmed
NewGameStartupInfo.Skill = param;
LastSkill = param;
const char *msg = AllSkills[param].MustConfirmText;
if (*msg==0) msg = GStrings("NIGHTMARE");
@ -157,6 +159,7 @@ bool M_SetSpecialMenu(FName& menu, int param)
case NAME_Startgame:
// sent either from skill menu or confirmation screen. Skill gets only set if sent from skill menu
// Now we can finally start the game. Ugh...
LastSkill = param;
NewGameStartupInfo.Skill = param;
[[fallthrough]];
case NAME_StartgameConfirmed:
@ -1048,7 +1051,7 @@ void M_StartupSkillMenu(FNewGameStartup *gs)
}
if (MenuSkills.Size() == 0) I_Error("No valid skills for menu found. At least one must be defined.");
int defskill = DefaultSkill;
int defskill = LastSkill > -1? LastSkill : DefaultSkill; // use the last selected skill, if available.
if ((unsigned int)defskill >= MenuSkills.Size())
{
defskill = SkillIndices[(MenuSkills.Size() - 1) / 2];