- option menus are working, although all colors are still wrong and the captions are not displayed.

This commit is contained in:
Christoph Oelckers 2020-10-04 21:42:40 +02:00
parent 7f6b02c451
commit 26a31a626d
4 changed files with 74 additions and 38 deletions

View file

@ -1835,7 +1835,6 @@ static const gamefilter games[] = {
{ "Worldtour", GAMEFLAG_WORLDTOUR}, { "Worldtour", GAMEFLAG_WORLDTOUR},
}; };
// for other parts that need to filter by game name.
bool validFilter(const char* str) bool validFilter(const char* str)
{ {
for (auto& gf : games) for (auto& gf : games)

View file

@ -347,7 +347,8 @@ void Display()
twodpsp.SetSize(screen->GetWidth(), screen->GetHeight()); twodpsp.SetSize(screen->GetWidth(), screen->GetHeight());
twodpsp.ClearClipRect(); twodpsp.ClearClipRect();
twod->Clear(); twod->Clear();
twod->SetSize(screen->GetWidth(), screen->GetHeight()); //twod->SetSize(screen->GetWidth(), screen->GetHeight());
twod->Begin(screen->GetWidth(), screen->GetHeight());
twod->ClearClipRect(); twod->ClearClipRect();
switch (gamestate) switch (gamestate)
{ {

View file

@ -184,7 +184,7 @@ static void SkipSubBlock(FScanner &sc)
// //
//============================================================================= //=============================================================================
static bool CheckSkipGameBlock(FScanner &sc) static bool CheckSkipGameBlock(FScanner &sc, bool yes = true)
{ {
bool filter = false; bool filter = false;
sc.MustGetStringName("("); sc.MustGetStringName("(");
@ -195,7 +195,7 @@ static bool CheckSkipGameBlock(FScanner &sc)
} }
while (sc.CheckString(",")); while (sc.CheckString(","));
sc.MustGetStringName(")"); sc.MustGetStringName(")");
if (!filter) if (filter != yes)
{ {
SkipSubBlock(sc); SkipSubBlock(sc);
return !sc.CheckString("else"); return !sc.CheckString("else");
@ -282,6 +282,14 @@ static void ParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc)
ParseListMenuBody(sc, desc); ParseListMenuBody(sc, desc);
} }
} }
else if (sc.Compare("ifnotgame"))
{
if (!CheckSkipGameBlock(sc, false))
{
// recursively parse sub-block
ParseListMenuBody(sc, desc);
}
}
else if (sc.Compare("ifoption")) else if (sc.Compare("ifoption"))
{ {
if (!CheckSkipOptionBlock(sc)) if (!CheckSkipOptionBlock(sc))
@ -773,6 +781,14 @@ static void ParseOptionSettings(FScanner &sc)
ParseOptionSettings(sc); ParseOptionSettings(sc);
} }
} }
else if (sc.Compare("ifnotgame"))
{
if (!CheckSkipGameBlock(sc, false))
{
// recursively parse sub-block
ParseOptionSettings(sc);
}
}
else if (sc.Compare("Linespacing")) else if (sc.Compare("Linespacing"))
{ {
sc.MustGetNumber(); sc.MustGetNumber();
@ -814,6 +830,14 @@ static void ParseOptionMenuBody(FScanner &sc, DOptionMenuDescriptor *desc)
ParseOptionMenuBody(sc, desc); ParseOptionMenuBody(sc, desc);
} }
} }
else if (sc.Compare("ifnotgame"))
{
if (!CheckSkipGameBlock(sc, false))
{
// recursively parse sub-block
ParseOptionMenuBody(sc, desc);
}
}
else if (sc.Compare("ifoption")) else if (sc.Compare("ifoption"))
{ {
if (!CheckSkipOptionBlock(sc)) if (!CheckSkipOptionBlock(sc))
@ -832,7 +856,7 @@ static void ParseOptionMenuBody(FScanner &sc, DOptionMenuDescriptor *desc)
} }
desc->mClass = cls; desc->mClass = cls;
} }
else if (sc.Compare("Title")) else if (sc.Compare({ "Title", "Caption" }))
{ {
sc.MustGetString(); sc.MustGetString();
desc->mTitle = sc.String; desc->mTitle = sc.String;

View file

@ -6,7 +6,7 @@
LISTMENU "MainMenu" LISTMENU "MainMenu"
{ {
ScriptId 0 /*
class "$.MainMenu" class "$.MainMenu"
ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides) ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides)
{ {
@ -65,6 +65,7 @@ LISTMENU "MainMenu"
NativeTextItem "3463", "v", "OptionsMenu" NativeTextItem "3463", "v", "OptionsMenu"
NativeTextItem "3464", "q", "QuitMenu" NativeTextItem "3464", "q", "QuitMenu"
} }
*/
} }
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
@ -75,7 +76,7 @@ LISTMENU "MainMenu"
LISTMENU "IngameMenu" LISTMENU "IngameMenu"
{ {
ScriptId 50 /*
class "$.MainMenu" class "$.MainMenu"
ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides) ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides)
{ {
@ -134,6 +135,7 @@ LISTMENU "IngameMenu"
NativeTextItem "3463", "v", "OptionsMenu" NativeTextItem "3463", "v", "OptionsMenu"
NativeTextItem "3464", "q", "QuitMenu" NativeTextItem "3464", "q", "QuitMenu"
} }
*/
} }
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
@ -144,6 +146,7 @@ LISTMENU "IngameMenu"
LISTMENU "EpisodeMenu" LISTMENU "EpisodeMenu"
{ {
/*
ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides) ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides)
{ {
class "$.ListMenu" class "$.ListMenu"
@ -167,12 +170,12 @@ LISTMENU "EpisodeMenu"
Position 35, 32 Position 35, 32
Linespacing 17 Linespacing 17
} }
*/
ScriptId 100
} }
LISTMENU "SkillMenu" LISTMENU "SkillMenu"
{ {
/*
ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides) ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides)
{ {
class "$.ListMenu" class "$.ListMenu"
@ -197,7 +200,7 @@ LISTMENU "SkillMenu"
Position 35, 32 Position 35, 32
Linespacing 17 Linespacing 17
} }
ScriptId 110 */
} }
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
@ -206,6 +209,7 @@ LISTMENU "SkillMenu"
// //
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
/*
ImageScroller "HelpMenu" ImageScroller "HelpMenu"
{ {
ifgame(Duke, Nam, WW2GI) ifgame(Duke, Nam, WW2GI)
@ -249,6 +253,7 @@ ImageScroller "HelpMenu"
} }
} }
} }
*/
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
// //
@ -261,6 +266,7 @@ ImageScroller "HelpMenu"
// //
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
/*
ImageScroller "CreditsMenu" ImageScroller "CreditsMenu"
{ {
ifgame(Duke, Nam, WW2GI) ifgame(Duke, Nam, WW2GI)
@ -351,6 +357,7 @@ ImageScroller "CreditsMenu"
ImageItem "#5113" ImageItem "#5113"
} }
} }
*/
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
// //
@ -360,9 +367,11 @@ ImageScroller "CreditsMenu"
ListMenu "LoadGameMenu" ListMenu "LoadGameMenu"
{ {
/*
Caption "$MNU_LOADGAME" Caption "$MNU_LOADGAME"
Position 0, 40 Position 0, 40
Class "LoadMenu" // uses its own implementation Class "LoadMenu" // uses its own implementation
*/
} }
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
@ -373,9 +382,11 @@ ListMenu "LoadGameMenu"
ListMenu "SaveGameMenu" ListMenu "SaveGameMenu"
{ {
/*
Caption "$MNU_SAVEGAME" Caption "$MNU_SAVEGAME"
Position 0, 40 Position 0, 40
Class "SaveMenu" // uses its own implementation Class "SaveMenu" // uses its own implementation
*/
} }
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
@ -426,7 +437,7 @@ DefaultOptionMenu
Position 85 Position 85
} }
OptionMenu "OptionsMenu" OptionMenu "OptionsMenu" protected
{ {
Caption "$MNU_OPTIONS" Caption "$MNU_OPTIONS"
Submenu "$OPTMNU_CONTROLS", "CustomizeControls" Submenu "$OPTMNU_CONTROLS", "CustomizeControls"
@ -452,7 +463,7 @@ OptionMenu "OptionsMenu"
// //
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
OptionMenu "CustomizeControls" OptionMenu "CustomizeControls" protected
{ {
Title "$CNTRLMNU_TITLE" Title "$CNTRLMNU_TITLE"
@ -469,7 +480,7 @@ OptionMenu "CustomizeControls"
SafeCommand "$CTRL_LEFTHANDED", "controlpreset 2" //engine/leftbinds.txt SafeCommand "$CTRL_LEFTHANDED", "controlpreset 2" //engine/leftbinds.txt
} }
OptionMenu "ActionControlsMenu"// protected OptionMenu "ActionControlsMenu" protected
{ {
Title "$CNTRLMNU_ACTION_TITLE" Title "$CNTRLMNU_ACTION_TITLE"
ScrollTop 2 ScrollTop 2
@ -531,7 +542,7 @@ OptionMenu "ActionControlsMenu"// protected
//Control "$CNTRLMNU_SCOREBOARD" , "+show_dukematch_scores" //Control "$CNTRLMNU_SCOREBOARD" , "+show_dukematch_scores"
} }
OptionMenu "ChatControlsMenu"// protected OptionMenu "ChatControlsMenu" protected
{ {
Title "$CNTRLMNU_CHAT_TITLE" Title "$CNTRLMNU_CHAT_TITLE"
ScrollTop 2 ScrollTop 2
@ -541,7 +552,7 @@ OptionMenu "ChatControlsMenu"// protected
Control "$CNTRLMNU_SAY" , "+send_message" Control "$CNTRLMNU_SAY" , "+send_message"
} }
OptionMenu "WeaponsControlMenu"// protected OptionMenu "WeaponsControlMenu" protected
{ {
Title "$CNTRLMNU_WEAPONS_TITLE" Title "$CNTRLMNU_WEAPONS_TITLE"
ScrollTop 2 ScrollTop 2
@ -587,7 +598,7 @@ OptionMenu "WeaponsControlMenu"// protected
} }
OptionMenu "InventoryControlsMenu"// protected OptionMenu "InventoryControlsMenu" protected
{ {
Title "$CNTRLMNU_INVENTORY_TITLE" Title "$CNTRLMNU_INVENTORY_TITLE"
ScrollTop 2 ScrollTop 2
@ -663,7 +674,7 @@ OptionMenu "InventoryControlsMenu"// protected
} }
} }
OptionMenu "OtherControlsMenu"// protected OptionMenu "OtherControlsMenu" protected
{ {
Title "$CNTRLMNU_OTHER_TITLE" Title "$CNTRLMNU_OTHER_TITLE"
ScrollTop 2 ScrollTop 2
@ -701,7 +712,7 @@ OptionMenu "OtherControlsMenu"// protected
} }
OptionMenu "MapControlsMenu" OptionMenu "MapControlsMenu" protected
{ {
Title "$MAPCNTRLMNU_CONTROLS" Title "$MAPCNTRLMNU_CONTROLS"
@ -747,7 +758,7 @@ OptionString "Cursors"
"-", "$OPTSTR_SYSTEMCURSOR" "-", "$OPTSTR_SYSTEMCURSOR"
} }
OptionMenu "MouseOptions" //protected OptionMenu "MouseOptions" protected
{ {
Title "$MOUSEMNU_TITLE" Title "$MOUSEMNU_TITLE"
//Option "$MOUSEMNU_ENABLEMOUSE", "in_mouse", "YesNo" //Option "$MOUSEMNU_ENABLEMOUSE", "in_mouse", "YesNo"
@ -776,7 +787,7 @@ OptionMenu "MouseOptions" //protected
// //
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
OptionMenu "JoystickOptions" //protected OptionMenu "JoystickOptions" protected
{ {
Title "$JOYMNU_OPTIONS" Title "$JOYMNU_OPTIONS"
// This will be filled in by joystick code if devices get connected or disconnected // This will be filled in by joystick code if devices get connected or disconnected
@ -799,7 +810,7 @@ OptionValue "Inversion"
1, "$OPTVAL_INVERTED" 1, "$OPTVAL_INVERTED"
} }
OptionMenu "JoystickConfigMenu" //protected OptionMenu "JoystickConfigMenu" protected
{ {
Title "$JOYMNU_TITLE" Title "$JOYMNU_TITLE"
Class "JoystickConfigMenu" Class "JoystickConfigMenu"
@ -851,7 +862,7 @@ OptionValue "Gender"
} }
OptionMenu "NewPlayerMenu" //protected OptionMenu "NewPlayerMenu" protected
{ {
Title "$MNU_PLAYERSETUP" Title "$MNU_PLAYERSETUP"
TextField "$PLYRMNU_NAME", playername TextField "$PLYRMNU_NAME", playername
@ -866,10 +877,10 @@ OptionMenu "NewPlayerMenu" //protected
} }
Option "$PLYRMNU_PLAYERGENDER", "playergender", "Gender" Option "$PLYRMNU_PLAYERGENDER", "playergender", "Gender"
Submenu "$PLRMNU_TAUNTS", "TauntsMenu" Submenu "$PLRMNU_TAUNTS", "TauntsMenu"
Class "NewPlayerMenu" //Class "NewPlayerMenu"
} }
OptionMenu "TauntsMenu" //protected OptionMenu "TauntsMenu" protected
{ {
Title "$PLRMNU_TAUNTS" Title "$PLRMNU_TAUNTS"
TextField "1", "combatmacro0" TextField "1", "combatmacro0"
@ -911,7 +922,7 @@ OptionValue "WeapSwitch"
} }
OptionMenu GameplayOptions //protected OptionMenu GameplayOptions protected
{ {
Title "$GMPLYMNU_TITLE" Title "$GMPLYMNU_TITLE"
Option "$PLYRMNU_AUTOAIM", "cl_autoaim", "AimMode" Option "$PLYRMNU_AUTOAIM", "cl_autoaim", "AimMode"
@ -967,7 +978,7 @@ OptionValue "Multisample"
} }
OptionMenu "VideoOptions" //protected OptionMenu "VideoOptions" protected
{ {
Title "$DSPLYMNU_TITLE" Title "$DSPLYMNU_TITLE"
@ -1112,7 +1123,7 @@ OptionValue CrosshairHealthTypes
2.0, "$OPTVAL_YES_ENHANCED" 2.0, "$OPTVAL_YES_ENHANCED"
} }
OptionMenu "HUDOptions" //protected OptionMenu "HUDOptions" protected
{ {
Title "$OPTMNU_HUD" Title "$OPTMNU_HUD"
@ -1231,7 +1242,7 @@ OptionString SpeakerModes
} }
OptionMenu OpenALSoundItems //protected OptionMenu OpenALSoundItems protected
{ {
Title "$OPENALMNU_TITLE" Title "$OPENALMNU_TITLE"
Option "$OPENALMNU_PLAYBACKDEVICE", "snd_aldevice", "ALDevices" Option "$OPENALMNU_PLAYBACKDEVICE", "snd_aldevice", "ALDevices"
@ -1245,7 +1256,7 @@ OptionValue MidiDevices
// filled in by the sound code // filled in by the sound code
} }
OptionMenu SoundOptions //protected OptionMenu SoundOptions protected
{ {
Title "$SNDMNU_TITLE" Title "$SNDMNU_TITLE"
Slider "$MODMNU_MASTERVOLUME", "snd_mastervolume", 0, 1, 0.05, 2 Slider "$MODMNU_MASTERVOLUME", "snd_mastervolume", 0, 1, 0.05, 2
@ -1288,7 +1299,7 @@ OptionMenu SoundOptions //protected
*=======================================*/ *=======================================*/
OptionMenu AdvSoundOptions //protected OptionMenu AdvSoundOptions protected
{ {
Title "$ADVSNDMNU_TITLE" Title "$ADVSNDMNU_TITLE"
Option "$ADVSNDMNU_LOOKUPMUS", "mus_extendedlookup", "OnOff" Option "$ADVSNDMNU_LOOKUPMUS", "mus_extendedlookup", "OnOff"
@ -1314,12 +1325,12 @@ OptionMenu AdvSoundOptions //protected
} }
OptionMenu TimidityConfigMenu //protected OptionMenu TimidityConfigMenu protected
{ {
Title "$ADVSNDMNU_SELCONFIG" Title "$ADVSNDMNU_SELCONFIG"
} }
OptionMenu FluidPatchsetMenu //protected OptionMenu FluidPatchsetMenu protected
{ {
Title "$ADVSNDMNU_SELCONFIG" Title "$ADVSNDMNU_SELCONFIG"
} }
@ -1352,7 +1363,7 @@ OptionValue ModVolumeRamps
OptionMenu ModReplayerOptions //protected OptionMenu ModReplayerOptions protected
{ {
Title "$MODMNU_TITLE" Title "$MODMNU_TITLE"
Slider "$MODMNU_MASTERVOLUME", "mod_dumb_mastervolume", 1, 16, 0.5, 1 Slider "$MODMNU_MASTERVOLUME", "mod_dumb_mastervolume", 1, 16, 0.5, 1
@ -1372,7 +1383,7 @@ OptionMenu ModReplayerOptions //protected
* *
*=======================================*/ *=======================================*/
OptionMenu MidiPlayerOptions /*FluidsynthOptions*/ //protected OptionMenu MidiPlayerOptions /*FluidsynthOptions*/ protected
{ {
Title "$SNDMNU_MIDIPLAYER" Title "$SNDMNU_MIDIPLAYER"
//Title "$ADVSNDMNU_FLUIDSYNTH" //Title "$ADVSNDMNU_FLUIDSYNTH"
@ -1445,7 +1456,7 @@ OptionValue GPUSwitch
2.0, "$OPTVAL_INTEGRATED" 2.0, "$OPTVAL_INTEGRATED"
} }
OptionMenu VideoModeMenu //protected OptionMenu VideoModeMenu protected
{ {
Title "$VIDMNU_TITLE" Title "$VIDMNU_TITLE"
@ -1485,7 +1496,7 @@ OptionMenu VideoModeMenu //protected
SubMenu "$VIDMNU_RESPRESET", CustomResolutionMenu SubMenu "$VIDMNU_RESPRESET", CustomResolutionMenu
} }
OptionMenu CustomResolutionMenu //protected OptionMenu CustomResolutionMenu protected
{ {
Title "$VIDMNU_RESPRESETTTL" Title "$VIDMNU_RESPRESETTTL"
@ -1530,7 +1541,7 @@ OptionValue Autosave
2, "$OPTVAL_NEVER" 2, "$OPTVAL_NEVER"
} }
OptionMenu "MiscOptions" //protected OptionMenu "MiscOptions" protected
{ {
Title "$MISCMNU_TITLE" Title "$MISCMNU_TITLE"
//Indent 220 //Indent 220
@ -1567,7 +1578,7 @@ OptionMenu "MiscOptions" //protected
// No multiplayer support for now, but kept for documentation. // No multiplayer support for now, but kept for documentation.
// //
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
/*
LISTMENU "MultiMenu" LISTMENU "MultiMenu"
{ {
ifgame(Duke, Nam, WW2GI) ifgame(Duke, Nam, WW2GI)
@ -1652,6 +1663,7 @@ OptionMenu "MultiOptionsMenu"
Option "$NETMNU_FFIRE", "m_ffire", "OnOff" Option "$NETMNU_FFIRE", "m_ffire", "OnOff"
SafeCommand "$NETMNU_ACCEPT", "MultiAccept" SafeCommand "$NETMNU_ACCEPT", "MultiAccept"
} }
*/
OptionMenu "EngineCredits" OptionMenu "EngineCredits"
{ {