- renamed the file system related classes to actually use the term "FileSystem".

This commit is contained in:
Christoph Oelckers 2020-04-11 13:24:34 +02:00
commit 6bccde3b51
103 changed files with 647 additions and 647 deletions

View file

@ -202,17 +202,17 @@ void R_InitColormaps (bool allowCustomColormap)
cm.blend = 0;
fakecmaps.Push(cm);
uint32_t NumLumps = Wads.GetNumLumps();
uint32_t NumLumps = fileSystem.GetNumLumps();
for (uint32_t i = 0; i < NumLumps; i++)
{
if (Wads.GetLumpNamespace(i) == ns_colormaps)
if (fileSystem.GetLumpNamespace(i) == ns_colormaps)
{
char name[9];
name[8] = 0;
Wads.GetLumpName (name, i);
fileSystem.GetLumpName (name, i);
if (Wads.CheckNumForName (name, ns_colormaps) == (int)i)
if (fileSystem.CheckNumForName (name, ns_colormaps) == (int)i)
{
strncpy(cm.name, name, 8);
cm.blend = 0;
@ -242,10 +242,10 @@ void R_InitColormaps (bool allowCustomColormap)
for (unsigned j = 1; j < fakecmaps.Size(); j++)
{
if (Wads.LumpLength (fakecmaps[j].lump) >= 256)
if (fileSystem.LumpLength (fakecmaps[j].lump) >= 256)
{
int k, r, g, b;
auto lump = Wads.OpenLumpReader (fakecmaps[j].lump);
auto lump = fileSystem.OpenLumpReader (fakecmaps[j].lump);
lump.Read(map, 256);
r = g = b = 0;

View file

@ -66,7 +66,7 @@ extern int AttenuationIsSet;
static void ParseVavoomSkybox()
{
int lump = Wads.CheckNumForName("SKYBOXES");
int lump = fileSystem.CheckNumForName("SKYBOXES");
if (lump < 0) return;
@ -87,7 +87,7 @@ static void ParseVavoomSkybox()
sc.MustGetStringName("map");
sc.MustGetString();
maplump = Wads.CheckNumForFullName(sc.String, true);
maplump = fileSystem.CheckNumForFullName(sc.String, true);
FTexture *tex = TexMan.FindTexture(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny);
if (tex == NULL)
@ -1155,8 +1155,8 @@ class GLDefsParser
if (lumpnum != -1)
{
if (iwad && Wads.GetLumpFile(lumpnum) <= Wads.GetMaxIwadNum()) useme = true;
if (thiswad && Wads.GetLumpFile(lumpnum) == workingLump) useme = true;
if (iwad && fileSystem.GetLumpFile(lumpnum) <= fileSystem.GetMaxIwadNum()) useme = true;
if (thiswad && fileSystem.GetLumpFile(lumpnum) == workingLump) useme = true;
}
if (!useme) return;
}
@ -1339,8 +1339,8 @@ class GLDefsParser
if (lumpnum != -1)
{
if (iwad && Wads.GetLumpFile(lumpnum) <= Wads.GetMaxIwadNum()) useme = true;
if (thiswad && Wads.GetLumpFile(lumpnum) == workingLump) useme = true;
if (iwad && fileSystem.GetLumpFile(lumpnum) <= fileSystem.GetMaxIwadNum()) useme = true;
if (thiswad && fileSystem.GetLumpFile(lumpnum) == workingLump) useme = true;
}
if (!useme) return;
}
@ -1741,7 +1741,7 @@ public:
{
sc.MustGetString();
// This is not using sc.Open because it can print a more useful error message when done here
lump = Wads.CheckNumForFullName(sc.String, true);
lump = fileSystem.CheckNumForFullName(sc.String, true);
if (lump==-1)
sc.ScriptError("Lump '%s' not found", sc.String);
@ -1835,7 +1835,7 @@ void LoadGLDefs(const char *defsLump)
static const char *gldefsnames[] = { "GLDEFS", defsLump, nullptr };
lastLump = 0;
while ((workingLump = Wads.FindLumpMulti(gldefsnames, &lastLump)) != -1)
while ((workingLump = fileSystem.FindLumpMulti(gldefsnames, &lastLump)) != -1)
{
GLDefsParser sc(workingLump, LightAssociations);
sc.DoParseDefs();

View file

@ -325,7 +325,7 @@ static TArray<int> SpriteModelHash;
static int FindGFXFile(FString & fn)
{
int lump = Wads.CheckNumForFullName(fn); // if we find something that matches the name plus the extension, return it and do not enter the substitution logic below.
int lump = fileSystem.CheckNumForFullName(fn); // if we find something that matches the name plus the extension, return it and do not enter the substitution logic below.
if (lump != -1) return lump;
int best = -1;
@ -337,7 +337,7 @@ static int FindGFXFile(FString & fn)
for (const char ** extp=extensions; *extp; extp++)
{
int lump = Wads.CheckNumForFullName(fn + *extp);
int lump = fileSystem.CheckNumForFullName(fn + *extp);
if (lump >= best) best = lump;
}
return best;
@ -357,7 +357,7 @@ FTextureID LoadSkin(const char * path, const char * fn)
buffer.Format("%s%s", path, fn);
int texlump = FindGFXFile(buffer);
const char * const texname = texlump < 0 ? fn : Wads.GetLumpFullName(texlump);
const char * const texname = texlump < 0 ? fn : fileSystem.GetLumpFullName(texlump);
return TexMan.CheckForTexture(texname, ETextureType::Any, FTextureManager::TEXMAN_TryAny);
}
@ -394,7 +394,7 @@ static unsigned FindModel(const char * path, const char * modelfile)
FString fullname;
fullname.Format("%s%s", path, modelfile);
int lump = Wads.CheckNumForFullName(fullname);
int lump = fileSystem.CheckNumForFullName(fullname);
if (lump<0)
{
@ -407,15 +407,15 @@ static unsigned FindModel(const char * path, const char * modelfile)
if (!Models[i]->mFileName.CompareNoCase(fullname)) return i;
}
int len = Wads.LumpLength(lump);
FMemLump lumpd = Wads.ReadLump(lump);
int len = fileSystem.LumpLength(lump);
FMemLump lumpd = fileSystem.ReadLump(lump);
char * buffer = (char*)lumpd.GetMem();
if ( (size_t)fullname.LastIndexOf("_d.3d") == fullname.Len()-5 )
{
FString anivfile = fullname.GetChars();
anivfile.Substitute("_d.3d","_a.3d");
if ( Wads.CheckNumForFullName(anivfile) > 0 )
if ( fileSystem.CheckNumForFullName(anivfile) > 0 )
{
model = new FUE1Model;
}
@ -424,7 +424,7 @@ static unsigned FindModel(const char * path, const char * modelfile)
{
FString datafile = fullname.GetChars();
datafile.Substitute("_a.3d","_d.3d");
if ( Wads.CheckNumForFullName(datafile) > 0 )
if ( fileSystem.CheckNumForFullName(datafile) > 0 )
{
model = new FUE1Model;
}
@ -532,7 +532,7 @@ void InitModels()
int Lump;
int lastLump = 0;
while ((Lump = Wads.FindLump("MODELDEF", &lastLump)) != -1)
while ((Lump = fileSystem.FindLump("MODELDEF", &lastLump)) != -1)
{
ParseModelDefLump(Lump);
}
@ -850,7 +850,7 @@ static void ParseModelDefLump(int Lump)
{
sc.MustGetString();
// This is not using sc.Open because it can print a more useful error message when done here
int includelump = Wads.CheckNumForFullName(sc.String, true);
int includelump = fileSystem.CheckNumForFullName(sc.String, true);
if (includelump == -1)
{
if (strcmp(sc.String, "sentinel.modl") != 0) // Gene Tech mod has a broken #include statement

View file

@ -170,7 +170,7 @@ bool FDMDModel::Load(const char * path, int lumpnum, const char * buffer, int le
void FDMDModel::LoadGeometry()
{
static int axis[3] = { VX, VY, VZ };
FMemLump lumpdata = Wads.ReadLump(mLumpNum);
FMemLump lumpdata = fileSystem.ReadLump(mLumpNum);
const char *buffer = (const char *)lumpdata.GetMem();
texCoords = new FTexCoord[info.numTexCoords];
memcpy(texCoords, buffer + info.offsetTexCoords, info.numTexCoords * sizeof(FTexCoord));
@ -496,7 +496,7 @@ void FMD2Model::LoadGeometry()
{
static int axis[3] = { VX, VY, VZ };
uint8_t *md2_frames;
FMemLump lumpdata = Wads.ReadLump(mLumpNum);
FMemLump lumpdata = fileSystem.ReadLump(mLumpNum);
const char *buffer = (const char *)lumpdata.GetMem();
texCoords = new FTexCoord[info.numTexCoords];

View file

@ -185,7 +185,7 @@ bool FMD3Model::Load(const char * path, int lumpnum, const char * buffer, int le
void FMD3Model::LoadGeometry()
{
FMemLump lumpdata = Wads.ReadLump(mLumpNum);
FMemLump lumpdata = fileSystem.ReadLump(mLumpNum);
const char *buffer = (const char *)lumpdata.GetMem();
md3_header_t * hdr = (md3_header_t *)buffer;
md3_surface_t * surf = (md3_surface_t*)(buffer + LittleLong(hdr->Ofs_Surfaces));

View file

@ -33,7 +33,7 @@
*/
bool FOBJModel::Load(const char* fn, int lumpnum, const char* buffer, int length)
{
FString objName = Wads.GetLumpFullPath(lumpnum);
FString objName = fileSystem.GetLumpFullPath(lumpnum);
FString objBuf(buffer, length);
// Do some replacements before we parse the OBJ string

View file

@ -42,18 +42,18 @@ float unpackuvert( uint32_t n, int c )
bool FUE1Model::Load( const char *filename, int lumpnum, const char *buffer, int length )
{
int lumpnum2;
FString realfilename = Wads.GetLumpFullName(lumpnum);
FString realfilename = fileSystem.GetLumpFullName(lumpnum);
if ( (size_t)realfilename.IndexOf("_d.3d") == realfilename.Len()-5 )
{
realfilename.Substitute("_d.3d","_a.3d");
lumpnum2 = Wads.CheckNumForFullName(realfilename);
lumpnum2 = fileSystem.CheckNumForFullName(realfilename);
mDataLump = lumpnum;
mAnivLump = lumpnum2;
}
else
{
realfilename.Substitute("_a.3d","_d.3d");
lumpnum2 = Wads.CheckNumForFullName(realfilename);
lumpnum2 = fileSystem.CheckNumForFullName(realfilename);
mAnivLump = lumpnum;
mDataLump = lumpnum2;
}
@ -64,9 +64,9 @@ void FUE1Model::LoadGeometry()
{
FMemLump lump, lump2;
const char *buffer, *buffer2;
lump = Wads.ReadLump(mDataLump);
lump = fileSystem.ReadLump(mDataLump);
buffer = (char*)lump.GetMem();
lump2 = Wads.ReadLump(mAnivLump);
lump2 = fileSystem.ReadLump(mAnivLump);
buffer2 = (char*)lump2.GetMem();
// map structures
dhead = (d3dhead*)(buffer);

View file

@ -490,7 +490,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC
bases = s;
basev = v;
if (colorset != NULL && colorset->Lump >= 0 && Wads.LumpLength(colorset->Lump) < 256)
if (colorset != NULL && colorset->Lump >= 0 && fileSystem.LumpLength(colorset->Lump) < 256)
{ // Bad table length. Ignore it.
colorset = NULL;
}
@ -511,7 +511,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC
}
else
{
FMemLump translump = Wads.ReadLump(colorset->Lump);
FMemLump translump = fileSystem.ReadLump(colorset->Lump);
const uint8_t *trans = (const uint8_t *)translump.GetMem();
for (i = start; i <= end; ++i)
{
@ -762,7 +762,7 @@ void R_ParseTrnslate()
int lump;
int lastlump = 0;
while (-1 != (lump = Wads.FindLump("TRNSLATE", &lastlump)))
while (-1 != (lump = fileSystem.FindLump("TRNSLATE", &lastlump)))
{
FScanner sc(lump);
while (sc.GetToken())
@ -803,7 +803,7 @@ void R_ParseTrnslate()
do
{
sc.MustGetToken(TK_StringConst);
int pallump = Wads.CheckNumForFullName(sc.String, true, ns_global);
int pallump = fileSystem.CheckNumForFullName(sc.String, true, ns_global);
if (pallump >= 0) //
{
int start = 0;

View file

@ -74,13 +74,13 @@ bool UseVanillaTransparency()
if (firstTime)
{
int lastlump = 0;
Wads.FindLump("ZSCRIPT", &lastlump); // ignore first ZScript
if (Wads.FindLump("ZSCRIPT", &lastlump) == -1) // no loaded ZScript
fileSystem.FindLump("ZSCRIPT", &lastlump); // ignore first ZScript
if (fileSystem.FindLump("ZSCRIPT", &lastlump) == -1) // no loaded ZScript
{
lastlump = 0;
foundDehacked = Wads.FindLump("DEHACKED", &lastlump) != -1;
foundDehacked = fileSystem.FindLump("DEHACKED", &lastlump) != -1;
lastlump = 0;
foundDecorate = Wads.FindLump("DECORATE", &lastlump) != -1;
foundDecorate = fileSystem.FindLump("DECORATE", &lastlump) != -1;
foundZScript = false;
}
else

View file

@ -342,19 +342,19 @@ void R_InitSpriteDefs ()
}
// Repeat, for voxels
vmax = Wads.GetNumLumps();
vmax = fileSystem.GetNumLumps();
TArray<VHasher> vhashes(vmax, true);
memset(vhashes.Data(), -1, sizeof(VHasher)*vmax);
for (i = 0; i < vmax; ++i)
{
if (Wads.GetLumpNamespace(i) == ns_voxels)
if (fileSystem.GetLumpNamespace(i) == ns_voxels)
{
char name[9];
size_t namelen;
int spin;
int sign;
Wads.GetLumpName(name, i);
fileSystem.GetLumpName(name, i);
name[8] = 0;
namelen = strlen(name);
if (namelen < 4)
@ -584,17 +584,17 @@ void R_InitSkins (void)
playersoundrefs[j] = skinsoundnames[j][1];
}
while ((base = Wads.FindLump ("S_SKIN", &lastlump, true)) != -1)
while ((base = fileSystem.FindLump ("S_SKIN", &lastlump, true)) != -1)
{
// The player sprite has 23 frames. This means that the S_SKIN
// marker needs a minimum of 23 lumps after it.
if (base >= Wads.GetNumLumps() - 23 || base == -1)
if (base >= fileSystem.GetNumLumps() - 23 || base == -1)
continue;
i++;
for (j = 0; j < NUMSKINSOUNDS; j++)
sndlumps[j] = -1;
Skins[i].namespc = Wads.GetLumpNamespace (base);
Skins[i].namespc = fileSystem.GetLumpNamespace (base);
FScanner sc(base);
intname = 0;
@ -712,10 +712,10 @@ void R_InitSkins (void)
}
else if (key[0] == '*')
{ // Player sound replacment (ZDoom extension)
int lump = Wads.CheckNumForName (sc.String, Skins[i].namespc);
int lump = fileSystem.CheckNumForName (sc.String, Skins[i].namespc);
if (lump == -1)
{
lump = Wads.CheckNumForFullName (sc.String, true, ns_sounds);
lump = fileSystem.CheckNumForFullName (sc.String, true, ns_sounds);
}
if (lump != -1)
{
@ -745,10 +745,10 @@ void R_InitSkins (void)
{
if (stricmp (key, skinsoundnames[j][0]) == 0)
{
sndlumps[j] = Wads.CheckNumForName (sc.String, Skins[i].namespc);
sndlumps[j] = fileSystem.CheckNumForName (sc.String, Skins[i].namespc);
if (sndlumps[j] == -1)
{ // Replacement not found, try finding it in the global namespace
sndlumps[j] = Wads.CheckNumForFullName (sc.String, true, ns_sounds);
sndlumps[j] = fileSystem.CheckNumForFullName (sc.String, true, ns_sounds);
}
}
}
@ -811,11 +811,11 @@ void R_InitSkins (void)
if (intname == 0)
{
char name[9];
Wads.GetLumpName (name, base+1);
fileSystem.GetLumpName (name, base+1);
memcpy(&intname, name, 4);
}
int basens = Wads.GetLumpNamespace(base);
int basens = fileSystem.GetLumpNamespace(base);
for(int spr = 0; spr<2; spr++)
{
@ -841,11 +841,11 @@ void R_InitSkins (void)
}
}
for (k = base + 1; Wads.GetLumpNamespace(k) == basens; k++)
for (k = base + 1; fileSystem.GetLumpNamespace(k) == basens; k++)
{
char lname[9];
uint32_t lnameint;
Wads.GetLumpName (lname, k);
fileSystem.GetLumpName (lname, k);
memcpy(&lnameint, lname, 4);
if (lnameint == intname)
{
@ -864,7 +864,7 @@ void R_InitSkins (void)
break;
}
Wads.GetLumpName (temp.name, base+1);
fileSystem.GetLumpName (temp.name, base+1);
temp.name[4] = 0;
int sprno = (int)sprites.Push (temp);
if (spr==0) Skins[i].sprite = sprno;
@ -949,7 +949,7 @@ CCMD (skins)
static void R_CreateSkinTranslation (const char *palname)
{
FMemLump lump = Wads.ReadLump (palname);
FMemLump lump = fileSystem.ReadLump (palname);
const uint8_t *otherPal = (uint8_t *)lump.GetMem();
for (int i = 0; i < 256; ++i)
@ -984,7 +984,7 @@ void R_InitSprites ()
// [RH] Count the number of skins.
numskins = PlayerClasses.Size ();
lastlump = 0;
while ((lump = Wads.FindLump ("S_SKIN", &lastlump, true)) != -1)
while ((lump = fileSystem.FindLump ("S_SKIN", &lastlump, true)) != -1)
{
numskins++;
}

View file

@ -284,7 +284,7 @@ int ReadPalette(int lumpnum, uint8_t *buffer)
{
return 0;
}
FMemLump lump = Wads.ReadLump(lumpnum);
FMemLump lump = fileSystem.ReadLump(lumpnum);
uint8_t *lumpmem = (uint8_t*)lump.GetMem();
memset(buffer, 0, 768);
@ -314,13 +314,13 @@ int ReadPalette(int lumpnum, uint8_t *buffer)
id = MAKE_ID('I', 'E', 'N', 'D');
fr.Read(&id, 4);
}
I_Error("%s contains no palette", Wads.GetLumpFullName(lumpnum));
I_Error("%s contains no palette", fileSystem.GetLumpFullName(lumpnum));
}
if (memcmp(lumpmem, "JASC-PAL", 8) == 0)
{
FScanner sc;
sc.OpenMem(Wads.GetLumpFullName(lumpnum), (char*)lumpmem, int(lump.GetSize()));
sc.OpenMem(fileSystem.GetLumpFullName(lumpnum), (char*)lumpmem, int(lump.GetSize()));
sc.MustGetString();
sc.MustGetNumber(); // version - ignore
sc.MustGetNumber();
@ -403,7 +403,7 @@ void InitPalette ()
{
uint8_t pal[768];
ReadPalette(Wads.GetNumForName("PLAYPAL"), pal);
ReadPalette(fileSystem.GetNumForName("PLAYPAL"), pal);
GPalette.SetPalette (pal);
GPalette.MakeGoodRemap ();

View file

@ -178,7 +178,7 @@ FVoxel *R_LoadKVX(int lumpnum)
int mip, maxmipsize;
int i, j, n;
FMemLump lump = Wads.ReadLump(lumpnum); // FMemLump adds an extra 0 byte to the end.
FMemLump lump = fileSystem.ReadLump(lumpnum); // FMemLump adds an extra 0 byte to the end.
uint8_t *rawvoxel = (uint8_t *)lump.GetMem();
int voxelsize = (int)(lump.GetSize()-1);
@ -325,7 +325,7 @@ FVoxelDef *R_LoadVoxelDef(int lumpnum, int spin)
FVoxel *vox = R_LoadKVX(lumpnum);
if (vox == NULL)
{
Printf("%s is not a valid voxel file\n", Wads.GetLumpFullName(lumpnum));
Printf("%s is not a valid voxel file\n", fileSystem.GetLumpFullName(lumpnum));
return NULL;
}
else
@ -644,7 +644,7 @@ void R_InitVoxels()
{
int lump, lastlump = 0;
while ((lump = Wads.FindLump("VOXELDEF", &lastlump)) != -1)
while ((lump = fileSystem.FindLump("VOXELDEF", &lastlump)) != -1)
{
FScanner sc(lump);
TArray<uint32_t> vsprites;
@ -657,7 +657,7 @@ void R_InitVoxels()
sc.SetCMode(true);
sc.MustGetToken(TK_StringConst);
voxelfile = Wads.CheckNumForFullName(sc.String, true, ns_voxels);
voxelfile = fileSystem.CheckNumForFullName(sc.String, true, ns_voxels);
if (voxelfile < 0)
{
sc.ScriptMessage("Voxel \"%s\" not found.\n", sc.String);