diff --git a/source/blood/src/blood.h b/source/blood/src/blood.h index 1a1837fdf..0df1bebef 100644 --- a/source/blood/src/blood.h +++ b/source/blood/src/blood.h @@ -77,6 +77,7 @@ void sndPlaySpecialMusicOrNothing(int nMusic); struct GameInterface : ::GameInterface { + const char* Name() override { return "Blood"; } void faketimerhandler() override; int app_main() override; void UpdateScreenSize() override; diff --git a/source/build/include/baselayer.h b/source/build/include/baselayer.h index ba328bd7b..1ec810cad 100644 --- a/source/build/include/baselayer.h +++ b/source/build/include/baselayer.h @@ -98,6 +98,7 @@ enum EMenuSounds : int; struct GameInterface { + virtual const char* Name() { return "$"; } virtual ~GameInterface() {} virtual bool GenerateSavePic() { return false; } virtual void faketimerhandler() {} // This is a remnant of older versions, but Blood backend has not updated yet. diff --git a/source/common/gamecontrol.cpp b/source/common/gamecontrol.cpp index dac122893..d5a2b22a6 100644 --- a/source/common/gamecontrol.cpp +++ b/source/common/gamecontrol.cpp @@ -305,6 +305,8 @@ namespace Powerslave ::GameInterface* CreateInterface(); } +CVAR(Bool, duke_compatibility_15, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) + void CheckFrontend(int flags) { if (flags & GAMEFLAG_BLOOD) @@ -323,10 +325,15 @@ void CheckFrontend(int flags) { gi = Powerslave::CreateInterface(); } - else + else if (flags & GAMEFLAG_FURY) { gi = Duke::CreateInterface(); } + else + { + gi = *duke_compatibility_15 ? Redneck::CreateInterface() : Duke::CreateInterface(); + } + } void I_StartupJoysticks(); diff --git a/source/common/menu/menudef.cpp b/source/common/menu/menudef.cpp index 48dcb82b4..fb7a4ff57 100644 --- a/source/common/menu/menudef.cpp +++ b/source/common/menu/menudef.cpp @@ -303,7 +303,9 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc) else if (sc.Compare("Class")) { sc.MustGetString(); - desc->mClass = sc.String; + FString s = sc.String; + s.Substitute("$", gi->Name()); + desc->mClass = s; } else if (sc.Compare("Selector")) { @@ -633,7 +635,9 @@ static void ParseImageScrollerBody(FScanner &sc, FImageScrollerDescriptor *desc) else if (sc.Compare("Class")) { sc.MustGetString(); - desc->mClass = sc.String; + FString s = sc.String; + s.Substitute("$", gi->Name()); + desc->mClass = s; } else if (sc.Compare("TextItem") || sc.Compare("ImageItem")) { @@ -850,7 +854,9 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc) else if (sc.Compare("Class")) { sc.MustGetString(); - desc->mClass = sc.String; + FString s = sc.String; + s.Substitute("$", gi->Name()); + desc->mClass = s; } else if (sc.Compare("Title") || sc.Compare("Caption")) { diff --git a/source/duke3d/src/duke3d.h b/source/duke3d/src/duke3d.h index 3f257a104..d19145968 100644 --- a/source/duke3d/src/duke3d.h +++ b/source/duke3d/src/duke3d.h @@ -142,6 +142,7 @@ static inline int32_t G_DefaultActorHealth(int spriteNum) struct GameInterface : ::GameInterface { + const char* Name() override { return "Duke"; } int app_main() override; void UpdateScreenSize() override; void FreeGameData() override; diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 0577fecff..8e584fc88 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -273,6 +273,7 @@ void G_DoAutoload(const char* dirname); struct GameInterface : ::GameInterface { + const char* Name() override { return "Exhumed"; } int app_main() override; void UpdateScreenSize() override; bool GenerateSavePic() override; diff --git a/source/rr/src/d_menu.cpp b/source/rr/src/d_menu.cpp index b46879828..f861673ca 100644 --- a/source/rr/src/d_menu.cpp +++ b/source/rr/src/d_menu.cpp @@ -517,9 +517,11 @@ END_RR_NS static TMenuClassDescriptor _mm("Redneck.MainMenu"); static TMenuClassDescriptor _lm("Redneck.ListMenu"); +static TMenuClassDescriptor _ism("Redneck.ImageScrollerMenu"); // does not implement a new class, we only need the descriptor. void RegisterRedneckMenus() { menuClasses.Push(&_mm); menuClasses.Push(&_lm); + menuClasses.Push(&_ism); } diff --git a/source/rr/src/duke3d.h b/source/rr/src/duke3d.h index 1a840434c..0c93cfef3 100644 --- a/source/rr/src/duke3d.h +++ b/source/rr/src/duke3d.h @@ -145,6 +145,7 @@ static inline int32_t G_DefaultActorHealth(int spriteNum) struct GameInterface : ::GameInterface { + const char* Name() override { return "Redneck"; } int app_main() override; void UpdateScreenSize() override; void FreeGameData() override; diff --git a/source/sw/src/game.h b/source/sw/src/game.h index ca2d9df26..0fbd730c6 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -2428,7 +2428,8 @@ void LoadSaveMsg(const char *msg); struct GameInterface : ::GameInterface { - int app_main() override; + const char* Name() override { return "ShadowWarrior"; } + int app_main() override; void UpdateScreenSize() override; void FreeGameData() override; bool GenerateSavePic() override; diff --git a/wadsrc/static/engine/menudef.txt b/wadsrc/static/engine/menudef.txt index 35e8acd78..b1c806d81 100644 --- a/wadsrc/static/engine/menudef.txt +++ b/wadsrc/static/engine/menudef.txt @@ -7,6 +7,7 @@ LISTMENU "MainMenu" { ScriptId 0 + class "$.MainMenu" ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) { ifgame(fury) @@ -20,14 +21,6 @@ LISTMENU "MainMenu" centermenu animatedtransition } - ifgame(Duke, Nam, WW2GI, Fury) - { - class "Duke.MainMenu" - } - else - { - class "Redneck.MainMenu" - } NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" //NativeTextItem "$MNU_NEWGAME", "m", "MultiMenu" // In EDuke this replaces "New Game" when in networking mode. Kept here as a reminder. ifgame(fury) @@ -47,7 +40,6 @@ LISTMENU "MainMenu" { position 160, 45, 150 caption "Blood" - class "Blood.ListMenu" centermenu Linespacing 20 NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" @@ -62,7 +54,6 @@ LISTMENU "MainMenu" { Position 55, 32 Linespacing 17 - class "ShadowWarrior.MainMenu" NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" NativeTextItem "$MNU_LOADGAME", "l", "LoadGameMenu" NativeTextItem "$MNU_SAVEGAME", "s", "SaveGameMenu" @@ -82,7 +73,6 @@ LISTMENU "MainMenu" { Position 160, 65 centermenu - class "Exhumed.MainMenu" linespacing 22 NativeTextItem "3460", "n", "StartGame", 1 NativeTextItem "3461", "l", "LoadGameMenu" @@ -101,6 +91,7 @@ LISTMENU "MainMenu" LISTMENU "IngameMenu" { ScriptId 50 + class "$.MainMenu" ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) { ifgame(fury) @@ -114,14 +105,6 @@ LISTMENU "IngameMenu" centermenu animatedtransition } - ifgame(Duke, Nam, WW2GI, Fury) - { - class "Duke.MainMenu" - } - else - { - class "Redneck.MainMenu" - } NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" NativeTextItem "$MNU_SAVEGAME", "s", "SaveGameMenu" NativeTextItem "$MNU_LOADGAME", "l", "LoadGameMenu" @@ -134,7 +117,6 @@ LISTMENU "IngameMenu" { position 160, 45, 150 caption "Blood" - class "Blood.ListMenu" centermenu Linespacing 17 NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" @@ -150,7 +132,6 @@ LISTMENU "IngameMenu" { Position 55, 32 Linespacing 17 - class "ShadowWarrior.MainMenu" NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" NativeTextItem "$MNU_LOADGAME", "l", "LoadGameMenu" NativeTextItem "$MNU_SAVEGAME", "s", "SaveGameMenu" @@ -169,7 +150,6 @@ LISTMENU "IngameMenu" { Position 160, 65 centermenu - class "Exhumed.MainMenu" linespacing 22 NativeTextItem "3460", "n", "StartGame", 1 NativeTextItem "3461", "l", "LoadGameMenu" @@ -189,25 +169,18 @@ LISTMENU "EpisodeMenu" { ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) // Ion Fury does not use this menu. { + class "$.ListMenu" caption "$MNU_SELECTEPISODE" position 160, 48, 142 centermenu fixedspacing 5 animatedtransition - ifgame(Duke, Nam, WW2GI, Fury) - { - class "Duke.ListMenu" - } - else - { - class "Redneck.ListMenu" - } } ifgame(blood) { + class "$.ListMenu" caption "$MNU_EPISODES" position 160, 45, 150 - class "Blood.ListMenu" centermenu Linespacing 20 } @@ -225,6 +198,7 @@ LISTMENU "SkillMenu" { ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) { + class "$.ListMenu" ifgame(fury) { position 160, 55, 115 @@ -238,21 +212,13 @@ LISTMENU "SkillMenu" } caption "$MNU_SELECTSKILL" fixedspacing 5 - ifgame(Duke, Nam, WW2GI, Fury) - { - class "Duke.ListMenu" - } - else - { - class "Redneck.ListMenu" - } animatedtransition } ifgame(blood) { + class "$.ListMenu" caption "$MNU_DIFFICULTY" position 160, 60, 150 - class "Blood.ListMenu" centermenu Linespacing 20 } @@ -285,7 +251,7 @@ LISTMENU "CustomGameMenu" animatedtransition } ScriptId 102 - class "Duke.ListMenu" + class "$.ListMenu" centermenu } @@ -304,7 +270,7 @@ LISTMENU "CustomSubMenu1" } centermenu ScriptId 103 - class "Duke.ListMenu" + class "$.ListMenu" } LISTMENU "CustomSubMenu2" @@ -321,7 +287,7 @@ LISTMENU "CustomSubMenu2" } centermenu ScriptId 103 - class "Duke.ListMenu" + class "$.ListMenu" } LISTMENU "CustomSubMenu3" @@ -338,7 +304,7 @@ LISTMENU "CustomSubMenu3" } centermenu ScriptId 103 - class "Duke.ListMenu" + class "$.ListMenu" } LISTMENU "CustomSubMenu4" @@ -355,7 +321,7 @@ LISTMENU "CustomSubMenu4" } centermenu ScriptId 103 - class "Duke.ListMenu" + class "$.ListMenu" } LISTMENU "CustomSubMenu5" @@ -372,7 +338,7 @@ LISTMENU "CustomSubMenu5" } centermenu ScriptId 103 - class "Duke.ListMenu" + class "$.ListMenu" } LISTMENU "CustomSubMenu6" @@ -389,7 +355,7 @@ LISTMENU "CustomSubMenu6" } centermenu ScriptId 103 - class "Duke.ListMenu" + class "$.ListMenu" } LISTMENU "CustomSubMenu7" @@ -406,7 +372,7 @@ LISTMENU "CustomSubMenu7" } centermenu ScriptId 103 - class "Duke.ListMenu" + class "$.ListMenu" } //------------------------------------------------------------------------------------------- @@ -421,7 +387,7 @@ ImageScroller "HelpMenu" { ImageItem "TEXTSTORY", 400 ImageItem "F1HELP", 401 - class "Duke.ImageScrollerMenu" + class "$.ImageScrollerMenu" ifgame(Duke, Nam, WW2GI) { animatedtransition @@ -439,7 +405,7 @@ ImageScroller "HelpMenu" } ifgame(blood) { - class "Blood.ImageScrollerMenu" + class "$.ImageScrollerMenu" // The duplication here is to integrate the alternating versions of HELP3 QAVAnimationItem "Help4.qav" QAVAnimationItem "Help5.qav"