diff --git a/source/common/menu/menu.cpp b/source/common/menu/menu.cpp index 101de17ad..df7a8d36c 100644 --- a/source/common/menu/menu.cpp +++ b/source/common/menu/menu.cpp @@ -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; diff --git a/source/common/menu/menudef.cpp b/source/common/menu/menudef.cpp index 279c6d427..2a7ca894c 100644 --- a/source/common/menu/menudef.cpp +++ b/source/common/menu/menudef.cpp @@ -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(*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(*desc); + auto li = ld->mItems[0]; + if (li->GetAction(nullptr) == NAME_EpisodeMenu) + { + li->SetAction(NAME_CustomGameMenu); + } } } } diff --git a/source/duke3d/src/d_menu.cpp b/source/duke3d/src/d_menu.cpp index e51a8f022..310b6743c 100644 --- a/source/duke3d/src/d_menu.cpp +++ b/source/duke3d/src/d_menu.cpp @@ -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); diff --git a/source/duke3d/src/gamestructures.cpp b/source/duke3d/src/gamestructures.cpp index 40727c8fe..291878e69 100644 --- a/source/duke3d/src/gamestructures.cpp +++ b/source/duke3d/src/gamestructures.cpp @@ -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: