diff --git a/source/common/menu/listmenu.cpp b/source/common/menu/listmenu.cpp index 9138a840a..b6033dd28 100644 --- a/source/common/menu/listmenu.cpp +++ b/source/common/menu/listmenu.cpp @@ -130,6 +130,7 @@ bool DListMenu::Responder (event_t *ev) if (mDesc->mItems[i]->CheckHotkey(ch)) { mDesc->mSelectedItem = i; + SelectionChanged(); gi->MenuSound(GameInterface::SelectSound); return true; } @@ -139,6 +140,7 @@ bool DListMenu::Responder (event_t *ev) if (mDesc->mItems[i]->CheckHotkey(ch)) { mDesc->mSelectedItem = i; + SelectionChanged(); gi->MenuSound(GameInterface::SelectSound); return true; } @@ -166,6 +168,7 @@ bool DListMenu::MenuEvent (int mkey, bool fromcontroller) if (--mDesc->mSelectedItem < 0) mDesc->mSelectedItem = mDesc->mItems.Size()-1; } while (!mDesc->mItems[mDesc->mSelectedItem]->Selectable() && mDesc->mSelectedItem != startedAt); + SelectionChanged(); gi->MenuSound(GameInterface::SelectSound); return true; @@ -175,6 +178,7 @@ bool DListMenu::MenuEvent (int mkey, bool fromcontroller) if (++mDesc->mSelectedItem >= (int)mDesc->mItems.Size()) mDesc->mSelectedItem = 0; } while (!mDesc->mItems[mDesc->mSelectedItem]->Selectable() && mDesc->mSelectedItem != startedAt); + SelectionChanged(); gi->MenuSound(GameInterface::SelectSound); return true; @@ -228,6 +232,7 @@ bool DListMenu::MouseEvent(int type, int xx, int yy) // no sound. This is too noisy. } mDesc->mSelectedItem = i; + SelectionChanged(); mDesc->mItems[i]->MouseEvent(type, x, y); return true; } @@ -264,7 +269,7 @@ void DListMenu::Drawer () PreDraw(); for(unsigned i=0;imItems.Size(); i++) { - if (mDesc->mItems[i]->mEnabled) mDesc->mItems[i]->Drawer(this, origin, mDesc->mSelectedItem == (int)i); + mDesc->mItems[i]->Drawer(this, origin, mDesc->mSelectedItem == (int)i); } if (mDesc->mSelectedItem >= 0 && mDesc->mSelectedItem < (int)mDesc->mItems.Size()) mDesc->mItems[mDesc->mSelectedItem]->DrawSelector(mDesc->mSelectOfsX, mDesc->mSelectOfsY, mDesc->mSelector); diff --git a/source/common/menu/menu.cpp b/source/common/menu/menu.cpp index c3823d631..101de17ad 100644 --- a/source/common/menu/menu.cpp +++ b/source/common/menu/menu.cpp @@ -454,7 +454,6 @@ bool M_SetMenu(FName menu, int param, FName caller) case NAME_CustomSubMenu1: GameStartupInfo.CustomLevel2 = param; gi->CustomMenuSelection(GameStartupInfo.CustomLevel1, param); - menu = FName(ENamedName(menu + param)); break; case NAME_SkillMenu: @@ -469,6 +468,10 @@ bool M_SetMenu(FName menu, int param, FName caller) gi->StartGame(GameStartupInfo); return false; + case NAME_CustomSubMenu1: + menu = ENamedName(menu + param); + break; + #if 0 case NAME_StartgameConfirm: { diff --git a/source/common/menu/menu.h b/source/common/menu/menu.h index 545de2b20..6167ecaa4 100644 --- a/source/common/menu/menu.h +++ b/source/common/menu/menu.h @@ -499,6 +499,7 @@ public: bool MouseEvent(int type, int x, int y); void Ticker (); void Drawer (); + virtual void SelectionChanged() {} void SetFocus(FListMenuItem *fc) { mFocusControl = fc; diff --git a/source/common/menu/menudef.cpp b/source/common/menu/menudef.cpp index fdda98779..279c6d427 100644 --- a/source/common/menu/menudef.cpp +++ b/source/common/menu/menudef.cpp @@ -1100,7 +1100,7 @@ static void BuildEpisodeMenu() FMenuDescriptor** desc = MenuDescriptors.CheckKey(NAME_CustomGameMenu); if (desc != NULL && (*desc)->mType == MDESC_ListMenu) { - FListMenuDescriptor* ld = static_cast(*desc); + FListMenuDescriptor* ldo = static_cast(*desc); for (MenuGameplayStemEntry const& stem : g_MenuGameplayEntries) { @@ -1112,7 +1112,8 @@ static void BuildEpisodeMenu() FMenuDescriptor** sdesc = MenuDescriptors.CheckKey(FName(ENamedName(NAME_CustomSubMenu1 + e))); if (sdesc != NULL && (*sdesc)->mType == MDESC_ListMenu) { - FListMenuDescriptor* ld = static_cast(*desc); + FListMenuDescriptor* ld = static_cast(*sdesc); + ld->mCaption = entry.name; for (MenuGameplayEntry const& subentry : stem.subentries) { @@ -1123,15 +1124,16 @@ static void BuildEpisodeMenu() if (subentry.flags & MGE_Locked) li->mEnabled = false; if (subentry.flags & MGE_Hidden) li->mHidden = true; - + ld->mItems.Push(li); ++s; } } FName link = entry.flags & MGE_UserContent ? NAME_UsermapMenu : s == 0 ? NAME_SkillMenu : NAME_CustomSubMenu1; - auto li = new FListMenuItemNativeText(ld->mXpos, 0, 0, 0, entry.name, NIT_BigFont, NIT_ActiveColor, 1.f, link, link == NAME_CustomSubMenu1 ? e : -1); + auto li = new FListMenuItemNativeText(ldo->mXpos, 0, 0, 0, entry.name, NIT_BigFont, NIT_ActiveColor, 1.f, link, e); if (entry.flags & MGE_Locked) li->mEnabled = false; if (entry.flags & MGE_Hidden) li->mHidden = true; + ldo->mItems.Push(li); e++; } } diff --git a/wadsrc/static/demolition/menudef.txt b/wadsrc/static/demolition/menudef.txt index b9b0a345b..3fc40df5a 100644 --- a/wadsrc/static/demolition/menudef.txt +++ b/wadsrc/static/demolition/menudef.txt @@ -147,9 +147,18 @@ LISTMENU "SkillMenu" { ifgame(Duke, Nam, WW2GI, Fury) // Ion Fury does not use this menu. { + ifgame(fury) + { + position 160, 55, 115 + fixedspacing 2 + } + else + { + position 160, 55, 115 + centermenu + animatedtransition + } caption "$MNU_SELECTSKILL" - position 160, 55, 135 - centermenu fixedspacing 5 class "Duke.ListMenu" animatedtransition @@ -160,82 +169,140 @@ LISTMENU "SkillMenu" // The custom menus are only supported by the EDuke32 frontend. LISTMENU "CustomGameMenu" { + caption "$MNU_NEWGAME" position 160, 48, 142 - centermenu - fixedspacing 5 + ifgame(fury) + { + fixedspacing 2 + } + else + { + fixedspacing 5 + animatedtransition + } ScriptId 102 class "Duke.ListMenu" - animatedtransition + centermenu } LISTMENU "CustomSubMenu1" { position 160, 48, 142 centermenu - fixedspacing 5 + ifgame(fury) + { + fixedspacing 2 + } + else + { + fixedspacing 5 + animatedtransition + } + centermenu ScriptId 103 class "Duke.ListMenu" - animatedtransition } LISTMENU "CustomSubMenu2" { position 160, 48, 142 + ifgame(fury) + { + fixedspacing 2 + } + else + { + fixedspacing 5 + animatedtransition + } centermenu - fixedspacing 5 ScriptId 103 class "Duke.ListMenu" - animatedtransition } LISTMENU "CustomSubMenu3" { position 160, 48, 142 + ifgame(fury) + { + fixedspacing 2 + } + else + { + fixedspacing 5 + animatedtransition + } centermenu - fixedspacing 5 ScriptId 103 class "Duke.ListMenu" - animatedtransition } LISTMENU "CustomSubMenu4" { position 160, 48, 142 + ifgame(fury) + { + fixedspacing 2 + } + else + { + fixedspacing 5 + animatedtransition + } centermenu - fixedspacing 5 ScriptId 103 class "Duke.ListMenu" - animatedtransition } LISTMENU "CustomSubMenu5" { position 160, 48, 142 + ifgame(fury) + { + fixedspacing 2 + } + else + { + fixedspacing 5 + animatedtransition + } centermenu - fixedspacing 5 ScriptId 103 class "Duke.ListMenu" - animatedtransition } LISTMENU "CustomSubMenu6" { position 160, 48, 142 + ifgame(fury) + { + fixedspacing 2 + } + else + { + fixedspacing 5 + animatedtransition + } centermenu - fixedspacing 5 ScriptId 103 class "Duke.ListMenu" - animatedtransition } LISTMENU "CustomSubMenu7" { position 160, 48, 142 + ifgame(fury) + { + fixedspacing 2 + } + else + { + fixedspacing 5 + animatedtransition + } centermenu - fixedspacing 5 ScriptId 103 class "Duke.ListMenu" - animatedtransition } LISTMENU "MultiMenu"