- fixed handling of the custom game mode menus in Ion Fury.

Sadly the scripting which necessitates this all is such a hack that it's probably necessary to fix again if the next project comes along that uses the same kind of "creativity" instead of providing a robust implementation.
This commit is contained in:
Christoph Oelckers 2019-11-27 23:35:12 +01:00
parent 2c36e986b9
commit 5f5fe271f7
4 changed files with 28 additions and 9 deletions

View file

@ -445,13 +445,19 @@ bool M_SetMenu(FName menu, int param, FName caller)
case NAME_CustomGameMenu:
GameStartupInfo.CustomLevel1 = param;
GameStartupInfo.CustomLevel2 = -1;
GameStartupInfo.Episode = -1;
GameStartupInfo.Level = -1;
GameStartupInfo.Episode = 0; // Set start to E1L1 so that even if the script fails to set the starting level it is set to something valid.
GameStartupInfo.Level = 0;
GameStartupInfo.Skill = gDefaultSkill;
gi->CustomMenuSelection(param, -1);
break;
case NAME_CustomSubMenu1:
case NAME_CustomSubMenu2:
case NAME_CustomSubMenu3:
case NAME_CustomSubMenu4:
case NAME_CustomSubMenu5:
case NAME_CustomSubMenu6:
case NAME_CustomSubMenu7:
GameStartupInfo.CustomLevel2 = param;
gi->CustomMenuSelection(GameStartupInfo.CustomLevel1, param);
break;

View file

@ -1139,14 +1139,17 @@ static void BuildEpisodeMenu()
}
if (e > 0)
{
FMenuDescriptor** desc = MenuDescriptors.CheckKey(NAME_MainMenu);
if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
for (auto name : { NAME_MainMenu, NAME_IngameMenu })
{
FListMenuDescriptor* ld = static_cast<FListMenuDescriptor*>(*desc);
auto li = ld->mItems[0];
if (li->GetAction(nullptr) == NAME_EpisodeMenu)
FMenuDescriptor** desc = MenuDescriptors.CheckKey(name);
if (desc != NULL && (*desc)->mType == MDESC_ListMenu)
{
li->SetAction(NAME_CustomGameMenu);
FListMenuDescriptor* ld = static_cast<FListMenuDescriptor*>(*desc);
auto li = ld->mItems[0];
if (li->GetAction(nullptr) == NAME_EpisodeMenu)
{
li->SetAction(NAME_CustomGameMenu);
}
}
}
}

View file

@ -270,6 +270,16 @@ class DukeListMenu : public DListMenu
using Super = DListMenu;
protected:
void SelectionChanged() override
{
if (mDesc->mScriptId == 110)
{
// Hack alert: Ion Fury depends on the skill getting set globally when the selection changes because the script cannot detect actual selection changes.
// Yuck!
ud.m_player_skill = mDesc->mSelectedItem+1;
}
}
virtual void CallScript(int event, bool getorigin = false)
{
ud.returnvar[0] = int(origin.X * 65536);

View file

@ -921,7 +921,7 @@ void __fastcall VM_SetPlayer(int const playerNum, int const labelNum, int const
else if ((ps.gm & MODE_MENU) && !(newValue & MODE_MENU))
Menu_Close(playerNum);
*/
ps.gm = newValue & ~MODE_MENU;
ps.gm = (newValue & ~MODE_MENU) | (ps.gm & MODE_MENU);
break;
case PLAYER_GOTWEAPON: