- fixed most issues with Ion Fury's game startup menus.

This commit is contained in:
Christoph Oelckers 2019-11-27 22:41:15 +01:00
parent 8492e3c67a
commit 2c36e986b9
5 changed files with 103 additions and 25 deletions

View file

@ -130,6 +130,7 @@ bool DListMenu::Responder (event_t *ev)
if (mDesc->mItems[i]->CheckHotkey(ch)) if (mDesc->mItems[i]->CheckHotkey(ch))
{ {
mDesc->mSelectedItem = i; mDesc->mSelectedItem = i;
SelectionChanged();
gi->MenuSound(GameInterface::SelectSound); gi->MenuSound(GameInterface::SelectSound);
return true; return true;
} }
@ -139,6 +140,7 @@ bool DListMenu::Responder (event_t *ev)
if (mDesc->mItems[i]->CheckHotkey(ch)) if (mDesc->mItems[i]->CheckHotkey(ch))
{ {
mDesc->mSelectedItem = i; mDesc->mSelectedItem = i;
SelectionChanged();
gi->MenuSound(GameInterface::SelectSound); gi->MenuSound(GameInterface::SelectSound);
return true; return true;
} }
@ -166,6 +168,7 @@ bool DListMenu::MenuEvent (int mkey, bool fromcontroller)
if (--mDesc->mSelectedItem < 0) mDesc->mSelectedItem = mDesc->mItems.Size()-1; if (--mDesc->mSelectedItem < 0) mDesc->mSelectedItem = mDesc->mItems.Size()-1;
} }
while (!mDesc->mItems[mDesc->mSelectedItem]->Selectable() && mDesc->mSelectedItem != startedAt); while (!mDesc->mItems[mDesc->mSelectedItem]->Selectable() && mDesc->mSelectedItem != startedAt);
SelectionChanged();
gi->MenuSound(GameInterface::SelectSound); gi->MenuSound(GameInterface::SelectSound);
return true; return true;
@ -175,6 +178,7 @@ bool DListMenu::MenuEvent (int mkey, bool fromcontroller)
if (++mDesc->mSelectedItem >= (int)mDesc->mItems.Size()) mDesc->mSelectedItem = 0; if (++mDesc->mSelectedItem >= (int)mDesc->mItems.Size()) mDesc->mSelectedItem = 0;
} }
while (!mDesc->mItems[mDesc->mSelectedItem]->Selectable() && mDesc->mSelectedItem != startedAt); while (!mDesc->mItems[mDesc->mSelectedItem]->Selectable() && mDesc->mSelectedItem != startedAt);
SelectionChanged();
gi->MenuSound(GameInterface::SelectSound); gi->MenuSound(GameInterface::SelectSound);
return true; return true;
@ -228,6 +232,7 @@ bool DListMenu::MouseEvent(int type, int xx, int yy)
// no sound. This is too noisy. // no sound. This is too noisy.
} }
mDesc->mSelectedItem = i; mDesc->mSelectedItem = i;
SelectionChanged();
mDesc->mItems[i]->MouseEvent(type, x, y); mDesc->mItems[i]->MouseEvent(type, x, y);
return true; return true;
} }
@ -264,7 +269,7 @@ void DListMenu::Drawer ()
PreDraw(); PreDraw();
for(unsigned i=0;i<mDesc->mItems.Size(); i++) for(unsigned i=0;i<mDesc->mItems.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()) if (mDesc->mSelectedItem >= 0 && mDesc->mSelectedItem < (int)mDesc->mItems.Size())
mDesc->mItems[mDesc->mSelectedItem]->DrawSelector(mDesc->mSelectOfsX, mDesc->mSelectOfsY, mDesc->mSelector); mDesc->mItems[mDesc->mSelectedItem]->DrawSelector(mDesc->mSelectOfsX, mDesc->mSelectOfsY, mDesc->mSelector);

View file

@ -454,7 +454,6 @@ bool M_SetMenu(FName menu, int param, FName caller)
case NAME_CustomSubMenu1: case NAME_CustomSubMenu1:
GameStartupInfo.CustomLevel2 = param; GameStartupInfo.CustomLevel2 = param;
gi->CustomMenuSelection(GameStartupInfo.CustomLevel1, param); gi->CustomMenuSelection(GameStartupInfo.CustomLevel1, param);
menu = FName(ENamedName(menu + param));
break; break;
case NAME_SkillMenu: case NAME_SkillMenu:
@ -469,6 +468,10 @@ bool M_SetMenu(FName menu, int param, FName caller)
gi->StartGame(GameStartupInfo); gi->StartGame(GameStartupInfo);
return false; return false;
case NAME_CustomSubMenu1:
menu = ENamedName(menu + param);
break;
#if 0 #if 0
case NAME_StartgameConfirm: case NAME_StartgameConfirm:
{ {

View file

@ -499,6 +499,7 @@ public:
bool MouseEvent(int type, int x, int y); bool MouseEvent(int type, int x, int y);
void Ticker (); void Ticker ();
void Drawer (); void Drawer ();
virtual void SelectionChanged() {}
void SetFocus(FListMenuItem *fc) void SetFocus(FListMenuItem *fc)
{ {
mFocusControl = fc; mFocusControl = fc;

View file

@ -1100,7 +1100,7 @@ static void BuildEpisodeMenu()
FMenuDescriptor** desc = MenuDescriptors.CheckKey(NAME_CustomGameMenu); FMenuDescriptor** desc = MenuDescriptors.CheckKey(NAME_CustomGameMenu);
if (desc != NULL && (*desc)->mType == MDESC_ListMenu) if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
{ {
FListMenuDescriptor* ld = static_cast<FListMenuDescriptor*>(*desc); FListMenuDescriptor* ldo = static_cast<FListMenuDescriptor*>(*desc);
for (MenuGameplayStemEntry const& stem : g_MenuGameplayEntries) for (MenuGameplayStemEntry const& stem : g_MenuGameplayEntries)
{ {
@ -1112,7 +1112,8 @@ static void BuildEpisodeMenu()
FMenuDescriptor** sdesc = MenuDescriptors.CheckKey(FName(ENamedName(NAME_CustomSubMenu1 + e))); FMenuDescriptor** sdesc = MenuDescriptors.CheckKey(FName(ENamedName(NAME_CustomSubMenu1 + e)));
if (sdesc != NULL && (*sdesc)->mType == MDESC_ListMenu) if (sdesc != NULL && (*sdesc)->mType == MDESC_ListMenu)
{ {
FListMenuDescriptor* ld = static_cast<FListMenuDescriptor*>(*desc); FListMenuDescriptor* ld = static_cast<FListMenuDescriptor*>(*sdesc);
ld->mCaption = entry.name;
for (MenuGameplayEntry const& subentry : stem.subentries) 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_Locked) li->mEnabled = false;
if (subentry.flags & MGE_Hidden) li->mHidden = true; if (subentry.flags & MGE_Hidden) li->mHidden = true;
ld->mItems.Push(li);
++s; ++s;
} }
} }
FName link = entry.flags & MGE_UserContent ? NAME_UsermapMenu : s == 0 ? NAME_SkillMenu : NAME_CustomSubMenu1; 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_Locked) li->mEnabled = false;
if (entry.flags & MGE_Hidden) li->mHidden = true; if (entry.flags & MGE_Hidden) li->mHidden = true;
ldo->mItems.Push(li);
e++; e++;
} }
} }

View file

@ -147,9 +147,18 @@ LISTMENU "SkillMenu"
{ {
ifgame(Duke, Nam, WW2GI, Fury) // Ion Fury does not use this menu. 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" caption "$MNU_SELECTSKILL"
position 160, 55, 135
centermenu
fixedspacing 5 fixedspacing 5
class "Duke.ListMenu" class "Duke.ListMenu"
animatedtransition animatedtransition
@ -160,82 +169,140 @@ LISTMENU "SkillMenu"
// The custom menus are only supported by the EDuke32 frontend. // The custom menus are only supported by the EDuke32 frontend.
LISTMENU "CustomGameMenu" LISTMENU "CustomGameMenu"
{ {
caption "$MNU_NEWGAME"
position 160, 48, 142 position 160, 48, 142
centermenu ifgame(fury)
fixedspacing 5 {
fixedspacing 2
}
else
{
fixedspacing 5
animatedtransition
}
ScriptId 102 ScriptId 102
class "Duke.ListMenu" class "Duke.ListMenu"
animatedtransition centermenu
} }
LISTMENU "CustomSubMenu1" LISTMENU "CustomSubMenu1"
{ {
position 160, 48, 142 position 160, 48, 142
centermenu centermenu
fixedspacing 5 ifgame(fury)
{
fixedspacing 2
}
else
{
fixedspacing 5
animatedtransition
}
centermenu
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "CustomSubMenu2" LISTMENU "CustomSubMenu2"
{ {
position 160, 48, 142 position 160, 48, 142
ifgame(fury)
{
fixedspacing 2
}
else
{
fixedspacing 5
animatedtransition
}
centermenu centermenu
fixedspacing 5
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "CustomSubMenu3" LISTMENU "CustomSubMenu3"
{ {
position 160, 48, 142 position 160, 48, 142
ifgame(fury)
{
fixedspacing 2
}
else
{
fixedspacing 5
animatedtransition
}
centermenu centermenu
fixedspacing 5
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "CustomSubMenu4" LISTMENU "CustomSubMenu4"
{ {
position 160, 48, 142 position 160, 48, 142
ifgame(fury)
{
fixedspacing 2
}
else
{
fixedspacing 5
animatedtransition
}
centermenu centermenu
fixedspacing 5
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "CustomSubMenu5" LISTMENU "CustomSubMenu5"
{ {
position 160, 48, 142 position 160, 48, 142
ifgame(fury)
{
fixedspacing 2
}
else
{
fixedspacing 5
animatedtransition
}
centermenu centermenu
fixedspacing 5
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "CustomSubMenu6" LISTMENU "CustomSubMenu6"
{ {
position 160, 48, 142 position 160, 48, 142
ifgame(fury)
{
fixedspacing 2
}
else
{
fixedspacing 5
animatedtransition
}
centermenu centermenu
fixedspacing 5
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "CustomSubMenu7" LISTMENU "CustomSubMenu7"
{ {
position 160, 48, 142 position 160, 48, 142
ifgame(fury)
{
fixedspacing 2
}
else
{
fixedspacing 5
animatedtransition
}
centermenu centermenu
fixedspacing 5
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "Duke.ListMenu"
animatedtransition
} }
LISTMENU "MultiMenu" LISTMENU "MultiMenu"