diff --git a/src/menu/menu.h b/src/menu/menu.h index 8a484b7ba..55884ab84 100644 --- a/src/menu/menu.h +++ b/src/menu/menu.h @@ -671,6 +671,7 @@ void M_ActivateMenu(DMenu *menu); void M_ClearMenus (); void M_ParseMenuDefs(); void M_StartupSkillMenu(FGameStartup *gs); +int M_GetDefaultSkill(); void M_StartControlPanel (bool makeSound); void M_SetMenu(FName menu, int param = -1); void M_NotifyNewSave (const char *file, const char *title, bool okForQuicksave); diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index f413a9475..4390f1675 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -1235,7 +1235,7 @@ void M_CreateMenus() //============================================================================= // -// THe skill menu must be refeshed each time it starts up +// The skill menu must be refeshed each time it starts up // //============================================================================= extern int restart; @@ -1345,7 +1345,7 @@ void M_StartupSkillMenu(FGameStartup *gs) } if (AllEpisodes[gs->Episode].mNoSkill || AllSkills.Size() == 1) { - ld->mAutoselect = firstitem + MIN(2u, AllSkills.Size()-1); + ld->mAutoselect = firstitem + M_GetDefaultSkill(); } else { @@ -1400,12 +1400,23 @@ fail: if (!done) { done = true; - int defskill = DefaultSkill; - if ((unsigned int)defskill >= AllSkills.Size()) - { - defskill = (AllSkills.Size() - 1) / 2; - } - od->mSelectedItem = defskill; + od->mSelectedItem = M_GetDefaultSkill(); } } } + +//============================================================================= +// +// Returns the default skill level. +// +//============================================================================= + +int M_GetDefaultSkill() +{ + int defskill = DefaultSkill; + if ((unsigned int)defskill >= AllSkills.Size()) + { + defskill = (AllSkills.Size() - 1) / 2; + } + return defskill; +}