mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-31 01:11:15 +00:00
backend update from GZDoom.
This commit is contained in:
parent
80fe0788c9
commit
c0d166c307
74 changed files with 1496 additions and 392 deletions
|
@ -519,3 +519,19 @@ void SetRazeCompileEnvironment()
|
|||
compileEnvironment.CheckSpecialMember = CheckForMemberDefault;
|
||||
compileEnvironment.CheckCustomGlobalFunctions = ResolveGlobalCustomFunction;
|
||||
}
|
||||
|
||||
// todo: clean up this mess
|
||||
extern bool HasGameSpecificTwoArgForEachLoopTypeNames() { return false; }
|
||||
extern const char* GetGameSpecificTwoArgForEachLoopTypeNames() { return ""; }
|
||||
extern bool IsGameSpecificTwoArgForEachLoop(FxTwoArgForEachLoop*) { return false; }
|
||||
extern FxExpression* ResolveGameSpecificTwoArgForEachLoop(FxTwoArgForEachLoop*) { return nullptr; }
|
||||
extern bool HasGameSpecificThreeArgForEachLoopTypeNames() { return false; }
|
||||
extern const char* GetGameSpecificThreeArgForEachLoopTypeNames() { return ""; }
|
||||
extern bool IsGameSpecificThreeArgForEachLoop(FxThreeArgForEachLoop*) { return false; }
|
||||
extern FxExpression* ResolveGameSpecificThreeArgForEachLoop(FxThreeArgForEachLoop*) { return nullptr; }
|
||||
extern bool HasGameSpecificTypedForEachLoopTypeNames() { return false; }
|
||||
extern const char* GetGameSpecificTypedForEachLoopTypeNames() { return ""; }
|
||||
extern bool IsGameSpecificTypedForEachLoop(FxTypedForEachLoop*) { return false; }
|
||||
extern FxExpression* ResolveGameSpecificTypedForEachLoop(FxTypedForEachLoop*) { return nullptr; }
|
||||
extern bool IsGameSpecificForEachLoop(FxForEachLoop*) { return false; }
|
||||
extern FxExpression* ResolveGameSpecificForEachLoop(FxForEachLoop*) { return nullptr; }
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "findfile.h"
|
||||
#include "palutil.h"
|
||||
#include "startupinfo.h"
|
||||
#include "files.h"
|
||||
|
||||
using namespace FileSys;
|
||||
|
||||
|
@ -153,6 +154,7 @@ static std::vector<std::string> ParseGameInfo(std::vector<std::string>& pwads, c
|
|||
|
||||
static std::vector<std::string> CheckGameInfo(std::vector<std::string>& pwads)
|
||||
{
|
||||
#if 1
|
||||
// scan the list of WADs backwards to find the last one that contains a GAMEINFO lump
|
||||
for (int i = (int)pwads.size() - 1; i >= 0; i--)
|
||||
{
|
||||
|
@ -180,18 +182,18 @@ static std::vector<std::string> CheckGameInfo(std::vector<std::string>& pwads)
|
|||
else
|
||||
resfile = FResourceFile::OpenDirectory(filename);
|
||||
|
||||
FName gameinfo = "GAMEINFO.TXT";
|
||||
if (resfile != NULL)
|
||||
const char* gameinfo = "GAMEINFO.TXT";
|
||||
if (resfile != nullptr)
|
||||
{
|
||||
uint32_t cnt = resfile->LumpCount();
|
||||
uint32_t cnt = resfile->EntryCount();
|
||||
for (int c = cnt - 1; c >= 0; c--)
|
||||
{
|
||||
FResourceLump* lmp = resfile->GetLump(c);
|
||||
|
||||
if (FName(lmp->getName(), true) == gameinfo)
|
||||
if (!stricmp(resfile->getName(c), gameinfo))
|
||||
{
|
||||
// Found one!
|
||||
auto bases = ParseGameInfo(pwads, resfile->FileName, (const char*)lmp->Lock(), lmp->LumpSize);
|
||||
auto data = resfile->Read(c);
|
||||
auto wadname = resfile->GetFileName();
|
||||
auto bases = ParseGameInfo(pwads, wadname, data.string(), (int)data.size());
|
||||
delete resfile;
|
||||
return bases;
|
||||
}
|
||||
|
@ -199,6 +201,7 @@ static std::vector<std::string> CheckGameInfo(std::vector<std::string>& pwads)
|
|||
delete resfile;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return std::vector<std::string>();
|
||||
}
|
||||
|
||||
|
@ -445,8 +448,8 @@ void InitFileSystem(TArray<GrpEntry>& groups)
|
|||
FILE* f = fopen("filesystem.dir", "wb");
|
||||
for (int num = 0; num < fileSystem.GetNumEntries(); num++)
|
||||
{
|
||||
auto fd = fileSystem.GetFileAt(num);
|
||||
fprintf(f, "%.50s %60s %d\n", fd->getName(), fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(num)), fd->Size());
|
||||
auto fd = fileSystem.FileLength(num);
|
||||
fprintf(f, "%.50s %60s %d\n", fileSystem.GetFileFullName(num), fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(num)), fd);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
|
|
@ -320,7 +320,7 @@ CCMD(md4sum)
|
|||
{
|
||||
auto data = fr.Read();
|
||||
uint8_t digest[16];
|
||||
md4once(data.data(), (uint32_t)data.size(), digest);
|
||||
md4once(data.bytes(), (uint32_t)data.size(), digest);
|
||||
for (int j = 0; j < 16; ++j)
|
||||
{
|
||||
Printf("%02x", digest[j]);
|
||||
|
|
|
@ -547,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(), (unsigned)buffer.size(), md4);
|
||||
md4once(buffer.bytes(), (unsigned)buffer.size(), md4);
|
||||
PostProcessLevel(md4, filename, sprites);
|
||||
loadMapHack(filename, md4, sprites);
|
||||
setWallSectors();
|
||||
|
@ -589,7 +589,7 @@ static void Decrypt(void* to_, const void* from_, int len, int key)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static void P_LoadBloodMapWalls(uint8_t* data, size_t len, TArray<walltype>& lwalls)
|
||||
static void P_LoadBloodMapWalls(const uint8_t* data, size_t len, TArray<walltype>& lwalls)
|
||||
{
|
||||
uint8_t infoBlock[37];
|
||||
int mapver = data[5];
|
||||
|
@ -698,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.bytes(), data.size(), lwalls);
|
||||
return lwalls;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,14 +71,14 @@ void FSavegameManager::ReadSaveStrings()
|
|||
FResourceFile *savegame = FResourceFile::OpenResourceFile(entry.FilePath.c_str(), true);
|
||||
if (savegame != nullptr)
|
||||
{
|
||||
FResourceLump *info = savegame->FindLump("info.json");
|
||||
if (info == nullptr)
|
||||
auto info = savegame->FindEntry("info.json");
|
||||
if (info < 0)
|
||||
{
|
||||
// savegame info not found. This is not a savegame so leave it alone.
|
||||
delete savegame;
|
||||
continue;
|
||||
}
|
||||
auto fr = info->NewReader();
|
||||
auto fr = savegame->GetEntryReader(info, true);
|
||||
FString title;
|
||||
int check = G_ValidateSavegame(fr, &title, true);
|
||||
fr.Close();
|
||||
|
|
|
@ -125,7 +125,7 @@ void paletteLoadFromDisk(void)
|
|||
unsigned length = numshades * 256;
|
||||
auto buffer = fil.Read(length);
|
||||
if (buffer.size() != length) return;
|
||||
lookups.setTable(0, buffer.data());
|
||||
lookups.setTable(0, buffer.bytes());
|
||||
|
||||
paletteloaded |= PALETTE_SHADE | PALETTE_TRANSLUC;
|
||||
}
|
||||
|
|
|
@ -89,10 +89,13 @@ void S_SetReverb(int strength)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
std::vector<uint8_t> RazeSoundEngine::ReadSound(int lumpnum)
|
||||
TArray<uint8_t> RazeSoundEngine::ReadSound(int lumpnum)
|
||||
{
|
||||
auto wlump = fileSystem.OpenFileReader(lumpnum);
|
||||
return wlump.Read();
|
||||
TArray<uint8_t> buffer(wlump.GetLength(), true);
|
||||
auto len = wlump.Read(buffer.data(), buffer.size());
|
||||
buffer.Resize(len);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -47,5 +47,5 @@ public:
|
|||
virtual bool SourceIsActor(FSoundChan* chan) { return chan->SourceType == SOURCE_Actor; }
|
||||
virtual int SoundSourceIndex(FSoundChan* chan) { return 0; }
|
||||
virtual void SetSource(FSoundChan* chan, int index) {}
|
||||
std::vector<uint8_t> ReadSound(int lumpnum) override;
|
||||
TArray<uint8_t> ReadSound(int lumpnum) override;
|
||||
};
|
||||
|
|
|
@ -136,13 +136,13 @@ bool ReadSavegame(const char* name)
|
|||
|
||||
if (savereader != nullptr)
|
||||
{
|
||||
auto lump = savereader->FindLump("info.json");
|
||||
if (!lump)
|
||||
auto lump = savereader->FindEntry("info.json");
|
||||
if (lump < 0)
|
||||
{
|
||||
delete savereader;
|
||||
return false;
|
||||
}
|
||||
auto file = lump->NewReader();
|
||||
auto file = savereader->GetEntryReader(lump);
|
||||
if (G_ValidateSavegame(file, nullptr, false) <= 0)
|
||||
{
|
||||
delete savereader;
|
||||
|
@ -150,18 +150,17 @@ bool ReadSavegame(const char* name)
|
|||
}
|
||||
file.Close();
|
||||
|
||||
auto info = savereader->FindLump("session.json");
|
||||
if (info == nullptr)
|
||||
auto info = savereader->FindEntry("session.json");
|
||||
if (info < 0)
|
||||
{
|
||||
delete savereader;
|
||||
return false;
|
||||
}
|
||||
|
||||
void* data = info->Lock();
|
||||
auto data = savereader->Read(info);
|
||||
FRazeSerializer arc;
|
||||
if (!arc.OpenReader((const char*)data, info->LumpSize))
|
||||
if (!arc.OpenReader(data.string(), data.size()))
|
||||
{
|
||||
info->Unlock();
|
||||
delete savereader;
|
||||
return false;
|
||||
}
|
||||
|
@ -171,7 +170,6 @@ bool ReadSavegame(const char* name)
|
|||
SerializeSession(arc);
|
||||
g_nextskill = gi->GetCurrentSkill();
|
||||
arc.Close();
|
||||
info->Unlock();
|
||||
delete savereader;
|
||||
|
||||
// this can only be done after the load is complete
|
||||
|
@ -247,7 +245,7 @@ bool WriteSavegame(const char* filename, const char *name)
|
|||
M_FinishPNG(&savepic);
|
||||
|
||||
auto picdata = savepic.GetBuffer();
|
||||
FileSys::FCompressedBuffer bufpng = { picdata->Size(), picdata->Size(), FileSys::METHOD_STORED, 0, static_cast<unsigned int>(crc32(0, &(*picdata)[0], picdata->Size())), (char*)&(*picdata)[0] };
|
||||
FileSys::FCompressedBuffer bufpng = { picdata->size(), picdata->size(), FileSys::METHOD_STORED, 0, static_cast<unsigned int>(crc32(0, &(*picdata)[0], picdata->size())), (char*)&(*picdata)[0] };
|
||||
|
||||
TArray<FileSys::FCompressedBuffer> savegame_content;
|
||||
TArray<FString> savegame_filenames;
|
||||
|
|
|
@ -628,10 +628,10 @@ TArray<GrpInfo> ParseAllGrpInfos(TArray<FileEntry>& filelist)
|
|||
engine_res.reset(FResourceFile::OpenResourceFile(baseres, true));
|
||||
if (engine_res)
|
||||
{
|
||||
auto basegrp = engine_res->FindLump("engine/grpinfo.txt");
|
||||
if (basegrp)
|
||||
auto basegrp = engine_res->FindEntry("engine/grpinfo.txt");
|
||||
if (basegrp >= 0)
|
||||
{
|
||||
auto fr = basegrp->NewReader();
|
||||
auto fr = engine_res->GetEntryReader(basegrp, true);
|
||||
if (fr.isOpen())
|
||||
{
|
||||
groups = ParseGrpInfo("engine/grpinfo.txt", fr, CRCMap);
|
||||
|
@ -787,7 +787,7 @@ TArray<GrpEntry> GrpScan()
|
|||
bool ok = true;
|
||||
for (auto &lump : grp->mustcontain)
|
||||
{
|
||||
if (!resf->FindLump(lump.GetChars()))
|
||||
if (resf->FindEntry(lump.GetChars()) < 0)
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
|
|
|
@ -560,7 +560,7 @@ FStateLabels *FStateDefinitions::CreateStateLabelList(TArray<FStateDefine> & sta
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void FStateDefinitions::InstallStates(PClassActor *info, AActor *defaults)
|
||||
void FStateDefinitions::InstallStates(PClassActor *info, DCoreActor *defaults)
|
||||
{
|
||||
if (defaults == nullptr)
|
||||
{
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "dobject.h"
|
||||
|
||||
class DCoreActor;
|
||||
struct Baggage;
|
||||
class FScanner;
|
||||
struct FActorInfo;
|
||||
|
@ -238,7 +239,7 @@ public:
|
|||
void SetStateLabel(const char *statename, FState *state, uint8_t defflags = SDF_STATE);
|
||||
void AddStateLabel(const char *statename);
|
||||
int GetStateLabelIndex (FName statename);
|
||||
void InstallStates(PClassActor *info, AActor *defaults);
|
||||
void InstallStates(PClassActor *info, DCoreActor *defaults);
|
||||
int FinishStates(PClassActor *actor);
|
||||
|
||||
void MakeStateDefines(const PClassActor *cls);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue