From 9d67dc36e896498382fe8ec3e813abf8eeeddd45 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 24 Jan 2012 03:16:24 +0000 Subject: [PATCH] - Fixed: Episodes with NoSkillMenu defined had their own idea of default skill that differed from episodes with skill menus (and completely ignored whichever skill is explicitly defined as the default skill). SVN r3346 (trunk) --- src/menu/menu.h | 1 + src/menu/menudef.cpp | 27 +++++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) 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; +}