diff --git a/src/console/c_cmds.cpp b/src/console/c_cmds.cpp index 87d38aa9f4..e62bfa39eb 100644 --- a/src/console/c_cmds.cpp +++ b/src/console/c_cmds.cpp @@ -854,11 +854,11 @@ CCMD (wdir) Printf ("%s must be loaded to view its directory.\n", argv[1]); return; } - for (int i = 0; i < fileSystem.GetNumLumps(); ++i) + for (int i = 0; i < fileSystem.GetNumEntries(); ++i) { - if (fileSystem.GetLumpFile(i) == wadnum) + if (fileSystem.GetFileContainer(i) == wadnum) { - Printf ("%s\n", fileSystem.GetLumpFullName(i)); + Printf ("%s\n", fileSystem.GetFileFullName(i)); } } } @@ -1224,7 +1224,7 @@ CCMD(secret) int lumpno=fileSystem.CheckNumForName("SECRETS"); if (lumpno < 0) return; - auto lump = fileSystem.OpenLumpReader(lumpno); + auto lump = fileSystem.OpenFileReader(lumpno); FString maphdr; maphdr.Format("[%s]", mapname); diff --git a/src/console/c_cvars.cpp b/src/console/c_cvars.cpp index c641395073..6a68d90b0f 100644 --- a/src/console/c_cvars.cpp +++ b/src/console/c_cvars.cpp @@ -1799,7 +1799,7 @@ void C_GrabCVarDefaults () while ((lump = fileSystem.FindLump("DEFCVARS", &lastlump)) != -1) { // don't parse from wads - if (lastlump > fileSystem.GetLastLump(fileSystem.GetMaxIwadNum())) + if (lastlump > fileSystem.GetLastEntry(fileSystem.GetMaxIwadNum())) I_FatalError("Cannot load DEFCVARS from a wadfile!\n"); FScanner sc(lump); diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index 699812f97b..c5336e7180 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -274,12 +274,12 @@ FIWadManager::FIWadManager(const char *firstfn, const char *optfn) if (optfn) fns.Push(optfn); check.InitMultipleFiles(fns, true); - if (check.GetNumLumps() > 0) + if (check.GetNumEntries() > 0) { int num = check.CheckNumForName("IWADINFO"); if (num >= 0) { - auto data = check.ReadLumpIntoArray(num); + auto data = check.GetFileData(num); ParseIWadInfo("IWADINFO", (const char*)data.Data(), data.Size()); } } @@ -304,7 +304,7 @@ int FIWadManager::ScanIWAD (const char *iwad) mLumpsFound.Resize(mIWadInfos.Size()); - auto CheckLumpName = [=](const char *name) + auto CheckFileName = [=](const char *name) { for (unsigned i = 0; i< mIWadInfos.Size(); i++) { @@ -318,18 +318,18 @@ int FIWadManager::ScanIWAD (const char *iwad) } }; - if (check.GetNumLumps() > 0) + if (check.GetNumEntries() > 0) { memset(&mLumpsFound[0], 0, mLumpsFound.Size() * sizeof(mLumpsFound[0])); - for(int ii = 0; ii < check.GetNumLumps(); ii++) + for(int ii = 0; ii < check.GetNumEntries(); ii++) { - CheckLumpName(check.GetLumpName(ii)); - auto full = check.GetLumpFullName(ii, false); + CheckFileName(check.GetFileShortName(ii)); + auto full = check.GetFileFullName(ii, false); if (full && strnicmp(full, "maps/", 5) == 0) { FString mapname(&full[5], strcspn(&full[5], ".")); - CheckLumpName(mapname); + CheckFileName(mapname); } } } @@ -355,7 +355,7 @@ int FIWadManager::CheckIWADInfo(const char* fn) FileSystem check; check.InitSingleFile(fn, true); - if (check.GetNumLumps() > 0) + if (check.GetNumEntries() > 0) { int num = check.CheckNumForName("IWADINFO"); if (num >= 0) @@ -364,7 +364,7 @@ int FIWadManager::CheckIWADInfo(const char* fn) { FIWADInfo result; - auto data = check.ReadLumpIntoArray(num); + auto data = check.GetFileData(num); ParseIWadInfo(fn, (const char*)data.Data(), data.Size(), &result); for (unsigned i = 0, count = mIWadInfos.Size(); i < count; ++i) diff --git a/src/d_main.cpp b/src/d_main.cpp index 91dce01e48..c408897163 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2023,14 +2023,14 @@ static FString CheckGameInfo(TArray & pwads) // Open the entire list as a temporary file system and look for a GAMEINFO lump. The last one will automatically win. check.InitMultipleFiles(pwads, true); - if (check.GetNumLumps() > 0) + if (check.GetNumEntries() > 0) { int num = check.CheckNumForName("GAMEINFO"); if (num >= 0) { // Found one! - auto data = check.ReadLumpIntoArray(num); - auto wadname = check.GetResourceFileName(check.GetLumpFile(num)); + auto data = check.GetFileData(num); + auto wadname = check.GetResourceFileName(check.GetFileContainer(num)); return ParseGameInfo(pwads, wadname, (const char*)data.Data(), data.Size()); } } @@ -2408,13 +2408,13 @@ static void RenameSprites(FileSystem &fileSystem, const TArray& deletel break; } - unsigned NumFiles = fileSystem.GetNumLumps(); + unsigned NumFiles = fileSystem.GetNumEntries(); for (uint32_t i = 0; i < NumFiles; i++) { // check for full Minotaur animations. If this is not found // some frames need to be renamed. - if (fileSystem.GetLumpNamespace(i) == ns_sprites) + if (fileSystem.GetFileNamespace(i) == ns_sprites) { auto& shortName = fileSystem.GetShortName(i); if (shortName.dword == MAKE_ID('M', 'N', 'T', 'R') && shortName.String[4] == 'Z') @@ -2430,10 +2430,10 @@ static void RenameSprites(FileSystem &fileSystem, const TArray& deletel for (uint32_t i = 0; i < NumFiles; i++) { auto& shortName = fileSystem.GetShortName(i); - if (fileSystem.GetLumpNamespace(i) == ns_sprites) + if (fileSystem.GetFileNamespace(i) == ns_sprites) { // Only sprites in the IWAD normally get renamed - if (renameAll || fileSystem.GetLumpFile(i) == fileSystem.GetIwadNum()) + if (renameAll || fileSystem.GetFileContainer(i) == fileSystem.GetIwadNum()) { for (int j = 0; j < numrenames; ++j) { @@ -2444,7 +2444,7 @@ static void RenameSprites(FileSystem &fileSystem, const TArray& deletel } if (gameinfo.gametype == GAME_Hexen) { - if (fileSystem.CheckLumpName(i, "ARTIINVU")) + if (fileSystem.CheckFileName(i, "ARTIINVU")) { shortName.String[4] = 'D'; shortName.String[5] = 'E'; shortName.String[6] = 'F'; shortName.String[7] = 'N'; @@ -2476,9 +2476,9 @@ static void RenameSprites(FileSystem &fileSystem, const TArray& deletel } } } - else if (fileSystem.GetLumpNamespace(i) == ns_global) + else if (fileSystem.GetFileNamespace(i) == ns_global) { - int fn = fileSystem.GetLumpFile(i); + int fn = fileSystem.GetFileContainer(i); if (fn >= fileSystem.GetIwadNum() && fn <= fileSystem.GetMaxIwadNum() && deletelumps.Find(shortName.String) < deletelumps.Size()) { shortName.String[0] = 0; // Lump must be deleted from directory. @@ -2550,7 +2550,7 @@ void RenameNerve(FileSystem& fileSystem) if (!found) return; - for (int i = fileSystem.GetFirstLump(w); i <= fileSystem.GetLastLump(w); i++) + for (int i = fileSystem.GetFirstEntry(w); i <= fileSystem.GetLastEntry(w); i++) { auto& shortName = fileSystem.GetShortName(i); // Only rename the maps from NERVE.WAD @@ -2640,8 +2640,8 @@ void FixMacHexen(FileSystem& fileSystem) // Hexen Beta is very similar to Demo but it has MAP41: Maze at the end of the WAD // So keep this map if it's present but discard all extra lumps - const int lastLump = fileSystem.GetLastLump(fileSystem.GetIwadNum()) - (isBeta ? 12 : 0); - assert(fileSystem.GetFirstLump(fileSystem.GetIwadNum()) + 299 < lastLump); + const int lastLump = fileSystem.GetLastEntry(fileSystem.GetIwadNum()) - (isBeta ? 12 : 0); + assert(fileSystem.GetFirstEntry(fileSystem.GetIwadNum()) + 299 < lastLump); for (int i = lastLump - EXTRA_LUMPS + 1; i <= lastLump; ++i) { @@ -2650,6 +2650,42 @@ void FixMacHexen(FileSystem& fileSystem) } } +static void FindStrifeTeaserVoices(FileSystem& fileSystem) +{ + if (gameinfo.gametype == GAME_Strife && gameinfo.flags & GI_SHAREWARE) + { + unsigned NumFiles = fileSystem.GetNumEntries(); + for (uint32_t i = 0; i < NumFiles; i++) + { + auto& shortName = fileSystem.GetShortName(i); + if (fileSystem.GetFileNamespace(i) == ns_global) + { + // Only sprites in the IWAD normally get renamed + if (fileSystem.GetFileContainer(i) == fileSystem.GetIwadNum()) + { + if (shortName.String[0] == 'V' && + shortName.String[1] == 'O' && + shortName.String[2] == 'C') + { + int j; + + for (j = 3; j < 8; ++j) + { + if (shortName.String[j] != 0 && !isdigit(shortName.String[j])) + break; + } + if (j == 8) + { + fileSystem.SetFileNamespace(i, ns_strifevoices); + } + } + } + } + } + } +} + + //========================================================================== // @@ -2839,6 +2875,7 @@ static int D_DoomMain_Internal (void) RenameNerve(fileSystem); RenameSprites(fileSystem, iwad_info->DeleteLumps); FixMacHexen(fileSystem); + FindStrifeTeaserVoices(fileSystem); }; fileSystem.InitMultipleFiles (allwads, false, &lfi); diff --git a/src/doomstat.h b/src/doomstat.h index da160f01ef..4ec9249596 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -180,7 +180,6 @@ extern bool playeringame[/*MAXPLAYERS*/]; // File handling stuff. extern FILE* debugfile; -extern FILE* hashfile; // if true, load all graphics at level load extern bool precache; diff --git a/src/doomtype.h b/src/doomtype.h index 419b9c91a7..ca7ce498ff 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -43,8 +43,6 @@ typedef TMap FClassMap; #include "basics.h" #include "printf.h" -extern bool batchrun; - // Bounding box coordinate storage. #include "palentry.h" diff --git a/src/g_dumpinfo.cpp b/src/g_dumpinfo.cpp index 7a25d7f17b..b17219c947 100644 --- a/src/g_dumpinfo.cpp +++ b/src/g_dumpinfo.cpp @@ -156,7 +156,7 @@ CCMD (mapchecksum) else { map->GetChecksum(cksum); - const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetLumpFile(map->lumpnum)); + const char *wadname = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(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(), - fileSystem.GetResourceFileName(fileSystem.GetLumpFile(map->lumpnum))); + fileSystem.GetResourceFileName(fileSystem.GetFileContainer(map->lumpnum))); delete map; } } diff --git a/src/g_game.cpp b/src/g_game.cpp index 978a7de0a6..b53e496071 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -2133,9 +2133,9 @@ static void PutSaveWads (FSerializer &arc) arc.AddString("Game WAD", name); // Name of wad the map resides in - if (fileSystem.GetLumpFile (primaryLevel->lumpnum) > fileSystem.GetIwadNum()) + if (fileSystem.GetFileContainer (primaryLevel->lumpnum) > fileSystem.GetIwadNum()) { - name = fileSystem.GetResourceFileName (fileSystem.GetLumpFile (primaryLevel->lumpnum)); + name = fileSystem.GetResourceFileName (fileSystem.GetFileContainer (primaryLevel->lumpnum)); arc.AddString("Map WAD", name); } } @@ -2778,7 +2778,7 @@ void G_DoPlayDemo (void) { int demolen = fileSystem.FileLength (demolump); demobuffer = (uint8_t *)M_Malloc(demolen); - fileSystem.ReadLump (demolump, demobuffer); + fileSystem.ReadFile (demolump, demobuffer); } else { diff --git a/src/g_level.cpp b/src/g_level.cpp index 16a6a5e7aa..7a462dbfdc 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -895,7 +895,7 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo) FTexture *tex = TexMan.GetTexture(*texids[i]); if (tex != nullptr) { - int filenum = fileSystem.GetLumpFile(tex->GetSourceLump()); + int filenum = fileSystem.GetFileContainer(tex->GetSourceLump()); if (filenum >= 0 && filenum <= fileSystem.GetMaxIwadNum()) { texids[i]->SetInvalid(); diff --git a/src/g_statusbar/sbarinfo.cpp b/src/g_statusbar/sbarinfo.cpp index 6de740775d..36ee0566ad 100644 --- a/src/g_statusbar/sbarinfo.cpp +++ b/src/g_statusbar/sbarinfo.cpp @@ -516,10 +516,10 @@ void SBarInfo::ParseSBarInfo(int lump) { sc.ScriptError("Standard %s status bar not found.", sc.String); } - else if (fileSystem.GetLumpFile(baselump) > 0) + else if (fileSystem.GetFileContainer(baselump) > 0) { I_FatalError("File %s is overriding core lump sbarinfo/%s.txt.", - fileSystem.GetResourceFileFullName(fileSystem.GetLumpFile(baselump)), sc.String); + fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(baselump)), sc.String); } ParseSBarInfo(baselump); } diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index ae23da16f0..15a24a5c2f 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -271,7 +271,7 @@ void ST_CreateStatusBar(bool bTitleLevel) // 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 = fileSystem.CheckNumForName("SBARINFO"); - int sbarinfofile = fileSystem.GetLumpFile(sbarinfolump); + int sbarinfofile = fileSystem.GetFileContainer(sbarinfolump); if (gameinfo.statusbarclassfile >= gameinfo.statusbarfile && gameinfo.statusbarclassfile >= sbarinfofile) { CreateGameInfoStatusBar(shouldWarn); diff --git a/src/gamedata/d_dehacked.cpp b/src/gamedata/d_dehacked.cpp index a082e29556..6694896607 100644 --- a/src/gamedata/d_dehacked.cpp +++ b/src/gamedata/d_dehacked.cpp @@ -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 = fileSystem.GetLumpFullName(lumpnum); + const char* const fullName = fileSystem.GetFileFullName(lumpnum); const char* const extension = strrchr(fullName, '.'); return NULL != extension && strchr(fullName, '/') == NULL @@ -2439,7 +2439,7 @@ int D_LoadDehLumps(DehLumpSource source) while ((lumpnum = fileSystem.FindLump("DEHACKED", &lastlump)) >= 0) { - const int filenum = fileSystem.GetLumpFile(lumpnum); + const int filenum = fileSystem.GetFileContainer(lumpnum); if (FromIWAD == source && filenum > fileSystem.GetMaxIwadNum()) { @@ -2461,7 +2461,7 @@ int D_LoadDehLumps(DehLumpSource source) if (dehload == 1) // load all .DEH lumps that are found. { - for (lumpnum = 0, lastlump = fileSystem.GetNumLumps(); lumpnum < lastlump; ++lumpnum) + for (lumpnum = 0, lastlump = fileSystem.GetNumEntries(); 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 = fileSystem.GetNumLumps()-1; lumpnum >=0; --lumpnum) + for (lumpnum = fileSystem.GetNumEntries()-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 = fileSystem.GetLumpFile(lumpnum); + LumpFileNum = fileSystem.GetFileContainer(lumpnum); PatchSize = fileSystem.FileLength(lumpnum); - PatchName = fileSystem.GetLumpFullPath(lumpnum); + PatchName = fileSystem.GetFileFullPath(lumpnum); PatchFile = new char[PatchSize + 1]; - fileSystem.ReadLump(lumpnum, PatchFile); + fileSystem.ReadFile(lumpnum, PatchFile); PatchFile[PatchSize] = '\0'; // terminate with a '\0' character auto res = DoDehPatch(); LumpFileNum = ls; @@ -2689,7 +2689,7 @@ static bool LoadDehSupp () return false; } - if (fileSystem.GetLumpFile(lump) > 0) + if (fileSystem.GetFileContainer(lump) > 0) { Printf("Warning: DEHSUPP no longer supported. DEHACKED patch disabled.\n"); return false; diff --git a/src/gamedata/fonts/font.cpp b/src/gamedata/fonts/font.cpp index 11dc3870f2..8afdc928e5 100644 --- a/src/gamedata/fonts/font.cpp +++ b/src/gamedata/fonts/font.cpp @@ -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. - fileSystem.GetLumpsInFolder(path, folderdata, nametemplate == nullptr); + fileSystem.GetFilesInFolder(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 && fileSystem.GetLumpFile(tex->SourceLump) <= fileSystem.GetMaxIwadNum() && tex->UseType == ETextureType::MiscPatch) + if (tex && tex->SourceLump >= 0 && fileSystem.GetFileContainer(tex->SourceLump) <= fileSystem.GetMaxIwadNum() && tex->UseType == ETextureType::MiscPatch) { texs[i] = tex; } diff --git a/src/gamedata/fonts/singlelumpfont.cpp b/src/gamedata/fonts/singlelumpfont.cpp index 083fb50db0..ceeb705d9f 100644 --- a/src/gamedata/fonts/singlelumpfont.cpp +++ b/src/gamedata/fonts/singlelumpfont.cpp @@ -125,7 +125,7 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump) : FFont(lump) FontName = name; - FileData data1 = fileSystem.ReadLump (lump); + FileData data1 = fileSystem.ReadFile (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) { - FileData memLump = fileSystem.ReadLump(Lump); + FileData memLump = fileSystem.ReadFile(Lump); const uint8_t* data = (const uint8_t*) memLump.GetMem(); uint8_t used[256], reverse[256]; diff --git a/src/gamedata/fonts/v_font.cpp b/src/gamedata/fonts/v_font.cpp index b32f96f4d0..ab6574ad3c 100644 --- a/src/gamedata/fonts/v_font.cpp +++ b/src/gamedata/fonts/v_font.cpp @@ -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 (fileSystem.GetLumpsInFolder(path, folderdata, true)) + if (fileSystem.GetFilesInFolder(path, folderdata, true)) { // This assumes that any custom font comes in one piece and not distributed across multiple resource files. - folderfile = fileSystem.GetLumpFile(folderdata[0].lumpnum); + folderfile = fileSystem.GetFileContainer(folderdata[0].lumpnum); } lump = fileSystem.CheckNumForFullName(fontlumpname? fontlumpname : name, true); - if (lump != -1 && fileSystem.GetLumpFile(lump) >= folderfile) + if (lump != -1 && fileSystem.GetFileContainer(lump) >= folderfile) { uint32_t head; { - auto lumpy = fileSystem.OpenLumpReader (lump); + auto lumpy = fileSystem.OpenFileReader (lump); lumpy.Read (&head, 4); } if ((head & MAKE_ID(255,255,255,0)) == MAKE_ID('F','O','N',0) || @@ -265,7 +265,7 @@ void V_InitCustomFonts() { *p = TexMan.GetTexture(texid); } - else if (fileSystem.GetLumpFile(sc.LumpNum) >= fileSystem.GetIwadNum()) + else if (fileSystem.GetFileContainer(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()); @@ -676,7 +676,7 @@ void V_InitFonts() { int wadfile = -1; auto a = fileSystem.CheckNumForName("FONTA33", ns_graphics); - if (a != -1) wadfile = fileSystem.GetLumpFile(a); + if (a != -1) wadfile = fileSystem.GetFileContainer(a); if (wadfile > fileSystem.GetIwadNum()) { // The font has been replaced, so we need to create a copy of the original as well. @@ -693,7 +693,7 @@ void V_InitFonts() { int wadfile = -1; auto a = fileSystem.CheckNumForName("STCFN065", ns_graphics); - if (a != -1) wadfile = fileSystem.GetLumpFile(a); + if (a != -1) wadfile = fileSystem.GetFileContainer(a); if (wadfile > fileSystem.GetIwadNum()) { // The font has been replaced, so we need to create a copy of the original as well. diff --git a/src/gamedata/g_mapinfo.cpp b/src/gamedata/g_mapinfo.cpp index 1c5bd50a25..bedbf1cc3a 100644 --- a/src/gamedata/g_mapinfo.cpp +++ b/src/gamedata/g_mapinfo.cpp @@ -855,7 +855,7 @@ void FMapInfoParser::ParseCluster() if (lump > 0) { // Check if this comes from either Hexen.wad or Hexdd.wad and if so, map to the string table. - int fileno = fileSystem.GetLumpFile(lump); + int fileno = fileSystem.GetFileContainer(lump); auto fn = fileSystem.GetResourceFileName(fileno); if (fn && (!stricmp(fn, "HEXEN.WAD") || !stricmp(fn, "HEXDD.WAD"))) { @@ -1986,7 +1986,7 @@ 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 = fileSystem.GetLumpFile(sc.LumpNum); + int fileno = fileSystem.GetFileContainer(sc.LumpNum); auto fn = fileSystem.GetResourceFileName(fileno); if (fn && (!stricmp(fn, "HEXEN.WAD") || !stricmp(fn, "HEXDD.WAD"))) { @@ -2211,13 +2211,13 @@ void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_i { sc.ScriptError("include file '%s' not found", sc.String); } - if (fileSystem.GetLumpFile(sc.LumpNum) != fileSystem.GetLumpFile(inclump)) + if (fileSystem.GetFileContainer(sc.LumpNum) != fileSystem.GetFileContainer(inclump)) { // Do not allow overriding includes from the default MAPINFO - if (fileSystem.GetLumpFile(sc.LumpNum) == 0) + if (fileSystem.GetFileContainer(sc.LumpNum) == 0) { I_FatalError("File %s is overriding core lump %s.", - fileSystem.GetResourceFileFullName(fileSystem.GetLumpFile(inclump)), sc.String); + fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(inclump)), sc.String); } } FScanner saved_sc = sc; @@ -2407,10 +2407,10 @@ void G_ParseMapInfo (FString basemapinfo) FMapInfoParser parse; level_info_t defaultinfo; int baselump = fileSystem.GetNumForFullName(basemapinfo); - if (fileSystem.GetLumpFile(baselump) > 0) + if (fileSystem.GetFileContainer(baselump) > 0) { I_FatalError("File %s is overriding core lump %s.", - fileSystem.GetResourceFileName(fileSystem.GetLumpFile(baselump)), basemapinfo.GetChars()); + fileSystem.GetResourceFileName(fileSystem.GetFileContainer(baselump)), basemapinfo.GetChars()); } parse.ParseMapInfo(baselump, gamedefaults, defaultinfo); } @@ -2426,7 +2426,7 @@ void G_ParseMapInfo (FString basemapinfo) // 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 = fileSystem.GetLumpFile(lump); + int wad = fileSystem.GetFileContainer(lump); int altlump = fileSystem.CheckNumForName("ZMAPINFO", ns_global, wad, true); if (altlump >= 0) continue; @@ -2434,7 +2434,7 @@ void G_ParseMapInfo (FString basemapinfo) else if (nindex == 2) { // MAPINFO and ZMAPINFO will override UMAPINFO if in the same WAD. - int wad = fileSystem.GetLumpFile(lump); + int wad = fileSystem.GetFileContainer(lump); int altlump = fileSystem.CheckNumForName("ZMAPINFO", ns_global, wad, true); if (altlump >= 0) continue; altlump = fileSystem.CheckNumForName("MAPINFO", ns_global, wad, true); diff --git a/src/gamedata/gi.cpp b/src/gamedata/gi.cpp index df8475c930..e27b73745b 100644 --- a/src/gamedata/gi.cpp +++ b/src/gamedata/gi.cpp @@ -171,7 +171,7 @@ const char* GameInfoBorders[] = { \ sc.MustGetToken(TK_StringConst); \ gameinfo.key = sc.String; \ - gameinfo.stampvar = fileSystem.GetLumpFile(sc.LumpNum); \ + gameinfo.stampvar = fileSystem.GetFileContainer(sc.LumpNum); \ } #define GAMEINFOKEY_INT(key, variable) \ diff --git a/src/gamedata/keysections.cpp b/src/gamedata/keysections.cpp index 7ddf90bb88..c15a670172 100644 --- a/src/gamedata/keysections.cpp +++ b/src/gamedata/keysections.cpp @@ -162,7 +162,7 @@ void D_LoadWadSettings () while ((lump = fileSystem.FindLump ("KEYCONF", &lastlump)) != -1) { - FileData data = fileSystem.ReadLump (lump); + FileData data = fileSystem.ReadFile (lump); const char *eof = (char *)data.GetMem() + fileSystem.FileLength (lump); const char *conf = (char *)data.GetMem(); diff --git a/src/gamedata/resourcefiles/resourcefile.h b/src/gamedata/resourcefiles/resourcefile.h index e54ed0bf50..b76dd8dece 100644 --- a/src/gamedata/resourcefiles/resourcefile.h +++ b/src/gamedata/resourcefiles/resourcefile.h @@ -158,7 +158,7 @@ public: // If this FResourceFile represents a directory, the Reader object is not usable so don't return it. FileReader *GetReader() { return Reader.isOpen()? &Reader : nullptr; } uint32_t LumpCount() const { return NumLumps; } - uint32_t GetFirstLump() const { return FirstLump; } + uint32_t GetFirstEntry() const { return FirstLump; } void SetFirstLump(uint32_t f) { FirstLump = f; } const FString &GetHash() const { return Hash; } diff --git a/src/gamedata/statistics.cpp b/src/gamedata/statistics.cpp index 578982369f..756f9380da 100644 --- a/src/gamedata/statistics.cpp +++ b/src/gamedata/statistics.cpp @@ -456,7 +456,7 @@ void STAT_ChangeLevel(const char *newl, FLevelLocals *Level) MapData * map = P_OpenMapData(StartEpisode->mEpisodeMap, false); if (map != NULL) { - wad = fileSystem.GetLumpFile(map->lumpnum); + wad = fileSystem.GetFileContainer(map->lumpnum); delete map; } const char * name = fileSystem.GetResourceFileName(wad); diff --git a/src/gamedata/stringtable.cpp b/src/gamedata/stringtable.cpp index 742d90831b..ce777f2b3d 100644 --- a/src/gamedata/stringtable.cpp +++ b/src/gamedata/stringtable.cpp @@ -65,7 +65,7 @@ void FStringTable::LoadStrings () lastlump = 0; while ((lump = fileSystem.FindLump ("LANGUAGE", &lastlump)) != -1) { - auto lumpdata = fileSystem.ReadLumpIntoArray(lump); + auto lumpdata = fileSystem.GetFileData(lump); if (!ParseLanguageCSV(lump, lumpdata)) LoadLanguage (lump, lumpdata); @@ -163,7 +163,7 @@ TArray> FStringTable::parseCSV(const TArray &buffer) bool FStringTable::readMacros(int lumpnum) { - auto lumpdata = fileSystem.ReadLumpIntoArray(lumpnum); + auto lumpdata = fileSystem.GetFileData(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 = fileSystem.GetLumpFile(lumpnum); + auto filenum = fileSystem.GetFileContainer(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 = { fileSystem.GetLumpFile(lumpnum), { string, string, string, string } }; + TableElement te = { fileSystem.GetFileContainer(lumpnum), { string, string, string, string } }; long index; while ((index = te.strings[0].IndexOf("@[")) >= 0) { diff --git a/src/gamedata/textures/anim_switches.cpp b/src/gamedata/textures/anim_switches.cpp index a899af2d0e..1adcfd1deb 100644 --- a/src/gamedata/textures/anim_switches.cpp +++ b/src/gamedata/textures/anim_switches.cpp @@ -64,7 +64,7 @@ void FTextureManager::InitSwitchList () if (lump != -1) { - FileData lumpdata = fileSystem.ReadLump (lump); + FileData lumpdata = fileSystem.ReadFile (lump); const char *alphSwitchList = (const char *)lumpdata.GetMem(); const char *list_p; FSwitchDef *def1, *def2; diff --git a/src/gamedata/textures/animations.cpp b/src/gamedata/textures/animations.cpp index 477a5c4baf..5a8b5a9603 100644 --- a/src/gamedata/textures/animations.cpp +++ b/src/gamedata/textures/animations.cpp @@ -182,7 +182,7 @@ void FTextureManager::InitAnimated (void) int lumpnum = fileSystem.CheckNumForName ("ANIMATED"); if (lumpnum != -1) { - FileData animatedlump = fileSystem.ReadLump (lumpnum); + FileData animatedlump = fileSystem.ReadFile (lumpnum); int animatedlen = fileSystem.FileLength(lumpnum); const uint8_t *animdefs = (const uint8_t *)animatedlump.GetMem(); const uint8_t *anim_p; @@ -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(), fileSystem.GetLumpFile(tex1->GetSourceLump()), - tex2->Name.GetChars(), pic2.GetIndex(), tex2->GetSourceLump(), fileSystem.GetLumpFile(tex2->GetSourceLump())); + tex1->Name.GetChars(), pic1.GetIndex(), tex1->GetSourceLump(), fileSystem.GetFileContainer(tex1->GetSourceLump()), + tex2->Name.GetChars(), pic2.GetIndex(), tex2->GetSourceLump(), fileSystem.GetFileContainer(tex2->GetSourceLump())); } if (pic1 == pic2) diff --git a/src/gamedata/textures/formats/automaptexture.cpp b/src/gamedata/textures/formats/automaptexture.cpp index fbb46ed896..f6c5e0101d 100644 --- a/src/gamedata/textures/formats/automaptexture.cpp +++ b/src/gamedata/textures/formats/automaptexture.cpp @@ -67,7 +67,7 @@ public: FImageSource *AutomapImage_TryCreate(FileReader &data, int lumpnum) { if (data.GetLength() < 320) return nullptr; - if (!fileSystem.CheckLumpName(lumpnum, "AUTOPAGE")) return nullptr; + if (!fileSystem.CheckFileName(lumpnum, "AUTOPAGE")) return nullptr; return new FAutomapTexture(lumpnum); } @@ -94,7 +94,7 @@ FAutomapTexture::FAutomapTexture (int lumpnum) TArray FAutomapTexture::CreatePalettedPixels(int conversion) { int x, y; - FileData data = fileSystem.ReadLump (SourceLump); + FileData data = fileSystem.ReadFile (SourceLump); const uint8_t *indata = (const uint8_t *)data.GetMem(); TArray Pixels(Width * Height, true); diff --git a/src/gamedata/textures/formats/buildtexture.cpp b/src/gamedata/textures/formats/buildtexture.cpp index 4de856681c..97dbb1b1f9 100644 --- a/src/gamedata/textures/formats/buildtexture.cpp +++ b/src/gamedata/textures/formats/buildtexture.cpp @@ -243,7 +243,7 @@ static int BuildPaletteTranslation(int lump) return false; } - FileData data = fileSystem.ReadLump(lump); + FileData data = fileSystem.ReadFile(lump); const uint8_t *ipal = (const uint8_t *)data.GetMem(); FRemapTable opal; @@ -309,10 +309,10 @@ 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 = fileSystem.GetNumLumps(); + int numlumps = fileSystem.GetNumEntries(); for (int i = 0; i < numlumps; i++) { - const char *name = fileSystem.GetLumpFullName(i); + const char *name = fileSystem.GetFileFullName(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(); @@ -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 = fileSystem.CheckNumForFullName(artpath, fileSystem.GetLumpFile(i)); + lumpnum = fileSystem.CheckNumForFullName(artpath, fileSystem.GetFileContainer(i)); if (lumpnum < 0) { break; @@ -337,7 +337,7 @@ void FTextureManager::InitBuildTiles() BuildTileData.Reserve(1); auto &artdata = BuildTileData.Last(); artdata.Resize(fileSystem.FileLength(lumpnum)); - fileSystem.ReadLump(lumpnum, &artdata[0]); + fileSystem.ReadFile(lumpnum, &artdata[0]); if ((numtiles = CountTiles(&artdata[0])) > 0) { diff --git a/src/gamedata/textures/formats/ddstexture.cpp b/src/gamedata/textures/formats/ddstexture.cpp index 5aaa625db6..8120486521 100644 --- a/src/gamedata/textures/formats/ddstexture.cpp +++ b/src/gamedata/textures/formats/ddstexture.cpp @@ -374,7 +374,7 @@ void FDDSTexture::CalcBitShift (uint32_t mask, uint8_t *lshiftp, uint8_t *rshift TArray FDDSTexture::CreatePalettedPixels(int conversion) { - auto lump = fileSystem.OpenLumpReader (SourceLump); + auto lump = fileSystem.OpenFileReader (SourceLump); TArray 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 = fileSystem.OpenLumpReader (SourceLump); + auto lump = fileSystem.OpenFileReader (SourceLump); uint8_t *TexBuffer = bmp->GetPixels(); diff --git a/src/gamedata/textures/formats/flattexture.cpp b/src/gamedata/textures/formats/flattexture.cpp index 5eb3e077ec..792753fea4 100644 --- a/src/gamedata/textures/formats/flattexture.cpp +++ b/src/gamedata/textures/formats/flattexture.cpp @@ -106,7 +106,7 @@ FFlatTexture::FFlatTexture (int lumpnum) TArray FFlatTexture::CreatePalettedPixels(int conversion) { - auto lump = fileSystem.OpenLumpReader (SourceLump); + auto lump = fileSystem.OpenFileReader (SourceLump); TArray Pixels(Width*Height, true); auto numread = lump.Read (Pixels.Data(), Width*Height); if (numread < Width*Height) diff --git a/src/gamedata/textures/formats/fontchars.cpp b/src/gamedata/textures/formats/fontchars.cpp index 7ec2225116..c01d4195ee 100644 --- a/src/gamedata/textures/formats/fontchars.cpp +++ b/src/gamedata/textures/formats/fontchars.cpp @@ -124,7 +124,7 @@ void FFontChar2::SetSourceRemap(const uint8_t *sourceremap) TArray FFontChar2::CreatePalettedPixels(int) { - auto lump = fileSystem.OpenLumpReader (SourceLump); + auto lump = fileSystem.OpenFileReader (SourceLump); int destSize = Width * Height; uint8_t max = 255; bool rle = true; @@ -233,7 +233,7 @@ TArray FFontChar2::CreatePalettedPixels(int) if (destSize < 0) { char name[9]; - fileSystem.GetLumpName (name, SourceLump); + fileSystem.GetFileShortName (name, SourceLump); name[8] = 0; I_FatalError ("The font %s is corrupt", name); } diff --git a/src/gamedata/textures/formats/imgztexture.cpp b/src/gamedata/textures/formats/imgztexture.cpp index c9c1168159..08160cf9ca 100644 --- a/src/gamedata/textures/formats/imgztexture.cpp +++ b/src/gamedata/textures/formats/imgztexture.cpp @@ -122,7 +122,7 @@ FIMGZTexture::FIMGZTexture (int lumpnum, uint16_t w, uint16_t h, int16_t l, int1 TArray FIMGZTexture::CreatePalettedPixels(int conversion) { - FileData lump = fileSystem.ReadLump (SourceLump); + FileData lump = fileSystem.ReadFile (SourceLump); const ImageHeader *imgz = (const ImageHeader *)lump.GetMem(); const uint8_t *data = (const uint8_t *)&imgz[1]; diff --git a/src/gamedata/textures/formats/jpegtexture.cpp b/src/gamedata/textures/formats/jpegtexture.cpp index 1d55bb694f..3234889f50 100644 --- a/src/gamedata/textures/formats/jpegtexture.cpp +++ b/src/gamedata/textures/formats/jpegtexture.cpp @@ -262,7 +262,7 @@ FJPEGTexture::FJPEGTexture (int lumpnum, int width, int height) TArray FJPEGTexture::CreatePalettedPixels(int conversion) { - auto lump = fileSystem.OpenLumpReader (SourceLump); + auto lump = fileSystem.OpenFileReader (SourceLump); JSAMPLE *buff = NULL; jpeg_decompress_struct cinfo; @@ -286,7 +286,7 @@ TArray 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", fileSystem.GetLumpFullPath(SourceLump).GetChars()); + Printf(TEXTCOLOR_ORANGE "Unsupported color format in %s\n", fileSystem.GetFileFullPath(SourceLump).GetChars()); } else { @@ -363,7 +363,7 @@ TArray FJPEGTexture::CreatePalettedPixels(int conversion) } catch (int) { - Printf(TEXTCOLOR_ORANGE "JPEG error in %s\n", fileSystem.GetLumpFullPath(SourceLump).GetChars()); + Printf(TEXTCOLOR_ORANGE "JPEG error in %s\n", fileSystem.GetFileFullPath(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 = fileSystem.OpenLumpReader (SourceLump); + auto lump = fileSystem.OpenFileReader (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", fileSystem.GetLumpFullPath(SourceLump).GetChars()); + Printf(TEXTCOLOR_ORANGE "Unsupported color format in %s\n", fileSystem.GetFileFullPath(SourceLump).GetChars()); } else { @@ -454,7 +454,7 @@ int FJPEGTexture::CopyPixels(FBitmap *bmp, int conversion) } catch (int) { - Printf(TEXTCOLOR_ORANGE "JPEG error in %s\n", fileSystem.GetLumpFullPath(SourceLump).GetChars()); + Printf(TEXTCOLOR_ORANGE "JPEG error in %s\n", fileSystem.GetFileFullPath(SourceLump).GetChars()); } jpeg_destroy_decompress(&cinfo); return 0; diff --git a/src/gamedata/textures/formats/patchtexture.cpp b/src/gamedata/textures/formats/patchtexture.cpp index 6b1d83b7b2..9ca4228ebd 100644 --- a/src/gamedata/textures/formats/patchtexture.cpp +++ b/src/gamedata/textures/formats/patchtexture.cpp @@ -170,7 +170,7 @@ TArray FPatchTexture::CreatePalettedPixels(int conversion) const column_t *maxcol; int x; - FileData lump = fileSystem.ReadLump (SourceLump); + FileData lump = fileSystem.ReadFile (SourceLump); const patch_t *patch = (const patch_t *)lump.GetMem(); maxcol = (const column_t *)((const uint8_t *)patch + fileSystem.FileLength (SourceLump) - 3); @@ -280,7 +280,7 @@ void FPatchTexture::DetectBadPatches () // 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. - FileData lump = fileSystem.ReadLump (SourceLump); + FileData lump = fileSystem.ReadFile (SourceLump); const patch_t *realpatch = (patch_t *)lump.GetMem(); const uint32_t *cofs = realpatch->columnofs; int x, x2 = LittleShort(realpatch->width); diff --git a/src/gamedata/textures/formats/pcxtexture.cpp b/src/gamedata/textures/formats/pcxtexture.cpp index 074ae7a4a9..9489e1123a 100644 --- a/src/gamedata/textures/formats/pcxtexture.cpp +++ b/src/gamedata/textures/formats/pcxtexture.cpp @@ -352,7 +352,7 @@ TArray FPCXTexture::CreatePalettedPixels(int conversion) PCXHeader header; int bitcount; - auto lump = fileSystem.OpenLumpReader(SourceLump); + auto lump = fileSystem.OpenFileReader(SourceLump); lump.Read(&header, sizeof(header)); @@ -441,7 +441,7 @@ int FPCXTexture::CopyPixels(FBitmap *bmp, int conversion) int bitcount; TArray Pixels; - auto lump = fileSystem.OpenLumpReader(SourceLump); + auto lump = fileSystem.OpenFileReader(SourceLump); lump.Read(&header, sizeof(header)); diff --git a/src/gamedata/textures/formats/pngtexture.cpp b/src/gamedata/textures/formats/pngtexture.cpp index 546ebdcf89..1a70885e63 100644 --- a/src/gamedata/textures/formats/pngtexture.cpp +++ b/src/gamedata/textures/formats/pngtexture.cpp @@ -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", fileSystem.GetLumpFullName (lumpnum), ihotx, ihotx); + Printf ("X-Offset for PNG texture %s is bad: %d (0x%08x)\n", fileSystem.GetFileFullName (lumpnum), ihotx, ihotx); ihotx = 0; } if (ihoty < -32768 || ihoty > 32767) { - Printf ("Y-Offset for PNG texture %s is bad: %d (0x%08x)\n", fileSystem.GetLumpFullName (lumpnum), ihoty, ihoty); + Printf ("Y-Offset for PNG texture %s is bad: %d (0x%08x)\n", fileSystem.GetFileFullName (lumpnum), ihoty, ihoty); ihoty = 0; } LeftOffset = ihotx; @@ -312,7 +312,7 @@ TArray FPNGTexture::CreatePalettedPixels(int conversion) FileReader *lump; FileReader lfr; - lfr = fileSystem.OpenLumpReader(SourceLump); + lfr = fileSystem.OpenFileReader(SourceLump); lump = 𝔩 TArray Pixels(Width*Height, true); @@ -457,7 +457,7 @@ int FPNGTexture::CopyPixels(FBitmap *bmp, int conversion) FileReader *lump; FileReader lfr; - lfr = fileSystem.OpenLumpReader(SourceLump); + lfr = fileSystem.OpenFileReader(SourceLump); lump = 𝔩 lump->Seek(33, FileReader::SeekSet); diff --git a/src/gamedata/textures/formats/rawpagetexture.cpp b/src/gamedata/textures/formats/rawpagetexture.cpp index 449b52a0c3..5650fdde2c 100644 --- a/src/gamedata/textures/formats/rawpagetexture.cpp +++ b/src/gamedata/textures/formats/rawpagetexture.cpp @@ -158,7 +158,7 @@ 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; - fileSystem.GetLumpName(Name, lumpnum); + fileSystem.GetFileShortName(Name, lumpnum); if (Name.CompareNoCase("E2END") == 0 && gameinfo.gametype == GAME_Heretic) { mPaletteLump = fileSystem.CheckNumForName("E2PAL"); @@ -175,7 +175,7 @@ FRawPageTexture::FRawPageTexture (int lumpnum) TArray FRawPageTexture::CreatePalettedPixels(int conversion) { - FileData lump = fileSystem.ReadLump (SourceLump); + FileData lump = fileSystem.ReadFile (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 { - FileData lump = fileSystem.ReadLump(SourceLump); - FileData plump = fileSystem.ReadLump(mPaletteLump); + FileData lump = fileSystem.ReadFile(SourceLump); + FileData plump = fileSystem.ReadFile(mPaletteLump); const uint8_t *source = (const uint8_t *)lump.GetMem(); const uint8_t *psource = (const uint8_t *)plump.GetMem(); PalEntry paldata[256]; diff --git a/src/gamedata/textures/formats/stbtexture.cpp b/src/gamedata/textures/formats/stbtexture.cpp index baf8a6d114..2beaf12258 100644 --- a/src/gamedata/textures/formats/stbtexture.cpp +++ b/src/gamedata/textures/formats/stbtexture.cpp @@ -160,7 +160,7 @@ TArray FStbTexture::CreatePalettedPixels(int conversion) int FStbTexture::CopyPixels(FBitmap *bmp, int conversion) { - auto lump = fileSystem.OpenLumpReader (SourceLump); + auto lump = fileSystem.OpenFileReader (SourceLump); int x, y, chan; auto image = stbi_load_from_callbacks(&callbacks, &lump, &x, &y, &chan, STBI_rgb_alpha); if (image) diff --git a/src/gamedata/textures/formats/tgatexture.cpp b/src/gamedata/textures/formats/tgatexture.cpp index 94b523de19..065f107c30 100644 --- a/src/gamedata/textures/formats/tgatexture.cpp +++ b/src/gamedata/textures/formats/tgatexture.cpp @@ -182,7 +182,7 @@ void FTGATexture::ReadCompressed(FileReader &lump, uint8_t * buffer, int bytespe TArray FTGATexture::CreatePalettedPixels(int conversion) { uint8_t PaletteMap[256]; - auto lump = fileSystem.OpenLumpReader (SourceLump); + auto lump = fileSystem.OpenFileReader (SourceLump); TGAHeader hdr; uint16_t w; uint8_t r,g,b,a; @@ -389,7 +389,7 @@ TArray FTGATexture::CreatePalettedPixels(int conversion) int FTGATexture::CopyPixels(FBitmap *bmp, int conversion) { PalEntry pe[256]; - auto lump = fileSystem.OpenLumpReader (SourceLump); + auto lump = fileSystem.OpenFileReader (SourceLump); TGAHeader hdr; uint16_t w; uint8_t r,g,b,a; diff --git a/src/gamedata/textures/image.cpp b/src/gamedata/textures/image.cpp index 40b7a75a42..a0a9274c8d 100644 --- a/src/gamedata/textures/image.cpp +++ b/src/gamedata/textures/image.cpp @@ -83,7 +83,7 @@ PalettedPixels FImageSource::GetCachedPalettedPixels(int conversion) PalettedPixels ret; FString name; - fileSystem.GetLumpName(name, SourceLump); + fileSystem.GetFileShortName(name, SourceLump); std::pair *info = nullptr; auto imageID = ImageID; @@ -201,7 +201,7 @@ FBitmap FImageSource::GetCachedBitmap(PalEntry *remap, int conversion, int *ptra FString name; int trans = -1; - fileSystem.GetLumpName(name, SourceLump); + fileSystem.GetFileShortName(name, SourceLump); std::pair *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 = fileSystem.OpenLumpReader(lumpnum); + auto data = fileSystem.OpenFileReader(lumpnum); if (!data.isOpen()) return nullptr; diff --git a/src/gamedata/textures/imagetexture.cpp b/src/gamedata/textures/imagetexture.cpp index 5c49b6c51c..6b538499a5 100644 --- a/src/gamedata/textures/imagetexture.cpp +++ b/src/gamedata/textures/imagetexture.cpp @@ -54,7 +54,7 @@ FImageTexture::FImageTexture(FImageSource *img, const char *name) mImage = img; if (img != nullptr) { - if (name == nullptr) fileSystem.GetLumpName(Name, img->LumpNum()); + if (name == nullptr) fileSystem.GetFileShortName(Name, img->LumpNum()); Width = img->GetWidth(); Height = img->GetHeight(); diff --git a/src/gamedata/textures/multipatchtexturebuilder.cpp b/src/gamedata/textures/multipatchtexturebuilder.cpp index 48a76a2b0c..ad345bcf65 100644 --- a/src/gamedata/textures/multipatchtexturebuilder.cpp +++ b/src/gamedata/textures/multipatchtexturebuilder.cpp @@ -283,7 +283,7 @@ void FMultipatchTextureBuilder::AddTexturesLump(const void *lumpdata, int lumpsi } { - auto pnames = fileSystem.OpenLumpReader(patcheslump); + auto pnames = fileSystem.OpenFileReader(patcheslump); numpatches = pnames.ReadUInt32(); // Check whether the amount of names reported is correct. @@ -406,12 +406,12 @@ void FMultipatchTextureBuilder::AddTexturesLumps(int lump1, int lump2, int patch if (lump1 >= 0) { - FileData texdir = fileSystem.ReadLump(lump1); + FileData texdir = fileSystem.ReadFile(lump1); AddTexturesLump(texdir.GetMem(), fileSystem.FileLength(lump1), lump1, patcheslump, firstdup, true); } if (lump2 >= 0) { - FileData texdir = fileSystem.ReadLump(lump2); + FileData texdir = fileSystem.ReadFile(lump2); AddTexturesLump(texdir.GetMem(), fileSystem.FileLength(lump2), lump2, patcheslump, firstdup, false); } } diff --git a/src/gamedata/textures/texture.cpp b/src/gamedata/textures/texture.cpp index 635eb44c49..3b639e3773 100644 --- a/src/gamedata/textures/texture.cpp +++ b/src/gamedata/textures/texture.cpp @@ -165,7 +165,7 @@ FTexture::FTexture (const char *name, int lumpnum) } else { - fileSystem.GetLumpName (Name, lumpnum); + fileSystem.GetFileShortName (Name, lumpnum); } } @@ -394,7 +394,7 @@ void FTexture::AddAutoMaterials() auto lump = fileSystem.CheckNumForFullName(lookup, false, ns_global, true); if (lump != -1) { - auto bmtex = TexMan.FindTexture(fileSystem.GetLumpFullName(lump), ETextureType::Any, FTextureManager::TEXMAN_TryAny); + auto bmtex = TexMan.FindTexture(fileSystem.GetFileFullName(lump), ETextureType::Any, FTextureManager::TEXMAN_TryAny); if (bmtex != nullptr) { bmtex->bMasked = false; diff --git a/src/gamedata/textures/texturemanager.cpp b/src/gamedata/textures/texturemanager.cpp index 0109108982..1c21bcb52c 100644 --- a/src/gamedata/textures/texturemanager.cpp +++ b/src/gamedata/textures/texturemanager.cpp @@ -443,7 +443,7 @@ 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 = fileSystem.GetLumpFile(Textures[texnum.GetIndex()].Texture->SourceLump); + int file = fileSystem.GetFileContainer(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; - fileSystem.GetLumpName(str, lumpnum); + fileSystem.GetFileShortName(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", fileSystem.GetLumpFullPath(lumpnum).GetChars()); + Printf (TEXTCOLOR_ORANGE "Invalid data encountered for texture %s\n", fileSystem.GetFileFullPath(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 = fileSystem.GetFirstLump(wadnum); - int lasttx = fileSystem.GetLastLump(wadnum); + int firsttx = fileSystem.GetFirstEntry(wadnum); + int lasttx = fileSystem.GetLastEntry(wadnum); FString Name; // Go from first to last so that ANIMDEFS work as expected. However, @@ -597,9 +597,9 @@ void FTextureManager::AddGroup(int wadnum, int ns, ETextureType usetype) for (; firsttx <= lasttx; ++firsttx) { - if (fileSystem.GetLumpNamespace(firsttx) == ns) + if (fileSystem.GetFileNamespace(firsttx) == ns) { - fileSystem.GetLumpName (Name, firsttx); + fileSystem.GetFileShortName (Name, firsttx); if (fileSystem.CheckNumForName (Name, ns) == firsttx) { @@ -626,8 +626,8 @@ void FTextureManager::AddGroup(int wadnum, int ns, ETextureType usetype) void FTextureManager::AddHiresTextures (int wadnum) { - int firsttx = fileSystem.GetFirstLump(wadnum); - int lasttx = fileSystem.GetLastLump(wadnum); + int firsttx = fileSystem.GetFirstEntry(wadnum); + int lasttx = fileSystem.GetLastEntry(wadnum); FString Name; TArray tlist; @@ -639,9 +639,9 @@ void FTextureManager::AddHiresTextures (int wadnum) for (;firsttx <= lasttx; ++firsttx) { - if (fileSystem.GetLumpNamespace(firsttx) == ns_hires) + if (fileSystem.GetFileNamespace(firsttx) == ns_hires) { - fileSystem.GetLumpName (Name, firsttx); + fileSystem.GetFileShortName (Name, firsttx); if (fileSystem.CheckNumForName (Name, ns_hires) == firsttx) { @@ -697,7 +697,7 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname, FMultipa while ((remapLump = fileSystem.FindLump(lumpname, &lastLump)) != -1) { - if (fileSystem.GetLumpFile(remapLump) == wadnum) + if (fileSystem.GetFileContainer(remapLump) == wadnum) { ParseTextureDef(remapLump, build); } @@ -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 && fileSystem.GetLumpNamespace(sl) == ns_sprites) + (sl=oldtex->GetSourceLump()) >= 0 && fileSystem.GetFileNamespace(sl) == ns_sprites) ) { FTexture * newtex = FTexture::CreateTexture ("", lumpnum, ETextureType::Any); @@ -869,7 +869,7 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build void FTextureManager::AddPatches (int lumpnum) { - auto file = fileSystem.ReopenLumpReader (lumpnum, true); + auto file = fileSystem.ReopenFileReader (lumpnum, true); uint32_t numpatches, i; char name[9]; @@ -911,7 +911,7 @@ 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 (fileSystem.GetLumpFile(pnames) == wadnum) TexMan.AddPatches (pnames); + if (fileSystem.GetFileContainer(pnames) == wadnum) TexMan.AddPatches (pnames); int texlump1 = fileSystem.CheckNumForName ("TEXTURE1", ns_global, wadnum); int texlump2 = fileSystem.CheckNumForName ("TEXTURE2", ns_global, wadnum); @@ -927,7 +927,7 @@ void FTextureManager::LoadTextureX(int wadnum, FMultipatchTextureBuilder &build) void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &build) { int firsttexture = Textures.Size(); - int lumpcount = fileSystem.GetNumLumps(); + int lumpcount = fileSystem.GetNumEntries(); bool iwad = wadnum >= fileSystem.GetIwadNum() && wadnum <= fileSystem.GetMaxIwadNum(); FirstTextureForFile.Push(firsttexture); @@ -949,37 +949,37 @@ 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 = fileSystem.GetFirstLump(wadnum); - int lasttx = fileSystem.GetLastLump(wadnum); + int firsttx = fileSystem.GetFirstEntry(wadnum); + int lasttx = fileSystem.GetLastEntry(wadnum); for (int i= firsttx; i <= lasttx; i++) { bool skin = false; FString Name; - fileSystem.GetLumpName(Name, i); + fileSystem.GetFileShortName(Name, i); // Ignore anything not in the global namespace - int ns = fileSystem.GetLumpNamespace(i); + int ns = fileSystem.GetFileNamespace(i); if (ns == ns_global) { // In Zips all graphics must be in a separate namespace. if (fileSystem.GetFileFlags(i) & LUMPF_FULLPATH) continue; // Ignore lumps with empty names. - if (fileSystem.CheckLumpName(i, "")) continue; + if (fileSystem.CheckFileName(i, "")) continue; // Ignore anything belonging to a map - 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; + if (fileSystem.CheckFileName(i, "THINGS")) continue; + if (fileSystem.CheckFileName(i, "LINEDEFS")) continue; + if (fileSystem.CheckFileName(i, "SIDEDEFS")) continue; + if (fileSystem.CheckFileName(i, "VERTEXES")) continue; + if (fileSystem.CheckFileName(i, "SEGS")) continue; + if (fileSystem.CheckFileName(i, "SSECTORS")) continue; + if (fileSystem.CheckFileName(i, "NODES")) continue; + if (fileSystem.CheckFileName(i, "SECTORS")) continue; + if (fileSystem.CheckFileName(i, "REJECT")) continue; + if (fileSystem.CheckFileName(i, "BLOCKMAP")) continue; + if (fileSystem.CheckFileName(i, "BEHAVIOR")) continue; bool force = false; // Don't bother looking at this lump if something later overrides it. @@ -1102,7 +1102,7 @@ void FTextureManager::SortTexturesByType(int start, int end) void FTextureManager::AddLocalizedVariants() { TArray content; - fileSystem.GetLumpsInFolder("localized/textures/", content, false); + fileSystem.GetFilesInFolder("localized/textures/", content, false); for (auto &entry : content) { FString name = entry.name; @@ -1351,9 +1351,9 @@ int FTextureManager::GuesstimateNumTextures () { int numtex = 0; - for(int i = fileSystem.GetNumLumps()-1; i>=0; i--) + for(int i = fileSystem.GetNumEntries()-1; i>=0; i--) { - int space = fileSystem.GetLumpNamespace(i); + int space = fileSystem.GetFileNamespace(i); switch(space) { case ns_flats: @@ -1400,7 +1400,7 @@ int FTextureManager::CountTexturesX () // Only count the patches if the PNAMES come from the current file // Otherwise they have already been counted. - if (fileSystem.GetLumpFile(pnames) == wadnum) + if (fileSystem.GetFileContainer(pnames) == wadnum) { count += CountLumpTextures (pnames); } @@ -1426,7 +1426,7 @@ int FTextureManager::CountLumpTextures (int lumpnum) { if (lumpnum >= 0) { - auto file = fileSystem.OpenLumpReader (lumpnum); + auto file = fileSystem.OpenFileReader (lumpnum); uint32_t numtex = file.ReadUInt32();; return int(numtex) >= 0 ? numtex : 0; @@ -1446,18 +1446,18 @@ void FTextureManager::AdjustSpriteOffsets() int sprid; TMap donotprocess; - int numtex = fileSystem.GetNumLumps(); + int numtex = fileSystem.GetNumEntries(); for (int i = 0; i < numtex; i++) { - 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()) + if (fileSystem.GetFileContainer(i) > fileSystem.GetMaxIwadNum()) break; // we are past the IWAD + if (fileSystem.GetFileNamespace(i) == ns_sprites && fileSystem.GetFileContainer(i) >= fileSystem.GetIwadNum() && fileSystem.GetFileContainer(i) <= fileSystem.GetMaxIwadNum()) { char str[9]; - fileSystem.GetLumpName(str, i); + fileSystem.GetFileShortName(str, i); str[8] = 0; FTextureID texid = TexMan.CheckForTexture(str, ETextureType::Sprite, 0); - if (texid.isValid() && fileSystem.GetLumpFile(GetTexture(texid)->SourceLump) > fileSystem.GetMaxIwadNum()) + if (texid.isValid() && fileSystem.GetFileContainer(GetTexture(texid)->SourceLump) > fileSystem.GetMaxIwadNum()) { // This texture has been replaced by some PWAD. memcpy(&sprid, str, 4); @@ -1471,7 +1471,7 @@ void FTextureManager::AdjustSpriteOffsets() FScanner sc; sc.OpenLumpNum(lump); sc.SetCMode(true); - int ofslumpno = fileSystem.GetLumpFile(lump); + int ofslumpno = fileSystem.GetFileContainer(lump); while (sc.GetString()) { int x, y; @@ -1496,9 +1496,9 @@ 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 < fileSystem.GetNumLumps()) + if (lumpnum >= 0 && lumpnum < fileSystem.GetNumEntries()) { - int wadno = fileSystem.GetLumpFile(lumpnum); + int wadno = fileSystem.GetFileContainer(lumpnum); if ((iwadonly && wadno >= fileSystem.GetIwadNum() && wadno <= fileSystem.GetMaxIwadNum()) || (!iwadonly && wadno == ofslumpno)) { if (wadno >= fileSystem.GetIwadNum() && wadno <= fileSystem.GetMaxIwadNum() && !forced && iwadonly) @@ -1547,7 +1547,7 @@ void FTextureManager::GenerateGlobalBrightmapFromColormap() int lump = fileSystem.CheckNumForName("COLORMAP"); if (lump == -1) lump = fileSystem.CheckNumForName("COLORMAP", ns_colormaps); if (lump == -1) return; - FileData cmap = fileSystem.ReadLump(lump); + FileData cmap = fileSystem.ReadFile(lump); uint8_t palbuffer[768]; ReadPalette(fileSystem.GetNumForName("PLAYPAL"), palbuffer); @@ -1603,7 +1603,7 @@ 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 (fileSystem.GetLinkedTexture(lump) == tex) - retval = fileSystem.GetLumpFullName(lump); + retval = fileSystem.GetFileFullName(lump); } } ACTION_RETURN_STRING(retval); diff --git a/src/gamedata/w_wad.cpp b/src/gamedata/w_wad.cpp index 9d04c91683..3bd664aca0 100644 --- a/src/gamedata/w_wad.cpp +++ b/src/gamedata/w_wad.cpp @@ -40,17 +40,15 @@ #include #include -#include "doomtype.h" #include "m_argv.h" #include "cmdlib.h" -#include "c_dispatch.h" #include "w_wad.h" #include "m_crc32.h" -#include "v_text.h" -#include "gi.h" +#include "printf.h" #include "resourcefiles/resourcefile.h" #include "md5.h" -#include "doomstat.h" + +extern FILE* hashfile; // MACROS ------------------------------------------------------------------ @@ -63,14 +61,14 @@ struct FileSystem::LumpRecord FTexture* linkedTexture; LumpShortName shortName; FString longName; - int wadnum; + int rfnum; int Namespace; int resourceId; void SetFromLump(int filenum, FResourceLump* lmp) { lump = lmp; - wadnum = filenum; + rfnum = filenum; linkedTexture = nullptr; if (lump->Flags & LUMPF_SHORTNAME) @@ -80,27 +78,6 @@ struct FileSystem::LumpRecord longName = ""; Namespace = lump->GetNamespace(); resourceId = 0; - - if (gameinfo.gametype == GAME_Strife && gameinfo.flags & GI_SHAREWARE && filenum == fileSystem.GetIwadNum()) - { - if (shortName.String[0] == 'V' && - shortName.String[1] == 'O' && - shortName.String[2] == 'C') - { - int j; - - for (j = 3; j < 8; ++j) - { - if (shortName.String[j] != 0 && !isdigit(shortName.String[j])) - break; - } - if (j == 8) - { - Namespace = ns_strifevoices; - } - } - } - } else if ((lump->Flags & LUMPF_EMBEDDED) || !lump->getName() || !*lump->getName()) { @@ -189,7 +166,7 @@ void FileSystem::DeleteAll () // explicitly delete all manually added lumps. for (auto &frec : FileInfo) { - if (frec.wadnum == -1) delete frec.lump; + if (frec.rfnum == -1) delete frec.lump; } FileInfo.Clear(); for (int i = Files.Size() - 1; i >= 0; --i) @@ -204,7 +181,7 @@ void FileSystem::DeleteAll () // InitMultipleFiles // // Pass a null terminated list of files to use. All files are optional, -// but at least one file must be found. Lump names can appear multiple +// but at least one file must be found. File names can appear multiple // times. The name searcher looks backwards, so a later file can // override an earlier one. // @@ -519,7 +496,7 @@ int FileSystem::CheckNumForName (const char *name, int space) return i != NULL_INDEX ? i : -1; } -int FileSystem::CheckNumForName (const char *name, int space, int wadnum, bool exact) +int FileSystem::CheckNumForName (const char *name, int space, int rfnum, bool exact) { union { @@ -528,7 +505,7 @@ int FileSystem::CheckNumForName (const char *name, int space, int wadnum, bool e }; uint32_t i; - if (wadnum < 0) + if (rfnum < 0) { return CheckNumForName (name, space); } @@ -541,7 +518,7 @@ int FileSystem::CheckNumForName (const char *name, int space, int wadnum, bool e while (i != NULL_INDEX && (FileInfo[i].shortName.qword != qname || FileInfo[i].Namespace != space || - (exact? (FileInfo[i].wadnum != wadnum) : (FileInfo[i].wadnum > wadnum)) )) + (exact? (FileInfo[i].rfnum != rfnum) : (FileInfo[i].rfnum > rfnum)) )) { i = NextLumpIndex[i]; } @@ -613,11 +590,11 @@ int FileSystem::CheckNumForFullName (const char *name, bool trynormal, int names return -1; } -int FileSystem::CheckNumForFullName (const char *name, int wadnum) +int FileSystem::CheckNumForFullName (const char *name, int rfnum) { uint32_t i; - if (wadnum < 0) + if (rfnum < 0) { return CheckNumForFullName (name); } @@ -625,7 +602,7 @@ int FileSystem::CheckNumForFullName (const char *name, int wadnum) i = FirstLumpIndex_FullName[MakeKey (name) % NumEntries]; while (i != NULL_INDEX && - (stricmp(name, FileInfo[i].longName) || FileInfo[i].wadnum != wadnum)) + (stricmp(name, FileInfo[i].longName) || FileInfo[i].rfnum != rfnum)) { i = NextLumpIndex_FullName[i]; } @@ -707,15 +684,13 @@ int FileSystem::FindResource (int resid, const char *type, int filenum) const no { return -1; } - FName lname(type, true); - if (lname == NAME_None) return -1; uint32_t* fli = FirstLumpIndex_ResId; uint32_t* nli = NextLumpIndex_ResId; for (i = fli[resid % NumEntries]; i != NULL_INDEX; i = nli[i]) { - if (filenum > 0 && FileInfo[i].wadnum != filenum) continue; + if (filenum > 0 && FileInfo[i].rfnum != filenum) continue; if (FileInfo[i].resourceId != resid) continue; auto extp = strrchr(FileInfo[i].longName, '.'); if (!extp) continue; @@ -940,20 +915,20 @@ static FResourceLump placeholderLump; void FileSystem::MoveLumpsInFolder(const char *path) { auto len = strlen(path); - auto wadnum = FileInfo.Last().wadnum; + auto rfnum = FileInfo.Last().rfnum; unsigned i; for (i = 0; i < FileInfo.Size(); i++) { auto& li = FileInfo[i]; - if (li.wadnum >= GetIwadNum()) break; + if (li.rfnum >= GetIwadNum()) break; if (li.longName.Left(len).CompareNoCase(path) == 0) { FileInfo.Push(li); li.lump = &placeholderLump; // Make the old entry point to something empty. We cannot delete the lump record here because it'd require adjustment of all indices in the list. auto &ln = FileInfo.Last(); ln.lump->LumpNameSetup(ln.longName.Mid(len)); - ln.SetFromLump(wadnum, ln.lump); + ln.SetFromLump(rfnum, ln.lump); } } } @@ -1039,7 +1014,7 @@ int FileSystem::FindLumpMulti (const char **names, int *lastlump, bool anyns, in // //========================================================================== -bool FileSystem::CheckLumpName (int lump, const char *name) +bool FileSystem::CheckFileName (int lump, const char *name) { if ((size_t)lump >= NumEntries) return false; @@ -1049,11 +1024,11 @@ bool FileSystem::CheckLumpName (int lump, const char *name) //========================================================================== // -// W_GetLumpName +// GetLumpName // //========================================================================== -void FileSystem::GetLumpName (char *to, int lump) const +void FileSystem::GetFileShortName (char *to, int lump) const { if ((size_t)lump >= NumEntries) *to = 0; @@ -1061,7 +1036,7 @@ void FileSystem::GetLumpName (char *to, int lump) const uppercopy (to, FileInfo[lump].shortName.String); } -const char* FileSystem::GetLumpName(int lump) const +const char* FileSystem::GetFileShortName(int lump) const { if ((size_t)lump >= NumEntries) return nullptr; @@ -1069,7 +1044,7 @@ const char* FileSystem::GetLumpName(int lump) const return FileInfo[lump].shortName.String; } -void FileSystem::GetLumpName(FString &to, int lump) const +void FileSystem::GetFileShortName(FString &to, int lump) const { if ((size_t)lump >= NumEntries) to = FString(); @@ -1081,13 +1056,13 @@ void FileSystem::GetLumpName(FString &to, int lump) const //========================================================================== // -// FileSystem :: GetLumpFullName +// FileSystem :: GetFileFullName // // Returns the lump's full name if it has one or its short name if not. // //========================================================================== -const char *FileSystem::GetLumpFullName (int lump, bool returnshort) const +const char *FileSystem::GetFileFullName (int lump, bool returnshort) const { if ((size_t)lump >= NumEntries) return NULL; @@ -1100,30 +1075,30 @@ const char *FileSystem::GetLumpFullName (int lump, bool returnshort) const //========================================================================== // -// FileSystem :: GetLumpFullPath +// FileSystem :: GetFileFullPath // // Returns the name of the lump's wad prefixed to the lump's full name. // //========================================================================== -FString FileSystem::GetLumpFullPath(int lump) const +FString FileSystem::GetFileFullPath(int lump) const { FString foo; if ((size_t) lump < NumEntries) { - foo << GetResourceFileName(FileInfo[lump].wadnum) << ':' << GetLumpFullName(lump); + foo << GetResourceFileName(FileInfo[lump].rfnum) << ':' << GetFileFullName(lump); } return foo; } //========================================================================== // -// GetLumpNamespace +// GetFileNamespace // //========================================================================== -int FileSystem::GetLumpNamespace (int lump) const +int FileSystem::GetFileNamespace (int lump) const { if ((size_t)lump >= NumEntries) return ns_global; @@ -1131,9 +1106,14 @@ int FileSystem::GetLumpNamespace (int lump) const return FileInfo[lump].Namespace; } +void FileSystem::SetFileNamespace(int lump, int ns) +{ + if ((size_t)lump < NumEntries) FileInfo[lump].Namespace = ns; +} + //========================================================================== // -// FileSystem :: GetLumpIndexNum +// FileSystem :: GetResourceId // // 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 @@ -1141,43 +1121,51 @@ int FileSystem::GetLumpNamespace (int lump) const // //========================================================================== -int FileSystem::GetLumpIndexNum(int lump) const +int FileSystem::GetResourceId(int lump) const { if ((size_t)lump >= NumEntries) - return 0; + return -1; else return FileInfo[lump].resourceId; } //========================================================================== // -// W_GetLumpFile +// GetResourceType +// +// is equivalent with the extension // //========================================================================== -int FileSystem::GetLumpFile (int lump) const +const char *FileSystem::GetResourceType(int lump) const +{ + if ((size_t)lump >= NumEntries) + return nullptr; + else + { + auto p = strrchr(FileInfo[lump].longName.GetChars(), '.'); + if (!p) return ""; // has no extension + if (strchr(p, '/')) return ""; // the '.' is part of a directory. + return p + 1; + } +} + +//========================================================================== +// +// GetFileContainer +// +//========================================================================== + +int FileSystem::GetFileContainer (int lump) const { if ((size_t)lump >= FileInfo.Size()) return -1; - return FileInfo[lump].wadnum; + return FileInfo[lump].rfnum; } //========================================================================== // -// W_GetLumpFile -// -//========================================================================== - -FResourceLump *FileSystem::GetLumpRecord(int lump) const -{ - if ((size_t)lump >= FileInfo.Size()) - return nullptr; - return FileInfo[lump].lump; -} - -//========================================================================== -// -// GetLumpsInFolder +// GetFilesInFolder // // Gets all lumps within a single folder in the hierarchy. // If 'atomic' is set, it treats folders as atomic, i.e. only the @@ -1192,7 +1180,13 @@ static int folderentrycmp(const void *a, const void *b) return strcmp(A->name, B->name); } -unsigned FileSystem::GetLumpsInFolder(const char *inpath, TArray &result, bool atomic) const +//========================================================================== +// +// +// +//========================================================================== + +unsigned FileSystem::GetFilesInFolder(const char *inpath, TArray &result, bool atomic) const { FString path = inpath; FixPathSeperator(path); @@ -1218,13 +1212,13 @@ unsigned FileSystem::GetLumpsInFolder(const char *inpath, TArray &r // Find the highest resource file having content in the given folder. for (auto & entry : result) { - int thisfile = fileSystem.GetLumpFile(entry.lumpnum); + int thisfile = fileSystem.GetFileContainer(entry.lumpnum); if (thisfile > maxfile) maxfile = thisfile; } // Delete everything from older files. for (int i = result.Size() - 1; i >= 0; i--) { - if (fileSystem.GetLumpFile(result[i].lumpnum) != maxfile) result.Delete(i); + if (fileSystem.GetFileContainer(result[i].lumpnum) != maxfile) result.Delete(i); } } qsort(result.Data(), result.Size(), sizeof(FolderEntry), folderentrycmp); @@ -1234,76 +1228,79 @@ unsigned FileSystem::GetLumpsInFolder(const char *inpath, TArray &r //========================================================================== // -// W_ReadLump -// -// Loads the lump into the given buffer, which must be >= W_LumpLength(). -// -//========================================================================== - -void FileSystem::ReadLump (int lump, void *dest) -{ - auto lumpr = OpenLumpReader (lump); - auto size = lumpr.GetLength (); - auto numread = lumpr.Read (dest, size); - - if (numread != size) - { - I_Error ("W_ReadLump: only read %ld of %ld on lump %i\n", - numread, size, lump); - } -} - -//========================================================================== -// -// W_ReadLump +// GetFileData // // Loads the lump into a TArray and returns it. // //========================================================================== -TArray FileSystem::ReadLumpIntoArray(int lump, int pad) +TArray FileSystem::GetFileData(int lump, int pad) { - auto lumpr = OpenLumpReader(lump); + if ((size_t)lump >= FileInfo.Size()) + return TArray(); + + auto lumpr = OpenFileReader(lump); auto size = lumpr.GetLength(); TArray data(size + pad, true); auto numread = lumpr.Read(data.Data(), size); if (numread != size) { - I_Error("W_ReadLump: only read %ld of %ld on lump %i\n", + I_Error("GetFileData: only read %ld of %ld on lump %i\n", numread, size, lump); } if (pad > 0) memset(&data[size], 0, pad); return data; } +//========================================================================== +// +// W_ReadFile +// +// Loads the lump into the given buffer, which must be >= W_LumpLength(). +// +//========================================================================== + +void FileSystem::ReadFile (int lump, void *dest) +{ + auto lumpr = OpenFileReader (lump); + auto size = lumpr.GetLength (); + auto numread = lumpr.Read (dest, size); + + if (numread != size) + { + I_Error ("W_ReadFile: only read %ld of %ld on lump %i\n", + numread, size, lump); + } +} + //========================================================================== // -// ReadLump - variant 2 +// ReadFile - variant 2 // // Loads the lump into a newly created buffer and returns it. // //========================================================================== -FileData FileSystem::ReadLump (int lump) +FileData FileSystem::ReadFile (int lump) { return FileData(FString(ELumpNum(lump))); } //========================================================================== // -// OpenLumpReader +// OpenFileReader // // uses a more abstract interface to allow for easier low level optimization later // //========================================================================== -FileReader FileSystem::OpenLumpReader(int lump) +FileReader FileSystem::OpenFileReader(int lump) { if ((unsigned)lump >= (unsigned)FileInfo.Size()) { - I_Error("W_OpenLumpNum: %u >= NumEntries", lump); + I_Error("OpenFileReader: %u >= NumEntries", lump); } auto rl = FileInfo[lump].lump; @@ -1318,11 +1315,11 @@ FileReader FileSystem::OpenLumpReader(int lump) return rl->NewReader(); // This always gets a reader to the cache } -FileReader FileSystem::ReopenLumpReader(int lump, bool alwayscache) +FileReader FileSystem::ReopenFileReader(int lump, bool alwayscache) { if ((unsigned)lump >= (unsigned)FileInfo.Size()) { - I_Error("ReopenLumpReader: %u >= NumEntries", lump); + I_Error("ReopenFileReader: %u >= NumEntries", lump); } auto rl = FileInfo[lump].lump; @@ -1330,7 +1327,7 @@ FileReader FileSystem::ReopenLumpReader(int lump, bool alwayscache) if (rl->RefCount == 0 && rd != nullptr && !rd->GetBuffer() && !alwayscache && !(rl->Flags & LUMPF_COMPRESSED)) { - int fileno = fileSystem.GetLumpFile(lump); + int fileno = fileSystem.GetFileContainer(lump); const char *filename = fileSystem.GetResourceFileName(fileno); FileReader fr; if (fr.OpenFile(filename, rl->GetFileOffset(), rl->LumpSize)) @@ -1341,6 +1338,13 @@ FileReader FileSystem::ReopenLumpReader(int lump, bool alwayscache) return rl->NewReader(); // This always gets a reader to the cache } +FileReader FileSystem::OpenFileReader(const char* name) +{ + auto lump = CheckNumForFullName(name); + if (lump < 0) return FileReader(); + else return OpenFileReader(lump); +} + //========================================================================== // // GetFileReader @@ -1350,34 +1354,34 @@ FileReader FileSystem::ReopenLumpReader(int lump, bool alwayscache) // //========================================================================== -FileReader *FileSystem::GetFileReader(int wadnum) +FileReader *FileSystem::GetFileReader(int rfnum) { - if ((uint32_t)wadnum >= Files.Size()) + if ((uint32_t)rfnum >= Files.Size()) { return NULL; } - return Files[wadnum]->GetReader(); + return Files[rfnum]->GetReader(); } //========================================================================== // -// W_GetWadName +// GetResourceFileName // // Returns the name of the given wad. // //========================================================================== -const char *FileSystem::GetResourceFileName (int wadnum) const noexcept +const char *FileSystem::GetResourceFileName (int rfnum) const noexcept { const char *name, *slash; - if ((uint32_t)wadnum >= Files.Size()) + if ((uint32_t)rfnum >= Files.Size()) { return NULL; } - name = Files[wadnum]->FileName; + name = Files[rfnum]->FileName; slash = strrchr (name, '/'); return slash != NULL ? slash+1 : name; } @@ -1387,14 +1391,14 @@ const char *FileSystem::GetResourceFileName (int wadnum) const noexcept // //========================================================================== -int FileSystem::GetFirstLump (int wadnum) const +int FileSystem::GetFirstEntry (int rfnum) const noexcept { - if ((uint32_t)wadnum >= Files.Size()) + if ((uint32_t)rfnum >= Files.Size()) { return 0; } - return Files[wadnum]->GetFirstLump(); + return Files[rfnum]->GetFirstEntry(); } //========================================================================== @@ -1402,14 +1406,14 @@ int FileSystem::GetFirstLump (int wadnum) const // //========================================================================== -int FileSystem::GetLastLump (int wadnum) const +int FileSystem::GetLastEntry (int rfnum) const noexcept { - if ((uint32_t)wadnum >= Files.Size()) + if ((uint32_t)rfnum >= Files.Size()) { return 0; } - return Files[wadnum]->GetFirstLump() + Files[wadnum]->LumpCount() - 1; + return Files[rfnum]->GetFirstEntry() + Files[rfnum]->LumpCount() - 1; } //========================================================================== @@ -1417,36 +1421,61 @@ int FileSystem::GetLastLump (int wadnum) const // //========================================================================== -int FileSystem::GetLumpCount (int wadnum) const +int FileSystem::GetEntryCount (int rfnum) const noexcept { - if ((uint32_t)wadnum >= Files.Size()) + if ((uint32_t)rfnum >= Files.Size()) { return 0; } - return Files[wadnum]->LumpCount(); + return Files[rfnum]->LumpCount(); } //========================================================================== // -// W_GetWadFullName +// GetResourceFileFullName // // Returns the name of the given wad, including any path // //========================================================================== -const char *FileSystem::GetResourceFileFullName (int wadnum) const noexcept +const char *FileSystem::GetResourceFileFullName (int rfnum) const noexcept { - if ((unsigned int)wadnum >= Files.Size()) + if ((unsigned int)rfnum >= Files.Size()) { return nullptr; } - return Files[wadnum]->FileName; + return Files[rfnum]->FileName; } +//========================================================================== +// +// Clones an existing resource with different properties +// +//========================================================================== + +bool FileSystem::CreatePathlessCopy(const char *name, int id, int /*flags*/) +{ + FString name2, type2, path; + + // The old code said 'filename' and ignored the path, this looked like a bug. + auto lump = FindFile(name); + if (lump < 0) return false; // Does not exist. + + auto oldlump = FileInfo[lump]; + int slash = oldlump.longName.LastIndexOf('/'); + if (slash == -1) return true; // already is pathless. + + // just create a new reference to the original data with a different name. + oldlump.longName = oldlump.longName.Mid(slash + 1); + oldlump.resourceId = id; + FileInfo.Push(oldlump); + return true; +} + // FileData ----------------------------------------------------------------- FileData::FileData () @@ -1475,7 +1504,7 @@ FileData::~FileData () FString::FString (ELumpNum lumpnum) { - auto lumpr = fileSystem.OpenLumpReader ((int)lumpnum); + auto lumpr = fileSystem.OpenFileReader ((int)lumpnum); auto size = lumpr.GetLength (); AllocBuffer (1 + size); auto numread = lumpr.Read (&Chars[0], size); @@ -1484,7 +1513,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, fileSystem.GetLumpFullName((int)lumpnum)); + numread, size, lumpnum, fileSystem.GetFileFullName((int)lumpnum)); } } @@ -1536,32 +1565,3 @@ static void PrintLastError () } #endif -#ifdef _DEBUG -//========================================================================== -// -// CCMD LumpNum -// -//========================================================================== - -CCMD(lumpnum) -{ - for (int i = 1; i < argv.argc(); ++i) - { - Printf("%s: %d\n", argv[i], fileSystem.CheckNumForName(argv[i])); - } -} - -//========================================================================== -// -// CCMD LumpNumFull -// -//========================================================================== - -CCMD(lumpnumfull) -{ - for (int i = 1; i < argv.argc(); ++i) - { - Printf("%s: %d\n", argv[i], fileSystem.CheckNumForFullName(argv[i])); - } -} -#endif diff --git a/src/gamedata/w_wad.h b/src/gamedata/w_wad.h index 21f88d9a5d..be8b56cdcc 100644 --- a/src/gamedata/w_wad.h +++ b/src/gamedata/w_wad.h @@ -10,7 +10,6 @@ #define __W_WAD__ #include "files.h" -#include "doomdef.h" #include "tarray.h" #include "cmdlib.h" #include "zstring.h" @@ -77,9 +76,9 @@ public: const char *GetResourceFileName (int filenum) const noexcept; const char *GetResourceFileFullName (int wadnum) const noexcept; - int GetFirstLump(int wadnum) const; - int GetLastLump(int wadnum) const; - int GetLumpCount(int wadnum) const; + int GetFirstEntry(int wadnum) const noexcept; + int GetLastEntry(int wadnum) const noexcept; + int GetEntryCount(int wadnum) const noexcept; int CheckNumForName (const char *name, int namespc); int CheckNumForName (const char *name, int namespc, int wadfile, bool exact = true); @@ -102,6 +101,7 @@ public: return CheckNumForFullName(name); } LumpShortName& GetShortName(int i); // may only be called before the hash chains are set up. + bool CreatePathlessCopy(const char* name, int id, int flags); inline int CheckNumForFullName(const FString &name, bool trynormal = false, int namespc = ns_global) { return CheckNumForFullName(name.GetChars(), trynormal, namespc); } inline int CheckNumForFullName (const FString &name, int wadfile) { return CheckNumForFullName(name.GetChars(), wadfile); } @@ -111,17 +111,18 @@ public: FTexture *GetLinkedTexture(int lump); - void ReadLump (int lump, void *dest); - TArray ReadLumpIntoArray(int lump, int pad = 0); // reads lump into a writable buffer and optionally adds some padding at the end. (FileData isn't writable!) - FileData ReadLump (int lump); - FileData ReadLump (const char *name) { return ReadLump (GetNumForName (name)); } + void ReadFile (int lump, void *dest); + TArray GetFileData(int lump, int pad = 0); // reads lump into a writable buffer and optionally adds some padding at the end. (FileData isn't writable!) + FileData ReadFile (int lump); + FileData ReadFile (const char *name) { return ReadFile (GetNumForName (name)); } - FileReader OpenLumpReader(int lump); // opens a reader that redirects to the containing file's one. - FileReader ReopenLumpReader(int lump, bool alwayscache = false); // opens an independent reader. + FileReader OpenFileReader(int lump); // opens a reader that redirects to the containing file's one. + FileReader ReopenFileReader(int lump, bool alwayscache = false); // opens an independent reader. + FileReader OpenFileReader(const char* name); int FindLump (const char *name, int *lastlump, bool anyns=false); // [RH] Find lumps with duplication int FindLumpMulti (const char **names, int *lastlump, bool anyns = false, int *nameindex = NULL); // same with multiple possible names - bool CheckLumpName (int lump, const char *name); // [RH] True if lump's name == name + bool CheckFileName (int lump, const char *name); // [RH] True if lump's name == name int FindFileWithExtensions(const char* name, const char* const* exts, int count); int FindResource(int resid, const char* type, int filenum) const noexcept; @@ -133,19 +134,20 @@ public: int FileLength (int lump) const; int GetFileOffset (int lump); // [RH] Returns offset of lump in the wadfile int GetFileFlags (int lump); // Return the flags for this lump - void GetLumpName (char *to, int lump) const; // [RH] Copies the lump name to to using uppercopy - void GetLumpName (FString &to, int lump) const; - const char* GetLumpName(int lump) const; - const char *GetLumpFullName (int lump, bool returnshort = true) const; // [RH] Returns the lump's full name - FString GetLumpFullPath (int lump) const; // [RH] Returns wad's name + lump's full name - int GetLumpFile (int lump) const; // [RH] Returns wadnum for a specified lump - int GetLumpNamespace (int lump) const; // [RH] Returns the namespace a lump belongs to - int GetLumpIndexNum (int lump) const; // Returns the RFF index number for this lump - FResourceLump *GetLumpRecord(int lump) const; // Returns the FResourceLump, in case the caller wants to have direct access to the lump cache. - bool CheckLumpName (int lump, const char *name) const; // [RH] Returns true if the names match - unsigned GetLumpsInFolder(const char *path, TArray &result, bool atomic) const; + void GetFileShortName (char *to, int lump) const; // [RH] Copies the lump name to to using uppercopy + void GetFileShortName (FString &to, int lump) const; + const char* GetFileShortName(int lump) const; + const char *GetFileFullName (int lump, bool returnshort = true) const; // [RH] Returns the lump's full name + FString GetFileFullPath (int lump) const; // [RH] Returns wad's name + lump's full name + int GetFileContainer (int lump) const; // [RH] Returns wadnum for a specified lump + int GetFileNamespace (int lump) const; // [RH] Returns the namespace a lump belongs to + void SetFileNamespace(int lump, int ns); + int GetResourceId(int lump) const; // Returns the RFF index number for this lump + const char* GetResourceType(int lump) const; + bool CheckFileName (int lump, const char *name) const; // [RH] Returns true if the names match + unsigned GetFilesInFolder(const char *path, TArray &result, bool atomic) const; - int GetNumLumps() const + int GetNumEntries() const { return NumEntries; } diff --git a/src/gamedata/xlat/parsecontext.cpp b/src/gamedata/xlat/parsecontext.cpp index 036e1045fc..4f2ff0a9a0 100644 --- a/src/gamedata/xlat/parsecontext.cpp +++ b/src/gamedata/xlat/parsecontext.cpp @@ -323,7 +323,7 @@ void FParseContext::ParseLump(const char *lumpname) } // Read the lump into a buffer and add a 0-terminator - auto lumpdata = fileSystem.ReadLumpIntoArray(lumpno, 1); + auto lumpdata = fileSystem.GetFileData(lumpno, 1); SourceLine = 0; SourceFile = lumpname; diff --git a/src/intermission/intermission_parse.cpp b/src/intermission/intermission_parse.cpp index dba03f7812..b2c9949d2f 100644 --- a/src/intermission/intermission_parse.cpp +++ b/src/intermission/intermission_parse.cpp @@ -306,7 +306,7 @@ bool FIntermissionActionTextscreen::ParseKey(FScanner &sc) if (lump > 0) { // Check if this comes from either Hexen.wad or Hexdd.wad and if so, map to the string table. - int fileno = fileSystem.GetLumpFile(lump); + int fileno = fileSystem.GetFileContainer(lump); auto fn = fileSystem.GetResourceFileName(fileno); if (fn && (!stricmp(fn, "HEXEN.WAD") || !stricmp(fn, "HEXDD.WAD"))) { @@ -318,12 +318,12 @@ bool FIntermissionActionTextscreen::ParseKey(FScanner &sc) } } if (!done) - mText = fileSystem.ReadLump(lump).GetString(); + mText = fileSystem.ReadFile(lump).GetString(); } else { // only print an error if coming from a PWAD - if (fileSystem.GetLumpFile(sc.LumpNum) > fileSystem.GetMaxIwadNum()) + if (fileSystem.GetFileContainer(sc.LumpNum) > fileSystem.GetMaxIwadNum()) sc.ScriptMessage("Unknown text lump '%s'", sc.String); mText.Format("Unknown text lump '%s'", sc.String); } @@ -862,7 +862,7 @@ void F_StartFinale (const char *music, int musicorder, int cdtrack, unsigned int int lump = fileSystem.CheckNumForFullName(text, true); if (lump > 0) { - textscreen->mText = fileSystem.ReadLump(lump).GetString(); + textscreen->mText = fileSystem.ReadFile(lump).GetString(); } else { diff --git a/src/maploader/compatibility.cpp b/src/maploader/compatibility.cpp index 2780241ca8..f393ea888e 100644 --- a/src/maploader/compatibility.cpp +++ b/src/maploader/compatibility.cpp @@ -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 (fileSystem.GetLumpFile(map->lumpnum) == fileSystem.GetIwadNum() && (gameinfo.flags & GI_COMPATSHORTTEX) && Level->maptype == MAPTYPE_DOOM) + if (fileSystem.GetFileContainer(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; diff --git a/src/maploader/glnodes.cpp b/src/maploader/glnodes.cpp index 0b3cb852a6..0feb9918f5 100644 --- a/src/maploader/glnodes.cpp +++ b/src/maploader/glnodes.cpp @@ -729,10 +729,10 @@ static bool MatchHeader(const char * label, const char * hdata) static int FindGLNodesInWAD(int labellump) { - int wadfile = fileSystem.GetLumpFile(labellump); + int wadfile = fileSystem.GetFileContainer(labellump); FString glheader; - glheader.Format("GL_%s", fileSystem.GetLumpFullName(labellump)); + glheader.Format("GL_%s", fileSystem.GetFileFullName(labellump)); if (glheader.Len()<=8) { int gllabel = fileSystem.CheckNumForName(glheader, ns_global, wadfile); @@ -750,10 +750,10 @@ static int FindGLNodesInWAD(int labellump) int lump; while ((lump=fileSystem.FindLump("GL_LEVEL", &lastlump))>=0) { - if (fileSystem.GetLumpFile(lump)==wadfile) + if (fileSystem.GetFileContainer(lump)==wadfile) { - FileData mem = fileSystem.ReadLump(lump); - if (MatchHeader(fileSystem.GetLumpFullName(labellump), (const char *)mem.GetMem())) return lump; + FileData mem = fileSystem.ReadFile(lump); + if (MatchHeader(fileSystem.GetFileFullName(labellump), (const char *)mem.GetMem())) return lump; } } } @@ -854,7 +854,7 @@ bool MapLoader::LoadGLNodes(MapData * map) FileReader gwalumps[4]; char path[256]; int li; - int lumpfile = fileSystem.GetLumpFile(map->lumpnum); + int lumpfile = fileSystem.GetFileContainer(map->lumpnum); bool mapinwad = map->InWad; FResourceFile * f_gwa = map->resource; @@ -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]=fileSystem.ReopenLumpReader(li+i+1); + gwalumps[i]=fileSystem.ReopenFileReader(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, fileSystem.GetLumpFullName(map->lumpnum), 8); + strncpy(map->MapLumps[0].Name, fileSystem.GetFileFullName(map->lumpnum), 8); } } } @@ -1000,7 +1000,7 @@ typedef TArray MemFile; static FString CreateCacheName(MapData *map, bool create) { FString path = M_GetCachePath(create); - FString lumpname = fileSystem.GetLumpFullPath(map->lumpnum); + FString lumpname = fileSystem.GetFileFullPath(map->lumpnum); int separator = lumpname.IndexOf(':'); path << '/' << lumpname.Left(separator); if (create) CreatePath(path); diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index 3122b9fbed..ab87de9160 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -2034,7 +2034,7 @@ void MapLoader::LoopSidedefs (bool firstloop) int MapLoader::DetermineTranslucency (int lumpnum) { - auto tranmap = fileSystem.OpenLumpReader (lumpnum); + auto tranmap = fileSystem.OpenFileReader (lumpnum); uint8_t index; PalEntry newcolor; PalEntry newcolor2; @@ -2054,7 +2054,7 @@ int MapLoader::DetermineTranslucency (int lumpnum) { char lumpname[9]; lumpname[8] = 0; - fileSystem.GetLumpName (lumpname, lumpnum); + fileSystem.GetFileShortName (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; - fileSystem.GetLumpName (lumpname, lumpnum); + fileSystem.GetFileShortName (lumpname, lumpnum); Printf ("%s appears to be translucency %d (%d%%)\n", lumpname, newcolor.r, newcolor.r*100/255); } diff --git a/src/maploader/strifedialogue.cpp b/src/maploader/strifedialogue.cpp index b651f6a953..9f2681cc78 100644 --- a/src/maploader/strifedialogue.cpp +++ b/src/maploader/strifedialogue.cpp @@ -152,9 +152,9 @@ bool MapLoader::LoadScriptFile (const char *name, bool include, int type) return false; } - FileReader lump = fileSystem.ReopenLumpReader (lumpnum); + FileReader lump = fileSystem.ReopenFileReader (lumpnum); - auto fn = fileSystem.GetLumpFile(lumpnum); + auto fn = fileSystem.GetFileContainer(lumpnum); auto wadname = fileSystem.GetResourceFileName(fn); if (stricmp(wadname, "STRIFE0.WAD") && stricmp(wadname, "STRIFE1.WAD") && stricmp(wadname, "SVE.WAD")) name = nullptr; // Only localize IWAD content. @@ -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", fileSystem.GetLumpFullName(lumpnum)); + DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", fileSystem.GetFileFullName(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", fileSystem.GetLumpFullName(lumpnum)); + DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", fileSystem.GetFileFullName(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", fileSystem.GetLumpFullName(lumpnum)); + DPrintf(DMSG_ERROR, "Incorrect data format for conversation script in %s.\n", fileSystem.GetFileFullName(lumpnum)); return false; } numnodes /= 1488; diff --git a/src/maploader/udmf.cpp b/src/maploader/udmf.cpp index 6ed8840660..72fa217287 100644 --- a/src/maploader/udmf.cpp +++ b/src/maploader/udmf.cpp @@ -2161,7 +2161,7 @@ public: isExtended = false; floordrop = false; - sc.OpenMem(fileSystem.GetLumpFullName(map->lumpnum), map->Read(ML_TEXTMAP)); + sc.OpenMem(fileSystem.GetFileFullName(map->lumpnum), map->Read(ML_TEXTMAP)); sc.SetCMode(true); if (sc.CheckString("namespace")) { diff --git a/src/maploader/usdf.cpp b/src/maploader/usdf.cpp index 61dcf66b09..64aa792321 100644 --- a/src/maploader/usdf.cpp +++ b/src/maploader/usdf.cpp @@ -563,7 +563,7 @@ public: bool Parse(MapLoader *loader,int lumpnum, FileReader &lump, int lumplen) { Level = loader->Level; - sc.OpenMem(fileSystem.GetLumpFullName(lumpnum), lump.Read(lumplen)); + sc.OpenMem(fileSystem.GetFileFullName(lumpnum), lump.Read(lumplen)); sc.SetCMode(true); // Namespace must be the first field because everything else depends on it. if (sc.CheckString("namespace")) diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index 87ca0d3920..0585810356 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -649,7 +649,7 @@ static void ParseListMenu(FScanner &sc) desc->mWLeft = 0; desc->mWRight = 0; desc->mCenter = false; - desc->mFromEngine = fileSystem.GetLumpFile(sc.LumpNum) == 0; // flags menu if the definition is from the IWAD. + desc->mFromEngine = fileSystem.GetFileContainer(sc.LumpNum) == 0; // flags menu if the definition is from the IWAD. ParseListMenuBody(sc, desc); ReplaceMenu(sc, desc); diff --git a/src/p_openmap.cpp b/src/p_openmap.cpp index abb47a3240..846ee2b99e 100644 --- a/src/p_openmap.cpp +++ b/src/p_openmap.cpp @@ -145,8 +145,8 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck) if (lump_name > lump_wad && lump_name > lump_map && lump_name != -1) { - int lumpfile = fileSystem.GetLumpFile(lump_name); - int nextfile = fileSystem.GetLumpFile(lump_name+1); + int lumpfile = fileSystem.GetFileContainer(lump_name); + int nextfile = fileSystem.GetFileContainer(lump_name+1); map->lumpnum = lump_name; @@ -154,7 +154,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 = fileSystem.ReopenLumpReader(lump_name); + map->MapLumps[0].Reader = fileSystem.ReopenFileReader(lump_name); if (!P_IsBuildMap(map)) { delete map; @@ -165,19 +165,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 = fileSystem.ReopenLumpReader(lump_name); - strncpy(map->MapLumps[0].Name, fileSystem.GetLumpFullName(lump_name), 8); + map->MapLumps[0].Reader = fileSystem.ReopenFileReader(lump_name); + strncpy(map->MapLumps[0].Name, fileSystem.GetFileFullName(lump_name), 8); map->InWad = true; int index = 0; - if (stricmp(fileSystem.GetLumpFullName(lump_name + 1), "TEXTMAP") != 0) + if (stricmp(fileSystem.GetFileFullName(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 = fileSystem.GetLumpFullName(lump_name + i); + const char * lumpname = fileSystem.GetFileFullName(lump_name + i); try { index = GetMapIndex(mapname, index, lumpname, !justcheck); @@ -197,17 +197,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 = fileSystem.ReopenLumpReader(lump_name + i); + map->MapLumps[index].Reader = fileSystem.ReopenFileReader(lump_name + i); strncpy(map->MapLumps[index].Name, lumpname, 8); } } else { map->isText = true; - map->MapLumps[1].Reader = fileSystem.ReopenLumpReader(lump_name + 1); + map->MapLumps[1].Reader = fileSystem.ReopenFileReader(lump_name + 1); for(int i = 2;; i++) { - const char * lumpname = fileSystem.GetLumpFullName(lump_name + i); + const char * lumpname = fileSystem.GetFileFullName(lump_name + i); if (lumpname == NULL) { @@ -240,7 +240,7 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck) break; } else continue; - map->MapLumps[index].Reader = fileSystem.ReopenLumpReader(lump_name + i); + map->MapLumps[index].Reader = fileSystem.ReopenFileReader(lump_name + i); strncpy(map->MapLumps[index].Name, lumpname, 8); } } @@ -258,8 +258,8 @@ MapData *P_OpenMapData(const char * mapname, bool justcheck) return NULL; } map->lumpnum = lump_wad; - auto reader = fileSystem.ReopenLumpReader(lump_wad); - map->resource = FResourceFile::OpenResourceFile(fileSystem.GetLumpFullName(lump_wad), reader, true); + auto reader = fileSystem.ReopenFileReader(lump_wad); + map->resource = FResourceFile::OpenResourceFile(fileSystem.GetFileFullName(lump_wad), reader, true); wadReader = map->resource->GetReader(); } } diff --git a/src/playsim/fragglescript/t_load.cpp b/src/playsim/fragglescript/t_load.cpp index a1b1bbb1ae..5b6915e858 100644 --- a/src/playsim/fragglescript/t_load.cpp +++ b/src/playsim/fragglescript/t_load.cpp @@ -227,7 +227,7 @@ bool FScriptLoader::ParseInfo(MapData * map) if (lumpsize==0) return false; fsglobal=true; lump=new char[lumpsize+3]; - fileSystem.ReadLump(lumpnum,lump); + fileSystem.ReadFile(lumpnum,lump); } else { diff --git a/src/playsim/fragglescript/t_prepro.cpp b/src/playsim/fragglescript/t_prepro.cpp index 6f739c335b..9bd78fcee5 100644 --- a/src/playsim/fragglescript/t_prepro.cpp +++ b/src/playsim/fragglescript/t_prepro.cpp @@ -419,7 +419,7 @@ void DFsScript::ParseInclude(FLevelLocals *Level, char *lumpname) int lumplen=fileSystem.FileLength(lumpnum); lump=new char[lumplen+10]; - fileSystem.ReadLump(lumpnum,lump); + fileSystem.ReadFile(lumpnum,lump); lump[lumplen]=0; diff --git a/src/playsim/p_acs.cpp b/src/playsim/p_acs.cpp index fe3f43eb41..1930082daa 100644 --- a/src/playsim/p_acs.cpp +++ b/src/playsim/p_acs.cpp @@ -1958,7 +1958,7 @@ FBehavior *FBehaviorContainer::LoadModule (int lumpnum, FileReader *fr, int len, else { delete behavior; - Printf(TEXTCOLOR_RED "%s: invalid ACS module\n", fileSystem.GetLumpFullName(lumpnum)); + Printf(TEXTCOLOR_RED "%s: invalid ACS module\n", fileSystem.GetFileFullName(lumpnum)); return NULL; } } @@ -2240,7 +2240,7 @@ bool FBehavior::Init(FLevelLocals *Level, int lumpnum, FileReader * fr, int len, object = new uint8_t[len]; if (fr == NULL) { - fileSystem.ReadLump (lumpnum, object); + fileSystem.ReadFile (lumpnum, object); } else { @@ -2272,7 +2272,7 @@ bool FBehavior::Init(FLevelLocals *Level, int lumpnum, FileReader * fr, int len, if (fr == NULL) { - fileSystem.GetLumpName (ModuleName, lumpnum); + fileSystem.GetFileShortName (ModuleName, lumpnum); ModuleName[8] = 0; } else @@ -2317,7 +2317,7 @@ 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 = fileSystem.GetLumpFile(reallumpnum); + int fileno = fileSystem.GetFileContainer(reallumpnum); const char * filename = fileSystem.GetResourceFileName(fileno); if (!stricmp(filename, "HEXEN.WAD") || !stricmp(filename, "HEXDD.WAD")) { diff --git a/src/playsim/p_user.cpp b/src/playsim/p_user.cpp index d2206c7c4d..e5f8fb9dba 100644 --- a/src/playsim/p_user.cpp +++ b/src/playsim/p_user.cpp @@ -391,7 +391,7 @@ void player_t::SetLogNumber (int num) lumpnum = fileSystem.CheckNumForName (lumpname); if (lumpnum != -1) { - auto fn = fileSystem.GetLumpFile(lumpnum); + auto fn = fileSystem.GetFileContainer(lumpnum); auto wadname = fileSystem.GetResourceFileName(fn); if (!stricmp(wadname, "STRIFE0.WAD") || !stricmp(wadname, "STRIFE1.WAD") || !stricmp(wadname, "SVE.WAD")) { @@ -406,7 +406,7 @@ void player_t::SetLogNumber (int num) } } - auto lump = fileSystem.ReadLump(lumpnum); + auto lump = fileSystem.ReadFile(lumpnum); SetLogText (lump.GetString()); } } @@ -838,8 +838,8 @@ static int SetupCrouchSprite(AActor *self, int crouchsprite) return false; } - int wadnorm = fileSystem.GetLumpFile(spritenorm); - int wadcrouch = fileSystem.GetLumpFile(spritenorm); + int wadnorm = fileSystem.GetFileContainer(spritenorm); + int wadcrouch = fileSystem.GetFileContainer(spritenorm); if (wadnorm > fileSystem.GetMaxIwadNum() && wadcrouch <= fileSystem.GetMaxIwadNum()) { diff --git a/src/r_data/colormaps.cpp b/src/r_data/colormaps.cpp index 885dcd1641..b121efbd70 100644 --- a/src/r_data/colormaps.cpp +++ b/src/r_data/colormaps.cpp @@ -202,15 +202,15 @@ void R_InitColormaps (bool allowCustomColormap) cm.blend = 0; fakecmaps.Push(cm); - uint32_t NumLumps = fileSystem.GetNumLumps(); + uint32_t NumLumps = fileSystem.GetNumEntries(); for (uint32_t i = 0; i < NumLumps; i++) { - if (fileSystem.GetLumpNamespace(i) == ns_colormaps) + if (fileSystem.GetFileNamespace(i) == ns_colormaps) { char name[9]; name[8] = 0; - fileSystem.GetLumpName (name, i); + fileSystem.GetFileShortName (name, i); if (fileSystem.CheckNumForName (name, ns_colormaps) == (int)i) { @@ -245,7 +245,7 @@ void R_InitColormaps (bool allowCustomColormap) if (fileSystem.FileLength (fakecmaps[j].lump) >= 256) { int k, r, g, b; - auto lump = fileSystem.OpenLumpReader (fakecmaps[j].lump); + auto lump = fileSystem.OpenFileReader (fakecmaps[j].lump); lump.Read(map, 256); r = g = b = 0; diff --git a/src/r_data/gldefs.cpp b/src/r_data/gldefs.cpp index e1474e0756..20b06a109b 100644 --- a/src/r_data/gldefs.cpp +++ b/src/r_data/gldefs.cpp @@ -1155,8 +1155,8 @@ class GLDefsParser if (lumpnum != -1) { - if (iwad && fileSystem.GetLumpFile(lumpnum) <= fileSystem.GetMaxIwadNum()) useme = true; - if (thiswad && fileSystem.GetLumpFile(lumpnum) == workingLump) useme = true; + if (iwad && fileSystem.GetFileContainer(lumpnum) <= fileSystem.GetMaxIwadNum()) useme = true; + if (thiswad && fileSystem.GetFileContainer(lumpnum) == workingLump) useme = true; } if (!useme) return; } @@ -1339,8 +1339,8 @@ class GLDefsParser if (lumpnum != -1) { - if (iwad && fileSystem.GetLumpFile(lumpnum) <= fileSystem.GetMaxIwadNum()) useme = true; - if (thiswad && fileSystem.GetLumpFile(lumpnum) == workingLump) useme = true; + if (iwad && fileSystem.GetFileContainer(lumpnum) <= fileSystem.GetMaxIwadNum()) useme = true; + if (thiswad && fileSystem.GetFileContainer(lumpnum) == workingLump) useme = true; } if (!useme) return; } diff --git a/src/r_data/models/models.cpp b/src/r_data/models/models.cpp index 910ed08369..c2c34f429e 100644 --- a/src/r_data/models/models.cpp +++ b/src/r_data/models/models.cpp @@ -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 : fileSystem.GetLumpFullName(texlump); + const char * const texname = texlump < 0 ? fn : fileSystem.GetFileFullName(texlump); return TexMan.CheckForTexture(texname, ETextureType::Any, FTextureManager::TEXMAN_TryAny); } @@ -408,7 +408,7 @@ static unsigned FindModel(const char * path, const char * modelfile) } int len = fileSystem.FileLength(lump); - FileData lumpd = fileSystem.ReadLump(lump); + FileData lumpd = fileSystem.ReadFile(lump); char * buffer = (char*)lumpd.GetMem(); if ( (size_t)fullname.LastIndexOf("_d.3d") == fullname.Len()-5 ) diff --git a/src/r_data/models/models_md2.cpp b/src/r_data/models/models_md2.cpp index 1192ec08f7..15651c8e58 100644 --- a/src/r_data/models/models_md2.cpp +++ b/src/r_data/models/models_md2.cpp @@ -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 }; - FileData lumpdata = fileSystem.ReadLump(mLumpNum); + FileData lumpdata = fileSystem.ReadFile(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; - FileData lumpdata = fileSystem.ReadLump(mLumpNum); + FileData lumpdata = fileSystem.ReadFile(mLumpNum); const char *buffer = (const char *)lumpdata.GetMem(); texCoords = new FTexCoord[info.numTexCoords]; diff --git a/src/r_data/models/models_md3.cpp b/src/r_data/models/models_md3.cpp index 571e85b974..edb6c7a7c5 100644 --- a/src/r_data/models/models_md3.cpp +++ b/src/r_data/models/models_md3.cpp @@ -185,7 +185,7 @@ bool FMD3Model::Load(const char * path, int lumpnum, const char * buffer, int le void FMD3Model::LoadGeometry() { - FileData lumpdata = fileSystem.ReadLump(mLumpNum); + FileData lumpdata = fileSystem.ReadFile(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)); diff --git a/src/r_data/models/models_obj.cpp b/src/r_data/models/models_obj.cpp index 6fdc59b2de..9a7c6f3356 100644 --- a/src/r_data/models/models_obj.cpp +++ b/src/r_data/models/models_obj.cpp @@ -33,7 +33,7 @@ */ bool FOBJModel::Load(const char* fn, int lumpnum, const char* buffer, int length) { - FString objName = fileSystem.GetLumpFullPath(lumpnum); + FString objName = fileSystem.GetFileFullPath(lumpnum); FString objBuf(buffer, length); // Do some replacements before we parse the OBJ string diff --git a/src/r_data/models/models_ue1.cpp b/src/r_data/models/models_ue1.cpp index a36dda73ec..52b9d11e0a 100644 --- a/src/r_data/models/models_ue1.cpp +++ b/src/r_data/models/models_ue1.cpp @@ -42,7 +42,7 @@ float unpackuvert( uint32_t n, int c ) bool FUE1Model::Load( const char *filename, int lumpnum, const char *buffer, int length ) { int lumpnum2; - FString realfilename = fileSystem.GetLumpFullName(lumpnum); + FString realfilename = fileSystem.GetFileFullName(lumpnum); if ( (size_t)realfilename.IndexOf("_d.3d") == realfilename.Len()-5 ) { realfilename.Substitute("_d.3d","_a.3d"); @@ -64,9 +64,9 @@ void FUE1Model::LoadGeometry() { FileData lump, lump2; const char *buffer, *buffer2; - lump = fileSystem.ReadLump(mDataLump); + lump = fileSystem.ReadFile(mDataLump); buffer = (char*)lump.GetMem(); - lump2 = fileSystem.ReadLump(mAnivLump); + lump2 = fileSystem.ReadFile(mAnivLump); buffer2 = (char*)lump2.GetMem(); // map structures dhead = (d3dhead*)(buffer); diff --git a/src/r_data/r_translate.cpp b/src/r_data/r_translate.cpp index 16381e8a78..abbf857930 100644 --- a/src/r_data/r_translate.cpp +++ b/src/r_data/r_translate.cpp @@ -511,7 +511,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC } else { - FileData translump = fileSystem.ReadLump(colorset->Lump); + FileData translump = fileSystem.ReadFile(colorset->Lump); const uint8_t *trans = (const uint8_t *)translump.GetMem(); for (i = start; i <= end; ++i) { diff --git a/src/r_data/sprites.cpp b/src/r_data/sprites.cpp index b26be338e1..a6dca0f2d0 100644 --- a/src/r_data/sprites.cpp +++ b/src/r_data/sprites.cpp @@ -342,19 +342,19 @@ void R_InitSpriteDefs () } // Repeat, for voxels - vmax = fileSystem.GetNumLumps(); + vmax = fileSystem.GetNumEntries(); TArray vhashes(vmax, true); memset(vhashes.Data(), -1, sizeof(VHasher)*vmax); for (i = 0; i < vmax; ++i) { - if (fileSystem.GetLumpNamespace(i) == ns_voxels) + if (fileSystem.GetFileNamespace(i) == ns_voxels) { char name[9]; size_t namelen; int spin; int sign; - fileSystem.GetLumpName(name, i); + fileSystem.GetFileShortName(name, i); name[8] = 0; namelen = strlen(name); if (namelen < 4) @@ -588,13 +588,13 @@ void R_InitSkins (void) { // The player sprite has 23 frames. This means that the S_SKIN // marker needs a minimum of 23 lumps after it. - if (base >= fileSystem.GetNumLumps() - 23 || base == -1) + if (base >= fileSystem.GetNumEntries() - 23 || base == -1) continue; i++; for (j = 0; j < NUMSKINSOUNDS; j++) sndlumps[j] = -1; - Skins[i].namespc = fileSystem.GetLumpNamespace (base); + Skins[i].namespc = fileSystem.GetFileNamespace (base); FScanner sc(base); intname = 0; @@ -811,11 +811,11 @@ void R_InitSkins (void) if (intname == 0) { char name[9]; - fileSystem.GetLumpName (name, base+1); + fileSystem.GetFileShortName (name, base+1); memcpy(&intname, name, 4); } - int basens = fileSystem.GetLumpNamespace(base); + int basens = fileSystem.GetFileNamespace(base); for(int spr = 0; spr<2; spr++) { @@ -841,11 +841,11 @@ void R_InitSkins (void) } } - for (k = base + 1; fileSystem.GetLumpNamespace(k) == basens; k++) + for (k = base + 1; fileSystem.GetFileNamespace(k) == basens; k++) { char lname[9]; uint32_t lnameint; - fileSystem.GetLumpName (lname, k); + fileSystem.GetFileShortName (lname, k); memcpy(&lnameint, lname, 4); if (lnameint == intname) { @@ -864,7 +864,7 @@ void R_InitSkins (void) break; } - fileSystem.GetLumpName (temp.name, base+1); + fileSystem.GetFileShortName (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) { - FileData lump = fileSystem.ReadLump (palname); + FileData lump = fileSystem.ReadFile (palname); const uint8_t *otherPal = (uint8_t *)lump.GetMem(); for (int i = 0; i < 256; ++i) diff --git a/src/r_data/v_palette.cpp b/src/r_data/v_palette.cpp index f5818a9ceb..43dfccfa49 100644 --- a/src/r_data/v_palette.cpp +++ b/src/r_data/v_palette.cpp @@ -284,7 +284,7 @@ int ReadPalette(int lumpnum, uint8_t *buffer) { return 0; } - FileData lump = fileSystem.ReadLump(lumpnum); + FileData lump = fileSystem.ReadFile(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", fileSystem.GetLumpFullName(lumpnum)); + I_Error("%s contains no palette", fileSystem.GetFileFullName(lumpnum)); } if (memcmp(lumpmem, "JASC-PAL", 8) == 0) { FScanner sc; - sc.OpenMem(fileSystem.GetLumpFullName(lumpnum), (char*)lumpmem, int(lump.GetSize())); + sc.OpenMem(fileSystem.GetFileFullName(lumpnum), (char*)lumpmem, int(lump.GetSize())); sc.MustGetString(); sc.MustGetNumber(); // version - ignore sc.MustGetNumber(); diff --git a/src/r_data/voxels.cpp b/src/r_data/voxels.cpp index 9f372bf75c..c51b6fd7f5 100644 --- a/src/r_data/voxels.cpp +++ b/src/r_data/voxels.cpp @@ -178,7 +178,7 @@ FVoxel *R_LoadKVX(int lumpnum) int mip, maxmipsize; int i, j, n; - FileData lump = fileSystem.ReadLump(lumpnum); // FileData adds an extra 0 byte to the end. + FileData lump = fileSystem.ReadFile(lumpnum); // FileData 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", fileSystem.GetLumpFullName(lumpnum)); + Printf("%s is not a valid voxel file\n", fileSystem.GetFileFullName(lumpnum)); return NULL; } else diff --git a/src/rendering/gl/shaders/gl_shader.cpp b/src/rendering/gl/shaders/gl_shader.cpp index a821e347f1..47afc4c8dc 100644 --- a/src/rendering/gl/shaders/gl_shader.cpp +++ b/src/rendering/gl/shaders/gl_shader.cpp @@ -333,11 +333,11 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char * int vp_lump = fileSystem.CheckNumForFullName(vert_prog_lump, 0); if (vp_lump == -1) I_Error("Unable to load '%s'", vert_prog_lump); - FileData vp_data = fileSystem.ReadLump(vp_lump); + FileData vp_data = fileSystem.ReadFile(vp_lump); int fp_lump = fileSystem.CheckNumForFullName(frag_prog_lump, 0); if (fp_lump == -1) I_Error("Unable to load '%s'", frag_prog_lump); - FileData fp_data = fileSystem.ReadLump(fp_lump); + FileData fp_data = fileSystem.ReadFile(fp_lump); @@ -385,7 +385,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char * { int pp_lump = fileSystem.CheckNumForFullName(proc_prog_lump); if (pp_lump == -1) I_Error("Unable to load '%s'", proc_prog_lump); - FileData pp_data = fileSystem.ReadLump(pp_lump); + FileData pp_data = fileSystem.ReadFile(pp_lump); if (pp_data.GetString().IndexOf("ProcessMaterial") < 0) { @@ -394,7 +394,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char * // add ProcessMaterial function that calls the older ProcessTexel function 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"); - FileData pl_data = fileSystem.ReadLump(pl_lump); + FileData pl_data = fileSystem.ReadFile(pl_lump); fp_comb << "\n" << pl_data.GetString().GetChars(); if (pp_data.GetString().IndexOf("ProcessTexel") < 0) @@ -420,7 +420,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char * { 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"); - FileData pl_data = fileSystem.ReadLump(pl_lump); + FileData pl_data = fileSystem.ReadFile(pl_lump); fp_comb << "\n" << pl_data.GetString().GetChars(); } } @@ -435,7 +435,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char * { int pp_lump = fileSystem.CheckNumForFullName(light_fragprog, 0); if (pp_lump == -1) I_Error("Unable to load '%s'", light_fragprog); - FileData pp_data = fileSystem.ReadLump(pp_lump); + FileData pp_data = fileSystem.ReadFile(pp_lump); fp_comb << pp_data.GetString().GetChars() << "\n"; } diff --git a/src/rendering/gl/shaders/gl_shaderprogram.cpp b/src/rendering/gl/shaders/gl_shaderprogram.cpp index 74914a23ad..6c92338b0d 100644 --- a/src/rendering/gl/shaders/gl_shaderprogram.cpp +++ b/src/rendering/gl/shaders/gl_shaderprogram.cpp @@ -93,7 +93,7 @@ void FShaderProgram::Compile(ShaderType type, const char *lumpName, const char * { int lump = fileSystem.CheckNumForFullName(lumpName); if (lump == -1) I_FatalError("Unable to load '%s'", lumpName); - FString code = fileSystem.ReadLump(lump).GetString().GetChars(); + FString code = fileSystem.ReadFile(lump).GetString().GetChars(); Compile(type, lumpName, code, defines, maxGlslVersion); } diff --git a/src/rendering/swrenderer/r_swcolormaps.cpp b/src/rendering/swrenderer/r_swcolormaps.cpp index c57e34684f..8fcdb22e25 100644 --- a/src/rendering/swrenderer/r_swcolormaps.cpp +++ b/src/rendering/swrenderer/r_swcolormaps.cpp @@ -366,7 +366,7 @@ void SetDefaultColormap (const char *name) } else { - auto lumpr = fileSystem.OpenLumpReader (lump); + auto lumpr = fileSystem.OpenFileReader (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 = fileSystem.GetNumLumps(); + uint32_t NumLumps = fileSystem.GetNumEntries(); realcolormaps.Maps = new uint8_t[256*NUMCOLORMAPS*fakecmaps.Size()]; SetDefaultColormap ("COLORMAP"); @@ -427,7 +427,7 @@ static void InitBoomColormaps () if (fileSystem.FileLength (fakecmaps[j].lump) >= (NUMCOLORMAPS+1)*256) { int k, r; - auto lump = fileSystem.OpenLumpReader (fakecmaps[j].lump); + auto lump = fileSystem.OpenFileReader (fakecmaps[j].lump); uint8_t *const map = realcolormaps.Maps + NUMCOLORMAPS*256*j; for (k = 0; k < NUMCOLORMAPS; ++k) diff --git a/src/rendering/v_video.cpp b/src/rendering/v_video.cpp index 84b0c40280..9959bc511b 100644 --- a/src/rendering/v_video.cpp +++ b/src/rendering/v_video.cpp @@ -387,7 +387,7 @@ FString V_GetColorStringByName (const char *name, FScriptPosition *sc) int c[3], step; size_t namelen; - if (fileSystem.GetNumLumps()==0) return FString(); + if (fileSystem.GetNumEntries()==0) return FString(); rgblump = fileSystem.CheckNumForName ("X11R6RGB"); if (rgblump == -1) @@ -397,7 +397,7 @@ FString V_GetColorStringByName (const char *name, FScriptPosition *sc) return FString(); } - rgbNames = fileSystem.ReadLump (rgblump); + rgbNames = fileSystem.ReadFile (rgblump); rgb = (char *)rgbNames.GetMem(); rgbEnd = rgb + fileSystem.FileLength (rgblump); step = 0; diff --git a/src/rendering/vulkan/renderer/vk_postprocess.cpp b/src/rendering/vulkan/renderer/vk_postprocess.cpp index 3820e235af..9ed14386b0 100644 --- a/src/rendering/vulkan/renderer/vk_postprocess.cpp +++ b/src/rendering/vulkan/renderer/vk_postprocess.cpp @@ -453,7 +453,7 @@ FString VkPPShader::LoadShaderCode(const FString &lumpName, const FString &defin { int lump = fileSystem.CheckNumForFullName(lumpName); if (lump == -1) I_FatalError("Unable to load '%s'", lumpName.GetChars()); - FString code = fileSystem.ReadLump(lump).GetString().GetChars(); + FString code = fileSystem.ReadFile(lump).GetString().GetChars(); FString patchedCode; patchedCode.AppendFormat("#version %d\n", 450); diff --git a/src/rendering/vulkan/shaders/vk_shader.cpp b/src/rendering/vulkan/shaders/vk_shader.cpp index ddf4f93a94..ca6234cfbf 100644 --- a/src/rendering/vulkan/shaders/vk_shader.cpp +++ b/src/rendering/vulkan/shaders/vk_shader.cpp @@ -347,7 +347,7 @@ FString VkShaderManager::LoadPublicShaderLump(const char *lumpname) { int lump = fileSystem.CheckNumForFullName(lumpname); if (lump == -1) I_Error("Unable to load '%s'", lumpname); - FileData data = fileSystem.ReadLump(lump); + FileData data = fileSystem.ReadFile(lump); return data.GetString(); } @@ -355,6 +355,6 @@ FString VkShaderManager::LoadPrivateShaderLump(const char *lumpname) { int lump = fileSystem.CheckNumForFullName(lumpname, 0); if (lump == -1) I_Error("Unable to load '%s'", lumpname); - FileData data = fileSystem.ReadLump(lump); + FileData data = fileSystem.ReadFile(lump); return data.GetString(); } diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index eee6caa594..e3499dda1a 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -187,7 +187,7 @@ bool FCompileContext::CheckWritable(int flags) { if (!(flags & VARF_ReadOnly)) return false; if (!(flags & VARF_InternalAccess)) return true; - return fileSystem.GetLumpFile(Lump) != 0; + return fileSystem.GetFileContainer(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) && fileSystem.GetLumpFile(ctx.Lump) == 0; + const bool internal = (ctx.Function->Variants[0].Flags & VARF_Deprecated) && fileSystem.GetFileContainer(ctx.Lump) == 0; const FString &deprecationMessage = vsym->DeprecationMessage; ScriptPosition.Message(internal ? MSG_DEBUGMSG : MSG_WARNING, diff --git a/src/scripting/decorate/thingdef_parse.cpp b/src/scripting/decorate/thingdef_parse.cpp index d043f6591c..38222062ec 100644 --- a/src/scripting/decorate/thingdef_parse.cpp +++ b/src/scripting/decorate/thingdef_parse.cpp @@ -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 = fileSystem.GetLumpFullPath(sc.LumpNum); + info->SourceLumpName = fileSystem.GetFileFullPath(sc.LumpNum); if (!info->SetReplacement(replaceName)) { @@ -1270,9 +1270,9 @@ void ParseDecorate (FScanner &sc, PNamespace *ns) { sc.MustGetString(); // This check needs to remain overridable for testing purposes. - if (fileSystem.GetLumpFile(sc.LumpNum) == 0 && !Args->CheckParm("-allowdecoratecrossincludes")) + if (fileSystem.GetFileContainer(sc.LumpNum) == 0 && !Args->CheckParm("-allowdecoratecrossincludes")) { - int includefile = fileSystem.GetLumpFile(fileSystem.CheckNumForFullName(sc.String, true)); + int includefile = fileSystem.GetFileContainer(fileSystem.CheckNumForFullName(sc.String, true)); if (includefile != 0) { I_FatalError("File %s is overriding core lump %s.", diff --git a/src/scripting/thingdef_properties.cpp b/src/scripting/thingdef_properties.cpp index b1dc1bdcdb..65303c55c7 100644 --- a/src/scripting/thingdef_properties.cpp +++ b/src/scripting/thingdef_properties.cpp @@ -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) && fileSystem.GetLumpFile(bag.Lumpnum) != 0) + !(gameinfo.flags&GI_SHAREWARE) && fileSystem.GetFileContainer(bag.Lumpnum) != 0) { bag.ScriptPosition.Message(MSG_WARNING, "Icon '%s' for '%s' not found\n", i, bag.Info->TypeName.GetChars()); diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index 17f4561876..8ed707e816 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -3153,10 +3153,10 @@ DEFINE_ACTION_FUNCTION_NATIVE(_AltHUD, GetLatency, Net_GetLatency) // //========================================================================== -DEFINE_ACTION_FUNCTION(_Wads, GetNumLumps) +DEFINE_ACTION_FUNCTION(_Wads, GetNumEntries) { PARAM_PROLOGUE; - ACTION_RETURN_INT(fileSystem.GetNumLumps()); + ACTION_RETURN_INT(fileSystem.GetNumEntries()); } DEFINE_ACTION_FUNCTION(_Wads, CheckNumForName) @@ -3182,7 +3182,7 @@ DEFINE_ACTION_FUNCTION(_Wads, FindLump) PARAM_STRING(name); PARAM_INT(startlump); PARAM_INT(ns); - const bool isLumpValid = startlump >= 0 && startlump < fileSystem.GetNumLumps(); + const bool isLumpValid = startlump >= 0 && startlump < fileSystem.GetNumEntries(); ACTION_RETURN_INT(isLumpValid ? fileSystem.FindLump(name, &startlump, 0 != ns) : -1); } @@ -3191,7 +3191,7 @@ DEFINE_ACTION_FUNCTION(_Wads, GetLumpName) PARAM_PROLOGUE; PARAM_INT(lump); FString lumpname; - fileSystem.GetLumpName(lumpname, lump); + fileSystem.GetFileShortName(lumpname, lump); ACTION_RETURN_STRING(lumpname); } @@ -3199,22 +3199,22 @@ DEFINE_ACTION_FUNCTION(_Wads, GetLumpFullName) { PARAM_PROLOGUE; PARAM_INT(lump); - ACTION_RETURN_STRING(fileSystem.GetLumpFullName(lump)); + ACTION_RETURN_STRING(fileSystem.GetFileFullName(lump)); } DEFINE_ACTION_FUNCTION(_Wads, GetLumpNamespace) { PARAM_PROLOGUE; PARAM_INT(lump); - ACTION_RETURN_INT(fileSystem.GetLumpNamespace(lump)); + ACTION_RETURN_INT(fileSystem.GetFileNamespace(lump)); } DEFINE_ACTION_FUNCTION(_Wads, ReadLump) { PARAM_PROLOGUE; PARAM_INT(lump); - const bool isLumpValid = lump >= 0 && lump < fileSystem.GetNumLumps(); - ACTION_RETURN_STRING(isLumpValid ? fileSystem.ReadLump(lump).GetString() : FString()); + const bool isLumpValid = lump >= 0 && lump < fileSystem.GetNumEntries(); + ACTION_RETURN_STRING(isLumpValid ? fileSystem.ReadFile(lump).GetString() : FString()); } diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index 722b137a47..06a1d341bb 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -687,7 +687,7 @@ void ZCCCompiler::CreateStructTypes() syms = &OutNamespace->Symbols; } - if (s->NodeName() == NAME__ && fileSystem.GetLumpFile(Lump) == 0) + if (s->NodeName() == NAME__ && fileSystem.GetFileContainer(Lump) == 0) { // This is just a container for syntactic purposes. s->strct->Type = nullptr; @@ -1406,7 +1406,7 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArrayFlags & notallowed) { @@ -1617,7 +1617,7 @@ bool ZCCCompiler::CompileProperties(PClass *type, TArray &Proper TArray fields; ZCC_Identifier *id = (ZCC_Identifier *)p->Body; - if (FName(p->NodeName) == FName("prefix") && fileSystem.GetLumpFile(Lump) == 0) + if (FName(p->NodeName) == FName("prefix") && fileSystem.GetFileContainer(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 &Propertie PField *field; FName referenced = FName(p->RefName); - if (FName(p->NodeName) == FName("prefix") && fileSystem.GetLumpFile(Lump) == 0) + if (FName(p->NodeName) == FName("prefix") && fileSystem.GetFileContainer(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 (fileSystem.GetLumpFile(Lump) != 0 || !formember) + if (fileSystem.GetFileContainer(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(field)->Flags & ZCC_Native) && fileSystem.GetLumpFile(Lump) == 0) + if (field->NodeType == AST_VarDeclarator && (static_cast(field)->Flags & ZCC_Native) && fileSystem.GetFileContainer(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. diff --git a/src/scripting/zscript/zcc_parser.cpp b/src/scripting/zscript/zcc_parser.cpp index 6ff20a64ac..a059f096e6 100644 --- a/src/scripting/zscript/zcc_parser.cpp +++ b/src/scripting/zscript/zcc_parser.cpp @@ -355,7 +355,7 @@ static void DoParse(int lumpnum) void *parser; ZCCToken value; auto baselump = lumpnum; - auto fileno = fileSystem.GetLumpFile(lumpnum); + auto fileno = fileSystem.GetFileContainer(lumpnum); parser = ZCCParseAlloc(malloc); ZCCParseState state; @@ -422,11 +422,11 @@ static void DoParse(int lumpnum) } else { - auto fileno2 = fileSystem.GetLumpFile(lumpnum); + auto fileno2 = fileSystem.GetFileContainer(lumpnum); if (fileno == 0 && fileno2 != 0) { I_FatalError("File %s is overriding core lump %s.", - fileSystem.GetResourceFileFullName(fileSystem.GetLumpFile(lumpnum)), Includes[i].GetChars()); + fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(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, fileSystem.GetLumpFullPath(baselump).GetChars()); + I_Error("%d errors while parsing %s", FScriptPosition::ErrorCounter, fileSystem.GetFileFullPath(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 = fileSystem.GetLumpFullPath(baselump); + FString filename = fileSystem.GetFileFullPath(baselump); filename.ReplaceChars(":\\/?|", '.'); filename << ".ast"; FileWriter *ff = FileWriter::Open(filename); @@ -471,19 +471,19 @@ static void DoParse(int lumpnum) } PSymbolTable symtable; - auto newns = fileSystem.GetLumpFile(baselump) == 0 ? Namespaces.GlobalNamespace : Namespaces.NewNamespace(fileSystem.GetLumpFile(baselump)); + auto newns = fileSystem.GetFileContainer(baselump) == 0 ? Namespaces.GlobalNamespace : Namespaces.NewNamespace(fileSystem.GetFileContainer(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, fileSystem.GetLumpFullPath(baselump).GetChars()); + I_Error("%d errors, %d warnings while compiling %s", FScriptPosition::ErrorCounter, FScriptPosition::WarnCounter, fileSystem.GetFileFullPath(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, fileSystem.GetLumpFullPath(baselump).GetChars()); + Printf(TEXTCOLOR_ORANGE "%d warnings while compiling %s\n", FScriptPosition::WarnCounter, fileSystem.GetFileFullPath(baselump).GetChars()); } } diff --git a/src/serializer.cpp b/src/serializer.cpp index d301a69d38..146ac21141 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -1475,7 +1475,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FTextureID &value, FTe if (fileSystem.GetLinkedTexture(pic->SourceLump) == pic) { - name = fileSystem.GetLumpFullName(pic->SourceLump); + name = fileSystem.GetFileFullName(pic->SourceLump); } else { diff --git a/src/sound/music/i_music.cpp b/src/sound/music/i_music.cpp index 3b87438719..cea4de38bd 100644 --- a/src/sound/music/i_music.cpp +++ b/src/sound/music/i_music.cpp @@ -177,7 +177,7 @@ static void SetupGenMidi() Printf("No GENMIDI lump found. OPL playback not available.\n"); return; } - auto data = fileSystem.OpenLumpReader(lump); + auto data = fileSystem.OpenFileReader(lump); auto genmidi = data.Read(); if (genmidi.Size() < 8 + 175 * 36 || memcmp(genmidi.Data(), "#OPL_II#", 8)) return; @@ -191,7 +191,7 @@ static void SetupWgOpn() { return; } - FileData data = fileSystem.ReadLump(lump); + FileData data = fileSystem.ReadFile(lump); ZMusic_SetWgOpn(data.GetMem(), (uint32_t)data.GetSize()); } @@ -202,7 +202,7 @@ static void SetupDMXGUS() { return; } - FileData data = fileSystem.ReadLump(lump); + FileData data = fileSystem.ReadFile(lump); ZMusic_SetDmxGus(data.GetMem(), (uint32_t)data.GetSize()); } @@ -315,7 +315,7 @@ static ZMusic_MidiSource GetMIDISource(const char *fn) return nullptr; } - auto wlump = fileSystem.OpenLumpReader(lump); + auto wlump = fileSystem.OpenFileReader(lump); uint32_t id[32 / 4]; diff --git a/src/sound/music/i_soundfont.cpp b/src/sound/music/i_soundfont.cpp index 5b63b30ae6..66d1647802 100644 --- a/src/sound/music/i_soundfont.cpp +++ b/src/sound/music/i_soundfont.cpp @@ -304,7 +304,7 @@ FLumpPatchSetReader::FLumpPatchSetReader(const char *filename) FileReader FLumpPatchSetReader::OpenMainConfigFile() { - return fileSystem.ReopenLumpReader(mLumpIndex); + return fileSystem.ReopenFileReader(mLumpIndex); } FileReader FLumpPatchSetReader::OpenFile(const char *name) @@ -314,7 +314,7 @@ FileReader FLumpPatchSetReader::OpenFile(const char *name) path = mBasePath + name; auto index = fileSystem.CheckNumForFullName(path); if (index < 0) return FileReader(); - return fileSystem.ReopenLumpReader(index); + return fileSystem.ReopenFileReader(index); } //========================================================================== diff --git a/src/sound/s_advsound.cpp b/src/sound/s_advsound.cpp index e5dfef0725..4738d92690 100644 --- a/src/sound/s_advsound.cpp +++ b/src/sound/s_advsound.cpp @@ -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 < fileSystem.GetNumLumps(); ++lump) + for (lump = 0; lump < fileSystem.GetNumEntries(); ++lump) { - switch (fileSystem.GetLumpNamespace (lump)) + switch (fileSystem.GetFileNamespace (lump)) { case ns_global: - if (fileSystem.CheckLumpName (lump, "SNDINFO")) + if (fileSystem.CheckFileName (lump, "SNDINFO")) { S_AddSNDINFO (lump); } @@ -1195,8 +1195,8 @@ static void S_AddSNDINFO (int lump) if (lump >= 0) { // do not set the alias if a later WAD defines its own music of this name - int file = fileSystem.GetLumpFile(lump); - int sndifile = fileSystem.GetLumpFile(sc.LumpNum); + int file = fileSystem.GetFileContainer(lump); + int sndifile = fileSystem.GetFileContainer(sc.LumpNum); if (file > sndifile) { sc.MustGetString(); @@ -1281,7 +1281,7 @@ static void S_AddSNDINFO (int lump) static void S_AddStrifeVoice (int lumpnum) { char name[16] = "svox/"; - fileSystem.GetLumpName (name+5, lumpnum); + fileSystem.GetFileShortName (name+5, lumpnum); S_AddSound (name, lumpnum); } diff --git a/src/sound/s_doomsound.cpp b/src/sound/s_doomsound.cpp index 31ca2edca3..311fc17f51 100644 --- a/src/sound/s_doomsound.cpp +++ b/src/sound/s_doomsound.cpp @@ -120,7 +120,7 @@ void S_Init() TArray curve; if (curvelump >= 0) { - curve = fileSystem.ReadLumpIntoArray(curvelump); + curve = fileSystem.GetFileData(curvelump); } soundEngine->Init(curve); } @@ -1065,7 +1065,7 @@ bool DoomSoundEngine::ValidatePosVel(int sourcetype, const void* source, const F TArray DoomSoundEngine::ReadSound(int lumpnum) { - auto wlump = fileSystem.OpenLumpReader(lumpnum); + auto wlump = fileSystem.OpenFileReader(lumpnum); return wlump.Read(); } @@ -1139,7 +1139,7 @@ void DoomSoundEngine::NoiseDebug() color = (chan->ChanFlags & CHANF_LOOP) ? CR_BROWN : CR_GREY; // Name - fileSystem.GetLumpName(temp, S_sfx[chan->SoundID].lumpnum); + fileSystem.GetFileShortName(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) { - fileSystem.GetLumpName(lumpname, sfx->lumpnum); + fileSystem.GetFileShortName(lumpname, sfx->lumpnum); Printf("%3d. %s (%s)\n", i, sfx->name.GetChars(), lumpname); } else if (S_sfx[i].link != sfxinfo_t::NO_LINK) diff --git a/src/sound/s_music.cpp b/src/sound/s_music.cpp index bedc061092..f602507a7d 100644 --- a/src/sound/s_music.cpp +++ b/src/sound/s_music.cpp @@ -445,7 +445,7 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force) { return false; } - reader = fileSystem.ReopenLumpReader(lumpnum); + reader = fileSystem.ReopenFileReader(lumpnum); } } else diff --git a/src/utility/printf.h b/src/utility/printf.h index 1593f672f6..abe5db8f37 100644 --- a/src/utility/printf.h +++ b/src/utility/printf.h @@ -78,3 +78,6 @@ int Printf (const char *format, ...) ATTRIBUTE((format(printf,1,2))); int DPrintf (int level, const char *format, ...) ATTRIBUTE((format(printf,2,3))); void debugprintf(const char* f, ...); // Prints to the debugger's log. + +// flag to silence non-error output +extern bool batchrun; diff --git a/src/utility/sc_man.cpp b/src/utility/sc_man.cpp index 6595677ae7..0fd5fd2b35 100644 --- a/src/utility/sc_man.cpp +++ b/src/utility/sc_man.cpp @@ -279,10 +279,10 @@ void FScanner :: OpenLumpNum (int lump) { Close (); { - FileData mem = fileSystem.ReadLump(lump); + FileData mem = fileSystem.ReadFile(lump); ScriptBuffer = mem.GetString(); } - ScriptName = fileSystem.GetLumpFullPath(lump); + ScriptName = fileSystem.GetFileFullPath(lump); LumpNum = lump; PrepareScript (); } diff --git a/src/win32/st_start.cpp b/src/win32/st_start.cpp index 00f13591ca..fc85b9b90c 100644 --- a/src/win32/st_start.cpp +++ b/src/win32/st_start.cpp @@ -531,7 +531,7 @@ int RunEndoom() return 0; } - if (fileSystem.GetLumpFile(endoom_lump) == fileSystem.GetMaxIwadNum() && showendoom == 2) + if (fileSystem.GetFileContainer(endoom_lump) == fileSystem.GetMaxIwadNum() && showendoom == 2) { // showendoom==2 means to show only lumps from PWADs. return 0; @@ -553,7 +553,7 @@ int RunEndoom() RestoreConView (); S_StopMusic(true); - fileSystem.ReadLump (endoom_lump, endoom_screen); + fileSystem.ReadFile (endoom_lump, endoom_screen); // Draw the loading screen to a bitmap. StartupBitmap = ST_Util_AllocTextBitmap (font); diff --git a/src/win32/st_start_util.cpp b/src/win32/st_start_util.cpp index 750d4cac70..9f1f1b0c26 100644 --- a/src/win32/st_start_util.cpp +++ b/src/win32/st_start_util.cpp @@ -422,9 +422,9 @@ FHexenStartupScreen::FHexenStartupScreen(int max_progress, long& hr) } NetNotchBits = new uint8_t[ST_NETNOTCH_WIDTH / 2 * ST_NETNOTCH_HEIGHT]; - fileSystem.ReadLump(netnotch_lump, NetNotchBits); + fileSystem.ReadFile(netnotch_lump, NetNotchBits); NotchBits = new uint8_t[ST_NOTCH_WIDTH / 2 * ST_NOTCH_HEIGHT]; - fileSystem.ReadLump(notch_lump, NotchBits); + fileSystem.ReadFile(notch_lump, NotchBits); uint8_t startup_screen[153648]; union @@ -433,7 +433,7 @@ FHexenStartupScreen::FHexenStartupScreen(int max_progress, long& hr) uint32_t quad; } c; - fileSystem.ReadLump(startup_lump, startup_screen); + fileSystem.ReadFile(startup_lump, startup_screen); c.color.rgbReserved = 0; @@ -590,7 +590,7 @@ FHereticStartupScreen::FHereticStartupScreen(int max_progress, long& hr) return; } - fileSystem.ReadLump(loading_lump, loading_screen); + fileSystem.ReadFile(loading_lump, loading_screen); // Slap the Heretic minor version on the loading screen. Heretic // did this inside the executable rather than coming with modified @@ -732,7 +732,7 @@ FStrifeStartupScreen::FStrifeStartupScreen(int max_progress, long& hr) // Fill bitmap with the startup image. memset(ST_Util_BitsForBitmap(StartupBitmap), 0xF0, 64000); - auto lumpr = fileSystem.OpenLumpReader(startup_lump); + auto lumpr = fileSystem.OpenFileReader(startup_lump); lumpr.Seek(57 * 320, FileReader::SeekSet); lumpr.Read(ST_Util_BitsForBitmap(StartupBitmap) + 41 * 320, 95 * 320); @@ -744,7 +744,7 @@ FStrifeStartupScreen::FStrifeStartupScreen(int max_progress, long& hr) if (lumpnum >= 0 && (lumplen = fileSystem.FileLength(lumpnum)) == StrifeStartupPicSizes[i]) { - auto lumpr = fileSystem.OpenLumpReader(lumpnum); + auto lumpr = fileSystem.OpenFileReader(lumpnum); StartupPics[i] = new uint8_t[lumplen]; lumpr.Read(StartupPics[i], lumplen); } @@ -1073,7 +1073,7 @@ uint8_t* ST_Util_LoadFont(const char* filename) } font = new uint8_t[lumplen + 1]; font[0] = height; // Store font height in the first byte. - fileSystem.ReadLump(lumpnum, font + 1); + fileSystem.ReadFile(lumpnum, font + 1); return font; } diff --git a/wadsrc/static/zscript/base.zs b/wadsrc/static/zscript/base.zs index 7cbaf8e917..cb18dad32f 100644 --- a/wadsrc/static/zscript/base.zs +++ b/wadsrc/static/zscript/base.zs @@ -878,7 +878,7 @@ struct Wads native static int FindLump(string name, int startlump = 0, FindLumpNamespace ns = GlobalNamespace); native static string ReadLump(int lump); - native static int GetNumLumps(); + native static int GetNumEntries(); native static string GetLumpName(int lump); native static string GetLumpFullName(int lump); native static int GetLumpNamespace(int lump);