From d0e6a7ea29f3ca2ce3d55cb09f537f17cd71d492 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Fri, 16 Jul 2021 22:14:56 +1000 Subject: [PATCH] - Allow CON-based games to have multiplayer episodes filtered from menu. * Fixes #461. * Fixes #462. --- source/core/gamecontrol.cpp | 7 +++++++ source/core/gamecontrol.h | 1 + source/core/gamestruct.h | 1 + source/core/searchpaths.cpp | 9 +++++++++ source/games/duke/src/duke3d.h | 1 + source/games/duke/src/gamedef.cpp | 24 ++++++++++++++++++++++++ wadsrc/static/engine/grpinfo.txt | 6 ++++++ 7 files changed, 49 insertions(+) diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 2fefb3be8..1e257d12f 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -949,6 +949,13 @@ int RunGame() colorset = true; } } + if (grp.FileInfo.mpepisodes.Size()) + { + for (auto& mpepisode : grp.FileInfo.mpepisodes) + { + gi->AddMultiplayerEpisode(mpepisode); + } + } } I_SetIWADInfo(); diff --git a/source/core/gamecontrol.h b/source/core/gamecontrol.h index 2f1276257..753c82c75 100644 --- a/source/core/gamecontrol.h +++ b/source/core/gamecontrol.h @@ -132,6 +132,7 @@ struct GrpInfo TArray tobedeleted; TArray loadfiles; TArray loadart; + TArray mpepisodes; uint32_t FgColor = 0, BgColor = 0; }; diff --git a/source/core/gamestruct.h b/source/core/gamestruct.h index 17eb72f2b..3401b65f6 100644 --- a/source/core/gamestruct.h +++ b/source/core/gamestruct.h @@ -120,6 +120,7 @@ struct GameInterface virtual void LeavePortal(spritetype* viewer, int type) {} virtual bool GetGeoEffect(GeoEffect* eff, int viewsector) { return false; } virtual int Voxelize(int sprnum) { return -1; } + virtual void AddMultiplayerEpisode(FString name) {} virtual FString statFPS() { diff --git a/source/core/searchpaths.cpp b/source/core/searchpaths.cpp index 0b5b8af65..96fbb6aec 100644 --- a/source/core/searchpaths.cpp +++ b/source/core/searchpaths.cpp @@ -588,6 +588,15 @@ static TArray ParseGrpInfo(const char *fn, FileReader &fr, TMap mpEpisodes; + +void GameInterface::AddMultiplayerEpisode(FString name) +{ + mpEpisodes.Push(FStringTable::MakeMacro(name.GetChars())); +} + + //--------------------------------------------------------------------------- // // definitions needed by the parser. @@ -1667,6 +1681,16 @@ int ConCompiler::parsecommand() auto clust = MustFindCluster(j + 1); vol->name = clust->name = FStringTable::MakeMacro(parsebuffer.Data(), i); if (j > 0) vol->flags |= VF_SHAREWARELOCK; + if (mpEpisodes.Size()) + { + for (auto& mpEpisode : mpEpisodes) + { + if (vol->name == mpEpisode) + { + vol->flags |= VF_HIDEFROMSP; + } + } + } return 0; } case concmd_defineskillname: diff --git a/wadsrc/static/engine/grpinfo.txt b/wadsrc/static/engine/grpinfo.txt index 9047d62f6..22ac89b95 100644 --- a/wadsrc/static/engine/grpinfo.txt +++ b/wadsrc/static/engine/grpinfo.txt @@ -717,6 +717,7 @@ grpinfo FgColor 0xbc9e89 BkColor 0x7f3300 GameID "Redneck" + mpepisodes "PISSIN' CONTEST" } grpinfo @@ -731,6 +732,7 @@ grpinfo FgColor 0xbc9e89 BkColor 0x7f3300 GameID "RedneckRides" + mpepisodes "PISSIN' CONTEST" } grpinfo @@ -772,6 +774,7 @@ grpinfo FgColor 0 BkColor 0x78720d GameID "Nam" + mpepisodes "MULTIPLAYER I", "MULTIPLAYER II" } grpinfo @@ -785,6 +788,7 @@ grpinfo FgColor 0 BkColor 0x78720d GameID "Nam" + mpepisodes "MULTIPLAYER I", "MULTIPLAYER II" } grpinfo @@ -798,6 +802,7 @@ grpinfo FgColor 0 BkColor 0x78720d GameID "WW2GI" + mpepisodes "MULTIPLAYER I", "MULTIPLAYER II" } grpinfo @@ -810,6 +815,7 @@ grpinfo dependency WW2GI_CRC gamefilter "WW2GI.Platoon" GameID "PlatoonLeader" + mpepisodes "MULTIPLAYER I", "MULTIPLAYER II" } grpinfo