- added detection logic for zipped versions of the Cryptic Passage add-on for Blood and the Route66 add-on for Redneck Rampage.

- added command line options to load the original file dump of both mods in the game directory.
- both also require loading additional non-standard-named .art files
This commit is contained in:
Christoph Oelckers 2019-12-11 23:41:05 +01:00
parent 7942bc9490
commit 86dc909559
9 changed files with 104 additions and 12 deletions

View file

@ -65,14 +65,16 @@ void UserConfig::ProcessOptions()
initprintf("Build-format config files not supported and will be ignored\n");
}
#if 0 // MP disabled pending evaluation
auto v = Args->CheckValue("-port");
if (v) netPort = strtol(v, nullptr, 0);
netServerMode = Args->CheckParm("-server");
netServerAddress = Args->CheckValue("-connect");
netPassword = Args->CheckValue("-password");
#endif
v = Args->CheckValue("-addon");
auto v = Args->CheckValue("-addon");
if (v)
{
auto val = strtol(v, nullptr, 0);
@ -92,6 +94,22 @@ void UserConfig::ProcessOptions()
{
gamegrp = "WW2GI.GRP";
}
// Set up all needed content for these two mod which feature a very messy distribution.
// As an alternative they can be zipped up - the launcher will be able to detect and set up such versions automatically.
else if (Args->CheckParm("-route66"))
{
gamegrp = "REDNECK.GRP";
DefaultCon = "GAME66.CON";
const char* argv[] = { "tilesa66.art" , "tilesb66.art" };
AddArt.reset(new FArgs(2, argv));
}
else if (Args->CheckParm("-cryptic"))
{
gamegrp = "BLOOD.RFF";
DefaultCon = "CRYPTIC.INI";
const char* argv[] = { "cpart07.ar_" , "cpart15.ar_" };
AddArt.reset(new FArgs(2, argv));
}
v = Args->CheckValue("-gamegrp");
if (v)
@ -408,6 +426,15 @@ int CONFIG_Init()
CheckFrontend(g_gameType);
InitFileSystem(usedgroups);
TArray<FString> addArt;
for (auto& grp : usedgroups)
{
for (auto& art : grp.FileInfo.loadart)
{
addArt.Push(art);
}
}
TileFiles.AddArt(addArt);
CONTROL_ClearAssignments();
CONFIG_InitMouseAndController();

View file

@ -267,7 +267,7 @@ static void D_AddDirectory (TArray<FString> &wadfiles, const char *dir)
{
skindir[stuffstart++] = '/';
int savedstart = stuffstart;
const char* validexts[] = { "*.grp", "*.zip", "*.pk3", "*.pk4", "*.7z", "*.pk7", "*.dat" };
static const char* validexts[] = { "*.grp", "*.zip", "*.pk3", "*.pk4", "*.7z", "*.pk7", "*.dat" };
for (auto ext : validexts)
{
stuffstart = savedstart;

View file

@ -29,7 +29,7 @@ struct MapRecord
FString name;
FString music;
int cdSongId = -1;
int flags = -1;
int flags = 0;
// The rest is only used by Blood
int nextLevel = -1;

View file

@ -38,6 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamecontrol.h"
#include "filesystem/filesystem.h"
static const char* res_exts[] = { ".grp", ".zip", ".pk3", ".pk4", ".7z", ".pk7" };
namespace fs = std::filesystem;
@ -809,7 +810,7 @@ static TArray<GrpInfo> ParseGrpInfo(const char *fn, FileReader &fr, TMap<FString
do
{
sc.MustGetToken(TK_StringConst);
grp.loadfiles.Push(sc.String);
grp.loadart.Push(sc.String);
}
while (sc.CheckToken(','));
}
@ -925,6 +926,7 @@ TArray<GrpEntry> GrpScan()
TArray<FileEntry*> sortedFileList;
TArray<GrpInfo*> sortedGroupList;
TArray<GrpInfo*> contentGroupList;
auto allFiles = CollectAllFilesInSearchPath();
auto allGroups = ParseAllGrpInfos(allFiles);
@ -935,8 +937,58 @@ TArray<GrpEntry> GrpScan()
// Remove all unnecessary content from the file list. Since this contains all data from the search path's directories it can be quite large.
// Sort both lists by file size so that we only need to pass over each list once to weed out all unrelated content. Go backward to avoid too much item movement
// (most will be deleted anyway.)
for (auto& f : allFiles) sortedFileList.Push(&f);
for (auto& g : allGroups) sortedGroupList.Push(&g);
for (auto& g : allGroups)
{
if (g.CRC == 0 && g.mustcontain.Size() > 0)
contentGroupList.Push(&g);
else
sortedGroupList.Push(&g);
}
// As a first pass we need to look for all known game resources which only are identified by a content list
if (contentGroupList.Size())
{
for (auto fe : sortedFileList)
{
FString fn = fe->FileName.MakeLower();
for (auto ext : res_exts)
{
if (strcmp(ext, fn.GetChars() + fn.Len() - 4) == 0)
{
auto resf = FResourceFile::OpenResourceFile(fe->FileName, true, true);
if (resf)
{
for (auto grp : contentGroupList)
{
bool ok = true;
for (auto &lump : grp->mustcontain)
{
if (!resf->FindLump(lump))
{
ok = false;
break;
}
}
if (ok)
{
// got a match
foundGames.Reserve(1);
auto& fg = foundGames.Last();
fg.FileInfo = *grp;
fg.FileName = fe->FileName;
fg.FileIndex = fe->Index;
break;
}
}
}
}
}
}
}
std::sort(sortedFileList.begin(), sortedFileList.end(), [](FileEntry* lhs, FileEntry* rhs) { return lhs->FileLength < rhs->FileLength; });
std::sort(sortedGroupList.begin(), sortedGroupList.end(), [](GrpInfo* lhs, GrpInfo* rhs) { return lhs->size < rhs->size; });
@ -944,6 +996,7 @@ TArray<GrpEntry> GrpScan()
int findex = sortedFileList.Size() - 1;
int gindex = sortedGroupList.Size() - 1;
while (findex > 0 && gindex > 0)
{
if (sortedFileList[findex]->FileLength > sortedGroupList[gindex]->size)
@ -1018,7 +1071,7 @@ TArray<GrpEntry> GrpScan()
{
for (unsigned j = foundGames.Size() - 1; j > i; j--)
{
if (foundGames[i].FileInfo.CRC == foundGames[j].FileInfo.CRC)
if (foundGames[i].FileInfo.CRC == foundGames[j].FileInfo.CRC && foundGames[j].FileInfo.CRC != 0)
foundGames.Delete(j);
}
}
@ -1094,7 +1147,7 @@ const char* G_DefaultConFile(void)
}
if (g_gameType & GAMEFLAG_SW)
return nullptr; // SW has no scripts of any kind (todo: Make Blood's INI files usable here for map definitions)
return nullptr; // SW has no scripts of any kind.
if (g_gameType & GAMEFLAG_NAM)
{

View file

@ -42,6 +42,7 @@
#include "palette.h"
#include "m_crc32.h"
#include "build.h"
#include "gamecontrol.h"
enum
{
@ -339,6 +340,10 @@ void BuildTiles::LoadArtSet(const char* filename)
FStringf fn(filename, index);
LoadArtFile(fn, false);
}
for (auto& addart : addedArt)
{
LoadArtFile(addart, false);
}
}

View file

@ -506,6 +506,7 @@ struct BuildTiles
FTexture* tiles[MAXTILES];
FTexture* tilesbak[MAXTILES];
TMap<FString, FTexture*> textures;
TArray<FString> addedArt;
BuildTiles()
{
@ -537,6 +538,10 @@ struct BuildTiles
int LoadArtFile(const char* file, bool mapart = false, int firsttile = -1);
void CloseAllMapArt();
void LoadArtSet(const char* filename);
void AddArt(TArray<FString>& art)
{
addedArt = std::move(art);
}
FTexture* ValidateCustomTile(int tilenum, int type);
int32_t artLoadFiles(const char* filename);
uint8_t* tileMakeWritable(int num);

View file

@ -575,7 +575,7 @@ void GameInterface::StartGame(FGameStartup& gs)
ud.m_respawn_inventory = 0;
ud.multimode = 1;
ud.m_volume_number = gs.Episode;
ud.m_level_number = gs.Level;
m_level_number = gs.Level;
G_NewGame_EnterLevel();
}

View file

@ -450,7 +450,7 @@ void GameInterface::StartGame(FGameStartup& gs)
ud.m_respawn_inventory = 0;
ud.multimode = 1;
ud.m_volume_number = gs.Episode;
ud.m_level_number = gs.Level;
m_level_number = gs.Level;
G_NewGame_EnterLevel();
}

View file

@ -332,10 +332,10 @@ grpinfo
grpinfo
{
// This is for detecting zipped versions of the mod. The default configuration with all files dumped in the game filter requires starting the game with "-route66"
// This is for detecting zipped versions of the mod.
name "Redneck Rampage: Suckin' Grits on Route 66"
scriptname "GAME66.CON"
mustcontain "TILESA66.ART", "TILESB66.ART", "CARNIVAL.MAP", "TRUCKSTP.MAP", "GAME66.CON"
mustcontain "TILESA66.ART", "TILESB66.ART", "ROUTE66/CARNIVAL.MAP", "ROUTE66/TRUCKSTP.MAP", "GAME66.CON"
flags GAMEFLAG_RR|GAMEFLAG_ADDON
dependency RR_CRC
loadart "TILESA66.ART", "TILESB66.ART" // replaces TILES009 and TILES023.
@ -355,6 +355,7 @@ grpinfo
gamefilter "Blood.Blood"
}
/* this doesn't work with the current setup.
grpinfo
{
// This is for identifying older Blood versions. Since I have no information, all I can do is testing for a few known files.
@ -367,10 +368,11 @@ grpinfo
loadgrp "SOUNDS.RFF", "GUI.RFF"
gamefilter "Blood.Blood"
}
*/
grpinfo
{
// This is for detecting zipped versions of the mod. The default configuration with all files dumped in the game filter requires starting the game with "-cryptic"
// This is for detecting zipped versions of the mod.
name "BLOOD: Cryptic Passage"
scriptname "CRYPTIC.INI"
mustcontain "CRYPTIC.INI", "CP01.MAP", "CP02.MAP"