mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 16:41:07 +00:00
Merge remote-tracking branch 'gzdoom/master' into qz-master-2021-10-27
This commit is contained in:
commit
7657685085
252 changed files with 1480 additions and 1477 deletions
|
@ -1,5 +1,5 @@
|
||||||
/* 7zTypes.h -- Basic types
|
/* 7zTypes.h -- Basic types
|
||||||
2021-07-13 : Igor Pavlov : Public domain */
|
2021-12-25 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
#ifndef __7Z_TYPES_H
|
#ifndef __7Z_TYPES_H
|
||||||
#define __7Z_TYPES_H
|
#define __7Z_TYPES_H
|
||||||
|
@ -105,6 +105,7 @@ typedef int WRes;
|
||||||
|
|
||||||
// we use errno equivalents for some WIN32 errors:
|
// we use errno equivalents for some WIN32 errors:
|
||||||
|
|
||||||
|
#define ERROR_INVALID_PARAMETER EINVAL
|
||||||
#define ERROR_INVALID_FUNCTION EINVAL
|
#define ERROR_INVALID_FUNCTION EINVAL
|
||||||
#define ERROR_ALREADY_EXISTS EEXIST
|
#define ERROR_ALREADY_EXISTS EEXIST
|
||||||
#define ERROR_FILE_EXISTS EEXIST
|
#define ERROR_FILE_EXISTS EEXIST
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define MY_VER_MAJOR 21
|
#define MY_VER_MAJOR 21
|
||||||
#define MY_VER_MINOR 06
|
#define MY_VER_MINOR 07
|
||||||
#define MY_VER_BUILD 0
|
#define MY_VER_BUILD 0
|
||||||
#define MY_VERSION_NUMBERS "21.06"
|
#define MY_VERSION_NUMBERS "21.07"
|
||||||
#define MY_VERSION MY_VERSION_NUMBERS
|
#define MY_VERSION MY_VERSION_NUMBERS
|
||||||
|
|
||||||
#ifdef MY_CPU_NAME
|
#ifdef MY_CPU_NAME
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
#define MY_VERSION_CPU MY_VERSION
|
#define MY_VERSION_CPU MY_VERSION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MY_DATE "2021-11-24"
|
#define MY_DATE "2021-12-26"
|
||||||
#undef MY_COPYRIGHT
|
#undef MY_COPYRIGHT
|
||||||
#undef MY_VERSION_COPYRIGHT_DATE
|
#undef MY_VERSION_COPYRIGHT_DATE
|
||||||
#define MY_AUTHOR_NAME "Igor Pavlov"
|
#define MY_AUTHOR_NAME "Igor Pavlov"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* LzFindMt.c -- multithreaded Match finder for LZ algorithms
|
/* LzFindMt.c -- multithreaded Match finder for LZ algorithms
|
||||||
2021-07-12 : Igor Pavlov : Public domain */
|
2021-12-21 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
#include "Precomp.h"
|
#include "Precomp.h"
|
||||||
|
|
||||||
|
@ -832,8 +832,8 @@ void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAllocPtr alloc)
|
||||||
#define kBtBufferSize (kMtBtBlockSize * kMtBtNumBlocks)
|
#define kBtBufferSize (kMtBtBlockSize * kMtBtNumBlocks)
|
||||||
|
|
||||||
|
|
||||||
static THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE HashThreadFunc2(void *p) { HashThreadFunc((CMatchFinderMt *)p); return 0; }
|
static THREAD_FUNC_DECL HashThreadFunc2(void *p) { HashThreadFunc((CMatchFinderMt *)p); return 0; }
|
||||||
static THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE BtThreadFunc2(void *p)
|
static THREAD_FUNC_DECL BtThreadFunc2(void *p)
|
||||||
{
|
{
|
||||||
Byte allocaDummy[0x180];
|
Byte allocaDummy[0x180];
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/* Threads.c -- multithreading library
|
/* Threads.c -- multithreading library
|
||||||
2021-07-12 : Igor Pavlov : Public domain */
|
2021-12-21 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
#include "Precomp.h"
|
#include "Precomp.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
#ifndef UNDER_CE
|
#ifndef USE_THREADS_CreateThread
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -63,10 +63,10 @@ WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param)
|
||||||
{
|
{
|
||||||
/* Windows Me/98/95: threadId parameter may not be NULL in _beginthreadex/CreateThread functions */
|
/* Windows Me/98/95: threadId parameter may not be NULL in _beginthreadex/CreateThread functions */
|
||||||
|
|
||||||
#ifdef UNDER_CE
|
#ifdef USE_THREADS_CreateThread
|
||||||
|
|
||||||
DWORD threadId;
|
DWORD threadId;
|
||||||
*p = CreateThread(0, 0, func, param, 0, &threadId);
|
*p = CreateThread(NULL, 0, func, param, 0, &threadId);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param)
|
||||||
|
|
||||||
WRes Thread_Create_With_Affinity(CThread *p, THREAD_FUNC_TYPE func, LPVOID param, CAffinityMask affinity)
|
WRes Thread_Create_With_Affinity(CThread *p, THREAD_FUNC_TYPE func, LPVOID param, CAffinityMask affinity)
|
||||||
{
|
{
|
||||||
#ifdef UNDER_CE
|
#ifdef USE_THREADS_CreateThread
|
||||||
|
|
||||||
UNUSED_VAR(affinity)
|
UNUSED_VAR(affinity)
|
||||||
return Thread_Create(p, func, param);
|
return Thread_Create(p, func, param);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Threads.h -- multithreading library
|
/* Threads.h -- multithreading library
|
||||||
2021-07-12 : Igor Pavlov : Public domain */
|
2021-12-21 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
#ifndef __7Z_THREADS_H
|
#ifndef __7Z_THREADS_H
|
||||||
#define __7Z_THREADS_H
|
#define __7Z_THREADS_H
|
||||||
|
@ -38,8 +38,14 @@ typedef HANDLE CThread;
|
||||||
#define Thread_Close(p) HandlePtr_Close(p)
|
#define Thread_Close(p) HandlePtr_Close(p)
|
||||||
// #define Thread_Wait(p) Handle_WaitObject(*(p))
|
// #define Thread_Wait(p) Handle_WaitObject(*(p))
|
||||||
|
|
||||||
typedef
|
|
||||||
#ifdef UNDER_CE
|
#ifdef UNDER_CE
|
||||||
|
// if (USE_THREADS_CreateThread is defined), we use _beginthreadex()
|
||||||
|
// if (USE_THREADS_CreateThread is not definned), we use CreateThread()
|
||||||
|
#define USE_THREADS_CreateThread
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef
|
||||||
|
#ifdef USE_THREADS_CreateThread
|
||||||
DWORD
|
DWORD
|
||||||
#else
|
#else
|
||||||
unsigned
|
unsigned
|
||||||
|
@ -90,7 +96,30 @@ typedef UInt64 CCpuSet;
|
||||||
|
|
||||||
|
|
||||||
#define THREAD_FUNC_CALL_TYPE MY_STD_CALL
|
#define THREAD_FUNC_CALL_TYPE MY_STD_CALL
|
||||||
#define THREAD_FUNC_DECL THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE
|
|
||||||
|
#if defined(_WIN32) && defined(__GNUC__)
|
||||||
|
/* GCC compiler for x86 32-bit uses the rule:
|
||||||
|
the stack is 16-byte aligned before CALL instruction for function calling.
|
||||||
|
But only root function main() contains instructions that
|
||||||
|
set 16-byte alignment for stack pointer. And another functions
|
||||||
|
just keep alignment, if it was set in some parent function.
|
||||||
|
|
||||||
|
The problem:
|
||||||
|
if we create new thread in MinGW (GCC) 32-bit x86 via _beginthreadex() or CreateThread(),
|
||||||
|
the root function of thread doesn't set 16-byte alignment.
|
||||||
|
And stack frames in all child functions also will be unaligned in that case.
|
||||||
|
|
||||||
|
Here we set (force_align_arg_pointer) attribute for root function of new thread.
|
||||||
|
Do we need (force_align_arg_pointer) also for another systems? */
|
||||||
|
|
||||||
|
#define THREAD_FUNC_ATTRIB_ALIGN_ARG __attribute__((force_align_arg_pointer))
|
||||||
|
// #define THREAD_FUNC_ATTRIB_ALIGN_ARG // for debug : bad alignment in SSE functions
|
||||||
|
#else
|
||||||
|
#define THREAD_FUNC_ATTRIB_ALIGN_ARG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define THREAD_FUNC_DECL THREAD_FUNC_ATTRIB_ALIGN_ARG THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE
|
||||||
|
|
||||||
typedef THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE * THREAD_FUNC_TYPE)(void *);
|
typedef THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE * THREAD_FUNC_TYPE)(void *);
|
||||||
WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param);
|
WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param);
|
||||||
WRes Thread_Create_With_Affinity(CThread *p, THREAD_FUNC_TYPE func, LPVOID param, CAffinityMask affinity);
|
WRes Thread_Create_With_Affinity(CThread *p, THREAD_FUNC_TYPE func, LPVOID param, CAffinityMask affinity);
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
HISTORY of the LZMA SDK
|
HISTORY of the LZMA SDK
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
21.07 2021-12-26
|
||||||
|
-------------------------
|
||||||
|
- New switches: -spm and -im!{file_path} to exclude directories from processing
|
||||||
|
for specified paths that don't contain path separator character at the end of path.
|
||||||
|
- The sorting order of files in archives was slightly changed to be more consistent
|
||||||
|
for cases where the name of some directory is the same as the prefix part of the name
|
||||||
|
of another directory or file.
|
||||||
|
|
||||||
|
|
||||||
21.06 2021-11-24
|
21.06 2021-11-24
|
||||||
-------------------------
|
-------------------------
|
||||||
- Bug in LZMA encoder in file LzmaEnc.c was fixed:
|
- Bug in LZMA encoder in file LzmaEnc.c was fixed:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
LZMA SDK 21.06
|
LZMA SDK 21.07
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
LZMA SDK provides the documentation, samples, header files,
|
LZMA SDK provides the documentation, samples, header files,
|
||||||
|
|
|
@ -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)
|
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;
|
RenderCommand dg;
|
||||||
int method = 0;
|
|
||||||
|
|
||||||
if (!img || !img->isValid()) return;
|
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;
|
dg.mFlags = DTF_Wrap;
|
||||||
|
|
||||||
float fs = 1.f / float(flatscale);
|
float fs = 1.f / float(flatscale);
|
||||||
bool flipc = false;
|
|
||||||
|
|
||||||
float sw = GetClassicFlatScalarWidth();
|
float sw = GetClassicFlatScalarWidth();
|
||||||
float sh = GetClassicFlatScalarHeight();
|
float sh = GetClassicFlatScalarHeight();
|
||||||
|
|
||||||
switch (local_origin)
|
switch (local_origin)
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
fU1 = float(left) / (float)src->GetDisplayWidth() * fs;
|
fU1 = float(left) / (float)src->GetDisplayWidth() * fs;
|
||||||
fV1 = float(top) / (float)src->GetDisplayHeight() * 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
|
// Default should try to scale to 640x400
|
||||||
int vscale = drawer->GetHeight() / 400;
|
int vscale = drawer->GetHeight() / 400;
|
||||||
int hscale = drawer->GetWidth() / 640;
|
int hscale = drawer->GetWidth() / 640;
|
||||||
scaleval = clamp(vscale, 1, hscale);
|
scaleval = max(1, min(vscale, hscale));
|
||||||
}
|
}
|
||||||
else scaleval = uiscale;
|
else scaleval = uiscale;
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ int GetConScale(F2DDrawer* drawer, int altval)
|
||||||
// Default should try to scale to 640x400
|
// Default should try to scale to 640x400
|
||||||
int vscale = drawer->GetHeight() / 800;
|
int vscale = drawer->GetHeight() / 800;
|
||||||
int hscale = drawer->GetWidth() / 1280;
|
int hscale = drawer->GetWidth() / 1280;
|
||||||
scaleval = clamp(vscale, 1, hscale);
|
scaleval = max(1, min(vscale, hscale));
|
||||||
}
|
}
|
||||||
else scaleval = (uiscale+1) / 2;
|
else scaleval = (uiscale+1) / 2;
|
||||||
|
|
||||||
|
@ -671,7 +671,6 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
|
||||||
{
|
{
|
||||||
INTBOOL boolval;
|
INTBOOL boolval;
|
||||||
int intval;
|
int intval;
|
||||||
bool translationset = false;
|
|
||||||
bool fillcolorset = false;
|
bool fillcolorset = false;
|
||||||
|
|
||||||
if (!fortext)
|
if (!fortext)
|
||||||
|
@ -1016,10 +1015,16 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
|
||||||
case DTA_CenterOffsetRel:
|
case DTA_CenterOffsetRel:
|
||||||
assert(fortext == false);
|
assert(fortext == false);
|
||||||
if (fortext) return false;
|
if (fortext) return false;
|
||||||
if (ListGetInt(tags))
|
intval = ListGetInt(tags);
|
||||||
|
if (intval == 1)
|
||||||
{
|
{
|
||||||
parms->left = img->GetDisplayLeftOffset() + img->GetDisplayWidth() * 0.5;
|
parms->left = img->GetDisplayLeftOffset() + (img->GetDisplayWidth() * 0.5);
|
||||||
parms->top = img->GetDisplayTopOffset() + img->GetDisplayHeight() * 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;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -603,13 +603,13 @@ static void CheckReplayGain(const char *musicname, EMidiDevice playertype, const
|
||||||
{
|
{
|
||||||
float* sbuf = (float*)readbuffer.Data();
|
float* sbuf = (float*)readbuffer.Data();
|
||||||
int numsamples = fmt.mBufferSize / 8;
|
int numsamples = fmt.mBufferSize / 8;
|
||||||
auto index = lbuffer.Reserve(numsamples);
|
auto addr = lbuffer.Reserve(numsamples);
|
||||||
rbuffer.Reserve(numsamples);
|
rbuffer.Reserve(numsamples);
|
||||||
|
|
||||||
for (int i = 0; i < numsamples; i++)
|
for (int i = 0; i < numsamples; i++)
|
||||||
{
|
{
|
||||||
lbuffer[index + i] = sbuf[i * 2] * 32768.f;
|
lbuffer[addr + i] = sbuf[i * 2] * 32768.f;
|
||||||
rbuffer[index + i] = sbuf[i * 2 + 1] * 32768.f;
|
rbuffer[addr + i] = sbuf[i * 2 + 1] * 32768.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float accTime = lbuffer.Size() / (float)fmt.mSampleRate;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lumpnum = -1;
|
|
||||||
int length = 0;
|
|
||||||
ZMusic_MusicStream handle = nullptr;
|
ZMusic_MusicStream handle = nullptr;
|
||||||
MidiDeviceSetting* devp = MidiDevices.CheckKey(musicname);
|
MidiDeviceSetting* devp = MidiDevices.CheckKey(musicname);
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,6 @@ public:
|
||||||
virtual FString GetStats()
|
virtual FString GetStats()
|
||||||
{
|
{
|
||||||
FString stats;
|
FString stats;
|
||||||
size_t pos = 0, len = 0;
|
|
||||||
ALfloat volume;
|
ALfloat volume;
|
||||||
ALint offset;
|
ALint offset;
|
||||||
ALint processed;
|
ALint processed;
|
||||||
|
|
|
@ -530,7 +530,7 @@ void S_ReadReverbDef (FScanner &sc)
|
||||||
{
|
{
|
||||||
const ReverbContainer *def;
|
const ReverbContainer *def;
|
||||||
ReverbContainer *newenv;
|
ReverbContainer *newenv;
|
||||||
REVERB_PROPERTIES props;
|
REVERB_PROPERTIES props = {};
|
||||||
char *name;
|
char *name;
|
||||||
int id1, id2, i, j;
|
int id1, id2, i, j;
|
||||||
bool inited[NUM_REVERB_FIELDS];
|
bool inited[NUM_REVERB_FIELDS];
|
||||||
|
|
|
@ -309,7 +309,6 @@ DEFINE_ACTION_FUNCTION(DReverbEdit, GetValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ACTION_RETURN_FLOAT(v);
|
ACTION_RETURN_FLOAT(v);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(DReverbEdit, SetValue)
|
DEFINE_ACTION_FUNCTION(DReverbEdit, SetValue)
|
||||||
|
@ -337,14 +336,12 @@ DEFINE_ACTION_FUNCTION(DReverbEdit, SetValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
ACTION_RETURN_FLOAT(v);
|
ACTION_RETURN_FLOAT(v);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(DReverbEdit, GrayCheck)
|
DEFINE_ACTION_FUNCTION(DReverbEdit, GrayCheck)
|
||||||
{
|
{
|
||||||
PARAM_PROLOGUE;
|
PARAM_PROLOGUE;
|
||||||
ACTION_RETURN_BOOL(CurrentEnv->Builtin);
|
ACTION_RETURN_BOOL(CurrentEnv->Builtin);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(DReverbEdit, GetSelectedEnvironment)
|
DEFINE_ACTION_FUNCTION(DReverbEdit, GetSelectedEnvironment)
|
||||||
|
|
|
@ -164,7 +164,6 @@ void SoundEngine::CacheSound (sfxinfo_t *sfx)
|
||||||
{
|
{
|
||||||
if (GSnd && !sfx->bTentative)
|
if (GSnd && !sfx->bTentative)
|
||||||
{
|
{
|
||||||
sfxinfo_t *orig = sfx;
|
|
||||||
while (!sfx->bRandomHeader && sfx->link != sfxinfo_t::NO_LINK)
|
while (!sfx->bRandomHeader && sfx->link != sfxinfo_t::NO_LINK)
|
||||||
{
|
{
|
||||||
sfx = &S_sfx[sfx->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?
|
// 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;
|
int count = 0;
|
||||||
if (sound_id > 0)
|
if (sound_id > 0)
|
||||||
{
|
{
|
||||||
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||||
{
|
{
|
||||||
|
if (chann != -1 && chann != chan->EntChannel) continue;
|
||||||
if (chan->OrgID == sound_id && (sourcetype == SOURCE_Any ||
|
if (chan->OrgID == sound_id && (sourcetype == SOURCE_Any ||
|
||||||
(chan->SourceType == sourcetype &&
|
(chan->SourceType == sourcetype &&
|
||||||
chan->Source == source)))
|
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)
|
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)))
|
if ((sourcetype == SOURCE_Any || (chan->SourceType == sourcetype && chan->Source == source)))
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
|
|
|
@ -249,9 +249,6 @@ public:
|
||||||
blockNewSounds = on;
|
blockNewSounds = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int SoundSourceIndex(FSoundChan* chan) { return 0; }
|
|
||||||
virtual void SetSource(FSoundChan* chan, int index) {}
|
|
||||||
|
|
||||||
virtual void StopChannel(FSoundChan* chan);
|
virtual void StopChannel(FSoundChan* chan);
|
||||||
sfxinfo_t* LoadSound(sfxinfo_t* sfx);
|
sfxinfo_t* LoadSound(sfxinfo_t* sfx);
|
||||||
const sfxinfo_t* GetSfx(unsigned snd)
|
const sfxinfo_t* GetSfx(unsigned snd)
|
||||||
|
@ -303,7 +300,7 @@ public:
|
||||||
bool IsSourcePlayingSomething(int sourcetype, const void* actor, int channel, int sound_id = -1);
|
bool IsSourcePlayingSomething(int sourcetype, const void* actor, int channel, int sound_id = -1);
|
||||||
|
|
||||||
// Stop and resume music, during game PAUSE.
|
// 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 UnloadAllSounds();
|
||||||
void Reset();
|
void Reset();
|
||||||
void MarkUsed(int num);
|
void MarkUsed(int num);
|
||||||
|
|
|
@ -331,16 +331,16 @@ void C_DeinitConsole ()
|
||||||
// at runtime.)
|
// at runtime.)
|
||||||
for (size_t i = 0; i < countof(Commands); ++i)
|
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;
|
FConsoleCommand *nextcmd = command->m_Next;
|
||||||
if (cmd->IsAlias())
|
if (command->IsAlias())
|
||||||
{
|
{
|
||||||
delete cmd;
|
delete command;
|
||||||
}
|
}
|
||||||
cmd = next;
|
command = nextcmd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -333,6 +333,7 @@ UCVarValue FBaseCVar::FromBool (bool value, ECVarType type)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
ret.Int = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,6 +364,7 @@ UCVarValue FBaseCVar::FromInt (int value, ECVarType type)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
ret.Int = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,6 +397,7 @@ UCVarValue FBaseCVar::FromFloat (float value, ECVarType type)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
ret.Int = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,6 +459,7 @@ UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
ret.Int = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1426,12 +1430,12 @@ void C_ArchiveCVars (FConfigFile *f, uint32_t filter)
|
||||||
cvar = cvar->m_Next;
|
cvar = cvar->m_Next;
|
||||||
}
|
}
|
||||||
qsort(cvarlist.Data(), cvarlist.Size(), sizeof(FBaseCVar*), cvarcmp);
|
qsort(cvarlist.Data(), cvarlist.Size(), sizeof(FBaseCVar*), cvarcmp);
|
||||||
for (auto cvar : cvarlist)
|
for (auto cv : cvarlist)
|
||||||
{
|
{
|
||||||
const char* const value = (cvar->Flags & CVAR_ISDEFAULT)
|
const char* const value = (cv->Flags & CVAR_ISDEFAULT)
|
||||||
? cvar->GetGenericRep(CVAR_String).String
|
? cv->GetGenericRep(CVAR_String).String
|
||||||
: cvar->SafeValue.GetChars();
|
: cv->SafeValue.GetChars();
|
||||||
f->SetValueForKey(cvar->GetName(), value);
|
f->SetValueForKey(cv->GetName(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1643,7 +1647,6 @@ CCMD (archivecvar)
|
||||||
void C_ListCVarsWithoutDescription()
|
void C_ListCVarsWithoutDescription()
|
||||||
{
|
{
|
||||||
FBaseCVar* var = CVars;
|
FBaseCVar* var = CVars;
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
while (var)
|
while (var)
|
||||||
{
|
{
|
||||||
|
|
|
@ -282,8 +282,8 @@ void C_DoCommand (const char *cmd, int keynum)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto cmd = new FStoredCommand(com, beg);
|
auto command = new FStoredCommand(com, beg);
|
||||||
delayedCommandQueue.AddCommand(cmd);
|
delayedCommandQueue.AddCommand(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,8 +373,8 @@ void AddCommandString (const char *text, int keynum)
|
||||||
// Note that deferred commands lose track of which key
|
// Note that deferred commands lose track of which key
|
||||||
// (if any) they were pressed from.
|
// (if any) they were pressed from.
|
||||||
*brkpt = ';';
|
*brkpt = ';';
|
||||||
auto cmd = new FWaitingCommand(brkpt, tics, UnsafeExecutionContext);
|
auto command = new FWaitingCommand(brkpt, tics, UnsafeExecutionContext);
|
||||||
delayedCommandQueue.AddCommand(cmd);
|
delayedCommandQueue.AddCommand(command);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -851,8 +851,8 @@ CCMD (key)
|
||||||
|
|
||||||
for (i = 1; i < argv.argc(); ++i)
|
for (i = 1; i < argv.argc(); ++i)
|
||||||
{
|
{
|
||||||
unsigned int key = MakeKey (argv[i]);
|
unsigned int hash = MakeKey (argv[i]);
|
||||||
Printf (" 0x%08x\n", key);
|
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)
|
FExecList *C_ParseExecFile(const char *file, FExecList *exec)
|
||||||
{
|
{
|
||||||
char cmd[4096];
|
char cmd[4096];
|
||||||
int retval = 0;
|
|
||||||
|
|
||||||
FileReader fr;
|
FileReader fr;
|
||||||
|
|
||||||
|
|
|
@ -736,7 +736,7 @@ bool HostGame (int i)
|
||||||
{
|
{
|
||||||
// If we send the packets eight times to each guest,
|
// If we send the packets eight times to each guest,
|
||||||
// hopefully at least one of them will get through.
|
// 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]);
|
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)
|
int PaletteContainer::AddTranslation(int slot, FRemapTable* remap, int count)
|
||||||
{
|
{
|
||||||
uint32_t id;
|
uint32_t id = 0;
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
auto newremap = AddRemap(&remap[i]);
|
auto newremap = AddRemap(&remap[i]);
|
||||||
|
@ -265,7 +265,7 @@ FRemapTable *PaletteContainer::TranslationToTable(int translation)
|
||||||
unsigned int type = GetTranslationType(translation);
|
unsigned int type = GetTranslationType(translation);
|
||||||
unsigned int index = GetTranslationIndex(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.
|
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)
|
bool FRemapTable::AddToTranslation(const char *range)
|
||||||
{
|
{
|
||||||
int start,end;
|
int start,end;
|
||||||
bool desaturated = false;
|
|
||||||
FScanner sc;
|
FScanner sc;
|
||||||
|
|
||||||
sc.OpenMem("translation", range, int(strlen(range)));
|
sc.OpenMem("translation", range, int(strlen(range)));
|
||||||
|
|
|
@ -1131,9 +1131,7 @@ FString FScanner::TokenName (int token, const char *string)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FString work;
|
|
||||||
work.Format("Unknown(%d)", token);
|
work.Format("Unknown(%d)", token);
|
||||||
return work;
|
|
||||||
}
|
}
|
||||||
return work;
|
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()
|
void FSerializer::EndObject()
|
||||||
{
|
{
|
||||||
if (isWriting())
|
if (isWriting())
|
||||||
|
@ -619,7 +641,6 @@ void FSerializer::ReadObjects(bool hubtravel)
|
||||||
if (BeginObject(nullptr))
|
if (BeginObject(nullptr))
|
||||||
{
|
{
|
||||||
FString clsname; // do not deserialize the class type directly so that we can print appropriate errors.
|
FString clsname; // do not deserialize the class type directly so that we can print appropriate errors.
|
||||||
int pindex = -1;
|
|
||||||
|
|
||||||
Serialize(*this, "classtype", clsname, nullptr);
|
Serialize(*this, "classtype", clsname, nullptr);
|
||||||
PClass *cls = PClass::FindClass(clsname);
|
PClass *cls = PClass::FindClass(clsname);
|
||||||
|
@ -643,6 +664,7 @@ void FSerializer::ReadObjects(bool hubtravel)
|
||||||
if (!founderrors)
|
if (!founderrors)
|
||||||
{
|
{
|
||||||
// Reset to start;
|
// Reset to start;
|
||||||
|
unsigned size = r->mObjects.Size();
|
||||||
r->mObjects.Last().mIndex = 0;
|
r->mObjects.Last().mIndex = 0;
|
||||||
|
|
||||||
for (unsigned i = 0; i < r->mDObjects.Size(); i++)
|
for (unsigned i = 0; i < r->mDObjects.Size(); i++)
|
||||||
|
@ -652,7 +674,6 @@ void FSerializer::ReadObjects(bool hubtravel)
|
||||||
{
|
{
|
||||||
if (obj != nullptr)
|
if (obj != nullptr)
|
||||||
{
|
{
|
||||||
int pindex = -1;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
obj->SerializeUserVars(*this);
|
obj->SerializeUserVars(*this);
|
||||||
|
@ -660,6 +681,7 @@ void FSerializer::ReadObjects(bool hubtravel)
|
||||||
}
|
}
|
||||||
catch (CRecoverableError &err)
|
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.
|
// 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");
|
Printf(TEXTCOLOR_RED "'%s'\n while restoring %s\n", err.GetMessage(), obj ? obj->GetClass()->TypeName.GetChars() : "invalid object");
|
||||||
mErrors++;
|
mErrors++;
|
||||||
|
|
|
@ -85,6 +85,7 @@ public:
|
||||||
void ReadObjects(bool hubtravel);
|
void ReadObjects(bool hubtravel);
|
||||||
bool BeginObject(const char *name);
|
bool BeginObject(const char *name);
|
||||||
void EndObject();
|
void EndObject();
|
||||||
|
bool HasObject(const char* name);
|
||||||
bool BeginArray(const char *name);
|
bool BeginArray(const char *name);
|
||||||
void EndArray();
|
void EndArray();
|
||||||
unsigned GetSize(const char *group);
|
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, FString &sid, FString *def);
|
||||||
FSerializer &Serialize(FSerializer &arc, const char *key, NumericValue &sid, NumericValue *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 **)
|
FSerializer &Serialize(FSerializer &arc, const char *key, T *&value, T **)
|
||||||
{
|
{
|
||||||
DObject *v = static_cast<DObject*>(value);
|
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());
|
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, PClass*& clst, PClass** def);
|
||||||
template<> FSerializer& Serialize(FSerializer& arc, const char* key, FFont*& font, FFont** 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);
|
template<> FSerializer &Serialize(FSerializer &arc, const char *key, Dictionary *&dict, Dictionary **def);
|
||||||
|
|
|
@ -41,8 +41,6 @@
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
#include "findfile.h"
|
#include "findfile.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// Zip Lump
|
// 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.
|
// 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.
|
// mark all lumps before the last F_END marker as potential flats.
|
||||||
unsigned int end = markers[markers.Size()-1].index;
|
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
|
// We can't add this to the flats namespace but
|
||||||
// it needs to be flagged for the texture manager.
|
// it needs to be flagged for the texture manager.
|
||||||
DPrintf(DMSG_NOTIFY, "Marking %s as potential flat\n", Lumps[i].getName());
|
DPrintf(DMSG_NOTIFY, "Marking %s as potential flat\n", Lumps[ii].getName());
|
||||||
Lumps[i].Flags |= LUMPF_MAYBEFLAT;
|
Lumps[ii].Flags |= LUMPF_MAYBEFLAT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -428,18 +428,19 @@ void FWadFile::SkinHack ()
|
||||||
namespc++;
|
namespc++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// needless to say, this check is entirely useless these days as map names can be more diverse..
|
||||||
if ((lump->getName()[0] == 'M' &&
|
if ((lump->getName()[0] == 'M' &&
|
||||||
lump->getName()[1] == 'A' &&
|
lump->getName()[1] == 'A' &&
|
||||||
lump->getName()[2] == 'P' &&
|
lump->getName()[2] == 'P' &&
|
||||||
lump->getName()[3] >= '0' && lump->getName()[3] <= '9' &&
|
lump->getName()[3] >= '0' && lump->getName()[3] <= '9' &&
|
||||||
lump->getName()[4] >= '0' && lump->getName()[4] <= '9' &&
|
lump->getName()[4] >= '0' && lump->getName()[4] <= '9' &&
|
||||||
lump->getName()[5] >= '\0')
|
lump->getName()[5] == '\0')
|
||||||
||
|
||
|
||||||
(lump->getName()[0] == 'E' &&
|
(lump->getName()[0] == 'E' &&
|
||||||
lump->getName()[1] >= '0' && lump->getName()[1] <= '9' &&
|
lump->getName()[1] >= '0' && lump->getName()[1] <= '9' &&
|
||||||
lump->getName()[2] == 'M' &&
|
lump->getName()[2] == 'M' &&
|
||||||
lump->getName()[3] >= '0' && lump->getName()[3] <= '9' &&
|
lump->getName()[3] >= '0' && lump->getName()[3] <= '9' &&
|
||||||
lump->getName()[4] >= '\0'))
|
lump->getName()[4] == '\0'))
|
||||||
{
|
{
|
||||||
hasmap = true;
|
hasmap = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,6 @@ void FileSystem::InitMultipleFiles (TArray<FString> &filenames, bool quiet, Lump
|
||||||
|
|
||||||
for(unsigned i=0;i<filenames.Size(); i++)
|
for(unsigned i=0;i<filenames.Size(); i++)
|
||||||
{
|
{
|
||||||
int baselump = NumEntries;
|
|
||||||
AddFile (filenames[i], nullptr, quiet, filter);
|
AddFile (filenames[i], nullptr, quiet, filter);
|
||||||
|
|
||||||
if (i == (unsigned)MaxIwadIndex) MoveLumpsInFolder("after_iwad/");
|
if (i == (unsigned)MaxIwadIndex) MoveLumpsInFolder("after_iwad/");
|
||||||
|
@ -1669,3 +1668,20 @@ FResourceLump* FileSystem::GetFileAt(int no)
|
||||||
return FileInfo[no].lump;
|
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;
|
uint32_t min, max, mid, inside;
|
||||||
FResourceLump *lump;
|
FResourceLump *lump;
|
||||||
int cmp;
|
int cmp = 0;
|
||||||
|
|
||||||
end = start = 0;
|
end = start = 0;
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ bool FResourceFile::FindPrefixRange(FString filter, void *lumps, size_t lumpsize
|
||||||
lumps = (uint8_t *)lumps - lumpsize;
|
lumps = (uint8_t *)lumps - lumpsize;
|
||||||
|
|
||||||
// Binary search to find any match at all.
|
// Binary search to find any match at all.
|
||||||
min = 1, max = maxlump;
|
mid = min = 1, max = maxlump;
|
||||||
while (min <= max)
|
while (min <= max)
|
||||||
{
|
{
|
||||||
mid = min + (max - min) / 2;
|
mid = min + (max - min) / 2;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
|
#include "zstring.h"
|
||||||
|
|
||||||
struct LumpFilterInfo
|
struct LumpFilterInfo
|
||||||
{
|
{
|
||||||
|
|
|
@ -292,12 +292,12 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
auto position = strtoll(base.GetChars(), &endp, 16);
|
auto position = strtoll(base.GetChars(), &endp, 16);
|
||||||
if ((*endp == 0 || (*endp == '.' && position >= '!' && position < 0xffff)))
|
if ((*endp == 0 || (*endp == '.' && position >= '!' && position < 0xffff)))
|
||||||
{
|
{
|
||||||
auto lump = TexMan.CheckForTexture(entry.name, ETextureType::MiscPatch);
|
auto texlump = TexMan.CheckForTexture(entry.name, ETextureType::MiscPatch);
|
||||||
if (lump.isValid())
|
if (texlump.isValid())
|
||||||
{
|
{
|
||||||
if ((int)position < minchar) minchar = (int)position;
|
if ((int)position < minchar) minchar = (int)position;
|
||||||
if ((int)position > maxchar) maxchar = (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);
|
tex->SetScale((float)Scale.X, (float)Scale.Y);
|
||||||
charMap.Insert((int)position, tex);
|
charMap.Insert((int)position, tex);
|
||||||
Type = Folder;
|
Type = Folder;
|
||||||
|
@ -313,10 +313,10 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
auto lump = charMap.CheckKey(FirstChar + i);
|
auto charlump = charMap.CheckKey(FirstChar + i);
|
||||||
if (lump != nullptr)
|
if (charlump != nullptr)
|
||||||
{
|
{
|
||||||
auto pic = *lump;
|
auto pic = *charlump;
|
||||||
if (pic != nullptr)
|
if (pic != nullptr)
|
||||||
{
|
{
|
||||||
double fheight = pic->GetDisplayHeight();
|
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].OriginY = -height * y;
|
||||||
part[0].TexImage = static_cast<FImageTexture*>(tex->GetTexture());
|
part[0].TexImage = static_cast<FImageTexture*>(tex->GetTexture());
|
||||||
FMultiPatchTexture *image = new FMultiPatchTexture(width, height, part, false, false);
|
FMultiPatchTexture *image = new FMultiPatchTexture(width, height, part, false, false);
|
||||||
FImageTexture *tex = new FImageTexture(image);
|
FImageTexture *imgtex = new FImageTexture(image);
|
||||||
auto gtex = MakeGameTexture(tex, nullptr, ETextureType::FontChar);
|
auto gtex = MakeGameTexture(imgtex, nullptr, ETextureType::FontChar);
|
||||||
gtex->SetWorldPanning(true);
|
gtex->SetWorldPanning(true);
|
||||||
gtex->SetOffsets(0, 0, 0);
|
gtex->SetOffsets(0, 0, 0);
|
||||||
gtex->SetOffsets(1, 0, 0);
|
gtex->SetOffsets(1, 0, 0);
|
||||||
|
@ -424,7 +424,6 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
|
||||||
LastChar = maxchar;
|
LastChar = maxchar;
|
||||||
auto count = maxchar - minchar + 1;
|
auto count = maxchar - minchar + 1;
|
||||||
Chars.Resize(count);
|
Chars.Resize(count);
|
||||||
int fontheight = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -309,9 +309,9 @@ void FSingleLumpFont::LoadFON2 (int lump, const uint8_t *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
Palette[0] = 0;
|
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;
|
data_p = palette + ActiveColors*3;
|
||||||
|
|
|
@ -102,12 +102,12 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FGameTexture
|
||||||
|
|
||||||
if (charlumps[i] != nullptr)
|
if (charlumps[i] != nullptr)
|
||||||
{
|
{
|
||||||
auto pic = charlumps[i];
|
auto charpic = charlumps[i];
|
||||||
Chars[i].OriginalPic = MakeGameTexture(pic->GetTexture(), nullptr, ETextureType::FontChar);
|
Chars[i].OriginalPic = MakeGameTexture(charpic->GetTexture(), nullptr, ETextureType::FontChar);
|
||||||
Chars[i].OriginalPic->CopySize(pic, true);
|
Chars[i].OriginalPic->CopySize(charpic, true);
|
||||||
TexMan.AddGameTexture(Chars[i].OriginalPic);
|
TexMan.AddGameTexture(Chars[i].OriginalPic);
|
||||||
Chars[i].XMove = (int)Chars[i].OriginalPic->GetDisplayWidth();
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -725,9 +725,9 @@ static void CalcDefaultTranslation(FFont* base, int index)
|
||||||
auto lum = otherluminosity[i];
|
auto lum = otherluminosity[i];
|
||||||
if (lum >= 0 && lum <= 1)
|
if (lum >= 0 && lum <= 1)
|
||||||
{
|
{
|
||||||
int index = int(lum * 255);
|
int lumidx = int(lum * 255);
|
||||||
remap[index] = GPalette.BaseColors[i];
|
remap[lumidx] = GPalette.BaseColors[i];
|
||||||
remap[index].a = 255;
|
remap[lumidx].a = 255;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,6 @@ TArray<FBrokenLines> V_BreakLines (FFont *font, int maxwidth, const uint8_t *str
|
||||||
{
|
{
|
||||||
if (*string == '[')
|
if (*string == '[')
|
||||||
{
|
{
|
||||||
const uint8_t* start = string;
|
|
||||||
while (*string != ']' && *string != '\0')
|
while (*string != ']' && *string != '\0')
|
||||||
{
|
{
|
||||||
string++;
|
string++;
|
||||||
|
|
|
@ -160,12 +160,12 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
|
||||||
it = opt->GetItem("ConnectMessage2");
|
it = opt->GetItem("ConnectMessage2");
|
||||||
if (it != nullptr) it->SetValue(0, !use_joystick);
|
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);
|
GC::WriteBarrier(opt, it);
|
||||||
opt->mItems.Push(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())
|
if (opt->mSelectedItem >= (int)opt->mItems.Size())
|
||||||
{
|
{
|
||||||
|
@ -179,15 +179,15 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
|
||||||
auto p = CurrentMenu->PointerVar<IJoystickConfig>("mJoy");
|
auto p = CurrentMenu->PointerVar<IJoystickConfig>("mJoy");
|
||||||
if (p != nullptr)
|
if (p != nullptr)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned ii;
|
||||||
for (i = 0; i < Joysticks.Size(); ++i)
|
for (ii = 0; ii < Joysticks.Size(); ++ii)
|
||||||
{
|
{
|
||||||
if (Joysticks[i] == p)
|
if (Joysticks[ii] == p)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == Joysticks.Size())
|
if (ii == Joysticks.Size())
|
||||||
{
|
{
|
||||||
CurrentMenu->Close();
|
CurrentMenu->Close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,6 +340,10 @@ static void DoParseListMenuBody(FScanner &sc, DListMenuDescriptor *desc, bool &s
|
||||||
{
|
{
|
||||||
desc->mCenter = true;
|
desc->mCenter = true;
|
||||||
}
|
}
|
||||||
|
else if (sc.Compare("Selecteditem"))
|
||||||
|
{
|
||||||
|
desc->mSelectedItem = desc->mItems.Size() - 1;
|
||||||
|
}
|
||||||
else if (sc.Compare("animatedtransition"))
|
else if (sc.Compare("animatedtransition"))
|
||||||
{
|
{
|
||||||
desc->mAnimatedTransition = true;
|
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.
|
// 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++)
|
for (unsigned int i = insertIndex; i < desc->mItems.Size(); i++)
|
||||||
{
|
{
|
||||||
auto item = desc->mItems[i];
|
auto litem = desc->mItems[i];
|
||||||
if (item->GetClass()->IsDescendantOf("ListMenuItemSelectable"))
|
if (litem->GetClass()->IsDescendantOf("ListMenuItemSelectable"))
|
||||||
{
|
{
|
||||||
desc->mItems[i]->mYpos += desc->mLinespacing;
|
desc->mItems[i]->mYpos += desc->mLinespacing;
|
||||||
}
|
}
|
||||||
|
@ -660,9 +664,9 @@ static bool FindMatchingItem(DMenuItemBase *desc)
|
||||||
MenuDescriptorList::Pair *pair;
|
MenuDescriptorList::Pair *pair;
|
||||||
while (it.NextPair(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;
|
return false;
|
||||||
|
|
|
@ -151,8 +151,6 @@ int FSavegameManagerBase::InsertSaveNode(FSaveGameNode *node)
|
||||||
|
|
||||||
void FSavegameManagerBase::NotifyNewSave(const FString &file, const FString &title, bool okForQuicksave, bool forceQuicksave)
|
void FSavegameManagerBase::NotifyNewSave(const FString &file, const FString &title, bool okForQuicksave, bool forceQuicksave)
|
||||||
{
|
{
|
||||||
FSaveGameNode *node;
|
|
||||||
|
|
||||||
if (file.IsEmpty())
|
if (file.IsEmpty())
|
||||||
return;
|
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->SaveTitle = title;
|
||||||
node->Filename = file;
|
node->Filename = file;
|
||||||
node->bOldVersion = false;
|
node->bOldVersion = false;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// 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
|
// 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.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// 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++)
|
for (const char ** extp=extensions; *extp; extp++)
|
||||||
{
|
{
|
||||||
int lump = fileSystem.CheckNumForFullName(fn + *extp);
|
lump = fileSystem.CheckNumForFullName(fn + *extp);
|
||||||
if (lump >= best) best = lump;
|
if (lump >= best) best = lump;
|
||||||
}
|
}
|
||||||
return best;
|
return best;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// 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
|
// 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.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// 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));
|
memcpy(lods[i].triangles, buffer + lodInfo[i].offsetTriangles, lodInfo[i].numTriangles * sizeof(FTriangle));
|
||||||
for (int j = 0; j < lodInfo[i].numTriangles; j++)
|
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].textureIndices[kk] = LittleShort(lods[i].triangles[j].textureIndices[kk]);
|
||||||
lods[i].triangles[j].vertexIndices[k] = LittleShort(lods[i].triangles[j].vertexIndices[k]);
|
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;
|
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++)
|
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);
|
memcpy(lods[0].triangles, buffer + lodInfo[0].offsetTriangles, sizeof(FTriangle) * cnt);
|
||||||
for (int j = 0; j < cnt; j++)
|
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].textureIndices[kk] = LittleShort(lods[0].triangles[j].textureIndices[kk]);
|
||||||
lods[0].triangles[j].vertexIndices[k] = LittleShort(lods[0].triangles[j].vertexIndices[k]);
|
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
|
// 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
|
// 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.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// 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);
|
Frames.Resize(numFrames);
|
||||||
for (unsigned i = 0; i < numFrames; i++)
|
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];
|
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));
|
md3_shader_t * shader = (md3_shader_t*)(((char*)ss) + LittleLong(ss->Ofs_Shaders));
|
||||||
s->Skins.Resize(s->numSkins);
|
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.
|
// [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.
|
// ... and since some tools seem to output backslashes, these need to be replaced with forward slashes to work.
|
||||||
FixPathSeperator(shader[i].Name);
|
FixPathSeperator(shader[ii].Name);
|
||||||
s->Skins[i] = LoadSkin("", shader[i].Name);
|
s->Skins[ii] = LoadSkin("", shader[ii].Name);
|
||||||
// [BB] Fall back and check if Name is relative.
|
// [BB] Fall back and check if Name is relative.
|
||||||
if (!s->Skins[i].isValid())
|
if (!s->Skins[ii].isValid())
|
||||||
s->Skins[i] = LoadSkin(path, shader[i].Name);
|
s->Skins[ii] = LoadSkin(path, shader[ii].Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mLumpNum = lumpnum;
|
mLumpNum = lumpnum;
|
||||||
|
@ -203,31 +203,31 @@ void FMD3Model::LoadGeometry()
|
||||||
md3_triangle_t * tris = (md3_triangle_t*)(((char*)ss) + LittleLong(ss->Ofs_Triangles));
|
md3_triangle_t * tris = (md3_triangle_t*)(((char*)ss) + LittleLong(ss->Ofs_Triangles));
|
||||||
s->Tris.Resize(s->numTriangles);
|
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
|
// Load texture coordinates
|
||||||
md3_texcoord_t * tc = (md3_texcoord_t*)(((char*)ss) + LittleLong(ss->Ofs_Texcoord));
|
md3_texcoord_t * tc = (md3_texcoord_t*)(((char*)ss) + LittleLong(ss->Ofs_Texcoord));
|
||||||
s->Texcoords.Resize(s->numVertices);
|
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[ii].s = tc[ii].s;
|
||||||
s->Texcoords[i].t = tc[i].t;
|
s->Texcoords[ii].t = tc[ii].t;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load vertices and texture coordinates
|
// Load vertices and texture coordinates
|
||||||
md3_vertex_t * vt = (md3_vertex_t*)(((char*)ss) + LittleLong(ss->Ofs_XYZNormal));
|
md3_vertex_t * vt = (md3_vertex_t*)(((char*)ss) + LittleLong(ss->Ofs_XYZNormal));
|
||||||
s->Vertices.Resize(s->numVertices * Frames.Size());
|
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[ii].x = LittleShort(vt[ii].x) / 64.f;
|
||||||
s->Vertices[i].y = LittleShort(vt[i].y) / 64.f;
|
s->Vertices[ii].y = LittleShort(vt[ii].y) / 64.f;
|
||||||
s->Vertices[i].z = LittleShort(vt[i].z) / 64.f;
|
s->Vertices[ii].z = LittleShort(vt[ii].z) / 64.f;
|
||||||
UnpackVector(LittleShort(vt[i].n), s->Vertices[i].nx, s->Vertices[i].ny, s->Vertices[i].nz);
|
UnpackVector(LittleShort(vt[ii].n), s->Vertices[ii].nx, s->Vertices[ii].ny, s->Vertices[ii].nz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,25 @@
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Copyright(C) 2018 Marisa Kirisame
|
// Copyright (c) 2018-2022 Marisa Kirisame, UnSX Team
|
||||||
// All rights reserved.
|
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// it under the terms of the GNU Lesser General Public License as published by
|
// of this software and associated documentation files (the "Software"), to
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// deal in the Software without restriction, including without limitation the
|
||||||
// (at your option) any later version.
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
// sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
// furnished to do so, subject to the following conditions:
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// The above copyright notice and this permission notice shall be included in
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// all copies or substantial portions of the Software.
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Lesser General Public License for more details.
|
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Lesser General Public License
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
// IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// 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
|
// 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.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// 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 PivotX = mVoxel->Mips[0].Pivot.X;
|
||||||
float PivotY = mVoxel->Mips[0].Pivot.Y;
|
float PivotY = mVoxel->Mips[0].Pivot.Y;
|
||||||
float PivotZ = mVoxel->Mips[0].Pivot.Z;
|
float PivotZ = mVoxel->Mips[0].Pivot.Z;
|
||||||
int h = mVoxel->Mips[0].SizeZ;
|
|
||||||
FModelVertex vert;
|
FModelVertex vert;
|
||||||
unsigned int indx[4];
|
unsigned int indx[4];
|
||||||
|
|
||||||
|
@ -286,8 +285,8 @@ void FVoxelModel::MakeSlabPolys(int x, int y, kvxslab_t *voxptr, FVoxelMap &chec
|
||||||
}
|
}
|
||||||
if (cull & 32)
|
if (cull & 32)
|
||||||
{
|
{
|
||||||
int z = ztop+zleng-1;
|
int zz = 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);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,10 @@ namespace GC
|
||||||
{
|
{
|
||||||
MarkArray((DObject **)(obj), count);
|
MarkArray((DObject **)(obj), count);
|
||||||
}
|
}
|
||||||
|
template<class T> void MarkArray(TObjPtr<T>* obj, size_t count)
|
||||||
|
{
|
||||||
|
MarkArray((DObject**)(obj), count);
|
||||||
|
}
|
||||||
template<class T> void MarkArray(TArray<T> &arr)
|
template<class T> void MarkArray(TArray<T> &arr)
|
||||||
{
|
{
|
||||||
MarkArray(&arr[0], arr.Size());
|
MarkArray(&arr[0], arr.Size());
|
||||||
|
|
|
@ -182,7 +182,9 @@ void I_PrintStr(const char *cp)
|
||||||
if (*srcp == 0x1c && con_printansi && terminal)
|
if (*srcp == 0x1c && con_printansi && terminal)
|
||||||
{
|
{
|
||||||
srcp += 1;
|
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)
|
if (range != CR_UNDEFINED)
|
||||||
{
|
{
|
||||||
PalEntry color = V_LogColorFromColorRange(range);
|
PalEntry color = V_LogColorFromColorRange(range);
|
||||||
|
|
|
@ -279,7 +279,7 @@ void SystemBaseFrameBuffer::PositionWindow(bool fullscreen, bool initialcall)
|
||||||
RECT r;
|
RECT r;
|
||||||
LONG style, exStyle;
|
LONG style, exStyle;
|
||||||
|
|
||||||
RECT monRect;
|
RECT monRect = {};
|
||||||
|
|
||||||
if (!m_Fullscreen && fullscreen && !initialcall) SaveWindowedPos();
|
if (!m_Fullscreen && fullscreen && !initialcall) SaveWindowedPos();
|
||||||
if (m_Monitor)
|
if (m_Monitor)
|
||||||
|
|
|
@ -340,7 +340,7 @@ static HANDLE WriteMyMiniDump (void)
|
||||||
MINIDUMP_EXCEPTION_INFORMATION exceptor = { DbgThreadID, &CrashPointers, FALSE };
|
MINIDUMP_EXCEPTION_INFORMATION exceptor = { DbgThreadID, &CrashPointers, FALSE };
|
||||||
WCHAR dbghelpPath[MAX_PATH+12], *bs;
|
WCHAR dbghelpPath[MAX_PATH+12], *bs;
|
||||||
WRITEDUMP pMiniDumpWriteDump;
|
WRITEDUMP pMiniDumpWriteDump;
|
||||||
HANDLE file;
|
HANDLE file = INVALID_HANDLE_VALUE;
|
||||||
BOOL good = FALSE;
|
BOOL good = FALSE;
|
||||||
HMODULE dbghelp = NULL;
|
HMODULE dbghelp = NULL;
|
||||||
|
|
||||||
|
@ -710,14 +710,14 @@ HANDLE WriteTextReport ()
|
||||||
ctxt->Rip, ctxt->Rsp, ctxt->SegCs, ctxt->SegSs, ctxt->EFlags);
|
ctxt->Rip, ctxt->Rsp, ctxt->SegCs, ctxt->SegSs, ctxt->EFlags);
|
||||||
#endif
|
#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')
|
if (eflagsBits[i][0] != 'x')
|
||||||
{
|
{
|
||||||
Writef (file, " %c%c%c", eflagsBits[i][0], eflagsBits[i][1],
|
Writef (file, " %c%c%c", eflagsBits[i][0], eflagsBits[i][1],
|
||||||
ctxt->EFlags & j ? '+' : '-');
|
ctxt->EFlags & dw ? '+' : '-');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Writef (file, "\r\n");
|
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 };
|
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 --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
|
@ -514,8 +514,6 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
case WM_WTSSESSION_CHANGE:
|
case WM_WTSSESSION_CHANGE:
|
||||||
case WM_POWERBROADCAST:
|
case WM_POWERBROADCAST:
|
||||||
{
|
{
|
||||||
int oldstate = SessionState;
|
|
||||||
|
|
||||||
if (message == WM_WTSSESSION_CHANGE && lParam == (LPARAM)SessionID)
|
if (message == WM_WTSSESSION_CHANGE && lParam == (LPARAM)SessionID)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
|
|
@ -268,7 +268,6 @@ void I_CheckNativeMouse(bool preferNative, bool eventhandlerresult)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool pauseState = false;
|
|
||||||
bool captureModeInGame = sysCallbacks.CaptureModeInGame && sysCallbacks.CaptureModeInGame();
|
bool captureModeInGame = sysCallbacks.CaptureModeInGame && sysCallbacks.CaptureModeInGame();
|
||||||
want_native = ((!m_use_mouse || menuactive != MENU_WaitKey) &&
|
want_native = ((!m_use_mouse || menuactive != MENU_WaitKey) &&
|
||||||
(!captureModeInGame || GUICapture));
|
(!captureModeInGame || GUICapture));
|
||||||
|
|
|
@ -288,8 +288,8 @@ static void DoPrintStr(const char *cpt, HWND edit, HANDLE StdOut)
|
||||||
|
|
||||||
wchar_t wbuf[256];
|
wchar_t wbuf[256];
|
||||||
int bpos = 0;
|
int bpos = 0;
|
||||||
CHARRANGE selection;
|
CHARRANGE selection = {};
|
||||||
CHARRANGE endselection;
|
CHARRANGE endselection = {};
|
||||||
LONG lines_before = 0, lines_after;
|
LONG lines_before = 0, lines_after;
|
||||||
CHARFORMAT format;
|
CHARFORMAT format;
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ CUSTOM_CVAR(Int, showendoom, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
FStartupScreen *FStartupScreen::CreateInstance(int max_progress)
|
FStartupScreen *FStartupScreen::CreateInstance(int max_progress)
|
||||||
{
|
{
|
||||||
FStartupScreen *scr = NULL;
|
FStartupScreen *scr = NULL;
|
||||||
HRESULT hr;
|
HRESULT hr = -1;
|
||||||
|
|
||||||
if (!Args->CheckParm("-nostartup"))
|
if (!Args->CheckParm("-nostartup"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -751,9 +751,9 @@ FStrifeStartupScreen::FStrifeStartupScreen(int max_progress, long& hr)
|
||||||
|
|
||||||
if (lumpnum >= 0 && (lumplen = fileSystem.FileLength(lumpnum)) == StrifeStartupPicSizes[i])
|
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];
|
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;
|
int prof = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||||
const char *version = Args->CheckValue("-glversion");
|
|
||||||
|
|
||||||
|
|
||||||
for (; prof <= WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; prof++)
|
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;
|
if (mat->Source()->GetUseType() == ETextureType::SWCanvas) return;
|
||||||
|
|
||||||
int flags = mat->GetScaleFlags();
|
|
||||||
int numLayers = mat->NumLayers();
|
int numLayers = mat->NumLayers();
|
||||||
MaterialLayerInfo* layer;
|
MaterialLayerInfo* layer;
|
||||||
auto base = static_cast<FHardwareTexture*>(mat->GetLayer(0, translation, &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)
|
bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, int translation, int flags)
|
||||||
{
|
{
|
||||||
int usebright = false;
|
|
||||||
|
|
||||||
bool needmipmap = (clampmode <= CLAMP_XY) && !forcenofilter;
|
bool needmipmap = (clampmode <= CLAMP_XY) && !forcenofilter;
|
||||||
|
|
||||||
// Bind it to the system.
|
// Bind it to the system.
|
||||||
|
|
|
@ -444,8 +444,6 @@ bool FGLRenderBuffers::CheckFrameBufferCompleteness()
|
||||||
if (result == GL_FRAMEBUFFER_COMPLETE)
|
if (result == GL_FRAMEBUFFER_COMPLETE)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
bool FailedCreate = true;
|
|
||||||
|
|
||||||
if (gl_debug_level > 0)
|
if (gl_debug_level > 0)
|
||||||
{
|
{
|
||||||
FString error = "glCheckFramebufferStatus failed: ";
|
FString error = "glCheckFramebufferStatus failed: ";
|
||||||
|
|
|
@ -318,7 +318,6 @@ void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translatio
|
||||||
lastClamp = clampmode;
|
lastClamp = clampmode;
|
||||||
lastTranslation = translation;
|
lastTranslation = translation;
|
||||||
|
|
||||||
int usebright = false;
|
|
||||||
int maxbound = 0;
|
int maxbound = 0;
|
||||||
|
|
||||||
int numLayers = mat->NumLayers();
|
int numLayers = mat->NumLayers();
|
||||||
|
|
|
@ -620,7 +620,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
{
|
{
|
||||||
char stringbuf[20];
|
char stringbuf[20];
|
||||||
mysnprintf(stringbuf, 20, "texture%d", i);
|
mysnprintf(stringbuf, 20, "texture%d", i);
|
||||||
int tempindex = glGetUniformLocation(hShader, stringbuf);
|
tempindex = glGetUniformLocation(hShader, stringbuf);
|
||||||
if (tempindex > 0) glUniform1i(tempindex, i - 1);
|
if (tempindex > 0) glUniform1i(tempindex, i - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,8 +783,8 @@ void FShaderCollection::CompileShaders(EPassType passType)
|
||||||
mMaterialShaders.Push(shc);
|
mMaterialShaders.Push(shc);
|
||||||
if (i < SHADER_NoTexture)
|
if (i < SHADER_NoTexture)
|
||||||
{
|
{
|
||||||
FShader *shc = Compile(defaultshaders[i].ShaderName, defaultshaders[i].gettexelfunc, defaultshaders[i].lightfunc, defaultshaders[i].Defines, false, passType);
|
FShader *shc1 = Compile(defaultshaders[i].ShaderName, defaultshaders[i].gettexelfunc, defaultshaders[i].lightfunc, defaultshaders[i].Defines, false, passType);
|
||||||
mMaterialShadersNAT.Push(shc);
|
mMaterialShadersNAT.Push(shc1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,38 @@
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright(C) 2015 Christopher Bruns
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// 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
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Lesser General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Lesser General Public License
|
|
||||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
|
||||||
//
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
/*
|
/*
|
||||||
** gl_stereo3d.cpp
|
** gl_stereo.cpp
|
||||||
** Stereoscopic 3D API
|
** Stereoscopic 3D API
|
||||||
**
|
**
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
** Copyright 2015 Christopher Bruns
|
||||||
|
** Copyright 2016-2021 Christoph Oelckers
|
||||||
|
** All rights reserved.
|
||||||
|
**
|
||||||
|
** Redistribution and use in source and binary forms, with or without
|
||||||
|
** modification, are permitted provided that the following conditions
|
||||||
|
** are met:
|
||||||
|
**
|
||||||
|
** 1. Redistributions of source code must retain the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer.
|
||||||
|
** 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer in the
|
||||||
|
** documentation and/or other materials provided with the distribution.
|
||||||
|
** 3. The name of the author may not be used to endorse or promote products
|
||||||
|
** derived from this software without specific prior written permission.
|
||||||
|
**
|
||||||
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
**
|
||||||
|
**
|
||||||
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gl_system.h"
|
#include "gl_system.h"
|
||||||
|
|
|
@ -138,6 +138,7 @@ void OpenGLFrameBuffer::InitializeState()
|
||||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
if (gles.depthClampAvailable) glEnable(GL_DEPTH_CLAMP);
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
@ -286,7 +287,6 @@ void OpenGLFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
|
||||||
{
|
{
|
||||||
if (mat->Source()->GetUseType() == ETextureType::SWCanvas) return;
|
if (mat->Source()->GetUseType() == ETextureType::SWCanvas) return;
|
||||||
|
|
||||||
int flags = mat->GetScaleFlags();
|
|
||||||
int numLayers = mat->NumLayers();
|
int numLayers = mat->NumLayers();
|
||||||
MaterialLayerInfo* layer;
|
MaterialLayerInfo* layer;
|
||||||
auto base = static_cast<FHardwareTexture*>(mat->GetLayer(0, translation, &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
|
#if USE_GLES2
|
||||||
|
if (glTextureBytes == 1)
|
||||||
|
{
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
sourcetype = GL_ALPHA;
|
||||||
|
texformat = GL_ALPHA;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sourcetype = GL_BGRA;
|
sourcetype = GL_BGRA;
|
||||||
texformat = GL_BGRA;
|
texformat = GL_BGRA;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
if (glTextureBytes == 1)
|
if (glTextureBytes == 1)
|
||||||
{
|
{
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
sourcetype = GL_RED;
|
sourcetype = GL_RED;
|
||||||
texformat = GL_R8;
|
texformat = GL_RED;
|
||||||
}
|
}
|
||||||
else
|
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);
|
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 (deletebuffer && buffer) free(buffer);
|
||||||
|
|
||||||
if (mipmap && TexFilter[gl_texture_filter].mipmapping)
|
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)
|
void FHardwareTexture::AllocateBuffer(int w, int h, int texelsize)
|
||||||
{
|
{
|
||||||
int rw = GetTexDimension(w);
|
|
||||||
int rh = GetTexDimension(h);
|
|
||||||
|
|
||||||
if (texelsize < 1 || texelsize > 4) texelsize = 4;
|
if (texelsize < 1 || texelsize > 4) texelsize = 4;
|
||||||
glTextureBytes = texelsize;
|
glTextureBytes = texelsize;
|
||||||
bufferpitch = w;
|
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)
|
bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, int translation, int flags)
|
||||||
{
|
{
|
||||||
int usebright = false;
|
|
||||||
|
|
||||||
bool needmipmap = (clampmode <= CLAMP_XY) && !forcenofilter;
|
bool needmipmap = (clampmode <= CLAMP_XY) && !forcenofilter;
|
||||||
|
|
||||||
// Bind it to the system.
|
// 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++)
|
for (size_t n = 0; n < mPresentShader->Uniforms.mFields.size(); n++)
|
||||||
{
|
{
|
||||||
int index = -1;
|
|
||||||
UniformFieldDesc desc = mPresentShader->Uniforms.mFields[n];
|
UniformFieldDesc desc = mPresentShader->Uniforms.mFields[n];
|
||||||
int loc = mPresentShader->Uniforms.UniformLocation[n];
|
int loc = mPresentShader->Uniforms.UniformLocation[n];
|
||||||
switch (desc.Type)
|
switch (desc.Type)
|
||||||
|
|
|
@ -302,9 +302,6 @@ namespace OpenGLESRenderer
|
||||||
if (result == GL_FRAMEBUFFER_COMPLETE)
|
if (result == GL_FRAMEBUFFER_COMPLETE)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
bool FailedCreate = true;
|
|
||||||
|
|
||||||
|
|
||||||
FString error = "glCheckFramebufferStatus failed: ";
|
FString error = "glCheckFramebufferStatus failed: ";
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,7 +110,6 @@ FGLRenderer::~FGLRenderer()
|
||||||
|
|
||||||
bool FGLRenderer::StartOffscreen()
|
bool FGLRenderer::StartOffscreen()
|
||||||
{
|
{
|
||||||
bool firstBind = (mFBID == 0);
|
|
||||||
if (mFBID == 0)
|
if (mFBID == 0)
|
||||||
glGenFramebuffers(1, &mFBID);
|
glGenFramebuffers(1, &mFBID);
|
||||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &mOldFBID);
|
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &mOldFBID);
|
||||||
|
|
|
@ -158,6 +158,7 @@ bool FGLRenderState::ApplyShader()
|
||||||
|
|
||||||
|
|
||||||
flavour.blendFlags = (int)(mStreamData.uTextureAddColor.a + 0.01);
|
flavour.blendFlags = (int)(mStreamData.uTextureAddColor.a + 0.01);
|
||||||
|
flavour.paletteInterpolate = !!(flavour.blendFlags & 0x4000);
|
||||||
|
|
||||||
flavour.twoDFog = false;
|
flavour.twoDFog = false;
|
||||||
flavour.fogEnabled = false;
|
flavour.fogEnabled = false;
|
||||||
|
@ -389,8 +390,7 @@ void FGLRenderState::ApplyState()
|
||||||
mMaterial.mChanged = false;
|
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);
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
@ -402,7 +402,6 @@ void FGLRenderState::ApplyState()
|
||||||
glPolygonOffset(mBias.mFactor, mBias.mUnits);
|
glPolygonOffset(mBias.mFactor, mBias.mUnits);
|
||||||
mBias.mChanged = false;
|
mBias.mChanged = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void FGLRenderState::ApplyBuffers()
|
void FGLRenderState::ApplyBuffers()
|
||||||
{
|
{
|
||||||
|
@ -458,7 +457,6 @@ void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translatio
|
||||||
lastClamp = clampmode;
|
lastClamp = clampmode;
|
||||||
lastTranslation = translation;
|
lastTranslation = translation;
|
||||||
|
|
||||||
int usebright = false;
|
|
||||||
int maxbound = 0;
|
int maxbound = 0;
|
||||||
|
|
||||||
int numLayers = mat->NumLayers();
|
int numLayers = mat->NumLayers();
|
||||||
|
|
|
@ -392,7 +392,6 @@ bool FShader::Load(const char * name, const char * vert_prog_lump_, const char *
|
||||||
|
|
||||||
assert(screen->mLights != NULL);
|
assert(screen->mLights != NULL);
|
||||||
|
|
||||||
bool lightbuffertype = screen->mLights->GetBufferType();
|
|
||||||
unsigned int lightbuffersize = screen->mLights->GetBlockSize();
|
unsigned int lightbuffersize = screen->mLights->GetBlockSize();
|
||||||
|
|
||||||
vp_comb.Format("#version 100\n#define NUM_UBO_LIGHTS %d\n#define NO_CLIPDISTANCE_SUPPORT\n", lightbuffersize);
|
vp_comb.Format("#version 100\n#define NUM_UBO_LIGHTS %d\n#define NO_CLIPDISTANCE_SUPPORT\n", lightbuffersize);
|
||||||
|
@ -687,7 +686,7 @@ bool FShader::Bind(ShaderFlavourData& flavour)
|
||||||
variantConfig.AppendFormat("#define MAXIMUM_LIGHT_VECTORS %d\n", gles.numlightvectors);
|
variantConfig.AppendFormat("#define MAXIMUM_LIGHT_VECTORS %d\n", gles.numlightvectors);
|
||||||
variantConfig.AppendFormat("#define DEF_TEXTURE_MODE %d\n", flavour.textureMode);
|
variantConfig.AppendFormat("#define DEF_TEXTURE_MODE %d\n", flavour.textureMode);
|
||||||
variantConfig.AppendFormat("#define DEF_TEXTURE_FLAGS %d\n", flavour.texFlags);
|
variantConfig.AppendFormat("#define DEF_TEXTURE_FLAGS %d\n", flavour.texFlags);
|
||||||
variantConfig.AppendFormat("#define DEF_BLEND_FLAGS %d\n", flavour.blendFlags);
|
variantConfig.AppendFormat("#define DEF_BLEND_FLAGS %d\n", flavour.blendFlags & 0x7);
|
||||||
variantConfig.AppendFormat("#define DEF_FOG_2D %d\n", flavour.twoDFog);
|
variantConfig.AppendFormat("#define DEF_FOG_2D %d\n", flavour.twoDFog);
|
||||||
variantConfig.AppendFormat("#define DEF_FOG_ENABLED %d\n", flavour.fogEnabled);
|
variantConfig.AppendFormat("#define DEF_FOG_ENABLED %d\n", flavour.fogEnabled);
|
||||||
variantConfig.AppendFormat("#define DEF_FOG_RADIAL %d\n", flavour.fogEquationRadial);
|
variantConfig.AppendFormat("#define DEF_FOG_RADIAL %d\n", flavour.fogEquationRadial);
|
||||||
|
@ -715,6 +714,7 @@ bool FShader::Bind(ShaderFlavourData& flavour)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
variantConfig.AppendFormat("#define DEF_HAS_SPOTLIGHT %d\n", flavour.hasSpotLight);
|
variantConfig.AppendFormat("#define DEF_HAS_SPOTLIGHT %d\n", flavour.hasSpotLight);
|
||||||
|
variantConfig.AppendFormat("#define DEF_PALETTE_INTERPOLATE %d\n", flavour.paletteInterpolate);
|
||||||
|
|
||||||
//Printf("Shader: %s, %08x %s", mFragProg2.GetChars(), tag, variantConfig.GetChars());
|
//Printf("Shader: %s, %08x %s", mFragProg2.GetChars(), tag, variantConfig.GetChars());
|
||||||
|
|
||||||
|
@ -851,7 +851,7 @@ void FShaderCollection::CompileShaders(EPassType passType)
|
||||||
mMaterialShaders.Push(shc);
|
mMaterialShaders.Push(shc);
|
||||||
if (i < SHADER_NoTexture)
|
if (i < SHADER_NoTexture)
|
||||||
{
|
{
|
||||||
FShader *shc = Compile(defaultshaders[i].ShaderName, defaultshaders[i].gettexelfunc, defaultshaders[i].lightfunc, defaultshaders[i].Defines, false, passType);
|
shc = Compile(defaultshaders[i].ShaderName, defaultshaders[i].gettexelfunc, defaultshaders[i].lightfunc, defaultshaders[i].Defines, false, passType);
|
||||||
mMaterialShadersNAT.Push(shc);
|
mMaterialShadersNAT.Push(shc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,6 +277,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool hasSpotLight;
|
bool hasSpotLight;
|
||||||
|
bool paletteInterpolate;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FShader
|
class FShader
|
||||||
|
@ -419,8 +420,8 @@ public:
|
||||||
#ifdef NPOT_EMULATION
|
#ifdef NPOT_EMULATION
|
||||||
tag |= (flavour.npotEmulation & 1) << 22;
|
tag |= (flavour.npotEmulation & 1) << 22;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tag |= (flavour.hasSpotLight & 1) << 23;
|
tag |= (flavour.hasSpotLight & 1) << 23;
|
||||||
|
tag |= (flavour.paletteInterpolate & 1) << 24;
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,6 @@ std::pair<FFlatVertex *, unsigned int> FFlatVertexBuffer::AllocVertices(unsigned
|
||||||
{
|
{
|
||||||
FFlatVertex *p = GetBuffer();
|
FFlatVertex *p = GetBuffer();
|
||||||
auto index = mCurIndex.fetch_add(count);
|
auto index = mCurIndex.fetch_add(count);
|
||||||
auto offset = index;
|
|
||||||
if (index + count >= BUFFER_SIZE_TO_USE)
|
if (index + count >= BUFFER_SIZE_TO_USE)
|
||||||
{
|
{
|
||||||
// If a single scene needs 2'000'000 vertices there must be something very wrong.
|
// If a single scene needs 2'000'000 vertices there must be something very wrong.
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#ifndef __GLC_DYNLIGHT_H
|
#ifndef __GLC_DYNLIGHT_H
|
||||||
#define __GLC_DYNLIGHT_H
|
#define __GLC_DYNLIGHT_H
|
||||||
|
|
||||||
|
#include "tarray.h"
|
||||||
|
|
||||||
struct FDynLightData
|
struct FDynLightData
|
||||||
{
|
{
|
||||||
TArray<float> arrays[3];
|
TArray<float> arrays[3];
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// 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
|
// 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.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// 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
|
// 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.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
|
|
@ -152,7 +152,7 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
|
||||||
char *chars = code.LockBuffer();
|
char *chars = code.LockBuffer();
|
||||||
|
|
||||||
ptrdiff_t startIndex = 0;
|
ptrdiff_t startIndex = 0;
|
||||||
ptrdiff_t startpos, endpos;
|
ptrdiff_t startpos, endpos = 0;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
ptrdiff_t matchIndex = code.IndexOf("layout(binding", startIndex);
|
ptrdiff_t matchIndex = code.IndexOf("layout(binding", startIndex);
|
||||||
|
@ -188,10 +188,10 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
|
||||||
if (isSamplerUniformName)
|
if (isSamplerUniformName)
|
||||||
{
|
{
|
||||||
samplerstobind.Push(std::make_pair(identifier, val));
|
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]))
|
if (!IsGlslWhitespace(chars[posi]))
|
||||||
chars[pos] = ' ';
|
chars[posi] = ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,6 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
|
||||||
|
|
||||||
FString RemoveLayoutLocationDecl(FString code, const char *inoutkeyword)
|
FString RemoveLayoutLocationDecl(FString code, const char *inoutkeyword)
|
||||||
{
|
{
|
||||||
ptrdiff_t len = code.Len();
|
|
||||||
char *chars = code.LockBuffer();
|
char *chars = code.LockBuffer();
|
||||||
|
|
||||||
ptrdiff_t startIndex = 0;
|
ptrdiff_t startIndex = 0;
|
||||||
|
@ -255,8 +254,8 @@ FString RemoveLayoutLocationDecl(FString code, const char *inoutkeyword)
|
||||||
if (keywordFound && IsGlslWhitespace(chars[endIndex + i]))
|
if (keywordFound && IsGlslWhitespace(chars[endIndex + i]))
|
||||||
{
|
{
|
||||||
// yes - replace declaration with spaces
|
// yes - replace declaration with spaces
|
||||||
for (auto i = matchIndex; i < endIndex; i++)
|
for (auto ii = matchIndex; ii < endIndex; ii++)
|
||||||
chars[i] = ' ';
|
chars[ii] = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
startIndex = endIndex;
|
startIndex = endIndex;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "hw_aabbtree.h"
|
#include "hw_aabbtree.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
class IDataBuffer;
|
class IDataBuffer;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// 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
|
// 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.
|
// (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
|
|
@ -1,27 +1,36 @@
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright(C) 2015 Christopher Bruns
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// 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
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Lesser General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Lesser General Public License
|
|
||||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
|
||||||
//
|
|
||||||
//--------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
/*
|
/*
|
||||||
** gl_stereo_leftright.cpp
|
** hw_vrmodes.cpp
|
||||||
** Offsets for left and right eye views
|
** Matrix handling for stereo 3D rendering
|
||||||
|
**
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
** Copyright 2015 Christopher Bruns
|
||||||
|
** Copyright 2016-2021 Christoph Oelckers
|
||||||
|
** All rights reserved.
|
||||||
|
**
|
||||||
|
** Redistribution and use in source and binary forms, with or without
|
||||||
|
** modification, are permitted provided that the following conditions
|
||||||
|
** are met:
|
||||||
|
**
|
||||||
|
** 1. Redistributions of source code must retain the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer.
|
||||||
|
** 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer in the
|
||||||
|
** documentation and/or other materials provided with the distribution.
|
||||||
|
** 3. The name of the author may not be used to endorse or promote products
|
||||||
|
** derived from this software without specific prior written permission.
|
||||||
|
**
|
||||||
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
**
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -154,9 +163,9 @@ VSMatrix VREyeInfo::GetProjection(float fov, float aspectRatio, float fovRatio)
|
||||||
double bottom = -fH;
|
double bottom = -fH;
|
||||||
double top = fH;
|
double top = fH;
|
||||||
|
|
||||||
VSMatrix result(1);
|
VSMatrix fmat(1);
|
||||||
result.frustum((float)left, (float)right, (float)bottom, (float)top, (float)zNear, (float)zFar);
|
fmat.frustum((float)left, (float)right, (float)bottom, (float)top, (float)zNear, (float)zFar);
|
||||||
return result;
|
return fmat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,6 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
|
||||||
for(auto &cmd : commands)
|
for(auto &cmd : commands)
|
||||||
{
|
{
|
||||||
|
|
||||||
int gltrans = -1;
|
|
||||||
state.SetRenderStyle(cmd.mRenderStyle);
|
state.SetRenderStyle(cmd.mRenderStyle);
|
||||||
state.EnableBrightmap(!(cmd.mRenderStyle.Flags & STYLEF_ColorIsFixed));
|
state.EnableBrightmap(!(cmd.mRenderStyle.Flags & STYLEF_ColorIsFixed));
|
||||||
state.EnableFog(2); // Special 2D mode 'fog'.
|
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.
|
// minimum set in GZDoom 4.0.0, but only while those fonts are required.
|
||||||
|
|
||||||
static bool lastspecialUI = false;
|
static bool lastspecialUI = false;
|
||||||
bool isInActualMenu = false;
|
|
||||||
|
|
||||||
bool specialUI = (!sysCallbacks.IsSpecialUI || sysCallbacks.IsSpecialUI());
|
bool specialUI = (!sysCallbacks.IsSpecialUI || sysCallbacks.IsSpecialUI());
|
||||||
|
|
||||||
|
|
|
@ -374,8 +374,6 @@ void V_InitScreen()
|
||||||
|
|
||||||
void V_Init2()
|
void V_Init2()
|
||||||
{
|
{
|
||||||
float gamma = static_cast<DDummyFrameBuffer *>(screen)->Gamma;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
DFrameBuffer *s = screen;
|
DFrameBuffer *s = screen;
|
||||||
screen = NULL;
|
screen = NULL;
|
||||||
|
|
|
@ -255,12 +255,12 @@ void VkRenderBuffers::CreateShadowmap()
|
||||||
|
|
||||||
if (!ShadowmapSampler)
|
if (!ShadowmapSampler)
|
||||||
{
|
{
|
||||||
SamplerBuilder builder;
|
SamplerBuilder samplerBuilder;
|
||||||
builder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST);
|
samplerBuilder.setMipmapMode(VK_SAMPLER_MIPMAP_MODE_NEAREST);
|
||||||
builder.setMinFilter(VK_FILTER_NEAREST);
|
samplerBuilder.setMinFilter(VK_FILTER_NEAREST);
|
||||||
builder.setMagFilter(VK_FILTER_NEAREST);
|
samplerBuilder.setMagFilter(VK_FILTER_NEAREST);
|
||||||
builder.setAddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE);
|
samplerBuilder.setAddressMode(VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE);
|
||||||
ShadowmapSampler = builder.create(fb->device);
|
ShadowmapSampler = samplerBuilder.create(fb->device);
|
||||||
ShadowmapSampler->SetDebugName("VkRenderBuffers.ShadowmapSampler");
|
ShadowmapSampler->SetDebugName("VkRenderBuffers.ShadowmapSampler");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,20 +325,20 @@ void VulkanDevice::CreateInstance()
|
||||||
|
|
||||||
if (debugLayerFound)
|
if (debugLayerFound)
|
||||||
{
|
{
|
||||||
VkDebugUtilsMessengerCreateInfoEXT createInfo = {};
|
VkDebugUtilsMessengerCreateInfoEXT dbgCreateInfo = {};
|
||||||
createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT;
|
dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT;
|
||||||
createInfo.messageSeverity =
|
dbgCreateInfo.messageSeverity =
|
||||||
//VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT |
|
//VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT |
|
||||||
//VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT |
|
//VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT |
|
||||||
VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
|
VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
|
||||||
VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_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_GENERAL_BIT_EXT |
|
||||||
VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
|
VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
|
||||||
VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
|
VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
|
||||||
createInfo.pfnUserCallback = DebugCallback;
|
dbgCreateInfo.pfnUserCallback = DebugCallback;
|
||||||
createInfo.pUserData = this;
|
dbgCreateInfo.pUserData = this;
|
||||||
result = vkCreateDebugUtilsMessengerEXT(instance, &createInfo, nullptr, &debugMessenger);
|
result = vkCreateDebugUtilsMessengerEXT(instance, &dbgCreateInfo, nullptr, &debugMessenger);
|
||||||
CheckVulkanError(result, "vkCreateDebugUtilsMessengerEXT failed");
|
CheckVulkanError(result, "vkCreateDebugUtilsMessengerEXT failed");
|
||||||
|
|
||||||
DebugLayerActive = true;
|
DebugLayerActive = true;
|
||||||
|
@ -347,8 +347,6 @@ void VulkanDevice::CreateInstance()
|
||||||
|
|
||||||
VkBool32 VulkanDevice::DebugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT* callbackData, void* userData)
|
VkBool32 VulkanDevice::DebugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT* callbackData, void* userData)
|
||||||
{
|
{
|
||||||
VulkanDevice *device = (VulkanDevice*)userData;
|
|
||||||
|
|
||||||
static std::mutex mtx;
|
static std::mutex mtx;
|
||||||
static std::set<FString> seenMessages;
|
static std::set<FString> seenMessages;
|
||||||
static int totalMessages;
|
static int totalMessages;
|
||||||
|
|
|
@ -392,8 +392,8 @@ void VulkanFrameBuffer::PrecacheMaterial(FMaterial *mat, int translation)
|
||||||
int numLayers = mat->NumLayers();
|
int numLayers = mat->NumLayers();
|
||||||
for (int i = 1; i < numLayers; i++)
|
for (int i = 1; i < numLayers; i++)
|
||||||
{
|
{
|
||||||
auto systex = static_cast<VkHardwareTexture*>(mat->GetLayer(i, 0, &layer));
|
auto syslayer = static_cast<VkHardwareTexture*>(mat->GetLayer(i, 0, &layer));
|
||||||
systex->GetImage(layer->layerTexture, 0, layer->scaleFlags);
|
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 buffer = new VKDataBuffer(bindingpoint, ssbo, needsresize);
|
||||||
|
|
||||||
auto fb = GetVulkanFrameBuffer();
|
|
||||||
switch (bindingpoint)
|
switch (bindingpoint)
|
||||||
{
|
{
|
||||||
case LIGHTBUF_BINDINGPOINT: LightBufferSSO = buffer; break;
|
case LIGHTBUF_BINDINGPOINT: LightBufferSSO = buffer; break;
|
||||||
|
|
|
@ -407,18 +407,18 @@ VulkanDescriptorSet* VkMaterial::GetDescriptorSet(const FMaterialState& state)
|
||||||
{
|
{
|
||||||
for (int i = 1; i < numLayers; i++)
|
for (int i = 1; i < numLayers; i++)
|
||||||
{
|
{
|
||||||
auto systex = static_cast<VkHardwareTexture*>(GetLayer(i, 0, &layer));
|
auto syslayer = static_cast<VkHardwareTexture*>(GetLayer(i, 0, &layer));
|
||||||
auto systeximage = systex->GetImage(layer->layerTexture, 0, layer->scaleFlags);
|
auto syslayerimage = syslayer->GetImage(layer->layerTexture, 0, layer->scaleFlags);
|
||||||
update.addCombinedImageSampler(descriptor.get(), i, systeximage->View.get(), sampler, systeximage->Layout);
|
update.addCombinedImageSampler(descriptor.get(), i, syslayerimage->View.get(), sampler, syslayerimage->Layout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 1; i < 3; i++)
|
for (int i = 1; i < 3; i++)
|
||||||
{
|
{
|
||||||
auto systex = static_cast<VkHardwareTexture*>(GetLayer(i, translation, &layer));
|
auto syslayer = static_cast<VkHardwareTexture*>(GetLayer(i, translation, &layer));
|
||||||
auto systeximage = systex->GetImage(layer->layerTexture, 0, layer->scaleFlags);
|
auto syslayerimage = syslayer->GetImage(layer->layerTexture, 0, layer->scaleFlags);
|
||||||
update.addCombinedImageSampler(descriptor.get(), i, systeximage->View.get(), sampler, systeximage->Layout);
|
update.addCombinedImageSampler(descriptor.get(), i, syslayerimage->View.get(), sampler, syslayerimage->Layout);
|
||||||
}
|
}
|
||||||
numLayers = 3;
|
numLayers = 3;
|
||||||
}
|
}
|
||||||
|
|
|
@ -522,10 +522,10 @@ FxExpression *FxConstant::MakeConstant(PSymbol *sym, const FScriptPosition &pos)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PSymbolConstString *csym = dyn_cast<PSymbolConstString>(sym);
|
PSymbolConstString *csymbol = dyn_cast<PSymbolConstString>(sym);
|
||||||
if (csym != nullptr)
|
if (csymbol != nullptr)
|
||||||
{
|
{
|
||||||
x = new FxConstant(csym->Str, pos);
|
x = new FxConstant(csymbol->Str, pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2436,7 +2436,7 @@ ExpEmit FxAssign::Emit(VMFunctionBuilder *build)
|
||||||
|
|
||||||
ExpEmit result;
|
ExpEmit result;
|
||||||
bool intconst = false;
|
bool intconst = false;
|
||||||
int intconstval;
|
int intconstval = 0;
|
||||||
|
|
||||||
if (Right->isConstant() && Right->ValueType->GetRegType() == REGT_INT)
|
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_LI, to.RegNum, (Operator == TK_AndAnd) ? 1 : 0);
|
||||||
build->Emit(OP_JMP, 1);
|
build->Emit(OP_JMP, 1);
|
||||||
build->BackpatchListToHere(no);
|
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.DeleteAndClear();
|
||||||
list.ShrinkToFit();
|
list.ShrinkToFit();
|
||||||
return to;
|
return to;
|
||||||
|
@ -5134,7 +5134,7 @@ ExpEmit FxNew::Emit(VMFunctionBuilder *build)
|
||||||
int outerside = -1;
|
int outerside = -1;
|
||||||
if (!val->isConstant())
|
if (!val->isConstant())
|
||||||
{
|
{
|
||||||
int outerside = FScopeBarrier::SideFromFlags(CallingFunction->Variants[0].Flags);
|
outerside = FScopeBarrier::SideFromFlags(CallingFunction->Variants[0].Flags);
|
||||||
if (outerside == FScopeBarrier::Side_Virtual)
|
if (outerside == FScopeBarrier::Side_Virtual)
|
||||||
outerside = FScopeBarrier::SideFromObjectFlags(CallingFunction->OwningClass->ScopeFlags);
|
outerside = FScopeBarrier::SideFromObjectFlags(CallingFunction->OwningClass->ScopeFlags);
|
||||||
}
|
}
|
||||||
|
@ -5569,8 +5569,6 @@ FxExpression *FxRandomPick::Resolve(FCompileContext &ctx)
|
||||||
|
|
||||||
ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build)
|
ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build)
|
||||||
{
|
{
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
assert(choices.Size() > 0);
|
assert(choices.Size() > 0);
|
||||||
|
|
||||||
// Call BuiltinRandom to generate a random number.
|
// Call BuiltinRandom to generate a random number.
|
||||||
|
@ -5603,7 +5601,7 @@ ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build)
|
||||||
|
|
||||||
// Allocate space for the jump table.
|
// Allocate space for the jump table.
|
||||||
size_t jumptable = build->Emit(OP_JMP, 0);
|
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);
|
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.
|
// 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]);
|
build->BackpatchToHere(finishes[i]);
|
||||||
}
|
}
|
||||||
|
@ -7855,8 +7853,8 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
||||||
}
|
}
|
||||||
else if (!ArgList.Size())
|
else if (!ArgList.Size())
|
||||||
{
|
{
|
||||||
auto cls = static_cast<PClassType*>(ctx.Class)->Descriptor;
|
auto clss = static_cast<PClassType*>(ctx.Class)->Descriptor;
|
||||||
ArgList.Push(new FxConstant(cls, NewClassPointer(cls), ScriptPosition));
|
ArgList.Push(new FxConstant(clss, NewClassPointer(clss), ScriptPosition));
|
||||||
}
|
}
|
||||||
|
|
||||||
func = new FxNew(ArgList[0]);
|
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.
|
// 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.
|
Self->ValueType = TypeSInt32; // all builtins treat the texture index as integer.
|
||||||
FxExpression *x;
|
FxExpression *x = nullptr;
|
||||||
switch (MethodName.GetIndex())
|
switch (MethodName.GetIndex())
|
||||||
{
|
{
|
||||||
case NAME_IsValid:
|
case NAME_IsValid:
|
||||||
|
@ -8369,8 +8367,8 @@ isresolved:
|
||||||
if (!novirtual || !(afd->Variants[0].Flags & VARF_Virtual))
|
if (!novirtual || !(afd->Variants[0].Flags & VARF_Virtual))
|
||||||
{
|
{
|
||||||
auto clstype = PType::toClass(ctx.Class);
|
auto clstype = PType::toClass(ctx.Class);
|
||||||
auto ccls = PType::toClass(cls);
|
auto cclss = PType::toClass(cls);
|
||||||
if (clstype == nullptr || ccls == nullptr || !clstype->Descriptor->IsDescendantOf(ccls->Descriptor))
|
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());
|
ScriptPosition.Message(MSG_ERROR, "Cannot call non-static function %s::%s from here", cls->TypeName.GetChars(), MethodName.GetChars());
|
||||||
delete this;
|
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.
|
// This must ensure that all new entries get cleared.
|
||||||
const int fillCount = int(self->Size() - oldSize);
|
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)
|
void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction *func)
|
||||||
{
|
{
|
||||||
VMFunction *callfunc;
|
VMFunction *callfunc = nullptr;
|
||||||
const char *name;
|
const char *name;
|
||||||
int col;
|
int col;
|
||||||
int mode;
|
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);
|
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());
|
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:
|
default:
|
||||||
return col+printf_wrapper(out, "$%d", arg);
|
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)
|
if (ast.TopNode != NULL)
|
||||||
{
|
{
|
||||||
ZCC_TreeNode *node = ast.TopNode;
|
ZCC_TreeNode *node = ast.TopNode;
|
||||||
PSymbolTreeNode *tnode;
|
PSymbolTreeNode *tnode = nullptr;
|
||||||
|
|
||||||
// [pbeta] Anything that must be processed before classes, structs, etc. should go here.
|
// [pbeta] Anything that must be processed before classes, structs, etc. should go here.
|
||||||
do
|
do
|
||||||
|
@ -606,7 +606,6 @@ PSymbolTreeNode *ZCCCompiler::AddTreeNode(FName name, ZCC_TreeNode *node, PSymbo
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto sy = Create<PSymbolTreeNode>(name, node);
|
auto sy = Create<PSymbolTreeNode>(name, node);
|
||||||
FString name;
|
|
||||||
treenodes->AddSymbol(sy);
|
treenodes->AddSymbol(sy);
|
||||||
return sy;
|
return sy;
|
||||||
}
|
}
|
||||||
|
@ -1930,19 +1929,19 @@ PType *ZCCCompiler::ResolveArraySize(PType *baseType, ZCC_Expression *arraysize,
|
||||||
if (mVersion >= MakeVersion(3, 7, 2))
|
if (mVersion >= MakeVersion(3, 7, 2))
|
||||||
{
|
{
|
||||||
TArray<ZCC_Expression *> fixedIndices;
|
TArray<ZCC_Expression *> fixedIndices;
|
||||||
for (auto node : indices)
|
for (auto index : indices)
|
||||||
{
|
{
|
||||||
fixedIndices.Insert (0, node);
|
fixedIndices.Insert (0, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
indices = std::move(fixedIndices);
|
indices = std::move(fixedIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
FCompileContext ctx(OutNamespace, cls, false);
|
FCompileContext ctx(OutNamespace, cls, false);
|
||||||
for (auto node : indices)
|
for (auto index : indices)
|
||||||
{
|
{
|
||||||
// There is no float->int casting here.
|
// There is no float->int casting here.
|
||||||
FxExpression *ex = ConvertNode(node);
|
FxExpression *ex = ConvertNode(index);
|
||||||
ex = ex->Resolve(ctx);
|
ex = ex->Resolve(ctx);
|
||||||
|
|
||||||
if (ex == nullptr) return TypeError;
|
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;
|
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.
|
// specifying 'override' is necessary to prevent one of the biggest problem spots with virtual inheritance: Mismatching argument types.
|
||||||
if (varflags & VARF_Override)
|
if (varflags & VARF_Override)
|
||||||
{
|
{
|
||||||
if (vindex == -1)
|
if (virtindex == -1)
|
||||||
{
|
{
|
||||||
Error(f, "Attempt to override non-existent virtual function %s", FName(f->Name).GetChars());
|
Error(f, "Attempt to override non-existent virtual function %s", FName(f->Name).GetChars());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto oldfunc = clstype->Virtuals[vindex];
|
auto oldfunc = clstype->Virtuals[virtindex];
|
||||||
if (parentfunc && parentfunc->mVersion > mVersion)
|
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);
|
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)
|
if (oldfunc->VarFlags & VARF_Protected)
|
||||||
sym->Variants[0].Flags |= VARF_Protected;
|
sym->Variants[0].Flags |= VARF_Protected;
|
||||||
|
|
||||||
clstype->Virtuals[vindex] = sym->Variants[0].Implementation;
|
clstype->Virtuals[virtindex] = sym->Variants[0].Implementation;
|
||||||
sym->Variants[0].Implementation->VirtualIndex = vindex;
|
sym->Variants[0].Implementation->VirtualIndex = virtindex;
|
||||||
sym->Variants[0].Implementation->VarFlags = sym->Variants[0].Flags;
|
sym->Variants[0].Implementation->VarFlags = sym->Variants[0].Flags;
|
||||||
|
|
||||||
// Defaults must be identical to parent class
|
// Defaults must be identical to parent class
|
||||||
|
@ -2493,7 +2492,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (vindex != -1)
|
if (virtindex != -1)
|
||||||
{
|
{
|
||||||
Error(f, "Function %s attempts to override parent function without 'override' qualifier", FName(f->Name).GetChars());
|
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)
|
else if (forclass)
|
||||||
{
|
{
|
||||||
int vindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], nullptr, exactReturnType);
|
int virtindex = clstype->FindVirtualIndex(sym->SymbolName, &sym->Variants[0], nullptr, exactReturnType);
|
||||||
if (vindex != -1)
|
if (virtindex != -1)
|
||||||
{
|
{
|
||||||
Error(f, "Function %s attempts to override parent function without 'override' qualifier", FName(f->Name).GetChars());
|
Error(f, "Function %s attempts to override parent function without 'override' qualifier", FName(f->Name).GetChars());
|
||||||
}
|
}
|
||||||
|
|
|
@ -831,10 +831,10 @@ public:
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
IMAGEHLP_LINE64 line64;
|
IMAGEHLP_LINE64 line64;
|
||||||
DWORD displacement = 0;
|
DWORD displacement1 = 0;
|
||||||
memset(&line64, 0, sizeof(IMAGEHLP_LINE64));
|
memset(&line64, 0, sizeof(IMAGEHLP_LINE64));
|
||||||
line64.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
|
line64.SizeOfStruct = sizeof(IMAGEHLP_LINE64);
|
||||||
result = SymGetLineFromAddr64(GetCurrentProcess(), (DWORD64)frame, &displacement, &line64);
|
result = SymGetLineFromAddr64(GetCurrentProcess(), (DWORD64)frame, &displacement1, &line64);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
s.Format("Called from %s at %s, line %d\n", symbol64->Name, line64.FileName, (int)line64.LineNumber);
|
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;
|
VMFunction *call = (VMFunction *)ptr;
|
||||||
VMReturn returns[MAX_RETURNS];
|
VMReturn returns[MAX_RETURNS];
|
||||||
int numret;
|
int numret1;
|
||||||
|
|
||||||
b = B;
|
b = B;
|
||||||
FillReturns(reg, f, returns, pc+1, C);
|
FillReturns(reg, f, returns, pc+1, C);
|
||||||
|
@ -701,7 +701,7 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
VMCycles[0].Unclock();
|
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();
|
VMCycles[0].Clock();
|
||||||
}
|
}
|
||||||
catch (CVMAbortException &err)
|
catch (CVMAbortException &err)
|
||||||
|
@ -714,10 +714,10 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto sfunc = static_cast<VMScriptFunction *>(call);
|
auto sfunc1 = static_cast<VMScriptFunction *>(call);
|
||||||
numret = sfunc->ScriptCall(sfunc, reg.param + f->NumParam - b, b, returns, C);
|
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;
|
f->NumParam -= B;
|
||||||
pc += C; // Skip RESULTs
|
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
|
// chosen to conserve a few opcodes by condensing all the
|
||||||
// string comparisons into a single one.
|
// string comparisons into a single one.
|
||||||
{
|
{
|
||||||
const FString *b, *c;
|
const FString *b1, *c1;
|
||||||
int test, method;
|
int test, method;
|
||||||
bool cmp;
|
bool cmp;
|
||||||
|
|
||||||
if (a & CMP_BK)
|
if (a & CMP_BK)
|
||||||
{
|
{
|
||||||
ASSERTKS(B);
|
ASSERTKS(B);
|
||||||
b = &konsts[B];
|
b1 = &konsts[B];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ASSERTS(B);
|
ASSERTS(B);
|
||||||
b = ®.s[B];
|
b1 = ®.s[B];
|
||||||
}
|
}
|
||||||
if (a & CMP_CK)
|
if (a & CMP_CK)
|
||||||
{
|
{
|
||||||
ASSERTKS(C);
|
ASSERTKS(C);
|
||||||
c = &konsts[C];
|
c1 = &konsts[C];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ASSERTS(C);
|
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;
|
method = a & CMP_METHOD_MASK;
|
||||||
if (method == CMP_EQ)
|
if (method == CMP_EQ)
|
||||||
{
|
{
|
||||||
|
@ -1302,12 +1302,10 @@ static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
|
||||||
ASSERTF(a); ASSERTF(B); ASSERTKF(C);
|
ASSERTF(a); ASSERTF(B); ASSERTKF(C);
|
||||||
fb = reg.f[B]; fc = konstf[C];
|
fb = reg.f[B]; fc = konstf[C];
|
||||||
goto Do_MODF;
|
goto Do_MODF;
|
||||||
NEXTOP;
|
|
||||||
OP(MODF_KR):
|
OP(MODF_KR):
|
||||||
ASSERTF(a); ASSERTKF(B); ASSERTF(C);
|
ASSERTF(a); ASSERTKF(B); ASSERTF(C);
|
||||||
fb = konstf[B]; fc = reg.f[C];
|
fb = konstf[B]; fc = reg.f[C];
|
||||||
goto Do_MODF;
|
goto Do_MODF;
|
||||||
NEXTOP;
|
|
||||||
|
|
||||||
OP(POWF_RR):
|
OP(POWF_RR):
|
||||||
ASSERTF(a); ASSERTF(B); ASSERTF(C);
|
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);
|
// PrintParameters(reg.param + f->NumParam - B, B);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static double DoFLOP(int flop, double v)
|
static double DoFLOP(int flop, double v)
|
||||||
|
|
|
@ -694,7 +694,6 @@ void ThrowAbortException(EVMAbortException reason, const char *moreinfo, ...)
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, moreinfo);
|
va_start(ap, moreinfo);
|
||||||
throw CVMAbortException(reason, moreinfo, ap);
|
throw CVMAbortException(reason, moreinfo, ap);
|
||||||
va_end(ap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThrowAbortException(VMScriptFunction *sfunc, VMOP *line, EVMAbortException reason, const char *moreinfo, ...)
|
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));
|
err.stacktrace.AppendFormat("Called from %s at %s, line %d\n", sfunc->PrintableName.GetChars(), sfunc->SourceFileName.GetChars(), sfunc->PCToLine(line));
|
||||||
throw err;
|
throw err;
|
||||||
va_end(ap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(DObject, ThrowAbortException)
|
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 texheight = tex->GetDisplayHeight() * scaleY;
|
||||||
double texleftoffs = tex->GetDisplayLeftOffset() * scaleY;
|
double texleftoffs = tex->GetDisplayLeftOffset() * scaleY;
|
||||||
double textopoffs = tex->GetDisplayTopOffset() * scaleY;
|
double textopoffs = tex->GetDisplayTopOffset() * scaleY;
|
||||||
double boxleftoffs, boxtopoffs;
|
double boxleftoffs = 0, boxtopoffs = 0;
|
||||||
|
|
||||||
if (boxwidth > 0 || boxheight > 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 texwidth = tex->GetDisplayWidth() * scaleX;
|
||||||
double texheight = tex->GetDisplayHeight() * scaleY;
|
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.
|
// resolve auto-alignment before making any adjustments to the position values.
|
||||||
if (!(flags & DI_SCREEN_MANUAL_ALIGN))
|
if (!(flags & DI_SCREEN_MANUAL_ALIGN))
|
||||||
|
@ -754,7 +752,7 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
|
||||||
{
|
{
|
||||||
if (ch == ' ')
|
if (ch == ' ')
|
||||||
{
|
{
|
||||||
x += (monospaced ? spacing : font->GetSpaceWidth() + spacing) * scaleX;
|
x += monospaced ? spacing : font->GetSpaceWidth() + spacing;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (ch == TEXTCOLOR_ESCAPE)
|
else if (ch == TEXTCOLOR_ESCAPE)
|
||||||
|
@ -774,7 +772,7 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
|
||||||
width += font->GetDefaultKerning();
|
width += font->GetDefaultKerning();
|
||||||
|
|
||||||
if (!monospaced) //If we are monospaced lets use the offset
|
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;
|
double rx, ry, rw, rh;
|
||||||
rx = x + drawOffset.X;
|
rx = x + drawOffset.X;
|
||||||
|
@ -825,12 +823,12 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
|
||||||
DTA_LegacyRenderStyle, ERenderStyle(style),
|
DTA_LegacyRenderStyle, ERenderStyle(style),
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
|
||||||
// Take text scale into account
|
|
||||||
dx = monospaced
|
dx = monospaced
|
||||||
? spacing * scaleX
|
? spacing
|
||||||
: (double(width) + spacing - c->GetDisplayLeftOffset()) * scaleX - 1;
|
: 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 i;
|
||||||
int fac;
|
int fac;
|
||||||
uint8_t r,g,b;
|
uint8_t r,g,b;
|
||||||
int gray;
|
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
switch(inf? inf->blend : BLEND_NONE)
|
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);
|
a = TSrc::A(pin, tr, tg, tb);
|
||||||
if (TBlend::ProcessAlpha0() || a)
|
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];
|
PalEntry pe = cm->GrayscaleToColor[gray];
|
||||||
TBlend::OpC(pout[TDest::RED], pe.r , a, inf);
|
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);
|
a = TSrc::A(pin, tr, tg, tb);
|
||||||
if (TBlend::ProcessAlpha0() || a)
|
if (TBlend::ProcessAlpha0() || a)
|
||||||
{
|
{
|
||||||
gray = TSrc::Gray(pin);
|
int gray = TSrc::Gray(pin);
|
||||||
r = (TSrc::R(pin)*(31-fac) + gray*fac)/31;
|
r = (TSrc::R(pin)*(31-fac) + gray*fac)/31;
|
||||||
g = (TSrc::G(pin)*(31-fac) + gray*fac)/31;
|
g = (TSrc::G(pin)*(31-fac) + gray*fac)/31;
|
||||||
b = (TSrc::B(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)
|
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 *in = buff;
|
||||||
uint8_t *out = Pixels.Data() + y;
|
uint8_t *out = Pixels.Data() + y;
|
||||||
switch (cinfo.out_color_space)
|
switch (cinfo.out_color_space)
|
||||||
|
|
|
@ -120,6 +120,7 @@ struct BuildInfo
|
||||||
bool bComplex = false;
|
bool bComplex = false;
|
||||||
bool textual = false;
|
bool textual = false;
|
||||||
bool bNoDecals = false;
|
bool bNoDecals = false;
|
||||||
|
bool bNoTrim = false;
|
||||||
int LeftOffset[2] = {};
|
int LeftOffset[2] = {};
|
||||||
int TopOffset[2] = {};
|
int TopOffset[2] = {};
|
||||||
FGameTexture *texture = nullptr;
|
FGameTexture *texture = nullptr;
|
||||||
|
|
|
@ -383,7 +383,7 @@ TArray<uint8_t> FPCXTexture::CreatePalettedPixels(int conversion)
|
||||||
else if (bitcount == 8)
|
else if (bitcount == 8)
|
||||||
{
|
{
|
||||||
lump.Seek(-769, FileReader::SeekEnd);
|
lump.Seek(-769, FileReader::SeekEnd);
|
||||||
uint8_t c = lump.ReadUInt8();
|
lump.ReadUInt8();
|
||||||
//if (c !=0x0c) memcpy(PaletteMap, GrayMap, 256); // Fallback for files without palette
|
//if (c !=0x0c) memcpy(PaletteMap, GrayMap, 256); // Fallback for files without palette
|
||||||
//else
|
//else
|
||||||
for(int i=0;i<256;i++)
|
for(int i=0;i<256;i++)
|
||||||
|
|
|
@ -59,6 +59,7 @@ enum EGameTexFlags
|
||||||
GTexf_BrightmapChecked = 128, // Check for a colormap-based brightmap was already done.
|
GTexf_BrightmapChecked = 128, // Check for a colormap-based brightmap was already done.
|
||||||
GTexf_AutoMaterialsAdded = 256, // AddAutoMaterials has been called on this texture.
|
GTexf_AutoMaterialsAdded = 256, // AddAutoMaterials has been called on this texture.
|
||||||
GTexf_OffsetsNotForFont = 512, // The offsets must be ignored when using this texture in a font.
|
GTexf_OffsetsNotForFont = 512, // The offsets must be ignored when using this texture in a font.
|
||||||
|
GTexf_NoTrim = 1024, // Don't perform trimming on this texture.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Refactoring helper to allow piece by piece adjustment of the API
|
// Refactoring helper to allow piece by piece adjustment of the API
|
||||||
|
@ -136,8 +137,12 @@ public:
|
||||||
void SetSpriteRect();
|
void SetSpriteRect();
|
||||||
|
|
||||||
ETextureType GetUseType() const { return UseType; }
|
ETextureType GetUseType() const { return UseType; }
|
||||||
void SetUpscaleFlag(int what) { shouldUpscaleFlag = what; }
|
void SetUpscaleFlag(int what, bool manual = false)
|
||||||
int GetUpscaleFlag() { return shouldUpscaleFlag == 1; }
|
{
|
||||||
|
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(); }
|
FTexture* GetTexture() { return Base.get(); }
|
||||||
int GetSourceLump() const { return Base->GetSourceLump(); }
|
int GetSourceLump() const { return Base->GetSourceLump(); }
|
||||||
|
@ -155,6 +160,8 @@ public:
|
||||||
bool expandSprites() { return expandSprite == -1? ShouldExpandSprite() : !!expandSprite; }
|
bool expandSprites() { return expandSprite == -1? ShouldExpandSprite() : !!expandSprite; }
|
||||||
bool useWorldPanning() const { return !!(flags & GTexf_WorldPanning); }
|
bool useWorldPanning() const { return !!(flags & GTexf_WorldPanning); }
|
||||||
void SetWorldPanning(bool on) { if (on) flags |= GTexf_WorldPanning; else flags &= ~GTexf_WorldPanning; }
|
void SetWorldPanning(bool on) { if (on) flags |= GTexf_WorldPanning; else flags &= ~GTexf_WorldPanning; }
|
||||||
|
void SetNoTrimming(bool on) { if (on) flags |= GTexf_NoTrim; else flags &= ~GTexf_NoTrim; }
|
||||||
|
bool GetNoTrimming() { return !!(flags & GTexf_NoTrim); }
|
||||||
bool allowNoDecals() const { return !!(flags & GTexf_NoDecals); }
|
bool allowNoDecals() const { return !!(flags & GTexf_NoDecals); }
|
||||||
void SetNoDecals(bool on) { if (on) flags |= GTexf_NoDecals; else flags &= ~GTexf_NoDecals; }
|
void SetNoDecals(bool on) { if (on) flags |= GTexf_NoDecals; else flags &= ~GTexf_NoDecals; }
|
||||||
void SetOffsetsNotForFont() { flags |= GTexf_OffsetsNotForFont; }
|
void SetOffsetsNotForFont() { flags |= GTexf_OffsetsNotForFont; }
|
||||||
|
|
|
@ -85,7 +85,6 @@ PalettedPixels FImageSource::GetCachedPalettedPixels(int conversion)
|
||||||
FString name;
|
FString name;
|
||||||
fileSystem.GetFileShortName(name, SourceLump);
|
fileSystem.GetFileShortName(name, SourceLump);
|
||||||
|
|
||||||
std::pair<int, int> *info = nullptr;
|
|
||||||
auto imageID = ImageID;
|
auto imageID = ImageID;
|
||||||
|
|
||||||
// Do we have this image in the cache?
|
// Do we have this image in the cache?
|
||||||
|
@ -201,7 +200,6 @@ FBitmap FImageSource::GetCachedBitmap(const PalEntry *remap, int conversion, int
|
||||||
int trans = -1;
|
int trans = -1;
|
||||||
fileSystem.GetFileShortName(name, SourceLump);
|
fileSystem.GetFileShortName(name, SourceLump);
|
||||||
|
|
||||||
std::pair<int, int> *info = nullptr;
|
|
||||||
auto imageID = ImageID;
|
auto imageID = ImageID;
|
||||||
|
|
||||||
if (remap != nullptr)
|
if (remap != nullptr)
|
||||||
|
|
|
@ -90,7 +90,7 @@ FBitmap FImageTexture::GetBgraBitmap(const PalEntry *p, int *trans)
|
||||||
|
|
||||||
TArray<uint8_t> FImageTexture::Get8BitPixels(bool alpha)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
|
@ -144,6 +144,7 @@ void FMultipatchTextureBuilder::MakeTexture(BuildInfo &buildinfo, ETextureType u
|
||||||
buildinfo.texture->SetScale((float)buildinfo.Scale.X, (float)buildinfo.Scale.Y);
|
buildinfo.texture->SetScale((float)buildinfo.Scale.X, (float)buildinfo.Scale.Y);
|
||||||
buildinfo.texture->SetWorldPanning(buildinfo.bWorldPanning);
|
buildinfo.texture->SetWorldPanning(buildinfo.bWorldPanning);
|
||||||
buildinfo.texture->SetNoDecals(buildinfo.bNoDecals);
|
buildinfo.texture->SetNoDecals(buildinfo.bNoDecals);
|
||||||
|
buildinfo.texture->SetNoTrimming(buildinfo.bNoTrim);
|
||||||
TexMan.AddGameTexture(buildinfo.texture);
|
TexMan.AddGameTexture(buildinfo.texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,12 +296,12 @@ void FMultipatchTextureBuilder::AddTexturesLump(const void *lumpdata, int lumpsi
|
||||||
// Catalog the patches these textures use so we know which
|
// Catalog the patches these textures use so we know which
|
||||||
// textures they represent.
|
// textures they represent.
|
||||||
patchlookup.Resize(numpatches);
|
patchlookup.Resize(numpatches);
|
||||||
for (uint32_t i = 0; i < numpatches; ++i)
|
for (uint32_t ii = 0; ii < numpatches; ++ii)
|
||||||
{
|
{
|
||||||
char pname[9];
|
char pname[9];
|
||||||
pnames.Read(pname, 8);
|
pnames.Read(pname, 8);
|
||||||
pname[8] = '\0';
|
pname[8] = '\0';
|
||||||
patchlookup[i].Name = pname;
|
patchlookup[ii].Name = pname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,6 +670,10 @@ void FMultipatchTextureBuilder::ParseTexture(FScanner &sc, ETextureType UseType,
|
||||||
{
|
{
|
||||||
buildinfo.bNoDecals = true;
|
buildinfo.bNoDecals = true;
|
||||||
}
|
}
|
||||||
|
else if (sc.Compare("NoTrim"))
|
||||||
|
{
|
||||||
|
buildinfo.bNoTrim = true;
|
||||||
|
}
|
||||||
else if (sc.Compare("Patch"))
|
else if (sc.Compare("Patch"))
|
||||||
{
|
{
|
||||||
TexPartBuild part;
|
TexPartBuild part;
|
||||||
|
@ -777,12 +782,12 @@ void FMultipatchTextureBuilder::ResolvePatches(BuildInfo &buildinfo)
|
||||||
{
|
{
|
||||||
TArray<FTextureID> list;
|
TArray<FTextureID> list;
|
||||||
TexMan.ListTextures(buildinfo.Inits[i].TexName, list, true);
|
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()))
|
if (gtex && gtex != buildinfo.texture && gtex->GetTexture() && gtex->GetTexture()->GetImage() && !dynamic_cast<FMultiPatchTexture*>(gtex->GetTexture()->GetImage()))
|
||||||
{
|
{
|
||||||
texno = list[i];
|
texno = list[ii];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -853,7 +858,6 @@ void FMultipatchTextureBuilder::ResolveAllPatches()
|
||||||
ResolvePatches(bi);
|
ResolvePatches(bi);
|
||||||
}
|
}
|
||||||
// Now try to resolve the images. We only can do this at the end when all multipatch textures are set up.
|
// 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.
|
// 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.
|
// 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()
|
void FTextureManager::DeleteAll()
|
||||||
{
|
{
|
||||||
FImageSource::ClearImages();
|
|
||||||
for (unsigned int i = 0; i < Textures.Size(); ++i)
|
for (unsigned int i = 0; i < Textures.Size(); ++i)
|
||||||
{
|
{
|
||||||
delete Textures[i].Texture;
|
delete Textures[i].Texture;
|
||||||
}
|
}
|
||||||
|
FImageSource::ClearImages();
|
||||||
Textures.Clear();
|
Textures.Clear();
|
||||||
Translation.Clear();
|
Translation.Clear();
|
||||||
FirstTextureForFile.Clear();
|
FirstTextureForFile.Clear();
|
||||||
|
@ -717,7 +717,7 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
|
||||||
sc.String[8]=0;
|
sc.String[8]=0;
|
||||||
|
|
||||||
tlist.Clear();
|
tlist.Clear();
|
||||||
int amount = ListTextures(sc.String, tlist);
|
ListTextures(sc.String, tlist);
|
||||||
FName texname = sc.String;
|
FName texname = sc.String;
|
||||||
|
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
|
@ -811,6 +811,22 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
|
||||||
}
|
}
|
||||||
//else Printf("Unable to define hires texture '%s'\n", tex->Name);
|
//else Printf("Unable to define hires texture '%s'\n", tex->Name);
|
||||||
}
|
}
|
||||||
|
else if (sc.Compare("notrim"))
|
||||||
|
{
|
||||||
|
sc.MustGetString();
|
||||||
|
|
||||||
|
FTextureID id = TexMan.CheckForTexture(sc.String, ETextureType::Sprite);
|
||||||
|
if (id.isValid())
|
||||||
|
{
|
||||||
|
FGameTexture *tex = TexMan.GetGameTexture(id);
|
||||||
|
|
||||||
|
if (tex) tex->SetNoTrimming(true);
|
||||||
|
else sc.ScriptError("NoTrim: %s not found", sc.String);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sc.ScriptError("NoTrim: %s is not a sprite", sc.String);
|
||||||
|
|
||||||
|
}
|
||||||
else if (sc.Compare("texture"))
|
else if (sc.Compare("texture"))
|
||||||
{
|
{
|
||||||
build.ParseTexture(sc, ETextureType::Override, lump);
|
build.ParseTexture(sc, ETextureType::Override, lump);
|
||||||
|
@ -919,7 +935,6 @@ void FTextureManager::LoadTextureX(int wadnum, FMultipatchTextureBuilder &build)
|
||||||
void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &build)
|
void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &build)
|
||||||
{
|
{
|
||||||
int firsttexture = Textures.Size();
|
int firsttexture = Textures.Size();
|
||||||
int lumpcount = fileSystem.GetNumEntries();
|
|
||||||
bool iwad = wadnum >= fileSystem.GetIwadNum() && wadnum <= fileSystem.GetMaxIwadNum();
|
bool iwad = wadnum >= fileSystem.GetIwadNum() && wadnum <= fileSystem.GetMaxIwadNum();
|
||||||
|
|
||||||
FirstTextureForFile.Push(firsttexture);
|
FirstTextureForFile.Push(firsttexture);
|
||||||
|
@ -1190,8 +1205,12 @@ void FTextureManager::Init(void (*progressFunc_)(), void (*checkForHacks)(BuildI
|
||||||
AddGameTexture(CreateShaderTexture(true, false));
|
AddGameTexture(CreateShaderTexture(true, false));
|
||||||
AddGameTexture(CreateShaderTexture(true, true));
|
AddGameTexture(CreateShaderTexture(true, true));
|
||||||
// Add two animtexture entries so that movie playback can call functions using texture IDs.
|
// Add two animtexture entries so that movie playback can call functions using texture IDs.
|
||||||
AddGameTexture(MakeGameTexture(new AnimTexture(), "AnimTextureFrame1", ETextureType::Override));
|
auto mt = MakeGameTexture(new AnimTexture(), "AnimTextureFrame1", ETextureType::Override);
|
||||||
AddGameTexture(MakeGameTexture(new AnimTexture(), "AnimTextureFrame2", 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();
|
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
|
#ifndef BASE64_H_C0CE2A47_D10E_42C9_A27C_C883944E704A
|
||||||
#define 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);
|
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);
|
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
|
#endif
|
||||||
|
|
||||||
static const Float_t ABYule[][2 * YULE_ORDER + 1] = {
|
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},
|
{(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},
|
||||||
{(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},
|
{(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},
|
||||||
{(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},
|
{(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},
|
||||||
{(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},
|
{(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},
|
||||||
{(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},
|
{(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},
|
||||||
{(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},
|
{(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},
|
||||||
{(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},
|
{(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},
|
||||||
{(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},
|
{(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},
|
||||||
{(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},
|
{(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},
|
||||||
{(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},
|
{(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},
|
||||||
{(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},
|
{(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},
|
||||||
{(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.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 },
|
{(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 },
|
||||||
{(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.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] = {
|
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},
|
{(Float_t) 0.99308203517541, (Float_t) -1.98611621154089, (Float_t) -1.98616407035082, (Float_t) 0.986211929160751, (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},
|
{(Float_t) 0.992472550461293, (Float_t) -1.98488843762334, (Float_t) -1.98494510092258, (Float_t) 0.979389350028798, (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},
|
{(Float_t) 0.989641019334721, (Float_t) -1.97917472731008, (Float_t) -1.97928203866944, (Float_t) 0.979389350028798, (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},
|
{(Float_t) 0.98621192462708, (Float_t) -1.97223372919527, (Float_t) -1.97242384925416, (Float_t) 0.97261396931306, (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},
|
{(Float_t) 0.98500175787242, (Float_t) -1.96977855582618, (Float_t) -1.97000351574484, (Float_t) 0.97022847566350, (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},
|
{(Float_t) 0.97938932735214, (Float_t) -1.95835380975398, (Float_t) -1.95877865470428, (Float_t) 0.95920349965459, (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},
|
{(Float_t) 0.97531843204928, (Float_t) -1.95002759149878, (Float_t) -1.95063686409857, (Float_t) 0.95124613669835, (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},
|
{(Float_t) 0.97316523498161, (Float_t) -1.94561023566527, (Float_t) -1.94633046996323, (Float_t) 0.94705070426118, (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},
|
{(Float_t) 0.96454515552826, (Float_t) -1.92783286977036, (Float_t) -1.92909031105652, (Float_t) 0.93034775234268, (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},
|
{(Float_t) 0.96009142950541, (Float_t) -1.91858953033784, (Float_t) -1.92018285901082, (Float_t) 0.92177618768381, (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},
|
{(Float_t) 0.95856916599601, (Float_t) -1.91542108074780, (Float_t) -1.91713833199203, (Float_t) 0.91885558323625, (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.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 },
|
{(Float_t)0.96535326815829, (Float_t)-1.92950577983524, (Float_t)-1.93070653631658, (Float_t)0.93190729279793, (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.98252400815195, (Float_t)-1.96474258269041, (Float_t)-1.96504801630391, (Float_t)0.96535344991740, (Float_t)0.98252400815195 },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue