- do not use the internal SWCUSTOM.TXT from the Twin Dragon add-on.

There's a second variant without this definition, so this needs to be defined internally, and since it needs to be done internally it may receive proper localization labels.
This commit is contained in:
Christoph Oelckers 2019-12-26 10:47:10 +01:00
parent 8e6a54a1e4
commit 5dcfa1cb0c
8 changed files with 250 additions and 39 deletions

View file

@ -100,7 +100,7 @@ void FileSystem::DeleteAll ()
//
//==========================================================================
int FileSystem::InitMultipleFiles (TArray<FString> &filenames, const TArray<FString> &deletelumps)
int FileSystem::InitMultipleFiles (TArray<FString> &filenames, const TArray<FString> &deletelumps, int maingamefiles)
{
int numfiles;
@ -126,6 +126,7 @@ int FileSystem::InitMultipleFiles (TArray<FString> &filenames, const TArray<FStr
{
return 0;
}
DeleteStuff(deletelumps, maingamefiles);
// [RH] Set up hash table
Hashes.Resize(NumLookupModes * 2 * NumEntries);
@ -140,6 +141,34 @@ int FileSystem::InitMultipleFiles (TArray<FString> &filenames, const TArray<FStr
return NumEntries;
}
//==========================================================================
//
// Deletes unwanted content from the main game files
//
//==========================================================================
void FileSystem::DeleteStuff(const TArray<FString>& deletelumps, int numgamefiles)
{
// This must account for the game directory being inserted at index 2.
// Deletion may only occur in the main game file, the directory and the add-on, there are no secondary dependencies, i.e. more than two game files.
numgamefiles++;
if (deletelumps.Size())
for (uint32_t i = 0; i < FileInfo.Size(); i++)
{
if (FileInfo[i].rfnum >= 1 && FileInfo[i].rfnum <= numgamefiles)
{
auto cmp = FileInfo[i].lump->LumpName[FResourceLump::FullNameType].GetChars();
for (auto &str : deletelumps)
{
if (!str.CompareNoCase(cmp))
{
for (auto& n : FileInfo[i].lump->LumpName) n = NAME_None;
}
}
}
}
}
//==========================================================================
//
// AddFile

View file

@ -81,7 +81,9 @@ public:
FileSystem () = default;
~FileSystem ();
int InitMultipleFiles (TArray<FString> &filenames, const TArray<FString> &todelete);
int InitMultipleFiles (TArray<FString> &filenames, const TArray<FString> &todelete, int maingamefiles);
void DeleteStuff(const TArray<FString>& deletelumps, int numgamefiles);
void AddFile (const char *filename, FileReader *wadinfo = NULL, bool nosubdirflag = false);
void AddAdditionalFile(const char* filename, FileReader* wadinfo = NULL) {}
int CheckIfResourceFileLoaded (const char *name) noexcept;

View file

@ -124,6 +124,7 @@ struct GrpInfo
int flags = 0;
bool loaddirectory = false;
TArray<FString> mustcontain;
TArray<FString> tobedeleted;
TArray<FString> loadfiles;
TArray<FString> loadart;
};

View file

@ -378,7 +378,11 @@ void InitFileSystem(TArray<GrpEntry>& groups)
}
TArray<FString> todelete;
fileSystem.InitMultipleFiles(Files, todelete);
for (auto& g : groups)
{
todelete.Append(g.FileInfo.tobedeleted);
}
fileSystem.InitMultipleFiles(Files, todelete, groups.Size());
FILE* f = fopen("filesystem.dir", "wb");
for (int i = 0; i < fileSystem.GetNumEntries(); i++)

View file

@ -797,6 +797,14 @@ static TArray<GrpInfo> ParseGrpInfo(const char *fn, FileReader &fr, TMap<FString
}
while (sc.CheckToken(','));
}
else if (sc.Compare("deletecontent"))
{
do
{
sc.MustGetToken(TK_StringConst);
grp.tobedeleted.Push(sc.String);
} while (sc.CheckToken(','));
}
else if (sc.Compare("loadgrp"))
{
do

View file

@ -392,6 +392,36 @@ grpinfo
gamefilter "ShadowWarrior.ShadowWarrior"
}
grpinfo
{
name "Shadow Warrior (Europe)"
flags GAMEFLAG_SW
crc 0xD4A1E153
size 47536148
defname "sw.def"
gamefilter "ShadowWarrior.ShadowWarrior"
}
grpinfo
{
name "Shadow Warrior (UK)"
flags GAMEFLAG_SW
crc 0x3EE68767
size 47536148
defname "sw.def"
gamefilter "ShadowWarrior.ShadowWarrior"
}
grpinfo
{
name "Shadow Warrior (Censored)"
flags GAMEFLAG_SW
crc 0x1A8776D2
size 47537951
defname "sw.def"
gamefilter "ShadowWarrior.ShadowWarrior"
}
grpinfo
{
name "Shadow Warrior Shareware 1.0"
@ -452,6 +482,7 @@ grpinfo
defname "twindrag.def" // included in the GRP
dependency SWREG12_CRC
gamefilter "ShadowWarrior.TwinDragon"
deletecontent "swcustom.txt" // not localizable and also not present in the alternative package.
}
grpinfo

View file

@ -2060,7 +2060,7 @@ Ruins of the Ronin (CTF),TXTS_MAP27,,,,,,,,,,,,,,,,,,,,,,
Killing Fields (CTF),TXTS_MAP28,,,,,,,,,,,,,,,,,,,,,,
Chinatown,TXTS_W_MAP01,,,,,,,,,,,,,,,,,,,,,,
Monastery,TXTS_W_MAP02,,,,,,,,,,,,,,,,,,,,,,
Trolly Yard,TXTS_W_MAP03,,,,,,,,,,,,,,,,,,,,,,
Trolley Yard,TXTS_W_MAP03,,,,,,,,,,,,,,,,,,,,,,
Restaurant,TXTS_W_MAP04,,,,,,,,,,,,,,,,,,,,,,
Skyscraper,TXTS_W_MAP05,,,,,,,,,,,,,,,,,,,,,,
Airplane,TXTS_W_MAP06,,,,,,,,,,,,,,,,,,,,,,
@ -2075,38 +2075,20 @@ Wanton DM 1 (DM only),TXTS_W_MAP14,,,,,,,,,,,,,,,,,,,,,,
Wanton DM2 (DM only),TXTS_W_MAP15,,,,,,,,,,,,,,,,,,,,,,
Wanton CTF (CTF),TXTS_W_MAP16,,,,,,,,,,,,,,,,,,,,,,
Wanton Destruction,TXTS_W_EP,,,,,,,,,,,,,,,,,,,,,,
Home Sweet Home,Home Sweet Home,"Twin Dragon
","ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
City of Dispair,City of Dispair,already contains,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Emergency Room,Emergency Room,SWCUSTOM.TXT,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Hide and Seek,Hide and Seek,,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Warehouse Madness,Warehouse Madness,,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Weapons Research Center,Weapons Research Center,,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Toxic Waste Facility,Toxic Waste Facility,,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Silver Bullet,Silver Bullet,,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Fishing Village,Fishing Village,,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Secret Garden,Secret Garden,,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Hung Lo's Fortress,Hung Lo's Fortress,,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Hung Lo's Palace,Hung Lo's Palace,,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Prison Camp (secret level),Prison Camp (secret level),,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Ninja Training Camp (dm),Ninja Training Camp (dm),,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
The Morgue/mortuary (dm),The Morgue/mortuary (dm),,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Island Caves (dm),Island Caves (dm),,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Twin Dragon,Twin Dragon,,"ShadowWarrior
",,,,,,,,,,,,,,,,,,,,
Home Sweet Home,TXTS_T_MAP05,"Twin Dragon",,,,,,,,,,,,,,,,,,,,,
City of Dispair,TXTS_T_MAP06,,,,,,,,,,,,,,,,,,,,,,
Emergency Room,TXTS_T_MAP07,,,,,,,,,,,,,,,,,,,,,,
Hide and Seek,TXTS_T_MAP08,,,,,,,,,,,,,,,,,,,,,,
Warehouse Madness,TXTS_T_MAP09,,,,,,,,,,,,,,,,,,,,,,
Weapons Research Center,TXTS_T_MAP10,,,,,,,,,,,,,,,,,,,,,,
Toxic Waste Facility,TXTS_T_MAP11,,,,,,,,,,,,,,,,,,,,,,
Silver Bullet,TXTS_T_MAP12,,,,,,,,,,,,,,,,,,,,,,
Fishing Village,TXTS_T_MAP13,,,,,,,,,,,,,,,,,,,,,,
Secret Garden,TXTS_T_MAP14,,,,,,,,,,,,,,,,,,,,,,
Hung Lo's Fortress,TXTS_T_MAP15,,,,,,,,,,,,,,,,,,,,,,
Hung Lo's Palace,TXTS_T_MAP20,,,,,,,,,,,,,,,,,,,,,,
Prison Camp (secret level),TXTS_T_MAP21,,,,,,,,,,,,,,,,,,,,,,
Ninja Training Camp (dm),TXTS_T_MAP23,,,,,,,,,,,,,,,,,,,,,,
The Morgue/mortuary (dm),TXTS_T_MAP24,,,,,,,,,,,,,,,,,,,,,,
Island Caves (dm),TXTS_T_MAP25,,,,,,,,,,,,,,,,,,,,,,
Twin Dragon,TXTS_T_TITLE,,,,,,,,,,,,,,,,,,,,,,
1 default Identifier Remarks Filter eng enc ena enz eni ens enj enb enl ent enw cs de el eo es esm esn esg esc esa esd esv eso esr ess esf esl esy esz esb ese esh esi esu fi fr hu it jp ko nl pl pt ptg ro ru sr
2060
2061
2062
2063
2064
2065
2066
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094

View file

@ -0,0 +1,154 @@
level 5
{
title "$TXTS_T_MAP05"
filename "$WHIRL.MAP"
song "yokoha03.mid"
cdatrack 5
besttime 300
partime 180
}
level 6
{
title "$TXTS_T_MAP06"
filename "$tank.map"
song "nippon34.mid"
cdatrack 6
besttime 300
partime 180
}
level 7
{
title "$TXTS_T_MAP07"
filename "$BOAT.MAP"
song "execut11.mid"
cdatrack 8
besttime 300
partime 180
}
level 8
{
title "$TXTS_T_MAP08"
filename "$GARDEN.MAP"
song ""
cdatrack 11
besttime 300
partime 180
}
level 9
{
title "$TXTS_T_MAP09"
filename "$OUTPOST.MAP"
song "sanai.mid"
cdatrack 12
besttime 300
partime 180
}
level 10
{
title "$TXTS_T_MAP10"
filename "$HIDTEMP.MAP"
song "kotec2.mid"
cdatrack 5
besttime 300
partime 180
}
level 11
{
title "$TXTS_T_MAP11"
filename "$plax1.map"
song ""
cdatrack 10
besttime 300
partime 180
}
level 12
{
title "$TXTS_T_MAP12"
filename "$BATH.MAP"
song ""
cdatrack 4
besttime 300
partime 180
}
level 13
{
title "$TXTS_T_MAP13"
filename "$AIRPORT.MAP"
song ""
cdatrack 6
besttime 300
partime 180
}
level 14
{
title "$TXTS_T_MAP14"
filename "$refiner.map"
song "kotoki12.mid"
cdatrack 9
besttime 300
partime 180
}
level 15
{
title "$TXTS_T_MAP15"
filename "$newmine.map"
song "hoshia02.mid"
cdatrack 7
besttime 300
partime 180
}
level 20
{
title "$TXTS_T_MAP20"
filename "$volcano.map"
song ""
cdatrack 10
besttime 300
partime 180
}
level 21
{
title "$TXTS_T_MAP21"
filename "$SHORE.MAP"
song ""
cdatrack 11
besttime 300
partime 180
}
level 23
{
title "$TXTS_T_MAP23"
filename "Tank.map"
song ""
cdatrack 11
besttime 300
partime 180
}
level 24
{
title "$TXTS_T_MAP24"
filename "$DMWOODS.MAP"
song ""
cdatrack 8
besttime 300
partime 180
}
level 25
{
title "$TXTS_T_MAP25"
filename "$dmshrin.map"
song ""
cdatrack 7
besttime 300
partime 180
}
episode 1
{
title ""
subtitle ""
}
episode 2
{
title "$TXTS_T_TITLE"
subtitle ""
}