- allow starting Duke, NAM and WW2GI with the RedNukem-based game code for Redneck Rampage.

This mainly required some rework of the menu setup to be less explicit about the frontend's menu classes.
This commit is contained in:
Christoph Oelckers 2020-02-12 20:25:59 +01:00
parent 82939f2037
commit 7909f29691
10 changed files with 42 additions and 55 deletions

View file

@ -77,6 +77,7 @@ void sndPlaySpecialMusicOrNothing(int nMusic);
struct GameInterface : ::GameInterface struct GameInterface : ::GameInterface
{ {
const char* Name() override { return "Blood"; }
void faketimerhandler() override; void faketimerhandler() override;
int app_main() override; int app_main() override;
void UpdateScreenSize() override; void UpdateScreenSize() override;

View file

@ -98,6 +98,7 @@ enum EMenuSounds : int;
struct GameInterface struct GameInterface
{ {
virtual const char* Name() { return "$"; }
virtual ~GameInterface() {} virtual ~GameInterface() {}
virtual bool GenerateSavePic() { return false; } virtual bool GenerateSavePic() { return false; }
virtual void faketimerhandler() {} // This is a remnant of older versions, but Blood backend has not updated yet. virtual void faketimerhandler() {} // This is a remnant of older versions, but Blood backend has not updated yet.

View file

@ -305,6 +305,8 @@ namespace Powerslave
::GameInterface* CreateInterface(); ::GameInterface* CreateInterface();
} }
CVAR(Bool, duke_compatibility_15, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
void CheckFrontend(int flags) void CheckFrontend(int flags)
{ {
if (flags & GAMEFLAG_BLOOD) if (flags & GAMEFLAG_BLOOD)
@ -323,10 +325,15 @@ void CheckFrontend(int flags)
{ {
gi = Powerslave::CreateInterface(); gi = Powerslave::CreateInterface();
} }
else else if (flags & GAMEFLAG_FURY)
{ {
gi = Duke::CreateInterface(); gi = Duke::CreateInterface();
} }
else
{
gi = *duke_compatibility_15 ? Redneck::CreateInterface() : Duke::CreateInterface();
}
} }
void I_StartupJoysticks(); void I_StartupJoysticks();

View file

@ -303,7 +303,9 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
else if (sc.Compare("Class")) else if (sc.Compare("Class"))
{ {
sc.MustGetString(); sc.MustGetString();
desc->mClass = sc.String; FString s = sc.String;
s.Substitute("$", gi->Name());
desc->mClass = s;
} }
else if (sc.Compare("Selector")) else if (sc.Compare("Selector"))
{ {
@ -633,7 +635,9 @@ static void ParseImageScrollerBody(FScanner &sc, FImageScrollerDescriptor *desc)
else if (sc.Compare("Class")) else if (sc.Compare("Class"))
{ {
sc.MustGetString(); 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")) else if (sc.Compare("TextItem") || sc.Compare("ImageItem"))
{ {
@ -850,7 +854,9 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
else if (sc.Compare("Class")) else if (sc.Compare("Class"))
{ {
sc.MustGetString(); 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")) else if (sc.Compare("Title") || sc.Compare("Caption"))
{ {

View file

@ -142,6 +142,7 @@ static inline int32_t G_DefaultActorHealth(int spriteNum)
struct GameInterface : ::GameInterface struct GameInterface : ::GameInterface
{ {
const char* Name() override { return "Duke"; }
int app_main() override; int app_main() override;
void UpdateScreenSize() override; void UpdateScreenSize() override;
void FreeGameData() override; void FreeGameData() override;

View file

@ -273,6 +273,7 @@ void G_DoAutoload(const char* dirname);
struct GameInterface : ::GameInterface struct GameInterface : ::GameInterface
{ {
const char* Name() override { return "Exhumed"; }
int app_main() override; int app_main() override;
void UpdateScreenSize() override; void UpdateScreenSize() override;
bool GenerateSavePic() override; bool GenerateSavePic() override;

View file

@ -517,9 +517,11 @@ END_RR_NS
static TMenuClassDescriptor<Redneck::RedneckMainMenu> _mm("Redneck.MainMenu"); static TMenuClassDescriptor<Redneck::RedneckMainMenu> _mm("Redneck.MainMenu");
static TMenuClassDescriptor<Redneck::RedneckListMenu> _lm("Redneck.ListMenu"); static TMenuClassDescriptor<Redneck::RedneckListMenu> _lm("Redneck.ListMenu");
static TMenuClassDescriptor<DImageScrollerMenu> _ism("Redneck.ImageScrollerMenu"); // does not implement a new class, we only need the descriptor.
void RegisterRedneckMenus() void RegisterRedneckMenus()
{ {
menuClasses.Push(&_mm); menuClasses.Push(&_mm);
menuClasses.Push(&_lm); menuClasses.Push(&_lm);
menuClasses.Push(&_ism);
} }

View file

@ -145,6 +145,7 @@ static inline int32_t G_DefaultActorHealth(int spriteNum)
struct GameInterface : ::GameInterface struct GameInterface : ::GameInterface
{ {
const char* Name() override { return "Redneck"; }
int app_main() override; int app_main() override;
void UpdateScreenSize() override; void UpdateScreenSize() override;
void FreeGameData() override; void FreeGameData() override;

View file

@ -2428,6 +2428,7 @@ void LoadSaveMsg(const char *msg);
struct GameInterface : ::GameInterface struct GameInterface : ::GameInterface
{ {
const char* Name() override { return "ShadowWarrior"; }
int app_main() override; int app_main() override;
void UpdateScreenSize() override; void UpdateScreenSize() override;
void FreeGameData() override; void FreeGameData() override;

View file

@ -7,6 +7,7 @@
LISTMENU "MainMenu" LISTMENU "MainMenu"
{ {
ScriptId 0 ScriptId 0
class "$.MainMenu"
ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides)
{ {
ifgame(fury) ifgame(fury)
@ -20,14 +21,6 @@ LISTMENU "MainMenu"
centermenu centermenu
animatedtransition animatedtransition
} }
ifgame(Duke, Nam, WW2GI, Fury)
{
class "Duke.MainMenu"
}
else
{
class "Redneck.MainMenu"
}
NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" 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. //NativeTextItem "$MNU_NEWGAME", "m", "MultiMenu" // In EDuke this replaces "New Game" when in networking mode. Kept here as a reminder.
ifgame(fury) ifgame(fury)
@ -47,7 +40,6 @@ LISTMENU "MainMenu"
{ {
position 160, 45, 150 position 160, 45, 150
caption "Blood" caption "Blood"
class "Blood.ListMenu"
centermenu centermenu
Linespacing 20 Linespacing 20
NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
@ -62,7 +54,6 @@ LISTMENU "MainMenu"
{ {
Position 55, 32 Position 55, 32
Linespacing 17 Linespacing 17
class "ShadowWarrior.MainMenu"
NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
NativeTextItem "$MNU_LOADGAME", "l", "LoadGameMenu" NativeTextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
NativeTextItem "$MNU_SAVEGAME", "s", "SaveGameMenu" NativeTextItem "$MNU_SAVEGAME", "s", "SaveGameMenu"
@ -82,7 +73,6 @@ LISTMENU "MainMenu"
{ {
Position 160, 65 Position 160, 65
centermenu centermenu
class "Exhumed.MainMenu"
linespacing 22 linespacing 22
NativeTextItem "3460", "n", "StartGame", 1 NativeTextItem "3460", "n", "StartGame", 1
NativeTextItem "3461", "l", "LoadGameMenu" NativeTextItem "3461", "l", "LoadGameMenu"
@ -101,6 +91,7 @@ LISTMENU "MainMenu"
LISTMENU "IngameMenu" LISTMENU "IngameMenu"
{ {
ScriptId 50 ScriptId 50
class "$.MainMenu"
ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides)
{ {
ifgame(fury) ifgame(fury)
@ -114,14 +105,6 @@ LISTMENU "IngameMenu"
centermenu centermenu
animatedtransition animatedtransition
} }
ifgame(Duke, Nam, WW2GI, Fury)
{
class "Duke.MainMenu"
}
else
{
class "Redneck.MainMenu"
}
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"
@ -134,7 +117,6 @@ LISTMENU "IngameMenu"
{ {
position 160, 45, 150 position 160, 45, 150
caption "Blood" caption "Blood"
class "Blood.ListMenu"
centermenu centermenu
Linespacing 17 Linespacing 17
NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
@ -150,7 +132,6 @@ LISTMENU "IngameMenu"
{ {
Position 55, 32 Position 55, 32
Linespacing 17 Linespacing 17
class "ShadowWarrior.MainMenu"
NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu" NativeTextItem "$MNU_NEWGAME", "n", "EpisodeMenu"
NativeTextItem "$MNU_LOADGAME", "l", "LoadGameMenu" NativeTextItem "$MNU_LOADGAME", "l", "LoadGameMenu"
NativeTextItem "$MNU_SAVEGAME", "s", "SaveGameMenu" NativeTextItem "$MNU_SAVEGAME", "s", "SaveGameMenu"
@ -169,7 +150,6 @@ LISTMENU "IngameMenu"
{ {
Position 160, 65 Position 160, 65
centermenu centermenu
class "Exhumed.MainMenu"
linespacing 22 linespacing 22
NativeTextItem "3460", "n", "StartGame", 1 NativeTextItem "3460", "n", "StartGame", 1
NativeTextItem "3461", "l", "LoadGameMenu" NativeTextItem "3461", "l", "LoadGameMenu"
@ -189,25 +169,18 @@ LISTMENU "EpisodeMenu"
{ {
ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) // Ion Fury does not use this menu. ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) // Ion Fury does not use this menu.
{ {
class "$.ListMenu"
caption "$MNU_SELECTEPISODE" caption "$MNU_SELECTEPISODE"
position 160, 48, 142 position 160, 48, 142
centermenu centermenu
fixedspacing 5 fixedspacing 5
animatedtransition animatedtransition
ifgame(Duke, Nam, WW2GI, Fury)
{
class "Duke.ListMenu"
}
else
{
class "Redneck.ListMenu"
}
} }
ifgame(blood) ifgame(blood)
{ {
class "$.ListMenu"
caption "$MNU_EPISODES" caption "$MNU_EPISODES"
position 160, 45, 150 position 160, 45, 150
class "Blood.ListMenu"
centermenu centermenu
Linespacing 20 Linespacing 20
} }
@ -225,6 +198,7 @@ LISTMENU "SkillMenu"
{ {
ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides) ifgame(Duke, Nam, WW2GI, Fury, Redneck, RedneckRides)
{ {
class "$.ListMenu"
ifgame(fury) ifgame(fury)
{ {
position 160, 55, 115 position 160, 55, 115
@ -238,21 +212,13 @@ LISTMENU "SkillMenu"
} }
caption "$MNU_SELECTSKILL" caption "$MNU_SELECTSKILL"
fixedspacing 5 fixedspacing 5
ifgame(Duke, Nam, WW2GI, Fury)
{
class "Duke.ListMenu"
}
else
{
class "Redneck.ListMenu"
}
animatedtransition animatedtransition
} }
ifgame(blood) ifgame(blood)
{ {
class "$.ListMenu"
caption "$MNU_DIFFICULTY" caption "$MNU_DIFFICULTY"
position 160, 60, 150 position 160, 60, 150
class "Blood.ListMenu"
centermenu centermenu
Linespacing 20 Linespacing 20
} }
@ -285,7 +251,7 @@ LISTMENU "CustomGameMenu"
animatedtransition animatedtransition
} }
ScriptId 102 ScriptId 102
class "Duke.ListMenu" class "$.ListMenu"
centermenu centermenu
} }
@ -304,7 +270,7 @@ LISTMENU "CustomSubMenu1"
} }
centermenu centermenu
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "$.ListMenu"
} }
LISTMENU "CustomSubMenu2" LISTMENU "CustomSubMenu2"
@ -321,7 +287,7 @@ LISTMENU "CustomSubMenu2"
} }
centermenu centermenu
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "$.ListMenu"
} }
LISTMENU "CustomSubMenu3" LISTMENU "CustomSubMenu3"
@ -338,7 +304,7 @@ LISTMENU "CustomSubMenu3"
} }
centermenu centermenu
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "$.ListMenu"
} }
LISTMENU "CustomSubMenu4" LISTMENU "CustomSubMenu4"
@ -355,7 +321,7 @@ LISTMENU "CustomSubMenu4"
} }
centermenu centermenu
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "$.ListMenu"
} }
LISTMENU "CustomSubMenu5" LISTMENU "CustomSubMenu5"
@ -372,7 +338,7 @@ LISTMENU "CustomSubMenu5"
} }
centermenu centermenu
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "$.ListMenu"
} }
LISTMENU "CustomSubMenu6" LISTMENU "CustomSubMenu6"
@ -389,7 +355,7 @@ LISTMENU "CustomSubMenu6"
} }
centermenu centermenu
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "$.ListMenu"
} }
LISTMENU "CustomSubMenu7" LISTMENU "CustomSubMenu7"
@ -406,7 +372,7 @@ LISTMENU "CustomSubMenu7"
} }
centermenu centermenu
ScriptId 103 ScriptId 103
class "Duke.ListMenu" class "$.ListMenu"
} }
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------
@ -421,7 +387,7 @@ ImageScroller "HelpMenu"
{ {
ImageItem "TEXTSTORY", 400 ImageItem "TEXTSTORY", 400
ImageItem "F1HELP", 401 ImageItem "F1HELP", 401
class "Duke.ImageScrollerMenu" class "$.ImageScrollerMenu"
ifgame(Duke, Nam, WW2GI) ifgame(Duke, Nam, WW2GI)
{ {
animatedtransition animatedtransition
@ -439,7 +405,7 @@ ImageScroller "HelpMenu"
} }
ifgame(blood) ifgame(blood)
{ {
class "Blood.ImageScrollerMenu" class "$.ImageScrollerMenu"
// The duplication here is to integrate the alternating versions of HELP3 // The duplication here is to integrate the alternating versions of HELP3
QAVAnimationItem "Help4.qav" QAVAnimationItem "Help4.qav"
QAVAnimationItem "Help5.qav" QAVAnimationItem "Help5.qav"