Skip to content

Commit

Permalink
- Allow CON-based games to have multiplayer episodes filtered from menu.
Browse files Browse the repository at this point in the history
* Fixes #461.
* Fixes #462.
  • Loading branch information
mjr4077au committed Jul 17, 2021
1 parent 1916b8b commit 2c41d21
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/core/gamecontrol.cpp
Expand Up @@ -928,6 +928,13 @@ int RunGame()
colorset = true;
}
}
if (grp.FileInfo.mpepisodes.Size())
{
for (auto& mpepisode : grp.FileInfo.mpepisodes)
{
gi->AddMultiplayerEpisode(mpepisode);
}
}
}
I_SetIWADInfo();

Expand Down
1 change: 1 addition & 0 deletions source/core/gamecontrol.h
Expand Up @@ -143,6 +143,7 @@ struct GrpInfo
TArray<FString> tobedeleted;
TArray<FString> loadfiles;
TArray<FString> loadart;
TArray<FString> mpepisodes;
uint32_t FgColor = 0, BgColor = 0;
};

Expand Down
1 change: 1 addition & 0 deletions source/core/gamestruct.h
Expand Up @@ -119,6 +119,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()
{
Expand Down
9 changes: 9 additions & 0 deletions source/core/searchpaths.cpp
Expand Up @@ -589,6 +589,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)
Expand Down
1 change: 1 addition & 0 deletions source/games/duke/src/duke3d.h
Expand Up @@ -69,6 +69,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;

};

Expand Down
24 changes: 24 additions & 0 deletions source/games/duke/src/gamedef.cpp
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions wadsrc/static/engine/grpinfo.txt
Expand Up @@ -691,6 +691,7 @@ grpinfo
FgColor 0xbc9e89
BkColor 0x7f3300
GameID "Redneck"
mpepisodes "PISSIN' CONTEST"
}

grpinfo
Expand All @@ -705,6 +706,7 @@ grpinfo
FgColor 0xbc9e89
BkColor 0x7f3300
GameID "RedneckRides"
mpepisodes "PISSIN' CONTEST"
}

grpinfo
Expand Down Expand Up @@ -746,6 +748,7 @@ grpinfo
FgColor 0
BkColor 0x78720d
GameID "Nam"
mpepisodes "MULTIPLAYER I", "MULTIPLAYER II"
}

grpinfo
Expand All @@ -759,6 +762,7 @@ grpinfo
FgColor 0
BkColor 0x78720d
GameID "Nam"
mpepisodes "MULTIPLAYER I", "MULTIPLAYER II"
}

grpinfo
Expand All @@ -772,6 +776,7 @@ grpinfo
FgColor 0
BkColor 0x78720d
GameID "WW2GI"
mpepisodes "MULTIPLAYER I", "MULTIPLAYER II"
}

grpinfo
Expand All @@ -784,6 +789,7 @@ grpinfo
dependency WW2GI_CRC
gamefilter "WW2GI.Platoon"
GameID "PlatoonLeader"
mpepisodes "MULTIPLAYER I", "MULTIPLAYER II"
}

grpinfo
Expand Down

0 comments on commit 2c41d21

Please sign in to comment.