- 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
parent 83befa7686
commit 6bccde3b51
103 changed files with 647 additions and 647 deletions

View file

@ -831,7 +831,7 @@ static void AM_ParseArrow(TArray<mline_t> &Arrow, const char *lumpname)
{
const int R = int((8 * PLAYERRADIUS) / 7);
FScanner sc;
int lump = Wads.CheckNumForFullName(lumpname, true);
int lump = fileSystem.CheckNumForFullName(lumpname, true);
if (lump >= 0)
{
sc.OpenLumpNum(lump);

View file

@ -293,7 +293,7 @@ public:
}
friend class FWadCollection;
friend class FileSystem;
};
class DecompressorBase : public FileReaderInterface

View file

@ -688,7 +688,7 @@ void C_BindDefaults ()
{
int lump, lastlump = 0;
while ((lump = Wads.FindLump("DEFBINDS", &lastlump)) != -1)
while ((lump = fileSystem.FindLump("DEFBINDS", &lastlump)) != -1)
{
FScanner sc(lump);

View file

@ -848,17 +848,17 @@ CCMD (wdir)
Printf ("usage: wdir <wadfile>\n");
return;
}
int wadnum = Wads.CheckIfWadLoaded (argv[1]);
int wadnum = fileSystem.CheckIfWadLoaded (argv[1]);
if (wadnum < 0)
{
Printf ("%s must be loaded to view its directory.\n", argv[1]);
return;
}
for (int i = 0; i < Wads.GetNumLumps(); ++i)
for (int i = 0; i < fileSystem.GetNumLumps(); ++i)
{
if (Wads.GetLumpFile(i) == wadnum)
if (fileSystem.GetLumpFile(i) == wadnum)
{
Printf ("%s\n", Wads.GetLumpFullName(i));
Printf ("%s\n", fileSystem.GetLumpFullName(i));
}
}
}
@ -1221,10 +1221,10 @@ CCMD(secret)
bool thislevel = !stricmp(mapname, primaryLevel->MapName);
bool foundsome = false;
int lumpno=Wads.CheckNumForName("SECRETS");
int lumpno=fileSystem.CheckNumForName("SECRETS");
if (lumpno < 0) return;
auto lump = Wads.OpenLumpReader(lumpno);
auto lump = fileSystem.OpenLumpReader(lumpno);
FString maphdr;
maphdr.Format("[%s]", mapname);

View file

@ -1796,10 +1796,10 @@ void C_GrabCVarDefaults ()
int lumpversion, gamelastrunversion;
gamelastrunversion = atoi(LASTRUNVERSION);
while ((lump = Wads.FindLump("DEFCVARS", &lastlump)) != -1)
while ((lump = fileSystem.FindLump("DEFCVARS", &lastlump)) != -1)
{
// don't parse from wads
if (lastlump > Wads.GetLastLump(Wads.GetMaxIwadNum()))
if (lastlump > fileSystem.GetLastLump(fileSystem.GetMaxIwadNum()))
I_FatalError("Cannot load DEFCVARS from a wadfile!\n");
FScanner sc(lump);

View file

@ -268,7 +268,7 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize,
FIWadManager::FIWadManager(const char *firstfn, const char *optfn)
{
FWadCollection check;
FileSystem check;
TArray<FString> fns;
TArray<FString> deletes;
fns.Push(firstfn);
@ -300,7 +300,7 @@ FIWadManager::FIWadManager(const char *firstfn, const char *optfn)
int FIWadManager::ScanIWAD (const char *iwad)
{
FWadCollection check;
FileSystem check;
check.InitSingleFile(iwad, true);
mLumpsFound.Resize(mIWadInfos.Size());
@ -353,7 +353,7 @@ int FIWadManager::ScanIWAD (const char *iwad)
int FIWadManager::CheckIWADInfo(const char* fn)
{
FWadCollection check;
FileSystem check;
check.InitSingleFile(fn, true);
if (check.GetNumLumps() > 0)
@ -735,14 +735,14 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
else
iwadnum = 1;
Wads.SetIwadNum(iwadnum);
fileSystem.SetIwadNum(iwadnum);
if (picks[pick].mRequiredPath.IsNotEmpty())
{
D_AddFile (wadfiles, picks[pick].mRequiredPath);
iwadnum++;
}
D_AddFile (wadfiles, picks[pick].mFullPath);
Wads.SetMaxIwadNum(iwadnum);
fileSystem.SetMaxIwadNum(iwadnum);
auto info = mIWadInfos[picks[pick].mInfoIndex];
// Load additional resources from the same directory as the IWAD itself.

View file

@ -1223,7 +1223,7 @@ void D_DoStrifeAdvanceDemo ()
case 0:
pagetic = 6 * TICRATE;
pagename = "TITLEPIC";
if (Wads.CheckNumForName ("d_logo", ns_music) < 0)
if (fileSystem.CheckNumForName ("d_logo", ns_music) < 0)
{ // strife0.wad does not have d_logo
S_StartMusic ("");
}
@ -1379,7 +1379,7 @@ void D_DoAdvanceDemo (void)
{
democount++;
mysnprintf (demoname + 4, countof(demoname) - 4, "%d", democount);
if (Wads.CheckNumForName (demoname) < 0)
if (fileSystem.CheckNumForName (demoname) < 0)
{
demosequence = 0;
democount = 0;
@ -1466,7 +1466,7 @@ void ParseCVarInfo()
int lump, lastlump = 0;
bool addedcvars = false;
while ((lump = Wads.FindLump("CVARINFO", &lastlump)) != -1)
while ((lump = fileSystem.FindLump("CVARINFO", &lastlump)) != -1)
{
FScanner sc(lump);
sc.SetCMode(true);
@ -2019,7 +2019,7 @@ static FString ParseGameInfo(TArray<FString> &pwads, const char *fn, const char
static FString CheckGameInfo(TArray<FString> & pwads)
{
TArray<FString> deletes;
FWadCollection check;
FileSystem check;
// Open the entire list as a temporary file system and look for a GAMEINFO lump. The last one will automatically win.
check.InitMultipleFiles(pwads, deletes, true);
@ -2045,9 +2045,9 @@ static FString CheckGameInfo(TArray<FString> & pwads)
static void SetMapxxFlag()
{
int lump_name = Wads.CheckNumForName("MAP01", ns_global, Wads.GetIwadNum());
int lump_wad = Wads.CheckNumForFullName("maps/map01.wad", Wads.GetIwadNum());
int lump_map = Wads.CheckNumForFullName("maps/map01.map", Wads.GetIwadNum());
int lump_name = fileSystem.CheckNumForName("MAP01", ns_global, fileSystem.GetIwadNum());
int lump_wad = fileSystem.CheckNumForFullName("maps/map01.wad", fileSystem.GetIwadNum());
int lump_map = fileSystem.CheckNumForFullName("maps/map01.map", fileSystem.GetIwadNum());
if (lump_name >= 0 || lump_wad >= 0 || lump_map >= 0) gameinfo.flags |= GI_MAPxx;
}
@ -2504,7 +2504,7 @@ static int D_DoomMain_Internal (void)
static const char* reserved[] = { "mapinfo", "zmapinfo", "gameinfo", "sndinfo", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "maps/" };
for (auto p : reserved) lfi.requiredPrefixes.Push(p);
Wads.InitMultipleFiles (allwads, iwad_info->DeleteLumps, false, &lfi);
fileSystem.InitMultipleFiles (allwads, iwad_info->DeleteLumps, false, &lfi);
allwads.Clear();
allwads.ShrinkToFit();
SetMapxxFlag();

View file

@ -156,7 +156,7 @@ CCMD (mapchecksum)
else
{
map->GetChecksum(cksum);
const char *wadname = Wads.GetWadName(Wads.GetLumpFile(map->lumpnum));
const char *wadname = fileSystem.GetWadName(fileSystem.GetLumpFile(map->lumpnum));
delete map;
for (size_t j = 0; j < sizeof(cksum); ++j)
{
@ -367,7 +367,7 @@ CCMD(listmaps)
if (map != NULL)
{
Printf("%s: '%s' (%s)\n", info->MapName.GetChars(), info->LookupLevelName().GetChars(),
Wads.GetWadName(Wads.GetLumpFile(map->lumpnum)));
fileSystem.GetWadName(fileSystem.GetLumpFile(map->lumpnum)));
delete map;
}
}

View file

@ -1765,7 +1765,7 @@ static bool CheckSingleWad (const char *name, bool &printRequires, bool printwar
{
return true;
}
if (Wads.CheckIfWadLoaded (name) < 0)
if (fileSystem.CheckIfWadLoaded (name) < 0)
{
if (printwarn)
{
@ -2129,13 +2129,13 @@ static void PutSaveWads (FSerializer &arc)
const char *name;
// Name of IWAD
name = Wads.GetWadName (Wads.GetIwadNum());
name = fileSystem.GetWadName (fileSystem.GetIwadNum());
arc.AddString("Game WAD", name);
// Name of wad the map resides in
if (Wads.GetLumpFile (primaryLevel->lumpnum) > Wads.GetIwadNum())
if (fileSystem.GetLumpFile (primaryLevel->lumpnum) > fileSystem.GetIwadNum())
{
name = Wads.GetWadName (Wads.GetLumpFile (primaryLevel->lumpnum));
name = fileSystem.GetWadName (fileSystem.GetLumpFile (primaryLevel->lumpnum));
arc.AddString("Map WAD", name);
}
}
@ -2773,12 +2773,12 @@ void G_DoPlayDemo (void)
gameaction = ga_nothing;
// [RH] Allow for demos not loaded as lumps
demolump = Wads.CheckNumForFullName (defdemoname, true);
demolump = fileSystem.CheckNumForFullName (defdemoname, true);
if (demolump >= 0)
{
int demolen = Wads.LumpLength (demolump);
int demolen = fileSystem.LumpLength (demolump);
demobuffer = (uint8_t *)M_Malloc(demolen);
Wads.ReadLump (demolump, demobuffer);
fileSystem.ReadLump (demolump, demobuffer);
}
else
{

View file

@ -895,8 +895,8 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo)
FTexture *tex = TexMan.GetTexture(*texids[i]);
if (tex != nullptr)
{
int filenum = Wads.GetLumpFile(tex->GetSourceLump());
if (filenum >= 0 && filenum <= Wads.GetMaxIwadNum())
int filenum = fileSystem.GetLumpFile(tex->GetSourceLump());
if (filenum >= 0 && filenum <= fileSystem.GetMaxIwadNum())
{
texids[i]->SetInvalid();
}

View file

@ -440,7 +440,7 @@ void SBarInfo::Load()
{
if(gameinfo.statusbar.IsNotEmpty())
{
int lump = Wads.CheckNumForFullName(gameinfo.statusbar, true);
int lump = fileSystem.CheckNumForFullName(gameinfo.statusbar, true);
if(lump != -1)
{
if (!batchrun) Printf ("ParseSBarInfo: Loading default status bar definition.\n");
@ -451,12 +451,12 @@ void SBarInfo::Load()
}
}
if(Wads.CheckNumForName("SBARINFO") != -1)
if(fileSystem.CheckNumForName("SBARINFO") != -1)
{
if (!batchrun) Printf ("ParseSBarInfo: Loading custom status bar definition.\n");
int lastlump, lump;
lastlump = 0;
while((lump = Wads.FindLump("SBARINFO", &lastlump)) != -1)
while((lump = fileSystem.FindLump("SBARINFO", &lastlump)) != -1)
{
if(SBarInfoScript[SCRIPT_CUSTOM] == NULL)
SBarInfoScript[SCRIPT_CUSTOM] = new SBarInfo(lump);
@ -478,7 +478,7 @@ void SBarInfo::ParseSBarInfo(int lump)
if(sc.TokenType == TK_Include)
{
sc.MustGetToken(TK_StringConst);
int lump = Wads.CheckNumForFullName(sc.String, true);
int lump = fileSystem.CheckNumForFullName(sc.String, true);
if (lump == -1)
sc.ScriptError("Lump '%s' not found", sc.String);
ParseSBarInfo(lump);
@ -493,15 +493,15 @@ void SBarInfo::ParseSBarInfo(int lump)
sc.MustGetToken(TK_Identifier);
if(sc.Compare("Doom"))
{
baselump = Wads.CheckNumForFullName("sbarinfo/doom.txt", true);
baselump = fileSystem.CheckNumForFullName("sbarinfo/doom.txt", true);
}
else if(sc.Compare("Heretic"))
{
baselump = Wads.CheckNumForFullName("sbarinfo/heretic.txt", true);
baselump = fileSystem.CheckNumForFullName("sbarinfo/heretic.txt", true);
}
else if(sc.Compare("Hexen"))
{
baselump = Wads.CheckNumForFullName("sbarinfo/hexen.txt", true);
baselump = fileSystem.CheckNumForFullName("sbarinfo/hexen.txt", true);
}
else if(sc.Compare("Strife"))
gameType = GAME_Strife;
@ -516,10 +516,10 @@ void SBarInfo::ParseSBarInfo(int lump)
{
sc.ScriptError("Standard %s status bar not found.", sc.String);
}
else if (Wads.GetLumpFile(baselump) > 0)
else if (fileSystem.GetLumpFile(baselump) > 0)
{
I_FatalError("File %s is overriding core lump sbarinfo/%s.txt.",
Wads.GetWadFullName(Wads.GetLumpFile(baselump)), sc.String);
fileSystem.GetWadFullName(fileSystem.GetLumpFile(baselump)), sc.String);
}
ParseSBarInfo(baselump);
}

View file

@ -270,8 +270,8 @@ void ST_CreateStatusBar(bool bTitleLevel)
// The old rule of 'what came last wins' goes here, as well.
// If the most recent SBARINFO definition comes before a status bar class definition it will be picked,
// if the class is defined later, this will be picked. If both come from the same file, the class definition will win.
int sbarinfolump = Wads.CheckNumForName("SBARINFO");
int sbarinfofile = Wads.GetLumpFile(sbarinfolump);
int sbarinfolump = fileSystem.CheckNumForName("SBARINFO");
int sbarinfofile = fileSystem.GetLumpFile(sbarinfolump);
if (gameinfo.statusbarclassfile >= gameinfo.statusbarfile && gameinfo.statusbarclassfile >= sbarinfofile)
{
CreateGameInfoStatusBar(shouldWarn);

View file

@ -422,7 +422,7 @@ void P_InitKeyMessages()
lastlump = 0;
ClearLocks();
while ((lump = Wads.FindLump ("LOCKDEFS", &lastlump)) != -1)
while ((lump = fileSystem.FindLump ("LOCKDEFS", &lastlump)) != -1)
{
FScanner sc(lump);
while (sc.GetString ())

View file

@ -2426,7 +2426,7 @@ CVAR(Int, dehload, 0, CVAR_ARCHIVE) // Autoloading of .DEH lumps is disabled by
// checks if lump is a .deh or .bex file. Only lumps in the root directory are considered valid.
static bool isDehFile(int lumpnum)
{
const char* const fullName = Wads.GetLumpFullName(lumpnum);
const char* const fullName = fileSystem.GetLumpFullName(lumpnum);
const char* const extension = strrchr(fullName, '.');
return NULL != extension && strchr(fullName, '/') == NULL
@ -2437,16 +2437,16 @@ int D_LoadDehLumps(DehLumpSource source)
{
int lastlump = 0, lumpnum, count = 0;
while ((lumpnum = Wads.FindLump("DEHACKED", &lastlump)) >= 0)
while ((lumpnum = fileSystem.FindLump("DEHACKED", &lastlump)) >= 0)
{
const int filenum = Wads.GetLumpFile(lumpnum);
const int filenum = fileSystem.GetLumpFile(lumpnum);
if (FromIWAD == source && filenum > Wads.GetMaxIwadNum())
if (FromIWAD == source && filenum > fileSystem.GetMaxIwadNum())
{
// No more DEHACKED lumps in IWAD
break;
}
else if (FromPWADs == source && filenum <= Wads.GetMaxIwadNum())
else if (FromPWADs == source && filenum <= fileSystem.GetMaxIwadNum())
{
// Skip DEHACKED lumps from IWAD
continue;
@ -2461,7 +2461,7 @@ int D_LoadDehLumps(DehLumpSource source)
if (dehload == 1) // load all .DEH lumps that are found.
{
for (lumpnum = 0, lastlump = Wads.GetNumLumps(); lumpnum < lastlump; ++lumpnum)
for (lumpnum = 0, lastlump = fileSystem.GetNumLumps(); lumpnum < lastlump; ++lumpnum)
{
if (isDehFile(lumpnum))
{
@ -2471,7 +2471,7 @@ int D_LoadDehLumps(DehLumpSource source)
}
else // only load the last .DEH lump that is found.
{
for (lumpnum = Wads.GetNumLumps()-1; lumpnum >=0; --lumpnum)
for (lumpnum = fileSystem.GetNumLumps()-1; lumpnum >=0; --lumpnum)
{
if (isDehFile(lumpnum))
{
@ -2488,13 +2488,13 @@ int D_LoadDehLumps(DehLumpSource source)
bool D_LoadDehLump(int lumpnum)
{
auto ls = LumpFileNum;
LumpFileNum = Wads.GetLumpFile(lumpnum);
LumpFileNum = fileSystem.GetLumpFile(lumpnum);
PatchSize = Wads.LumpLength(lumpnum);
PatchSize = fileSystem.LumpLength(lumpnum);
PatchName = Wads.GetLumpFullPath(lumpnum);
PatchName = fileSystem.GetLumpFullPath(lumpnum);
PatchFile = new char[PatchSize + 1];
Wads.ReadLump(lumpnum, PatchFile);
fileSystem.ReadLump(lumpnum, PatchFile);
PatchFile[PatchSize] = '\0'; // terminate with a '\0' character
auto res = DoDehPatch();
LumpFileNum = ls;
@ -2520,14 +2520,14 @@ bool D_LoadDehFile(const char *patchfile)
else
{
// Couldn't find it in the filesystem; try from a lump instead.
int lumpnum = Wads.CheckNumForFullName(patchfile, true);
int lumpnum = fileSystem.CheckNumForFullName(patchfile, true);
if (lumpnum < 0)
{
// Compatibility fallback. It's just here because
// some WAD may need it. Should be deleted if it can
// be confirmed that nothing uses this case.
FString filebase(ExtractFileBase(patchfile));
lumpnum = Wads.CheckNumForName(filebase);
lumpnum = fileSystem.CheckNumForName(filebase);
}
if (lumpnum >= 0)
{
@ -2682,14 +2682,14 @@ static bool LoadDehSupp ()
{
// Make sure we only get the DEHSUPP lump from zdoom.pk3
// User modifications are not supported!
int lump = Wads.CheckNumForName("DEHSUPP");
int lump = fileSystem.CheckNumForName("DEHSUPP");
if (lump == -1)
{
return false;
}
if (Wads.GetLumpFile(lump) > 0)
if (fileSystem.GetLumpFile(lump) > 0)
{
Printf("Warning: DEHSUPP no longer supported. DEHACKED patch disabled.\n");
return false;

View file

@ -264,7 +264,7 @@ void FDecalLib::ReadAllDecals ()
DecalLibrary.Clear();
while ((lump = Wads.FindLump ("DECALDEF", &lastlump)) != -1)
while ((lump = fileSystem.FindLump ("DECALDEF", &lastlump)) != -1)
{
FScanner sc(lump);
ReadDecals (sc);
@ -391,7 +391,7 @@ void FDecalLib::ParseDecal (FScanner &sc)
case DECAL_PIC:
sc.MustGetString ();
picnum = TexMan.CheckForTexture (sc.String, ETextureType::Any);
if (!picnum.Exists() && (lumpnum = Wads.CheckNumForName (sc.String, ns_graphics)) >= 0)
if (!picnum.Exists() && (lumpnum = fileSystem.CheckNumForName (sc.String, ns_graphics)) >= 0)
{
picnum = TexMan.CreateTexture (lumpnum, ETextureType::Decal);
}

View file

@ -110,7 +110,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
FStringf path("fonts/%s/", filetemplate);
// If a name template is given, collect data from all resource files.
// For anything else, each folder is being treated as an atomic, self-contained unit and mixing from different glyph sets is blocked.
Wads.GetLumpsInFolder(path, folderdata, nametemplate == nullptr);
fileSystem.GetLumpsInFolder(path, folderdata, nametemplate == nullptr);
//if (nametemplate == nullptr)
{
@ -234,7 +234,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
for (auto entry : array)
{
FTexture *tex = TexMan.GetTexture(entry, false);
if (tex && tex->SourceLump >= 0 && Wads.GetLumpFile(tex->SourceLump) <= Wads.GetMaxIwadNum() && tex->UseType == ETextureType::MiscPatch)
if (tex && tex->SourceLump >= 0 && fileSystem.GetLumpFile(tex->SourceLump) <= fileSystem.GetMaxIwadNum() && tex->UseType == ETextureType::MiscPatch)
{
texs[i] = tex;
}

View file

@ -125,7 +125,7 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump) : FFont(lump)
FontName = name;
FMemLump data1 = Wads.ReadLump (lump);
FMemLump data1 = fileSystem.ReadLump (lump);
const uint8_t *data = (const uint8_t *)data1.GetMem();
if (data[0] == 0xE1 && data[1] == 0xE6 && data[2] == 0xD5 && data[3] == 0x1A)
@ -539,7 +539,7 @@ int FSingleLumpFont::BMFCompare(const void *a, const void *b)
void FSingleLumpFont::CheckFON1Chars (double *luminosity)
{
FMemLump memLump = Wads.ReadLump(Lump);
FMemLump memLump = fileSystem.ReadLump(Lump);
const uint8_t* data = (const uint8_t*) memLump.GetMem();
uint8_t used[256], reverse[256];

View file

@ -110,20 +110,20 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
FStringf path("fonts/%s/", name);
// Use a folder-based font only if it comes from a later file than the single lump version.
if (Wads.GetLumpsInFolder(path, folderdata, true))
if (fileSystem.GetLumpsInFolder(path, folderdata, true))
{
// This assumes that any custom font comes in one piece and not distributed across multiple resource files.
folderfile = Wads.GetLumpFile(folderdata[0].lumpnum);
folderfile = fileSystem.GetLumpFile(folderdata[0].lumpnum);
}
lump = Wads.CheckNumForFullName(fontlumpname? fontlumpname : name, true);
lump = fileSystem.CheckNumForFullName(fontlumpname? fontlumpname : name, true);
if (lump != -1 && Wads.GetLumpFile(lump) >= folderfile)
if (lump != -1 && fileSystem.GetLumpFile(lump) >= folderfile)
{
uint32_t head;
{
auto lumpy = Wads.OpenLumpReader (lump);
auto lumpy = fileSystem.OpenLumpReader (lump);
lumpy.Read (&head, 4);
}
if ((head & MAKE_ID(255,255,255,0)) == MAKE_ID('F','O','N',0) ||
@ -176,7 +176,7 @@ void V_InitCustomFonts()
int kerning;
char cursor = '_';
while ((llump = Wads.FindLump ("FONTDEFS", &lastlump)) != -1)
while ((llump = fileSystem.FindLump ("FONTDEFS", &lastlump)) != -1)
{
sc.OpenLumpNum(llump);
while (sc.GetString())
@ -265,7 +265,7 @@ void V_InitCustomFonts()
{
*p = TexMan.GetTexture(texid);
}
else if (Wads.GetLumpFile(sc.LumpNum) >= Wads.GetIwadNum())
else if (fileSystem.GetLumpFile(sc.LumpNum) >= fileSystem.GetIwadNum())
{
// Print a message only if this isn't in zdoom.pk3
sc.ScriptMessage("%s: Unable to find texture in font definition for %s", sc.String, namebuffer.GetChars());
@ -345,7 +345,7 @@ void V_InitFontColors ()
TranslationLookup.Clear();
TranslationColors.Clear();
while ((lump = Wads.FindLump ("TEXTCOLO", &lastlump)) != -1)
while ((lump = fileSystem.FindLump ("TEXTCOLO", &lastlump)) != -1)
{
FScanner sc(lump);
while (sc.GetString())
@ -663,7 +663,7 @@ void V_InitFonts()
FFont *CreateHexLumpFont(const char *fontname, int lump);
FFont *CreateHexLumpFont2(const char *fontname, int lump);
auto lump = Wads.CheckNumForFullName("newconsolefont.hex", 0); // This is always loaded from gzdoom.pk3 to prevent overriding it with incomplete replacements.
auto lump = fileSystem.CheckNumForFullName("newconsolefont.hex", 0); // This is always loaded from gzdoom.pk3 to prevent overriding it with incomplete replacements.
if (lump == -1) I_FatalError("newconsolefont.hex not found"); // This font is needed - do not start up without it.
NewConsoleFont = CreateHexLumpFont("NewConsoleFont", lump);
NewSmallFont = CreateHexLumpFont2("NewSmallFont", lump);
@ -672,12 +672,12 @@ void V_InitFonts()
// load the heads-up font
if (!(SmallFont = V_GetFont("SmallFont", "SMALLFNT")))
{
if (Wads.CheckNumForName("FONTA_S") >= 0)
if (fileSystem.CheckNumForName("FONTA_S") >= 0)
{
int wadfile = -1;
auto a = Wads.CheckNumForName("FONTA33", ns_graphics);
if (a != -1) wadfile = Wads.GetLumpFile(a);
if (wadfile > Wads.GetIwadNum())
auto a = fileSystem.CheckNumForName("FONTA33", ns_graphics);
if (a != -1) wadfile = fileSystem.GetLumpFile(a);
if (wadfile > fileSystem.GetIwadNum())
{
// The font has been replaced, so we need to create a copy of the original as well.
SmallFont = new FFont("SmallFont", "FONTA%02u", nullptr, HU_FONTSTART, HU_FONTSIZE, 1, -1);
@ -689,12 +689,12 @@ void V_InitFonts()
SmallFont->SetCursor('[');
}
}
else if (Wads.CheckNumForName("STCFN033", ns_graphics) >= 0)
else if (fileSystem.CheckNumForName("STCFN033", ns_graphics) >= 0)
{
int wadfile = -1;
auto a = Wads.CheckNumForName("STCFN065", ns_graphics);
if (a != -1) wadfile = Wads.GetLumpFile(a);
if (wadfile > Wads.GetIwadNum())
auto a = fileSystem.CheckNumForName("STCFN065", ns_graphics);
if (a != -1) wadfile = fileSystem.GetLumpFile(a);
if (wadfile > fileSystem.GetIwadNum())
{
// The font has been replaced, so we need to create a copy of the original as well.
SmallFont = new FFont("SmallFont", "STCFN%.3d", nullptr, HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1);
@ -707,12 +707,12 @@ void V_InitFonts()
}
// Create the original small font as a fallback for incomplete definitions.
if (Wads.CheckNumForName("FONTA_S") >= 0)
if (fileSystem.CheckNumForName("FONTA_S") >= 0)
{
OriginalSmallFont = new FFont("OriginalSmallFont", "FONTA%02u", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, 1, -1, -1, false, true);
OriginalSmallFont->SetCursor('[');
}
else if (Wads.CheckNumForName("STCFN033", ns_graphics) >= 0)
else if (fileSystem.CheckNumForName("STCFN033", ns_graphics) >= 0)
{
OriginalSmallFont = new FFont("OriginalSmallFont", "STCFN%.3d", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1, -1, false, true);
}
@ -727,7 +727,7 @@ void V_InitFonts()
if (!(SmallFont2 = V_GetFont("SmallFont2"))) // Only used by Strife
{
if (Wads.CheckNumForName("STBFN033", ns_graphics) >= 0)
if (fileSystem.CheckNumForName("STBFN033", ns_graphics) >= 0)
{
SmallFont2 = new FFont("SmallFont2", "STBFN%.3d", "defsmallfont2", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1);
}
@ -738,7 +738,7 @@ void V_InitFonts()
if (!(BigFont = V_GetFont("BigFont")))
{
if (Wads.CheckNumForName("FONTB_S") >= 0)
if (fileSystem.CheckNumForName("FONTB_S") >= 0)
{
BigFont = new FFont("BigFont", "FONTB%02u", "defbigfont", HU_FONTSTART, HU_FONTSIZE, 1, -1);
}

View file

@ -851,12 +851,12 @@ void FMapInfoParser::ParseCluster()
// Remap Hexen's CLUS?MSG lumps to the string table, if applicable. The code here only checks what can actually be in an IWAD.
if (clusterinfo->flags & CLUSTER_EXITTEXTINLUMP)
{
int lump = Wads.CheckNumForFullName(clusterinfo->ExitText, true);
int lump = fileSystem.CheckNumForFullName(clusterinfo->ExitText, true);
if (lump > 0)
{
// Check if this comes from either Hexen.wad or Hexdd.wad and if so, map to the string table.
int fileno = Wads.GetLumpFile(lump);
auto fn = Wads.GetWadName(fileno);
int fileno = fileSystem.GetLumpFile(lump);
auto fn = fileSystem.GetWadName(fileno);
if (fn && (!stricmp(fn, "HEXEN.WAD") || !stricmp(fn, "HEXDD.WAD")))
{
FStringf key("TXT_%.5s_%s", fn, clusterinfo->ExitText.GetChars());
@ -1986,8 +1986,8 @@ level_info_t *FMapInfoParser::ParseMapHeader(level_info_t &defaultinfo)
if (HexenHack)
{
// Try to localize Hexen's map names. This does not use the above feature to allow these names to be unique.
int fileno = Wads.GetLumpFile(sc.LumpNum);
auto fn = Wads.GetWadName(fileno);
int fileno = fileSystem.GetLumpFile(sc.LumpNum);
auto fn = fileSystem.GetWadName(fileno);
if (fn && (!stricmp(fn, "HEXEN.WAD") || !stricmp(fn, "HEXDD.WAD")))
{
FStringf key("TXT_%.5s_%s", fn, levelinfo->MapName.GetChars());
@ -2206,18 +2206,18 @@ void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_i
if (sc.Compare("include"))
{
sc.MustGetString();
int inclump = Wads.CheckNumForFullName(sc.String, true);
int inclump = fileSystem.CheckNumForFullName(sc.String, true);
if (inclump < 0)
{
sc.ScriptError("include file '%s' not found", sc.String);
}
if (Wads.GetLumpFile(sc.LumpNum) != Wads.GetLumpFile(inclump))
if (fileSystem.GetLumpFile(sc.LumpNum) != fileSystem.GetLumpFile(inclump))
{
// Do not allow overriding includes from the default MAPINFO
if (Wads.GetLumpFile(sc.LumpNum) == 0)
if (fileSystem.GetLumpFile(sc.LumpNum) == 0)
{
I_FatalError("File %s is overriding core lump %s.",
Wads.GetWadFullName(Wads.GetLumpFile(inclump)), sc.String);
fileSystem.GetWadFullName(fileSystem.GetLumpFile(inclump)), sc.String);
}
}
FScanner saved_sc = sc;
@ -2406,11 +2406,11 @@ void G_ParseMapInfo (FString basemapinfo)
{
FMapInfoParser parse;
level_info_t defaultinfo;
int baselump = Wads.GetNumForFullName(basemapinfo);
if (Wads.GetLumpFile(baselump) > 0)
int baselump = fileSystem.GetNumForFullName(basemapinfo);
if (fileSystem.GetLumpFile(baselump) > 0)
{
I_FatalError("File %s is overriding core lump %s.",
Wads.GetWadFullName(Wads.GetLumpFile(baselump)), basemapinfo.GetChars());
fileSystem.GetWadFullName(fileSystem.GetLumpFile(baselump)), basemapinfo.GetChars());
}
parse.ParseMapInfo(baselump, gamedefaults, defaultinfo);
}
@ -2419,25 +2419,25 @@ void G_ParseMapInfo (FString basemapinfo)
int nindex;
// Parse any extra MAPINFOs.
while ((lump = Wads.FindLumpMulti (mapinfonames, &lastlump, false, &nindex)) != -1)
while ((lump = fileSystem.FindLumpMulti (mapinfonames, &lastlump, false, &nindex)) != -1)
{
if (nindex == 0)
{
// If this lump is named MAPINFO we need to check if the same WAD contains a ZMAPINFO lump.
// If that exists we need to skip this one.
int wad = Wads.GetLumpFile(lump);
int altlump = Wads.CheckNumForName("ZMAPINFO", ns_global, wad, true);
int wad = fileSystem.GetLumpFile(lump);
int altlump = fileSystem.CheckNumForName("ZMAPINFO", ns_global, wad, true);
if (altlump >= 0) continue;
}
else if (nindex == 2)
{
// MAPINFO and ZMAPINFO will override UMAPINFO if in the same WAD.
int wad = Wads.GetLumpFile(lump);
int altlump = Wads.CheckNumForName("ZMAPINFO", ns_global, wad, true);
int wad = fileSystem.GetLumpFile(lump);
int altlump = fileSystem.CheckNumForName("ZMAPINFO", ns_global, wad, true);
if (altlump >= 0) continue;
altlump = Wads.CheckNumForName("MAPINFO", ns_global, wad, true);
altlump = fileSystem.CheckNumForName("MAPINFO", ns_global, wad, true);
if (altlump >= 0) continue;
}
if (nindex != 2)

View file

@ -171,7 +171,7 @@ const char* GameInfoBorders[] =
{ \
sc.MustGetToken(TK_StringConst); \
gameinfo.key = sc.String; \
gameinfo.stampvar = Wads.GetLumpFile(sc.LumpNum); \
gameinfo.stampvar = fileSystem.GetLumpFile(sc.LumpNum); \
}
#define GAMEINFOKEY_INT(key, variable) \

View file

@ -316,7 +316,7 @@ static void LoadAltHudStuff()
break;
}
while ((lump = Wads.FindLump("ALTHUDCF", &lastlump)) != -1)
while ((lump = fileSystem.FindLump("ALTHUDCF", &lastlump)) != -1)
{
FScanner sc(lump);
while (sc.GetString())

View file

@ -160,10 +160,10 @@ void D_LoadWadSettings ()
KeySections.Clear();
KeyConfWeapons.Clear();
while ((lump = Wads.FindLump ("KEYCONF", &lastlump)) != -1)
while ((lump = fileSystem.FindLump ("KEYCONF", &lastlump)) != -1)
{
FMemLump data = Wads.ReadLump (lump);
const char *eof = (char *)data.GetMem() + Wads.LumpLength (lump);
FMemLump data = fileSystem.ReadLump (lump);
const char *eof = (char *)data.GetMem() + fileSystem.LumpLength (lump);
const char *conf = (char *)data.GetMem();
while (conf < eof)

View file

@ -249,7 +249,7 @@ void P_InitTerrainTypes ()
MakeDefaultTerrain ();
lastlump = 0;
while (-1 != (lump = Wads.FindLump ("TERRAIN", &lastlump)) )
while (-1 != (lump = fileSystem.FindLump ("TERRAIN", &lastlump)) )
{
FScanner sc(lump);
ParseOuter (sc);

View file

@ -456,10 +456,10 @@ void STAT_ChangeLevel(const char *newl, FLevelLocals *Level)
MapData * map = P_OpenMapData(StartEpisode->mEpisodeMap, false);
if (map != NULL)
{
wad = Wads.GetLumpFile(map->lumpnum);
wad = fileSystem.GetLumpFile(map->lumpnum);
delete map;
}
const char * name = Wads.GetWadName(wad);
const char * name = fileSystem.GetWadName(wad);
FString section = ExtractFileBase(name) + "." + StartEpisode->mEpisodeMap;
section.ToUpper();

View file

@ -57,15 +57,15 @@ void FStringTable::LoadStrings ()
int lastlump, lump;
lastlump = 0;
while ((lump = Wads.FindLump("LMACROS", &lastlump)) != -1)
while ((lump = fileSystem.FindLump("LMACROS", &lastlump)) != -1)
{
readMacros(lump);
}
lastlump = 0;
while ((lump = Wads.FindLump ("LANGUAGE", &lastlump)) != -1)
while ((lump = fileSystem.FindLump ("LANGUAGE", &lastlump)) != -1)
{
auto lumpdata = Wads.ReadLumpIntoArray(lump);
auto lumpdata = fileSystem.ReadLumpIntoArray(lump);
if (!ParseLanguageCSV(lump, lumpdata))
LoadLanguage (lump, lumpdata);
@ -163,7 +163,7 @@ TArray<TArray<FString>> FStringTable::parseCSV(const TArray<uint8_t> &buffer)
bool FStringTable::readMacros(int lumpnum)
{
auto lumpdata = Wads.ReadLumpIntoArray(lumpnum);
auto lumpdata = fileSystem.ReadLumpIntoArray(lumpnum);
auto data = parseCSV(lumpdata);
for (unsigned i = 1; i < data.Size(); i++)
@ -410,7 +410,7 @@ void FStringTable::DeleteForLabel(int lumpnum, FName label)
{
decltype(allStrings)::Iterator it(allStrings);
decltype(allStrings)::Pair *pair;
auto filenum = Wads.GetLumpFile(lumpnum);
auto filenum = fileSystem.GetLumpFile(lumpnum);
while (it.NextPair(pair))
{
@ -432,7 +432,7 @@ void FStringTable::DeleteForLabel(int lumpnum, FName label)
void FStringTable::InsertString(int lumpnum, int langid, FName label, const FString &string)
{
const char *strlangid = (const char *)&langid;
TableElement te = { Wads.GetLumpFile(lumpnum), { string, string, string, string } };
TableElement te = { fileSystem.GetLumpFile(lumpnum), { string, string, string, string } };
long index;
while ((index = te.strings[0].IndexOf("@[")) >= 0)
{

View file

@ -133,7 +133,7 @@ void FTeam::ParseTeamInfo ()
int iLump, iLastLump = 0;
Teams.Clear();
while ((iLump = Wads.FindLump ("TEAMINFO", &iLastLump)) != -1)
while ((iLump = fileSystem.FindLump ("TEAMINFO", &iLastLump)) != -1)
{
FScanner Scan (iLump);

View file

@ -60,11 +60,11 @@ static int SortSwitchDefs (const void *a, const void *b)
void FTextureManager::InitSwitchList ()
{
const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny;
int lump = Wads.CheckNumForName ("SWITCHES");
int lump = fileSystem.CheckNumForName ("SWITCHES");
if (lump != -1)
{
FMemLump lumpdata = Wads.ReadLump (lump);
FMemLump lumpdata = fileSystem.ReadLump (lump);
const char *alphSwitchList = (const char *)lumpdata.GetMem();
const char *list_p;
FSwitchDef *def1, *def2;

View file

@ -179,11 +179,11 @@ void FTextureManager::InitAnimated (void)
// don't know about ZDoom's more flexible texture system.
// | FTextureManager::TEXMAN_TryAny;
int lumpnum = Wads.CheckNumForName ("ANIMATED");
int lumpnum = fileSystem.CheckNumForName ("ANIMATED");
if (lumpnum != -1)
{
FMemLump animatedlump = Wads.ReadLump (lumpnum);
int animatedlen = Wads.LumpLength(lumpnum);
FMemLump animatedlump = fileSystem.ReadLump (lumpnum);
int animatedlen = fileSystem.LumpLength(lumpnum);
const uint8_t *animdefs = (const uint8_t *)animatedlump.GetMem();
const uint8_t *anim_p;
FTextureID pic1, pic2;
@ -241,8 +241,8 @@ void FTextureManager::InitAnimated (void)
if (debuganimated)
{
Printf("Defining animation '%s' (texture %d, lump %d, file %d) to '%s' (texture %d, lump %d, file %d)\n",
tex1->Name.GetChars(), pic1.GetIndex(), tex1->GetSourceLump(), Wads.GetLumpFile(tex1->GetSourceLump()),
tex2->Name.GetChars(), pic2.GetIndex(), tex2->GetSourceLump(), Wads.GetLumpFile(tex2->GetSourceLump()));
tex1->Name.GetChars(), pic1.GetIndex(), tex1->GetSourceLump(), fileSystem.GetLumpFile(tex1->GetSourceLump()),
tex2->Name.GetChars(), pic2.GetIndex(), tex2->GetSourceLump(), fileSystem.GetLumpFile(tex2->GetSourceLump()));
}
if (pic1 == pic2)
@ -279,7 +279,7 @@ void FTextureManager::InitAnimDefs ()
const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny;
int lump, lastlump = 0;
while ((lump = Wads.FindLump ("ANIMDEFS", &lastlump)) != -1)
while ((lump = fileSystem.FindLump ("ANIMDEFS", &lastlump)) != -1)
{
FScanner sc(lump);

View file

@ -67,7 +67,7 @@ public:
FImageSource *AutomapImage_TryCreate(FileReader &data, int lumpnum)
{
if (data.GetLength() < 320) return nullptr;
if (!Wads.CheckLumpName(lumpnum, "AUTOPAGE")) return nullptr;
if (!fileSystem.CheckLumpName(lumpnum, "AUTOPAGE")) return nullptr;
return new FAutomapTexture(lumpnum);
}
@ -81,7 +81,7 @@ FAutomapTexture::FAutomapTexture (int lumpnum)
: FImageSource(lumpnum)
{
Width = 320;
Height = uint16_t(Wads.LumpLength(lumpnum) / 320);
Height = uint16_t(fileSystem.LumpLength(lumpnum) / 320);
bUseGamePalette = true;
}
@ -94,7 +94,7 @@ FAutomapTexture::FAutomapTexture (int lumpnum)
TArray<uint8_t> FAutomapTexture::CreatePalettedPixels(int conversion)
{
int x, y;
FMemLump data = Wads.ReadLump (SourceLump);
FMemLump data = fileSystem.ReadLump (SourceLump);
const uint8_t *indata = (const uint8_t *)data.GetMem();
TArray<uint8_t> Pixels(Width * Height, true);

View file

@ -238,12 +238,12 @@ static int CountTiles (const void *tiles)
static int BuildPaletteTranslation(int lump)
{
if (Wads.LumpLength(lump) < 768)
if (fileSystem.LumpLength(lump) < 768)
{
return false;
}
FMemLump data = Wads.ReadLump(lump);
FMemLump data = fileSystem.ReadLump(lump);
const uint8_t *ipal = (const uint8_t *)data.GetMem();
FRemapTable opal;
@ -309,14 +309,14 @@ void FTextureManager::InitBuildTiles()
// Unfortunately neither the palettes nor the .ART files contain any usable identifying marker
// so this can only go by the file names.
int numlumps = Wads.GetNumLumps();
int numlumps = fileSystem.GetNumLumps();
for (int i = 0; i < numlumps; i++)
{
const char *name = Wads.GetLumpFullName(i);
if (Wads.CheckNumForFullName(name) != i) continue; // This palette is hidden by a later one. Do not process
const char *name = fileSystem.GetLumpFullName(i);
if (fileSystem.CheckNumForFullName(name) != i) continue; // This palette is hidden by a later one. Do not process
FString base = ExtractFileBase(name, true);
base.ToLower();
if (base.Compare("palette.dat") == 0 && Wads.LumpLength(i) >= 768) // must be a valid palette, i.e. at least 256 colors.
if (base.Compare("palette.dat") == 0 && fileSystem.LumpLength(i) >= 768) // must be a valid palette, i.e. at least 256 colors.
{
FString path = ExtractFilePath(name);
if (path.IsNotEmpty() && path.Back() != '/') path += '/';
@ -328,7 +328,7 @@ void FTextureManager::InitBuildTiles()
// only read from the same source as the palette.
// The entire format here is just too volatile to allow liberal mixing.
// An .ART set must be treated as one unit.
lumpnum = Wads.CheckNumForFullName(artpath, Wads.GetLumpFile(i));
lumpnum = fileSystem.CheckNumForFullName(artpath, fileSystem.GetLumpFile(i));
if (lumpnum < 0)
{
break;
@ -336,8 +336,8 @@ void FTextureManager::InitBuildTiles()
BuildTileData.Reserve(1);
auto &artdata = BuildTileData.Last();
artdata.Resize(Wads.LumpLength(lumpnum));
Wads.ReadLump(lumpnum, &artdata[0]);
artdata.Resize(fileSystem.LumpLength(lumpnum));
fileSystem.ReadLump(lumpnum, &artdata[0]);
if ((numtiles = CountTiles(&artdata[0])) > 0)
{

View file

@ -374,7 +374,7 @@ void FDDSTexture::CalcBitShift (uint32_t mask, uint8_t *lshiftp, uint8_t *rshift
TArray<uint8_t> FDDSTexture::CreatePalettedPixels(int conversion)
{
auto lump = Wads.OpenLumpReader (SourceLump);
auto lump = fileSystem.OpenLumpReader (SourceLump);
TArray<uint8_t> Pixels(Width*Height, true);
@ -783,7 +783,7 @@ void FDDSTexture::DecompressDXT5 (FileReader &lump, bool premultiplied, uint8_t
int FDDSTexture::CopyPixels(FBitmap *bmp, int conversion)
{
auto lump = Wads.OpenLumpReader (SourceLump);
auto lump = fileSystem.OpenLumpReader (SourceLump);
uint8_t *TexBuffer = bmp->GetPixels();

View file

@ -79,7 +79,7 @@ FFlatTexture::FFlatTexture (int lumpnum)
int area;
int bits;
area = Wads.LumpLength (lumpnum);
area = fileSystem.LumpLength (lumpnum);
switch (area)
{
@ -106,7 +106,7 @@ FFlatTexture::FFlatTexture (int lumpnum)
TArray<uint8_t> FFlatTexture::CreatePalettedPixels(int conversion)
{
auto lump = Wads.OpenLumpReader (SourceLump);
auto lump = fileSystem.OpenLumpReader (SourceLump);
TArray<uint8_t> Pixels(Width*Height, true);
auto numread = lump.Read (Pixels.Data(), Width*Height);
if (numread < Width*Height)

View file

@ -124,7 +124,7 @@ void FFontChar2::SetSourceRemap(const uint8_t *sourceremap)
TArray<uint8_t> FFontChar2::CreatePalettedPixels(int)
{
auto lump = Wads.OpenLumpReader (SourceLump);
auto lump = fileSystem.OpenLumpReader (SourceLump);
int destSize = Width * Height;
uint8_t max = 255;
bool rle = true;
@ -233,7 +233,7 @@ TArray<uint8_t> FFontChar2::CreatePalettedPixels(int)
if (destSize < 0)
{
char name[9];
Wads.GetLumpName (name, SourceLump);
fileSystem.GetLumpName (name, SourceLump);
name[8] = 0;
I_FatalError ("The font %s is corrupt", name);
}

View file

@ -122,7 +122,7 @@ FIMGZTexture::FIMGZTexture (int lumpnum, uint16_t w, uint16_t h, int16_t l, int1
TArray<uint8_t> FIMGZTexture::CreatePalettedPixels(int conversion)
{
FMemLump lump = Wads.ReadLump (SourceLump);
FMemLump lump = fileSystem.ReadLump (SourceLump);
const ImageHeader *imgz = (const ImageHeader *)lump.GetMem();
const uint8_t *data = (const uint8_t *)&imgz[1];

View file

@ -262,7 +262,7 @@ FJPEGTexture::FJPEGTexture (int lumpnum, int width, int height)
TArray<uint8_t> FJPEGTexture::CreatePalettedPixels(int conversion)
{
auto lump = Wads.OpenLumpReader (SourceLump);
auto lump = fileSystem.OpenLumpReader (SourceLump);
JSAMPLE *buff = NULL;
jpeg_decompress_struct cinfo;
@ -286,7 +286,7 @@ TArray<uint8_t> FJPEGTexture::CreatePalettedPixels(int conversion)
(cinfo.out_color_space == JCS_YCbCr && cinfo.num_components == 3) ||
(cinfo.out_color_space == JCS_GRAYSCALE && cinfo.num_components == 1)))
{
Printf(TEXTCOLOR_ORANGE "Unsupported color format in %s\n", Wads.GetLumpFullPath(SourceLump).GetChars());
Printf(TEXTCOLOR_ORANGE "Unsupported color format in %s\n", fileSystem.GetLumpFullPath(SourceLump).GetChars());
}
else
{
@ -363,7 +363,7 @@ TArray<uint8_t> FJPEGTexture::CreatePalettedPixels(int conversion)
}
catch (int)
{
Printf(TEXTCOLOR_ORANGE "JPEG error in %s\n", Wads.GetLumpFullPath(SourceLump).GetChars());
Printf(TEXTCOLOR_ORANGE "JPEG error in %s\n", fileSystem.GetLumpFullPath(SourceLump).GetChars());
}
jpeg_destroy_decompress(&cinfo);
if (buff != NULL)
@ -386,7 +386,7 @@ int FJPEGTexture::CopyPixels(FBitmap *bmp, int conversion)
{
PalEntry pe[256];
auto lump = Wads.OpenLumpReader (SourceLump);
auto lump = fileSystem.OpenLumpReader (SourceLump);
jpeg_decompress_struct cinfo;
jpeg_error_mgr jerr;
@ -406,7 +406,7 @@ int FJPEGTexture::CopyPixels(FBitmap *bmp, int conversion)
(cinfo.out_color_space == JCS_YCbCr && cinfo.num_components == 3) ||
(cinfo.out_color_space == JCS_GRAYSCALE && cinfo.num_components == 1)))
{
Printf(TEXTCOLOR_ORANGE "Unsupported color format in %s\n", Wads.GetLumpFullPath(SourceLump).GetChars());
Printf(TEXTCOLOR_ORANGE "Unsupported color format in %s\n", fileSystem.GetLumpFullPath(SourceLump).GetChars());
}
else
{
@ -454,7 +454,7 @@ int FJPEGTexture::CopyPixels(FBitmap *bmp, int conversion)
}
catch (int)
{
Printf(TEXTCOLOR_ORANGE "JPEG error in %s\n", Wads.GetLumpFullPath(SourceLump).GetChars());
Printf(TEXTCOLOR_ORANGE "JPEG error in %s\n", fileSystem.GetLumpFullPath(SourceLump).GetChars());
}
jpeg_destroy_decompress(&cinfo);
return 0;

View file

@ -170,10 +170,10 @@ TArray<uint8_t> FPatchTexture::CreatePalettedPixels(int conversion)
const column_t *maxcol;
int x;
FMemLump lump = Wads.ReadLump (SourceLump);
FMemLump lump = fileSystem.ReadLump (SourceLump);
const patch_t *patch = (const patch_t *)lump.GetMem();
maxcol = (const column_t *)((const uint8_t *)patch + Wads.LumpLength (SourceLump) - 3);
maxcol = (const column_t *)((const uint8_t *)patch + fileSystem.LumpLength (SourceLump) - 3);
remap = ImageHelpers::GetRemap(conversion == luminance, isalpha);
// Special case for skies
@ -275,12 +275,12 @@ int FPatchTexture::CopyPixels(FBitmap *bmp, int conversion)
void FPatchTexture::DetectBadPatches ()
{
// The patch must look like it is large enough for the rules to apply to avoid using this on truly empty patches.
if (Wads.LumpLength(SourceLump) < Width * Height / 2) return;
if (fileSystem.LumpLength(SourceLump) < Width * Height / 2) return;
// Check if this patch is likely to be a problem.
// It must be 256 pixels tall, and all its columns must have exactly
// one post, where each post has a supposed length of 0.
FMemLump lump = Wads.ReadLump (SourceLump);
FMemLump lump = fileSystem.ReadLump (SourceLump);
const patch_t *realpatch = (patch_t *)lump.GetMem();
const uint32_t *cofs = realpatch->columnofs;
int x, x2 = LittleShort(realpatch->width);

View file

@ -352,7 +352,7 @@ TArray<uint8_t> FPCXTexture::CreatePalettedPixels(int conversion)
PCXHeader header;
int bitcount;
auto lump = Wads.OpenLumpReader(SourceLump);
auto lump = fileSystem.OpenLumpReader(SourceLump);
lump.Read(&header, sizeof(header));
@ -441,7 +441,7 @@ int FPCXTexture::CopyPixels(FBitmap *bmp, int conversion)
int bitcount;
TArray<uint8_t> Pixels;
auto lump = Wads.OpenLumpReader(SourceLump);
auto lump = fileSystem.OpenLumpReader(SourceLump);
lump.Read(&header, sizeof(header));

View file

@ -194,12 +194,12 @@ FPNGTexture::FPNGTexture (FileReader &lump, int lumpnum, int width, int height,
ihoty = BigLong((int)hoty);
if (ihotx < -32768 || ihotx > 32767)
{
Printf ("X-Offset for PNG texture %s is bad: %d (0x%08x)\n", Wads.GetLumpFullName (lumpnum), ihotx, ihotx);
Printf ("X-Offset for PNG texture %s is bad: %d (0x%08x)\n", fileSystem.GetLumpFullName (lumpnum), ihotx, ihotx);
ihotx = 0;
}
if (ihoty < -32768 || ihoty > 32767)
{
Printf ("Y-Offset for PNG texture %s is bad: %d (0x%08x)\n", Wads.GetLumpFullName (lumpnum), ihoty, ihoty);
Printf ("Y-Offset for PNG texture %s is bad: %d (0x%08x)\n", fileSystem.GetLumpFullName (lumpnum), ihoty, ihoty);
ihoty = 0;
}
LeftOffset = ihotx;
@ -312,7 +312,7 @@ TArray<uint8_t> FPNGTexture::CreatePalettedPixels(int conversion)
FileReader *lump;
FileReader lfr;
lfr = Wads.OpenLumpReader(SourceLump);
lfr = fileSystem.OpenLumpReader(SourceLump);
lump = &lfr;
TArray<uint8_t> Pixels(Width*Height, true);
@ -457,7 +457,7 @@ int FPNGTexture::CopyPixels(FBitmap *bmp, int conversion)
FileReader *lump;
FileReader lfr;
lfr = Wads.OpenLumpReader(SourceLump);
lfr = fileSystem.OpenLumpReader(SourceLump);
lump = &lfr;
lump->Seek(33, FileReader::SeekSet);

View file

@ -158,11 +158,11 @@ FRawPageTexture::FRawPageTexture (int lumpnum)
// Special case hack for Heretic's E2 end pic. This is not going to be exposed as an editing feature because the implications would be horrible.
FString Name;
Wads.GetLumpName(Name, lumpnum);
fileSystem.GetLumpName(Name, lumpnum);
if (Name.CompareNoCase("E2END") == 0 && gameinfo.gametype == GAME_Heretic)
{
mPaletteLump = Wads.CheckNumForName("E2PAL");
if (Wads.LumpLength(mPaletteLump) < 768) mPaletteLump = -1;
mPaletteLump = fileSystem.CheckNumForName("E2PAL");
if (fileSystem.LumpLength(mPaletteLump) < 768) mPaletteLump = -1;
}
else bUseGamePalette = true;
}
@ -175,7 +175,7 @@ FRawPageTexture::FRawPageTexture (int lumpnum)
TArray<uint8_t> FRawPageTexture::CreatePalettedPixels(int conversion)
{
FMemLump lump = Wads.ReadLump (SourceLump);
FMemLump lump = fileSystem.ReadLump (SourceLump);
const uint8_t *source = (const uint8_t *)lump.GetMem();
const uint8_t *source_p = source;
uint8_t *dest_p;
@ -207,8 +207,8 @@ int FRawPageTexture::CopyPixels(FBitmap *bmp, int conversion)
if (mPaletteLump < 0) return FImageSource::CopyPixels(bmp, conversion);
else
{
FMemLump lump = Wads.ReadLump(SourceLump);
FMemLump plump = Wads.ReadLump(mPaletteLump);
FMemLump lump = fileSystem.ReadLump(SourceLump);
FMemLump plump = fileSystem.ReadLump(mPaletteLump);
const uint8_t *source = (const uint8_t *)lump.GetMem();
const uint8_t *psource = (const uint8_t *)plump.GetMem();
PalEntry paldata[256];

View file

@ -160,7 +160,7 @@ TArray<uint8_t> FStbTexture::CreatePalettedPixels(int conversion)
int FStbTexture::CopyPixels(FBitmap *bmp, int conversion)
{
auto lump = Wads.OpenLumpReader (SourceLump);
auto lump = fileSystem.OpenLumpReader (SourceLump);
int x, y, chan;
auto image = stbi_load_from_callbacks(&callbacks, &lump, &x, &y, &chan, STBI_rgb_alpha);
if (image)

View file

@ -182,7 +182,7 @@ void FTGATexture::ReadCompressed(FileReader &lump, uint8_t * buffer, int bytespe
TArray<uint8_t> FTGATexture::CreatePalettedPixels(int conversion)
{
uint8_t PaletteMap[256];
auto lump = Wads.OpenLumpReader (SourceLump);
auto lump = fileSystem.OpenLumpReader (SourceLump);
TGAHeader hdr;
uint16_t w;
uint8_t r,g,b,a;
@ -389,7 +389,7 @@ TArray<uint8_t> FTGATexture::CreatePalettedPixels(int conversion)
int FTGATexture::CopyPixels(FBitmap *bmp, int conversion)
{
PalEntry pe[256];
auto lump = Wads.OpenLumpReader (SourceLump);
auto lump = fileSystem.OpenLumpReader (SourceLump);
TGAHeader hdr;
uint16_t w;
uint8_t r,g,b,a;

View file

@ -83,7 +83,7 @@ PalettedPixels FImageSource::GetCachedPalettedPixels(int conversion)
PalettedPixels ret;
FString name;
Wads.GetLumpName(name, SourceLump);
fileSystem.GetLumpName(name, SourceLump);
std::pair<int, int> *info = nullptr;
auto imageID = ImageID;
@ -201,7 +201,7 @@ FBitmap FImageSource::GetCachedBitmap(PalEntry *remap, int conversion, int *ptra
FString name;
int trans = -1;
Wads.GetLumpName(name, SourceLump);
fileSystem.GetLumpName(name, SourceLump);
std::pair<int, int> *info = nullptr;
auto imageID = ImageID;
@ -371,7 +371,7 @@ FImageSource * FImageSource::GetImage(int lumpnum, ETextureType usetype)
// An image for this lump already exists. We do not need another one.
if (ImageForLump[lumpnum] != nullptr) return ImageForLump[lumpnum];
auto data = Wads.OpenLumpReader(lumpnum);
auto data = fileSystem.OpenLumpReader(lumpnum);
if (!data.isOpen())
return nullptr;

View file

@ -54,7 +54,7 @@ FImageTexture::FImageTexture(FImageSource *img, const char *name)
mImage = img;
if (img != nullptr)
{
if (name == nullptr) Wads.GetLumpName(Name, img->LumpNum());
if (name == nullptr) fileSystem.GetLumpName(Name, img->LumpNum());
Width = img->GetWidth();
Height = img->GetHeight();

View file

@ -283,7 +283,7 @@ void FMultipatchTextureBuilder::AddTexturesLump(const void *lumpdata, int lumpsi
}
{
auto pnames = Wads.OpenLumpReader(patcheslump);
auto pnames = fileSystem.OpenLumpReader(patcheslump);
numpatches = pnames.ReadUInt32();
// Check whether the amount of names reported is correct.
@ -294,7 +294,7 @@ void FMultipatchTextureBuilder::AddTexturesLump(const void *lumpdata, int lumpsi
}
// Check whether the amount of names reported is correct.
int lumplength = Wads.LumpLength(patcheslump);
int lumplength = fileSystem.LumpLength(patcheslump);
if (numpatches > uint32_t((lumplength - 4) / 8))
{
Printf("PNAMES lump is shorter than required (%u entries reported but only %d bytes (%d entries) long\n",
@ -406,13 +406,13 @@ void FMultipatchTextureBuilder::AddTexturesLumps(int lump1, int lump2, int patch
if (lump1 >= 0)
{
FMemLump texdir = Wads.ReadLump(lump1);
AddTexturesLump(texdir.GetMem(), Wads.LumpLength(lump1), lump1, patcheslump, firstdup, true);
FMemLump texdir = fileSystem.ReadLump(lump1);
AddTexturesLump(texdir.GetMem(), fileSystem.LumpLength(lump1), lump1, patcheslump, firstdup, true);
}
if (lump2 >= 0)
{
FMemLump texdir = Wads.ReadLump(lump2);
AddTexturesLump(texdir.GetMem(), Wads.LumpLength(lump2), lump2, patcheslump, firstdup, false);
FMemLump texdir = fileSystem.ReadLump(lump2);
AddTexturesLump(texdir.GetMem(), fileSystem.LumpLength(lump2), lump2, patcheslump, firstdup, false);
}
}

View file

@ -165,14 +165,14 @@ FTexture::FTexture (const char *name, int lumpnum)
}
else
{
Wads.GetLumpName (Name, lumpnum);
fileSystem.GetLumpName (Name, lumpnum);
}
}
FTexture::~FTexture ()
{
FTexture *link = Wads.GetLinkedTexture(SourceLump);
if (link == this) Wads.SetLinkedTexture(SourceLump, nullptr);
FTexture *link = fileSystem.GetLinkedTexture(SourceLump);
if (link == this) fileSystem.SetLinkedTexture(SourceLump, nullptr);
if (areas != nullptr) delete[] areas;
areas = nullptr;
@ -391,10 +391,10 @@ void FTexture::AddAutoMaterials()
if (this->*(layer.pointer) == nullptr) // only if no explicit assignment had been done.
{
FStringf lookup("%s%s%s", layer.path, bFullNameTexture ? "" : "auto/", searchname.GetChars());
auto lump = Wads.CheckNumForFullName(lookup, false, ns_global, true);
auto lump = fileSystem.CheckNumForFullName(lookup, false, ns_global, true);
if (lump != -1)
{
auto bmtex = TexMan.FindTexture(Wads.GetLumpFullName(lump), ETextureType::Any, FTextureManager::TEXMAN_TryAny);
auto bmtex = TexMan.FindTexture(fileSystem.GetLumpFullName(lump), ETextureType::Any, FTextureManager::TEXMAN_TryAny);
if (bmtex != nullptr)
{
bmtex->bMasked = false;

View file

@ -265,10 +265,10 @@ FTextureID FTextureManager::CheckForTexture (const char *name, ETextureType uset
if (strchr(name, '/'))
{
FTexture *const NO_TEXTURE = (FTexture*)-1;
int lump = Wads.CheckNumForFullName(name);
int lump = fileSystem.CheckNumForFullName(name);
if (lump >= 0)
{
FTexture *tex = Wads.GetLinkedTexture(lump);
FTexture *tex = fileSystem.GetLinkedTexture(lump);
if (tex == NO_TEXTURE) return FTextureID(-1);
if (tex != NULL) return tex->id;
if (flags & TEXMAN_DontCreate) return FTextureID(-1); // we only want to check, there's no need to create a texture if we don't have one yet.
@ -276,13 +276,13 @@ FTextureID FTextureManager::CheckForTexture (const char *name, ETextureType uset
if (tex != NULL)
{
tex->AddAutoMaterials();
Wads.SetLinkedTexture(lump, tex);
fileSystem.SetLinkedTexture(lump, tex);
return AddTexture(tex);
}
else
{
// mark this lump as having no valid texture so that we don't have to retry creating one later.
Wads.SetLinkedTexture(lump, NO_TEXTURE);
fileSystem.SetLinkedTexture(lump, NO_TEXTURE);
}
}
}
@ -443,8 +443,8 @@ bool FTextureManager::OkForLocalization(FTextureID texnum, const char *substitut
if (cl_gfxlocalization == 2) return false;
// Mode 3 must also reject substitutions for non-IWAD content.
int file = Wads.GetLumpFile(Textures[texnum.GetIndex()].Texture->SourceLump);
if (file > Wads.GetMaxIwadNum()) return true;
int file = fileSystem.GetLumpFile(Textures[texnum.GetIndex()].Texture->SourceLump);
if (file > fileSystem.GetMaxIwadNum()) return true;
return false;
}
@ -509,13 +509,13 @@ FTextureID FTextureManager::CreateTexture (int lumpnum, ETextureType usetype)
if (lumpnum != -1)
{
FString str;
Wads.GetLumpName(str, lumpnum);
fileSystem.GetLumpName(str, lumpnum);
FTexture *out = FTexture::CreateTexture(str, lumpnum, usetype);
if (out != NULL) return AddTexture (out);
else
{
Printf (TEXTCOLOR_ORANGE "Invalid data encountered for texture %s\n", Wads.GetLumpFullPath(lumpnum).GetChars());
Printf (TEXTCOLOR_ORANGE "Invalid data encountered for texture %s\n", fileSystem.GetLumpFullPath(lumpnum).GetChars());
return FTextureID(-1);
}
}
@ -586,8 +586,8 @@ bool FTextureManager::AreTexturesCompatible (FTextureID picnum1, FTextureID picn
void FTextureManager::AddGroup(int wadnum, int ns, ETextureType usetype)
{
int firsttx = Wads.GetFirstLump(wadnum);
int lasttx = Wads.GetLastLump(wadnum);
int firsttx = fileSystem.GetFirstLump(wadnum);
int lasttx = fileSystem.GetLastLump(wadnum);
FString Name;
// Go from first to last so that ANIMDEFS work as expected. However,
@ -597,19 +597,19 @@ void FTextureManager::AddGroup(int wadnum, int ns, ETextureType usetype)
for (; firsttx <= lasttx; ++firsttx)
{
if (Wads.GetLumpNamespace(firsttx) == ns)
if (fileSystem.GetLumpNamespace(firsttx) == ns)
{
Wads.GetLumpName (Name, firsttx);
fileSystem.GetLumpName (Name, firsttx);
if (Wads.CheckNumForName (Name, ns) == firsttx)
if (fileSystem.CheckNumForName (Name, ns) == firsttx)
{
CreateTexture (firsttx, usetype);
}
StartScreen->Progress();
}
else if (ns == ns_flats && Wads.GetLumpFlags(firsttx) & LUMPF_MAYBEFLAT)
else if (ns == ns_flats && fileSystem.GetLumpFlags(firsttx) & LUMPF_MAYBEFLAT)
{
if (Wads.CheckNumForName (Name, ns) < firsttx)
if (fileSystem.CheckNumForName (Name, ns) < firsttx)
{
CreateTexture (firsttx, usetype);
}
@ -626,8 +626,8 @@ void FTextureManager::AddGroup(int wadnum, int ns, ETextureType usetype)
void FTextureManager::AddHiresTextures (int wadnum)
{
int firsttx = Wads.GetFirstLump(wadnum);
int lasttx = Wads.GetLastLump(wadnum);
int firsttx = fileSystem.GetFirstLump(wadnum);
int lasttx = fileSystem.GetLastLump(wadnum);
FString Name;
TArray<FTextureID> tlist;
@ -639,11 +639,11 @@ void FTextureManager::AddHiresTextures (int wadnum)
for (;firsttx <= lasttx; ++firsttx)
{
if (Wads.GetLumpNamespace(firsttx) == ns_hires)
if (fileSystem.GetLumpNamespace(firsttx) == ns_hires)
{
Wads.GetLumpName (Name, firsttx);
fileSystem.GetLumpName (Name, firsttx);
if (Wads.CheckNumForName (Name, ns_hires) == firsttx)
if (fileSystem.CheckNumForName (Name, ns_hires) == firsttx)
{
tlist.Clear();
int amount = ListTextures(Name, tlist);
@ -695,9 +695,9 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname, FMultipa
lastLump = 0;
while ((remapLump = Wads.FindLump(lumpname, &lastLump)) != -1)
while ((remapLump = fileSystem.FindLump(lumpname, &lastLump)) != -1)
{
if (Wads.GetLumpFile(remapLump) == wadnum)
if (fileSystem.GetLumpFile(remapLump) == wadnum)
{
ParseTextureDef(remapLump, build);
}
@ -732,8 +732,8 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
FName texname = sc.String;
sc.MustGetString();
int lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_patches);
if (lumpnum == -1) lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_graphics);
int lumpnum = fileSystem.CheckNumForFullName(sc.String, true, ns_patches);
if (lumpnum == -1) lumpnum = fileSystem.CheckNumForFullName(sc.String, true, ns_graphics);
if (tlist.Size() == 0)
{
@ -757,7 +757,7 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
if (oldtex->UseType == type || type == ETextureType::Any ||
(mode == TEXMAN_Overridable && oldtex->UseType == ETextureType::Override) ||
(type == ETextureType::Sprite && oldtex->UseType == ETextureType::MiscPatch &&
(sl=oldtex->GetSourceLump()) >= 0 && Wads.GetLumpNamespace(sl) == ns_sprites)
(sl=oldtex->GetSourceLump()) >= 0 && fileSystem.GetLumpNamespace(sl) == ns_sprites)
)
{
FTexture * newtex = FTexture::CreateTexture ("", lumpnum, ETextureType::Any);
@ -785,8 +785,8 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
{
FString src = base.Left(8);
int lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_patches);
if (lumpnum == -1) lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_graphics);
int lumpnum = fileSystem.CheckNumForFullName(sc.String, true, ns_patches);
if (lumpnum == -1) lumpnum = fileSystem.CheckNumForFullName(sc.String, true, ns_graphics);
sc.GetString();
bool is32bit = !!sc.Compare("force32bit");
@ -844,7 +844,7 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
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)
{
sc.ScriptError("Lump '%s' not found", sc.String);
@ -869,7 +869,7 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
void FTextureManager::AddPatches (int lumpnum)
{
auto file = Wads.ReopenLumpReader (lumpnum, true);
auto file = fileSystem.ReopenLumpReader (lumpnum, true);
uint32_t numpatches, i;
char name[9];
@ -882,7 +882,7 @@ void FTextureManager::AddPatches (int lumpnum)
if (CheckForTexture (name, ETextureType::WallPatch, 0) == -1)
{
CreateTexture (Wads.CheckNumForName (name, ns_patches), ETextureType::WallPatch);
CreateTexture (fileSystem.CheckNumForName (name, ns_patches), ETextureType::WallPatch);
}
StartScreen->Progress();
}
@ -901,7 +901,7 @@ void FTextureManager::LoadTextureX(int wadnum, FMultipatchTextureBuilder &build)
{
// Use the most recent PNAMES for this WAD.
// Multiple PNAMES in a WAD will be ignored.
int pnames = Wads.CheckNumForName("PNAMES", ns_global, wadnum, false);
int pnames = fileSystem.CheckNumForName("PNAMES", ns_global, wadnum, false);
if (pnames < 0)
{
@ -911,10 +911,10 @@ void FTextureManager::LoadTextureX(int wadnum, FMultipatchTextureBuilder &build)
// Only add the patches if the PNAMES come from the current file
// Otherwise they have already been processed.
if (Wads.GetLumpFile(pnames) == wadnum) TexMan.AddPatches (pnames);
if (fileSystem.GetLumpFile(pnames) == wadnum) TexMan.AddPatches (pnames);
int texlump1 = Wads.CheckNumForName ("TEXTURE1", ns_global, wadnum);
int texlump2 = Wads.CheckNumForName ("TEXTURE2", ns_global, wadnum);
int texlump1 = fileSystem.CheckNumForName ("TEXTURE1", ns_global, wadnum);
int texlump2 = fileSystem.CheckNumForName ("TEXTURE2", ns_global, wadnum);
build.AddTexturesLumps (texlump1, texlump2, pnames);
}
@ -927,8 +927,8 @@ void FTextureManager::LoadTextureX(int wadnum, FMultipatchTextureBuilder &build)
void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &build)
{
int firsttexture = Textures.Size();
int lumpcount = Wads.GetNumLumps();
bool iwad = wadnum >= Wads.GetIwadNum() && wadnum <= Wads.GetMaxIwadNum();
int lumpcount = fileSystem.GetNumLumps();
bool iwad = wadnum >= fileSystem.GetIwadNum() && wadnum <= fileSystem.GetMaxIwadNum();
FirstTextureForFile.Push(firsttexture);
@ -949,41 +949,41 @@ void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &b
AddGroup(wadnum, ns_newtextures, ETextureType::Override);
// Sixth step: Try to find any lump in the WAD that may be a texture and load as a TEX_MiscPatch
int firsttx = Wads.GetFirstLump(wadnum);
int lasttx = Wads.GetLastLump(wadnum);
int firsttx = fileSystem.GetFirstLump(wadnum);
int lasttx = fileSystem.GetLastLump(wadnum);
for (int i= firsttx; i <= lasttx; i++)
{
bool skin = false;
FString Name;
Wads.GetLumpName(Name, i);
fileSystem.GetLumpName(Name, i);
// Ignore anything not in the global namespace
int ns = Wads.GetLumpNamespace(i);
int ns = fileSystem.GetLumpNamespace(i);
if (ns == ns_global)
{
// In Zips all graphics must be in a separate namespace.
if (Wads.GetLumpFlags(i) & LUMPF_FULLPATH) continue;
if (fileSystem.GetLumpFlags(i) & LUMPF_FULLPATH) continue;
// Ignore lumps with empty names.
if (Wads.CheckLumpName(i, "")) continue;
if (fileSystem.CheckLumpName(i, "")) continue;
// Ignore anything belonging to a map
if (Wads.CheckLumpName(i, "THINGS")) continue;
if (Wads.CheckLumpName(i, "LINEDEFS")) continue;
if (Wads.CheckLumpName(i, "SIDEDEFS")) continue;
if (Wads.CheckLumpName(i, "VERTEXES")) continue;
if (Wads.CheckLumpName(i, "SEGS")) continue;
if (Wads.CheckLumpName(i, "SSECTORS")) continue;
if (Wads.CheckLumpName(i, "NODES")) continue;
if (Wads.CheckLumpName(i, "SECTORS")) continue;
if (Wads.CheckLumpName(i, "REJECT")) continue;
if (Wads.CheckLumpName(i, "BLOCKMAP")) continue;
if (Wads.CheckLumpName(i, "BEHAVIOR")) continue;
if (fileSystem.CheckLumpName(i, "THINGS")) continue;
if (fileSystem.CheckLumpName(i, "LINEDEFS")) continue;
if (fileSystem.CheckLumpName(i, "SIDEDEFS")) continue;
if (fileSystem.CheckLumpName(i, "VERTEXES")) continue;
if (fileSystem.CheckLumpName(i, "SEGS")) continue;
if (fileSystem.CheckLumpName(i, "SSECTORS")) continue;
if (fileSystem.CheckLumpName(i, "NODES")) continue;
if (fileSystem.CheckLumpName(i, "SECTORS")) continue;
if (fileSystem.CheckLumpName(i, "REJECT")) continue;
if (fileSystem.CheckLumpName(i, "BLOCKMAP")) continue;
if (fileSystem.CheckLumpName(i, "BEHAVIOR")) continue;
bool force = false;
// Don't bother looking at this lump if something later overrides it.
if (Wads.CheckNumForName(Name, ns_graphics) != i)
if (fileSystem.CheckNumForName(Name, ns_graphics) != i)
{
if (iwad)
{
@ -999,7 +999,7 @@ void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &b
}
else if (ns == ns_graphics)
{
if (Wads.CheckNumForName(Name, ns_graphics) != i)
if (fileSystem.CheckNumForName(Name, ns_graphics) != i)
{
if (iwad)
{
@ -1012,7 +1012,7 @@ void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &b
else if (ns >= ns_firstskin)
{
// Don't bother looking this lump if something later overrides it.
if (Wads.CheckNumForName(Name, ns) != i) continue;
if (fileSystem.CheckNumForName(Name, ns) != i) continue;
skin = true;
}
else continue;
@ -1102,7 +1102,7 @@ void FTextureManager::SortTexturesByType(int start, int end)
void FTextureManager::AddLocalizedVariants()
{
TArray<FolderEntry> content;
Wads.GetLumpsInFolder("localized/textures/", content, false);
fileSystem.GetLumpsInFolder("localized/textures/", content, false);
for (auto &entry : content)
{
FString name = entry.name;
@ -1195,7 +1195,7 @@ void FTextureManager::Init()
AddTexture(CreateShaderTexture(true, false));
AddTexture(CreateShaderTexture(true, true));
int wadcnt = Wads.GetNumWads();
int wadcnt = fileSystem.GetNumWads();
FMultipatchTextureBuilder build(*this);
@ -1273,7 +1273,7 @@ void FTextureManager::InitPalettedVersions()
{
int lump, lastlump = 0;
while ((lump = Wads.FindLump("PALVERS", &lastlump)) != -1)
while ((lump = fileSystem.FindLump("PALVERS", &lastlump)) != -1)
{
FScanner sc(lump);
@ -1351,9 +1351,9 @@ int FTextureManager::GuesstimateNumTextures ()
{
int numtex = 0;
for(int i = Wads.GetNumLumps()-1; i>=0; i--)
for(int i = fileSystem.GetNumLumps()-1; i>=0; i--)
{
int space = Wads.GetLumpNamespace(i);
int space = fileSystem.GetLumpNamespace(i);
switch(space)
{
case ns_flats:
@ -1366,7 +1366,7 @@ int FTextureManager::GuesstimateNumTextures ()
break;
default:
if (Wads.GetLumpFlags(i) & LUMPF_MAYBEFLAT) numtex++;
if (fileSystem.GetLumpFlags(i) & LUMPF_MAYBEFLAT) numtex++;
break;
}
@ -1388,25 +1388,25 @@ int FTextureManager::GuesstimateNumTextures ()
int FTextureManager::CountTexturesX ()
{
int count = 0;
int wadcount = Wads.GetNumWads();
int wadcount = fileSystem.GetNumWads();
for (int wadnum = 0; wadnum < wadcount; wadnum++)
{
// Use the most recent PNAMES for this WAD.
// Multiple PNAMES in a WAD will be ignored.
int pnames = Wads.CheckNumForName("PNAMES", ns_global, wadnum, false);
int pnames = fileSystem.CheckNumForName("PNAMES", ns_global, wadnum, false);
// should never happen except for zdoom.pk3
if (pnames < 0) continue;
// Only count the patches if the PNAMES come from the current file
// Otherwise they have already been counted.
if (Wads.GetLumpFile(pnames) == wadnum)
if (fileSystem.GetLumpFile(pnames) == wadnum)
{
count += CountLumpTextures (pnames);
}
int texlump1 = Wads.CheckNumForName ("TEXTURE1", ns_global, wadnum);
int texlump2 = Wads.CheckNumForName ("TEXTURE2", ns_global, wadnum);
int texlump1 = fileSystem.CheckNumForName ("TEXTURE1", ns_global, wadnum);
int texlump2 = fileSystem.CheckNumForName ("TEXTURE2", ns_global, wadnum);
count += CountLumpTextures (texlump1) - 1;
count += CountLumpTextures (texlump2) - 1;
@ -1426,7 +1426,7 @@ int FTextureManager::CountLumpTextures (int lumpnum)
{
if (lumpnum >= 0)
{
auto file = Wads.OpenLumpReader (lumpnum);
auto file = fileSystem.OpenLumpReader (lumpnum);
uint32_t numtex = file.ReadUInt32();;
return int(numtex) >= 0 ? numtex : 0;
@ -1446,18 +1446,18 @@ void FTextureManager::AdjustSpriteOffsets()
int sprid;
TMap<int, bool> donotprocess;
int numtex = Wads.GetNumLumps();
int numtex = fileSystem.GetNumLumps();
for (int i = 0; i < numtex; i++)
{
if (Wads.GetLumpFile(i) > Wads.GetMaxIwadNum()) break; // we are past the IWAD
if (Wads.GetLumpNamespace(i) == ns_sprites && Wads.GetLumpFile(i) >= Wads.GetIwadNum() && Wads.GetLumpFile(i) <= Wads.GetMaxIwadNum())
if (fileSystem.GetLumpFile(i) > fileSystem.GetMaxIwadNum()) break; // we are past the IWAD
if (fileSystem.GetLumpNamespace(i) == ns_sprites && fileSystem.GetLumpFile(i) >= fileSystem.GetIwadNum() && fileSystem.GetLumpFile(i) <= fileSystem.GetMaxIwadNum())
{
char str[9];
Wads.GetLumpName(str, i);
fileSystem.GetLumpName(str, i);
str[8] = 0;
FTextureID texid = TexMan.CheckForTexture(str, ETextureType::Sprite, 0);
if (texid.isValid() && Wads.GetLumpFile(GetTexture(texid)->SourceLump) > Wads.GetMaxIwadNum())
if (texid.isValid() && fileSystem.GetLumpFile(GetTexture(texid)->SourceLump) > fileSystem.GetMaxIwadNum())
{
// This texture has been replaced by some PWAD.
memcpy(&sprid, str, 4);
@ -1466,12 +1466,12 @@ void FTextureManager::AdjustSpriteOffsets()
}
}
while ((lump = Wads.FindLump("SPROFS", &lastlump, false)) != -1)
while ((lump = fileSystem.FindLump("SPROFS", &lastlump, false)) != -1)
{
FScanner sc;
sc.OpenLumpNum(lump);
sc.SetCMode(true);
int ofslumpno = Wads.GetLumpFile(lump);
int ofslumpno = fileSystem.GetLumpFile(lump);
while (sc.GetString())
{
int x, y;
@ -1496,12 +1496,12 @@ void FTextureManager::AdjustSpriteOffsets()
int lumpnum = tex->GetSourceLump();
// We only want to change texture offsets for sprites in the IWAD or the file this lump originated from.
if (lumpnum >= 0 && lumpnum < Wads.GetNumLumps())
if (lumpnum >= 0 && lumpnum < fileSystem.GetNumLumps())
{
int wadno = Wads.GetLumpFile(lumpnum);
if ((iwadonly && wadno >= Wads.GetIwadNum() && wadno <= Wads.GetMaxIwadNum()) || (!iwadonly && wadno == ofslumpno))
int wadno = fileSystem.GetLumpFile(lumpnum);
if ((iwadonly && wadno >= fileSystem.GetIwadNum() && wadno <= fileSystem.GetMaxIwadNum()) || (!iwadonly && wadno == ofslumpno))
{
if (wadno >= Wads.GetIwadNum() && wadno <= Wads.GetMaxIwadNum() && !forced && iwadonly)
if (wadno >= fileSystem.GetIwadNum() && wadno <= fileSystem.GetMaxIwadNum() && !forced && iwadonly)
{
memcpy(&sprid, &tex->Name[0], 4);
if (donotprocess.CheckKey(sprid)) continue; // do not alter sprites that only get partially replaced.
@ -1542,14 +1542,14 @@ void FTextureManager::SpriteAdjustChanged()
void FTextureManager::GenerateGlobalBrightmapFromColormap()
{
Wads.CheckNumForFullName("textures/tgapal", false, 0, true);
fileSystem.CheckNumForFullName("textures/tgapal", false, 0, true);
HasGlobalBrightmap = false;
int lump = Wads.CheckNumForName("COLORMAP");
if (lump == -1) lump = Wads.CheckNumForName("COLORMAP", ns_colormaps);
int lump = fileSystem.CheckNumForName("COLORMAP");
if (lump == -1) lump = fileSystem.CheckNumForName("COLORMAP", ns_colormaps);
if (lump == -1) return;
FMemLump cmap = Wads.ReadLump(lump);
FMemLump cmap = fileSystem.ReadLump(lump);
uint8_t palbuffer[768];
ReadPalette(Wads.GetNumForName("PLAYPAL"), palbuffer);
ReadPalette(fileSystem.GetNumForName("PLAYPAL"), palbuffer);
const unsigned char *cmapdata = (const unsigned char *)cmap.GetMem();
const uint8_t *paldata = palbuffer;
@ -1602,8 +1602,8 @@ DEFINE_ACTION_FUNCTION(_TexMan, GetName)
{
// Textures for full path names do not have their own name, they merely link to the source lump.
auto lump = tex->GetSourceLump();
if (Wads.GetLinkedTexture(lump) == tex)
retval = Wads.GetLumpFullName(lump);
if (fileSystem.GetLinkedTexture(lump) == tex)
retval = fileSystem.GetLumpFullName(lump);
}
}
ACTION_RETURN_STRING(retval);

View file

@ -70,7 +70,7 @@ union LumpShortName
};
struct FWadCollection::LumpRecord
struct FileSystem::LumpRecord
{
FResourceLump *lump;
FTexture* linkedTexture;
@ -94,7 +94,7 @@ struct FWadCollection::LumpRecord
Namespace = lump->GetNamespace();
resourceId = 0;
if (gameinfo.gametype == GAME_Strife && gameinfo.flags & GI_SHAREWARE && filenum == Wads.GetIwadNum())
if (gameinfo.gametype == GAME_Strife && gameinfo.flags & GI_SHAREWARE && filenum == fileSystem.GetIwadNum())
{
if (shortName.String[0] == 'V' &&
shortName.String[1] == 'O' &&
@ -183,7 +183,7 @@ static void PrintLastError ();
// PUBLIC DATA DEFINITIONS -------------------------------------------------
FWadCollection Wads;
FileSystem fileSystem;
// PRIVATE DATA DEFINITIONS ------------------------------------------------
@ -221,16 +221,16 @@ void uppercopy (char *to, const char *from)
to[i] = 0;
}
FWadCollection::FWadCollection ()
FileSystem::FileSystem ()
{
}
FWadCollection::~FWadCollection ()
FileSystem::~FileSystem ()
{
DeleteAll();
}
void FWadCollection::DeleteAll ()
void FileSystem::DeleteAll ()
{
LumpInfo.Clear();
NumLumps = 0;
@ -255,7 +255,7 @@ void FWadCollection::DeleteAll ()
//
//==========================================================================
void FWadCollection::InitSingleFile(const char* filename, bool quiet)
void FileSystem::InitSingleFile(const char* filename, bool quiet)
{
TArray<FString> filenames;
TArray<FString> deletes;
@ -263,7 +263,7 @@ void FWadCollection::InitSingleFile(const char* filename, bool quiet)
InitMultipleFiles(filenames, deletes, true);
}
void FWadCollection::InitMultipleFiles (TArray<FString> &filenames, const TArray<FString> &deletelumps, bool quiet, LumpFilterInfo* filter)
void FileSystem::InitMultipleFiles (TArray<FString> &filenames, const TArray<FString> &deletelumps, bool quiet, LumpFilterInfo* filter)
{
int numfiles;
@ -312,11 +312,11 @@ void FWadCollection::InitMultipleFiles (TArray<FString> &filenames, const TArray
//
//-----------------------------------------------------------------------
int FWadCollection::AddExternalFile(const char *filename)
int FileSystem::AddExternalFile(const char *filename)
{
FResourceLump *lump = new FExternalLump(filename);
FWadCollection::LumpRecord *lumprec = &LumpInfo[LumpInfo.Reserve(1)];
FileSystem::LumpRecord *lumprec = &LumpInfo[LumpInfo.Reserve(1)];
lumprec->SetFromLump(-1, lump);
return LumpInfo.Size()-1; // later
}
@ -331,7 +331,7 @@ int FWadCollection::AddExternalFile(const char *filename)
// [RH] Removed reload hack
//==========================================================================
void FWadCollection::AddFile (const char *filename, FileReader *wadr, bool quiet, LumpFilterInfo* filter)
void FileSystem::AddFile (const char *filename, FileReader *wadr, bool quiet, LumpFilterInfo* filter)
{
int startlump;
bool isdir = false;
@ -385,7 +385,7 @@ void FWadCollection::AddFile (const char *filename, FileReader *wadr, bool quiet
for (uint32_t i=0; i < resfile->LumpCount(); i++)
{
FResourceLump *lump = resfile->GetLump(i);
FWadCollection::LumpRecord *lump_p = &LumpInfo[LumpInfo.Reserve(1)];
FileSystem::LumpRecord *lump_p = &LumpInfo[LumpInfo.Reserve(1)];
lump_p->SetFromLump(Files.Size(), lump);
}
@ -462,7 +462,7 @@ void FWadCollection::AddFile (const char *filename, FileReader *wadr, bool quiet
//
//==========================================================================
int FWadCollection::CheckIfWadLoaded (const char *name)
int FileSystem::CheckIfWadLoaded (const char *name)
{
unsigned int i;
@ -498,7 +498,7 @@ int FWadCollection::CheckIfWadLoaded (const char *name)
DEFINE_ACTION_FUNCTION(_Wads, GetNumLumps)
{
PARAM_PROLOGUE;
ACTION_RETURN_INT(Wads.GetNumLumps());
ACTION_RETURN_INT(fileSystem.GetNumLumps());
}
//==========================================================================
@ -512,7 +512,7 @@ DEFINE_ACTION_FUNCTION(_Wads, GetNumLumps)
// and namespace parameter
//==========================================================================
int FWadCollection::CheckNumForName (const char *name, int space)
int FileSystem::CheckNumForName (const char *name, int space)
{
union
{
@ -557,7 +557,7 @@ int FWadCollection::CheckNumForName (const char *name, int space)
return i != NULL_INDEX ? i : -1;
}
int FWadCollection::CheckNumForName (const char *name, int space, int wadnum, bool exact)
int FileSystem::CheckNumForName (const char *name, int space, int wadnum, bool exact)
{
union
{
@ -594,7 +594,7 @@ DEFINE_ACTION_FUNCTION(_Wads, CheckNumForName)
PARAM_INT(ns);
PARAM_INT(wadnum);
PARAM_BOOL(exact);
ACTION_RETURN_INT(Wads.CheckNumForName(name, ns, wadnum, exact));
ACTION_RETURN_INT(fileSystem.CheckNumForName(name, ns, wadnum, exact));
}
//==========================================================================
//
@ -604,7 +604,7 @@ DEFINE_ACTION_FUNCTION(_Wads, CheckNumForName)
//
//==========================================================================
int FWadCollection::GetNumForName (const char *name, int space)
int FileSystem::GetNumForName (const char *name, int space)
{
int i;
@ -627,7 +627,7 @@ int FWadCollection::GetNumForName (const char *name, int space)
//
//==========================================================================
int FWadCollection::CheckNumForFullName (const char *name, bool trynormal, int namespc, bool ignoreext)
int FileSystem::CheckNumForFullName (const char *name, bool trynormal, int namespc, bool ignoreext)
{
uint32_t i;
@ -663,10 +663,10 @@ DEFINE_ACTION_FUNCTION(_Wads, CheckNumForFullName)
{
PARAM_PROLOGUE;
PARAM_STRING(name);
ACTION_RETURN_INT(Wads.CheckNumForFullName(name));
ACTION_RETURN_INT(fileSystem.CheckNumForFullName(name));
}
int FWadCollection::CheckNumForFullName (const char *name, int wadnum)
int FileSystem::CheckNumForFullName (const char *name, int wadnum)
{
uint32_t i;
@ -694,7 +694,7 @@ int FWadCollection::CheckNumForFullName (const char *name, int wadnum)
//
//==========================================================================
int FWadCollection::GetNumForFullName (const char *name)
int FileSystem::GetNumForFullName (const char *name)
{
int i;
@ -712,7 +712,7 @@ int FWadCollection::GetNumForFullName (const char *name)
//
//==========================================================================
void FWadCollection::SetLinkedTexture(int lump, FTexture *tex)
void FileSystem::SetLinkedTexture(int lump, FTexture *tex)
{
if ((size_t)lump < NumLumps)
{
@ -726,7 +726,7 @@ void FWadCollection::SetLinkedTexture(int lump, FTexture *tex)
//
//==========================================================================
FTexture *FWadCollection::GetLinkedTexture(int lump)
FTexture *FileSystem::GetLinkedTexture(int lump)
{
if ((size_t)lump < NumLumps)
{
@ -743,7 +743,7 @@ FTexture *FWadCollection::GetLinkedTexture(int lump)
//
//==========================================================================
int FWadCollection::LumpLength (int lump) const
int FileSystem::LumpLength (int lump) const
{
if ((size_t)lump >= NumLumps)
{
@ -762,7 +762,7 @@ int FWadCollection::LumpLength (int lump) const
//
//==========================================================================
int FWadCollection::GetLumpOffset (int lump)
int FileSystem::GetLumpOffset (int lump)
{
if ((size_t)lump >= NumLumps)
{
@ -778,7 +778,7 @@ int FWadCollection::GetLumpOffset (int lump)
//
//==========================================================================
int FWadCollection::GetLumpFlags (int lump)
int FileSystem::GetLumpFlags (int lump)
{
if ((size_t)lump >= NumLumps)
{
@ -800,7 +800,7 @@ int FWadCollection::GetLumpFlags (int lump)
//
//==========================================================================
uint32_t FWadCollection::LumpNameHash (const char *s)
uint32_t FileSystem::LumpNameHash (const char *s)
{
const uint32_t *table = GetCRCTable ();;
uint32_t hash = 0xffffffff;
@ -822,7 +822,7 @@ uint32_t FWadCollection::LumpNameHash (const char *s)
//
//==========================================================================
void FWadCollection::InitHashChains (void)
void FileSystem::InitHashChains (void)
{
unsigned int i, j;
@ -872,7 +872,7 @@ void FWadCollection::InitHashChains (void)
//
//==========================================================================
void FWadCollection::RenameSprites (const TArray<FString> &deletelumps)
void FileSystem::RenameSprites (const TArray<FString> &deletelumps)
{
bool renameAll;
bool MNTRZfound = false;
@ -1037,7 +1037,7 @@ void FWadCollection::RenameSprites (const TArray<FString> &deletelumps)
// MD5 checksum for Unity version of NERVE.WAD: 4214c47651b63ee2257b1c2490a518c9 (3,821,966)
//
//==========================================================================
void FWadCollection::RenameNerve ()
void FileSystem::RenameNerve ()
{
if (gameinfo.gametype != GAME_Doom)
return;
@ -1114,7 +1114,7 @@ void FWadCollection::RenameNerve ()
//
//==========================================================================
void FWadCollection::FixMacHexen()
void FileSystem::FixMacHexen()
{
if (GAME_Hexen != gameinfo.gametype)
{
@ -1199,7 +1199,7 @@ void FWadCollection::FixMacHexen()
static FResourceLump placeholderLump;
void FWadCollection::MoveLumpsInFolder(const char *path)
void FileSystem::MoveLumpsInFolder(const char *path)
{
auto len = strlen(path);
auto wadnum = LumpInfo.Last().wadnum;
@ -1229,7 +1229,7 @@ void FWadCollection::MoveLumpsInFolder(const char *path)
//
//==========================================================================
int FWadCollection::FindLump (const char *name, int *lastlump, bool anyns)
int FileSystem::FindLump (const char *name, int *lastlump, bool anyns)
{
union
{
@ -1263,8 +1263,8 @@ DEFINE_ACTION_FUNCTION(_Wads, FindLump)
PARAM_STRING(name);
PARAM_INT(startlump);
PARAM_INT(ns);
const bool isLumpValid = startlump >= 0 && startlump < Wads.GetNumLumps();
ACTION_RETURN_INT(isLumpValid ? Wads.FindLump(name, &startlump, 0 != ns) : -1);
const bool isLumpValid = startlump >= 0 && startlump < fileSystem.GetNumLumps();
ACTION_RETURN_INT(isLumpValid ? fileSystem.FindLump(name, &startlump, 0 != ns) : -1);
}
//==========================================================================
@ -1276,7 +1276,7 @@ DEFINE_ACTION_FUNCTION(_Wads, FindLump)
//
//==========================================================================
int FWadCollection::FindLumpMulti (const char **names, int *lastlump, bool anyns, int *nameindex)
int FileSystem::FindLumpMulti (const char **names, int *lastlump, bool anyns, int *nameindex)
{
LumpRecord *lump_p;
@ -1311,7 +1311,7 @@ int FWadCollection::FindLumpMulti (const char **names, int *lastlump, bool anyns
//
//==========================================================================
bool FWadCollection::CheckLumpName (int lump, const char *name)
bool FileSystem::CheckLumpName (int lump, const char *name)
{
if ((size_t)lump >= NumLumps)
return false;
@ -1325,7 +1325,7 @@ bool FWadCollection::CheckLumpName (int lump, const char *name)
//
//==========================================================================
void FWadCollection::GetLumpName (char *to, int lump) const
void FileSystem::GetLumpName (char *to, int lump) const
{
if ((size_t)lump >= NumLumps)
*to = 0;
@ -1333,7 +1333,7 @@ void FWadCollection::GetLumpName (char *to, int lump) const
uppercopy (to, LumpInfo[lump].shortName.String);
}
const char* FWadCollection::GetLumpName(int lump) const
const char* FileSystem::GetLumpName(int lump) const
{
if ((size_t)lump >= NumLumps)
return nullptr;
@ -1341,7 +1341,7 @@ const char* FWadCollection::GetLumpName(int lump) const
return LumpInfo[lump].shortName.String;
}
void FWadCollection::GetLumpName(FString &to, int lump) const
void FileSystem::GetLumpName(FString &to, int lump) const
{
if ((size_t)lump >= NumLumps)
to = FString();
@ -1356,19 +1356,19 @@ DEFINE_ACTION_FUNCTION(_Wads, GetLumpName)
PARAM_PROLOGUE;
PARAM_INT(lump);
FString lumpname;
Wads.GetLumpName(lumpname, lump);
fileSystem.GetLumpName(lumpname, lump);
ACTION_RETURN_STRING(lumpname);
}
//==========================================================================
//
// FWadCollection :: GetLumpFullName
// FileSystem :: GetLumpFullName
//
// Returns the lump's full name if it has one or its short name if not.
//
//==========================================================================
const char *FWadCollection::GetLumpFullName (int lump, bool returnshort) const
const char *FileSystem::GetLumpFullName (int lump, bool returnshort) const
{
if ((size_t)lump >= NumLumps)
return NULL;
@ -1383,18 +1383,18 @@ DEFINE_ACTION_FUNCTION(_Wads, GetLumpFullName)
{
PARAM_PROLOGUE;
PARAM_INT(lump);
ACTION_RETURN_STRING(Wads.GetLumpFullName(lump));
ACTION_RETURN_STRING(fileSystem.GetLumpFullName(lump));
}
//==========================================================================
//
// FWadCollection :: GetLumpFullPath
// FileSystem :: GetLumpFullPath
//
// Returns the name of the lump's wad prefixed to the lump's full name.
//
//==========================================================================
FString FWadCollection::GetLumpFullPath(int lump) const
FString FileSystem::GetLumpFullPath(int lump) const
{
FString foo;
@ -1411,7 +1411,7 @@ FString FWadCollection::GetLumpFullPath(int lump) const
//
//==========================================================================
int FWadCollection::GetLumpNamespace (int lump) const
int FileSystem::GetLumpNamespace (int lump) const
{
if ((size_t)lump >= NumLumps)
return ns_global;
@ -1423,12 +1423,12 @@ DEFINE_ACTION_FUNCTION(_Wads, GetLumpNamespace)
{
PARAM_PROLOGUE;
PARAM_INT(lump);
ACTION_RETURN_INT(Wads.GetLumpNamespace(lump));
ACTION_RETURN_INT(fileSystem.GetLumpNamespace(lump));
}
//==========================================================================
//
// FWadCollection :: GetLumpIndexNum
// FileSystem :: GetLumpIndexNum
//
// Returns the index number for this lump. This is *not* the lump's position
// in the lump directory, but rather a special value that RFF can associate
@ -1436,7 +1436,7 @@ DEFINE_ACTION_FUNCTION(_Wads, GetLumpNamespace)
//
//==========================================================================
int FWadCollection::GetLumpIndexNum(int lump) const
int FileSystem::GetLumpIndexNum(int lump) const
{
if ((size_t)lump >= NumLumps)
return 0;
@ -1450,7 +1450,7 @@ int FWadCollection::GetLumpIndexNum(int lump) const
//
//==========================================================================
int FWadCollection::GetLumpFile (int lump) const
int FileSystem::GetLumpFile (int lump) const
{
if ((size_t)lump >= LumpInfo.Size())
return -1;
@ -1463,7 +1463,7 @@ int FWadCollection::GetLumpFile (int lump) const
//
//==========================================================================
FResourceLump *FWadCollection::GetLumpRecord(int lump) const
FResourceLump *FileSystem::GetLumpRecord(int lump) const
{
if ((size_t)lump >= LumpInfo.Size())
return nullptr;
@ -1487,7 +1487,7 @@ static int folderentrycmp(const void *a, const void *b)
return strcmp(A->name, B->name);
}
unsigned FWadCollection::GetLumpsInFolder(const char *inpath, TArray<FolderEntry> &result, bool atomic) const
unsigned FileSystem::GetLumpsInFolder(const char *inpath, TArray<FolderEntry> &result, bool atomic) const
{
FString path = inpath;
FixPathSeperator(path);
@ -1499,7 +1499,7 @@ unsigned FWadCollection::GetLumpsInFolder(const char *inpath, TArray<FolderEntry
if (LumpInfo[i].longName.IndexOf(path) == 0)
{
// Only if it hasn't been replaced.
if ((unsigned)Wads.CheckNumForFullName(LumpInfo[i].longName) == i)
if ((unsigned)fileSystem.CheckNumForFullName(LumpInfo[i].longName) == i)
{
result.Push({ LumpInfo[i].longName.GetChars(), i });
}
@ -1513,13 +1513,13 @@ unsigned FWadCollection::GetLumpsInFolder(const char *inpath, TArray<FolderEntry
// Find the highest resource file having content in the given folder.
for (auto & entry : result)
{
int thisfile = Wads.GetLumpFile(entry.lumpnum);
int thisfile = fileSystem.GetLumpFile(entry.lumpnum);
if (thisfile > maxfile) maxfile = thisfile;
}
// Delete everything from older files.
for (int i = result.Size() - 1; i >= 0; i--)
{
if (Wads.GetLumpFile(result[i].lumpnum) != maxfile) result.Delete(i);
if (fileSystem.GetLumpFile(result[i].lumpnum) != maxfile) result.Delete(i);
}
}
qsort(result.Data(), result.Size(), sizeof(FolderEntry), folderentrycmp);
@ -1535,7 +1535,7 @@ unsigned FWadCollection::GetLumpsInFolder(const char *inpath, TArray<FolderEntry
//
//==========================================================================
void FWadCollection::ReadLump (int lump, void *dest)
void FileSystem::ReadLump (int lump, void *dest)
{
auto lumpr = OpenLumpReader (lump);
auto size = lumpr.GetLength ();
@ -1556,7 +1556,7 @@ void FWadCollection::ReadLump (int lump, void *dest)
//
//==========================================================================
TArray<uint8_t> FWadCollection::ReadLumpIntoArray(int lump, int pad)
TArray<uint8_t> FileSystem::ReadLumpIntoArray(int lump, int pad)
{
auto lumpr = OpenLumpReader(lump);
auto size = lumpr.GetLength();
@ -1580,7 +1580,7 @@ TArray<uint8_t> FWadCollection::ReadLumpIntoArray(int lump, int pad)
//
//==========================================================================
FMemLump FWadCollection::ReadLump (int lump)
FMemLump FileSystem::ReadLump (int lump)
{
return FMemLump(FString(ELumpNum(lump)));
}
@ -1589,8 +1589,8 @@ DEFINE_ACTION_FUNCTION(_Wads, ReadLump)
{
PARAM_PROLOGUE;
PARAM_INT(lump);
const bool isLumpValid = lump >= 0 && lump < Wads.GetNumLumps();
ACTION_RETURN_STRING(isLumpValid ? Wads.ReadLump(lump).GetString() : FString());
const bool isLumpValid = lump >= 0 && lump < fileSystem.GetNumLumps();
ACTION_RETURN_STRING(isLumpValid ? fileSystem.ReadLump(lump).GetString() : FString());
}
//==========================================================================
@ -1602,7 +1602,7 @@ DEFINE_ACTION_FUNCTION(_Wads, ReadLump)
//==========================================================================
FileReader FWadCollection::OpenLumpReader(int lump)
FileReader FileSystem::OpenLumpReader(int lump)
{
if ((unsigned)lump >= (unsigned)LumpInfo.Size())
{
@ -1621,7 +1621,7 @@ FileReader FWadCollection::OpenLumpReader(int lump)
return rl->NewReader(); // This always gets a reader to the cache
}
FileReader FWadCollection::ReopenLumpReader(int lump, bool alwayscache)
FileReader FileSystem::ReopenLumpReader(int lump, bool alwayscache)
{
if ((unsigned)lump >= (unsigned)LumpInfo.Size())
{
@ -1633,8 +1633,8 @@ FileReader FWadCollection::ReopenLumpReader(int lump, bool alwayscache)
if (rl->RefCount == 0 && rd != nullptr && !rd->GetBuffer() && !alwayscache && !(rl->Flags & LUMPF_COMPRESSED))
{
int fileno = Wads.GetLumpFile(lump);
const char *filename = Wads.GetWadFullName(fileno);
int fileno = fileSystem.GetLumpFile(lump);
const char *filename = fileSystem.GetWadFullName(fileno);
FileReader fr;
if (fr.OpenFile(filename, rl->GetFileOffset(), rl->LumpSize))
{
@ -1653,7 +1653,7 @@ FileReader FWadCollection::ReopenLumpReader(int lump, bool alwayscache)
//
//==========================================================================
FileReader *FWadCollection::GetFileReader(int wadnum)
FileReader *FileSystem::GetFileReader(int wadnum)
{
if ((uint32_t)wadnum >= Files.Size())
{
@ -1671,7 +1671,7 @@ FileReader *FWadCollection::GetFileReader(int wadnum)
//
//==========================================================================
const char *FWadCollection::GetWadName (int wadnum) const
const char *FileSystem::GetWadName (int wadnum) const
{
const char *name, *slash;
@ -1690,7 +1690,7 @@ const char *FWadCollection::GetWadName (int wadnum) const
//
//==========================================================================
int FWadCollection::GetFirstLump (int wadnum) const
int FileSystem::GetFirstLump (int wadnum) const
{
if ((uint32_t)wadnum >= Files.Size())
{
@ -1705,7 +1705,7 @@ int FWadCollection::GetFirstLump (int wadnum) const
//
//==========================================================================
int FWadCollection::GetLastLump (int wadnum) const
int FileSystem::GetLastLump (int wadnum) const
{
if ((uint32_t)wadnum >= Files.Size())
{
@ -1720,7 +1720,7 @@ int FWadCollection::GetLastLump (int wadnum) const
//
//==========================================================================
int FWadCollection::GetLumpCount (int wadnum) const
int FileSystem::GetLumpCount (int wadnum) const
{
if ((uint32_t)wadnum >= Files.Size())
{
@ -1739,7 +1739,7 @@ int FWadCollection::GetLumpCount (int wadnum) const
//
//==========================================================================
const char *FWadCollection::GetWadFullName (int wadnum) const
const char *FileSystem::GetWadFullName (int wadnum) const
{
if ((unsigned int)wadnum >= Files.Size())
{
@ -1778,7 +1778,7 @@ FMemLump::~FMemLump ()
FString::FString (ELumpNum lumpnum)
{
auto lumpr = Wads.OpenLumpReader ((int)lumpnum);
auto lumpr = fileSystem.OpenLumpReader ((int)lumpnum);
auto size = lumpr.GetLength ();
AllocBuffer (1 + size);
auto numread = lumpr.Read (&Chars[0], size);
@ -1787,7 +1787,7 @@ FString::FString (ELumpNum lumpnum)
if (numread != size)
{
I_Error ("ConstructStringFromLump: Only read %ld of %ld bytes on lump %i (%s)\n",
numread, size, lumpnum, Wads.GetLumpFullName((int)lumpnum));
numread, size, lumpnum, fileSystem.GetLumpFullName((int)lumpnum));
}
}
@ -1850,7 +1850,7 @@ CCMD(lumpnum)
{
for (int i = 1; i < argv.argc(); ++i)
{
Printf("%s: %d\n", argv[i], Wads.CheckNumForName(argv[i]));
Printf("%s: %d\n", argv[i], fileSystem.CheckNumForName(argv[i]));
}
}
@ -1864,7 +1864,7 @@ CCMD(lumpnumfull)
{
for (int i = 1; i < argv.argc(); ++i)
{
Printf("%s: %d\n", argv[i], Wads.CheckNumForFullName(argv[i]));
Printf("%s: %d\n", argv[i], fileSystem.CheckNumForFullName(argv[i]));
}
}
#endif

View file

@ -59,7 +59,7 @@ private:
FString Block;
friend class FWadCollection;
friend class FileSystem;
};
struct FolderEntry
@ -68,11 +68,11 @@ struct FolderEntry
unsigned lumpnum;
};
class FWadCollection
class FileSystem
{
public:
FWadCollection ();
~FWadCollection ();
FileSystem ();
~FileSystem ();
// The wadnum for the IWAD
int GetIwadNum() { return IwadIndex; }
@ -194,6 +194,6 @@ private:
FileReader * GetFileReader(int wadnum); // Gets a FileReader object to the entire WAD
};
extern FWadCollection Wads;
extern FileSystem fileSystem;
#endif

View file

@ -314,7 +314,7 @@ void FParseContext::ParseLump(const char *lumpname)
const char *SavedSourceFile = SourceFile;
FParseToken token;
int lumpno = Wads.CheckNumForFullName(lumpname, true);
int lumpno = fileSystem.CheckNumForFullName(lumpname, true);
if (lumpno == -1)
{
@ -323,7 +323,7 @@ void FParseContext::ParseLump(const char *lumpname)
}
// Read the lump into a buffer and add a 0-terminator
auto lumpdata = Wads.ReadLumpIntoArray(lumpno, 1);
auto lumpdata = fileSystem.ReadLumpIntoArray(lumpno, 1);
SourceLine = 0;
SourceFile = lumpname;

View file

@ -301,13 +301,13 @@ bool FIntermissionActionTextscreen::ParseKey(FScanner &sc)
{
sc.MustGetToken('=');
sc.MustGetToken(TK_StringConst);
int lump = Wads.CheckNumForFullName(sc.String, true);
int lump = fileSystem.CheckNumForFullName(sc.String, true);
bool done = false;
if (lump > 0)
{
// Check if this comes from either Hexen.wad or Hexdd.wad and if so, map to the string table.
int fileno = Wads.GetLumpFile(lump);
auto fn = Wads.GetWadName(fileno);
int fileno = fileSystem.GetLumpFile(lump);
auto fn = fileSystem.GetWadName(fileno);
if (fn && (!stricmp(fn, "HEXEN.WAD") || !stricmp(fn, "HEXDD.WAD")))
{
FStringf key("TXT_%.5s_%s", fn, sc.String);
@ -318,12 +318,12 @@ bool FIntermissionActionTextscreen::ParseKey(FScanner &sc)
}
}
if (!done)
mText = Wads.ReadLump(lump).GetString();
mText = fileSystem.ReadLump(lump).GetString();
}
else
{
// only print an error if coming from a PWAD
if (Wads.GetLumpFile(sc.LumpNum) > Wads.GetMaxIwadNum())
if (fileSystem.GetLumpFile(sc.LumpNum) > fileSystem.GetMaxIwadNum())
sc.ScriptMessage("Unknown text lump '%s'", sc.String);
mText.Format("Unknown text lump '%s'", sc.String);
}
@ -859,10 +859,10 @@ void F_StartFinale (const char *music, int musicorder, int cdtrack, unsigned int
FIntermissionActionTextscreen *textscreen = new FIntermissionActionTextscreen;
if (textInLump)
{
int lump = Wads.CheckNumForFullName(text, true);
int lump = fileSystem.CheckNumForFullName(text, true);
if (lump > 0)
{
textscreen->mText = Wads.ReadLump(lump).GetString();
textscreen->mText = fileSystem.ReadLump(lump).GetString();
}
else
{

View file

@ -207,7 +207,7 @@ void ParseCompatibility()
// The contents of this file are not cumulative, as it should not
// be present in user-distributed maps.
FScanner sc(Wads.GetNumForFullName("compatibility.txt"));
FScanner sc(fileSystem.GetNumForFullName("compatibility.txt"));
while (sc.GetString()) // Get MD5 signature
{
@ -291,7 +291,7 @@ FName MapLoader::CheckCompatibility(MapData *map)
// When playing Doom IWAD levels force COMPAT_SHORTTEX and COMPATF_LIGHT.
// I'm not sure if the IWAD maps actually need COMPATF_LIGHT but it certainly does not hurt.
// TNT's MAP31 also needs COMPATF_STAIRINDEX but that only gets activated for TNT.WAD.
if (Wads.GetLumpFile(map->lumpnum) == Wads.GetIwadNum() && (gameinfo.flags & GI_COMPATSHORTTEX) && Level->maptype == MAPTYPE_DOOM)
if (fileSystem.GetLumpFile(map->lumpnum) == fileSystem.GetIwadNum() && (gameinfo.flags & GI_COMPATSHORTTEX) && Level->maptype == MAPTYPE_DOOM)
{
Level->ii_compatflags = COMPATF_SHORTTEX|COMPATF_LIGHT;
if (gameinfo.flags & GI_COMPATSTAIRS) Level->ii_compatflags |= COMPATF_STAIRINDEX;

View file

@ -520,7 +520,7 @@ void MapLoader::InitED()
FScanner sc;
if (filename.IsEmpty()) return;
int lump = Wads.CheckNumForFullName(filename, true, ns_global);
int lump = fileSystem.CheckNumForFullName(filename, true, ns_global);
if (lump == -1) return;
sc.OpenLumpNum(lump);
@ -659,7 +659,7 @@ void MapLoader::LoadMapinfoACSLump()
{
if (Level->info->acsName.IsNotEmpty())
{
int lump = Wads.CheckNumForName(Level->info->acsName);
int lump = fileSystem.CheckNumForName(Level->info->acsName);
if (lump >= 0) Level->Behaviors.LoadModule(lump);
}
}

View file

@ -729,31 +729,31 @@ static bool MatchHeader(const char * label, const char * hdata)
static int FindGLNodesInWAD(int labellump)
{
int wadfile = Wads.GetLumpFile(labellump);
int wadfile = fileSystem.GetLumpFile(labellump);
FString glheader;
glheader.Format("GL_%s", Wads.GetLumpFullName(labellump));
glheader.Format("GL_%s", fileSystem.GetLumpFullName(labellump));
if (glheader.Len()<=8)
{
int gllabel = Wads.CheckNumForName(glheader, ns_global, wadfile);
int gllabel = fileSystem.CheckNumForName(glheader, ns_global, wadfile);
if (gllabel >= 0) return gllabel;
}
else
{
// Before scanning the entire WAD directory let's check first whether
// it is necessary.
int gllabel = Wads.CheckNumForName("GL_LEVEL", ns_global, wadfile);
int gllabel = fileSystem.CheckNumForName("GL_LEVEL", ns_global, wadfile);
if (gllabel >= 0)
{
int lastlump=0;
int lump;
while ((lump=Wads.FindLump("GL_LEVEL", &lastlump))>=0)
while ((lump=fileSystem.FindLump("GL_LEVEL", &lastlump))>=0)
{
if (Wads.GetLumpFile(lump)==wadfile)
if (fileSystem.GetLumpFile(lump)==wadfile)
{
FMemLump mem = Wads.ReadLump(lump);
if (MatchHeader(Wads.GetLumpFullName(labellump), (const char *)mem.GetMem())) return lump;
FMemLump mem = fileSystem.ReadLump(lump);
if (MatchHeader(fileSystem.GetLumpFullName(labellump), (const char *)mem.GetMem())) return lump;
}
}
}
@ -854,11 +854,11 @@ bool MapLoader::LoadGLNodes(MapData * map)
FileReader gwalumps[4];
char path[256];
int li;
int lumpfile = Wads.GetLumpFile(map->lumpnum);
int lumpfile = fileSystem.GetLumpFile(map->lumpnum);
bool mapinwad = map->InWad;
FResourceFile * f_gwa = map->resource;
const char * name = Wads.GetWadFullName(lumpfile);
const char * name = fileSystem.GetWadFullName(lumpfile);
if (mapinwad)
{
@ -869,7 +869,7 @@ bool MapLoader::LoadGLNodes(MapData * map)
// GL nodes are loaded with a WAD
for(int i=0;i<4;i++)
{
gwalumps[i]=Wads.ReopenLumpReader(li+i+1);
gwalumps[i]=fileSystem.ReopenLumpReader(li+i+1);
}
return DoLoadGLNodes(gwalumps);
}
@ -886,7 +886,7 @@ bool MapLoader::LoadGLNodes(MapData * map)
f_gwa = FResourceFile::OpenResourceFile(path, true);
if (f_gwa==nullptr) return false;
strncpy(map->MapLumps[0].Name, Wads.GetLumpFullName(map->lumpnum), 8);
strncpy(map->MapLumps[0].Name, fileSystem.GetLumpFullName(map->lumpnum), 8);
}
}
}
@ -1000,7 +1000,7 @@ typedef TArray<uint8_t> MemFile;
static FString CreateCacheName(MapData *map, bool create)
{
FString path = M_GetCachePath(create);
FString lumpname = Wads.GetLumpFullPath(map->lumpnum);
FString lumpname = fileSystem.GetLumpFullPath(map->lumpnum);
int separator = lumpname.IndexOf(':');
path << '/' << lumpname.Left(separator);
if (create) CreatePath(path);

View file

@ -2034,7 +2034,7 @@ void MapLoader::LoopSidedefs (bool firstloop)
int MapLoader::DetermineTranslucency (int lumpnum)
{
auto tranmap = Wads.OpenLumpReader (lumpnum);
auto tranmap = fileSystem.OpenLumpReader (lumpnum);
uint8_t index;
PalEntry newcolor;
PalEntry newcolor2;
@ -2054,7 +2054,7 @@ int MapLoader::DetermineTranslucency (int lumpnum)
{
char lumpname[9];
lumpname[8] = 0;
Wads.GetLumpName (lumpname, lumpnum);
fileSystem.GetLumpName (lumpname, lumpnum);
Printf ("%s appears to be additive translucency %d (%d%%)\n", lumpname, newcolor.r,
newcolor.r*100/255);
}
@ -2065,7 +2065,7 @@ int MapLoader::DetermineTranslucency (int lumpnum)
{
char lumpname[9];
lumpname[8] = 0;
Wads.GetLumpName (lumpname, lumpnum);
fileSystem.GetLumpName (lumpname, lumpnum);
Printf ("%s appears to be translucency %d (%d%%)\n", lumpname, newcolor.r,
newcolor.r*100/255);
}
@ -2150,8 +2150,8 @@ void MapLoader::ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec
// The translator set the alpha argument already; no reason to do it again.
sd->SetTexture(side_t::mid, FNullTextureID());
}
else if ((lumpnum = Wads.CheckNumForName (msd->midtexture)) > 0 &&
Wads.LumpLength (lumpnum) == 65536)
else if ((lumpnum = fileSystem.CheckNumForName (msd->midtexture)) > 0 &&
fileSystem.LumpLength (lumpnum) == 65536)
{
*alpha = (short)DetermineTranslucency (lumpnum);
sd->SetTexture(side_t::mid, FNullTextureID());

View file

@ -139,9 +139,9 @@ void MapLoader::LoadStrifeConversations (MapData *map, const char *mapname)
bool MapLoader::LoadScriptFile (const char *name, bool include, int type)
{
int lumpnum = Wads.CheckNumForName (name);
int lumpnum = fileSystem.CheckNumForName (name);
const bool found = lumpnum >= 0
|| (lumpnum = Wads.CheckNumForFullName (name)) >= 0;
|| (lumpnum = fileSystem.CheckNumForFullName (name)) >= 0;
if (!found)
{
@ -152,13 +152,13 @@ bool MapLoader::LoadScriptFile (const char *name, bool include, int type)
return false;
}
FileReader lump = Wads.ReopenLumpReader (lumpnum);
FileReader lump = fileSystem.ReopenLumpReader (lumpnum);
auto fn = Wads.GetLumpFile(lumpnum);
auto wadname = Wads.GetWadName(fn);
auto fn = fileSystem.GetLumpFile(lumpnum);
auto wadname = fileSystem.GetWadName(fn);
if (stricmp(wadname, "STRIFE0.WAD") && stricmp(wadname, "STRIFE1.WAD") && stricmp(wadname, "SVE.WAD")) name = nullptr; // Only localize IWAD content.
bool res = LoadScriptFile(name, lumpnum, lump, Wads.LumpLength(lumpnum), include, type);
bool res = LoadScriptFile(name, lumpnum, lump, fileSystem.LumpLength(lumpnum), include, type);
return res;
}
@ -177,7 +177,7 @@ bool MapLoader::LoadScriptFile(const char *name, int lumpnum, FileReader &lump,
if ((type == 1 && !isbinary) || (type == 2 && isbinary))
{
DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", Wads.GetLumpFullName(lumpnum));
DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", fileSystem.GetLumpFullName(lumpnum));
return false;
}
@ -197,7 +197,7 @@ bool MapLoader::LoadScriptFile(const char *name, int lumpnum, FileReader &lump,
// is exactly 1516 bytes long.
if (numnodes % 1516 != 0)
{
DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", Wads.GetLumpFullName(lumpnum));
DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", fileSystem.GetLumpFullName(lumpnum));
return false;
}
numnodes /= 1516;
@ -207,7 +207,7 @@ bool MapLoader::LoadScriptFile(const char *name, int lumpnum, FileReader &lump,
// And the teaser version has 1488-byte entries.
if (numnodes % 1488 != 0)
{
DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", Wads.GetLumpFullName(lumpnum));
DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", fileSystem.GetLumpFullName(lumpnum));
return false;
}
numnodes /= 1488;

View file

@ -2161,7 +2161,7 @@ public:
isExtended = false;
floordrop = false;
sc.OpenMem(Wads.GetLumpFullName(map->lumpnum), map->Read(ML_TEXTMAP));
sc.OpenMem(fileSystem.GetLumpFullName(map->lumpnum), map->Read(ML_TEXTMAP));
sc.SetCMode(true);
if (sc.CheckString("namespace"))
{

View file

@ -563,7 +563,7 @@ public:
bool Parse(MapLoader *loader,int lumpnum, FileReader &lump, int lumplen)
{
Level = loader->Level;
sc.OpenMem(Wads.GetLumpFullName(lumpnum), lump.Read(lumplen));
sc.OpenMem(fileSystem.GetLumpFullName(lumpnum), lump.Read(lumplen));
sc.SetCMode(true);
// Namespace must be the first field because everything else depends on it.
if (sc.CheckString("namespace"))

View file

@ -204,7 +204,7 @@ void FSavegameManager::ReadSaveStrings()
// old, incompatible savegame. List as not usable.
oldVer = true;
}
else if (iwad.CompareNoCase(Wads.GetWadName(Wads.GetIwadNum())) == 0)
else if (iwad.CompareNoCase(fileSystem.GetWadName(fileSystem.GetIwadNum())) == 0)
{
missing = !G_CheckSaveGameWads(arc, false);
}

View file

@ -649,7 +649,7 @@ static void ParseListMenu(FScanner &sc)
desc->mWLeft = 0;
desc->mWRight = 0;
desc->mCenter = false;
desc->mFromEngine = Wads.GetLumpFile(sc.LumpNum) == 0; // flags menu if the definition is from the IWAD.
desc->mFromEngine = fileSystem.GetLumpFile(sc.LumpNum) == 0; // flags menu if the definition is from the IWAD.
ParseListMenuBody(sc, desc);
ReplaceMenu(sc, desc);
@ -1010,9 +1010,9 @@ void M_ParseMenuDefs()
DefaultListMenuSettings->Reset();
DefaultOptionMenuSettings->Reset();
int IWADMenu = Wads.CheckNumForName("MENUDEF", ns_global, Wads.GetIwadNum());
int IWADMenu = fileSystem.CheckNumForName("MENUDEF", ns_global, fileSystem.GetIwadNum());
while ((lump = Wads.FindLump ("MENUDEF", &lastlump)) != -1)
while ((lump = fileSystem.FindLump ("MENUDEF", &lastlump)) != -1)
{
FScanner sc(lump);
@ -1376,7 +1376,7 @@ static void InitCrosshairsList()
pair->Value = 0;
pair->Text = "None";
while ((lump = Wads.FindLump("XHAIRS", &lastlump)) != -1)
while ((lump = fileSystem.FindLump("XHAIRS", &lastlump)) != -1)
{
FScanner sc(lump);
while (sc.GetNumber())

View file

@ -134,16 +134,16 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck)
// Check for both *.wad and *.map in order to load Build maps
// as well. The higher one will take precedence.
// Names with more than 8 characters will only be checked as .wad and .map.
if (strlen(mapname) <= 8) lump_name = Wads.CheckNumForName(mapname);
if (strlen(mapname) <= 8) lump_name = fileSystem.CheckNumForName(mapname);
fmt.Format("maps/%s.wad", mapname);
lump_wad = Wads.CheckNumForFullName(fmt);
lump_wad = fileSystem.CheckNumForFullName(fmt);
fmt.Format("maps/%s.map", mapname);
lump_map = Wads.CheckNumForFullName(fmt);
lump_map = fileSystem.CheckNumForFullName(fmt);
if (lump_name > lump_wad && lump_name > lump_map && lump_name != -1)
{
int lumpfile = Wads.GetLumpFile(lump_name);
int nextfile = Wads.GetLumpFile(lump_name+1);
int lumpfile = fileSystem.GetLumpFile(lump_name);
int nextfile = fileSystem.GetLumpFile(lump_name+1);
map->lumpnum = lump_name;
@ -151,7 +151,7 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck)
{
// The following lump is from a different file so whatever this is,
// it is not a multi-lump Doom level so let's assume it is a Build map.
map->MapLumps[0].Reader = Wads.ReopenLumpReader(lump_name);
map->MapLumps[0].Reader = fileSystem.ReopenLumpReader(lump_name);
if (!P_IsBuildMap(map))
{
delete map;
@ -162,19 +162,19 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck)
// This case can only happen if the lump is inside a real WAD file.
// As such any special handling for other types of lumps is skipped.
map->MapLumps[0].Reader = Wads.ReopenLumpReader(lump_name);
strncpy(map->MapLumps[0].Name, Wads.GetLumpFullName(lump_name), 8);
map->MapLumps[0].Reader = fileSystem.ReopenLumpReader(lump_name);
strncpy(map->MapLumps[0].Name, fileSystem.GetLumpFullName(lump_name), 8);
map->InWad = true;
int index = 0;
if (stricmp(Wads.GetLumpFullName(lump_name + 1), "TEXTMAP") != 0)
if (stricmp(fileSystem.GetLumpFullName(lump_name + 1), "TEXTMAP") != 0)
{
for(int i = 1;; i++)
{
// Since levels must be stored in WADs they can't really have full
// names and for any valid level lump this always returns the short name.
const char * lumpname = Wads.GetLumpFullName(lump_name + i);
const char * lumpname = fileSystem.GetLumpFullName(lump_name + i);
try
{
index = GetMapIndex(mapname, index, lumpname, !justcheck);
@ -194,17 +194,17 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck)
// The next lump is not part of this map anymore
if (index < 0) break;
map->MapLumps[index].Reader = Wads.ReopenLumpReader(lump_name + i);
map->MapLumps[index].Reader = fileSystem.ReopenLumpReader(lump_name + i);
strncpy(map->MapLumps[index].Name, lumpname, 8);
}
}
else
{
map->isText = true;
map->MapLumps[1].Reader = Wads.ReopenLumpReader(lump_name + 1);
map->MapLumps[1].Reader = fileSystem.ReopenLumpReader(lump_name + 1);
for(int i = 2;; i++)
{
const char * lumpname = Wads.GetLumpFullName(lump_name + i);
const char * lumpname = fileSystem.GetLumpFullName(lump_name + i);
if (lumpname == NULL)
{
@ -237,7 +237,7 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck)
break;
}
else continue;
map->MapLumps[index].Reader = Wads.ReopenLumpReader(lump_name + i);
map->MapLumps[index].Reader = fileSystem.ReopenLumpReader(lump_name + i);
strncpy(map->MapLumps[index].Name, lumpname, 8);
}
}
@ -255,8 +255,8 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck)
return NULL;
}
map->lumpnum = lump_wad;
auto reader = Wads.ReopenLumpReader(lump_wad);
map->resource = FResourceFile::OpenResourceFile(Wads.GetLumpFullName(lump_wad), reader, true);
auto reader = fileSystem.ReopenLumpReader(lump_wad);
map->resource = FResourceFile::OpenResourceFile(fileSystem.GetLumpFullName(lump_wad), reader, true);
wadReader = map->resource->GetReader();
}
}

View file

@ -253,7 +253,7 @@ void InitBotStuff()
{
int lump;
int lastlump = 0;
while (-1 != (lump = Wads.FindLump("BOTSUPP", &lastlump)))
while (-1 != (lump = fileSystem.FindLump("BOTSUPP", &lastlump)))
{
FScanner sc(lump);
sc.SetCMode(true);

View file

@ -355,12 +355,12 @@ static FSoundID T_FindSound(const char * name)
if (gameinfo.gametype & GAME_DoomStrifeChex)
{
mysnprintf(buffer, countof(buffer), "DS%.35s", name);
if (Wads.CheckNumForName(buffer, ns_sounds)<0) strcpy(buffer, name);
if (fileSystem.CheckNumForName(buffer, ns_sounds)<0) strcpy(buffer, name);
}
else
{
strcpy(buffer, name);
if (Wads.CheckNumForName(buffer, ns_sounds)<0) mysnprintf(buffer, countof(buffer), "DS%.35s", name);
if (fileSystem.CheckNumForName(buffer, ns_sounds)<0) mysnprintf(buffer, countof(buffer), "DS%.35s", name);
}
int id = S_AddSound(name, buffer);
@ -2086,14 +2086,14 @@ bool FS_ChangeMusic(const char * string)
{
char buffer[40];
if (Wads.CheckNumForName(string, ns_music)<0 || !S_ChangeMusic(string,true))
if (fileSystem.CheckNumForName(string, ns_music)<0 || !S_ChangeMusic(string,true))
{
// Retry with O_ prepended to the music name, then with D_
mysnprintf(buffer, countof(buffer), "O_%s", string);
if (Wads.CheckNumForName(buffer, ns_music)<0 || !S_ChangeMusic(buffer,true))
if (fileSystem.CheckNumForName(buffer, ns_music)<0 || !S_ChangeMusic(buffer,true))
{
mysnprintf(buffer, countof(buffer), "D_%s", string);
if (Wads.CheckNumForName(buffer, ns_music)<0)
if (fileSystem.CheckNumForName(buffer, ns_music)<0)
{
S_ChangeMusic(NULL, 0);
return false;

View file

@ -221,13 +221,13 @@ bool FScriptLoader::ParseInfo(MapData * map)
if (lumpsize==0)
{
// Try a global FS lump
int lumpnum=Wads.CheckNumForName("FSGLOBAL");
int lumpnum=fileSystem.CheckNumForName("FSGLOBAL");
if (lumpnum<0) return false;
lumpsize=Wads.LumpLength(lumpnum);
lumpsize=fileSystem.LumpLength(lumpnum);
if (lumpsize==0) return false;
fsglobal=true;
lump=new char[lumpsize+3];
Wads.ReadLump(lumpnum,lump);
fileSystem.ReadLump(lumpnum,lump);
}
else
{

View file

@ -411,15 +411,15 @@ void DFsScript::ParseInclude(FLevelLocals *Level, char *lumpname)
int lumpnum;
char *lump;
if((lumpnum = Wads.CheckNumForName(lumpname)) == -1)
if((lumpnum = fileSystem.CheckNumForName(lumpname)) == -1)
{
I_Error("include lump '%s' not found!\n", lumpname);
return;
}
int lumplen=Wads.LumpLength(lumpnum);
int lumplen=fileSystem.LumpLength(lumpnum);
lump=new char[lumplen+10];
Wads.ReadLump(lumpnum,lump);
fileSystem.ReadLump(lumpnum,lump);
lump[lumplen]=0;

View file

@ -1920,12 +1920,12 @@ void FBehaviorContainer::LoadDefaultModules ()
// Scan each LOADACS lump and load the specified modules in order
int lump, lastlump = 0;
while ((lump = Wads.FindLump ("LOADACS", &lastlump)) != -1)
while ((lump = fileSystem.FindLump ("LOADACS", &lastlump)) != -1)
{
FScanner sc(lump);
while (sc.GetString())
{
int acslump = Wads.CheckNumForName (sc.String, ns_acslibrary);
int acslump = fileSystem.CheckNumForName (sc.String, ns_acslibrary);
if (acslump >= 0)
{
LoadModule (acslump);
@ -1958,7 +1958,7 @@ FBehavior *FBehaviorContainer::LoadModule (int lumpnum, FileReader *fr, int len,
else
{
delete behavior;
Printf(TEXTCOLOR_RED "%s: invalid ACS module\n", Wads.GetLumpFullName(lumpnum));
Printf(TEXTCOLOR_RED "%s: invalid ACS module\n", fileSystem.GetLumpFullName(lumpnum));
return NULL;
}
}
@ -2224,7 +2224,7 @@ bool FBehavior::Init(FLevelLocals *Level, int lumpnum, FileReader * fr, int len,
// 2. Corrupt modules won't be reported when a level is being loaded if this function quits before
// adding it to the list.
if (fr == NULL) len = Wads.LumpLength (lumpnum);
if (fr == NULL) len = fileSystem.LumpLength (lumpnum);
@ -2240,7 +2240,7 @@ bool FBehavior::Init(FLevelLocals *Level, int lumpnum, FileReader * fr, int len,
object = new uint8_t[len];
if (fr == NULL)
{
Wads.ReadLump (lumpnum, object);
fileSystem.ReadLump (lumpnum, object);
}
else
{
@ -2272,7 +2272,7 @@ bool FBehavior::Init(FLevelLocals *Level, int lumpnum, FileReader * fr, int len,
if (fr == NULL)
{
Wads.GetLumpName (ModuleName, lumpnum);
fileSystem.GetLumpName (ModuleName, lumpnum);
ModuleName[8] = 0;
}
else
@ -2317,8 +2317,8 @@ bool FBehavior::Init(FLevelLocals *Level, int lumpnum, FileReader * fr, int len,
// If this is an original Hexen BEHAVIOR, set up some localization info for it. Original Hexen BEHAVIORs are always in the old format.
if ((Level->flags2 & LEVEL2_HEXENHACK) && gameinfo.gametype == GAME_Hexen && lumpnum == -1 && reallumpnum > 0)
{
int fileno = Wads.GetLumpFile(reallumpnum);
const char * filename = Wads.GetWadName(fileno);
int fileno = fileSystem.GetLumpFile(reallumpnum);
const char * filename = fileSystem.GetWadName(fileno);
if (!stricmp(filename, "HEXEN.WAD") || !stricmp(filename, "HEXDD.WAD"))
{
ShouldLocalize = true;
@ -2563,7 +2563,7 @@ bool FBehavior::Init(FLevelLocals *Level, int lumpnum, FileReader * fr, int len,
if (parse[i])
{
FBehavior *module = NULL;
int lump = Wads.CheckNumForName (&parse[i], ns_acslibrary);
int lump = fileSystem.CheckNumForName (&parse[i], ns_acslibrary);
if (lump < 0)
{
Printf (TEXTCOLOR_RED "Could not find ACS library %s.\n", &parse[i]);

View file

@ -388,11 +388,11 @@ void player_t::SetLogNumber (int num)
}
mysnprintf (lumpname, countof(lumpname), "LOG%d", num);
lumpnum = Wads.CheckNumForName (lumpname);
lumpnum = fileSystem.CheckNumForName (lumpname);
if (lumpnum != -1)
{
auto fn = Wads.GetLumpFile(lumpnum);
auto wadname = Wads.GetWadName(fn);
auto fn = fileSystem.GetLumpFile(lumpnum);
auto wadname = fileSystem.GetWadName(fn);
if (!stricmp(wadname, "STRIFE0.WAD") || !stricmp(wadname, "STRIFE1.WAD") || !stricmp(wadname, "SVE.WAD"))
{
// If this is an original IWAD text, try looking up its lower priority string version first.
@ -406,7 +406,7 @@ void player_t::SetLogNumber (int num)
}
}
auto lump = Wads.ReadLump(lumpnum);
auto lump = fileSystem.ReadLump(lumpnum);
SetLogText (lump.GetString());
}
}
@ -820,16 +820,16 @@ static int SetupCrouchSprite(AActor *self, int crouchsprite)
FString normspritename = sprites[self->SpawnState->sprite].name;
FString crouchspritename = sprites[crouchsprite].name;
int spritenorm = Wads.CheckNumForName(normspritename + "A1", ns_sprites);
int spritenorm = fileSystem.CheckNumForName(normspritename + "A1", ns_sprites);
if (spritenorm == -1)
{
spritenorm = Wads.CheckNumForName(normspritename + "A0", ns_sprites);
spritenorm = fileSystem.CheckNumForName(normspritename + "A0", ns_sprites);
}
int spritecrouch = Wads.CheckNumForName(crouchspritename + "A1", ns_sprites);
int spritecrouch = fileSystem.CheckNumForName(crouchspritename + "A1", ns_sprites);
if (spritecrouch == -1)
{
spritecrouch = Wads.CheckNumForName(crouchspritename + "A0", ns_sprites);
spritecrouch = fileSystem.CheckNumForName(crouchspritename + "A0", ns_sprites);
}
if (spritenorm == -1 || spritecrouch == -1)
@ -838,10 +838,10 @@ static int SetupCrouchSprite(AActor *self, int crouchsprite)
return false;
}
int wadnorm = Wads.GetLumpFile(spritenorm);
int wadcrouch = Wads.GetLumpFile(spritenorm);
int wadnorm = fileSystem.GetLumpFile(spritenorm);
int wadcrouch = fileSystem.GetLumpFile(spritenorm);
if (wadnorm > Wads.GetMaxIwadNum() && wadcrouch <= Wads.GetMaxIwadNum())
if (wadnorm > fileSystem.GetMaxIwadNum() && wadcrouch <= fileSystem.GetMaxIwadNum())
{
// Question: Add an option / disable crouching or do what?
return false;

View file

@ -115,7 +115,7 @@ static int DoomSpecificInfo (char *buffer, char *end)
}
p += snprintf(buffer + p, size - p, "\n");
for (i = 0; (arg = Wads.GetWadName(i)) != NULL; ++i)
for (i = 0; (arg = fileSystem.GetWadName(i)) != NULL; ++i)
{
p += snprintf(buffer + p, size - p, "\nWad %d: %s", i, arg);
}

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);

View file

@ -331,13 +331,13 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
i_data += "#define noise4(unused) vec4(0)\n";
#endif // __APPLE__
int vp_lump = Wads.CheckNumForFullName(vert_prog_lump, 0);
int vp_lump = fileSystem.CheckNumForFullName(vert_prog_lump, 0);
if (vp_lump == -1) I_Error("Unable to load '%s'", vert_prog_lump);
FMemLump vp_data = Wads.ReadLump(vp_lump);
FMemLump vp_data = fileSystem.ReadLump(vp_lump);
int fp_lump = Wads.CheckNumForFullName(frag_prog_lump, 0);
int fp_lump = fileSystem.CheckNumForFullName(frag_prog_lump, 0);
if (fp_lump == -1) I_Error("Unable to load '%s'", frag_prog_lump);
FMemLump fp_data = Wads.ReadLump(fp_lump);
FMemLump fp_data = fileSystem.ReadLump(fp_lump);
@ -383,18 +383,18 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
if (*proc_prog_lump != '#')
{
int pp_lump = Wads.CheckNumForFullName(proc_prog_lump);
int pp_lump = fileSystem.CheckNumForFullName(proc_prog_lump);
if (pp_lump == -1) I_Error("Unable to load '%s'", proc_prog_lump);
FMemLump pp_data = Wads.ReadLump(pp_lump);
FMemLump pp_data = fileSystem.ReadLump(pp_lump);
if (pp_data.GetString().IndexOf("ProcessMaterial") < 0)
{
// this looks like an old custom hardware shader.
// add ProcessMaterial function that calls the older ProcessTexel function
int pl_lump = Wads.CheckNumForFullName("shaders/glsl/func_defaultmat.fp", 0);
int pl_lump = fileSystem.CheckNumForFullName("shaders/glsl/func_defaultmat.fp", 0);
if (pl_lump == -1) I_Error("Unable to load '%s'", "shaders/glsl/func_defaultmat.fp");
FMemLump pl_data = Wads.ReadLump(pl_lump);
FMemLump pl_data = fileSystem.ReadLump(pl_lump);
fp_comb << "\n" << pl_data.GetString().GetChars();
if (pp_data.GetString().IndexOf("ProcessTexel") < 0)
@ -418,9 +418,9 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
if (pp_data.GetString().IndexOf("ProcessLight") < 0)
{
int pl_lump = Wads.CheckNumForFullName("shaders/glsl/func_defaultlight.fp", 0);
int pl_lump = fileSystem.CheckNumForFullName("shaders/glsl/func_defaultlight.fp", 0);
if (pl_lump == -1) I_Error("Unable to load '%s'", "shaders/glsl/func_defaultlight.fp");
FMemLump pl_data = Wads.ReadLump(pl_lump);
FMemLump pl_data = fileSystem.ReadLump(pl_lump);
fp_comb << "\n" << pl_data.GetString().GetChars();
}
}
@ -433,9 +433,9 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
if (light_fragprog)
{
int pp_lump = Wads.CheckNumForFullName(light_fragprog, 0);
int pp_lump = fileSystem.CheckNumForFullName(light_fragprog, 0);
if (pp_lump == -1) I_Error("Unable to load '%s'", light_fragprog);
FMemLump pp_data = Wads.ReadLump(pp_lump);
FMemLump pp_data = fileSystem.ReadLump(pp_lump);
fp_comb << pp_data.GetString().GetChars() << "\n";
}

View file

@ -91,9 +91,9 @@ void FShaderProgram::CreateShader(ShaderType type)
void FShaderProgram::Compile(ShaderType type, const char *lumpName, const char *defines, int maxGlslVersion)
{
int lump = Wads.CheckNumForFullName(lumpName);
int lump = fileSystem.CheckNumForFullName(lumpName);
if (lump == -1) I_FatalError("Unable to load '%s'", lumpName);
FString code = Wads.ReadLump(lump).GetString().GetChars();
FString code = fileSystem.ReadLump(lump).GetString().GetChars();
Compile(type, lumpName, code, defines, maxGlslVersion);
}

View file

@ -347,12 +347,12 @@ void SetDefaultColormap (const char *name)
uint8_t unremap[256];
uint8_t remap[256];
lump = Wads.CheckNumForFullName (name, true, ns_colormaps);
lump = fileSystem.CheckNumForFullName (name, true, ns_colormaps);
if (lump == -1)
lump = Wads.CheckNumForName (name, ns_global);
lump = fileSystem.CheckNumForName (name, ns_global);
// [RH] If using BUILD's palette, generate the colormap
if (lump == -1 || Wads.CheckNumForFullName("palette.dat") >= 0 || Wads.CheckNumForFullName("blood.pal") >= 0)
if (lump == -1 || fileSystem.CheckNumForFullName("palette.dat") >= 0 || fileSystem.CheckNumForFullName("blood.pal") >= 0)
{
Printf ("Make colormap\n");
FDynamicColormap foo;
@ -366,7 +366,7 @@ void SetDefaultColormap (const char *name)
}
else
{
auto lumpr = Wads.OpenLumpReader (lump);
auto lumpr = fileSystem.OpenLumpReader (lump);
// [RH] The colormap may not have been designed for the specific
// palette we are using, so remap it to match the current palette.
@ -404,7 +404,7 @@ static void InitBoomColormaps ()
// This is a really rough hack, but it's better than
// not doing anything with them at all (right?)
uint32_t NumLumps = Wads.GetNumLumps();
uint32_t NumLumps = fileSystem.GetNumLumps();
realcolormaps.Maps = new uint8_t[256*NUMCOLORMAPS*fakecmaps.Size()];
SetDefaultColormap ("COLORMAP");
@ -424,10 +424,10 @@ static void InitBoomColormaps ()
remap[0] = 0;
for (j = 1; j < fakecmaps.Size(); j++)
{
if (Wads.LumpLength (fakecmaps[j].lump) >= (NUMCOLORMAPS+1)*256)
if (fileSystem.LumpLength (fakecmaps[j].lump) >= (NUMCOLORMAPS+1)*256)
{
int k, r;
auto lump = Wads.OpenLumpReader (fakecmaps[j].lump);
auto lump = fileSystem.OpenLumpReader (fakecmaps[j].lump);
uint8_t *const map = realcolormaps.Maps + NUMCOLORMAPS*256*j;
for (k = 0; k < NUMCOLORMAPS; ++k)

View file

@ -387,9 +387,9 @@ FString V_GetColorStringByName (const char *name, FScriptPosition *sc)
int c[3], step;
size_t namelen;
if (Wads.GetNumLumps()==0) return FString();
if (fileSystem.GetNumLumps()==0) return FString();
rgblump = Wads.CheckNumForName ("X11R6RGB");
rgblump = fileSystem.CheckNumForName ("X11R6RGB");
if (rgblump == -1)
{
if (!sc) Printf ("X11R6RGB lump not found\n");
@ -397,9 +397,9 @@ FString V_GetColorStringByName (const char *name, FScriptPosition *sc)
return FString();
}
rgbNames = Wads.ReadLump (rgblump);
rgbNames = fileSystem.ReadLump (rgblump);
rgb = (char *)rgbNames.GetMem();
rgbEnd = rgb + Wads.LumpLength (rgblump);
rgbEnd = rgb + fileSystem.LumpLength (rgblump);
step = 0;
namelen = strlen (name);

View file

@ -451,9 +451,9 @@ VkPPShader::VkPPShader(PPShader *shader)
FString VkPPShader::LoadShaderCode(const FString &lumpName, const FString &defines, int version)
{
int lump = Wads.CheckNumForFullName(lumpName);
int lump = fileSystem.CheckNumForFullName(lumpName);
if (lump == -1) I_FatalError("Unable to load '%s'", lumpName.GetChars());
FString code = Wads.ReadLump(lump).GetString().GetChars();
FString code = fileSystem.ReadLump(lump).GetString().GetChars();
FString patchedCode;
patchedCode.AppendFormat("#version %d\n", 450);

View file

@ -345,16 +345,16 @@ FString VkShaderManager::GetTargetGlslVersion()
FString VkShaderManager::LoadPublicShaderLump(const char *lumpname)
{
int lump = Wads.CheckNumForFullName(lumpname);
int lump = fileSystem.CheckNumForFullName(lumpname);
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
FMemLump data = Wads.ReadLump(lump);
FMemLump data = fileSystem.ReadLump(lump);
return data.GetString();
}
FString VkShaderManager::LoadPrivateShaderLump(const char *lumpname)
{
int lump = Wads.CheckNumForFullName(lumpname, 0);
int lump = fileSystem.CheckNumForFullName(lumpname, 0);
if (lump == -1) I_Error("Unable to load '%s'", lumpname);
FMemLump data = Wads.ReadLump(lump);
FMemLump data = fileSystem.ReadLump(lump);
return data.GetString();
}

View file

@ -187,7 +187,7 @@ bool FCompileContext::CheckWritable(int flags)
{
if (!(flags & VARF_ReadOnly)) return false;
if (!(flags & VARF_InternalAccess)) return true;
return Wads.GetLumpFile(Lump) != 0;
return fileSystem.GetLumpFile(Lump) != 0;
}
FxLocalVariableDeclaration *FCompileContext::FindLocalVariable(FName name)
@ -6141,7 +6141,7 @@ FxExpression *FxIdentifier::Resolve(FCompileContext& ctx)
// even if it depends on some deprecated symbol.
// The main motivation here is to keep the deprecated static functions accessing the global level variable as they were.
// Print these only if debug output is active and at the highest verbosity level.
const bool internal = (ctx.Function->Variants[0].Flags & VARF_Deprecated) && Wads.GetLumpFile(ctx.Lump) == 0;
const bool internal = (ctx.Function->Variants[0].Flags & VARF_Deprecated) && fileSystem.GetLumpFile(ctx.Lump) == 0;
const FString &deprecationMessage = vsym->DeprecationMessage;
ScriptPosition.Message(internal ? MSG_DEBUGMSG : MSG_WARNING,

View file

@ -1113,7 +1113,7 @@ static PClassActor *ParseActorHeader(FScanner &sc, Baggage *bag)
{
PClassActor *info = CreateNewActor(sc, typeName, parentName);
info->ActorInfo()->DoomEdNum = DoomEdNum > 0 ? DoomEdNum : -1;
info->SourceLumpName = Wads.GetLumpFullPath(sc.LumpNum);
info->SourceLumpName = fileSystem.GetLumpFullPath(sc.LumpNum);
if (!info->SetReplacement(replaceName))
{
@ -1270,13 +1270,13 @@ void ParseDecorate (FScanner &sc, PNamespace *ns)
{
sc.MustGetString();
// This check needs to remain overridable for testing purposes.
if (Wads.GetLumpFile(sc.LumpNum) == 0 && !Args->CheckParm("-allowdecoratecrossincludes"))
if (fileSystem.GetLumpFile(sc.LumpNum) == 0 && !Args->CheckParm("-allowdecoratecrossincludes"))
{
int includefile = Wads.GetLumpFile(Wads.CheckNumForFullName(sc.String, true));
int includefile = fileSystem.GetLumpFile(fileSystem.CheckNumForFullName(sc.String, true));
if (includefile != 0)
{
I_FatalError("File %s is overriding core lump %s.",
Wads.GetWadFullName(includefile), sc.String);
fileSystem.GetWadFullName(includefile), sc.String);
}
}
FScanner newscanner;
@ -1341,7 +1341,7 @@ void ParseAllDecorate()
{
int lastlump = 0, lump;
while ((lump = Wads.FindLump("DECORATE", &lastlump)) != -1)
while ((lump = fileSystem.FindLump("DECORATE", &lastlump)) != -1)
{
FScanner sc(lump);
auto ns = Namespaces.NewNamespace(sc.LumpNum);

View file

@ -1125,7 +1125,7 @@ static void SetIcon(FTextureID &icon, Baggage &bag, const char *i)
// Don't print warnings if the item is for another game or if this is a shareware IWAD.
// Strife's teaser doesn't contain all the icon graphics of the full game.
if ((bag.Info->ActorInfo()->GameFilter == GAME_Any || bag.Info->ActorInfo()->GameFilter & gameinfo.gametype) &&
!(gameinfo.flags&GI_SHAREWARE) && Wads.GetLumpFile(bag.Lumpnum) != 0)
!(gameinfo.flags&GI_SHAREWARE) && fileSystem.GetLumpFile(bag.Lumpnum) != 0)
{
bag.ScriptPosition.Message(MSG_WARNING,
"Icon '%s' for '%s' not found\n", i, bag.Info->TypeName.GetChars());
@ -1474,7 +1474,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, colorsetfile, ISSI, PlayerPawn)
FPlayerColorSet color;
color.Name = setname;
color.Lump = Wads.CheckNumForName(rangefile);
color.Lump = fileSystem.CheckNumForName(rangefile);
color.RepresentativeColor = representative_color;
color.NumExtraRanges = 0;

View file

@ -687,7 +687,7 @@ void ZCCCompiler::CreateStructTypes()
syms = &OutNamespace->Symbols;
}
if (s->NodeName() == NAME__ && Wads.GetLumpFile(Lump) == 0)
if (s->NodeName() == NAME__ && fileSystem.GetLumpFile(Lump) == 0)
{
// This is just a container for syntactic purposes.
s->strct->Type = nullptr;
@ -1406,7 +1406,7 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
ZCC_Latent | ZCC_Final | ZCC_Action | ZCC_Static | ZCC_FuncConst | ZCC_Abstract | ZCC_Virtual | ZCC_Override | ZCC_Extension | ZCC_VirtualScope | ZCC_ClearScope;
// Some internal fields need to be set to clearscope.
if (Wads.GetLumpFile(Lump) == 0) notallowed &= ~ZCC_ClearScope;
if (fileSystem.GetLumpFile(Lump) == 0) notallowed &= ~ZCC_ClearScope;
if (field->Flags & notallowed)
{
@ -1617,7 +1617,7 @@ bool ZCCCompiler::CompileProperties(PClass *type, TArray<ZCC_Property *> &Proper
TArray<PField *> fields;
ZCC_Identifier *id = (ZCC_Identifier *)p->Body;
if (FName(p->NodeName) == FName("prefix") && Wads.GetLumpFile(Lump) == 0)
if (FName(p->NodeName) == FName("prefix") && fileSystem.GetLumpFile(Lump) == 0)
{
// only for internal definitions: Allow setting a prefix. This is only for compatiblity with the old DECORATE property parser, but not for general use.
prefix = id->Id;
@ -1672,7 +1672,7 @@ bool ZCCCompiler::CompileFlagDefs(PClass *type, TArray<ZCC_FlagDef *> &Propertie
PField *field;
FName referenced = FName(p->RefName);
if (FName(p->NodeName) == FName("prefix") && Wads.GetLumpFile(Lump) == 0)
if (FName(p->NodeName) == FName("prefix") && fileSystem.GetLumpFile(Lump) == 0)
{
// only for internal definitions: Allow setting a prefix. This is only for compatiblity with the old DECORATE property parser, but not for general use.
prefix = referenced;
@ -1840,7 +1840,7 @@ PType *ZCCCompiler::DetermineType(PType *outertype, ZCC_TreeNode *field, FName n
case ZCC_NativeType:
// Creating an instance of a native struct is only allowed for internal definitions of native variables.
if (Wads.GetLumpFile(Lump) != 0 || !formember)
if (fileSystem.GetLumpFile(Lump) != 0 || !formember)
{
Error(field, "%s: @ not allowed for user scripts", name.GetChars());
}
@ -1896,7 +1896,7 @@ PType *ZCCCompiler::DetermineType(PType *outertype, ZCC_TreeNode *field, FName n
auto ftype = DetermineType(outertype, field, name, atype->ElementType, false, true);
if (ftype->GetRegType() == REGT_NIL || ftype->GetRegCount() > 1)
{
if (field->NodeType == AST_VarDeclarator && (static_cast<ZCC_VarDeclarator*>(field)->Flags & ZCC_Native) && Wads.GetLumpFile(Lump) == 0)
if (field->NodeType == AST_VarDeclarator && (static_cast<ZCC_VarDeclarator*>(field)->Flags & ZCC_Native) && fileSystem.GetLumpFile(Lump) == 0)
{
// the internal definitions may declare native arrays to complex types.
// As long as they can be mapped to a static array type the VM can handle them, in a limited but sufficient fashion.

View file

@ -245,7 +245,7 @@ static void ParseSingleFile(FScanner *pSC, const char *filename, int lump, void
{
if (filename != nullptr)
{
lump = Wads.CheckNumForFullName(filename, true);
lump = fileSystem.CheckNumForFullName(filename, true);
if (lump >= 0)
{
lsc.OpenLumpNum(lump);
@ -355,7 +355,7 @@ static void DoParse(int lumpnum)
void *parser;
ZCCToken value;
auto baselump = lumpnum;
auto fileno = Wads.GetLumpFile(lumpnum);
auto fileno = fileSystem.GetLumpFile(lumpnum);
parser = ZCCParseAlloc(malloc);
ZCCParseState state;
@ -415,18 +415,18 @@ static void DoParse(int lumpnum)
ParseSingleFile(&sc, nullptr, lumpnum, parser, state);
for (unsigned i = 0; i < Includes.Size(); i++)
{
lumpnum = Wads.CheckNumForFullName(Includes[i], true);
lumpnum = fileSystem.CheckNumForFullName(Includes[i], true);
if (lumpnum == -1)
{
IncludeLocs[i].Message(MSG_ERROR, "Include script lump %s not found", Includes[i].GetChars());
}
else
{
auto fileno2 = Wads.GetLumpFile(lumpnum);
auto fileno2 = fileSystem.GetLumpFile(lumpnum);
if (fileno == 0 && fileno2 != 0)
{
I_FatalError("File %s is overriding core lump %s.",
Wads.GetWadFullName(Wads.GetLumpFile(lumpnum)), Includes[i].GetChars());
fileSystem.GetWadFullName(fileSystem.GetLumpFile(lumpnum)), Includes[i].GetChars());
}
ParseSingleFile(nullptr, nullptr, lumpnum, parser, state);
@ -445,7 +445,7 @@ static void DoParse(int lumpnum)
// If the parser fails, there is no point starting the compiler, because it'd only flood the output with endless errors.
if (FScriptPosition::ErrorCounter > 0)
{
I_Error("%d errors while parsing %s", FScriptPosition::ErrorCounter, Wads.GetLumpFullPath(baselump).GetChars());
I_Error("%d errors while parsing %s", FScriptPosition::ErrorCounter, fileSystem.GetLumpFullPath(baselump).GetChars());
}
#ifndef NDEBUG
@ -459,7 +459,7 @@ static void DoParse(int lumpnum)
if (Args->CheckParm("-dumpast"))
{
FString ast = ZCC_PrintAST(state.TopNode);
FString filename = Wads.GetLumpFullPath(baselump);
FString filename = fileSystem.GetLumpFullPath(baselump);
filename.ReplaceChars(":\\/?|", '.');
filename << ".ast";
FileWriter *ff = FileWriter::Open(filename);
@ -471,19 +471,19 @@ static void DoParse(int lumpnum)
}
PSymbolTable symtable;
auto newns = Wads.GetLumpFile(baselump) == 0 ? Namespaces.GlobalNamespace : Namespaces.NewNamespace(Wads.GetLumpFile(baselump));
auto newns = fileSystem.GetLumpFile(baselump) == 0 ? Namespaces.GlobalNamespace : Namespaces.NewNamespace(fileSystem.GetLumpFile(baselump));
ZCCCompiler cc(state, NULL, symtable, newns, baselump, state.ParseVersion);
cc.Compile();
if (FScriptPosition::ErrorCounter > 0)
{
// Abort if the compiler produced any errors. Also do not compile further lumps, because they very likely miss some stuff.
I_Error("%d errors, %d warnings while compiling %s", FScriptPosition::ErrorCounter, FScriptPosition::WarnCounter, Wads.GetLumpFullPath(baselump).GetChars());
I_Error("%d errors, %d warnings while compiling %s", FScriptPosition::ErrorCounter, FScriptPosition::WarnCounter, fileSystem.GetLumpFullPath(baselump).GetChars());
}
else if (FScriptPosition::WarnCounter > 0)
{
// If we got warnings, but no errors, print the information but continue.
Printf(TEXTCOLOR_ORANGE "%d warnings while compiling %s\n", FScriptPosition::WarnCounter, Wads.GetLumpFullPath(baselump).GetChars());
Printf(TEXTCOLOR_ORANGE "%d warnings while compiling %s\n", FScriptPosition::WarnCounter, fileSystem.GetLumpFullPath(baselump).GetChars());
}
}
@ -497,7 +497,7 @@ void ParseScripts()
int lump, lastlump = 0;
FScriptPosition::ResetErrorCounter();
while ((lump = Wads.FindLump("ZSCRIPT", &lastlump)) != -1)
while ((lump = fileSystem.FindLump("ZSCRIPT", &lastlump)) != -1)
{
DoParse(lump);
}

View file

@ -1473,9 +1473,9 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FTextureID &value, FTe
FTexture *pic = TexMan.GetTexture(chk);
const char *name;
if (Wads.GetLinkedTexture(pic->SourceLump) == pic)
if (fileSystem.GetLinkedTexture(pic->SourceLump) == pic)
{
name = Wads.GetLumpFullName(pic->SourceLump);
name = fileSystem.GetLumpFullName(pic->SourceLump);
}
else
{

View file

@ -171,13 +171,13 @@ static void SetupGenMidi()
{
// The OPL renderer should not care about where this comes from.
// Note: No I_Error here - this needs to be consistent with the rest of the music code.
auto lump = Wads.CheckNumForName("GENMIDI", ns_global);
auto lump = fileSystem.CheckNumForName("GENMIDI", ns_global);
if (lump < 0)
{
Printf("No GENMIDI lump found. OPL playback not available.\n");
return;
}
auto data = Wads.OpenLumpReader(lump);
auto data = fileSystem.OpenLumpReader(lump);
auto genmidi = data.Read();
if (genmidi.Size() < 8 + 175 * 36 || memcmp(genmidi.Data(), "#OPL_II#", 8)) return;
@ -186,23 +186,23 @@ static void SetupGenMidi()
static void SetupWgOpn()
{
int lump = Wads.CheckNumForFullName("xg.wopn");
int lump = fileSystem.CheckNumForFullName("xg.wopn");
if (lump < 0)
{
return;
}
FMemLump data = Wads.ReadLump(lump);
FMemLump data = fileSystem.ReadLump(lump);
ZMusic_SetWgOpn(data.GetMem(), (uint32_t)data.GetSize());
}
static void SetupDMXGUS()
{
int lump = Wads.CheckNumForFullName("DMXGUS");
int lump = fileSystem.CheckNumForFullName("DMXGUS");
if (lump < 0)
{
return;
}
FMemLump data = Wads.ReadLump(lump);
FMemLump data = fileSystem.ReadLump(lump);
ZMusic_SetDmxGus(data.GetMem(), (uint32_t)data.GetSize());
}
@ -307,15 +307,15 @@ static ZMusic_MidiSource GetMIDISource(const char *fn)
FString src = fn;
if (src.Compare("*") == 0) src = mus_playing.name;
auto lump = Wads.CheckNumForName(src, ns_music);
if (lump < 0) lump = Wads.CheckNumForFullName(src);
auto lump = fileSystem.CheckNumForName(src, ns_music);
if (lump < 0) lump = fileSystem.CheckNumForFullName(src);
if (lump < 0)
{
Printf("Cannot find MIDI lump %s.\n", src.GetChars());
return nullptr;
}
auto wlump = Wads.OpenLumpReader(lump);
auto wlump = fileSystem.OpenLumpReader(lump);
uint32_t id[32 / 4];

View file

@ -294,7 +294,7 @@ FileReader FPatchSetReader::OpenFile(const char *name)
FLumpPatchSetReader::FLumpPatchSetReader(const char *filename)
{
mLumpIndex = Wads.CheckNumForFullName(filename);
mLumpIndex = fileSystem.CheckNumForFullName(filename);
mBasePath = filename;
FixPathSeperator(mBasePath);
@ -304,7 +304,7 @@ FLumpPatchSetReader::FLumpPatchSetReader(const char *filename)
FileReader FLumpPatchSetReader::OpenMainConfigFile()
{
return Wads.ReopenLumpReader(mLumpIndex);
return fileSystem.ReopenLumpReader(mLumpIndex);
}
FileReader FLumpPatchSetReader::OpenFile(const char *name)
@ -312,9 +312,9 @@ FileReader FLumpPatchSetReader::OpenFile(const char *name)
FString path;
if (IsAbsPath(name)) return FileReader(); // no absolute paths in the lump directory.
path = mBasePath + name;
auto index = Wads.CheckNumForFullName(path);
auto index = fileSystem.CheckNumForFullName(path);
if (index < 0) return FileReader();
return Wads.ReopenLumpReader(index);
return fileSystem.ReopenLumpReader(index);
}
//==========================================================================
@ -472,7 +472,7 @@ FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *name, int allowed
if (name != nullptr)
{
const char *p = name + strlen(name) - 4;
if (p > name && !stricmp(p, ".cfg") && Wads.CheckNumForFullName(name) >= 0)
if (p > name && !stricmp(p, ".cfg") && fileSystem.CheckNumForFullName(name) >= 0)
{
return new FLumpPatchSetReader(name);
}

View file

@ -435,7 +435,7 @@ DEFINE_ACTION_FUNCTION(DObject,S_GetLength)
int S_AddSound (const char *logicalname, const char *lumpname, FScanner *sc)
{
int lump = Wads.CheckNumForFullName (lumpname, true, ns_sounds);
int lump = fileSystem.CheckNumForFullName (lumpname, true, ns_sounds);
return S_AddSound (logicalname, lump);
}
@ -505,7 +505,7 @@ int S_AddPlayerSound (const char *pclass, int gender, int refid,
if (lumpname)
{
lump = Wads.CheckNumForFullName (lumpname, true, ns_sounds);
lump = fileSystem.CheckNumForFullName (lumpname, true, ns_sounds);
}
return S_AddPlayerSound (pclass, gender, refid, lump);
@ -780,12 +780,12 @@ void S_ParseSndInfo (bool redefine)
CurrentPitchMask = 0;
S_AddSound ("{ no sound }", "DSEMPTY"); // Sound 0 is no sound at all
for (lump = 0; lump < Wads.GetNumLumps(); ++lump)
for (lump = 0; lump < fileSystem.GetNumLumps(); ++lump)
{
switch (Wads.GetLumpNamespace (lump))
switch (fileSystem.GetLumpNamespace (lump))
{
case ns_global:
if (Wads.CheckLumpName (lump, "SNDINFO"))
if (fileSystem.CheckLumpName (lump, "SNDINFO"))
{
S_AddSNDINFO (lump);
}
@ -801,7 +801,7 @@ void S_ParseSndInfo (bool redefine)
S_ShrinkPlayerSoundLists ();
sfx_empty = Wads.CheckNumForName ("dsempty", ns_sounds);
sfx_empty = fileSystem.CheckNumForName ("dsempty", ns_sounds);
S_CheckIntegrity();
}
@ -1191,12 +1191,12 @@ static void S_AddSNDINFO (int lump)
case SI_MusicAlias: {
sc.MustGetString();
int lump = Wads.CheckNumForName(sc.String, ns_music);
int lump = fileSystem.CheckNumForName(sc.String, ns_music);
if (lump >= 0)
{
// do not set the alias if a later WAD defines its own music of this name
int file = Wads.GetLumpFile(lump);
int sndifile = Wads.GetLumpFile(sc.LumpNum);
int file = fileSystem.GetLumpFile(lump);
int sndifile = fileSystem.GetLumpFile(sc.LumpNum);
if (file > sndifile)
{
sc.MustGetString();
@ -1208,7 +1208,7 @@ static void S_AddSNDINFO (int lump)
FName mapped = sc.String;
// only set the alias if the lump it maps to exists.
if (mapped == NAME_None || Wads.CheckNumForFullName(sc.String, true, ns_music) >= 0)
if (mapped == NAME_None || fileSystem.CheckNumForFullName(sc.String, true, ns_music) >= 0)
{
MusicAliases[alias] = mapped;
}
@ -1281,7 +1281,7 @@ static void S_AddSNDINFO (int lump)
static void S_AddStrifeVoice (int lumpnum)
{
char name[16] = "svox/";
Wads.GetLumpName (name+5, lumpnum);
fileSystem.GetLumpName (name+5, lumpnum);
S_AddSound (name, lumpnum);
}
@ -1995,7 +1995,7 @@ void S_ParseMusInfo()
{
int lastlump = 0, lump;
while ((lump = Wads.FindLump ("MUSINFO", &lastlump)) != -1)
while ((lump = fileSystem.FindLump ("MUSINFO", &lastlump)) != -1)
{
FScanner sc(lump);

View file

@ -116,11 +116,11 @@ void S_Init()
I_InitSound();
// Heretic and Hexen have sound curve lookup tables. Doom does not.
int curvelump = Wads.CheckNumForName("SNDCURVE");
int curvelump = fileSystem.CheckNumForName("SNDCURVE");
TArray<uint8_t> curve;
if (curvelump >= 0)
{
curve = Wads.ReadLumpIntoArray(curvelump);
curve = fileSystem.ReadLumpIntoArray(curvelump);
}
soundEngine->Init(curve);
}
@ -196,7 +196,7 @@ void S_Start()
if (LocalSndInfo.IsNotEmpty())
{
// Now parse the local SNDINFO
int j = Wads.CheckNumForFullName(LocalSndInfo, true);
int j = fileSystem.CheckNumForFullName(LocalSndInfo, true);
if (j >= 0) S_AddLocalSndInfo(j);
}
@ -210,7 +210,7 @@ void S_Start()
if (parse_ss)
{
S_ParseSndSeq(LocalSndSeq.IsNotEmpty() ? Wads.CheckNumForFullName(LocalSndSeq, true) : -1);
S_ParseSndSeq(LocalSndSeq.IsNotEmpty() ? fileSystem.CheckNumForFullName(LocalSndSeq, true) : -1);
}
LastLocalSndInfo = LocalSndInfo;
@ -1059,13 +1059,13 @@ bool DoomSoundEngine::ValidatePosVel(int sourcetype, const void* source, const F
//==========================================================================
//
// This is to avoid hardscoding the dependency on Wads into the sound engine
// This is to avoid hardscoding the dependency on the file system into the sound engine
//
//==========================================================================
TArray<uint8_t> DoomSoundEngine::ReadSound(int lumpnum)
{
auto wlump = Wads.OpenLumpReader(lumpnum);
auto wlump = fileSystem.OpenLumpReader(lumpnum);
return wlump.Read();
}
@ -1139,7 +1139,7 @@ void DoomSoundEngine::NoiseDebug()
color = (chan->ChanFlags & CHANF_LOOP) ? CR_BROWN : CR_GREY;
// Name
Wads.GetLumpName(temp, S_sfx[chan->SoundID].lumpnum);
fileSystem.GetLumpName(temp, S_sfx[chan->SoundID].lumpnum);
temp[8] = 0;
screen->DrawText(NewConsoleFont, color, 0, y, temp, TAG_DONE);
@ -1257,7 +1257,7 @@ void DoomSoundEngine::PrintSoundList()
}
else if (S_sfx[i].lumpnum != -1)
{
Wads.GetLumpName(lumpname, sfx->lumpnum);
fileSystem.GetLumpName(lumpname, sfx->lumpnum);
Printf("%3d. %s (%s)\n", i, sfx->name.GetChars(), lumpname);
}
else if (S_sfx[i].link != sfxinfo_t::NO_LINK)

View file

@ -434,18 +434,18 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
FileReader reader;
if (!FileExists (musicname))
{
if ((lumpnum = Wads.CheckNumForFullName (musicname, true, ns_music)) == -1)
if ((lumpnum = fileSystem.CheckNumForFullName (musicname, true, ns_music)) == -1)
{
Printf ("Music \"%s\" not found\n", musicname);
return false;
}
if (handle == nullptr)
{
if (Wads.LumpLength (lumpnum) == 0)
if (fileSystem.LumpLength (lumpnum) == 0)
{
return false;
}
reader = Wads.ReopenLumpReader(lumpnum);
reader = fileSystem.ReopenLumpReader(lumpnum);
}
}
else

View file

@ -543,7 +543,7 @@ void S_ParseReverbDef ()
{
int lump, lastlump = 0;
while ((lump = Wads.FindLump ("REVERBS", &lastlump)) != -1)
while ((lump = fileSystem.FindLump ("REVERBS", &lastlump)) != -1)
{
FScanner sc;
sc.OpenLumpNum(lump);

View file

@ -581,7 +581,7 @@ void S_ParseSndSeq (int levellump)
memset (SeqTrans, -1, sizeof(SeqTrans));
lastlump = 0;
while (((lump = Wads.FindLump ("SNDSEQ", &lastlump)) != -1 || levellump != -1) && levellump != -2)
while (((lump = fileSystem.FindLump ("SNDSEQ", &lastlump)) != -1 || levellump != -1) && levellump != -2)
{
if (lump == -1)
{

View file

@ -203,7 +203,7 @@ FScanner &FScanner::operator=(const FScanner &other)
void FScanner::Open (const char *name)
{
int lump = Wads.CheckNumForFullName(name, true);
int lump = fileSystem.CheckNumForFullName(name, true);
if (lump == -1)
{
I_Error("Could not find script lump '%s'\n", name);
@ -279,10 +279,10 @@ void FScanner :: OpenLumpNum (int lump)
{
Close ();
{
FMemLump mem = Wads.ReadLump(lump);
FMemLump mem = fileSystem.ReadLump(lump);
ScriptBuffer = mem.GetString();
}
ScriptName = Wads.GetLumpFullPath(lump);
ScriptName = fileSystem.GetLumpFullPath(lump);
LumpNum = lump;
PrepareScript ();
}

View file

@ -369,7 +369,7 @@ bool DInterBackground::LoadBackground(bool isenterpic)
}
else
{
int lumpnum = Wads.CheckNumForFullName(lumpname + 1, true);
int lumpnum = fileSystem.CheckNumForFullName(lumpname + 1, true);
if (lumpnum >= 0)
{
FScanner sc(lumpnum);

Some files were not shown because too many files have changed in this diff Show more