From 5df0a7241f8cfb1b235f0be552aebfe507f7464a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 25 Aug 2020 20:40:30 +0200 Subject: [PATCH] - disabled a few menu options for unsupported features in Exhumed. Fixes #255 --- source/core/menu/menudef.cpp | 35 +++++++++++++- source/exhumed/src/input.cpp | 11 +++-- wadsrc/static/engine/menudef.txt | 81 ++++++++++++-------------------- 3 files changed, 70 insertions(+), 57 deletions(-) diff --git a/source/core/menu/menudef.cpp b/source/core/menu/menudef.cpp index cb9b60668..c03319ff0 100644 --- a/source/core/menu/menudef.cpp +++ b/source/core/menu/menudef.cpp @@ -174,7 +174,7 @@ bool validFilter(const char *str) } -static bool CheckSkipGameBlock(FScanner &sc) +static bool CheckSkipGameBlock(FScanner &sc, bool negate = false) { int filter = 0; sc.MustGetStringName("("); @@ -186,6 +186,7 @@ static bool CheckSkipGameBlock(FScanner &sc) filter |= games[gi].gameflag; } while (sc.CheckString(",")); + if (negate) filter = ~filter; sc.MustGetStringName(")"); if (!(filter & g_gameType)) { @@ -287,6 +288,14 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc) ParseListMenuBody(sc, desc); } } + else if (sc.Compare("ifnotgame")) + { + if (!CheckSkipGameBlock(sc, true)) + { + // recursively parse sub-block + ParseListMenuBody(sc, desc); + } + } else if (sc.Compare("ifoption")) { if (!CheckSkipOptionBlock(sc)) @@ -590,6 +599,14 @@ static void ParseImageScrollerBody(FScanner &sc, FImageScrollerDescriptor *desc) ParseImageScrollerBody(sc, desc); } } + else if (sc.Compare("ifnotgame")) + { + if (!CheckSkipGameBlock(sc, true)) + { + // recursively parse sub-block + ParseImageScrollerBody(sc, desc); + } + } else if (sc.Compare("ifshareware")) { if (!CheckSkipNoSwBlock(sc)) @@ -768,6 +785,14 @@ static void ParseOptionSettings(FScanner &sc) ParseOptionSettings(sc); } } + else if (sc.Compare("ifnotgame")) + { + if (!CheckSkipGameBlock(sc, true)) + { + // recursively parse sub-block + ParseOptionSettings(sc); + } + } else if (sc.Compare("Linespacing")) { sc.MustGetNumber(); @@ -809,6 +834,14 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc) ParseOptionMenuBody(sc, desc); } } + else if (sc.Compare("ifnotgame")) + { + if (!CheckSkipGameBlock(sc, true)) + { + // recursively parse sub-block + ParseOptionMenuBody(sc, desc); + } + } else if (sc.Compare("ifshareware")) { if (!CheckSkipNoSwBlock(sc)) diff --git a/source/exhumed/src/input.cpp b/source/exhumed/src/input.cpp index c94e115cb..a2ca1970e 100644 --- a/source/exhumed/src/input.cpp +++ b/source/exhumed/src/input.cpp @@ -210,10 +210,13 @@ void registerinputcommands() C_RegisterFunction("invprev", nullptr, [](CCmdFuncPtr)->int { if (PlayerList[nLocalPlayer].nHealth > 0) SetPrevItem(nLocalPlayer); return CCMD_OK; }); C_RegisterFunction("invnext", nullptr, [](CCmdFuncPtr)->int { if (PlayerList[nLocalPlayer].nHealth > 0) SetNextItem(nLocalPlayer); return CCMD_OK; }); C_RegisterFunction("invuse", nullptr, [](CCmdFuncPtr)->int { if (PlayerList[nLocalPlayer].nHealth > 0) UseCurItem(nLocalPlayer); return CCMD_OK; }); - // todo: - //C_RegisterFunction("weapprev", nullptr, [](CCmdFuncPtr)->int { WeaponToSend = 11; return CCMD_OK; }); - //C_RegisterFunction("weapnext", nullptr, [](CCmdFuncPtr)->int { WeaponToSend = 12; return CCMD_OK; }); - //C_RegisterFunction("turnaround", nullptr, [](CCmdFuncPtr)->int { BitsToSend |= SKB_TURNAROUND; return CCMD_OK; }); + // todo: These still need to be implemented. + C_RegisterFunction("weapprev", nullptr, [](CCmdFuncPtr)->int { /*WeaponToSend = 11;*/ return CCMD_OK; }); + C_RegisterFunction("weapnext", nullptr, [](CCmdFuncPtr)->int { /*WeaponToSend = 12;*/ return CCMD_OK; }); + + // These are only here to silence the engine when the keys bound to them are pressed. The functions do not exist. + C_RegisterFunction("turnaround", nullptr, [](CCmdFuncPtr)->int { return CCMD_OK; }); + C_RegisterFunction("holsterweapon", nullptr, [](CCmdFuncPtr)->int { return CCMD_OK; }); } diff --git a/wadsrc/static/engine/menudef.txt b/wadsrc/static/engine/menudef.txt index 6a1f2115e..18ebaa1e0 100644 --- a/wadsrc/static/engine/menudef.txt +++ b/wadsrc/static/engine/menudef.txt @@ -77,19 +77,11 @@ LISTMENU "IngameMenu" { ScriptId 50 class "$.MainMenu" - ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) + ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides) { - ifgame(fury) - { - position 40, 130, 60 - fixedspacing 2 - } - else - { - position 160, 55, 115 - centermenu - animatedtransition - } + position 160, 55, 115 + centermenu + animatedtransition NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" NativeTextItem "$MNU_SAVEGAME", "s", "SaveGameMenu" NativeTextItem "$MNU_LOADGAME", "l", "LoadGameMenu" @@ -98,18 +90,6 @@ LISTMENU "IngameMenu" NativeTextItem "$MNU_ENDGAME", "e", "EndgameMenu" NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu" } - ifgame(Deer) - { - position 160, 72, 108 - centermenu - animatedtransition - NativeTextItem "Keep Huntin'!", "k", "HuntMenu" - NativeTextItem "Trophies", "t", "TrophiesMenu" - NativeTextItem "$MNU_OPTIONS", "o", "OptionsMenu" - NativeTextItem "$MNU_HELP", "h", "HelpMenu" - NativeTextItem "Leave Area", "l", "EndgameMenu" - NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu" - } ifgame(Blood) { position 160, 45, 150 @@ -164,7 +144,7 @@ LISTMENU "IngameMenu" LISTMENU "EpisodeMenu" { - ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) // Ion Fury does not use this menu. + ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides) { class "$.ListMenu" caption "$MNU_SELECTEPISODE" @@ -193,20 +173,12 @@ LISTMENU "EpisodeMenu" LISTMENU "SkillMenu" { - ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) + ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides) { class "$.ListMenu" - ifgame(fury) - { - position 160, 55, 115 - fixedspacing 2 - } - else - { - position 160, 55, 115 - centermenu - animatedtransition - } + position 160, 55, 115 + centermenu + animatedtransition caption "$MNU_SELECTSKILL" fixedspacing 5 animatedtransition @@ -236,7 +208,7 @@ LISTMENU "SkillMenu" ImageScroller "HelpMenu" { - ifgame(Duke, Nam, WW2GI, Fury) + ifgame(Duke, Nam, WW2GI) { ImageItem "#3280", 400 ImageItem "#2445", 401 @@ -246,7 +218,7 @@ ImageScroller "HelpMenu" animatedtransition } } - ifgame(Redneck, RedneckRides, Deer) + ifgame(Redneck, RedneckRides) { ImageItem "#2541" ImageItem "#1633" @@ -526,12 +498,15 @@ OptionMenu "ActionControlsMenu"// protected StaticText "" Control "$CNTRLMNU_TURNLEFT" , "+turn_left" Control "$CNTRLMNU_TURNRIGHT" , "+turn_right" - Control "$CNTRLMNU_TURN180" , "turnaround" + ifnotgame(Exhumed) + { + Control "$CNTRLMNU_TURN180" , "turnaround" + } StaticText "" Control "$CNTRLMNU_JUMP" , "+jump" Control "$CNTRLMNU_CROUCH" , "+crouch" - ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) + ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides) { // Fixme: Make this work in all games Control "$CNTRLMNU_TOGGLECROUCH" , "+toggle_crouch" @@ -545,7 +520,7 @@ OptionMenu "ActionControlsMenu"// protected Control "$CNTRLMNU_AIMDOWN" , "+aim_down" Control "$CNTRLMNU_LOOKUP" , "+look_up" Control "$CNTRLMNU_LOOKDOWN" , "+look_down" - ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides, Deer) + ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides) { Control "$CNTRLMNU_LOOKLEFT" , "+look_left" Control "$CNTRLMNU_LOOKRIGHT" , "+look_right" @@ -593,11 +568,10 @@ OptionMenu "WeaponsControlMenu"// protected Control "$CNTRLMNU_SLOT8" , "slot 8" Control "$CNTRLMNU_SLOT9" , "slot 9" Control "$CNTRLMNU_SLOT0" , "slot 10" - StaticText "" - Control "$CNTRLMNU_HOLSTER" , "holsterweapon" - ifgame(Fury) + ifnotgame(Exhumed) { - Control "$CNTRLMNU_RELOAD" , "steroids" + StaticText "" + Control "$CNTRLMNU_HOLSTER" , "holsterweapon" } ifgame(Duke, Nam, WW2GI) { @@ -714,7 +688,10 @@ OptionMenu "OtherControlsMenu"// protected Control "$CNTRLMNU_ADJUST_GAMMA" , "bumpgamma" StaticText "" - Control "$CNTRLMNU_OPEN_HELP" , "openhelpmenu" + ifnotgame(Exhumed) + { + Control "$CNTRLMNU_OPEN_HELP" , "openhelpmenu" + } Control "$CNTRLMNU_OPEN_SAVE" , "opensavemenu" Control "$CNTRLMNU_OPEN_LOAD" , "openloadmenu" Control "$CNTRLMNU_OPEN_OPTIONS" , "openmenu optionsmenu" @@ -863,7 +840,7 @@ OptionMenu "NewPlayerMenu" //protected { Title "$MNU_PLAYERSETUP" TextField "$PLYRMNU_NAME", playername - ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) + ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides) { Option "$PLYRMNU_PLAYERCOLOR", "playercolor", "PlayerColors" } @@ -983,7 +960,7 @@ OptionMenu "VideoOptions" //protected { Option "$DSPLYMNU_SLOPETILT", "cl_slopetilting", "OnOff" } - ifgame (Duke, Nam, WW2GI, Fury, Redneck, RedneckRides, Deer) + ifgame (Duke, Nam, WW2GI, Redneck, RedneckRides) { Option "$DSPLYMNU_VIEWBOB", "cl_viewbob", "OnOff" } @@ -1167,7 +1144,7 @@ OptionMenu SoundOptions //protected { Option "$SNDMNU_CDEMU", "mus_redbook", "OnOff" } - ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides, ShadowWarrior) + ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides, ShadowWarrior) { Option "$SNDMNU_AMBIENCE", "snd_ambience", "OnOff" Option "$SNDMNU_SPEECH", "snd_speech", "OnOff" @@ -1466,12 +1443,12 @@ OptionMenu "MiscOptions" //protected LISTMENU "MultiMenu" { - ifgame(Duke, Nam, WW2GI, Fury) + ifgame(Duke, Nam, WW2GI) { position 160, 55, 135 centermenu fixedspacing 5 - ifgame(Duke, Nam, WW2GI, Fury) + ifgame(Duke, Nam, WW2GI) { class "Duke.ListMenu" }