- engine updates from GZDoom.

This commit is contained in:
Christoph Oelckers 2020-09-27 10:03:53 +02:00
parent a9ca6c8081
commit 0795c79a3a
10 changed files with 46 additions and 23 deletions

View file

@ -41,7 +41,6 @@
#include "utf8.h" #include "utf8.h"
#include "m_joy.h" #include "m_joy.h"
#include "vm.h" #include "vm.h"
#include "cheathandler.h"
#include "gamestate.h" #include "gamestate.h"
bool G_Responder(event_t* ev); bool G_Responder(event_t* ev);

View file

@ -4,4 +4,5 @@
SystemCallbacks *sysCallbacks; SystemCallbacks *sysCallbacks;
FString endoomName; FString endoomName;
bool batchrun; bool batchrun;
float menuBlurAmount;

View file

@ -32,3 +32,4 @@ struct WadStuff
extern FString endoomName; extern FString endoomName;
extern bool batchrun; extern bool batchrun;
extern float menuBlurAmount;

View file

@ -1039,6 +1039,9 @@ xx(AttackZOffset)
xx(SpawnMask) xx(SpawnMask)
xx(ScoreIcon) xx(ScoreIcon)
xx(ViewHeight) xx(ViewHeight)
xx(ViewAngle)
xx(ViewPitch)
xx(ViewRoll)
xx(FallingScreamMinSpeed) xx(FallingScreamMinSpeed)
xx(FallingScreamMaxSpeed) xx(FallingScreamMaxSpeed)
xx(GruntSpeed) xx(GruntSpeed)
@ -1072,3 +1075,4 @@ xx(PlayerSkin)
xx(NewPlayerMenu) xx(NewPlayerMenu)
xx(AltHud) xx(AltHud)
xx(GameScreen) xx(GameScreen)

View file

@ -40,7 +40,6 @@
#include "templates.h" #include "templates.h"
#include "palettecontainer.h" #include "palettecontainer.h"
#include "files.h" #include "files.h"
#include "c_dispatch.h"
PaletteContainer GPalette; PaletteContainer GPalette;
FColorMatcher ColorMatcher; FColorMatcher ColorMatcher;
@ -821,15 +820,4 @@ bool FRemapTable::AddColors(int start, int count, const uint8_t*colors, int tran
} }
CCMD(exportpalette)
{
FILE* f = fopen("palette.pal", "wb");
if (!f) return;
for (int i = 0; i < 256; i++)
{
fputc(GPalette.BaseColors[i].r, f);
fputc(GPalette.BaseColors[i].g, f);
fputc(GPalette.BaseColors[i].b, f);
}
fclose(f);
}

View file

@ -676,6 +676,7 @@ void FSerializer::ReadObjects(bool hubtravel)
{ {
Printf(TEXTCOLOR_RED "Failed to restore all objects in savegame\n"); Printf(TEXTCOLOR_RED "Failed to restore all objects in savegame\n");
mErrors++; mErrors++;
mObjectErrors++;
} }
} }
catch(...) catch(...)

View file

@ -182,6 +182,7 @@ public:
} }
int mErrors = 0; int mErrors = 0;
int mObjectErrors = 0;
}; };
FSerializer& Serialize(FSerializer& arc, const char* key, char& value, char* defval); FSerializer& Serialize(FSerializer& arc, const char* key, char& value, char* defval);
@ -242,7 +243,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, TArray<T, TT> &value,
template<int size> template<int size>
FSerializer& Serialize(FSerializer& arc, const char* key, FixedBitArray<size>& value, FixedBitArray<size>* def) FSerializer& Serialize(FSerializer& arc, const char* key, FixedBitArray<size>& value, FixedBitArray<size>* def)
{ {
return arc.Array(key, value.Storage(), def ? def->Storage() : nullptr, value.StorageSize()); return arc.SerializeMemory(key, value.Storage(), value.StorageSize());
} }
template<> FSerializer& Serialize(FSerializer& arc, const char* key, PClass*& clst, PClass** def); template<> FSerializer& Serialize(FSerializer& arc, const char* key, PClass*& clst, PClass** def);

View file

@ -226,15 +226,44 @@ struct FReader
//========================================================================== //==========================================================================
template<class T> template<class T>
FSerializer &SerializePointer(FSerializer &arc, const char *key, T *&value, T **defval, T *base) FSerializer &SerializePointer(FSerializer &arc, const char *key, T *&value, T **defval, T *base, const int64_t count)
{ {
assert(base != nullptr); assert(base != nullptr);
assert(count > 0);
if (arc.isReading() || !arc.w->inObject() || defval == nullptr || value != *defval) if (arc.isReading() || !arc.w->inObject() || defval == nullptr || value != *defval)
{ {
int64_t vv = value == nullptr ? -1 : value - base; int64_t vv = -1;
if (value != nullptr)
{
vv = value - base;
if (vv < 0 || vv >= count)
{
Printf("Trying to serialize out-of-bounds array value with key '%s', index = %lli, size = %lli\n", key, vv, count);
vv = -1;
}
}
Serialize(arc, key, vv, nullptr); Serialize(arc, key, vv, nullptr);
value = vv < 0 ? nullptr : base + vv; if (vv == -1)
value = nullptr;
else if (vv < 0 || vv >= count)
{
Printf("Trying to serialize out-of-bounds array value with key '%s', index = %lli, size = %lli\n", key, vv, count);
value = nullptr;
}
else
value = base + vv;
} }
return arc; return arc;
} }
template<class T>
FSerializer &SerializePointer(FSerializer &arc, const char *key, T *&value, T **defval, TArray<T> &array)
{
if (array.Size() == 0)
{
Printf("Trying to serialize a value with key '%s' from empty array\n", key);
return arc;
}
return SerializePointer(arc, key, value, defval, array.Data(), array.Size());
}

View file

@ -132,6 +132,9 @@ inline uint64_t rdtsc()
} }
while (upper != temp); while (upper != temp);
return (static_cast<unsigned long long>(upper) << 32) | lower; return (static_cast<unsigned long long>(upper) << 32) | lower;
#elif defined __aarch64__
// TODO: Implement and test on ARM64
return 0;
#else // i386 #else // i386
if (CPU.bRDTSC) if (CPU.bRDTSC)
{ {

View file

@ -93,10 +93,6 @@ TArray<TArray<FString>> FStringTable::parseCSV(const TArray<uint8_t> &buffer)
for (size_t i = 0; i < bufLength; ++i) for (size_t i = 0; i < bufLength; ++i)
{ {
if (buffer[i] == '#')
{
int a = 0;
}
if (buffer[i] == '"') if (buffer[i] == '"')
{ {
// Double quotes inside a quoted string count as an escaped quotation mark. // Double quotes inside a quoted string count as an escaped quotation mark.
@ -454,7 +450,7 @@ void FStringTable::InsertString(int lumpnum, int langid, FName label, const FStr
auto replace = allMacros.CheckKey(lookupname); auto replace = allMacros.CheckKey(lookupname);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
const char *replacement = replace ? replace->Replacements[i].GetChars() : ""; const char *replacement = replace? replace->Replacements[i].GetChars() : "";
te.strings[i].Substitute(replacee, replacement); te.strings[i].Substitute(replacee, replacement);
} }
} }