- Allow CON-based games to have multiplayer episodes filtered from menu.

* Fixes #461.
* Fixes #462.
This commit is contained in:
Mitchell Richters 2021-07-16 22:14:56 +10:00 committed by Christoph Oelckers
parent 593bbe10ef
commit d0e6a7ea29
7 changed files with 49 additions and 0 deletions

View file

@ -949,6 +949,13 @@ int RunGame()
colorset = true;
}
}
if (grp.FileInfo.mpepisodes.Size())
{
for (auto& mpepisode : grp.FileInfo.mpepisodes)
{
gi->AddMultiplayerEpisode(mpepisode);
}
}
}
I_SetIWADInfo();

View file

@ -132,6 +132,7 @@ struct GrpInfo
TArray<FString> tobedeleted;
TArray<FString> loadfiles;
TArray<FString> loadart;
TArray<FString> mpepisodes;
uint32_t FgColor = 0, BgColor = 0;
};

View file

@ -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()
{

View file

@ -588,6 +588,15 @@ static TArray<GrpInfo> ParseGrpInfo(const char *fn, FileReader &fr, TMap<FString
}
while (sc.CheckToken(','));
}
else if (sc.Compare("mpepisodes"))
{
do
{
sc.MustGetToken(TK_StringConst);
grp.mpepisodes.Push(sc.String);
}
while (sc.CheckToken(','));
}
else sc.ScriptError(nullptr);
}
if (grp.dependencyCRC == 0 && (grp.flags & (GAMEFLAG_DUKE | GAMEFLAG_NAM | GAMEFLAG_NAPALM | GAMEFLAG_WW2GI | GAMEFLAG_RRALL | GAMEFLAG_BLOOD | GAMEFLAG_SW | GAMEFLAG_PSEXHUMED)) == 0)

View file

@ -67,6 +67,7 @@ struct GameInterface : public ::GameInterface
void EnterPortal(spritetype* viewer, int type) override;
void LeavePortal(spritetype* viewer, int type) override;
bool GetGeoEffect(GeoEffect* eff, int viewsector) override;
void AddMultiplayerEpisode(FString name) override;
};

View file

@ -54,6 +54,20 @@ BEGIN_DUKE_NS
enum { VERSIONCHECK = 41 };
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
static TArray<FString> 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:

View file

@ -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