- disabled a few menu options for unsupported features in Exhumed.

Fixes #255
This commit is contained in:
Christoph Oelckers 2020-08-25 20:40:30 +02:00
parent e97fb2ab7f
commit 5df0a7241f
3 changed files with 70 additions and 57 deletions

View file

@ -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; int filter = 0;
sc.MustGetStringName("("); sc.MustGetStringName("(");
@ -186,6 +186,7 @@ static bool CheckSkipGameBlock(FScanner &sc)
filter |= games[gi].gameflag; filter |= games[gi].gameflag;
} }
while (sc.CheckString(",")); while (sc.CheckString(","));
if (negate) filter = ~filter;
sc.MustGetStringName(")"); sc.MustGetStringName(")");
if (!(filter & g_gameType)) if (!(filter & g_gameType))
{ {
@ -287,6 +288,14 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
ParseListMenuBody(sc, 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")) else if (sc.Compare("ifoption"))
{ {
if (!CheckSkipOptionBlock(sc)) if (!CheckSkipOptionBlock(sc))
@ -590,6 +599,14 @@ static void ParseImageScrollerBody(FScanner &sc, FImageScrollerDescriptor *desc)
ParseImageScrollerBody(sc, 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")) else if (sc.Compare("ifshareware"))
{ {
if (!CheckSkipNoSwBlock(sc)) if (!CheckSkipNoSwBlock(sc))
@ -768,6 +785,14 @@ static void ParseOptionSettings(FScanner &sc)
ParseOptionSettings(sc); ParseOptionSettings(sc);
} }
} }
else if (sc.Compare("ifnotgame"))
{
if (!CheckSkipGameBlock(sc, true))
{
// recursively parse sub-block
ParseOptionSettings(sc);
}
}
else if (sc.Compare("Linespacing")) else if (sc.Compare("Linespacing"))
{ {
sc.MustGetNumber(); sc.MustGetNumber();
@ -809,6 +834,14 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
ParseOptionMenuBody(sc, 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")) else if (sc.Compare("ifshareware"))
{ {
if (!CheckSkipNoSwBlock(sc)) if (!CheckSkipNoSwBlock(sc))

View file

@ -210,10 +210,13 @@ void registerinputcommands()
C_RegisterFunction("invprev", nullptr, [](CCmdFuncPtr)->int { if (PlayerList[nLocalPlayer].nHealth > 0) SetPrevItem(nLocalPlayer); return CCMD_OK; }); 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("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; }); C_RegisterFunction("invuse", nullptr, [](CCmdFuncPtr)->int { if (PlayerList[nLocalPlayer].nHealth > 0) UseCurItem(nLocalPlayer); return CCMD_OK; });
// todo: // todo: These still need to be implemented.
//C_RegisterFunction("weapprev", nullptr, [](CCmdFuncPtr)->int { WeaponToSend = 11; return CCMD_OK; }); C_RegisterFunction("weapprev", nullptr, [](CCmdFuncPtr)->int { /*WeaponToSend = 11;*/ return CCMD_OK; });
//C_RegisterFunction("weapnext", nullptr, [](CCmdFuncPtr)->int { WeaponToSend = 12; 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; });
// 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; });
} }

View file

@ -77,19 +77,11 @@ LISTMENU "IngameMenu"
{ {
ScriptId 50 ScriptId 50
class "$.MainMenu" 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 position 160, 55, 115
centermenu centermenu
animatedtransition animatedtransition
}
NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
NativeTextItem "$MNU_SAVEGAME", "s", "SaveGameMenu" NativeTextItem "$MNU_SAVEGAME", "s", "SaveGameMenu"
NativeTextItem "$MNU_LOADGAME", "l", "LoadGameMenu" NativeTextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
@ -98,18 +90,6 @@ LISTMENU "IngameMenu"
NativeTextItem "$MNU_ENDGAME", "e", "EndgameMenu" NativeTextItem "$MNU_ENDGAME", "e", "EndgameMenu"
NativeTextItem "$MNU_QUITGAME", "q", "QuitMenu" 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) ifgame(Blood)
{ {
position 160, 45, 150 position 160, 45, 150
@ -164,7 +144,7 @@ LISTMENU "IngameMenu"
LISTMENU "EpisodeMenu" LISTMENU "EpisodeMenu"
{ {
ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) // Ion Fury does not use this menu. ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides)
{ {
class "$.ListMenu" class "$.ListMenu"
caption "$MNU_SELECTEPISODE" caption "$MNU_SELECTEPISODE"
@ -193,20 +173,12 @@ LISTMENU "EpisodeMenu"
LISTMENU "SkillMenu" LISTMENU "SkillMenu"
{ {
ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides)
{ {
class "$.ListMenu" class "$.ListMenu"
ifgame(fury)
{
position 160, 55, 115
fixedspacing 2
}
else
{
position 160, 55, 115 position 160, 55, 115
centermenu centermenu
animatedtransition animatedtransition
}
caption "$MNU_SELECTSKILL" caption "$MNU_SELECTSKILL"
fixedspacing 5 fixedspacing 5
animatedtransition animatedtransition
@ -236,7 +208,7 @@ LISTMENU "SkillMenu"
ImageScroller "HelpMenu" ImageScroller "HelpMenu"
{ {
ifgame(Duke, Nam, WW2GI, Fury) ifgame(Duke, Nam, WW2GI)
{ {
ImageItem "#3280", 400 ImageItem "#3280", 400
ImageItem "#2445", 401 ImageItem "#2445", 401
@ -246,7 +218,7 @@ ImageScroller "HelpMenu"
animatedtransition animatedtransition
} }
} }
ifgame(Redneck, RedneckRides, Deer) ifgame(Redneck, RedneckRides)
{ {
ImageItem "#2541" ImageItem "#2541"
ImageItem "#1633" ImageItem "#1633"
@ -526,12 +498,15 @@ OptionMenu "ActionControlsMenu"// protected
StaticText "" StaticText ""
Control "$CNTRLMNU_TURNLEFT" , "+turn_left" Control "$CNTRLMNU_TURNLEFT" , "+turn_left"
Control "$CNTRLMNU_TURNRIGHT" , "+turn_right" Control "$CNTRLMNU_TURNRIGHT" , "+turn_right"
ifnotgame(Exhumed)
{
Control "$CNTRLMNU_TURN180" , "turnaround" Control "$CNTRLMNU_TURN180" , "turnaround"
}
StaticText "" StaticText ""
Control "$CNTRLMNU_JUMP" , "+jump" Control "$CNTRLMNU_JUMP" , "+jump"
Control "$CNTRLMNU_CROUCH" , "+crouch" Control "$CNTRLMNU_CROUCH" , "+crouch"
ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides)
{ {
// Fixme: Make this work in all games // Fixme: Make this work in all games
Control "$CNTRLMNU_TOGGLECROUCH" , "+toggle_crouch" Control "$CNTRLMNU_TOGGLECROUCH" , "+toggle_crouch"
@ -545,7 +520,7 @@ OptionMenu "ActionControlsMenu"// protected
Control "$CNTRLMNU_AIMDOWN" , "+aim_down" Control "$CNTRLMNU_AIMDOWN" , "+aim_down"
Control "$CNTRLMNU_LOOKUP" , "+look_up" Control "$CNTRLMNU_LOOKUP" , "+look_up"
Control "$CNTRLMNU_LOOKDOWN" , "+look_down" 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_LOOKLEFT" , "+look_left"
Control "$CNTRLMNU_LOOKRIGHT" , "+look_right" Control "$CNTRLMNU_LOOKRIGHT" , "+look_right"
@ -593,11 +568,10 @@ OptionMenu "WeaponsControlMenu"// protected
Control "$CNTRLMNU_SLOT8" , "slot 8" Control "$CNTRLMNU_SLOT8" , "slot 8"
Control "$CNTRLMNU_SLOT9" , "slot 9" Control "$CNTRLMNU_SLOT9" , "slot 9"
Control "$CNTRLMNU_SLOT0" , "slot 10" Control "$CNTRLMNU_SLOT0" , "slot 10"
ifnotgame(Exhumed)
{
StaticText "" StaticText ""
Control "$CNTRLMNU_HOLSTER" , "holsterweapon" Control "$CNTRLMNU_HOLSTER" , "holsterweapon"
ifgame(Fury)
{
Control "$CNTRLMNU_RELOAD" , "steroids"
} }
ifgame(Duke, Nam, WW2GI) ifgame(Duke, Nam, WW2GI)
{ {
@ -714,7 +688,10 @@ OptionMenu "OtherControlsMenu"// protected
Control "$CNTRLMNU_ADJUST_GAMMA" , "bumpgamma" Control "$CNTRLMNU_ADJUST_GAMMA" , "bumpgamma"
StaticText "" StaticText ""
ifnotgame(Exhumed)
{
Control "$CNTRLMNU_OPEN_HELP" , "openhelpmenu" Control "$CNTRLMNU_OPEN_HELP" , "openhelpmenu"
}
Control "$CNTRLMNU_OPEN_SAVE" , "opensavemenu" Control "$CNTRLMNU_OPEN_SAVE" , "opensavemenu"
Control "$CNTRLMNU_OPEN_LOAD" , "openloadmenu" Control "$CNTRLMNU_OPEN_LOAD" , "openloadmenu"
Control "$CNTRLMNU_OPEN_OPTIONS" , "openmenu optionsmenu" Control "$CNTRLMNU_OPEN_OPTIONS" , "openmenu optionsmenu"
@ -863,7 +840,7 @@ OptionMenu "NewPlayerMenu" //protected
{ {
Title "$MNU_PLAYERSETUP" Title "$MNU_PLAYERSETUP"
TextField "$PLYRMNU_NAME", playername TextField "$PLYRMNU_NAME", playername
ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides)
{ {
Option "$PLYRMNU_PLAYERCOLOR", "playercolor", "PlayerColors" Option "$PLYRMNU_PLAYERCOLOR", "playercolor", "PlayerColors"
} }
@ -983,7 +960,7 @@ OptionMenu "VideoOptions" //protected
{ {
Option "$DSPLYMNU_SLOPETILT", "cl_slopetilting", "OnOff" 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" Option "$DSPLYMNU_VIEWBOB", "cl_viewbob", "OnOff"
} }
@ -1167,7 +1144,7 @@ OptionMenu SoundOptions //protected
{ {
Option "$SNDMNU_CDEMU", "mus_redbook", "OnOff" 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_AMBIENCE", "snd_ambience", "OnOff"
Option "$SNDMNU_SPEECH", "snd_speech", "OnOff" Option "$SNDMNU_SPEECH", "snd_speech", "OnOff"
@ -1466,12 +1443,12 @@ OptionMenu "MiscOptions" //protected
LISTMENU "MultiMenu" LISTMENU "MultiMenu"
{ {
ifgame(Duke, Nam, WW2GI, Fury) ifgame(Duke, Nam, WW2GI)
{ {
position 160, 55, 135 position 160, 55, 135
centermenu centermenu
fixedspacing 5 fixedspacing 5
ifgame(Duke, Nam, WW2GI, Fury) ifgame(Duke, Nam, WW2GI)
{ {
class "Duke.ListMenu" class "Duke.ListMenu"
} }