- fixed issues with the skill menu.

This commit is contained in:
Christoph Oelckers 2020-10-30 17:23:16 +01:00
parent 629737bd72
commit f09db4c943
3 changed files with 18 additions and 10 deletions

View file

@ -340,6 +340,10 @@ static void DoParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc, bool &s
{
desc->mCenter = true;
}
else if (sc.Compare("Selecteditem"))
{
desc->mSelectedItem = desc->mItems.Size() - 1;
}
else if (sc.Compare("animatedtransition"))
{
desc->mAnimatedTransition = true;

View file

@ -349,7 +349,8 @@ static DMenuItemBase* CreateCustomListMenuItemText(double x, double y, int heigh
const char* classname =
(g_gameType & GAMEFLAG_BLOOD) ? "ListMenuItemBloodTextItem" :
(g_gameType & GAMEFLAG_SW) ? "ListMenuItemSWTextItem" :
(g_gameType & GAMEFLAG_PSEXHUMED) ? "ListMenuItemExhumedTextItem" : "ListMenuItemDukeTextItem";
(g_gameType & GAMEFLAG_PSEXHUMED) ? "ListMenuItemExhumedTextItem" :
"ListMenuItemDukeTextItem";
auto c = PClass::FindClass(classname);
auto p = c->CreateNew();
FString keystr = FString(char(hotkey));
@ -426,7 +427,8 @@ static void BuildEpisodeMenu()
// Build skill menu
int addedSkills = 0;
desc = MenuDescriptors.CheckKey(NAME_Skillmenu);
if (desc != nullptr && (*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
// If the skill names list ios empty, a predefined menu is assumed
if (desc != nullptr && gSkillNames[0].IsNotEmpty() && (*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor)))
{
DListMenuDescriptor* ld = static_cast<DListMenuDescriptor*>(*desc);
DMenuItemBase* popped = nullptr;

View file

@ -241,20 +241,22 @@ LISTMENU "SkillMenu"
position 130, 50
Linespacing 16
WH1SkillItem "#00510", "$SKILL_EASY", "e", "StartGame 0"
WH1SkillItem "#00511", "$SKILL_NORMAL", "m", "StartGame 1"
WH1SkillItem "#00512", "$SKILL_HARD", "h", "StartGame 2"
WH1SkillItem "#00513", "$SKILL_VERY_HARD", "v", "StartGame 3"
WH1SkillItem "#00510", "$SKILL_EASY", "e", "StartGame", 0
WH1SkillItem "#00511", "$SKILL_NORMAL", "m", "StartGame", 1
selecteditem
WH1SkillItem "#00512", "$SKILL_HARD", "h", "StartGame", 2
WH1SkillItem "#00513", "$SKILL_VERY_HARD", "v", "StartGame", 3
}
ifgame(Witchaven2)
{
CaptionItem "$MNU_DIFFICULTY"
Position 120, 40
Linespacing 22
WH2SkillItem "#00510", "$SKILL_EASY", "e", "StartGame 0"
WH2SkillItem "#00511", "$SKILL_NORMAL", "m", "StartGame 1"
WH2SkillItem "#00512", "$SKILL_HARD", "h", "StartGame 2"
WH2SkillItem "#00513", "$SKILL_VERY_HARD", "v", "StartGame 3"
WH2SkillItem "#00510", "$SKILL_EASY", "e", "StartGame", 0
WH2SkillItem "#00511", "$SKILL_NORMAL", "m", "StartGame", 1
selecteditem
WH2SkillItem "#00512", "$SKILL_HARD", "h", "StartGame", 2
WH2SkillItem "#00513", "$SKILL_VERY_HARD", "v", "StartGame", 3
}
}