mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- backend update.
This commit is contained in:
parent
f41e0f9f50
commit
a9141af545
28 changed files with 128 additions and 68 deletions
|
@ -914,6 +914,7 @@ set (PCH_SOURCES
|
||||||
common/engine/renderstyle.cpp
|
common/engine/renderstyle.cpp
|
||||||
common/engine/v_colortables.cpp
|
common/engine/v_colortables.cpp
|
||||||
common/engine/serializer.cpp
|
common/engine/serializer.cpp
|
||||||
|
common/engine/m_joy.cpp
|
||||||
common/engine/m_random.cpp
|
common/engine/m_random.cpp
|
||||||
common/objects/dobject.cpp
|
common/objects/dobject.cpp
|
||||||
common/objects/dobjgc.cpp
|
common/objects/dobjgc.cpp
|
||||||
|
@ -983,10 +984,6 @@ set (PCH_SOURCES
|
||||||
core/menu/messagebox.cpp
|
core/menu/messagebox.cpp
|
||||||
core/menu/optionmenu.cpp
|
core/menu/optionmenu.cpp
|
||||||
core/menu/resolutionmenu.cpp
|
core/menu/resolutionmenu.cpp
|
||||||
|
|
||||||
#core/input/i_joystick.cpp
|
|
||||||
#core/input/i_input.cpp
|
|
||||||
core/input/m_joy.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if( ${HAVE_VM_JIT} )
|
if( ${HAVE_VM_JIT} )
|
||||||
|
|
|
@ -110,12 +110,7 @@ void scrLoadPalette(void)
|
||||||
numshades = 64;
|
numshades = 64;
|
||||||
paletteloaded |= PALETTE_MAIN;
|
paletteloaded |= PALETTE_MAIN;
|
||||||
scrLoadPLUs();
|
scrLoadPLUs();
|
||||||
paletteloaded |= PALETTE_SHADE;
|
paletteloaded |= PALETTE_SHADE | PALETTE_TRANSLUC;
|
||||||
Printf("Loading translucency table\n");
|
|
||||||
DICTNODE *pTrans = gSysRes.Lookup("TRANS", "TLU");
|
|
||||||
if (!pTrans)
|
|
||||||
ThrowError("TRANS.TLU not found");
|
|
||||||
paletteloaded |= PALETTE_TRANSLUC;
|
|
||||||
|
|
||||||
enginePostInit();
|
enginePostInit();
|
||||||
|
|
||||||
|
|
|
@ -378,7 +378,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
||||||
FVector3 pos, vel;
|
FVector3 pos, vel;
|
||||||
FRolloffInfo *rolloff;
|
FRolloffInfo *rolloff;
|
||||||
|
|
||||||
if (sound_id <= 0 || volume <= 0 || nosfx || nosound )
|
if (sound_id <= 0 || volume <= 0 || nosfx || nosound || blockNewSounds)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// prevent crashes.
|
// prevent crashes.
|
||||||
|
|
|
@ -238,6 +238,7 @@ protected:
|
||||||
TArray<uint8_t> S_SoundCurve;
|
TArray<uint8_t> S_SoundCurve;
|
||||||
TMap<int, int> ResIdMap;
|
TMap<int, int> ResIdMap;
|
||||||
TArray<FRandomSoundList> S_rnd;
|
TArray<FRandomSoundList> S_rnd;
|
||||||
|
bool blockNewSounds = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void LinkChannel(FSoundChan* chan, FSoundChan** head);
|
void LinkChannel(FSoundChan* chan, FSoundChan** head);
|
||||||
|
@ -268,6 +269,11 @@ public:
|
||||||
}
|
}
|
||||||
void EvictAllChannels();
|
void EvictAllChannels();
|
||||||
|
|
||||||
|
void BlockNewSounds(bool on)
|
||||||
|
{
|
||||||
|
blockNewSounds = on;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int SoundSourceIndex(FSoundChan* chan) { return 0; }
|
virtual int SoundSourceIndex(FSoundChan* chan) { return 0; }
|
||||||
virtual void SetSource(FSoundChan* chan, int index) {}
|
virtual void SetSource(FSoundChan* chan, int index) {}
|
||||||
|
|
||||||
|
|
|
@ -1600,3 +1600,22 @@ CCMD (archivecvar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void C_ListCVarsWithoutDescription()
|
||||||
|
{
|
||||||
|
FBaseCVar* var = CVars;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
while (var)
|
||||||
|
{
|
||||||
|
if (var->GetDescription().IsEmpty())
|
||||||
|
{
|
||||||
|
Printf("%s\n", var->GetName());
|
||||||
|
}
|
||||||
|
var = var->m_Next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CCMD(listcvarswithoutdescription)
|
||||||
|
{
|
||||||
|
C_ListCVarsWithoutDescription();
|
||||||
|
}
|
||||||
|
|
|
@ -143,6 +143,10 @@ public:
|
||||||
void SetArchiveBit () { Flags |= CVAR_ARCHIVE; }
|
void SetArchiveBit () { Flags |= CVAR_ARCHIVE; }
|
||||||
void MarkUnsafe();
|
void MarkUnsafe();
|
||||||
void MarkSafe() { Flags &= ~CVAR_UNSAFECONTEXT; }
|
void MarkSafe() { Flags &= ~CVAR_UNSAFECONTEXT; }
|
||||||
|
void AddDescription(const FString& label)
|
||||||
|
{
|
||||||
|
if (Description.IsEmpty()) Description = label;
|
||||||
|
}
|
||||||
|
|
||||||
int ToInt()
|
int ToInt()
|
||||||
{
|
{
|
||||||
|
@ -214,6 +218,7 @@ private:
|
||||||
friend void C_SetCVarsToDefaults (void);
|
friend void C_SetCVarsToDefaults (void);
|
||||||
friend void FilterCompactCVars (TArray<FBaseCVar *> &cvars, uint32_t filter);
|
friend void FilterCompactCVars (TArray<FBaseCVar *> &cvars, uint32_t filter);
|
||||||
friend void C_DeinitConsole();
|
friend void C_DeinitConsole();
|
||||||
|
friend void C_ListCVarsWithoutDescription();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns a string with all cvars whose flags match filter. In compact mode,
|
// Returns a string with all cvars whose flags match filter. In compact mode,
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "c_buttons.h"
|
#include "c_buttons.h"
|
||||||
#include "findfile.h"
|
#include "findfile.h"
|
||||||
|
#include "gstrings.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -300,7 +301,7 @@ void C_DoCommand (const char *cmd, int keynum)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Get the variable's value
|
{ // Get the variable's value
|
||||||
if (var->GetDescription().Len()) Printf("%s\n", var->GetDescription().GetChars());
|
if (var->GetDescription().Len()) Printf("%s\n", GStrings.localize(var->GetDescription()));
|
||||||
Printf ("\"%s\" is \"%s\"\n", var->GetName(), var->GetHumanString());
|
Printf ("\"%s\" is \"%s\"\n", var->GetName(), var->GetHumanString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "gameconfigfile.h"
|
#include "gameconfigfile.h"
|
||||||
#include "d_event.h"
|
#include "d_event.h"
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
|
#include "printf.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -124,23 +125,23 @@ bool M_LoadJoystickConfig(IJoystickConfig *joy)
|
||||||
numaxes = joy->GetNumAxes();
|
numaxes = joy->GetNumAxes();
|
||||||
for (int i = 0; i < numaxes; ++i)
|
for (int i = 0; i < numaxes; ++i)
|
||||||
{
|
{
|
||||||
axislen = snprintf(key, countof(key), "Axis%u", i);
|
axislen = mysnprintf(key, countof(key), "Axis%u", i);
|
||||||
|
|
||||||
snprintf(key + axislen, countof(key) - axislen, "deadzone");
|
mysnprintf(key + axislen, countof(key) - axislen, "deadzone");
|
||||||
value = GameConfig->GetValueForKey(key);
|
value = GameConfig->GetValueForKey(key);
|
||||||
if (value != NULL)
|
if (value != NULL)
|
||||||
{
|
{
|
||||||
joy->SetAxisDeadZone(i, (float)atof(value));
|
joy->SetAxisDeadZone(i, (float)atof(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(key + axislen, countof(key) - axislen, "scale");
|
mysnprintf(key + axislen, countof(key) - axislen, "scale");
|
||||||
value = GameConfig->GetValueForKey(key);
|
value = GameConfig->GetValueForKey(key);
|
||||||
if (value != NULL)
|
if (value != NULL)
|
||||||
{
|
{
|
||||||
joy->SetAxisScale(i, (float)atof(value));
|
joy->SetAxisScale(i, (float)atof(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(key + axislen, countof(key) - axislen, "map");
|
mysnprintf(key + axislen, countof(key) - axislen, "map");
|
||||||
value = GameConfig->GetValueForKey(key);
|
value = GameConfig->GetValueForKey(key);
|
||||||
if (value != NULL)
|
if (value != NULL)
|
||||||
{
|
{
|
||||||
|
@ -173,30 +174,30 @@ void M_SaveJoystickConfig(IJoystickConfig *joy)
|
||||||
GameConfig->ClearCurrentSection();
|
GameConfig->ClearCurrentSection();
|
||||||
if (!joy->IsSensitivityDefault())
|
if (!joy->IsSensitivityDefault())
|
||||||
{
|
{
|
||||||
snprintf(value, countof(value), "%g", joy->GetSensitivity());
|
mysnprintf(value, countof(value), "%g", joy->GetSensitivity());
|
||||||
GameConfig->SetValueForKey("Sensitivity", value);
|
GameConfig->SetValueForKey("Sensitivity", value);
|
||||||
}
|
}
|
||||||
numaxes = joy->GetNumAxes();
|
numaxes = joy->GetNumAxes();
|
||||||
for (int i = 0; i < numaxes; ++i)
|
for (int i = 0; i < numaxes; ++i)
|
||||||
{
|
{
|
||||||
axislen = snprintf(key, countof(key), "Axis%u", i);
|
axislen = mysnprintf(key, countof(key), "Axis%u", i);
|
||||||
|
|
||||||
if (!joy->IsAxisDeadZoneDefault(i))
|
if (!joy->IsAxisDeadZoneDefault(i))
|
||||||
{
|
{
|
||||||
snprintf(key + axislen, countof(key) - axislen, "deadzone");
|
mysnprintf(key + axislen, countof(key) - axislen, "deadzone");
|
||||||
snprintf(value, countof(value), "%g", joy->GetAxisDeadZone(i));
|
mysnprintf(value, countof(value), "%g", joy->GetAxisDeadZone(i));
|
||||||
GameConfig->SetValueForKey(key, value);
|
GameConfig->SetValueForKey(key, value);
|
||||||
}
|
}
|
||||||
if (!joy->IsAxisScaleDefault(i))
|
if (!joy->IsAxisScaleDefault(i))
|
||||||
{
|
{
|
||||||
snprintf(key + axislen, countof(key) - axislen, "scale");
|
mysnprintf(key + axislen, countof(key) - axislen, "scale");
|
||||||
snprintf(value, countof(value), "%g", joy->GetAxisScale(i));
|
mysnprintf(value, countof(value), "%g", joy->GetAxisScale(i));
|
||||||
GameConfig->SetValueForKey(key, value);
|
GameConfig->SetValueForKey(key, value);
|
||||||
}
|
}
|
||||||
if (!joy->IsAxisMapDefault(i))
|
if (!joy->IsAxisMapDefault(i))
|
||||||
{
|
{
|
||||||
snprintf(key + axislen, countof(key) - axislen, "map");
|
mysnprintf(key + axislen, countof(key) - axislen, "map");
|
||||||
snprintf(value, countof(value), "%d", joy->GetAxisMap(i));
|
mysnprintf(value, countof(value), "%d", joy->GetAxisMap(i));
|
||||||
GameConfig->SetValueForKey(key, value);
|
GameConfig->SetValueForKey(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef M_JOY_H
|
#ifndef M_JOY_H
|
||||||
#define M_JOY_H
|
#define M_JOY_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include "basics.h"
|
||||||
#include "tarray.h"
|
#include "tarray.h"
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ enum EJoyAxis
|
||||||
};
|
};
|
||||||
|
|
||||||
// Generic configuration interface for a controller.
|
// Generic configuration interface for a controller.
|
||||||
struct IJoystickConfig
|
struct NOVTABLE IJoystickConfig
|
||||||
{
|
{
|
||||||
virtual ~IJoystickConfig() = 0;
|
virtual ~IJoystickConfig() = 0;
|
||||||
|
|
|
@ -1386,7 +1386,7 @@ FileReader FileSystem::ReopenFileReader(int lump, bool alwayscache)
|
||||||
if (rl->RefCount == 0 && rd != nullptr && !rd->GetBuffer() && !alwayscache && !(rl->Flags & LUMPF_COMPRESSED))
|
if (rl->RefCount == 0 && rd != nullptr && !rd->GetBuffer() && !alwayscache && !(rl->Flags & LUMPF_COMPRESSED))
|
||||||
{
|
{
|
||||||
int fileno = fileSystem.GetFileContainer(lump);
|
int fileno = fileSystem.GetFileContainer(lump);
|
||||||
const char *filename = fileSystem.GetResourceFileName(fileno);
|
const char *filename = fileSystem.GetResourceFileFullName(fileno);
|
||||||
FileReader fr;
|
FileReader fr;
|
||||||
if (fr.OpenFile(filename, rl->GetFileOffset(), rl->LumpSize))
|
if (fr.OpenFile(filename, rl->GetFileOffset(), rl->LumpSize))
|
||||||
{
|
{
|
||||||
|
|
|
@ -266,14 +266,12 @@ private:
|
||||||
|
|
||||||
void *operator new(size_t len, nonew&)
|
void *operator new(size_t len, nonew&)
|
||||||
{
|
{
|
||||||
GC::AllocBytes += len;
|
|
||||||
return M_Malloc(len);
|
return M_Malloc(len);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void operator delete (void *mem, nonew&)
|
void operator delete (void *mem, nonew&)
|
||||||
{
|
{
|
||||||
GC::AllocBytes -= _msize(mem);
|
|
||||||
M_Free(mem);
|
M_Free(mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -306,6 +306,9 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
uniform sampler2D texture6;
|
uniform sampler2D texture6;
|
||||||
uniform sampler2D texture7;
|
uniform sampler2D texture7;
|
||||||
uniform sampler2D texture8;
|
uniform sampler2D texture8;
|
||||||
|
uniform sampler2D texture9;
|
||||||
|
uniform sampler2D texture10;
|
||||||
|
uniform sampler2D texture11;
|
||||||
|
|
||||||
// timer data
|
// timer data
|
||||||
uniform float timer;
|
uniform float timer;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
|
@ -183,6 +183,9 @@ static const char *shaderBindings = R"(
|
||||||
layout(set = 1, binding = 5) uniform sampler2D texture6;
|
layout(set = 1, binding = 5) uniform sampler2D texture6;
|
||||||
layout(set = 1, binding = 6) uniform sampler2D texture7;
|
layout(set = 1, binding = 6) uniform sampler2D texture7;
|
||||||
layout(set = 1, binding = 7) uniform sampler2D texture8;
|
layout(set = 1, binding = 7) uniform sampler2D texture8;
|
||||||
|
layout(set = 1, binding = 8) uniform sampler2D texture9;
|
||||||
|
layout(set = 1, binding = 9) uniform sampler2D texture10;
|
||||||
|
layout(set = 1, binding = 10) uniform sampler2D texture11;
|
||||||
|
|
||||||
// This must match the PushConstants struct
|
// This must match the PushConstants struct
|
||||||
layout(push_constant) uniform PushConstants
|
layout(push_constant) uniform PushConstants
|
||||||
|
|
|
@ -2229,7 +2229,7 @@ remove them if not needed.
|
||||||
#include <mutex> // for std::mutex
|
#include <mutex> // for std::mutex
|
||||||
#include <atomic> // for std::atomic
|
#include <atomic> // for std::atomic
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
|
||||||
#include <malloc.h> // for aligned_alloc()
|
#include <malloc.h> // for aligned_alloc()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -170,6 +170,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddTexturesLumps(int lump1, int lump2, int patcheslump);
|
void AddTexturesLumps(int lump1, int lump2, int patcheslump);
|
||||||
void ParseTexture(FScanner &sc, ETextureType usetype);
|
void ParseTexture(FScanner &sc, ETextureType usetype, int deflump);
|
||||||
void ResolveAllPatches();
|
void ResolveAllPatches();
|
||||||
};
|
};
|
||||||
|
|
|
@ -389,7 +389,7 @@ void FGameTexture::SetSpriteRect()
|
||||||
|
|
||||||
void FGameTexture::CleanHardwareData(bool full)
|
void FGameTexture::CleanHardwareData(bool full)
|
||||||
{
|
{
|
||||||
Base->CleanHardwareTextures();
|
if (full) Base->CleanHardwareTextures();
|
||||||
for (auto mat : Material) if (mat) mat->DeleteDescriptors();
|
for (auto mat : Material) if (mat) mat->DeleteDescriptors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,10 +241,6 @@ public:
|
||||||
DisplayHeight = h;
|
DisplayHeight = h;
|
||||||
ScaleX = TexelWidth / w;
|
ScaleX = TexelWidth / w;
|
||||||
ScaleY = TexelHeight / h;
|
ScaleY = TexelHeight / h;
|
||||||
if (shouldUpscaleFlag < 2)
|
|
||||||
{
|
|
||||||
shouldUpscaleFlag = ScaleX < 2 && ScaleY < 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// compensate for roundoff errors
|
// compensate for roundoff errors
|
||||||
if (int(ScaleX * w) != TexelWidth) ScaleX += (1 / 65536.);
|
if (int(ScaleX * w) != TexelWidth) ScaleX += (1 / 65536.);
|
||||||
|
@ -271,10 +267,6 @@ public:
|
||||||
{
|
{
|
||||||
ScaleX = x;
|
ScaleX = x;
|
||||||
ScaleY = y;
|
ScaleY = y;
|
||||||
if (shouldUpscaleFlag < 2)
|
|
||||||
{
|
|
||||||
shouldUpscaleFlag = ScaleX < 2 && ScaleY < 2;
|
|
||||||
}
|
|
||||||
DisplayWidth = TexelWidth / x;
|
DisplayWidth = TexelWidth / x;
|
||||||
DisplayHeight = TexelHeight / y;
|
DisplayHeight = TexelHeight / y;
|
||||||
}
|
}
|
||||||
|
@ -374,7 +366,7 @@ enum EUpscaleFlags
|
||||||
extern int upscalemask;
|
extern int upscalemask;
|
||||||
void UpdateUpscaleMask();
|
void UpdateUpscaleMask();
|
||||||
|
|
||||||
int calcShouldUpscale(FGameTexture* tex);
|
void calcShouldUpscale(FGameTexture* tex);
|
||||||
inline int shouldUpscale(FGameTexture* tex, EUpscaleFlags UseType)
|
inline int shouldUpscale(FGameTexture* tex, EUpscaleFlags UseType)
|
||||||
{
|
{
|
||||||
// This only checks the global scale mask and the texture's validation for upscaling. Everything else has been done up front elsewhere.
|
// This only checks the global scale mask and the texture's validation for upscaling. Everything else has been done up front elsewhere.
|
||||||
|
|
|
@ -502,20 +502,21 @@ void FTexture::CreateUpsampledTextureBuffer(FTextureBuffer &texbuffer, bool hasA
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
int calcShouldUpscale(FGameTexture *tex)
|
void calcShouldUpscale(FGameTexture *tex)
|
||||||
{
|
{
|
||||||
|
tex->SetUpscaleFlag(0);
|
||||||
// [BB] Don't resample if width * height of the input texture is bigger than gl_texture_hqresize_maxinputsize squared.
|
// [BB] Don't resample if width * height of the input texture is bigger than gl_texture_hqresize_maxinputsize squared.
|
||||||
const int maxInputSize = gl_texture_hqresize_maxinputsize;
|
const int maxInputSize = gl_texture_hqresize_maxinputsize;
|
||||||
if (tex->GetTexelWidth() * tex->GetTexelHeight() > maxInputSize * maxInputSize)
|
if (tex->GetTexelWidth() * tex->GetTexelHeight() > maxInputSize * maxInputSize)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
// [BB] Don't try to upsample textures based off FCanvasTexture. (This should never get here in the first place!)
|
// [BB] Don't try to upsample textures based off FCanvasTexture. (This should never get here in the first place!)
|
||||||
if (tex->isHardwareCanvas())
|
if (tex->isHardwareCanvas())
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
// already scaled?
|
// already scaled?
|
||||||
if (tex->GetScaleX() >= 2.f || tex->GetScaleY() > 2.f)
|
if (tex->GetScaleX() >= 2.f || tex->GetScaleY() > 2.f)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
return CTF_Upscale;
|
tex->SetUpscaleFlag(1);
|
||||||
}
|
}
|
|
@ -48,6 +48,11 @@ public:
|
||||||
return sourcetex;
|
return sourcetex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClearLayers()
|
||||||
|
{
|
||||||
|
mTextureLayers.Resize(1);
|
||||||
|
}
|
||||||
|
|
||||||
void AddTextureLayer(FTexture *tex, bool allowscale)
|
void AddTextureLayer(FTexture *tex, bool allowscale)
|
||||||
{
|
{
|
||||||
mTextureLayers.Push({ tex, allowscale });
|
mTextureLayers.Push({ tex, allowscale });
|
||||||
|
|
|
@ -606,7 +606,7 @@ void FMultipatchTextureBuilder::ParsePatch(FScanner &sc, BuildInfo &info, TexPar
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void FMultipatchTextureBuilder::ParseTexture(FScanner &sc, ETextureType UseType)
|
void FMultipatchTextureBuilder::ParseTexture(FScanner &sc, ETextureType UseType, int deflump)
|
||||||
{
|
{
|
||||||
BuildInfo &buildinfo = BuiltTextures[BuiltTextures.Reserve(1)];
|
BuildInfo &buildinfo = BuiltTextures[BuiltTextures.Reserve(1)];
|
||||||
|
|
||||||
|
@ -637,6 +637,7 @@ void FMultipatchTextureBuilder::ParseTexture(FScanner &sc, ETextureType UseType)
|
||||||
sc.MustGetStringName(",");
|
sc.MustGetStringName(",");
|
||||||
sc.MustGetNumber();
|
sc.MustGetNumber();
|
||||||
buildinfo.Height = sc.Number;
|
buildinfo.Height = sc.Number;
|
||||||
|
buildinfo.DefinitionLump = deflump;
|
||||||
|
|
||||||
bool offset2set = false;
|
bool offset2set = false;
|
||||||
if (sc.CheckString("{"))
|
if (sc.CheckString("{"))
|
||||||
|
@ -778,13 +779,10 @@ void FMultipatchTextureBuilder::ResolvePatches(BuildInfo &buildinfo)
|
||||||
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 i = list.Size() - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if (list[i] != buildinfo.texture->GetID())
|
auto gtex = TexMan.GetGameTexture(list[i]);
|
||||||
|
if (gtex && gtex != buildinfo.texture && gtex->GetTexture() && gtex->GetTexture()->GetImage() && !dynamic_cast<FMultiPatchTexture*>(gtex->GetTexture()->GetImage()))
|
||||||
{
|
{
|
||||||
auto gtex = TexMan.GetGameTexture(list[i]);
|
texno = list[i];
|
||||||
if (gtex && !dynamic_cast<FMultiPatchTexture*>(gtex->GetTexture()))
|
|
||||||
{
|
|
||||||
texno = list[i];
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -911,6 +909,7 @@ void FMultipatchTextureBuilder::ResolveAllPatches()
|
||||||
{
|
{
|
||||||
auto img = new FMultiPatchTexture(buildinfo.Width, buildinfo.Height, buildinfo.Parts, buildinfo.bComplex, buildinfo.textual);
|
auto img = new FMultiPatchTexture(buildinfo.Width, buildinfo.Height, buildinfo.Parts, buildinfo.bComplex, buildinfo.textual);
|
||||||
auto itex = new FImageTexture(img);
|
auto itex = new FImageTexture(img);
|
||||||
|
itex->SetSourceLump(buildinfo.DefinitionLump);
|
||||||
AddImageToTexture(itex, buildinfo);
|
AddImageToTexture(itex, buildinfo);
|
||||||
}
|
}
|
||||||
BuiltTextures.Delete(i);
|
BuiltTextures.Delete(i);
|
||||||
|
|
|
@ -106,7 +106,7 @@ void FTextureManager::DeleteAll()
|
||||||
// This must not, under any circumstances, delete the wipe textures, because
|
// This must not, under any circumstances, delete the wipe textures, because
|
||||||
// all CCMDs triggering a flush can be executed while a wipe is in progress
|
// all CCMDs triggering a flush can be executed while a wipe is in progress
|
||||||
//
|
//
|
||||||
// This now also deletes the software textures because having the software
|
// This now also deletes the software textures because the software
|
||||||
// renderer can also use the texture scalers and that is the
|
// renderer can also use the texture scalers and that is the
|
||||||
// main reason to call this outside of the destruction code.
|
// main reason to call this outside of the destruction code.
|
||||||
//
|
//
|
||||||
|
@ -120,8 +120,8 @@ void FTextureManager::FlushAll()
|
||||||
{
|
{
|
||||||
Textures[i].Texture->CleanHardwareData();
|
Textures[i].Texture->CleanHardwareData();
|
||||||
delete Textures[i].Texture->GetSoftwareTexture();
|
delete Textures[i].Texture->GetSoftwareTexture();
|
||||||
Textures[i].Texture->SetSoftwareTexture(nullptr);
|
|
||||||
calcShouldUpscale(Textures[i].Texture);
|
calcShouldUpscale(Textures[i].Texture);
|
||||||
|
Textures[i].Texture->SetSoftwareTexture(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -782,23 +782,23 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
|
||||||
}
|
}
|
||||||
else if (sc.Compare("texture"))
|
else if (sc.Compare("texture"))
|
||||||
{
|
{
|
||||||
build.ParseTexture(sc, ETextureType::Override);
|
build.ParseTexture(sc, ETextureType::Override, lump);
|
||||||
}
|
}
|
||||||
else if (sc.Compare("sprite"))
|
else if (sc.Compare("sprite"))
|
||||||
{
|
{
|
||||||
build.ParseTexture(sc, ETextureType::Sprite);
|
build.ParseTexture(sc, ETextureType::Sprite, lump);
|
||||||
}
|
}
|
||||||
else if (sc.Compare("walltexture"))
|
else if (sc.Compare("walltexture"))
|
||||||
{
|
{
|
||||||
build.ParseTexture(sc, ETextureType::Wall);
|
build.ParseTexture(sc, ETextureType::Wall, lump);
|
||||||
}
|
}
|
||||||
else if (sc.Compare("flat"))
|
else if (sc.Compare("flat"))
|
||||||
{
|
{
|
||||||
build.ParseTexture(sc, ETextureType::Flat);
|
build.ParseTexture(sc, ETextureType::Flat, lump);
|
||||||
}
|
}
|
||||||
else if (sc.Compare("graphic"))
|
else if (sc.Compare("graphic"))
|
||||||
{
|
{
|
||||||
build.ParseTexture(sc, ETextureType::MiscPatch);
|
build.ParseTexture(sc, ETextureType::MiscPatch, lump);
|
||||||
}
|
}
|
||||||
else if (sc.Compare("#include"))
|
else if (sc.Compare("#include"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -253,6 +253,7 @@ public:
|
||||||
bool isCanvas() const { return bHasCanvas; }
|
bool isCanvas() const { return bHasCanvas; }
|
||||||
|
|
||||||
int GetSourceLump() { return SourceLump; } // needed by the scripted GetName method.
|
int GetSourceLump() { return SourceLump; } // needed by the scripted GetName method.
|
||||||
|
void SetSourceLump(int sl) { SourceLump = sl; }
|
||||||
bool FindHoles(const unsigned char * buffer, int w, int h);
|
bool FindHoles(const unsigned char * buffer, int w, int h);
|
||||||
|
|
||||||
void CopySize(FTexture* BaseTexture)
|
void CopySize(FTexture* BaseTexture)
|
||||||
|
|
|
@ -38,14 +38,14 @@
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc/malloc.h>
|
#include <malloc/malloc.h>
|
||||||
#elif defined(__OpenBSD__)
|
#elif defined(__OpenBSD__) || defined(__DragonFly__)
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#else
|
#else
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "engineerrors.h"
|
#include "engineerrors.h"
|
||||||
#include "m_alloc.h"
|
#include "dobject.h"
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
#define _NORMAL_BLOCK 0
|
#define _NORMAL_BLOCK 0
|
||||||
|
@ -62,16 +62,22 @@ void *M_Malloc(size_t size)
|
||||||
if (block == NULL)
|
if (block == NULL)
|
||||||
I_FatalError("Could not malloc %zu bytes", size);
|
I_FatalError("Could not malloc %zu bytes", size);
|
||||||
|
|
||||||
|
GC::AllocBytes += _msize(block);
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *M_Realloc(void *memblock, size_t size)
|
void *M_Realloc(void *memblock, size_t size)
|
||||||
{
|
{
|
||||||
|
if (memblock != NULL)
|
||||||
|
{
|
||||||
|
GC::AllocBytes -= _msize(memblock);
|
||||||
|
}
|
||||||
void *block = realloc(memblock, size);
|
void *block = realloc(memblock, size);
|
||||||
if (block == NULL)
|
if (block == NULL)
|
||||||
{
|
{
|
||||||
I_FatalError("Could not realloc %zu bytes", size);
|
I_FatalError("Could not realloc %zu bytes", size);
|
||||||
}
|
}
|
||||||
|
GC::AllocBytes += _msize(block);
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -86,6 +92,7 @@ void *M_Malloc(size_t size)
|
||||||
*sizeStore = size;
|
*sizeStore = size;
|
||||||
block = sizeStore+1;
|
block = sizeStore+1;
|
||||||
|
|
||||||
|
GC::AllocBytes += _msize(block);
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +101,10 @@ void *M_Realloc(void *memblock, size_t size)
|
||||||
if(memblock == NULL)
|
if(memblock == NULL)
|
||||||
return M_Malloc(size);
|
return M_Malloc(size);
|
||||||
|
|
||||||
|
if (memblock != NULL)
|
||||||
|
{
|
||||||
|
GC::AllocBytes -= _msize(memblock);
|
||||||
|
}
|
||||||
void *block = realloc(((size_t*) memblock)-1, size+sizeof(size_t));
|
void *block = realloc(((size_t*) memblock)-1, size+sizeof(size_t));
|
||||||
if (block == NULL)
|
if (block == NULL)
|
||||||
{
|
{
|
||||||
|
@ -104,6 +115,7 @@ void *M_Realloc(void *memblock, size_t size)
|
||||||
*sizeStore = size;
|
*sizeStore = size;
|
||||||
block = sizeStore+1;
|
block = sizeStore+1;
|
||||||
|
|
||||||
|
GC::AllocBytes += _msize(block);
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -120,16 +132,22 @@ void *M_Malloc_Dbg(size_t size, const char *file, int lineno)
|
||||||
if (block == NULL)
|
if (block == NULL)
|
||||||
I_FatalError("Could not malloc %zu bytes in %s, line %d", size, file, lineno);
|
I_FatalError("Could not malloc %zu bytes in %s, line %d", size, file, lineno);
|
||||||
|
|
||||||
|
GC::AllocBytes += _msize(block);
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *M_Realloc_Dbg(void *memblock, size_t size, const char *file, int lineno)
|
void *M_Realloc_Dbg(void *memblock, size_t size, const char *file, int lineno)
|
||||||
{
|
{
|
||||||
|
if (memblock != NULL)
|
||||||
|
{
|
||||||
|
GC::AllocBytes -= _msize(memblock);
|
||||||
|
}
|
||||||
void *block = _realloc_dbg(memblock, size, _NORMAL_BLOCK, file, lineno);
|
void *block = _realloc_dbg(memblock, size, _NORMAL_BLOCK, file, lineno);
|
||||||
if (block == NULL)
|
if (block == NULL)
|
||||||
{
|
{
|
||||||
I_FatalError("Could not realloc %zu bytes in %s, line %d", size, file, lineno);
|
I_FatalError("Could not realloc %zu bytes in %s, line %d", size, file, lineno);
|
||||||
}
|
}
|
||||||
|
GC::AllocBytes += _msize(block);
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -144,6 +162,7 @@ void *M_Malloc_Dbg(size_t size, const char *file, int lineno)
|
||||||
*sizeStore = size;
|
*sizeStore = size;
|
||||||
block = sizeStore+1;
|
block = sizeStore+1;
|
||||||
|
|
||||||
|
GC::AllocBytes += _msize(block);
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +171,10 @@ void *M_Realloc_Dbg(void *memblock, size_t size, const char *file, int lineno)
|
||||||
if(memblock == NULL)
|
if(memblock == NULL)
|
||||||
return M_Malloc_Dbg(size, file, lineno);
|
return M_Malloc_Dbg(size, file, lineno);
|
||||||
|
|
||||||
|
if (memblock != NULL)
|
||||||
|
{
|
||||||
|
GC::AllocBytes -= _msize(memblock);
|
||||||
|
}
|
||||||
void *block = _realloc_dbg(((size_t*) memblock)-1, size+sizeof(size_t), _NORMAL_BLOCK, file, lineno);
|
void *block = _realloc_dbg(((size_t*) memblock)-1, size+sizeof(size_t), _NORMAL_BLOCK, file, lineno);
|
||||||
|
|
||||||
if (block == NULL)
|
if (block == NULL)
|
||||||
|
@ -163,6 +186,7 @@ void *M_Realloc_Dbg(void *memblock, size_t size, const char *file, int lineno)
|
||||||
*sizeStore = size;
|
*sizeStore = size;
|
||||||
block = sizeStore+1;
|
block = sizeStore+1;
|
||||||
|
|
||||||
|
GC::AllocBytes += _msize(block);
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -173,6 +197,7 @@ void M_Free (void *block)
|
||||||
{
|
{
|
||||||
if (block != NULL)
|
if (block != NULL)
|
||||||
{
|
{
|
||||||
|
GC::AllocBytes -= _msize(block);
|
||||||
free(block);
|
free(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,6 +206,7 @@ void M_Free (void *block)
|
||||||
{
|
{
|
||||||
if(block != NULL)
|
if(block != NULL)
|
||||||
{
|
{
|
||||||
|
GC::AllocBytes -= _msize(block);
|
||||||
free(((size_t*) block)-1);
|
free(((size_t*) block)-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include <malloc/malloc.h>
|
#include <malloc/malloc.h>
|
||||||
#define _msize(p) malloc_size(p)
|
#define _msize(p) malloc_size(p)
|
||||||
#elif defined(__solaris__) || defined(__OpenBSD__)
|
#elif defined(__solaris__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||||
#define _msize(p) (*((size_t*)(p)-1))
|
#define _msize(p) (*((size_t*)(p)-1))
|
||||||
#elif !defined(_WIN32)
|
#elif !defined(_WIN32)
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
|
@ -444,7 +444,7 @@ void MakeGoodRemap(uint32_t* BaseColors, uint8_t* Remap)
|
||||||
|
|
||||||
for (i = 0; i < 256; ++i)
|
for (i = 0; i < 256; ++i)
|
||||||
{
|
{
|
||||||
sortcopy[i] = BaseColors[i] | (i << 24);
|
sortcopy[i] = (BaseColors[i] & 0xffffff) | (i << 24);
|
||||||
}
|
}
|
||||||
qsort(sortcopy, 256, 4, sortforremap);
|
qsort(sortcopy, 256, 4, sortforremap);
|
||||||
for (i = 255; i > 0; --i)
|
for (i = 255; i > 0; --i)
|
||||||
|
|
|
@ -107,7 +107,6 @@ void paletteLoadFromDisk(void)
|
||||||
// LameDuke and Witchaven use an older variant.
|
// LameDuke and Witchaven use an older variant.
|
||||||
if (fil.GetLength() == 41600)
|
if (fil.GetLength() == 41600)
|
||||||
{
|
{
|
||||||
fil.Seek(-2, FileReader::SeekCur);
|
|
||||||
numshades = 32;
|
numshades = 32;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -129,8 +128,7 @@ void paletteLoadFromDisk(void)
|
||||||
if (buffer.Size() != length) return;
|
if (buffer.Size() != length) return;
|
||||||
lookups.setTable(0, buffer.Data());
|
lookups.setTable(0, buffer.Data());
|
||||||
|
|
||||||
paletteloaded |= PALETTE_SHADE;
|
paletteloaded |= PALETTE_SHADE | PALETTE_TRANSLUC;
|
||||||
paletteloaded |= PALETTE_TRANSLUC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -309,6 +309,16 @@ float R_DoomLightingEquation(float light)
|
||||||
z = pixelpos.w;
|
z = pixelpos.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((uPalLightLevels >> 16) == 5) // gl_lightmode 5: Build software lighting emulation.
|
||||||
|
{
|
||||||
|
// This is a lot more primitive than Doom's lighting...
|
||||||
|
float numShades = float(uPalLightLevels & 255);
|
||||||
|
float curshade = (1.0 - light) * (numShades - 1.0);
|
||||||
|
float visibility = max(uGlobVis * uLightFactor * z, 0.0);
|
||||||
|
float shade = clamp((curshade + visibility), 0.0, numShades - 1.0);
|
||||||
|
return clamp(shade * uLightDist, 0.0, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
float colormap = R_DoomColormap(light, z);
|
float colormap = R_DoomColormap(light, z);
|
||||||
|
|
||||||
if ((uPalLightLevels & 0xff) != 0)
|
if ((uPalLightLevels & 0xff) != 0)
|
||||||
|
|
Loading…
Reference in a new issue