mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 04:22:34 +00:00
- Backend update from Raze.
This is mainly code cleanup from setting the compiler to a stricter warning level.
This commit is contained in:
parent
6aea7694bc
commit
1c517d19fa
102 changed files with 491 additions and 588 deletions
|
@ -749,7 +749,6 @@ void F2DDrawer::AddPoly(FGameTexture *texture, FVector2 *points, int npoints,
|
|||
void F2DDrawer::AddPoly(FGameTexture* img, FVector4* vt, size_t vtcount, const unsigned int* ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2)
|
||||
{
|
||||
RenderCommand dg;
|
||||
int method = 0;
|
||||
|
||||
if (!img || !img->isValid()) return;
|
||||
|
||||
|
@ -835,13 +834,13 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTextu
|
|||
dg.mFlags = DTF_Wrap;
|
||||
|
||||
float fs = 1.f / float(flatscale);
|
||||
bool flipc = false;
|
||||
|
||||
float sw = GetClassicFlatScalarWidth();
|
||||
float sh = GetClassicFlatScalarHeight();
|
||||
|
||||
switch (local_origin)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
fU1 = float(left) / (float)src->GetDisplayWidth() * fs;
|
||||
fV1 = float(top) / (float)src->GetDisplayHeight() * fs;
|
||||
|
|
|
@ -144,7 +144,7 @@ int GetUIScale(F2DDrawer *drawer, int altval)
|
|||
// Default should try to scale to 640x400
|
||||
int vscale = drawer->GetHeight() / 400;
|
||||
int hscale = drawer->GetWidth() / 640;
|
||||
scaleval = clamp(vscale, 1, hscale);
|
||||
scaleval = max(1, min(vscale, hscale));
|
||||
}
|
||||
else scaleval = uiscale;
|
||||
|
||||
|
@ -165,7 +165,7 @@ int GetConScale(F2DDrawer* drawer, int altval)
|
|||
// Default should try to scale to 640x400
|
||||
int vscale = drawer->GetHeight() / 800;
|
||||
int hscale = drawer->GetWidth() / 1280;
|
||||
scaleval = clamp(vscale, 1, hscale);
|
||||
scaleval = max(1, min(vscale, hscale));
|
||||
}
|
||||
else scaleval = (uiscale+1) / 2;
|
||||
|
||||
|
@ -671,7 +671,6 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
|
|||
{
|
||||
INTBOOL boolval;
|
||||
int intval;
|
||||
bool translationset = false;
|
||||
bool fillcolorset = false;
|
||||
|
||||
if (!fortext)
|
||||
|
@ -1016,10 +1015,16 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
|
|||
case DTA_CenterOffsetRel:
|
||||
assert(fortext == false);
|
||||
if (fortext) return false;
|
||||
if (ListGetInt(tags))
|
||||
intval = ListGetInt(tags);
|
||||
if (intval == 1)
|
||||
{
|
||||
parms->left = img->GetDisplayLeftOffset() + img->GetDisplayWidth() * 0.5;
|
||||
parms->top = img->GetDisplayTopOffset() + img->GetDisplayHeight() * 0.5;
|
||||
parms->left = img->GetDisplayLeftOffset() + (img->GetDisplayWidth() * 0.5);
|
||||
parms->top = img->GetDisplayTopOffset() + (img->GetDisplayHeight() * 0.5);
|
||||
}
|
||||
else if (intval == 2)
|
||||
{
|
||||
parms->left = img->GetDisplayLeftOffset() + floor(img->GetDisplayWidth() * 0.5);
|
||||
parms->top = img->GetDisplayTopOffset() + floor(img->GetDisplayHeight() * 0.5);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -603,13 +603,13 @@ static void CheckReplayGain(const char *musicname, EMidiDevice playertype, const
|
|||
{
|
||||
float* sbuf = (float*)readbuffer.Data();
|
||||
int numsamples = fmt.mBufferSize / 8;
|
||||
auto index = lbuffer.Reserve(numsamples);
|
||||
auto addr = lbuffer.Reserve(numsamples);
|
||||
rbuffer.Reserve(numsamples);
|
||||
|
||||
for (int i = 0; i < numsamples; i++)
|
||||
{
|
||||
lbuffer[index + i] = sbuf[i * 2] * 32768.f;
|
||||
rbuffer[index + i] = sbuf[i * 2 + 1] * 32768.f;
|
||||
lbuffer[addr + i] = sbuf[i * 2] * 32768.f;
|
||||
rbuffer[addr + i] = sbuf[i * 2 + 1] * 32768.f;
|
||||
}
|
||||
}
|
||||
float accTime = lbuffer.Size() / (float)fmt.mSampleRate;
|
||||
|
@ -684,8 +684,6 @@ bool S_ChangeMusic(const char* musicname, int order, bool looping, bool force)
|
|||
return true;
|
||||
}
|
||||
|
||||
int lumpnum = -1;
|
||||
int length = 0;
|
||||
ZMusic_MusicStream handle = nullptr;
|
||||
MidiDeviceSetting* devp = MidiDevices.CheckKey(musicname);
|
||||
|
||||
|
|
|
@ -329,7 +329,6 @@ public:
|
|||
virtual FString GetStats()
|
||||
{
|
||||
FString stats;
|
||||
size_t pos = 0, len = 0;
|
||||
ALfloat volume;
|
||||
ALint offset;
|
||||
ALint processed;
|
||||
|
|
|
@ -530,7 +530,7 @@ void S_ReadReverbDef (FScanner &sc)
|
|||
{
|
||||
const ReverbContainer *def;
|
||||
ReverbContainer *newenv;
|
||||
REVERB_PROPERTIES props;
|
||||
REVERB_PROPERTIES props = {};
|
||||
char *name;
|
||||
int id1, id2, i, j;
|
||||
bool inited[NUM_REVERB_FIELDS];
|
||||
|
|
|
@ -309,7 +309,6 @@ DEFINE_ACTION_FUNCTION(DReverbEdit, GetValue)
|
|||
}
|
||||
}
|
||||
ACTION_RETURN_FLOAT(v);
|
||||
return 1;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DReverbEdit, SetValue)
|
||||
|
@ -337,14 +336,12 @@ DEFINE_ACTION_FUNCTION(DReverbEdit, SetValue)
|
|||
}
|
||||
|
||||
ACTION_RETURN_FLOAT(v);
|
||||
return 1;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DReverbEdit, GrayCheck)
|
||||
{
|
||||
PARAM_PROLOGUE;
|
||||
ACTION_RETURN_BOOL(CurrentEnv->Builtin);
|
||||
return 1;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DReverbEdit, GetSelectedEnvironment)
|
||||
|
|
|
@ -164,7 +164,6 @@ void SoundEngine::CacheSound (sfxinfo_t *sfx)
|
|||
{
|
||||
if (GSnd && !sfx->bTentative)
|
||||
{
|
||||
sfxinfo_t *orig = sfx;
|
||||
while (!sfx->bRandomHeader && sfx->link != sfxinfo_t::NO_LINK)
|
||||
{
|
||||
sfx = &S_sfx[sfx->link];
|
||||
|
@ -1085,13 +1084,14 @@ void SoundEngine::SetPitch(FSoundChan *chan, float pitch)
|
|||
// Is a sound being played by a specific emitter?
|
||||
//==========================================================================
|
||||
|
||||
int SoundEngine::GetSoundPlayingInfo (int sourcetype, const void *source, int sound_id)
|
||||
int SoundEngine::GetSoundPlayingInfo (int sourcetype, const void *source, int sound_id, int chann)
|
||||
{
|
||||
int count = 0;
|
||||
if (sound_id > 0)
|
||||
{
|
||||
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||
{
|
||||
if (chann != -1 && chann != chan->EntChannel) continue;
|
||||
if (chan->OrgID == sound_id && (sourcetype == SOURCE_Any ||
|
||||
(chan->SourceType == sourcetype &&
|
||||
chan->Source == source)))
|
||||
|
@ -1104,6 +1104,7 @@ int SoundEngine::GetSoundPlayingInfo (int sourcetype, const void *source, int so
|
|||
{
|
||||
for (FSoundChan* chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||
{
|
||||
if (chann != -1 && chann != chan->EntChannel) continue;
|
||||
if ((sourcetype == SOURCE_Any || (chan->SourceType == sourcetype && chan->Source == source)))
|
||||
{
|
||||
count++;
|
||||
|
|
|
@ -249,9 +249,6 @@ public:
|
|||
blockNewSounds = on;
|
||||
}
|
||||
|
||||
virtual int SoundSourceIndex(FSoundChan* chan) { return 0; }
|
||||
virtual void SetSource(FSoundChan* chan, int index) {}
|
||||
|
||||
virtual void StopChannel(FSoundChan* chan);
|
||||
sfxinfo_t* LoadSound(sfxinfo_t* sfx);
|
||||
const sfxinfo_t* GetSfx(unsigned snd)
|
||||
|
@ -303,7 +300,7 @@ public:
|
|||
bool IsSourcePlayingSomething(int sourcetype, const void* actor, int channel, int sound_id = -1);
|
||||
|
||||
// Stop and resume music, during game PAUSE.
|
||||
int GetSoundPlayingInfo(int sourcetype, const void* source, int sound_id);
|
||||
int GetSoundPlayingInfo(int sourcetype, const void* source, int sound_id, int chan = -1);
|
||||
void UnloadAllSounds();
|
||||
void Reset();
|
||||
void MarkUsed(int num);
|
||||
|
|
|
@ -331,16 +331,16 @@ void C_DeinitConsole ()
|
|||
// at runtime.)
|
||||
for (size_t i = 0; i < countof(Commands); ++i)
|
||||
{
|
||||
FConsoleCommand *cmd = Commands[i];
|
||||
FConsoleCommand *command = Commands[i];
|
||||
|
||||
while (cmd != NULL)
|
||||
while (command != NULL)
|
||||
{
|
||||
FConsoleCommand *next = cmd->m_Next;
|
||||
if (cmd->IsAlias())
|
||||
FConsoleCommand *nextcmd = command->m_Next;
|
||||
if (command->IsAlias())
|
||||
{
|
||||
delete cmd;
|
||||
delete command;
|
||||
}
|
||||
cmd = next;
|
||||
command = nextcmd;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -333,6 +333,7 @@ UCVarValue FBaseCVar::FromBool (bool value, ECVarType type)
|
|||
break;
|
||||
|
||||
default:
|
||||
ret.Int = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -363,6 +364,7 @@ UCVarValue FBaseCVar::FromInt (int value, ECVarType type)
|
|||
break;
|
||||
|
||||
default:
|
||||
ret.Int = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -395,6 +397,7 @@ UCVarValue FBaseCVar::FromFloat (float value, ECVarType type)
|
|||
break;
|
||||
|
||||
default:
|
||||
ret.Int = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -456,6 +459,7 @@ UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
|
|||
break;
|
||||
|
||||
default:
|
||||
ret.Int = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1426,12 +1430,12 @@ void C_ArchiveCVars (FConfigFile *f, uint32_t filter)
|
|||
cvar = cvar->m_Next;
|
||||
}
|
||||
qsort(cvarlist.Data(), cvarlist.Size(), sizeof(FBaseCVar*), cvarcmp);
|
||||
for (auto cvar : cvarlist)
|
||||
for (auto cv : cvarlist)
|
||||
{
|
||||
const char* const value = (cvar->Flags & CVAR_ISDEFAULT)
|
||||
? cvar->GetGenericRep(CVAR_String).String
|
||||
: cvar->SafeValue.GetChars();
|
||||
f->SetValueForKey(cvar->GetName(), value);
|
||||
const char* const value = (cv->Flags & CVAR_ISDEFAULT)
|
||||
? cv->GetGenericRep(CVAR_String).String
|
||||
: cv->SafeValue.GetChars();
|
||||
f->SetValueForKey(cv->GetName(), value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1643,7 +1647,6 @@ CCMD (archivecvar)
|
|||
void C_ListCVarsWithoutDescription()
|
||||
{
|
||||
FBaseCVar* var = CVars;
|
||||
int count = 0;
|
||||
|
||||
while (var)
|
||||
{
|
||||
|
|
|
@ -282,8 +282,8 @@ void C_DoCommand (const char *cmd, int keynum)
|
|||
}
|
||||
else
|
||||
{
|
||||
auto cmd = new FStoredCommand(com, beg);
|
||||
delayedCommandQueue.AddCommand(cmd);
|
||||
auto command = new FStoredCommand(com, beg);
|
||||
delayedCommandQueue.AddCommand(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -373,8 +373,8 @@ void AddCommandString (const char *text, int keynum)
|
|||
// Note that deferred commands lose track of which key
|
||||
// (if any) they were pressed from.
|
||||
*brkpt = ';';
|
||||
auto cmd = new FWaitingCommand(brkpt, tics, UnsafeExecutionContext);
|
||||
delayedCommandQueue.AddCommand(cmd);
|
||||
auto command = new FWaitingCommand(brkpt, tics, UnsafeExecutionContext);
|
||||
delayedCommandQueue.AddCommand(command);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -851,8 +851,8 @@ CCMD (key)
|
|||
|
||||
for (i = 1; i < argv.argc(); ++i)
|
||||
{
|
||||
unsigned int key = MakeKey (argv[i]);
|
||||
Printf (" 0x%08x\n", key);
|
||||
unsigned int hash = MakeKey (argv[i]);
|
||||
Printf (" 0x%08x\n", hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1014,7 +1014,6 @@ void FExecList::AddPullins(TArray<FString> &wads, FConfigFile *config) const
|
|||
FExecList *C_ParseExecFile(const char *file, FExecList *exec)
|
||||
{
|
||||
char cmd[4096];
|
||||
int retval = 0;
|
||||
|
||||
FileReader fr;
|
||||
|
||||
|
|
|
@ -736,7 +736,7 @@ bool HostGame (int i)
|
|||
{
|
||||
// If we send the packets eight times to each guest,
|
||||
// hopefully at least one of them will get through.
|
||||
for (int i = 8; i != 0; --i)
|
||||
for (int ii = 8; ii != 0; --ii)
|
||||
{
|
||||
PreSend (&packet, 2, &sendaddress[node]);
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ void PaletteContainer::UpdateTranslation(int trans, FRemapTable* remap)
|
|||
|
||||
int PaletteContainer::AddTranslation(int slot, FRemapTable* remap, int count)
|
||||
{
|
||||
uint32_t id;
|
||||
uint32_t id = 0;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
auto newremap = AddRemap(&remap[i]);
|
||||
|
@ -265,7 +265,7 @@ FRemapTable *PaletteContainer::TranslationToTable(int translation)
|
|||
unsigned int type = GetTranslationType(translation);
|
||||
unsigned int index = GetTranslationIndex(translation);
|
||||
|
||||
if (type < 0 || type >= TranslationTables.Size() || index >= NumTranslations(type))
|
||||
if (type >= TranslationTables.Size() || index >= NumTranslations(type))
|
||||
{
|
||||
return uniqueRemaps[0]; // this is the identity table.
|
||||
}
|
||||
|
@ -649,7 +649,6 @@ bool FRemapTable::AddTint(int start, int end, int r, int g, int b, int amount)
|
|||
bool FRemapTable::AddToTranslation(const char *range)
|
||||
{
|
||||
int start,end;
|
||||
bool desaturated = false;
|
||||
FScanner sc;
|
||||
|
||||
sc.OpenMem("translation", range, int(strlen(range)));
|
||||
|
|
|
@ -1131,9 +1131,7 @@ FString FScanner::TokenName (int token, const char *string)
|
|||
}
|
||||
else
|
||||
{
|
||||
FString work;
|
||||
work.Format ("Unknown(%d)", token);
|
||||
return work;
|
||||
work.Format("Unknown(%d)", token);
|
||||
}
|
||||
return work;
|
||||
}
|
||||
|
|
|
@ -290,6 +290,28 @@ bool FSerializer::BeginObject(const char *name)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool FSerializer::HasObject(const char* name)
|
||||
{
|
||||
if (isReading())
|
||||
{
|
||||
auto val = r->FindKey(name);
|
||||
if (val != nullptr)
|
||||
{
|
||||
if (val->IsObject())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FSerializer::EndObject()
|
||||
{
|
||||
if (isWriting())
|
||||
|
@ -619,7 +641,6 @@ void FSerializer::ReadObjects(bool hubtravel)
|
|||
if (BeginObject(nullptr))
|
||||
{
|
||||
FString clsname; // do not deserialize the class type directly so that we can print appropriate errors.
|
||||
int pindex = -1;
|
||||
|
||||
Serialize(*this, "classtype", clsname, nullptr);
|
||||
PClass *cls = PClass::FindClass(clsname);
|
||||
|
@ -643,6 +664,7 @@ void FSerializer::ReadObjects(bool hubtravel)
|
|||
if (!founderrors)
|
||||
{
|
||||
// Reset to start;
|
||||
unsigned size = r->mObjects.Size();
|
||||
r->mObjects.Last().mIndex = 0;
|
||||
|
||||
for (unsigned i = 0; i < r->mDObjects.Size(); i++)
|
||||
|
@ -652,7 +674,6 @@ void FSerializer::ReadObjects(bool hubtravel)
|
|||
{
|
||||
if (obj != nullptr)
|
||||
{
|
||||
int pindex = -1;
|
||||
try
|
||||
{
|
||||
obj->SerializeUserVars(*this);
|
||||
|
@ -660,6 +681,7 @@ void FSerializer::ReadObjects(bool hubtravel)
|
|||
}
|
||||
catch (CRecoverableError &err)
|
||||
{
|
||||
r->mObjects.Clamp(size); // close all inner objects.
|
||||
// In case something in here throws an error, let's continue and deal with it later.
|
||||
Printf(TEXTCOLOR_RED "'%s'\n while restoring %s\n", err.GetMessage(), obj ? obj->GetClass()->TypeName.GetChars() : "invalid object");
|
||||
mErrors++;
|
||||
|
|
|
@ -85,6 +85,7 @@ public:
|
|||
void ReadObjects(bool hubtravel);
|
||||
bool BeginObject(const char *name);
|
||||
void EndObject();
|
||||
bool HasObject(const char* name);
|
||||
bool BeginArray(const char *name);
|
||||
void EndArray();
|
||||
unsigned GetSize(const char *group);
|
||||
|
@ -234,7 +235,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FSoundID &sid, FSoundI
|
|||
FSerializer &Serialize(FSerializer &arc, const char *key, FString &sid, FString *def);
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, NumericValue &sid, NumericValue *def);
|
||||
|
||||
template<class T>
|
||||
template <typename T/*, typename = std::enable_if_t<std::is_base_of_v<DObject, T>>*/>
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, T *&value, T **)
|
||||
{
|
||||
DObject *v = static_cast<DObject*>(value);
|
||||
|
@ -301,6 +302,11 @@ FSerializer& Serialize(FSerializer& arc, const char* key, FixedBitArray<size>& v
|
|||
return arc.SerializeMemory(key, value.Storage(), value.StorageSize());
|
||||
}
|
||||
|
||||
inline FSerializer& Serialize(FSerializer& arc, const char* key, BitArray& value, BitArray* def)
|
||||
{
|
||||
return arc.SerializeMemory(key, value.Storage().Data(), value.Storage().Size());
|
||||
}
|
||||
|
||||
template<> FSerializer& Serialize(FSerializer& arc, const char* key, PClass*& clst, PClass** def);
|
||||
template<> FSerializer& Serialize(FSerializer& arc, const char* key, FFont*& font, FFont** def);
|
||||
template<> FSerializer &Serialize(FSerializer &arc, const char *key, Dictionary *&dict, Dictionary **def);
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
#include "printf.h"
|
||||
#include "findfile.h"
|
||||
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Zip Lump
|
||||
|
|
|
@ -308,14 +308,14 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name
|
|||
// We have found no F_START but one or more F_END markers.
|
||||
// mark all lumps before the last F_END marker as potential flats.
|
||||
unsigned int end = markers[markers.Size()-1].index;
|
||||
for(unsigned int i = 0; i < end; i++)
|
||||
for(unsigned int ii = 0; ii < end; ii++)
|
||||
{
|
||||
if (Lumps[i].LumpSize == 4096)
|
||||
if (Lumps[ii].LumpSize == 4096)
|
||||
{
|
||||
// We can't add this to the flats namespace but
|
||||
// it needs to be flagged for the texture manager.
|
||||
DPrintf(DMSG_NOTIFY, "Marking %s as potential flat\n", Lumps[i].getName());
|
||||
Lumps[i].Flags |= LUMPF_MAYBEFLAT;
|
||||
DPrintf(DMSG_NOTIFY, "Marking %s as potential flat\n", Lumps[ii].getName());
|
||||
Lumps[ii].Flags |= LUMPF_MAYBEFLAT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -428,18 +428,19 @@ void FWadFile::SkinHack ()
|
|||
namespc++;
|
||||
}
|
||||
}
|
||||
// needless to say, this check is entirely useless these days as map names can be more diverse..
|
||||
if ((lump->getName()[0] == 'M' &&
|
||||
lump->getName()[1] == 'A' &&
|
||||
lump->getName()[2] == 'P' &&
|
||||
lump->getName()[3] >= '0' && lump->getName()[3] <= '9' &&
|
||||
lump->getName()[4] >= '0' && lump->getName()[4] <= '9' &&
|
||||
lump->getName()[5] >= '\0')
|
||||
lump->getName()[5] == '\0')
|
||||
||
|
||||
(lump->getName()[0] == 'E' &&
|
||||
lump->getName()[1] >= '0' && lump->getName()[1] <= '9' &&
|
||||
lump->getName()[2] == 'M' &&
|
||||
lump->getName()[3] >= '0' && lump->getName()[3] <= '9' &&
|
||||
lump->getName()[4] >= '\0'))
|
||||
lump->getName()[4] == '\0'))
|
||||
{
|
||||
hasmap = true;
|
||||
}
|
||||
|
|
|
@ -218,7 +218,6 @@ void FileSystem::InitMultipleFiles (TArray<FString> &filenames, bool quiet, Lump
|
|||
|
||||
for(unsigned i=0;i<filenames.Size(); i++)
|
||||
{
|
||||
int baselump = NumEntries;
|
||||
AddFile (filenames[i], nullptr, quiet, filter);
|
||||
|
||||
if (i == (unsigned)MaxIwadIndex) MoveLumpsInFolder("after_iwad/");
|
||||
|
@ -1669,3 +1668,20 @@ FResourceLump* FileSystem::GetFileAt(int no)
|
|||
return FileInfo[no].lump;
|
||||
}
|
||||
|
||||
#include "c_dispatch.h"
|
||||
|
||||
CCMD(fs_dir)
|
||||
{
|
||||
int numfiles = fileSystem.GetNumEntries();
|
||||
|
||||
for (int i = 0; i < numfiles; i++)
|
||||
{
|
||||
auto container = fileSystem.GetResourceFileFullName(fileSystem.GetFileContainer(i));
|
||||
auto fn1 = fileSystem.GetFileFullName(i);
|
||||
auto fns = fileSystem.GetFileShortName(i);
|
||||
auto fnid = fileSystem.GetResourceId(i);
|
||||
auto length = fileSystem.FileLength(i);
|
||||
bool hidden = fileSystem.FindFile(fn1) != i;
|
||||
Printf(PRINT_NONOTIFY, "%s%-64s %-15s (%5d) %10d %s %s\n", hidden ? TEXTCOLOR_RED : TEXTCOLOR_UNTRANSLATED, fn1, fns, fnid, length, container, hidden ? "(h)" : "");
|
||||
}
|
||||
}
|
|
@ -490,7 +490,7 @@ bool FResourceFile::FindPrefixRange(FString filter, void *lumps, size_t lumpsize
|
|||
{
|
||||
uint32_t min, max, mid, inside;
|
||||
FResourceLump *lump;
|
||||
int cmp;
|
||||
int cmp = 0;
|
||||
|
||||
end = start = 0;
|
||||
|
||||
|
@ -499,7 +499,7 @@ bool FResourceFile::FindPrefixRange(FString filter, void *lumps, size_t lumpsize
|
|||
lumps = (uint8_t *)lumps - lumpsize;
|
||||
|
||||
// Binary search to find any match at all.
|
||||
min = 1, max = maxlump;
|
||||
mid = min = 1, max = maxlump;
|
||||
while (min <= max)
|
||||
{
|
||||
mid = min + (max - min) / 2;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <limits.h>
|
||||
|
||||
#include "files.h"
|
||||
#include "zstring.h"
|
||||
|
||||
struct LumpFilterInfo
|
||||
{
|
||||
|
|
|
@ -292,12 +292,12 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
auto position = strtoll(base.GetChars(), &endp, 16);
|
||||
if ((*endp == 0 || (*endp == '.' && position >= '!' && position < 0xffff)))
|
||||
{
|
||||
auto lump = TexMan.CheckForTexture(entry.name, ETextureType::MiscPatch);
|
||||
if (lump.isValid())
|
||||
auto texlump = TexMan.CheckForTexture(entry.name, ETextureType::MiscPatch);
|
||||
if (texlump.isValid())
|
||||
{
|
||||
if ((int)position < minchar) minchar = (int)position;
|
||||
if ((int)position > maxchar) maxchar = (int)position;
|
||||
auto tex = TexMan.GetGameTexture(lump);
|
||||
auto tex = TexMan.GetGameTexture(texlump);
|
||||
tex->SetScale((float)Scale.X, (float)Scale.Y);
|
||||
charMap.Insert((int)position, tex);
|
||||
Type = Folder;
|
||||
|
@ -313,10 +313,10 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
auto lump = charMap.CheckKey(FirstChar + i);
|
||||
if (lump != nullptr)
|
||||
auto charlump = charMap.CheckKey(FirstChar + i);
|
||||
if (charlump != nullptr)
|
||||
{
|
||||
auto pic = *lump;
|
||||
auto pic = *charlump;
|
||||
if (pic != nullptr)
|
||||
{
|
||||
double fheight = pic->GetDisplayHeight();
|
||||
|
@ -399,8 +399,8 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
|
|||
part[0].OriginY = -height * y;
|
||||
part[0].TexImage = static_cast<FImageTexture*>(tex->GetTexture());
|
||||
FMultiPatchTexture *image = new FMultiPatchTexture(width, height, part, false, false);
|
||||
FImageTexture *tex = new FImageTexture(image);
|
||||
auto gtex = MakeGameTexture(tex, nullptr, ETextureType::FontChar);
|
||||
FImageTexture *imgtex = new FImageTexture(image);
|
||||
auto gtex = MakeGameTexture(imgtex, nullptr, ETextureType::FontChar);
|
||||
gtex->SetWorldPanning(true);
|
||||
gtex->SetOffsets(0, 0, 0);
|
||||
gtex->SetOffsets(1, 0, 0);
|
||||
|
@ -424,7 +424,6 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
|
|||
LastChar = maxchar;
|
||||
auto count = maxchar - minchar + 1;
|
||||
Chars.Resize(count);
|
||||
int fontheight = 0;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
|
|
|
@ -309,9 +309,9 @@ void FSingleLumpFont::LoadFON2 (int lump, const uint8_t *data)
|
|||
}
|
||||
|
||||
Palette[0] = 0;
|
||||
for (int i = 1; i < ActiveColors; i++)
|
||||
for (int pp = 1; pp < ActiveColors; pp++)
|
||||
{
|
||||
Palette[i] = PalEntry(255, palette[i * 3], palette[i * 3 + 1], palette[i * 3 + 2]);
|
||||
Palette[pp] = PalEntry(255, palette[pp * 3], palette[pp * 3 + 1], palette[pp * 3 + 2]);
|
||||
}
|
||||
|
||||
data_p = palette + ActiveColors*3;
|
||||
|
|
|
@ -102,12 +102,12 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FGameTexture
|
|||
|
||||
if (charlumps[i] != nullptr)
|
||||
{
|
||||
auto pic = charlumps[i];
|
||||
Chars[i].OriginalPic = MakeGameTexture(pic->GetTexture(), nullptr, ETextureType::FontChar);
|
||||
Chars[i].OriginalPic->CopySize(pic, true);
|
||||
auto charpic = charlumps[i];
|
||||
Chars[i].OriginalPic = MakeGameTexture(charpic->GetTexture(), nullptr, ETextureType::FontChar);
|
||||
Chars[i].OriginalPic->CopySize(charpic, true);
|
||||
TexMan.AddGameTexture(Chars[i].OriginalPic);
|
||||
Chars[i].XMove = (int)Chars[i].OriginalPic->GetDisplayWidth();
|
||||
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(pic, Chars[i].OriginalPic);
|
||||
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(charpic, Chars[i].OriginalPic);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -725,9 +725,9 @@ static void CalcDefaultTranslation(FFont* base, int index)
|
|||
auto lum = otherluminosity[i];
|
||||
if (lum >= 0 && lum <= 1)
|
||||
{
|
||||
int index = int(lum * 255);
|
||||
remap[index] = GPalette.BaseColors[i];
|
||||
remap[index].a = 255;
|
||||
int lumidx = int(lum * 255);
|
||||
remap[lumidx] = GPalette.BaseColors[i];
|
||||
remap[lumidx].a = 255;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@ TArray<FBrokenLines> V_BreakLines (FFont *font, int maxwidth, const uint8_t *str
|
|||
{
|
||||
if (*string == '[')
|
||||
{
|
||||
const uint8_t* start = string;
|
||||
while (*string != ']' && *string != '\0')
|
||||
{
|
||||
string++;
|
||||
|
|
|
@ -160,12 +160,12 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
|
|||
it = opt->GetItem("ConnectMessage2");
|
||||
if (it != nullptr) it->SetValue(0, !use_joystick);
|
||||
|
||||
for (int i = 0; i < (int)Joysticks.Size(); ++i)
|
||||
for (int ii = 0; ii < (int)Joysticks.Size(); ++ii)
|
||||
{
|
||||
it = CreateOptionMenuItemJoyConfigMenu(Joysticks[i]->GetName(), Joysticks[i]);
|
||||
it = CreateOptionMenuItemJoyConfigMenu(Joysticks[ii]->GetName(), Joysticks[ii]);
|
||||
GC::WriteBarrier(opt, it);
|
||||
opt->mItems.Push(it);
|
||||
if (i == itemnum) opt->mSelectedItem = opt->mItems.Size();
|
||||
if (ii == itemnum) opt->mSelectedItem = opt->mItems.Size();
|
||||
}
|
||||
if (opt->mSelectedItem >= (int)opt->mItems.Size())
|
||||
{
|
||||
|
@ -179,15 +179,15 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
|
|||
auto p = CurrentMenu->PointerVar<IJoystickConfig>("mJoy");
|
||||
if (p != nullptr)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < Joysticks.Size(); ++i)
|
||||
unsigned ii;
|
||||
for (ii = 0; ii < Joysticks.Size(); ++ii)
|
||||
{
|
||||
if (Joysticks[i] == p)
|
||||
if (Joysticks[ii] == p)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == Joysticks.Size())
|
||||
if (ii == Joysticks.Size())
|
||||
{
|
||||
CurrentMenu->Close();
|
||||
}
|
||||
|
|
|
@ -340,6 +340,10 @@ static void DoParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc, bool &s
|
|||
{
|
||||
desc->mCenter = true;
|
||||
}
|
||||
else if (sc.Compare("Selecteditem"))
|
||||
{
|
||||
desc->mSelectedItem = desc->mItems.Size() - 1;
|
||||
}
|
||||
else if (sc.Compare("animatedtransition"))
|
||||
{
|
||||
desc->mAnimatedTransition = true;
|
||||
|
@ -563,8 +567,8 @@ static void DoParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc, bool &s
|
|||
// NB: index has been incremented, so we're not affecting the newly inserted item here.
|
||||
for (unsigned int i = insertIndex; i < desc->mItems.Size(); i++)
|
||||
{
|
||||
auto item = desc->mItems[i];
|
||||
if (item->GetClass()->IsDescendantOf("ListMenuItemSelectable"))
|
||||
auto litem = desc->mItems[i];
|
||||
if (litem->GetClass()->IsDescendantOf("ListMenuItemSelectable"))
|
||||
{
|
||||
desc->mItems[i]->mYpos += desc->mLinespacing;
|
||||
}
|
||||
|
@ -660,9 +664,9 @@ static bool FindMatchingItem(DMenuItemBase *desc)
|
|||
MenuDescriptorList::Pair *pair;
|
||||
while (it.NextPair(pair))
|
||||
{
|
||||
for (auto it : pair->Value->mItems)
|
||||
for (auto item : pair->Value->mItems)
|
||||
{
|
||||
if (it->mAction == name && GetGroup(it) == grp) return true;
|
||||
if (item->mAction == name && GetGroup(item) == grp) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -151,8 +151,6 @@ int FSavegameManagerBase::InsertSaveNode(FSaveGameNode *node)
|
|||
|
||||
void FSavegameManagerBase::NotifyNewSave(const FString &file, const FString &title, bool okForQuicksave, bool forceQuicksave)
|
||||
{
|
||||
FSaveGameNode *node;
|
||||
|
||||
if (file.IsEmpty())
|
||||
return;
|
||||
|
||||
|
@ -180,7 +178,7 @@ void FSavegameManagerBase::NotifyNewSave(const FString &file, const FString &tit
|
|||
}
|
||||
}
|
||||
|
||||
node = new FSaveGameNode;
|
||||
auto node = new FSaveGameNode;
|
||||
node->SaveTitle = title;
|
||||
node->Filename = file;
|
||||
node->bOldVersion = false;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// the Free Software Foundation, either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
|
@ -98,7 +98,7 @@ static int FindGFXFile(FString & fn)
|
|||
|
||||
for (const char ** extp=extensions; *extp; extp++)
|
||||
{
|
||||
int lump = fileSystem.CheckNumForFullName(fn + *extp);
|
||||
lump = fileSystem.CheckNumForFullName(fn + *extp);
|
||||
if (lump >= best) best = lump;
|
||||
}
|
||||
return best;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// the Free Software Foundation, either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
|
@ -217,10 +217,10 @@ void FDMDModel::LoadGeometry()
|
|||
memcpy(lods[i].triangles, buffer + lodInfo[i].offsetTriangles, lodInfo[i].numTriangles * sizeof(FTriangle));
|
||||
for (int j = 0; j < lodInfo[i].numTriangles; j++)
|
||||
{
|
||||
for (int k = 0; k < 3; k++)
|
||||
for (int kk = 0; kk < 3; kk++)
|
||||
{
|
||||
lods[i].triangles[j].textureIndices[k] = LittleShort(lods[i].triangles[j].textureIndices[k]);
|
||||
lods[i].triangles[j].vertexIndices[k] = LittleShort(lods[i].triangles[j].vertexIndices[k]);
|
||||
lods[i].triangles[j].textureIndices[kk] = LittleShort(lods[i].triangles[j].textureIndices[kk]);
|
||||
lods[i].triangles[j].vertexIndices[kk] = LittleShort(lods[i].triangles[j].vertexIndices[kk]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ void FDMDModel::BuildVertexBuffer(FModelRenderer *renderer)
|
|||
|
||||
FTriangle *tri = lods[0].triangles;
|
||||
|
||||
for (int i = 0; i < lodInfo[0].numTriangles; i++)
|
||||
for (int ii = 0; ii < lodInfo[0].numTriangles; ii++)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -541,10 +541,10 @@ void FMD2Model::LoadGeometry()
|
|||
memcpy(lods[0].triangles, buffer + lodInfo[0].offsetTriangles, sizeof(FTriangle) * cnt);
|
||||
for (int j = 0; j < cnt; j++)
|
||||
{
|
||||
for (int k = 0; k < 3; k++)
|
||||
for (int kk = 0; kk < 3; kk++)
|
||||
{
|
||||
lods[0].triangles[j].textureIndices[k] = LittleShort(lods[0].triangles[j].textureIndices[k]);
|
||||
lods[0].triangles[j].vertexIndices[k] = LittleShort(lods[0].triangles[j].vertexIndices[k]);
|
||||
lods[0].triangles[j].textureIndices[kk] = LittleShort(lods[0].triangles[j].textureIndices[kk]);
|
||||
lods[0].triangles[j].vertexIndices[kk] = LittleShort(lods[0].triangles[j].vertexIndices[kk]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// the Free Software Foundation, either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
|
@ -141,7 +141,7 @@ bool FMD3Model::Load(const char * path, int lumpnum, const char * buffer, int le
|
|||
Frames.Resize(numFrames);
|
||||
for (unsigned i = 0; i < numFrames; i++)
|
||||
{
|
||||
strncpy(Frames[i].Name, frm[i].Name, 16);
|
||||
strncpy(Frames[i].Name, frm[i].Name, 15);
|
||||
for (int j = 0; j < 3; j++) Frames[i].origin[j] = frm[i].localorigin[j];
|
||||
}
|
||||
|
||||
|
@ -164,15 +164,15 @@ bool FMD3Model::Load(const char * path, int lumpnum, const char * buffer, int le
|
|||
md3_shader_t * shader = (md3_shader_t*)(((char*)ss) + LittleLong(ss->Ofs_Shaders));
|
||||
s->Skins.Resize(s->numSkins);
|
||||
|
||||
for (unsigned i = 0; i < s->numSkins; i++)
|
||||
for (unsigned ii = 0; ii < s->numSkins; ii++)
|
||||
{
|
||||
// [BB] According to the MD3 spec, Name is supposed to include the full path.
|
||||
// ... and since some tools seem to output backslashes, these need to be replaced with forward slashes to work.
|
||||
FixPathSeperator(shader[i].Name);
|
||||
s->Skins[i] = LoadSkin("", shader[i].Name);
|
||||
FixPathSeperator(shader[ii].Name);
|
||||
s->Skins[ii] = LoadSkin("", shader[ii].Name);
|
||||
// [BB] Fall back and check if Name is relative.
|
||||
if (!s->Skins[i].isValid())
|
||||
s->Skins[i] = LoadSkin(path, shader[i].Name);
|
||||
if (!s->Skins[ii].isValid())
|
||||
s->Skins[ii] = LoadSkin(path, shader[ii].Name);
|
||||
}
|
||||
}
|
||||
mLumpNum = lumpnum;
|
||||
|
@ -203,31 +203,31 @@ void FMD3Model::LoadGeometry()
|
|||
md3_triangle_t * tris = (md3_triangle_t*)(((char*)ss) + LittleLong(ss->Ofs_Triangles));
|
||||
s->Tris.Resize(s->numTriangles);
|
||||
|
||||
for (unsigned i = 0; i < s->numTriangles; i++) for (int j = 0; j < 3; j++)
|
||||
for (unsigned ii = 0; ii < s->numTriangles; ii++) for (int j = 0; j < 3; j++)
|
||||
{
|
||||
s->Tris[i].VertIndex[j] = LittleLong(tris[i].vt_index[j]);
|
||||
s->Tris[ii].VertIndex[j] = LittleLong(tris[ii].vt_index[j]);
|
||||
}
|
||||
|
||||
// Load texture coordinates
|
||||
md3_texcoord_t * tc = (md3_texcoord_t*)(((char*)ss) + LittleLong(ss->Ofs_Texcoord));
|
||||
s->Texcoords.Resize(s->numVertices);
|
||||
|
||||
for (unsigned i = 0; i < s->numVertices; i++)
|
||||
for (unsigned ii = 0; ii < s->numVertices; ii++)
|
||||
{
|
||||
s->Texcoords[i].s = tc[i].s;
|
||||
s->Texcoords[i].t = tc[i].t;
|
||||
s->Texcoords[ii].s = tc[ii].s;
|
||||
s->Texcoords[ii].t = tc[ii].t;
|
||||
}
|
||||
|
||||
// Load vertices and texture coordinates
|
||||
md3_vertex_t * vt = (md3_vertex_t*)(((char*)ss) + LittleLong(ss->Ofs_XYZNormal));
|
||||
s->Vertices.Resize(s->numVertices * Frames.Size());
|
||||
|
||||
for (unsigned i = 0; i < s->numVertices * Frames.Size(); i++)
|
||||
for (unsigned ii = 0; ii < s->numVertices * Frames.Size(); ii++)
|
||||
{
|
||||
s->Vertices[i].x = LittleShort(vt[i].x) / 64.f;
|
||||
s->Vertices[i].y = LittleShort(vt[i].y) / 64.f;
|
||||
s->Vertices[i].z = LittleShort(vt[i].z) / 64.f;
|
||||
UnpackVector(LittleShort(vt[i].n), s->Vertices[i].nx, s->Vertices[i].ny, s->Vertices[i].nz);
|
||||
s->Vertices[ii].x = LittleShort(vt[ii].x) / 64.f;
|
||||
s->Vertices[ii].y = LittleShort(vt[ii].y) / 64.f;
|
||||
s->Vertices[ii].z = LittleShort(vt[ii].z) / 64.f;
|
||||
UnpackVector(LittleShort(vt[ii].n), s->Vertices[ii].nx, s->Vertices[ii].ny, s->Vertices[ii].nz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// the Free Software Foundation, either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
|
@ -205,7 +205,6 @@ void FVoxelModel::AddFace(int x1, int y1, int z1, int x2, int y2, int z2, int x3
|
|||
float PivotX = mVoxel->Mips[0].Pivot.X;
|
||||
float PivotY = mVoxel->Mips[0].Pivot.Y;
|
||||
float PivotZ = mVoxel->Mips[0].Pivot.Z;
|
||||
int h = mVoxel->Mips[0].SizeZ;
|
||||
FModelVertex vert;
|
||||
unsigned int indx[4];
|
||||
|
||||
|
@ -286,8 +285,8 @@ void FVoxelModel::MakeSlabPolys(int x, int y, kvxslab_t *voxptr, FVoxelMap &chec
|
|||
}
|
||||
if (cull & 32)
|
||||
{
|
||||
int z = ztop+zleng-1;
|
||||
AddFace(x+1, y, z+1, x, y, z+1, x+1, y+1, z+1, x, y+1, z+1, voxptr->col[zleng-1], check);
|
||||
int zz = ztop+zleng-1;
|
||||
AddFace(x+1, y, zz+1, x, y, zz+1, x+1, y+1, zz+1, x, y+1, zz+1, voxptr->col[zleng-1], check);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,9 @@ void I_PrintStr(const char *cp)
|
|||
if (*srcp == 0x1c && con_printansi && terminal)
|
||||
{
|
||||
srcp += 1;
|
||||
EColorRange range = V_ParseFontColor((const uint8_t*&)srcp, CR_UNTRANSLATED, CR_YELLOW);
|
||||
const uint8_t* scratch = (const uint8_t*)srcp; // GCC does not like direct casting of the parameter.
|
||||
EColorRange range = V_ParseFontColor(scratch, CR_UNTRANSLATED, CR_YELLOW);
|
||||
srcp = (char*)scratch;
|
||||
if (range != CR_UNDEFINED)
|
||||
{
|
||||
PalEntry color = V_LogColorFromColorRange(range);
|
||||
|
|
|
@ -279,7 +279,7 @@ void SystemBaseFrameBuffer::PositionWindow(bool fullscreen, bool initialcall)
|
|||
RECT r;
|
||||
LONG style, exStyle;
|
||||
|
||||
RECT monRect;
|
||||
RECT monRect = {};
|
||||
|
||||
if (!m_Fullscreen && fullscreen && !initialcall) SaveWindowedPos();
|
||||
if (m_Monitor)
|
||||
|
|
|
@ -340,7 +340,7 @@ static HANDLE WriteMyMiniDump (void)
|
|||
MINIDUMP_EXCEPTION_INFORMATION exceptor = { DbgThreadID, &CrashPointers, FALSE };
|
||||
WCHAR dbghelpPath[MAX_PATH+12], *bs;
|
||||
WRITEDUMP pMiniDumpWriteDump;
|
||||
HANDLE file;
|
||||
HANDLE file = INVALID_HANDLE_VALUE;
|
||||
BOOL good = FALSE;
|
||||
HMODULE dbghelp = NULL;
|
||||
|
||||
|
@ -710,14 +710,14 @@ HANDLE WriteTextReport ()
|
|||
ctxt->Rip, ctxt->Rsp, ctxt->SegCs, ctxt->SegSs, ctxt->EFlags);
|
||||
#endif
|
||||
|
||||
DWORD j;
|
||||
DWORD dw;
|
||||
|
||||
for (i = 0, j = 1; (size_t)i < sizeof(eflagsBits)/sizeof(eflagsBits[0]); j <<= 1, ++i)
|
||||
for (i = 0, dw = 1; (size_t)i < sizeof(eflagsBits)/sizeof(eflagsBits[0]); dw <<= 1, ++i)
|
||||
{
|
||||
if (eflagsBits[i][0] != 'x')
|
||||
{
|
||||
Writef (file, " %c%c%c", eflagsBits[i][0], eflagsBits[i][1],
|
||||
ctxt->EFlags & j ? '+' : '-');
|
||||
ctxt->EFlags & dw ? '+' : '-');
|
||||
}
|
||||
}
|
||||
Writef (file, "\r\n");
|
||||
|
|
|
@ -281,14 +281,6 @@ CUSTOM_CVAR(Bool, joy_dinput, true, CVAR_GLOBALCONFIG|CVAR_ARCHIVE|CVAR_NOINITCA
|
|||
|
||||
static const uint8_t POVButtons[9] = { 0x01, 0x03, 0x02, 0x06, 0x04, 0x0C, 0x08, 0x09, 0x00 };
|
||||
|
||||
//("dc12a687-737f-11cf-884d-00aa004b2e24")
|
||||
static const IID IID_IWbemLocator = { 0xdc12a687, 0x737f, 0x11cf,
|
||||
{ 0x88, 0x4d, 0x00, 0xaa, 0x00, 0x4b, 0x2e, 0x24 } };
|
||||
|
||||
//("4590f811-1d3a-11d0-891f-00aa004b2e24")
|
||||
static const CLSID CLSID_WbemLocator = { 0x4590f811, 0x1d3a, 0x11d0,
|
||||
{ 0x89, 0x1f, 0x00, 0xaa, 0x00, 0x4b, 0x2e, 0x24 } };
|
||||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -514,8 +514,6 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
case WM_WTSSESSION_CHANGE:
|
||||
case WM_POWERBROADCAST:
|
||||
{
|
||||
int oldstate = SessionState;
|
||||
|
||||
if (message == WM_WTSSESSION_CHANGE && lParam == (LPARAM)SessionID)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
|
|
@ -268,7 +268,6 @@ void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult)
|
|||
}
|
||||
else
|
||||
{
|
||||
bool pauseState = false;
|
||||
bool captureModeInGame = sysCallbacks.CaptureModeInGame && sysCallbacks.CaptureModeInGame();
|
||||
want_native = ((!m_use_mouse || menuactive != MENU_WaitKey) &&
|
||||
(!captureModeInGame || GUICapture));
|
||||
|
|
|
@ -288,8 +288,8 @@ static void DoPrintStr(const char *cpt, HWND edit, HANDLE StdOut)
|
|||
|
||||
wchar_t wbuf[256];
|
||||
int bpos = 0;
|
||||
CHARRANGE selection;
|
||||
CHARRANGE endselection;
|
||||
CHARRANGE selection = {};
|
||||
CHARRANGE endselection = {};
|
||||
LONG lines_before = 0, lines_after;
|
||||
CHARFORMAT format;
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ CUSTOM_CVAR(Int, showendoom, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|||
FStartupScreen *FStartupScreen::CreateInstance(int max_progress)
|
||||
{
|
||||
FStartupScreen *scr = NULL;
|
||||
HRESULT hr;
|
||||
HRESULT hr = -1;
|
||||
|
||||
if (!Args->CheckParm("-nostartup"))
|
||||
{
|
||||
|
|
|
@ -751,9 +751,9 @@ FStrifeStartupScreen::FStrifeStartupScreen(int max_progress, long& hr)
|
|||
|
||||
if (lumpnum >= 0 && (lumplen = fileSystem.FileLength(lumpnum)) == StrifeStartupPicSizes[i])
|
||||
{
|
||||
auto lumpr = fileSystem.OpenFileReader(lumpnum);
|
||||
auto lumpr1 = fileSystem.OpenFileReader(lumpnum);
|
||||
StartupPics[i] = new uint8_t[lumplen];
|
||||
lumpr.Read(StartupPics[i], lumplen);
|
||||
lumpr1.Read(StartupPics[i], lumplen);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -423,8 +423,6 @@ bool Win32GLVideo::InitHardware(HWND Window, int multisample)
|
|||
}
|
||||
|
||||
int prof = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||
const char *version = Args->CheckValue("-glversion");
|
||||
|
||||
|
||||
for (; prof <= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; prof++)
|
||||
{
|
||||
|
|
|
@ -326,7 +326,6 @@ void OpenGLFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
|
|||
{
|
||||
if (mat->Source()->GetUseType() == ETextureType::SWCanvas) return;
|
||||
|
||||
int flags = mat->GetScaleFlags();
|
||||
int numLayers = mat->NumLayers();
|
||||
MaterialLayerInfo* layer;
|
||||
auto base = static_cast<FHardwareTexture*>(mat->GetLayer(0, translation, &layer));
|
||||
|
|
|
@ -301,8 +301,6 @@ void FHardwareTexture::BindToFrameBuffer(int width, int height)
|
|||
|
||||
bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, int translation, int flags)
|
||||
{
|
||||
int usebright = false;
|
||||
|
||||
bool needmipmap = (clampmode <= CLAMP_XY) && !forcenofilter;
|
||||
|
||||
// Bind it to the system.
|
||||
|
|
|
@ -444,8 +444,6 @@ bool FGLRenderBuffers::CheckFrameBufferCompleteness()
|
|||
if (result == GL_FRAMEBUFFER_COMPLETE)
|
||||
return true;
|
||||
|
||||
bool FailedCreate = true;
|
||||
|
||||
if (gl_debug_level > 0)
|
||||
{
|
||||
FString error = "glCheckFramebufferStatus failed: ";
|
||||
|
|
|
@ -318,7 +318,6 @@ void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translatio
|
|||
lastClamp = clampmode;
|
||||
lastTranslation = translation;
|
||||
|
||||
int usebright = false;
|
||||
int maxbound = 0;
|
||||
|
||||
int numLayers = mat->NumLayers();
|
||||
|
|
|
@ -620,7 +620,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
{
|
||||
char stringbuf[20];
|
||||
mysnprintf(stringbuf, 20, "texture%d", i);
|
||||
int tempindex = glGetUniformLocation(hShader, stringbuf);
|
||||
tempindex = glGetUniformLocation(hShader, stringbuf);
|
||||
if (tempindex > 0) glUniform1i(tempindex, i - 1);
|
||||
}
|
||||
|
||||
|
@ -783,8 +783,8 @@ void FShaderCollection::CompileShaders(EPassType passType)
|
|||
mMaterialShaders.Push(shc);
|
||||
if (i < SHADER_NoTexture)
|
||||
{
|
||||
FShader *shc = Compile(defaultshaders[i].ShaderName, defaultshaders[i].gettexelfunc, defaultshaders[i].lightfunc, defaultshaders[i].Defines, false, passType);
|
||||
mMaterialShadersNAT.Push(shc);
|
||||
FShader *shc1 = Compile(defaultshaders[i].ShaderName, defaultshaders[i].gettexelfunc, defaultshaders[i].lightfunc, defaultshaders[i].Defines, false, passType);
|
||||
mMaterialShadersNAT.Push(shc1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -138,6 +138,7 @@ void OpenGLFrameBuffer::InitializeState()
|
|||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
if (gles.depthClampAvailable) glEnable(GL_DEPTH_CLAMP);
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
|
@ -286,7 +287,6 @@ void OpenGLFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
|
|||
{
|
||||
if (mat->Source()->GetUseType() == ETextureType::SWCanvas) return;
|
||||
|
||||
int flags = mat->GetScaleFlags();
|
||||
int numLayers = mat->NumLayers();
|
||||
MaterialLayerInfo* layer;
|
||||
auto base = static_cast<FHardwareTexture*>(mat->GetLayer(0, translation, &layer));
|
||||
|
|
|
@ -132,14 +132,23 @@ unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int
|
|||
|
||||
|
||||
#if USE_GLES2
|
||||
sourcetype = GL_BGRA;
|
||||
texformat = GL_BGRA;
|
||||
if (glTextureBytes == 1)
|
||||
{
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
sourcetype = GL_ALPHA;
|
||||
texformat = GL_ALPHA;
|
||||
}
|
||||
else
|
||||
{
|
||||
sourcetype = GL_BGRA;
|
||||
texformat = GL_BGRA;
|
||||
}
|
||||
#else
|
||||
if (glTextureBytes == 1)
|
||||
{
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
sourcetype = GL_RED;
|
||||
texformat = GL_R8;
|
||||
texformat = GL_RED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -150,6 +159,16 @@ unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int
|
|||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, texformat, rw, rh, 0, sourcetype, GL_UNSIGNED_BYTE, buffer);
|
||||
|
||||
#if !(USE_GLES2)
|
||||
// The shader is using the alpha channel instead of red, this work on GLES but not on GL
|
||||
// So the texture uses GL_RED and this swizzels the red channel into the alpha channel
|
||||
if (glTextureBytes == 1)
|
||||
{
|
||||
GLint swizzleMask[] = { GL_ZERO, GL_ZERO, GL_ZERO, GL_RED };
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (deletebuffer && buffer) free(buffer);
|
||||
|
||||
if (mipmap && TexFilter[gl_texture_filter].mipmapping)
|
||||
|
@ -166,9 +185,6 @@ unsigned int FHardwareTexture::CreateTexture(unsigned char * buffer, int w, int
|
|||
|
||||
void FHardwareTexture::AllocateBuffer(int w, int h, int texelsize)
|
||||
{
|
||||
int rw = GetTexDimension(w);
|
||||
int rh = GetTexDimension(h);
|
||||
|
||||
if (texelsize < 1 || texelsize > 4) texelsize = 4;
|
||||
glTextureBytes = texelsize;
|
||||
bufferpitch = w;
|
||||
|
@ -287,8 +303,6 @@ void FHardwareTexture::BindToFrameBuffer(int width, int height)
|
|||
|
||||
bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, int translation, int flags)
|
||||
{
|
||||
int usebright = false;
|
||||
|
||||
bool needmipmap = (clampmode <= CLAMP_XY) && !forcenofilter;
|
||||
|
||||
// Bind it to the system.
|
||||
|
|
|
@ -161,7 +161,6 @@ void FGLRenderer::DrawPresentTexture(const IntRect &box, bool applyGamma)
|
|||
|
||||
for (size_t n = 0; n < mPresentShader->Uniforms.mFields.size(); n++)
|
||||
{
|
||||
int index = -1;
|
||||
UniformFieldDesc desc = mPresentShader->Uniforms.mFields[n];
|
||||
int loc = mPresentShader->Uniforms.UniformLocation[n];
|
||||
switch (desc.Type)
|
||||
|
|
|
@ -302,9 +302,6 @@ namespace OpenGLESRenderer
|
|||
if (result == GL_FRAMEBUFFER_COMPLETE)
|
||||
return true;
|
||||
|
||||
bool FailedCreate = true;
|
||||
|
||||
|
||||
FString error = "glCheckFramebufferStatus failed: ";
|
||||
switch (result)
|
||||
{
|
||||
|
|
|
@ -110,7 +110,6 @@ FGLRenderer::~FGLRenderer()
|
|||
|
||||
bool FGLRenderer::StartOffscreen()
|
||||
{
|
||||
bool firstBind = (mFBID == 0);
|
||||
if (mFBID == 0)
|
||||
glGenFramebuffers(1, &mFBID);
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &mOldFBID);
|
||||
|
|
|
@ -389,19 +389,17 @@ void FGLRenderState::ApplyState()
|
|||
mMaterial.mChanged = false;
|
||||
}
|
||||
|
||||
if (mBias.mChanged)
|
||||
|
||||
if (mBias.mFactor == 0 && mBias.mUnits == 0)
|
||||
{
|
||||
if (mBias.mFactor == 0 && mBias.mUnits == 0)
|
||||
{
|
||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
}
|
||||
else
|
||||
{
|
||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
}
|
||||
glPolygonOffset(mBias.mFactor, mBias.mUnits);
|
||||
mBias.mChanged = false;
|
||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||
}
|
||||
else
|
||||
{
|
||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
}
|
||||
glPolygonOffset(mBias.mFactor, mBias.mUnits);
|
||||
mBias.mChanged = false;
|
||||
}
|
||||
|
||||
void FGLRenderState::ApplyBuffers()
|
||||
|
@ -458,7 +456,6 @@ void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translatio
|
|||
lastClamp = clampmode;
|
||||
lastTranslation = translation;
|
||||
|
||||
int usebright = false;
|
||||
int maxbound = 0;
|
||||
|
||||
int numLayers = mat->NumLayers();
|
||||
|
|
|
@ -149,7 +149,6 @@ std::pair<FFlatVertex *, unsigned int> FFlatVertexBuffer::AllocVertices(unsigned
|
|||
{
|
||||
FFlatVertex *p = GetBuffer();
|
||||
auto index = mCurIndex.fetch_add(count);
|
||||
auto offset = index;
|
||||
if (index + count >= BUFFER_SIZE_TO_USE)
|
||||
{
|
||||
// If a single scene needs 2'000'000 vertices there must be something very wrong.
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#ifndef __GLC_DYNLIGHT_H
|
||||
#define __GLC_DYNLIGHT_H
|
||||
|
||||
#include "tarray.h"
|
||||
|
||||
struct FDynLightData
|
||||
{
|
||||
TArray<float> arrays[3];
|
||||
|
|
|
@ -152,7 +152,7 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
|
|||
char *chars = code.LockBuffer();
|
||||
|
||||
ptrdiff_t startIndex = 0;
|
||||
ptrdiff_t startpos, endpos;
|
||||
ptrdiff_t startpos, endpos = 0;
|
||||
while (true)
|
||||
{
|
||||
ptrdiff_t matchIndex = code.IndexOf("layout(binding", startIndex);
|
||||
|
@ -188,10 +188,10 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
|
|||
if (isSamplerUniformName)
|
||||
{
|
||||
samplerstobind.Push(std::make_pair(identifier, val));
|
||||
for (auto pos = startpos; pos < endpos; pos++)
|
||||
for (auto posi = startpos; posi < endpos; posi++)
|
||||
{
|
||||
if (!IsGlslWhitespace(chars[pos]))
|
||||
chars[pos] = ' ';
|
||||
if (!IsGlslWhitespace(chars[posi]))
|
||||
chars[posi] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +216,6 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
|
|||
|
||||
FString RemoveLayoutLocationDecl(FString code, const char *inoutkeyword)
|
||||
{
|
||||
ptrdiff_t len = code.Len();
|
||||
char *chars = code.LockBuffer();
|
||||
|
||||
ptrdiff_t startIndex = 0;
|
||||
|
@ -255,8 +254,8 @@ FString RemoveLayoutLocationDecl(FString code, const char *inoutkeyword)
|
|||
if (keywordFound && IsGlslWhitespace(chars[endIndex + i]))
|
||||
{
|
||||
// yes - replace declaration with spaces
|
||||
for (auto i = matchIndex; i < endIndex; i++)
|
||||
chars[i] = ' ';
|
||||
for (auto ii = matchIndex; ii < endIndex; ii++)
|
||||
chars[ii] = ' ';
|
||||
}
|
||||
|
||||
startIndex = endIndex;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "hw_aabbtree.h"
|
||||
#include "stats.h"
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
class IDataBuffer;
|
||||
|
||||
|
|
|
@ -154,9 +154,9 @@ VSMatrix VREyeInfo::GetProjection(float fov, float aspectRatio, float fovRatio)
|
|||
double bottom = -fH;
|
||||
double top = fH;
|
||||
|
||||
VSMatrix result(1);
|
||||
result.frustum((float)left, (float)right, (float)bottom, (float)top, (float)zNear, (float)zFar);
|
||||
return result;
|
||||
VSMatrix fmat(1);
|
||||
fmat.frustum((float)left, (float)right, (float)bottom, (float)top, (float)zNear, (float)zFar);
|
||||
return fmat;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,6 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
|
|||
for(auto &cmd : commands)
|
||||
{
|
||||
|
||||
int gltrans = -1;
|
||||
state.SetRenderStyle(cmd.mRenderStyle);
|
||||
state.EnableBrightmap(!(cmd.mRenderStyle.Flags & STYLEF_ColorIsFixed));
|
||||
state.EnableFog(2); // Special 2D mode 'fog'.
|
||||
|
|
|
@ -105,7 +105,6 @@ namespace
|
|||
// minimum set in GZDoom 4.0.0, but only while those fonts are required.
|
||||
|
||||
static bool lastspecialUI = false;
|
||||
bool isInActualMenu = false;
|
||||
|
||||
bool specialUI = (!sysCallbacks.IsSpecialUI || sysCallbacks.IsSpecialUI());
|
||||
|
||||
|
|
|
@ -374,8 +374,6 @@ void V_InitScreen()
|
|||
|
||||
void V_Init2()
|
||||
{
|
||||
float gamma = static_cast<DDummyFrameBuffer *>(screen)->Gamma;
|
||||
|
||||
{
|
||||
DFrameBuffer *s = screen;
|
||||
screen = NULL;
|
||||
|
|
|
@ -255,12 +255,12 @@ void VkRenderBuffers::CreateShadowmap()
|
|||
|
||||
if (!ShadowmapSampler)
|
||||
{
|
||||
SamplerBuilder builder;
|
||||
builder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST);
|
||||
builder.setMinFilter(VK_FILTER_NEAREST);
|
||||
builder.setMagFilter(VK_FILTER_NEAREST);
|
||||
builder.setAddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE);
|
||||
ShadowmapSampler = builder.create(fb->device);
|
||||
SamplerBuilder samplerBuilder;
|
||||
samplerBuilder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST);
|
||||
samplerBuilder.setMinFilter(VK_FILTER_NEAREST);
|
||||
samplerBuilder.setMagFilter(VK_FILTER_NEAREST);
|
||||
samplerBuilder.setAddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE);
|
||||
ShadowmapSampler = samplerBuilder.create(fb->device);
|
||||
ShadowmapSampler->SetDebugName("VkRenderBuffers.ShadowmapSampler");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,20 +325,20 @@ void VulkanDevice::CreateInstance()
|
|||
|
||||
if (debugLayerFound)
|
||||
{
|
||||
VkDebugUtilsMessengerCreateInfoEXT createInfo = {};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT;
|
||||
createInfo.messageSeverity =
|
||||
VkDebugUtilsMessengerCreateInfoEXT dbgCreateInfo = {};
|
||||
dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT;
|
||||
dbgCreateInfo.messageSeverity =
|
||||
//VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT |
|
||||
//VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT |
|
||||
VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
|
||||
VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT;
|
||||
createInfo.messageType =
|
||||
dbgCreateInfo.messageType =
|
||||
VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT |
|
||||
VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
|
||||
VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
|
||||
createInfo.pfnUserCallback = DebugCallback;
|
||||
createInfo.pUserData = this;
|
||||
result = vkCreateDebugUtilsMessengerEXT(instance, &createInfo, nullptr, &debugMessenger);
|
||||
dbgCreateInfo.pfnUserCallback = DebugCallback;
|
||||
dbgCreateInfo.pUserData = this;
|
||||
result = vkCreateDebugUtilsMessengerEXT(instance, &dbgCreateInfo, nullptr, &debugMessenger);
|
||||
CheckVulkanError(result, "vkCreateDebugUtilsMessengerEXT failed");
|
||||
|
||||
DebugLayerActive = true;
|
||||
|
@ -347,8 +347,6 @@ void VulkanDevice::CreateInstance()
|
|||
|
||||
VkBool32 VulkanDevice::DebugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT* callbackData, void* userData)
|
||||
{
|
||||
VulkanDevice *device = (VulkanDevice*)userData;
|
||||
|
||||
static std::mutex mtx;
|
||||
static std::set<FString> seenMessages;
|
||||
static int totalMessages;
|
||||
|
|
|
@ -392,8 +392,8 @@ void VulkanFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
|
|||
int numLayers = mat->NumLayers();
|
||||
for (int i = 1; i < numLayers; i++)
|
||||
{
|
||||
auto systex = static_cast<VkHardwareTexture*>(mat->GetLayer(i, 0, &layer));
|
||||
systex->GetImage(layer->layerTexture, 0, layer->scaleFlags);
|
||||
auto syslayer = static_cast<VkHardwareTexture*>(mat->GetLayer(i, 0, &layer));
|
||||
syslayer->GetImage(layer->layerTexture, 0, layer->scaleFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,6 @@ IDataBuffer *VulkanFrameBuffer::CreateDataBuffer(int bindingpoint, bool ssbo, bo
|
|||
{
|
||||
auto buffer = new VKDataBuffer(bindingpoint, ssbo, needsresize);
|
||||
|
||||
auto fb = GetVulkanFrameBuffer();
|
||||
switch (bindingpoint)
|
||||
{
|
||||
case LIGHTBUF_BINDINGPOINT: LightBufferSSO = buffer; break;
|
||||
|
|
|
@ -407,18 +407,18 @@ VulkanDescriptorSet* VkMaterial::GetDescriptorSet(const FMaterialState& state)
|
|||
{
|
||||
for (int i = 1; i < numLayers; i++)
|
||||
{
|
||||
auto systex = static_cast<VkHardwareTexture*>(GetLayer(i, 0, &layer));
|
||||
auto systeximage = systex->GetImage(layer->layerTexture, 0, layer->scaleFlags);
|
||||
update.addCombinedImageSampler(descriptor.get(), i, systeximage->View.get(), sampler, systeximage->Layout);
|
||||
auto syslayer = static_cast<VkHardwareTexture*>(GetLayer(i, 0, &layer));
|
||||
auto syslayerimage = syslayer->GetImage(layer->layerTexture, 0, layer->scaleFlags);
|
||||
update.addCombinedImageSampler(descriptor.get(), i, syslayerimage->View.get(), sampler, syslayerimage->Layout);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 1; i < 3; i++)
|
||||
{
|
||||
auto systex = static_cast<VkHardwareTexture*>(GetLayer(i, translation, &layer));
|
||||
auto systeximage = systex->GetImage(layer->layerTexture, 0, layer->scaleFlags);
|
||||
update.addCombinedImageSampler(descriptor.get(), i, systeximage->View.get(), sampler, systeximage->Layout);
|
||||
auto syslayer = static_cast<VkHardwareTexture*>(GetLayer(i, translation, &layer));
|
||||
auto syslayerimage = syslayer->GetImage(layer->layerTexture, 0, layer->scaleFlags);
|
||||
update.addCombinedImageSampler(descriptor.get(), i, syslayerimage->View.get(), sampler, syslayerimage->Layout);
|
||||
}
|
||||
numLayers = 3;
|
||||
}
|
||||
|
|
|
@ -522,10 +522,10 @@ FxExpression *FxConstant::MakeConstant(PSymbol *sym, const FScriptPosition &pos)
|
|||
}
|
||||
else
|
||||
{
|
||||
PSymbolConstString *csym = dyn_cast<PSymbolConstString>(sym);
|
||||
if (csym != nullptr)
|
||||
PSymbolConstString *csymbol = dyn_cast<PSymbolConstString>(sym);
|
||||
if (csymbol != nullptr)
|
||||
{
|
||||
x = new FxConstant(csym->Str, pos);
|
||||
x = new FxConstant(csymbol->Str, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2436,7 +2436,7 @@ ExpEmit FxAssign::Emit(VMFunctionBuilder *build)
|
|||
|
||||
ExpEmit result;
|
||||
bool intconst = false;
|
||||
int intconstval;
|
||||
int intconstval = 0;
|
||||
|
||||
if (Right->isConstant() && Right->ValueType->GetRegType() == REGT_INT)
|
||||
{
|
||||
|
@ -4396,7 +4396,7 @@ ExpEmit FxBinaryLogical::Emit(VMFunctionBuilder *build)
|
|||
build->Emit(OP_LI, to.RegNum, (Operator == TK_AndAnd) ? 1 : 0);
|
||||
build->Emit(OP_JMP, 1);
|
||||
build->BackpatchListToHere(no);
|
||||
auto ctarget = build->Emit(OP_LI, to.RegNum, (Operator == TK_AndAnd) ? 0 : 1);
|
||||
build->Emit(OP_LI, to.RegNum, (Operator == TK_AndAnd) ? 0 : 1);
|
||||
list.DeleteAndClear();
|
||||
list.ShrinkToFit();
|
||||
return to;
|
||||
|
@ -5134,7 +5134,7 @@ ExpEmit FxNew::Emit(VMFunctionBuilder *build)
|
|||
int outerside = -1;
|
||||
if (!val->isConstant())
|
||||
{
|
||||
int outerside = FScopeBarrier::SideFromFlags(CallingFunction->Variants[0].Flags);
|
||||
outerside = FScopeBarrier::SideFromFlags(CallingFunction->Variants[0].Flags);
|
||||
if (outerside == FScopeBarrier::Side_Virtual)
|
||||
outerside = FScopeBarrier::SideFromObjectFlags(CallingFunction->OwningClass->ScopeFlags);
|
||||
}
|
||||
|
@ -5569,8 +5569,6 @@ FxExpression *FxRandomPick::Resolve(FCompileContext &ctx)
|
|||
|
||||
ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
assert(choices.Size() > 0);
|
||||
|
||||
// Call BuiltinRandom to generate a random number.
|
||||
|
@ -5603,7 +5601,7 @@ ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build)
|
|||
|
||||
// Allocate space for the jump table.
|
||||
size_t jumptable = build->Emit(OP_JMP, 0);
|
||||
for (i = 1; i < choices.Size(); ++i)
|
||||
for (unsigned i = 1; i < choices.Size(); ++i)
|
||||
{
|
||||
build->Emit(OP_JMP, 0);
|
||||
}
|
||||
|
@ -5639,7 +5637,7 @@ ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build)
|
|||
}
|
||||
}
|
||||
// Backpatch each case (except the last, since it ends here) to jump to here.
|
||||
for (i = 0; i < choices.Size() - 1; ++i)
|
||||
for (unsigned i = 0; i < choices.Size() - 1; ++i)
|
||||
{
|
||||
build->BackpatchToHere(finishes[i]);
|
||||
}
|
||||
|
@ -7855,8 +7853,8 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
|||
}
|
||||
else if (!ArgList.Size())
|
||||
{
|
||||
auto cls = static_cast<PClassType*>(ctx.Class)->Descriptor;
|
||||
ArgList.Push(new FxConstant(cls, NewClassPointer(cls), ScriptPosition));
|
||||
auto clss = static_cast<PClassType*>(ctx.Class)->Descriptor;
|
||||
ArgList.Push(new FxConstant(clss, NewClassPointer(clss), ScriptPosition));
|
||||
}
|
||||
|
||||
func = new FxNew(ArgList[0]);
|
||||
|
@ -8036,7 +8034,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx)
|
|||
}
|
||||
// No need to create a dedicated node here, all builtins map directly to trivial operations.
|
||||
Self->ValueType = TypeSInt32; // all builtins treat the texture index as integer.
|
||||
FxExpression *x;
|
||||
FxExpression *x = nullptr;
|
||||
switch (MethodName.GetIndex())
|
||||
{
|
||||
case NAME_IsValid:
|
||||
|
@ -8369,8 +8367,8 @@ isresolved:
|
|||
if (!novirtual || !(afd->Variants[0].Flags & VARF_Virtual))
|
||||
{
|
||||
auto clstype = PType::toClass(ctx.Class);
|
||||
auto ccls = PType::toClass(cls);
|
||||
if (clstype == nullptr || ccls == nullptr || !clstype->Descriptor->IsDescendantOf(ccls->Descriptor))
|
||||
auto cclss = PType::toClass(cls);
|
||||
if (clstype == nullptr || cclss == nullptr || !clstype->Descriptor->IsDescendantOf(cclss->Descriptor))
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Cannot call non-static function %s::%s from here", cls->TypeName.GetChars(), MethodName.GetChars());
|
||||
delete this;
|
||||
|
|
|
@ -114,7 +114,7 @@ template<class T, int fill = 1> void ArrayResize(T *self, int amount)
|
|||
{
|
||||
// This must ensure that all new entries get cleared.
|
||||
const int fillCount = int(self->Size() - oldSize);
|
||||
if (fillCount > 0) memset(&(*self)[oldSize], 0, sizeof(*self)[0] * fillCount);
|
||||
if (fillCount > 0) memset((void*)&(*self)[oldSize], 0, sizeof(*self)[0] * fillCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ void VMDumpConstants(FILE *out, const VMScriptFunction *func)
|
|||
|
||||
void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction *func)
|
||||
{
|
||||
VMFunction *callfunc;
|
||||
VMFunction *callfunc = nullptr;
|
||||
const char *name;
|
||||
int col;
|
||||
int mode;
|
||||
|
@ -526,7 +526,7 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction
|
|||
{
|
||||
printf_wrapper(out, ",%d\n", code[++i].i24);
|
||||
}
|
||||
else if (code[i].op == OP_CALL_K)
|
||||
else if (code[i].op == OP_CALL_K && callfunc)
|
||||
{
|
||||
printf_wrapper(out, " [%s]\n", callfunc->PrintableName.GetChars());
|
||||
}
|
||||
|
@ -665,7 +665,6 @@ static int print_reg(FILE *out, int col, int arg, int mode, int immshift, const
|
|||
default:
|
||||
return col+printf_wrapper(out, "$%d", arg);
|
||||
}
|
||||
return col;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -475,7 +475,7 @@ ZCCCompiler::ZCCCompiler(ZCC_AST &ast, DObject *_outer, PSymbolTable &_symbols,
|
|||
if (ast.TopNode != NULL)
|
||||
{
|
||||
ZCC_TreeNode *node = ast.TopNode;
|
||||
PSymbolTreeNode *tnode;
|
||||
PSymbolTreeNode *tnode = nullptr;
|
||||
|
||||
// [pbeta] Anything that must be processed before classes, structs, etc. should go here.
|
||||
do
|
||||
|
@ -606,7 +606,6 @@ PSymbolTreeNode *ZCCCompiler::AddTreeNode(FName name, ZCC_TreeNode *node, PSymbo
|
|||
else
|
||||
{
|
||||
auto sy = Create<PSymbolTreeNode>(name, node);
|
||||
FString name;
|
||||
treenodes->AddSymbol(sy);
|
||||
return sy;
|
||||
}
|
||||
|
@ -1930,19 +1929,19 @@ PType *ZCCCompiler::ResolveArraySize(PType *baseType, ZCC_Expression *arraysize,
|
|||
if (mVersion >= MakeVersion(3, 7, 2))
|
||||
{
|
||||
TArray<ZCC_Expression *> fixedIndices;
|
||||
for (auto node : indices)
|
||||
for (auto index : indices)
|
||||
{
|
||||
fixedIndices.Insert (0, node);
|
||||
fixedIndices.Insert (0, index);
|
||||
}
|
||||
|
||||
indices = std::move(fixedIndices);
|
||||
}
|
||||
|
||||
FCompileContext ctx(OutNamespace, cls, false);
|
||||
for (auto node : indices)
|
||||
for (auto index : indices)
|
||||
{
|
||||
// There is no float->int casting here.
|
||||
FxExpression *ex = ConvertNode(node);
|
||||
FxExpression *ex = ConvertNode(index);
|
||||
ex = ex->Resolve(ctx);
|
||||
|
||||
if (ex == nullptr) return TypeError;
|
||||
|
@ -2425,17 +2424,17 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
|
||||
auto parentfunc = clstype->ParentClass? dyn_cast<PFunction>(clstype->ParentClass->VMType->Symbols.FindSymbol(sym->SymbolName, true)) : nullptr;
|
||||
|
||||
int vindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], parentfunc, exactReturnType);
|
||||
int virtindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], parentfunc, exactReturnType);
|
||||
// specifying 'override' is necessary to prevent one of the biggest problem spots with virtual inheritance: Mismatching argument types.
|
||||
if (varflags & VARF_Override)
|
||||
{
|
||||
if (vindex == -1)
|
||||
if (virtindex == -1)
|
||||
{
|
||||
Error(f, "Attempt to override non-existent virtual function %s", FName(f->Name).GetChars());
|
||||
}
|
||||
else
|
||||
{
|
||||
auto oldfunc = clstype->Virtuals[vindex];
|
||||
auto oldfunc = clstype->Virtuals[virtindex];
|
||||
if (parentfunc && parentfunc->mVersion > mVersion)
|
||||
{
|
||||
Error(f, "Attempt to override function %s which is incompatible with version %d.%d.%d", FName(f->Name).GetChars(), mVersion.major, mVersion.minor, mVersion.revision);
|
||||
|
@ -2467,8 +2466,8 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
if (oldfunc->VarFlags & VARF_Protected)
|
||||
sym->Variants[0].Flags |= VARF_Protected;
|
||||
|
||||
clstype->Virtuals[vindex] = sym->Variants[0].Implementation;
|
||||
sym->Variants[0].Implementation->VirtualIndex = vindex;
|
||||
clstype->Virtuals[virtindex] = sym->Variants[0].Implementation;
|
||||
sym->Variants[0].Implementation->VirtualIndex = virtindex;
|
||||
sym->Variants[0].Implementation->VarFlags = sym->Variants[0].Flags;
|
||||
|
||||
// Defaults must be identical to parent class
|
||||
|
@ -2493,7 +2492,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
}
|
||||
else
|
||||
{
|
||||
if (vindex != -1)
|
||||
if (virtindex != -1)
|
||||
{
|
||||
Error(f, "Function %s attempts to override parent function without 'override' qualifier", FName(f->Name).GetChars());
|
||||
}
|
||||
|
@ -2507,8 +2506,8 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
}
|
||||
else if (forclass)
|
||||
{
|
||||
int vindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], nullptr, exactReturnType);
|
||||
if (vindex != -1)
|
||||
int virtindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], nullptr, exactReturnType);
|
||||
if (virtindex != -1)
|
||||
{
|
||||
Error(f, "Function %s attempts to override parent function without 'override' qualifier", FName(f->Name).GetChars());
|
||||
}
|
||||
|
|
|
@ -831,10 +831,10 @@ public:
|
|||
if (result)
|
||||
{
|
||||
IMAGEHLP_LINE64 line64;
|
||||
DWORD displacement = 0;
|
||||
DWORD displacement1 = 0;
|
||||
memset(&line64, 0, sizeof(IMAGEHLP_LINE64));
|
||||
line64.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
|
||||
result = SymGetLineFromAddr64(GetCurrentProcess(), (DWORD64)frame, &displacement, &line64);
|
||||
result = SymGetLineFromAddr64(GetCurrentProcess(), (DWORD64)frame, &displacement1, &line64);
|
||||
if (result)
|
||||
{
|
||||
s.Format("Called from %s at %s, line %d\n", symbol64->Name, line64.FileName, (int)line64.LineNumber);
|
||||
|
|
|
@ -692,7 +692,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
{
|
||||
VMFunction *call = (VMFunction *)ptr;
|
||||
VMReturn returns[MAX_RETURNS];
|
||||
int numret;
|
||||
int numret1;
|
||||
|
||||
b = B;
|
||||
FillReturns(reg, f, returns, pc+1, C);
|
||||
|
@ -701,7 +701,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
try
|
||||
{
|
||||
VMCycles[0].Unclock();
|
||||
numret = static_cast<VMNativeFunction *>(call)->NativeCall(VM_INVOKE(reg.param + f->NumParam - b, b, returns, C, call->RegTypes));
|
||||
numret1 = static_cast<VMNativeFunction *>(call)->NativeCall(VM_INVOKE(reg.param + f->NumParam - b, b, returns, C, call->RegTypes));
|
||||
VMCycles[0].Clock();
|
||||
}
|
||||
catch (CVMAbortException &err)
|
||||
|
@ -714,10 +714,10 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
}
|
||||
else
|
||||
{
|
||||
auto sfunc = static_cast<VMScriptFunction *>(call);
|
||||
numret = sfunc->ScriptCall(sfunc, reg.param + f->NumParam - b, b, returns, C);
|
||||
auto sfunc1 = static_cast<VMScriptFunction *>(call);
|
||||
numret1 = sfunc1->ScriptCall(sfunc1, reg.param + f->NumParam - b, b, returns, C);
|
||||
}
|
||||
assert(numret == C && "Number of parameters returned differs from what was expected by the caller");
|
||||
assert(numret1 == C && "Number of parameters returned differs from what was expected by the caller");
|
||||
f->NumParam -= B;
|
||||
pc += C; // Skip RESULTs
|
||||
}
|
||||
|
@ -858,31 +858,31 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
// chosen to conserve a few opcodes by condensing all the
|
||||
// string comparisons into a single one.
|
||||
{
|
||||
const FString *b, *c;
|
||||
const FString *b1, *c1;
|
||||
int test, method;
|
||||
bool cmp;
|
||||
|
||||
if (a & CMP_BK)
|
||||
{
|
||||
ASSERTKS(B);
|
||||
b = &konsts[B];
|
||||
b1 = &konsts[B];
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERTS(B);
|
||||
b = ®.s[B];
|
||||
b1 = ®.s[B];
|
||||
}
|
||||
if (a & CMP_CK)
|
||||
{
|
||||
ASSERTKS(C);
|
||||
c = &konsts[C];
|
||||
c1 = &konsts[C];
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERTS(C);
|
||||
c = ®.s[C];
|
||||
c1 = ®.s[C];
|
||||
}
|
||||
test = (a & CMP_APPROX) ? b->CompareNoCase(*c) : b->Compare(*c);
|
||||
test = (a & CMP_APPROX) ? b1->CompareNoCase(*c1) : b1->Compare(*c1);
|
||||
method = a & CMP_METHOD_MASK;
|
||||
if (method == CMP_EQ)
|
||||
{
|
||||
|
@ -1302,12 +1302,10 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
ASSERTF(a); ASSERTF(B); ASSERTKF(C);
|
||||
fb = reg.f[B]; fc = konstf[C];
|
||||
goto Do_MODF;
|
||||
NEXTOP;
|
||||
OP(MODF_KR):
|
||||
ASSERTF(a); ASSERTKF(B); ASSERTF(C);
|
||||
fb = konstf[B]; fc = reg.f[C];
|
||||
goto Do_MODF;
|
||||
NEXTOP;
|
||||
|
||||
OP(POWF_RR):
|
||||
ASSERTF(a); ASSERTF(B); ASSERTF(C);
|
||||
|
@ -1712,7 +1710,6 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
|||
// PrintParameters(reg.param + f->NumParam - B, B);
|
||||
throw;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static double DoFLOP(int flop, double v)
|
||||
|
|
|
@ -694,7 +694,6 @@ void ThrowAbortException(EVMAbortException reason, const char *moreinfo, ...)
|
|||
va_list ap;
|
||||
va_start(ap, moreinfo);
|
||||
throw CVMAbortException(reason, moreinfo, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void ThrowAbortException(VMScriptFunction *sfunc, VMOP *line, EVMAbortException reason, const char *moreinfo, ...)
|
||||
|
@ -706,7 +705,6 @@ void ThrowAbortException(VMScriptFunction *sfunc, VMOP *line, EVMAbortException
|
|||
|
||||
err.stacktrace.AppendFormat("Called from %s at %s, line %d\n", sfunc->PrintableName.GetChars(), sfunc->SourceFileName.GetChars(), sfunc->PCToLine(line));
|
||||
throw err;
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DObject, ThrowAbortException)
|
||||
|
|
|
@ -467,7 +467,7 @@ void DStatusBarCore::DrawGraphic(FGameTexture* tex, double x, double y, int flag
|
|||
double texheight = tex->GetDisplayHeight() * scaleY;
|
||||
double texleftoffs = tex->GetDisplayLeftOffset() * scaleY;
|
||||
double textopoffs = tex->GetDisplayTopOffset() * scaleY;
|
||||
double boxleftoffs, boxtopoffs;
|
||||
double boxleftoffs = 0, boxtopoffs = 0;
|
||||
|
||||
if (boxwidth > 0 || boxheight > 0)
|
||||
{
|
||||
|
@ -618,8 +618,6 @@ void DStatusBarCore::DrawRotated(FGameTexture* tex, double x, double y, int flag
|
|||
{
|
||||
double texwidth = tex->GetDisplayWidth() * scaleX;
|
||||
double texheight = tex->GetDisplayHeight() * scaleY;
|
||||
double texleftoffs = tex->GetDisplayLeftOffset() * scaleY;
|
||||
double textopoffs = tex->GetDisplayTopOffset() * scaleY;
|
||||
|
||||
// resolve auto-alignment before making any adjustments to the position values.
|
||||
if (!(flags & DI_SCREEN_MANUAL_ALIGN))
|
||||
|
@ -754,7 +752,7 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
|
|||
{
|
||||
if (ch == ' ')
|
||||
{
|
||||
x += (monospaced ? spacing : font->GetSpaceWidth() + spacing) * scaleX;
|
||||
x += monospaced ? spacing : font->GetSpaceWidth() + spacing;
|
||||
continue;
|
||||
}
|
||||
else if (ch == TEXTCOLOR_ESCAPE)
|
||||
|
@ -774,7 +772,7 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
|
|||
width += font->GetDefaultKerning();
|
||||
|
||||
if (!monospaced) //If we are monospaced lets use the offset
|
||||
x += c->GetDisplayLeftOffset() * scaleX + 1; //ignore x offsets since we adapt to character size
|
||||
x += (c->GetDisplayLeftOffset() + 1); //ignore x offsets since we adapt to character size
|
||||
|
||||
double rx, ry, rw, rh;
|
||||
rx = x + drawOffset.X;
|
||||
|
@ -825,12 +823,12 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
|
|||
DTA_LegacyRenderStyle, ERenderStyle(style),
|
||||
TAG_DONE);
|
||||
|
||||
// Take text scale into account
|
||||
dx = monospaced
|
||||
? spacing * scaleX
|
||||
: (double(width) + spacing - c->GetDisplayLeftOffset()) * scaleX - 1;
|
||||
? spacing
|
||||
: width + spacing - (c->GetDisplayLeftOffset() + 1);
|
||||
|
||||
x += dx;
|
||||
// Take text scale into account
|
||||
x += dx * scaleX;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,6 @@ void iCopyColors(uint8_t *pout, const uint8_t *pin, int count, int step, FCopyIn
|
|||
int i;
|
||||
int fac;
|
||||
uint8_t r,g,b;
|
||||
int gray;
|
||||
int a;
|
||||
|
||||
switch(inf? inf->blend : BLEND_NONE)
|
||||
|
@ -119,7 +118,7 @@ void iCopyColors(uint8_t *pout, const uint8_t *pin, int count, int step, FCopyIn
|
|||
a = TSrc::A(pin, tr, tg, tb);
|
||||
if (TBlend::ProcessAlpha0() || a)
|
||||
{
|
||||
gray = clamp<int>(TSrc::Gray(pin),0,255);
|
||||
int gray = clamp<int>(TSrc::Gray(pin),0,255);
|
||||
|
||||
PalEntry pe = cm->GrayscaleToColor[gray];
|
||||
TBlend::OpC(pout[TDest::RED], pe.r , a, inf);
|
||||
|
@ -140,7 +139,7 @@ void iCopyColors(uint8_t *pout, const uint8_t *pin, int count, int step, FCopyIn
|
|||
a = TSrc::A(pin, tr, tg, tb);
|
||||
if (TBlend::ProcessAlpha0() || a)
|
||||
{
|
||||
gray = TSrc::Gray(pin);
|
||||
int gray = TSrc::Gray(pin);
|
||||
r = (TSrc::R(pin)*(31-fac) + gray*fac)/31;
|
||||
g = (TSrc::G(pin)*(31-fac) + gray*fac)/31;
|
||||
b = (TSrc::B(pin)*(31-fac) + gray*fac)/31;
|
||||
|
|
|
@ -296,7 +296,7 @@ TArray<uint8_t> FJPEGTexture::CreatePalettedPixels(int conversion)
|
|||
|
||||
while (cinfo.output_scanline < cinfo.output_height)
|
||||
{
|
||||
int num_scanlines = jpeg_read_scanlines(&cinfo, &buff, 1);
|
||||
jpeg_read_scanlines(&cinfo, &buff, 1);
|
||||
uint8_t *in = buff;
|
||||
uint8_t *out = Pixels.Data() + y;
|
||||
switch (cinfo.out_color_space)
|
||||
|
|
|
@ -383,7 +383,7 @@ TArray<uint8_t> FPCXTexture::CreatePalettedPixels(int conversion)
|
|||
else if (bitcount == 8)
|
||||
{
|
||||
lump.Seek(-769, FileReader::SeekEnd);
|
||||
uint8_t c = lump.ReadUInt8();
|
||||
lump.ReadUInt8();
|
||||
//if (c !=0x0c) memcpy(PaletteMap, GrayMap, 256); // Fallback for files without palette
|
||||
//else
|
||||
for(int i=0;i<256;i++)
|
||||
|
|
|
@ -311,7 +311,7 @@ void FGameTexture::SetupSpriteData()
|
|||
|
||||
if (i == 1 && ShouldExpandSprite())
|
||||
{
|
||||
spi.mTrimResult = Base->TrimBorders(spi.trim) && !GetNoTrimming(); // get the trim size before adding the empty frame
|
||||
spi.mTrimResult = Base->TrimBorders(spi.trim); // get the trim size before adding the empty frame
|
||||
spi.spriteWidth += 2;
|
||||
spi.spriteHeight += 2;
|
||||
}
|
||||
|
|
|
@ -137,8 +137,12 @@ public:
|
|||
void SetSpriteRect();
|
||||
|
||||
ETextureType GetUseType() const { return UseType; }
|
||||
void SetUpscaleFlag(int what) { shouldUpscaleFlag = what; }
|
||||
int GetUpscaleFlag() { return shouldUpscaleFlag == 1; }
|
||||
void SetUpscaleFlag(int what, bool manual = false)
|
||||
{
|
||||
if ((shouldUpscaleFlag & 2) && !manual) return; // if set manually this may not be reset.
|
||||
shouldUpscaleFlag = what | (manual? 2 : 0);
|
||||
}
|
||||
int GetUpscaleFlag() { return shouldUpscaleFlag & 1; }
|
||||
|
||||
FTexture* GetTexture() { return Base.get(); }
|
||||
int GetSourceLump() const { return Base->GetSourceLump(); }
|
||||
|
|
|
@ -85,7 +85,6 @@ PalettedPixels FImageSource::GetCachedPalettedPixels(int conversion)
|
|||
FString name;
|
||||
fileSystem.GetFileShortName(name, SourceLump);
|
||||
|
||||
std::pair<int, int> *info = nullptr;
|
||||
auto imageID = ImageID;
|
||||
|
||||
// Do we have this image in the cache?
|
||||
|
@ -201,7 +200,6 @@ FBitmap FImageSource::GetCachedBitmap(const PalEntry *remap, int conversion, int
|
|||
int trans = -1;
|
||||
fileSystem.GetFileShortName(name, SourceLump);
|
||||
|
||||
std::pair<int, int> *info = nullptr;
|
||||
auto imageID = ImageID;
|
||||
|
||||
if (remap != nullptr)
|
||||
|
|
|
@ -90,7 +90,7 @@ FBitmap FImageTexture::GetBgraBitmap(const PalEntry *p, int *trans)
|
|||
|
||||
TArray<uint8_t> FImageTexture::Get8BitPixels(bool alpha)
|
||||
{
|
||||
return mImage->GetPalettedPixels(alpha? alpha : bNoRemap0 ? FImageSource::noremap0 : FImageSource::normal);
|
||||
return mImage->GetPalettedPixels(alpha? FImageSource::luminance : bNoRemap0 ? FImageSource::noremap0 : FImageSource::normal);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
|
@ -296,12 +296,12 @@ void FMultipatchTextureBuilder::AddTexturesLump(const void *lumpdata, int lumpsi
|
|||
// Catalog the patches these textures use so we know which
|
||||
// textures they represent.
|
||||
patchlookup.Resize(numpatches);
|
||||
for (uint32_t i = 0; i < numpatches; ++i)
|
||||
for (uint32_t ii = 0; ii < numpatches; ++ii)
|
||||
{
|
||||
char pname[9];
|
||||
pnames.Read(pname, 8);
|
||||
pname[8] = '\0';
|
||||
patchlookup[i].Name = pname;
|
||||
patchlookup[ii].Name = pname;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -782,12 +782,12 @@ void FMultipatchTextureBuilder::ResolvePatches(BuildInfo &buildinfo)
|
|||
{
|
||||
TArray<FTextureID> list;
|
||||
TexMan.ListTextures(buildinfo.Inits[i].TexName, list, true);
|
||||
for (int i = list.Size() - 1; i >= 0; i--)
|
||||
for (int ii = list.Size() - 1; ii >= 0; ii--)
|
||||
{
|
||||
auto gtex = TexMan.GetGameTexture(list[i]);
|
||||
auto gtex = TexMan.GetGameTexture(list[ii]);
|
||||
if (gtex && gtex != buildinfo.texture && gtex->GetTexture() && gtex->GetTexture()->GetImage() && !dynamic_cast<FMultiPatchTexture*>(gtex->GetTexture()->GetImage()))
|
||||
{
|
||||
texno = list[i];
|
||||
texno = list[ii];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -858,7 +858,6 @@ void FMultipatchTextureBuilder::ResolveAllPatches()
|
|||
ResolvePatches(bi);
|
||||
}
|
||||
// Now try to resolve the images. We only can do this at the end when all multipatch textures are set up.
|
||||
int i = 0;
|
||||
|
||||
// reverse the list so that the Delete operation in the loop below deletes at the end.
|
||||
// For normal sized lists this is of no real concern, but Total Chaos has over 250000 textures where this becomes a performance issue.
|
||||
|
|
|
@ -86,11 +86,11 @@ FTextureManager::~FTextureManager ()
|
|||
|
||||
void FTextureManager::DeleteAll()
|
||||
{
|
||||
FImageSource::ClearImages();
|
||||
for (unsigned int i = 0; i < Textures.Size(); ++i)
|
||||
{
|
||||
delete Textures[i].Texture;
|
||||
}
|
||||
FImageSource::ClearImages();
|
||||
Textures.Clear();
|
||||
Translation.Clear();
|
||||
FirstTextureForFile.Clear();
|
||||
|
@ -717,7 +717,7 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
|
|||
sc.String[8]=0;
|
||||
|
||||
tlist.Clear();
|
||||
int amount = ListTextures(sc.String, tlist);
|
||||
ListTextures(sc.String, tlist);
|
||||
FName texname = sc.String;
|
||||
|
||||
sc.MustGetString();
|
||||
|
@ -935,7 +935,6 @@ void FTextureManager::LoadTextureX(int wadnum, FMultipatchTextureBuilder &build)
|
|||
void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &build)
|
||||
{
|
||||
int firsttexture = Textures.Size();
|
||||
int lumpcount = fileSystem.GetNumEntries();
|
||||
bool iwad = wadnum >= fileSystem.GetIwadNum() && wadnum <= fileSystem.GetMaxIwadNum();
|
||||
|
||||
FirstTextureForFile.Push(firsttexture);
|
||||
|
@ -1206,8 +1205,12 @@ void FTextureManager::Init(void (*progressFunc_)(), void (*checkForHacks)(BuildI
|
|||
AddGameTexture(CreateShaderTexture(true, false));
|
||||
AddGameTexture(CreateShaderTexture(true, true));
|
||||
// Add two animtexture entries so that movie playback can call functions using texture IDs.
|
||||
AddGameTexture(MakeGameTexture(new AnimTexture(), "AnimTextureFrame1", ETextureType::Override));
|
||||
AddGameTexture(MakeGameTexture(new AnimTexture(), "AnimTextureFrame2", ETextureType::Override));
|
||||
auto mt = MakeGameTexture(new AnimTexture(), "AnimTextureFrame1", ETextureType::Override);
|
||||
mt->SetUpscaleFlag(false, true);
|
||||
AddGameTexture(mt);
|
||||
mt = MakeGameTexture(new AnimTexture(), "AnimTextureFrame2", ETextureType::Override);
|
||||
mt->SetUpscaleFlag(false, true);
|
||||
AddGameTexture(mt);
|
||||
|
||||
int wadcnt = fileSystem.GetNumWads();
|
||||
|
||||
|
|
2
src/common/thirdparty/base64.h
vendored
2
src/common/thirdparty/base64.h
vendored
|
@ -6,6 +6,8 @@
|
|||
#ifndef BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A
|
||||
#define BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A
|
||||
|
||||
#include "tarray.h"
|
||||
|
||||
TArray<uint8_t> base64_encode(unsigned char const* bytes_to_encode, size_t in_len);
|
||||
void base64_decode(void* memory, size_t len, const char* encoded_string);
|
||||
|
||||
|
|
56
src/common/thirdparty/gain_analysis.cpp
vendored
56
src/common/thirdparty/gain_analysis.cpp
vendored
|
@ -111,41 +111,41 @@
|
|||
#endif
|
||||
|
||||
static const Float_t ABYule[][2 * YULE_ORDER + 1] = {
|
||||
{(const Float_t) 0.006471345933032, (const Float_t) -7.22103125152679, (const Float_t) -0.02567678242161, (const Float_t) 24.7034187975904, (const Float_t) 0.049805860704367, (const Float_t) -52.6825833623896, (const Float_t) -0.05823001743528, (const Float_t) 77.4825736677539, (const Float_t) 0.040611847441914, (const Float_t) -82.0074753444205, (const Float_t) -0.010912036887501, (const Float_t) 63.1566097101925, (const Float_t) -0.00901635868667, (const Float_t) -34.889569769245, (const Float_t) 0.012448886238123, (const Float_t) 13.2126852760198, (const Float_t) -0.007206683749426, (const Float_t) -3.09445623301669, (const Float_t) 0.002167156433951, (const Float_t) 0.340344741393305, (const Float_t) -0.000261819276949},
|
||||
{(const Float_t) 0.015415414474287, (const Float_t) -7.19001570087017, (const Float_t) -0.07691359399407, (const Float_t) 24.4109412087159, (const Float_t) 0.196677418516518, (const Float_t) -51.6306373580801, (const Float_t) -0.338855114128061, (const Float_t) 75.3978476863163, (const Float_t) 0.430094579594561, (const Float_t) -79.4164552507386, (const Float_t) -0.415015413747894, (const Float_t) 61.0373661948115, (const Float_t) 0.304942508151101, (const Float_t) -33.7446462547014, (const Float_t) -0.166191795926663, (const Float_t) 12.8168791146274, (const Float_t) 0.063198189938739, (const Float_t) -3.01332198541437, (const Float_t) -0.015003978694525, (const Float_t) 0.223619893831468, (const Float_t) 0.001748085184539},
|
||||
{(const Float_t) 0.021776466467053, (const Float_t) -5.74819833657784, (const Float_t) -0.062376961003801, (const Float_t) 16.246507961894, (const Float_t) 0.107731165328514, (const Float_t) -29.9691822642542, (const Float_t) -0.150994515142316, (const Float_t) 40.027597579378, (const Float_t) 0.170334807313632, (const Float_t) -40.3209196052655, (const Float_t) -0.157984942890531, (const Float_t) 30.8542077487718, (const Float_t) 0.121639833268721, (const Float_t) -17.5965138737281, (const Float_t) -0.074094040816409, (const Float_t) 7.10690214103873, (const Float_t) 0.031282852041061, (const Float_t) -1.82175564515191, (const Float_t) -0.00755421235941, (const Float_t) 0.223619893831468, (const Float_t) 0.00117925454213},
|
||||
{(const Float_t) 0.03857599435200, (const Float_t) -3.84664617118067, (const Float_t) -0.02160367184185, (const Float_t) 7.81501653005538, (const Float_t) -0.00123395316851, (const Float_t) -11.34170355132042, (const Float_t) -0.00009291677959, (const Float_t) 13.05504219327545, (const Float_t) -0.01655260341619, (const Float_t) -12.28759895145294, (const Float_t) 0.02161526843274, (const Float_t) 9.48293806319790, (const Float_t) -0.02074045215285, (const Float_t) -5.87257861775999, (const Float_t) 0.00594298065125, (const Float_t) 2.75465861874613, (const Float_t) 0.00306428023191, (const Float_t) -0.86984376593551, (const Float_t) 0.00012025322027, (const Float_t) 0.13919314567432, (const Float_t) 0.00288463683916},
|
||||
{(const Float_t) 0.05418656406430, (const Float_t) -3.47845948550071, (const Float_t) -0.02911007808948, (const Float_t) 6.36317777566148, (const Float_t) -0.00848709379851, (const Float_t) -8.54751527471874, (const Float_t) -0.00851165645469, (const Float_t) 9.47693607801280, (const Float_t) -0.00834990904936, (const Float_t) -8.81498681370155, (const Float_t) 0.02245293253339, (const Float_t) 6.85401540936998, (const Float_t) -0.02596338512915, (const Float_t) -4.39470996079559, (const Float_t) 0.01624864962975, (const Float_t) 2.19611684890774, (const Float_t) -0.00240879051584, (const Float_t) -0.75104302451432, (const Float_t) 0.00674613682247, (const Float_t) 0.13149317958808, (const Float_t) -0.00187763777362},
|
||||
{(const Float_t) 0.15457299681924, (const Float_t) -2.37898834973084, (const Float_t) -0.09331049056315, (const Float_t) 2.84868151156327, (const Float_t) -0.06247880153653, (const Float_t) -2.64577170229825, (const Float_t) 0.02163541888798, (const Float_t) 2.23697657451713, (const Float_t) -0.05588393329856, (const Float_t) -1.67148153367602, (const Float_t) 0.04781476674921, (const Float_t) 1.00595954808547, (const Float_t) 0.00222312597743, (const Float_t) -0.45953458054983, (const Float_t) 0.03174092540049, (const Float_t) 0.16378164858596, (const Float_t) -0.01390589421898, (const Float_t) -0.05032077717131, (const Float_t) 0.00651420667831, (const Float_t) 0.02347897407020, (const Float_t) -0.00881362733839},
|
||||
{(const Float_t) 0.30296907319327, (const Float_t) -1.61273165137247, (const Float_t) -0.22613988682123, (const Float_t) 1.07977492259970, (const Float_t) -0.08587323730772, (const Float_t) -0.25656257754070, (const Float_t) 0.03282930172664, (const Float_t) -0.16276719120440, (const Float_t) -0.00915702933434, (const Float_t) -0.22638893773906, (const Float_t) -0.02364141202522, (const Float_t) 0.39120800788284, (const Float_t) -0.00584456039913, (const Float_t) -0.22138138954925, (const Float_t) 0.06276101321749, (const Float_t) 0.04500235387352, (const Float_t) -0.00000828086748, (const Float_t) 0.02005851806501, (const Float_t) 0.00205861885564, (const Float_t) 0.00302439095741, (const Float_t) -0.02950134983287},
|
||||
{(const Float_t) 0.33642304856132, (const Float_t) -1.49858979367799, (const Float_t) -0.25572241425570, (const Float_t) 0.87350271418188, (const Float_t) -0.11828570177555, (const Float_t) 0.12205022308084, (const Float_t) 0.11921148675203, (const Float_t) -0.80774944671438, (const Float_t) -0.07834489609479, (const Float_t) 0.47854794562326, (const Float_t) -0.00469977914380, (const Float_t) -0.12453458140019, (const Float_t) -0.00589500224440, (const Float_t) -0.04067510197014, (const Float_t) 0.05724228140351, (const Float_t) 0.08333755284107, (const Float_t) 0.00832043980773, (const Float_t) -0.04237348025746, (const Float_t) -0.01635381384540, (const Float_t) 0.02977207319925, (const Float_t) -0.01760176568150},
|
||||
{(const Float_t) 0.44915256608450, (const Float_t) -0.62820619233671, (const Float_t) -0.14351757464547, (const Float_t) 0.29661783706366, (const Float_t) -0.22784394429749, (const Float_t) -0.37256372942400, (const Float_t) -0.01419140100551, (const Float_t) 0.00213767857124, (const Float_t) 0.04078262797139, (const Float_t) -0.42029820170918, (const Float_t) -0.12398163381748, (const Float_t) 0.22199650564824, (const Float_t) 0.04097565135648, (const Float_t) 0.00613424350682, (const Float_t) 0.10478503600251, (const Float_t) 0.06747620744683, (const Float_t) -0.01863887810927, (const Float_t) 0.05784820375801, (const Float_t) -0.03193428438915, (const Float_t) 0.03222754072173, (const Float_t) 0.00541907748707},
|
||||
{(const Float_t) 0.56619470757641, (const Float_t) -1.04800335126349, (const Float_t) -0.75464456939302, (const Float_t) 0.29156311971249, (const Float_t) 0.16242137742230, (const Float_t) -0.26806001042947, (const Float_t) 0.16744243493672, (const Float_t) 0.00819999645858, (const Float_t) -0.18901604199609, (const Float_t) 0.45054734505008, (const Float_t) 0.30931782841830, (const Float_t) -0.33032403314006, (const Float_t) -0.27562961986224, (const Float_t) 0.06739368333110, (const Float_t) 0.00647310677246, (const Float_t) -0.04784254229033, (const Float_t) 0.08647503780351, (const Float_t) 0.01639907836189, (const Float_t) -0.03788984554840, (const Float_t) 0.01807364323573, (const Float_t) -0.00588215443421},
|
||||
{(const Float_t) 0.58100494960553, (const Float_t) -0.51035327095184, (const Float_t) -0.53174909058578, (const Float_t) -0.31863563325245, (const Float_t) -0.14289799034253, (const Float_t) -0.20256413484477, (const Float_t) 0.17520704835522, (const Float_t) 0.14728154134330, (const Float_t) 0.02377945217615, (const Float_t) 0.38952639978999, (const Float_t) 0.15558449135573, (const Float_t) -0.23313271880868, (const Float_t) -0.25344790059353, (const Float_t) -0.05246019024463, (const Float_t) 0.01628462406333, (const Float_t) -0.02505961724053, (const Float_t) 0.06920467763959, (const Float_t) 0.02442357316099, (const Float_t) -0.03721611395801, (const Float_t) 0.01818801111503, (const Float_t) -0.00749618797172},
|
||||
{(const Float_t) 0.53648789255105, (const Float_t) -0.25049871956020, (const Float_t) -0.42163034350696, (const Float_t) -0.43193942311114, (const Float_t) -0.00275953611929, (const Float_t) -0.03424681017675, (const Float_t) 0.04267842219415, (const Float_t) -0.04678328784242, (const Float_t) -0.10214864179676, (const Float_t) 0.26408300200955, (const Float_t) 0.14590772289388, (const Float_t) 0.15113130533216, (const Float_t) -0.02459864859345, (const Float_t) -0.17556493366449, (const Float_t) -0.11202315195388, (const Float_t) -0.18823009262115, (const Float_t) -0.04060034127000, (const Float_t) 0.05477720428674, (const Float_t) 0.04788665548180, (const Float_t) 0.04704409688120, (const Float_t) -0.02217936801134},
|
||||
{(Float_t) 0.006471345933032, (Float_t) -7.22103125152679, (Float_t) -0.02567678242161, (Float_t) 24.7034187975904, (Float_t) 0.049805860704367, (Float_t) -52.6825833623896, (Float_t) -0.05823001743528, (Float_t) 77.4825736677539, (Float_t) 0.040611847441914, (Float_t) -82.0074753444205, (Float_t) -0.010912036887501, (Float_t) 63.1566097101925, (Float_t) -0.00901635868667, (Float_t) -34.889569769245, (Float_t) 0.012448886238123, (Float_t) 13.2126852760198, (Float_t) -0.007206683749426, (Float_t) -3.09445623301669, (Float_t) 0.002167156433951, (Float_t) 0.340344741393305, (Float_t) -0.000261819276949},
|
||||
{(Float_t) 0.015415414474287, (Float_t) -7.19001570087017, (Float_t) -0.07691359399407, (Float_t) 24.4109412087159, (Float_t) 0.196677418516518, (Float_t) -51.6306373580801, (Float_t) -0.338855114128061, (Float_t) 75.3978476863163, (Float_t) 0.430094579594561, (Float_t) -79.4164552507386, (Float_t) -0.415015413747894, (Float_t) 61.0373661948115, (Float_t) 0.304942508151101, (Float_t) -33.7446462547014, (Float_t) -0.166191795926663, (Float_t) 12.8168791146274, (Float_t) 0.063198189938739, (Float_t) -3.01332198541437, (Float_t) -0.015003978694525, (Float_t) 0.223619893831468, (Float_t) 0.001748085184539},
|
||||
{(Float_t) 0.021776466467053, (Float_t) -5.74819833657784, (Float_t) -0.062376961003801, (Float_t) 16.246507961894, (Float_t) 0.107731165328514, (Float_t) -29.9691822642542, (Float_t) -0.150994515142316, (Float_t) 40.027597579378, (Float_t) 0.170334807313632, (Float_t) -40.3209196052655, (Float_t) -0.157984942890531, (Float_t) 30.8542077487718, (Float_t) 0.121639833268721, (Float_t) -17.5965138737281, (Float_t) -0.074094040816409, (Float_t) 7.10690214103873, (Float_t) 0.031282852041061, (Float_t) -1.82175564515191, (Float_t) -0.00755421235941, (Float_t) 0.223619893831468, (Float_t) 0.00117925454213},
|
||||
{(Float_t) 0.03857599435200, (Float_t) -3.84664617118067, (Float_t) -0.02160367184185, (Float_t) 7.81501653005538, (Float_t) -0.00123395316851, (Float_t) -11.34170355132042, (Float_t) -0.00009291677959, (Float_t) 13.05504219327545, (Float_t) -0.01655260341619, (Float_t) -12.28759895145294, (Float_t) 0.02161526843274, (Float_t) 9.48293806319790, (Float_t) -0.02074045215285, (Float_t) -5.87257861775999, (Float_t) 0.00594298065125, (Float_t) 2.75465861874613, (Float_t) 0.00306428023191, (Float_t) -0.86984376593551, (Float_t) 0.00012025322027, (Float_t) 0.13919314567432, (Float_t) 0.00288463683916},
|
||||
{(Float_t) 0.05418656406430, (Float_t) -3.47845948550071, (Float_t) -0.02911007808948, (Float_t) 6.36317777566148, (Float_t) -0.00848709379851, (Float_t) -8.54751527471874, (Float_t) -0.00851165645469, (Float_t) 9.47693607801280, (Float_t) -0.00834990904936, (Float_t) -8.81498681370155, (Float_t) 0.02245293253339, (Float_t) 6.85401540936998, (Float_t) -0.02596338512915, (Float_t) -4.39470996079559, (Float_t) 0.01624864962975, (Float_t) 2.19611684890774, (Float_t) -0.00240879051584, (Float_t) -0.75104302451432, (Float_t) 0.00674613682247, (Float_t) 0.13149317958808, (Float_t) -0.00187763777362},
|
||||
{(Float_t) 0.15457299681924, (Float_t) -2.37898834973084, (Float_t) -0.09331049056315, (Float_t) 2.84868151156327, (Float_t) -0.06247880153653, (Float_t) -2.64577170229825, (Float_t) 0.02163541888798, (Float_t) 2.23697657451713, (Float_t) -0.05588393329856, (Float_t) -1.67148153367602, (Float_t) 0.04781476674921, (Float_t) 1.00595954808547, (Float_t) 0.00222312597743, (Float_t) -0.45953458054983, (Float_t) 0.03174092540049, (Float_t) 0.16378164858596, (Float_t) -0.01390589421898, (Float_t) -0.05032077717131, (Float_t) 0.00651420667831, (Float_t) 0.02347897407020, (Float_t) -0.00881362733839},
|
||||
{(Float_t) 0.30296907319327, (Float_t) -1.61273165137247, (Float_t) -0.22613988682123, (Float_t) 1.07977492259970, (Float_t) -0.08587323730772, (Float_t) -0.25656257754070, (Float_t) 0.03282930172664, (Float_t) -0.16276719120440, (Float_t) -0.00915702933434, (Float_t) -0.22638893773906, (Float_t) -0.02364141202522, (Float_t) 0.39120800788284, (Float_t) -0.00584456039913, (Float_t) -0.22138138954925, (Float_t) 0.06276101321749, (Float_t) 0.04500235387352, (Float_t) -0.00000828086748, (Float_t) 0.02005851806501, (Float_t) 0.00205861885564, (Float_t) 0.00302439095741, (Float_t) -0.02950134983287},
|
||||
{(Float_t) 0.33642304856132, (Float_t) -1.49858979367799, (Float_t) -0.25572241425570, (Float_t) 0.87350271418188, (Float_t) -0.11828570177555, (Float_t) 0.12205022308084, (Float_t) 0.11921148675203, (Float_t) -0.80774944671438, (Float_t) -0.07834489609479, (Float_t) 0.47854794562326, (Float_t) -0.00469977914380, (Float_t) -0.12453458140019, (Float_t) -0.00589500224440, (Float_t) -0.04067510197014, (Float_t) 0.05724228140351, (Float_t) 0.08333755284107, (Float_t) 0.00832043980773, (Float_t) -0.04237348025746, (Float_t) -0.01635381384540, (Float_t) 0.02977207319925, (Float_t) -0.01760176568150},
|
||||
{(Float_t) 0.44915256608450, (Float_t) -0.62820619233671, (Float_t) -0.14351757464547, (Float_t) 0.29661783706366, (Float_t) -0.22784394429749, (Float_t) -0.37256372942400, (Float_t) -0.01419140100551, (Float_t) 0.00213767857124, (Float_t) 0.04078262797139, (Float_t) -0.42029820170918, (Float_t) -0.12398163381748, (Float_t) 0.22199650564824, (Float_t) 0.04097565135648, (Float_t) 0.00613424350682, (Float_t) 0.10478503600251, (Float_t) 0.06747620744683, (Float_t) -0.01863887810927, (Float_t) 0.05784820375801, (Float_t) -0.03193428438915, (Float_t) 0.03222754072173, (Float_t) 0.00541907748707},
|
||||
{(Float_t) 0.56619470757641, (Float_t) -1.04800335126349, (Float_t) -0.75464456939302, (Float_t) 0.29156311971249, (Float_t) 0.16242137742230, (Float_t) -0.26806001042947, (Float_t) 0.16744243493672, (Float_t) 0.00819999645858, (Float_t) -0.18901604199609, (Float_t) 0.45054734505008, (Float_t) 0.30931782841830, (Float_t) -0.33032403314006, (Float_t) -0.27562961986224, (Float_t) 0.06739368333110, (Float_t) 0.00647310677246, (Float_t) -0.04784254229033, (Float_t) 0.08647503780351, (Float_t) 0.01639907836189, (Float_t) -0.03788984554840, (Float_t) 0.01807364323573, (Float_t) -0.00588215443421},
|
||||
{(Float_t) 0.58100494960553, (Float_t) -0.51035327095184, (Float_t) -0.53174909058578, (Float_t) -0.31863563325245, (Float_t) -0.14289799034253, (Float_t) -0.20256413484477, (Float_t) 0.17520704835522, (Float_t) 0.14728154134330, (Float_t) 0.02377945217615, (Float_t) 0.38952639978999, (Float_t) 0.15558449135573, (Float_t) -0.23313271880868, (Float_t) -0.25344790059353, (Float_t) -0.05246019024463, (Float_t) 0.01628462406333, (Float_t) -0.02505961724053, (Float_t) 0.06920467763959, (Float_t) 0.02442357316099, (Float_t) -0.03721611395801, (Float_t) 0.01818801111503, (Float_t) -0.00749618797172},
|
||||
{(Float_t) 0.53648789255105, (Float_t) -0.25049871956020, (Float_t) -0.42163034350696, (Float_t) -0.43193942311114, (Float_t) -0.00275953611929, (Float_t) -0.03424681017675, (Float_t) 0.04267842219415, (Float_t) -0.04678328784242, (Float_t) -0.10214864179676, (Float_t) 0.26408300200955, (Float_t) 0.14590772289388, (Float_t) 0.15113130533216, (Float_t) -0.02459864859345, (Float_t) -0.17556493366449, (Float_t) -0.11202315195388, (Float_t) -0.18823009262115, (Float_t) -0.04060034127000, (Float_t) 0.05477720428674, (Float_t) 0.04788665548180, (Float_t) 0.04704409688120, (Float_t) -0.02217936801134},
|
||||
|
||||
{(const Float_t) 0.38524531015142, (const Float_t) -1.29708918404534, (const Float_t) -0.27682212062067, (const Float_t) 0.90399339674203, (const Float_t)-0.09980181488805, (const Float_t) -0.29613799017877, (const Float_t) 0.09951486755646, (const Float_t)-0.42326645916207, (const Float_t) -0.08934020156622, (const Float_t) 0.37934887402200, (const Float_t) -0.00322369330199, (const Float_t) -0.37919795944938, (const Float_t) -0.00110329090689, (const Float_t) 0.23410283284785, (const Float_t) 0.03784509844682, (const Float_t) -0.03892971758879, (const Float_t) 0.01683906213303, (const Float_t) 0.00403009552351, (const Float_t) -0.01147039862572, (const Float_t) 0.03640166626278, (const Float_t) -0.01941767987192 },
|
||||
{(const Float_t)0.08717879977844, (const Float_t)-2.62816311472146, (const Float_t)-0.01000374016172, (const Float_t)3.53734535817992, (const Float_t)-0.06265852122368, (const Float_t)-3.81003448678921, (const Float_t)-0.01119328800950, (const Float_t)3.91291636730132, (const Float_t)-0.00114279372960, (const Float_t)-3.53518605896288, (const Float_t)0.02081333954769, (const Float_t)2.71356866157873, (const Float_t)-0.01603261863207, (const Float_t)-1.86723311846592, (const Float_t)0.01936763028546, (const Float_t)1.12075382367659, (const Float_t)0.00760044736442, (const Float_t)-0.48574086886890, (const Float_t)-0.00303979112271, (const Float_t)0.11330544663849, (const Float_t)-0.00075088605788 },
|
||||
{(Float_t) 0.38524531015142, (Float_t) -1.29708918404534, (Float_t) -0.27682212062067, (Float_t) 0.90399339674203, (Float_t)-0.09980181488805, (Float_t) -0.29613799017877, (Float_t) 0.09951486755646, (Float_t)-0.42326645916207, (Float_t) -0.08934020156622, (Float_t) 0.37934887402200, (Float_t) -0.00322369330199, (Float_t) -0.37919795944938, (Float_t) -0.00110329090689, (Float_t) 0.23410283284785, (Float_t) 0.03784509844682, (Float_t) -0.03892971758879, (Float_t) 0.01683906213303, (Float_t) 0.00403009552351, (Float_t) -0.01147039862572, (Float_t) 0.03640166626278, (Float_t) -0.01941767987192 },
|
||||
{(Float_t)0.08717879977844, (Float_t)-2.62816311472146, (Float_t)-0.01000374016172, (Float_t)3.53734535817992, (Float_t)-0.06265852122368, (Float_t)-3.81003448678921, (Float_t)-0.01119328800950, (Float_t)3.91291636730132, (Float_t)-0.00114279372960, (Float_t)-3.53518605896288, (Float_t)0.02081333954769, (Float_t)2.71356866157873, (Float_t)-0.01603261863207, (Float_t)-1.86723311846592, (Float_t)0.01936763028546, (Float_t)1.12075382367659, (Float_t)0.00760044736442, (Float_t)-0.48574086886890, (Float_t)-0.00303979112271, (Float_t)0.11330544663849, (Float_t)-0.00075088605788 },
|
||||
|
||||
};
|
||||
|
||||
|
||||
static const Float_t ABButter[][2 * BUTTER_ORDER + 1] = {
|
||||
{(const Float_t) 0.99308203517541, (const Float_t) -1.98611621154089, (const Float_t) -1.98616407035082, (const Float_t) 0.986211929160751, (const Float_t) 0.99308203517541},
|
||||
{(const Float_t) 0.992472550461293, (const Float_t) -1.98488843762334, (const Float_t) -1.98494510092258, (const Float_t) 0.979389350028798, (const Float_t) 0.992472550461293},
|
||||
{(const Float_t) 0.989641019334721, (const Float_t) -1.97917472731008, (const Float_t) -1.97928203866944, (const Float_t) 0.979389350028798, (const Float_t) 0.989641019334721},
|
||||
{(const Float_t) 0.98621192462708, (const Float_t) -1.97223372919527, (const Float_t) -1.97242384925416, (const Float_t) 0.97261396931306, (const Float_t) 0.98621192462708},
|
||||
{(const Float_t) 0.98500175787242, (const Float_t) -1.96977855582618, (const Float_t) -1.97000351574484, (const Float_t) 0.97022847566350, (const Float_t) 0.98500175787242},
|
||||
{(const Float_t) 0.97938932735214, (const Float_t) -1.95835380975398, (const Float_t) -1.95877865470428, (const Float_t) 0.95920349965459, (const Float_t) 0.97938932735214},
|
||||
{(const Float_t) 0.97531843204928, (const Float_t) -1.95002759149878, (const Float_t) -1.95063686409857, (const Float_t) 0.95124613669835, (const Float_t) 0.97531843204928},
|
||||
{(const Float_t) 0.97316523498161, (const Float_t) -1.94561023566527, (const Float_t) -1.94633046996323, (const Float_t) 0.94705070426118, (const Float_t) 0.97316523498161},
|
||||
{(const Float_t) 0.96454515552826, (const Float_t) -1.92783286977036, (const Float_t) -1.92909031105652, (const Float_t) 0.93034775234268, (const Float_t) 0.96454515552826},
|
||||
{(const Float_t) 0.96009142950541, (const Float_t) -1.91858953033784, (const Float_t) -1.92018285901082, (const Float_t) 0.92177618768381, (const Float_t) 0.96009142950541},
|
||||
{(const Float_t) 0.95856916599601, (const Float_t) -1.91542108074780, (const Float_t) -1.91713833199203, (const Float_t) 0.91885558323625, (const Float_t) 0.95856916599601},
|
||||
{(const Float_t) 0.94597685600279, (const Float_t) -1.88903307939452, (const Float_t) -1.89195371200558, (const Float_t) 0.89487434461664, (const Float_t) 0.94597685600279},
|
||||
{(Float_t) 0.99308203517541, (Float_t) -1.98611621154089, (Float_t) -1.98616407035082, (Float_t) 0.986211929160751, (Float_t) 0.99308203517541},
|
||||
{(Float_t) 0.992472550461293, (Float_t) -1.98488843762334, (Float_t) -1.98494510092258, (Float_t) 0.979389350028798, (Float_t) 0.992472550461293},
|
||||
{(Float_t) 0.989641019334721, (Float_t) -1.97917472731008, (Float_t) -1.97928203866944, (Float_t) 0.979389350028798, (Float_t) 0.989641019334721},
|
||||
{(Float_t) 0.98621192462708, (Float_t) -1.97223372919527, (Float_t) -1.97242384925416, (Float_t) 0.97261396931306, (Float_t) 0.98621192462708},
|
||||
{(Float_t) 0.98500175787242, (Float_t) -1.96977855582618, (Float_t) -1.97000351574484, (Float_t) 0.97022847566350, (Float_t) 0.98500175787242},
|
||||
{(Float_t) 0.97938932735214, (Float_t) -1.95835380975398, (Float_t) -1.95877865470428, (Float_t) 0.95920349965459, (Float_t) 0.97938932735214},
|
||||
{(Float_t) 0.97531843204928, (Float_t) -1.95002759149878, (Float_t) -1.95063686409857, (Float_t) 0.95124613669835, (Float_t) 0.97531843204928},
|
||||
{(Float_t) 0.97316523498161, (Float_t) -1.94561023566527, (Float_t) -1.94633046996323, (Float_t) 0.94705070426118, (Float_t) 0.97316523498161},
|
||||
{(Float_t) 0.96454515552826, (Float_t) -1.92783286977036, (Float_t) -1.92909031105652, (Float_t) 0.93034775234268, (Float_t) 0.96454515552826},
|
||||
{(Float_t) 0.96009142950541, (Float_t) -1.91858953033784, (Float_t) -1.92018285901082, (Float_t) 0.92177618768381, (Float_t) 0.96009142950541},
|
||||
{(Float_t) 0.95856916599601, (Float_t) -1.91542108074780, (Float_t) -1.91713833199203, (Float_t) 0.91885558323625, (Float_t) 0.95856916599601},
|
||||
{(Float_t) 0.94597685600279, (Float_t) -1.88903307939452, (Float_t) -1.89195371200558, (Float_t) 0.89487434461664, (Float_t) 0.94597685600279},
|
||||
|
||||
{(const Float_t)0.96535326815829, (const Float_t)-1.92950577983524, (const Float_t)-1.93070653631658, (const Float_t)0.93190729279793, (const Float_t)0.96535326815829 },
|
||||
{(const Float_t)0.98252400815195, (const Float_t)-1.96474258269041, (const Float_t)-1.96504801630391, (const Float_t)0.96535344991740, (const Float_t)0.98252400815195 },
|
||||
{(Float_t)0.96535326815829, (Float_t)-1.92950577983524, (Float_t)-1.93070653631658, (Float_t)0.93190729279793, (Float_t)0.96535326815829 },
|
||||
{(Float_t)0.98252400815195, (Float_t)-1.96474258269041, (Float_t)-1.96504801630391, (Float_t)0.96535344991740, (Float_t)0.98252400815195 },
|
||||
|
||||
};
|
||||
|
||||
|
|
5
src/common/thirdparty/m_crc32.h
vendored
5
src/common/thirdparty/m_crc32.h
vendored
|
@ -50,8 +50,3 @@ inline uint32_t CRC1 (uint32_t crc, const uint8_t c, const uint32_t *crcTable)
|
|||
{
|
||||
return crcTable[(crc & 0xff) ^ c] ^ (crc >> 8);
|
||||
}
|
||||
|
||||
inline uint32_t Bcrc32(const void* data, int length, uint32_t crc)
|
||||
{
|
||||
return crc32(crc, (const Bytef*)data, length);
|
||||
}
|
||||
|
|
4
src/common/thirdparty/rapidjson/document.h
vendored
4
src/common/thirdparty/rapidjson/document.h
vendored
|
@ -1937,7 +1937,7 @@ private:
|
|||
if (count) {
|
||||
GenericValue* e = static_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
|
||||
SetElementsPointer(e);
|
||||
std::memcpy(e, values, count * sizeof(GenericValue));
|
||||
std::memcpy((void*)e, (void*)values, count * sizeof(GenericValue));
|
||||
}
|
||||
else
|
||||
SetElementsPointer(0);
|
||||
|
@ -1950,7 +1950,7 @@ private:
|
|||
if (count) {
|
||||
Member* m = static_cast<Member*>(allocator.Malloc(count * sizeof(Member)));
|
||||
SetMembersPointer(m);
|
||||
std::memcpy(m, members, count * sizeof(Member));
|
||||
std::memcpy((void*)m, (void*)members, count * sizeof(Member));
|
||||
}
|
||||
else
|
||||
SetMembersPointer(0);
|
||||
|
|
4
src/common/thirdparty/strnatcmp.c
vendored
4
src/common/thirdparty/strnatcmp.c
vendored
|
@ -85,8 +85,6 @@ compare_right(nat_char const *a, nat_char const *b)
|
|||
} else if (!*a && !*b)
|
||||
return bias;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -107,8 +105,6 @@ compare_left(nat_char const *a, nat_char const *b)
|
|||
else if (*a > *b)
|
||||
return +1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,6 +38,13 @@ typedef uint32_t angle_t;
|
|||
#define FORCE_PACKED
|
||||
#endif
|
||||
|
||||
// Todo: get rid of this. Static file name buffers suck.
|
||||
#ifndef PATH_MAX
|
||||
#define BMAX_PATH 256
|
||||
#else
|
||||
#define BMAX_PATH PATH_MAX
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define GCCPRINTF(stri,firstargi) __attribute__((format(printf,stri,firstargi)))
|
||||
|
|
|
@ -248,7 +248,7 @@ bool GetFileInfo(const char* pathname, size_t *size, time_t *time)
|
|||
bool res = _wstat64(wstr.c_str(), &info) == 0;
|
||||
#endif
|
||||
if (!res || (info.st_mode & S_IFDIR)) return false;
|
||||
if (size) *size = info.st_size;
|
||||
if (size) *size = (size_t)info.st_size;
|
||||
if (time) *time = info.st_mtime;
|
||||
return res;
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ FString StripExtension(const char* path)
|
|||
src = path + strlen(path) - 1;
|
||||
|
||||
//
|
||||
// back up until a . and abort on a \
|
||||
// back up until a . and abort on a '/'
|
||||
//
|
||||
while (src != path && !IsSeperator(*(src - 1)))
|
||||
{
|
||||
|
|
|
@ -19,4 +19,5 @@ inline ZMusicCustomReader *GetMusicReader(FileReader& fr)
|
|||
delete zr;
|
||||
};
|
||||
return zcr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <assert.h>
|
||||
#include "i_time.h"
|
||||
|
||||
//==========================================================================
|
||||
|
@ -46,6 +47,7 @@
|
|||
static uint64_t FirstFrameStartTime;
|
||||
static uint64_t CurrentFrameStartTime;
|
||||
static uint64_t FreezeTime;
|
||||
static double lastinputtime;
|
||||
int GameTicRate = 35; // make sure it is not 0, even if the client doesn't set it.
|
||||
|
||||
double TimeScale = 1.0;
|
||||
|
@ -195,3 +197,39 @@ void I_ResetFrameTime()
|
|||
I_SetFrameTime();
|
||||
FirstFrameStartTime += (CurrentFrameStartTime - ft);
|
||||
}
|
||||
|
||||
double I_GetInputFrac(bool const synchronised, double const ticrate)
|
||||
{
|
||||
if (!synchronised)
|
||||
{
|
||||
const double max = 1000. / ticrate;
|
||||
const double now = I_msTimeF();
|
||||
const double elapsedInputTicks = std::min(now - lastinputtime, max);
|
||||
lastinputtime = now;
|
||||
|
||||
if (elapsedInputTicks < max)
|
||||
{
|
||||
// Calculate an amplification to apply to the result before returning,
|
||||
// factoring in the game's ticrate and the value of the result.
|
||||
// This rectifies a deviation of 100+ ms or more depending on the length
|
||||
// of the operation to be within 1-2 ms of synchronised input
|
||||
// from 60 fps to at least 1000 fps at ticrates of 30 and 40 Hz.
|
||||
const double result = elapsedInputTicks * ticrate * (1. / 1000.);
|
||||
return result * (1. + 0.35 * (1. - ticrate * (1. / 50.)) * (1. - result));
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void I_ResetInputTime()
|
||||
{
|
||||
// Reset lastinputtime to current time.
|
||||
lastinputtime = I_msTimeF();
|
||||
}
|
||||
|
|
|
@ -38,3 +38,9 @@ uint64_t I_nsTime();
|
|||
|
||||
// Reset the timer after a lengthy operation
|
||||
void I_ResetFrameTime();
|
||||
|
||||
// Return a decimal fraction to scale input operations at framerate
|
||||
double I_GetInputFrac(bool const synchronised, double const ticrate = GameTicRate);
|
||||
|
||||
// Reset the last input check to after a lengthy operation
|
||||
void I_ResetInputTime();
|
||||
|
|
|
@ -117,6 +117,14 @@ void *FMemArena::Alloc(size_t size)
|
|||
return iAlloc((size + 15) & ~15);
|
||||
}
|
||||
|
||||
void* FMemArena::Calloc(size_t size)
|
||||
{
|
||||
size = (size + 15) & ~15;
|
||||
auto mem = iAlloc(size);
|
||||
memset(mem, 0, size);
|
||||
return mem;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMemArena :: FreeAll
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
~FMemArena();
|
||||
|
||||
void *Alloc(size_t size);
|
||||
void* Calloc(size_t size);
|
||||
void FreeAll();
|
||||
void FreeAllBlocks();
|
||||
FString DumpInfo();
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
struct PalEntry
|
||||
{
|
||||
PalEntry() = default;
|
||||
PalEntry(const PalEntry&) = default;
|
||||
constexpr PalEntry (uint32_t argb) : d(argb) { }
|
||||
operator uint32_t () const { return d; }
|
||||
void SetRGB(PalEntry other)
|
||||
|
|
|
@ -565,9 +565,9 @@ int V_GetColorFromString(const char* cstr, FScriptPosition* sc)
|
|||
{
|
||||
if (strlen(cstr) == 6)
|
||||
{
|
||||
char* p;
|
||||
int color = strtol(cstr, &p, 16);
|
||||
if (*p == 0)
|
||||
char* endp;
|
||||
int color = strtol(cstr, &endp, 16);
|
||||
if (*endp == 0)
|
||||
{
|
||||
// RRGGBB string
|
||||
c[0] = (color & 0xff0000) >> 16;
|
||||
|
@ -903,7 +903,6 @@ int ReadPalette(int lumpnum, uint8_t* buffer)
|
|||
fr.Seek(33, FileReader::SeekSet);
|
||||
fr.Read(&len, 4);
|
||||
fr.Read(&id, 4);
|
||||
bool succeeded = false;
|
||||
while (id != MAKE_ID('I', 'D', 'A', 'T') && id != MAKE_ID('I', 'E', 'N', 'D'))
|
||||
{
|
||||
len = BigLong((unsigned int)len);
|
||||
|
|
|
@ -105,6 +105,17 @@ protected:
|
|||
T* m_ptr;
|
||||
};
|
||||
|
||||
// magic little helper. :)
|
||||
template <class T>
|
||||
class backwards
|
||||
{
|
||||
T& _obj;
|
||||
public:
|
||||
backwards(T &obj) : _obj(obj) {}
|
||||
auto begin() {return _obj.rbegin();}
|
||||
auto end() {return _obj.rend();}
|
||||
};
|
||||
|
||||
|
||||
// TArray -------------------------------------------------------------------
|
||||
|
||||
|
@ -308,6 +319,16 @@ public:
|
|||
return &Array[0];
|
||||
}
|
||||
|
||||
unsigned IndexOf(const T& elem) const
|
||||
{
|
||||
return &elem - Array;
|
||||
}
|
||||
|
||||
unsigned IndexOf(const T* elem) const
|
||||
{
|
||||
return elem - Array;
|
||||
}
|
||||
|
||||
unsigned int Find(const T& item) const
|
||||
{
|
||||
unsigned int i;
|
||||
|
@ -1672,6 +1693,12 @@ public:
|
|||
return !!(bytes[index >> 3] & (1 << (index & 7)));
|
||||
}
|
||||
|
||||
// for when array syntax cannot be used.
|
||||
bool Check(size_t index) const
|
||||
{
|
||||
return !!(bytes[index >> 3] & (1 << (index & 7)));
|
||||
}
|
||||
|
||||
void Set(size_t index, bool set = true)
|
||||
{
|
||||
if (!set) Clear(index);
|
||||
|
@ -1850,18 +1877,20 @@ public:
|
|||
// Return a reference to an element
|
||||
T &operator[] (size_t index) const
|
||||
{
|
||||
assert(index < Count);
|
||||
return Array[index];
|
||||
}
|
||||
// Returns a reference to the last element
|
||||
T &Last() const
|
||||
{
|
||||
assert(Count > 0);
|
||||
return Array[Count - 1];
|
||||
}
|
||||
|
||||
// returns address of first element
|
||||
T *Data() const
|
||||
{
|
||||
return &Array[0];
|
||||
return Array;
|
||||
}
|
||||
|
||||
unsigned Size() const
|
||||
|
@ -1896,202 +1925,3 @@ private:
|
|||
unsigned int Count;
|
||||
};
|
||||
|
||||
|
||||
template<typename T> class TSparseIterator
|
||||
{
|
||||
public:
|
||||
using iterator_category = std::random_access_iterator_tag;
|
||||
using value_type = T;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = value_type*;
|
||||
using reference = value_type&;
|
||||
|
||||
TSparseIterator(unsigned char* ptr = nullptr, unsigned stride = 0) { m_Ptr = ptr; Stride = stride; }
|
||||
|
||||
// Comparison operators
|
||||
bool operator==(const TSparseIterator &other) const { return m_Ptr == other.m_Ptr; }
|
||||
bool operator!=(const TSparseIterator &other) const { return m_Ptr != other.m_Ptr; }
|
||||
bool operator< (const TSparseIterator &other) const { return m_Ptr < other.m_Ptr; }
|
||||
bool operator<=(const TSparseIterator &other) const { return m_Ptr <= other.m_Ptr; }
|
||||
bool operator> (const TSparseIterator &other) const { return m_Ptr > other.m_Ptr; }
|
||||
bool operator>=(const TSparseIterator &other) const { return m_Ptr >= other.m_Ptr; }
|
||||
|
||||
// Arithmetic operators
|
||||
TSparseIterator &operator++() { m_Ptr += Stride; return *this; }
|
||||
TSparseIterator operator++(int) { auto tmp = *this; ++*this; return tmp; }
|
||||
TSparseIterator &operator--() { m_Ptr -= Stride; return *this; }
|
||||
TSparseIterator operator--(int) { auto tmp = *this; --*this; return tmp; }
|
||||
TSparseIterator &operator+=(difference_type offset) { m_Ptr += offset * Stride; return *this; }
|
||||
TSparseIterator operator+(difference_type offset) const { return TSparseIterator(m_Ptr + offset * Stride, Stride); }
|
||||
friend TSparseIterator operator+(difference_type offset, const TSparseIterator &other) { return TSparseIterator(offset*other.Stride + other.m_Ptr, other.Stride); }
|
||||
TSparseIterator &operator-=(difference_type offset) { m_Ptr -= offset * Stride; return *this; }
|
||||
TSparseIterator operator-(difference_type offset) const { return TSparseIterator(m_Ptr - offset * Stride, Stride); }
|
||||
difference_type operator-(const TSparseIterator &other) const { return (m_Ptr - other.m_Ptr) / Stride; }
|
||||
|
||||
// Random access operators
|
||||
T& operator[](difference_type i) { return *(T*)(m_Ptr + i * Stride); }
|
||||
const T& operator[](difference_type i) const { return *(T*)(m_Ptr + i * Stride); }
|
||||
|
||||
T &operator*() const { return (T*)m_Ptr; }
|
||||
T* operator->() { return (T*)m_Ptr; }
|
||||
|
||||
protected:
|
||||
unsigned char* m_Ptr;
|
||||
unsigned Stride;
|
||||
};
|
||||
|
||||
// A wrapper to externally stored data.
|
||||
// Like the above but with a customizable stride
|
||||
template <class T>
|
||||
class TSparseArrayView
|
||||
{
|
||||
public:
|
||||
|
||||
typedef TSparseIterator<T> iterator;
|
||||
typedef TSparseIterator<const T> const_iterator;
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
typedef T value_type;
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return iterator(Array, Stride);
|
||||
}
|
||||
const_iterator begin() const
|
||||
{
|
||||
return const_iterator(Array, Stride);
|
||||
}
|
||||
const_iterator cbegin() const
|
||||
{
|
||||
return const_iterator(Array, Stride);
|
||||
}
|
||||
|
||||
iterator end()
|
||||
{
|
||||
return iterator(Array + Count * Stride, Stride);
|
||||
}
|
||||
const_iterator end() const
|
||||
{
|
||||
return const_iterator(Array + Count * Stride, Stride);
|
||||
}
|
||||
const_iterator cend() const
|
||||
{
|
||||
return const_iterator(Array + Count * Stride, Stride);
|
||||
}
|
||||
|
||||
reverse_iterator rbegin()
|
||||
{
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
const_reverse_iterator rbegin() const
|
||||
{
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
const_reverse_iterator crbegin() const
|
||||
{
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
reverse_iterator rend()
|
||||
{
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
const_reverse_iterator rend() const
|
||||
{
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
const_reverse_iterator crend() const
|
||||
{
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
|
||||
////////
|
||||
TSparseArrayView() = default; // intended to keep this type trivial.
|
||||
TSparseArrayView(T *data, unsigned stride, unsigned count = 0)
|
||||
{
|
||||
Count = count;
|
||||
Array = data;
|
||||
Stride = stride;
|
||||
}
|
||||
TSparseArrayView(const TSparseArrayView<T> &other) = default;
|
||||
TSparseArrayView<T> &operator= (const TSparseArrayView<T> &other) = default;
|
||||
|
||||
// Check equality of two arrays
|
||||
bool operator==(const TArrayView<T> &other) const
|
||||
{
|
||||
if (Count != other.Count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (unsigned int i = 0; i < Count; ++i)
|
||||
{
|
||||
if (Element(i) != other.Element(i))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
T &Element(size_t index)
|
||||
{
|
||||
return (T*)Array[index*Stride];
|
||||
}
|
||||
// Return a reference to an element
|
||||
T &operator[] (size_t index) const
|
||||
{
|
||||
return Element(index);
|
||||
}
|
||||
// Returns a reference to the last element
|
||||
T &Last() const
|
||||
{
|
||||
return Element(Count - 1);
|
||||
}
|
||||
|
||||
// returns address of first element
|
||||
T *Data() const
|
||||
{
|
||||
return &Element(0);
|
||||
}
|
||||
|
||||
unsigned Size() const
|
||||
{
|
||||
return Count;
|
||||
}
|
||||
|
||||
unsigned int Find(const T& item) const
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < Count; ++i)
|
||||
{
|
||||
if (Element(i) == item)
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void Set(T *data, unsigned stride, unsigned count)
|
||||
{
|
||||
Array = reinterpret_cast<unsigned char*>(data);
|
||||
Count = count;
|
||||
Stride = stride;
|
||||
}
|
||||
|
||||
void Set(void *data, unsigned stride, unsigned count)
|
||||
{
|
||||
Array = reinterpret_cast<unsigned char*>(data);
|
||||
Count = count;
|
||||
Stride = stride;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
Count = 0;
|
||||
Stride = 0;
|
||||
Array = nullptr;
|
||||
}
|
||||
private:
|
||||
unsigned char* Array;
|
||||
unsigned int Count;
|
||||
unsigned int Stride;
|
||||
};
|
||||
|
|
|
@ -53,42 +53,42 @@ public:
|
|||
|
||||
TFlags() = default;
|
||||
TFlags(const Self& other) = default;
|
||||
TFlags (T value) : Value (static_cast<TT> (value)) {}
|
||||
constexpr TFlags (T value) : Value (static_cast<TT> (value)) {}
|
||||
|
||||
// This allows initializing the flagset with 0, as 0 implicitly converts into a null pointer.
|
||||
TFlags (ZeroDummy*) : Value (0) {}
|
||||
constexpr TFlags (ZeroDummy*) : Value (0) {}
|
||||
|
||||
// Relation operators
|
||||
Self operator| (Self other) const { return Self::FromInt (Value | other.GetValue()); }
|
||||
Self operator& (Self other) const { return Self::FromInt (Value & other.GetValue()); }
|
||||
Self operator^ (Self other) const { return Self::FromInt (Value ^ other.GetValue()); }
|
||||
Self operator| (T value) const { return Self::FromInt (Value | value); }
|
||||
Self operator& (T value) const { return Self::FromInt (Value & value); }
|
||||
Self operator^ (T value) const { return Self::FromInt (Value ^ value); }
|
||||
Self operator~() const { return Self::FromInt (~Value); }
|
||||
constexpr Self operator| (const Self& other) const { return Self::FromInt (Value | other.GetValue()); }
|
||||
constexpr Self operator& (const Self& other) const { return Self::FromInt (Value & other.GetValue()); }
|
||||
constexpr Self operator^ (const Self& other) const { return Self::FromInt (Value ^ other.GetValue()); }
|
||||
constexpr Self operator| (T value) const { return Self::FromInt (Value | value); }
|
||||
constexpr Self operator& (T value) const { return Self::FromInt (Value & value); }
|
||||
constexpr Self operator^ (T value) const { return Self::FromInt (Value ^ value); }
|
||||
constexpr Self operator~() const { return Self::FromInt (~Value); }
|
||||
|
||||
// Assignment operators
|
||||
Self& operator= (Self other) { Value = other.GetValue(); return *this; }
|
||||
Self& operator|= (Self other) { Value |= other.GetValue(); return *this; }
|
||||
Self& operator&= (Self other) { Value &= other.GetValue(); return *this; }
|
||||
Self& operator^= (Self other) { Value ^= other.GetValue(); return *this; }
|
||||
Self& operator= (T value) { Value = value; return *this; }
|
||||
Self& operator|= (T value) { Value |= value; return *this; }
|
||||
Self& operator&= (T value) { Value &= value; return *this; }
|
||||
Self& operator^= (T value) { Value ^= value; return *this; }
|
||||
constexpr Self& operator= (const Self& other) = default;
|
||||
constexpr Self& operator|= (const Self& other) { Value |= other.GetValue(); return *this; }
|
||||
constexpr Self& operator&= (const Self& other) { Value &= other.GetValue(); return *this; }
|
||||
constexpr Self& operator^= (const Self& other) { Value ^= other.GetValue(); return *this; }
|
||||
constexpr Self& operator= (T value) { Value = value; return *this; }
|
||||
constexpr Self& operator|= (T value) { Value |= value; return *this; }
|
||||
constexpr Self& operator&= (T value) { Value &= value; return *this; }
|
||||
constexpr Self& operator^= (T value) { Value ^= value; return *this; }
|
||||
|
||||
// Access the value of the flagset
|
||||
TT GetValue() const { return Value; }
|
||||
operator TT() const { return Value; }
|
||||
constexpr TT GetValue() const { return Value; }
|
||||
constexpr operator TT() const { return Value; }
|
||||
|
||||
// Set the value of the flagset manually with an integer.
|
||||
// Please think twice before using this.
|
||||
static Self FromInt (TT value) { return Self (static_cast<T> (value)); }
|
||||
static constexpr Self FromInt (TT value) { return Self (static_cast<T> (value)); }
|
||||
|
||||
private:
|
||||
template<typename X> Self operator| (X value) const { return Self::FromInt (Value | value); }
|
||||
template<typename X> Self operator& (X value) const { return Self::FromInt (Value & value); }
|
||||
template<typename X> Self operator^ (X value) const { return Self::FromInt (Value ^ value); }
|
||||
template<typename X> constexpr Self operator| (X value) const { return Self::FromInt (Value | value); }
|
||||
template<typename X> constexpr Self operator& (X value) const { return Self::FromInt (Value & value); }
|
||||
template<typename X> constexpr Self operator^ (X value) const { return Self::FromInt (Value ^ value); }
|
||||
|
||||
public: // to be removed.
|
||||
TT Value;
|
||||
|
@ -98,11 +98,11 @@ public: // to be removed.
|
|||
* Additional operators for TFlags types.
|
||||
*/
|
||||
#define DEFINE_TFLAGS_OPERATORS(T) \
|
||||
inline T operator| (T::EnumType a, T::EnumType b) { return T::FromInt (T::IntType (a) | T::IntType (b)); } \
|
||||
inline T operator& (T::EnumType a, T::EnumType b) { return T::FromInt (T::IntType (a) & T::IntType (b)); } \
|
||||
inline T operator^ (T::EnumType a, T::EnumType b) { return T::FromInt (T::IntType (a) ^ T::IntType (b)); } \
|
||||
inline T operator| (T::EnumType a, T b) { return T::FromInt (T::IntType (a) | T::IntType (b)); } \
|
||||
inline T operator& (T::EnumType a, T b) { return T::FromInt (T::IntType (a) & T::IntType (b)); } \
|
||||
inline T operator^ (T::EnumType a, T b) { return T::FromInt (T::IntType (a) ^ T::IntType (b)); } \
|
||||
inline T operator~ (T::EnumType a) { return T::FromInt (~T::IntType (a)); }
|
||||
constexpr inline T operator| (T::EnumType a, T::EnumType b) { return T::FromInt (T::IntType (a) | T::IntType (b)); } \
|
||||
constexpr inline T operator& (T::EnumType a, T::EnumType b) { return T::FromInt (T::IntType (a) & T::IntType (b)); } \
|
||||
constexpr inline T operator^ (T::EnumType a, T::EnumType b) { return T::FromInt (T::IntType (a) ^ T::IntType (b)); } \
|
||||
constexpr inline T operator| (T::EnumType a, T b) { return T::FromInt (T::IntType (a) | T::IntType (b)); } \
|
||||
constexpr inline T operator& (T::EnumType a, T b) { return T::FromInt (T::IntType (a) & T::IntType (b)); } \
|
||||
constexpr inline T operator^ (T::EnumType a, T b) { return T::FromInt (T::IntType (a) ^ T::IntType (b)); } \
|
||||
constexpr inline T operator~ (T::EnumType a) { return T::FromInt (~T::IntType (a)); }
|
||||
|
||||
|
|
|
@ -428,7 +428,6 @@ int getAlternative(int code)
|
|||
case 0x457: return 0xef;
|
||||
case 0x458: return 'j';
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue