mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- adapted to backend changes.
This commit is contained in:
parent
cf19d75242
commit
3c695a5abd
29 changed files with 127 additions and 102 deletions
|
@ -1078,6 +1078,7 @@ set (PCH_SOURCES
|
|||
common/textures/formats/stbtexture.cpp
|
||||
common/textures/formats/anmtexture.cpp
|
||||
common/textures/formats/startscreentexture.cpp
|
||||
common/textures/formats/qoitexture.cpp
|
||||
common/textures/hires/hqresize.cpp
|
||||
common/models/models_md3.cpp
|
||||
common/models/models_md2.cpp
|
||||
|
|
|
@ -176,7 +176,7 @@ static TArray<FString> CheckGameInfo(TArray<FString>& pwads)
|
|||
resfile = FResourceFile::OpenResourceFile(filename, fr, true);
|
||||
}
|
||||
else
|
||||
resfile = FResourceFile::OpenDirectory(filename, true);
|
||||
resfile = FResourceFile::OpenDirectory(filename);
|
||||
|
||||
FName gameinfo = "GAMEINFO.TXT";
|
||||
if (resfile != NULL)
|
||||
|
@ -189,7 +189,7 @@ static TArray<FString> CheckGameInfo(TArray<FString>& pwads)
|
|||
if (FName(lmp->getName(), true) == gameinfo)
|
||||
{
|
||||
// Found one!
|
||||
auto bases = ParseGameInfo(pwads, resfile->FileName, (const char*)lmp->Lock(), lmp->LumpSize);
|
||||
auto bases = ParseGameInfo(pwads, resfile->FileName.c_str(), (const char*)lmp->Lock(), lmp->LumpSize);
|
||||
delete resfile;
|
||||
return bases;
|
||||
}
|
||||
|
@ -279,7 +279,6 @@ static void DeleteStuff(FileSystem &fileSystem, const TArray<FString>& deletelum
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
const char* iwad_folders[13] = { "textures/", "hires/", "sounds/", "music/", "maps/" };
|
||||
const char* iwad_reserved_duke[12] = { ".map", "rmapinfo", ".con", "menudef", "gldefs", "zscript", "maps/", nullptr };
|
||||
const char* iwad_reserved_blood[12] = { ".map", "rmapinfo", ".ini", "menudef", "gldefs", "zscript", "maps/", nullptr };
|
||||
const char* iwad_reserved_sw[12] = { ".map", "rmapinfo", "swcustom.txt", "menudef", "gldefs", "zscript", "maps/", nullptr };
|
||||
|
@ -292,6 +291,36 @@ const char** iwad_reserved()
|
|||
(g_gameType & GAMEFLAG_BLOOD) ? iwad_reserved_blood : iwad_reserved_duke;
|
||||
}
|
||||
|
||||
static int FileSystemPrintf(FSMessageLevel level, const char* fmt, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, fmt);
|
||||
FString text;
|
||||
text.VFormat(fmt, arg);
|
||||
switch (level)
|
||||
{
|
||||
case FSMessageLevel::Error:
|
||||
return Printf(TEXTCOLOR_RED "%s", text.GetChars());
|
||||
break;
|
||||
case FSMessageLevel::Warning:
|
||||
Printf(TEXTCOLOR_YELLOW "%s", text.GetChars());
|
||||
break;
|
||||
case FSMessageLevel::Attention:
|
||||
Printf(TEXTCOLOR_BLUE "%s", text.GetChars());
|
||||
break;
|
||||
case FSMessageLevel::Message:
|
||||
Printf("%s", text.GetChars());
|
||||
break;
|
||||
case FSMessageLevel::DebugWarn:
|
||||
DPrintf(DMSG_WARNING, "%s", text.GetChars());
|
||||
break;
|
||||
case FSMessageLevel::DebugNotify:
|
||||
DPrintf(DMSG_NOTIFY, "%s", text.GetChars());
|
||||
break;
|
||||
}
|
||||
return (int)text.Len();
|
||||
}
|
||||
|
||||
void InitFileSystem(TArray<GrpEntry>& groups)
|
||||
{
|
||||
TArray<int> dependencies;
|
||||
|
@ -392,24 +421,23 @@ void InitFileSystem(TArray<GrpEntry>& groups)
|
|||
}
|
||||
todelete.Append(userConfig.toBeDeleted);
|
||||
LumpFilterInfo lfi;
|
||||
for (auto p : iwad_folders) lfi.reservedFolders.Push(p);
|
||||
for (auto p = iwad_reserved(); *p; p++) lfi.requiredPrefixes.Push(*p);
|
||||
lfi.reservedFolders = { "textures/", "hires/", "sounds/", "music/", "maps/" };
|
||||
for (auto p = iwad_reserved(); *p; p++) lfi.requiredPrefixes.push_back(*p);
|
||||
if (isBlood())
|
||||
{
|
||||
lfi.embeddings.Push("blood.rff");
|
||||
lfi.embeddings.Push("sounds.rff");
|
||||
lfi.embeddings = { "blood.rff", "sounds.rff" };
|
||||
}
|
||||
|
||||
lfi.dotFilter = LumpFilter;
|
||||
|
||||
if (isDukeEngine()) lfi.gameTypeFilter.Push("DukeEngine");
|
||||
if (isDukeLike()) lfi.gameTypeFilter.Push("DukeLike");
|
||||
if (isDukeEngine()) lfi.gameTypeFilter.push_back("DukeEngine");
|
||||
if (isDukeLike()) lfi.gameTypeFilter.push_back("DukeLike");
|
||||
|
||||
lfi.postprocessFunc = [&]()
|
||||
{
|
||||
DeleteStuff(fileSystem, todelete, groups.Size());
|
||||
};
|
||||
fileSystem.InitMultipleFiles(Files, false, &lfi);
|
||||
fileSystem.InitMultipleFiles(Files, &lfi);
|
||||
if (Args->CheckParm("-dumpfs"))
|
||||
{
|
||||
FILE* f = fopen("filesystem.dir", "wb");
|
||||
|
|
|
@ -320,7 +320,7 @@ CCMD(md4sum)
|
|||
{
|
||||
auto data = fr.Read();
|
||||
uint8_t digest[16];
|
||||
md4once(data.Data(), data.Size(), digest);
|
||||
md4once(data.data(), data.size(), digest);
|
||||
for (int j = 0; j < 16; ++j)
|
||||
{
|
||||
Printf("%02x", digest[j]);
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "tiletexture.h"
|
||||
#include "games/blood/src/mapstructs.h"
|
||||
#include "buildtiles.h"
|
||||
#include "m_swap.h"
|
||||
|
||||
extern BitArray clipsectormap;
|
||||
|
||||
|
@ -546,7 +547,7 @@ void loadMap(const char* filename, int flags, DVector3* pos, int16_t* ang, secto
|
|||
fr.Seek(0, FileReader::SeekSet);
|
||||
auto buffer = fr.Read();
|
||||
uint8_t md4[16];
|
||||
md4once(buffer.Data(), buffer.Size(), md4);
|
||||
md4once(buffer.data(), (unsigned)buffer.size(), md4);
|
||||
PostProcessLevel(md4, filename, sprites);
|
||||
loadMapHack(filename, md4, sprites);
|
||||
setWallSectors();
|
||||
|
@ -697,7 +698,7 @@ TArray<walltype> loadMapWalls(const char* filename)
|
|||
if (isBlood())
|
||||
{
|
||||
auto data = fr.Read();
|
||||
P_LoadBloodMapWalls(data.Data(), data.Size(), lwalls);
|
||||
P_LoadBloodMapWalls(data.data(), data.size(), lwalls);
|
||||
return lwalls;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "v_video.h"
|
||||
#include "findfile.h"
|
||||
#include "v_draw.h"
|
||||
#include "fs_findfile.h"
|
||||
#include "savegamehelp.h"
|
||||
|
||||
//=============================================================================
|
||||
|
@ -59,22 +60,14 @@ void FSavegameManager::ReadSaveStrings()
|
|||
{
|
||||
if (SaveGames.Size() == 0)
|
||||
{
|
||||
void *filefirst;
|
||||
findstate_t c_file;
|
||||
FString filter;
|
||||
|
||||
LastSaved = LastAccessed = -1;
|
||||
quickSaveSlot = nullptr;
|
||||
filter = G_BuildSaveName("*");
|
||||
filefirst = I_FindFirst(filter.GetChars(), &c_file);
|
||||
if (filefirst != ((void *)(-1)))
|
||||
FileList list;
|
||||
if (ScanDirectory(list, G_GetSavegamesFolder().GetChars(), "*." SAVEGAME_EXT, true))
|
||||
{
|
||||
do
|
||||
for (auto& entry : list)
|
||||
{
|
||||
// I_FindName only returns the file's name and not its full path
|
||||
FString filepath = G_BuildSaveName(I_FindName(&c_file));
|
||||
|
||||
FResourceFile *savegame = FResourceFile::OpenResourceFile(filepath, true, true);
|
||||
FResourceFile *savegame = FResourceFile::OpenResourceFile(entry.FilePath.c_str(), true);
|
||||
if (savegame != nullptr)
|
||||
{
|
||||
FResourceLump *info = savegame->FindLump("info.json");
|
||||
|
@ -92,15 +85,14 @@ void FSavegameManager::ReadSaveStrings()
|
|||
if (check != 0)
|
||||
{
|
||||
FSaveGameNode *node = new FSaveGameNode;
|
||||
node->Filename = filepath;
|
||||
node->Filename = entry.FilePath.c_str();
|
||||
node->bOldVersion = check == -1;
|
||||
node->bMissingWads = check == -2;
|
||||
node->SaveTitle = title;
|
||||
InsertSaveNode(node);
|
||||
}
|
||||
}
|
||||
} while (I_FindNext (filefirst, &c_file) == 0);
|
||||
I_FindClose (filefirst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,8 +124,8 @@ void paletteLoadFromDisk(void)
|
|||
// Read base shade table (lookuptables 0).
|
||||
unsigned length = numshades * 256;
|
||||
auto buffer = fil.Read(length);
|
||||
if (buffer.Size() != length) return;
|
||||
lookups.setTable(0, buffer.Data());
|
||||
if (buffer.size() != length) return;
|
||||
lookups.setTable(0, buffer.data());
|
||||
|
||||
paletteloaded |= PALETTE_SHADE | PALETTE_TRANSLUC;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "filesystem.h"
|
||||
#include "zstring.h"
|
||||
#include "palentry.h"
|
||||
#include "basics.h"
|
||||
|
||||
|
||||
enum
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
class FSerializer;
|
||||
struct IntRect;
|
||||
class FGameTexture;
|
||||
|
||||
void render_drawrooms(DCoreActor* playersprite, const DVector3& position, sectortype* sectnum, const DRotator& angles, double interpfrac, float fov = -1);
|
||||
void render_camtex(DCoreActor* playersprite, const DVector3& position, sectortype* sect, const DRotator& angles, FGameTexture* camtex, IntRect& rect, double interpfrac);
|
||||
|
|
|
@ -77,7 +77,7 @@ void BunchDrawer::Init(HWDrawInfo *_di, Clipper* c, const DVector2& view, angle_
|
|||
DVector2 vv;
|
||||
vv.X = w.pos.X - view.X;
|
||||
vv.Y = w.pos.Y + view.Y; // beware of different coordinate systems!
|
||||
w.clipangle = RAD2BAM(atan2(vv.Y, vv.X));
|
||||
w.clipangle = vv.Angle().BAMs();
|
||||
}
|
||||
memset(sectionstartang.Data(), -1, sectionstartang.Size() * sizeof(sectionstartang[0]));
|
||||
memset(sectionendang.Data(), -1, sectionendang.Size() * sizeof(sectionendang[0]));
|
||||
|
|
|
@ -539,7 +539,7 @@ bool HWMirrorPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *clippe
|
|||
double newx = x * 2 + dx * i / j - view.X;
|
||||
double newy = y * 2 + dy * i / j - view.Y;
|
||||
|
||||
auto myan = RAD2BAM(atan2(dy, dx));
|
||||
auto myan = VecToAngle(dx, dy).BAMs();
|
||||
auto newan = myan + myan - vp.RotAngle;
|
||||
|
||||
vp.RotAngle = newan;
|
||||
|
@ -563,8 +563,8 @@ bool HWMirrorPortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *clippe
|
|||
|
||||
ClearClipper(di, clipper);
|
||||
|
||||
auto startan = RAD2BAM(atan2(line->pos.Y - newy, line->pos.X - newx));
|
||||
auto endan = RAD2BAM(atan2(line->point2Wall()->pos.Y - newy, line->point2Wall()->pos.X - newx));
|
||||
auto startan = VecToAngle(line->pos.X - newx, line->pos.Y - newy).BAMs();
|
||||
auto endan = VecToAngle(line->point2Wall()->pos.X - newx, line->point2Wall()->pos.Y - newy).BAMs();
|
||||
clipper->RestrictVisibleRange(endan, startan); // we check the line from the backside so angles are reversed.
|
||||
return true;
|
||||
}
|
||||
|
@ -636,8 +636,8 @@ bool HWLineToLinePortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *cl
|
|||
|
||||
ClearClipper(di, clipper);
|
||||
|
||||
auto startan = RAD2BAM(atan2(origin->pos.Y + oldvp.Y, origin->pos.X - oldvp.X));
|
||||
auto endan = RAD2BAM(atan2(origin->point2Wall()->pos.Y + oldvp.Y, origin->point2Wall()->pos.X - oldvp.X));
|
||||
auto startan = VecToAngle(origin->pos.X - oldvp.X, origin->pos.Y + oldvp.Y).BAMs();
|
||||
auto endan = VecToAngle(origin->point2Wall()->pos.X - oldvp.X, origin->point2Wall()->pos.Y + oldvp.Y).BAMs();
|
||||
clipper->RestrictVisibleRange(startan, endan);
|
||||
return true;
|
||||
}
|
||||
|
@ -689,8 +689,8 @@ bool HWLineToSpritePortal::Setup(HWDrawInfo* di, FRenderState& rstate, Clipper*
|
|||
|
||||
ClearClipper(di, clipper);
|
||||
|
||||
auto startan = RAD2BAM(atan2(origin->pos.Y - origy, origin->pos.X - origx));
|
||||
auto endan = RAD2BAM(atan2(origin->point2Wall()->pos.Y - origy, origin->point2Wall()->pos.X - origx));
|
||||
auto startan = VecToAngle(origin->pos.X - origx, origin->pos.Y - origy).BAMs();
|
||||
auto endan = VecToAngle(origin->point2Wall()->pos.X - origx, origin->point2Wall()->pos.Y - origy).BAMs();
|
||||
clipper->RestrictVisibleRange(startan, endan);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,8 @@ bool RTS_IsInitialized()
|
|||
auto fr = fileSystem.OpenFileReader(RTSName);
|
||||
RTSName = ""; // don't try ever again.
|
||||
if (!fr.isOpen()) return false;
|
||||
RTSFile = fr.Read();
|
||||
RTSFile.Resize(fr.GetLength());
|
||||
fr.Read(RTSFile.Data(), fr.GetLength());
|
||||
if (RTSFile.Size() >= 28) // minimum size for one entry
|
||||
{
|
||||
WadInfo *wi = (WadInfo*)RTSFile.Data();
|
||||
|
|
|
@ -67,11 +67,11 @@
|
|||
#include <zlib.h>
|
||||
|
||||
#include "buildtiles.h"
|
||||
#include "fs_findfile.h"
|
||||
|
||||
|
||||
|
||||
void WriteSavePic(FileWriter* file, int width, int height);
|
||||
bool WriteZip(const char* filename, TArray<FString>& filenames, TArray<FCompressedBuffer>& content);
|
||||
extern FString savename;
|
||||
extern FString BackupSaveGame;
|
||||
int SaveVersion;
|
||||
|
@ -114,7 +114,7 @@ static void SerializeSession(FSerializer& arc)
|
|||
|
||||
bool ReadSavegame(const char* name)
|
||||
{
|
||||
auto savereader = FResourceFile::OpenResourceFile(name, true, true);
|
||||
auto savereader = FResourceFile::OpenResourceFile(name, true);
|
||||
|
||||
if (savereader != nullptr)
|
||||
{
|
||||
|
@ -234,8 +234,10 @@ bool WriteSavegame(const char* filename, const char *name)
|
|||
savegame_filenames.Push("info.json");
|
||||
savegame_content.Push(savegamesession.GetCompressedOutput());
|
||||
savegame_filenames.Push("session.json");
|
||||
for (unsigned i = 0; i < savegame_content.Size(); i++)
|
||||
savegame_content[i].filename = savegame_filenames[i].GetChars();
|
||||
|
||||
if (WriteZip(filename, savegame_filenames, savegame_content))
|
||||
if (WriteZip(filename, savegame_content.Data(), savegame_content.Size()))
|
||||
{
|
||||
// Check whether the file is ok by trying to open it.
|
||||
FResourceFile* test = FResourceFile::OpenResourceFile(filename, true);
|
||||
|
@ -318,7 +320,7 @@ int G_ValidateSavegame(FileReader &fr, FString *savetitle, bool formenu)
|
|||
{
|
||||
auto data = fr.Read();
|
||||
FSerializer arc;
|
||||
if (!arc.OpenReader((const char*)data.Data(), data.Size()))
|
||||
if (!arc.OpenReader((const char*)data.data(), data.size()))
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "filesystem.h"
|
||||
#include "findfile.h"
|
||||
#include "engineerrors.h"
|
||||
#include "fs_findfile.h"
|
||||
|
||||
static const char* res_exts[] = { ".grp", ".zip", ".pk3", ".pk4", ".7z", ".pk7", ".rff"};
|
||||
|
||||
|
@ -189,23 +190,13 @@ void CollectSubdirectories(TArray<FString> &searchpath, const char *dirmatch)
|
|||
FString AbsPath = M_GetNormalizedPath(dirpath);
|
||||
if (DirExists(AbsPath))
|
||||
{
|
||||
findstate_t findstate;
|
||||
void* handle;
|
||||
if ((handle = I_FindFirst(AbsPath + "/*", &findstate)) != (void*)-1)
|
||||
FileList list;
|
||||
if (ScanDirectory(list, AbsPath, "*", true))
|
||||
{
|
||||
do
|
||||
for (auto& entry : list)
|
||||
{
|
||||
if (I_FindAttr(&findstate) & FA_DIREC)
|
||||
{
|
||||
auto p = I_FindName(&findstate);
|
||||
if (strcmp(p, ".") && strcmp(p, ".."))
|
||||
{
|
||||
FStringf fullpath("%s/%s", AbsPath.GetChars(), p);
|
||||
searchpath.Push(fullpath);
|
||||
}
|
||||
}
|
||||
} while (I_FindNext(handle, &findstate) == 0);
|
||||
I_FindClose(handle);
|
||||
if (entry.isDirectory) searchpath.Push(entry.FilePath.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -313,23 +304,21 @@ TArray<FileEntry> CollectAllFilesInSearchPath()
|
|||
{
|
||||
if (DirExists(path))
|
||||
{
|
||||
findstate_t findstate;
|
||||
void* handle;
|
||||
if ((handle = I_FindFirst(path + "/*.*", &findstate)) != (void*)-1)
|
||||
FileList list;
|
||||
if (ScanDirectory(list, path, "*", true))
|
||||
{
|
||||
do
|
||||
for (auto& entry : list)
|
||||
{
|
||||
if (!(I_FindAttr(&findstate) & FA_DIREC))
|
||||
if (!entry.isDirectory)
|
||||
{
|
||||
auto p = I_FindName(&findstate);
|
||||
filelist.Reserve(1);
|
||||
auto& flentry = filelist.Last();
|
||||
flentry.FileName.Format("%s/%s", path.GetChars(), p);
|
||||
flentry.FileName = entry.FilePath.c_str();
|
||||
GetFileInfo(flentry.FileName, &flentry.FileLength, &flentry.FileTime);
|
||||
flentry.Index = index++; // to preserve order when working on the list.
|
||||
|
||||
}
|
||||
} while (I_FindNext(handle, &findstate) == 0);
|
||||
I_FindClose(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -429,7 +418,7 @@ static TArray<GrpInfo> ParseGrpInfo(const char *fn, FileReader &fr, TMap<FString
|
|||
|
||||
FScanner sc;
|
||||
auto mem = fr.Read();
|
||||
sc.OpenMem(fn, (const char *)mem.Data(), mem.Size());
|
||||
sc.OpenMem(fn, (const char *)mem.data(), (int)mem.size());
|
||||
|
||||
while (sc.GetToken())
|
||||
{
|
||||
|
@ -636,7 +625,7 @@ TArray<GrpInfo> ParseAllGrpInfos(TArray<FileEntry>& filelist)
|
|||
// This opens the base resource only for reading the grpinfo from it which we need before setting up the game state.
|
||||
std::unique_ptr<FResourceFile> engine_res;
|
||||
const char* baseres = BaseFileSearch(ENGINERES_FILE, nullptr, true, GameConfig);
|
||||
engine_res.reset(FResourceFile::OpenResourceFile(baseres, true, true));
|
||||
engine_res.reset(FResourceFile::OpenResourceFile(baseres, true));
|
||||
if (engine_res)
|
||||
{
|
||||
auto basegrp = engine_res->FindLump("engine/grpinfo.txt");
|
||||
|
@ -790,7 +779,7 @@ TArray<GrpEntry> GrpScan()
|
|||
{
|
||||
if (strcmp(ext, fn.GetChars() + fn.Len() - 4) == 0)
|
||||
{
|
||||
auto resf = FResourceFile::OpenResourceFile(fe->FileName, true, true);
|
||||
auto resf = FResourceFile::OpenResourceFile(fe->FileName, true);
|
||||
if (resf)
|
||||
{
|
||||
for (auto grp : contentGroupList)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "tiletexture.h"
|
||||
#include "s_soundinternal.h"
|
||||
|
||||
class FGameTexture;
|
||||
// extended texture info for which there is no room in the texture manager.
|
||||
|
||||
enum AnimFlags
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "texturemanager.h"
|
||||
#include "filesystem.h"
|
||||
#include "printf.h"
|
||||
#include "m_swap.h"
|
||||
|
||||
|
||||
class FTileTexture : public FImageSource
|
||||
|
@ -439,7 +440,8 @@ static void AddArtFile(const FString& filename)
|
|||
FileReader fr = fileSystem.OpenFileReader(filename);
|
||||
if (fr.isOpen())
|
||||
{
|
||||
auto artdata = fr.Read();
|
||||
TArray<uint8_t> artdata(fr.GetLength());
|
||||
fr.Read(artdata.Data(), artdata.Size());
|
||||
if (artdata.Size() > 16)
|
||||
{
|
||||
if (memcmp(artdata.Data(), "BUILDART", 8) == 0)
|
||||
|
|
|
@ -553,8 +553,8 @@ void GameInterface::loadPalette(void)
|
|||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
auto pal = fileSystem.LoadFile(PAL[i]);
|
||||
if (pal.Size() < 768) I_FatalError("%s: file too small", PAL[i]);
|
||||
paletteSetColorTable(i, pal.Data(), false, false);
|
||||
if (pal.size() < 768) I_FatalError("%s: file too small", PAL[i]);
|
||||
paletteSetColorTable(i, pal.data(), false, false);
|
||||
}
|
||||
|
||||
numshades = 64;
|
||||
|
@ -567,12 +567,12 @@ void GameInterface::loadPalette(void)
|
|||
else continue;
|
||||
}
|
||||
auto data = fileSystem.GetFileData(lump);
|
||||
if (data.Size() != 64 * 256)
|
||||
if (data.size() != 64 * 256)
|
||||
{
|
||||
if (i < 15) I_FatalError("%s: Incorrect PLU size", PLU[i]);
|
||||
else continue;
|
||||
}
|
||||
lookups.setTable(i, data.Data());
|
||||
lookups.setTable(i, data.data());
|
||||
}
|
||||
|
||||
lookups.setFadeColor(1, 255, 255, 255);
|
||||
|
|
|
@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "hw_sections.h"
|
||||
#include "sectorgeometry.h"
|
||||
#include "psky.h"
|
||||
#include "m_swap.h"
|
||||
|
||||
#include "blood.h"
|
||||
|
||||
|
@ -612,11 +613,11 @@ void dbLoadMap(const char* pPath, DVector3& pos, short* pAngle, sectortype** cur
|
|||
fr.Seek(0, FileReader::SeekSet);
|
||||
auto buffer = fr.Read();
|
||||
uint8_t md4[16];
|
||||
md4once(buffer.Data(), buffer.Size(), md4);
|
||||
md4once(buffer.data(), (unsigned)buffer.size(), md4);
|
||||
PostProcessLevel(md4, mapname, sprites);
|
||||
loadMapHack(mapname, md4, sprites);
|
||||
|
||||
if (CalcCRC32(buffer.Data(), buffer.Size() - 4) != nCRC)
|
||||
if (CalcCRC32(buffer.data(), (unsigned)buffer.size() - 4) != nCRC)
|
||||
{
|
||||
I_Error("%s: Map File does not match CRC", mapname.GetChars());
|
||||
}
|
||||
|
|
|
@ -106,7 +106,8 @@ void FireInit(void)
|
|||
auto fr = fileSystem.OpenFileReader("rfire.clu");
|
||||
if (!fr.isOpen())
|
||||
I_Error("RFIRE.CLU not found");
|
||||
gCLU = fr.Read();
|
||||
gCLU.Resize((unsigned)fr.GetLength());
|
||||
fr.Read(gCLU.Data(), fr.GetLength());
|
||||
for (int i = 0; i < 100; i++)
|
||||
DoFireFrame();
|
||||
}
|
||||
|
|
|
@ -172,7 +172,7 @@ void IniFile::Load()
|
|||
if (fp.isOpen())
|
||||
{
|
||||
auto pBuffer = fp.ReadPadded(1);
|
||||
LoadRes(pBuffer.Data());
|
||||
LoadRes(pBuffer.data());
|
||||
}
|
||||
else
|
||||
curNode->next = &head;
|
||||
|
|
|
@ -25,6 +25,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
enum
|
||||
{
|
||||
BMAX_PATH = 260
|
||||
};
|
||||
|
||||
|
||||
struct FNODE
|
||||
{
|
||||
FNODE *next;
|
||||
|
|
|
@ -33,7 +33,7 @@ class BloodSoundEngine : public RazeSoundEngine
|
|||
{
|
||||
// client specific parts of the sound engine go in this class.
|
||||
void CalcPosVel(int type, const void* source, const float pt[3], int channum, int chanflags, FSoundID chanSound, FVector3* pos, FVector3* vel, FSoundChan* channel) override;
|
||||
TArray<uint8_t> ReadSound(int lumpnum) override;
|
||||
std::vector<uint8_t> ReadSound(int lumpnum) override;
|
||||
|
||||
public:
|
||||
BloodSoundEngine()
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
TArray<uint8_t> BloodSoundEngine::ReadSound(int lumpnum)
|
||||
std::vector<uint8_t> BloodSoundEngine::ReadSound(int lumpnum)
|
||||
{
|
||||
auto wlump = fileSystem.OpenFileReader(lumpnum);
|
||||
return wlump.Read();
|
||||
|
|
|
@ -1089,7 +1089,7 @@ int ConCompiler::parsecommand()
|
|||
temp_ifelse_check = checking_ifelse;
|
||||
checking_ifelse = 0;
|
||||
auto origtptr = textptr;
|
||||
textptr = (char*)data.Data();
|
||||
textptr = (char*)data.data();
|
||||
|
||||
do
|
||||
done = parsecommand();
|
||||
|
@ -3107,7 +3107,7 @@ void ConCompiler::compilecon(const char *filenam)
|
|||
}
|
||||
Printf("Compiling: '%s'.\n", filenam);
|
||||
auto data = fileSystem.GetFileData(currentsourcefile, 1);
|
||||
textptr = (char*)data.Data();
|
||||
textptr = (char*)data.data();
|
||||
|
||||
line_number = 1;
|
||||
errorcount = warningcount = 0;
|
||||
|
|
|
@ -85,7 +85,7 @@ class DukeSoundEngine : public RazeSoundEngine
|
|||
{
|
||||
// client specific parts of the sound engine go in this class.
|
||||
void CalcPosVel(int type, const void* source, const float pt[3], int channum, int chanflags, FSoundID chanSound, FVector3* pos, FVector3* vel, FSoundChan* chan) override;
|
||||
TArray<uint8_t> ReadSound(int lumpnum) override;
|
||||
std::vector<uint8_t> ReadSound(int lumpnum) override;
|
||||
|
||||
public:
|
||||
DukeSoundEngine()
|
||||
|
@ -145,7 +145,7 @@ static FSoundID GetReplacementSound(FSoundID soundNum)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
TArray<uint8_t> DukeSoundEngine::ReadSound(int lumpnum)
|
||||
std::vector<uint8_t> DukeSoundEngine::ReadSound(int lumpnum)
|
||||
{
|
||||
auto wlump = fileSystem.OpenFileReader(lumpnum);
|
||||
return wlump.Read();
|
||||
|
|
|
@ -194,8 +194,6 @@ public:
|
|||
};
|
||||
|
||||
|
||||
extern char g_modDir[BMAX_PATH];
|
||||
|
||||
void G_LoadGroupsInDir(const char* dirname);
|
||||
void G_DoAutoload(const char* dirname);
|
||||
void DrawRel(FGameTexture* tile, double x, double y, int shade = 0);
|
||||
|
|
|
@ -140,7 +140,7 @@ public:
|
|||
case kFrameSound:
|
||||
{
|
||||
auto buffer = fp.Read(nSize);
|
||||
assert(buffer.Size() == kSampleSize);
|
||||
assert(buffer.size() == kSampleSize);
|
||||
auto wbuffer = audio.samples + audio.nWrite * kSampleSize;
|
||||
for (int i = 0; i < 2205; i++)
|
||||
{
|
||||
|
|
|
@ -137,7 +137,7 @@ class EXSoundEngine : public RazeSoundEngine
|
|||
{
|
||||
// client specific parts of the sound engine go in this class.
|
||||
void CalcPosVel(int type, const void* source, const float pt[3], int channum, int chanflags, FSoundID chanSound, FVector3* pos, FVector3* vel, FSoundChan* chan) override;
|
||||
TArray<uint8_t> ReadSound(int lumpnum) override;
|
||||
std::vector<uint8_t> ReadSound(int lumpnum) override;
|
||||
|
||||
public:
|
||||
EXSoundEngine()
|
||||
|
@ -165,7 +165,7 @@ public:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
TArray<uint8_t> EXSoundEngine::ReadSound(int lumpnum)
|
||||
std::vector<uint8_t> EXSoundEngine::ReadSound(int lumpnum)
|
||||
{
|
||||
auto wlump = fileSystem.OpenFileReader(lumpnum);
|
||||
return wlump.Read();
|
||||
|
@ -191,7 +191,7 @@ int LoadSound(const char* name)
|
|||
{
|
||||
auto check = fileSystem.GetFileData(lump);
|
||||
bool loops = false;
|
||||
if (check.Size() > 26 && check[26] == 6 && !memcmp("Creative Voice File", check.Data(), 19))
|
||||
if (check.size() > 26 && check[26] == 6 && !memcmp("Creative Voice File", check.data(), 19))
|
||||
{
|
||||
// This game uses the actual loop point information in the sound data as its only means to check if a sound is looped.
|
||||
loops = true;
|
||||
|
|
|
@ -234,12 +234,12 @@ void GameInterface::loadPalette(void)
|
|||
|
||||
paletteLoadFromDisk();
|
||||
auto pal = fileSystem.LoadFile("3drealms.pal", 0);
|
||||
if (pal.Size() >= 768)
|
||||
if (pal.size() >= 768)
|
||||
{
|
||||
for (auto& c : pal)
|
||||
c <<= 2;
|
||||
|
||||
paletteSetColorTable(DREALMSPAL, pal.Data(), true, true);
|
||||
paletteSetColorTable(DREALMSPAL, pal.data(), true, true);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -67,21 +67,21 @@ static bool tokenready; // only true if UnGetToken was ju
|
|||
==============
|
||||
*/
|
||||
|
||||
TArray<uint8_t> LoadScriptFile(const char *filename)
|
||||
std::vector<uint8_t> LoadScriptFile(const char *filename)
|
||||
{
|
||||
FileReader fp;
|
||||
|
||||
if (!(fp = fileSystem.OpenFileReader(filename)).isOpen())
|
||||
{
|
||||
// If there's no script file, forget it.
|
||||
return TArray<uint8_t>();
|
||||
return std::vector<uint8_t>();
|
||||
}
|
||||
|
||||
auto scriptbuffer = fp.Read();
|
||||
|
||||
if (scriptbuffer.Size() != 0)
|
||||
if (scriptbuffer.size() != 0)
|
||||
{
|
||||
scriptbuffer.Push(0);
|
||||
scriptbuffer.push_back(0);
|
||||
scriptline = 1;
|
||||
endofscript = false;
|
||||
tokenready = false;
|
||||
|
@ -194,12 +194,12 @@ void LoadKVXFromScript(TilesetBuildInfo& info, const char* filename)
|
|||
|
||||
// Load the file
|
||||
auto buffer = LoadScriptFile(filename);
|
||||
if (!buffer.Size())
|
||||
if (!buffer.size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
script_p = (char*)buffer.Data();
|
||||
scriptend_p = (char*)&buffer.Last();
|
||||
script_p = (char*)buffer.data();
|
||||
scriptend_p = (char*)&buffer.back();
|
||||
|
||||
do
|
||||
{
|
||||
|
|
|
@ -363,7 +363,7 @@ class SWSoundEngine : public RazeSoundEngine
|
|||
{
|
||||
// client specific parts of the sound engine go in this class.
|
||||
void CalcPosVel(int type, const void* source, const float pt[3], int channum, int chanflags, FSoundID chanSound, FVector3* pos, FVector3* vel, FSoundChan* chan) override;
|
||||
TArray<uint8_t> ReadSound(int lumpnum) override;
|
||||
std::vector<uint8_t> ReadSound(int lumpnum) override;
|
||||
|
||||
public:
|
||||
SWSoundEngine()
|
||||
|
@ -412,7 +412,7 @@ public:
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
TArray<uint8_t> SWSoundEngine::ReadSound(int lumpnum)
|
||||
std::vector<uint8_t> SWSoundEngine::ReadSound(int lumpnum)
|
||||
{
|
||||
auto wlump = fileSystem.OpenFileReader(lumpnum);
|
||||
return wlump.Read();
|
||||
|
|
Loading…
Reference in a new issue