mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-23 20:32:51 +00:00
Merge remote-tracking branch 'gz/master' into thereisnospoon
This commit is contained in:
commit
2c314f3f3f
19 changed files with 628 additions and 386 deletions
|
@ -2521,6 +2521,9 @@ void D_DoomMain (void)
|
|||
|
||||
// Create replacements for dehacked pickups
|
||||
FinishDehPatch();
|
||||
|
||||
// clean up the compiler symbols which are not needed any longer.
|
||||
RemoveUnusedSymbols();
|
||||
|
||||
InitActorNumsFromMapinfo();
|
||||
InitSpawnablesFromMapinfo();
|
||||
|
|
|
@ -3898,3 +3898,45 @@ void FNamespaceManager::ReleaseSymbols()
|
|||
GlobalNamespace = nullptr;
|
||||
AllNamespaces.Clear();
|
||||
}
|
||||
|
||||
// removes all symbols from the symbol tables.
|
||||
// After running the compiler these are not needed anymore.
|
||||
// Only the namespaces themselves are kept because the type table references them.
|
||||
int FNamespaceManager::RemoveSymbols()
|
||||
{
|
||||
int count = 0;
|
||||
for (auto ns : AllNamespaces)
|
||||
{
|
||||
count += ns->Symbols.Symbols.CountUsed();
|
||||
ns->Symbols.ReleaseSymbols();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void RemoveUnusedSymbols()
|
||||
{
|
||||
// Global symbols are not needed anymore after running the compiler.
|
||||
int count = Namespaces.RemoveSymbols();
|
||||
|
||||
// We do not need any non-field and non-function symbols in structs and classes anymore.
|
||||
for (size_t i = 0; i < countof(TypeTable.TypeHash); ++i)
|
||||
{
|
||||
for (PType *ty = TypeTable.TypeHash[i]; ty != NULL; ty = ty->HashNext)
|
||||
{
|
||||
if (ty->IsKindOf(RUNTIME_CLASS(PStruct)))
|
||||
{
|
||||
auto it = ty->Symbols.GetIterator();
|
||||
PSymbolTable::MapType::Pair *pair;
|
||||
while (it.NextPair(pair))
|
||||
{
|
||||
if (!pair->Value->IsKindOf(RUNTIME_CLASS(PField)) && !pair->Value->IsKindOf(RUNTIME_CLASS(PFunction)))
|
||||
{
|
||||
ty->Symbols.RemoveSymbol(pair->Value);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DPrintf(DMSG_SPAMMY, "%d symbols removed after compilation\n", count);
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ class VMFrameStack;
|
|||
struct VMValue;
|
||||
struct VMReturn;
|
||||
class VMFunction;
|
||||
struct FNamespaceManager;
|
||||
|
||||
// A VM function ------------------------------------------------------------
|
||||
|
||||
|
@ -157,6 +158,7 @@ private:
|
|||
MapType Symbols;
|
||||
|
||||
friend class DObject;
|
||||
friend struct FNamespaceManager;
|
||||
};
|
||||
|
||||
// A symbol for a compiler tree node ----------------------------------------
|
||||
|
@ -1010,6 +1012,7 @@ struct FNamespaceManager
|
|||
PNamespace *NewNamespace(int filenum);
|
||||
size_t MarkSymbols();
|
||||
void ReleaseSymbols();
|
||||
int RemoveSymbols();
|
||||
};
|
||||
|
||||
extern FNamespaceManager Namespaces;
|
||||
|
@ -1047,4 +1050,7 @@ inline T *&DObject::PointerVar(FName field)
|
|||
{
|
||||
return *(T**)ScriptVar(field, nullptr); // pointer check is more tricky and for the handful of uses in the DECORATE parser not worth the hassle.
|
||||
}
|
||||
|
||||
void RemoveUnusedSymbols();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -142,21 +142,25 @@ void DCorpsePointer::OnDestroy ()
|
|||
TThinkerIterator<DCorpsePointer> iterator (STAT_CORPSEPOINTER);
|
||||
DCorpsePointer *first = iterator.Next ();
|
||||
|
||||
int prevCount = first->Count;
|
||||
|
||||
if (first == this)
|
||||
// During a serialization unwind the thinker list won't be available.
|
||||
if (first != nullptr)
|
||||
{
|
||||
first = iterator.Next ();
|
||||
}
|
||||
int prevCount = first->Count;
|
||||
|
||||
if (first != NULL)
|
||||
{
|
||||
first->Count = prevCount - 1;
|
||||
}
|
||||
if (first == this)
|
||||
{
|
||||
first = iterator.Next();
|
||||
}
|
||||
|
||||
if (first != NULL)
|
||||
{
|
||||
first->Count = prevCount - 1;
|
||||
}
|
||||
|
||||
}
|
||||
if (Corpse != NULL)
|
||||
{
|
||||
Corpse->Destroy ();
|
||||
Corpse->Destroy();
|
||||
}
|
||||
Super::OnDestroy();
|
||||
}
|
||||
|
|
|
@ -133,6 +133,17 @@ CUSTOM_CVAR(Float, gl_ssao_exponent, 1.8f, 0)
|
|||
if (self < 0.1f) self = 0.1f;
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Float, gl_paltonemap_powtable, 2.0f, CVAR_ARCHIVE | CVAR_NOINITCALL)
|
||||
{
|
||||
GLRenderer->ClearTonemapPalette();
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Bool, gl_paltonemap_reverselookup, true, CVAR_ARCHIVE | CVAR_NOINITCALL)
|
||||
{
|
||||
GLRenderer->ClearTonemapPalette();
|
||||
}
|
||||
|
||||
|
||||
EXTERN_CVAR(Float, vid_brightness)
|
||||
EXTERN_CVAR(Float, vid_contrast)
|
||||
|
||||
|
@ -533,8 +544,11 @@ void FGLRenderer::CreateTonemapPalette()
|
|||
|
||||
void FGLRenderer::ClearTonemapPalette()
|
||||
{
|
||||
delete mTonemapPalette;
|
||||
mTonemapPalette = nullptr;
|
||||
if (mTonemapPalette)
|
||||
{
|
||||
delete mTonemapPalette;
|
||||
mTonemapPalette = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -821,14 +835,16 @@ int FGLRenderer::PTM_BestColor (const uint32 *pal_in, int r, int g, int b, int f
|
|||
const PalEntry *pal = (const PalEntry *)pal_in;
|
||||
static double powtable[256];
|
||||
static bool firstTime = true;
|
||||
static float trackpowtable = 0.;
|
||||
|
||||
double fbestdist, fdist;
|
||||
int bestcolor;
|
||||
|
||||
if (firstTime)
|
||||
if (firstTime || trackpowtable != gl_paltonemap_powtable)
|
||||
{
|
||||
trackpowtable = gl_paltonemap_powtable;
|
||||
firstTime = false;
|
||||
for (int x = 0; x < 256; x++) powtable[x] = pow((double)x/255,1.2);
|
||||
for (int x = 0; x < 256; x++) powtable[x] = pow((double)x/255, (double)gl_paltonemap_powtable);
|
||||
}
|
||||
|
||||
for (int color = first; color < num; color++)
|
||||
|
@ -837,9 +853,9 @@ int FGLRenderer::PTM_BestColor (const uint32 *pal_in, int r, int g, int b, int f
|
|||
double y = powtable[abs(g-pal[color].g)];
|
||||
double z = powtable[abs(b-pal[color].b)];
|
||||
fdist = x + y + z;
|
||||
if (color == first || fdist < fbestdist)
|
||||
if (color == first || ((gl_paltonemap_reverselookup)?(fdist <= fbestdist):(fdist < fbestdist)))
|
||||
{
|
||||
if (fdist == 0)
|
||||
if (fdist == 0 && !gl_paltonemap_reverselookup)
|
||||
return color;
|
||||
|
||||
fbestdist = fdist;
|
||||
|
|
|
@ -43,6 +43,7 @@ void gl_SetTextureMode(int type);
|
|||
FRenderState gl_RenderState;
|
||||
|
||||
CVAR(Bool, gl_direct_state_change, true, 0)
|
||||
CVAR(Bool, gl_bandedswlight, false, CVAR_ARCHIVE)
|
||||
|
||||
|
||||
static VSMatrix identityMatrix(1);
|
||||
|
@ -146,6 +147,7 @@ bool FRenderState::ApplyShader()
|
|||
|
||||
activeShader->muDesaturation.Set(mDesaturation / 255.f);
|
||||
activeShader->muFogEnabled.Set(fogset);
|
||||
activeShader->muPalLightLevels.Set(gl_bandedswlight);
|
||||
activeShader->muTextureMode.Set(mTextureMode);
|
||||
activeShader->muCameraPos.Set(mCameraPos.vec);
|
||||
activeShader->muLightParms.Set(mLightParms);
|
||||
|
|
|
@ -214,6 +214,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
|
||||
muDesaturation.Init(hShader, "uDesaturationFactor");
|
||||
muFogEnabled.Init(hShader, "uFogEnabled");
|
||||
muPalLightLevels.Init(hShader, "uPalLightLevels");
|
||||
muTextureMode.Init(hShader, "uTextureMode");
|
||||
muCameraPos.Init(hShader, "uCameraPos");
|
||||
muLightParms.Init(hShader, "uLightAttr");
|
||||
|
|
|
@ -259,6 +259,7 @@ class FShader
|
|||
|
||||
FBufferedUniform1f muDesaturation;
|
||||
FBufferedUniform1i muFogEnabled;
|
||||
FBufferedUniform1i muPalLightLevels;
|
||||
FBufferedUniform1i muTextureMode;
|
||||
FBufferedUniform4f muCameraPos;
|
||||
FBufferedUniform4f muLightParms;
|
||||
|
|
|
@ -156,6 +156,7 @@ FRandom::FRandom ()
|
|||
#endif
|
||||
Next = RNGList;
|
||||
RNGList = this;
|
||||
Init(0);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -199,6 +200,7 @@ FRandom::FRandom (const char *name)
|
|||
|
||||
Next = probe;
|
||||
*prev = this;
|
||||
Init(0);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -9716,7 +9716,16 @@ scriptwait:
|
|||
|
||||
if (runaway != 0 && InModuleScriptNumber >= 0)
|
||||
{
|
||||
activeBehavior->GetScriptPtr(InModuleScriptNumber)->ProfileData.AddRun(runaway);
|
||||
auto scriptptr = activeBehavior->GetScriptPtr(InModuleScriptNumber);
|
||||
if (scriptptr != nullptr)
|
||||
{
|
||||
scriptptr->ProfileData.AddRun(runaway);
|
||||
}
|
||||
else
|
||||
{
|
||||
// It is pointless to continue execution. The script is broken and needs to be aborted.
|
||||
I_Error("Bad script definition encountered. Script %d is reported running but not present.\nThe most likely cause for this message is using 'delay' inside a function which is not supported.\nPlease check the ACS compiler used for compiling the script!", InModuleScriptNumber);
|
||||
}
|
||||
}
|
||||
|
||||
if (state == SCRIPT_DivideBy0)
|
||||
|
|
|
@ -3532,7 +3532,14 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop)
|
|||
|| ((mo->flags6 & MF6_NOBOSSRIP) && (BlockingMobj->flags2 & MF2_BOSS))) && (BlockingMobj->flags2 & MF2_REFLECTIVE))
|
||||
|| ((BlockingMobj->player == NULL) && (!(BlockingMobj->flags3 & MF3_ISMONSTER)))))
|
||||
{
|
||||
if (mo->bouncecount > 0 && --mo->bouncecount == 0) return false;
|
||||
if (mo->bouncecount>0 && --mo->bouncecount == 0)
|
||||
{
|
||||
if (mo->flags & MF_MISSILE)
|
||||
P_ExplodeMissile(mo, nullptr, BlockingMobj);
|
||||
else
|
||||
mo->CallDie(BlockingMobj, nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mo->flags7 & MF7_HITTARGET) mo->target = BlockingMobj;
|
||||
if (mo->flags7 & MF7_HITMASTER) mo->master = BlockingMobj;
|
||||
|
|
|
@ -1814,15 +1814,18 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target)
|
|||
mo->effects = 0; // [RH]
|
||||
mo->flags &= ~MF_SHOOTABLE;
|
||||
|
||||
FState *nextstate=NULL;
|
||||
FState *nextstate = nullptr;
|
||||
|
||||
if (target != NULL && ((target->flags & (MF_SHOOTABLE|MF_CORPSE)) || (target->flags6 & MF6_KILLED)) )
|
||||
if (target != nullptr)
|
||||
{
|
||||
if (mo->flags7 & MF7_HITTARGET) mo->target = target;
|
||||
if (mo->flags7 & MF7_HITMASTER) mo->master = target;
|
||||
if (mo->flags7 & MF7_HITTRACER) mo->tracer = target;
|
||||
if (target->flags & MF_NOBLOOD) nextstate = mo->FindState(NAME_Crash);
|
||||
if (nextstate == NULL) nextstate = mo->FindState(NAME_Death, NAME_Extreme);
|
||||
if ((target->flags & (MF_SHOOTABLE | MF_CORPSE)) || (target->flags6 & MF6_KILLED))
|
||||
{
|
||||
if (target->flags & MF_NOBLOOD) nextstate = mo->FindState(NAME_Crash);
|
||||
if (nextstate == NULL) nextstate = mo->FindState(NAME_Death, NAME_Extreme);
|
||||
}
|
||||
}
|
||||
if (nextstate == NULL) nextstate = mo->FindState(NAME_Death);
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ static bool R_InstallSpriteLump (FTextureID lump, unsigned frame, char rot, bool
|
|||
|
||||
if (frame >= MAX_SPRITE_FRAMES || rotation > 16)
|
||||
{
|
||||
Printf (TEXTCOLOR_RED"R_InstallSpriteLump: Bad frame characters in lump %s\n", TexMan[lump]->Name.GetChars());
|
||||
Printf (TEXTCOLOR_RED "R_InstallSpriteLump: Bad frame characters in lump %s\n", TexMan[lump]->Name.GetChars());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1217,9 +1217,8 @@ static void ParseDamageDefinition(FScanner &sc)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void ParseDecorate (FScanner &sc)
|
||||
void ParseDecorate (FScanner &sc, PNamespace *ns)
|
||||
{
|
||||
auto ns = Namespaces.NewNamespace(sc.LumpNum);
|
||||
// Get actor class name.
|
||||
for(;;)
|
||||
{
|
||||
|
@ -1245,7 +1244,7 @@ void ParseDecorate (FScanner &sc)
|
|||
}
|
||||
FScanner newscanner;
|
||||
newscanner.Open(sc.String);
|
||||
ParseDecorate(newscanner);
|
||||
ParseDecorate(newscanner, ns);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1308,6 +1307,7 @@ void ParseAllDecorate()
|
|||
while ((lump = Wads.FindLump("DECORATE", &lastlump)) != -1)
|
||||
{
|
||||
FScanner sc(lump);
|
||||
ParseDecorate(sc);
|
||||
auto ns = Namespaces.NewNamespace(sc.LumpNum);
|
||||
ParseDecorate(sc, ns);
|
||||
}
|
||||
}
|
|
@ -2645,6 +2645,9 @@ GLPREFMNU_LENS = "Lens distortion effect";
|
|||
GLPREFMNU_SSAO = "Ambient occlusion quality";
|
||||
GLPREFMNU_SSAO_PORTALS = "Portals with AO";
|
||||
GLPREFMNU_FXAA = "FXAA Quality";
|
||||
GLPREFMNU_PALTONEMAPORDER = "Tonemap Palette Order";
|
||||
GLPREFMNU_PALTONEMAPPOWER = "Tonemap Palette Exponent";
|
||||
GLPREFMNU_SWLMBANDED = "Banded SW Lightmode";
|
||||
|
||||
// Option Values
|
||||
OPTVAL_SMART = "Smart";
|
||||
|
@ -2728,3 +2731,5 @@ OPTVAL_LOW = "Low";
|
|||
OPTVAL_MEDIUM = "Medium";
|
||||
OPTVAL_HIGH = "High";
|
||||
OPTVAL_EXTREME = "Extreme";
|
||||
OPTVAL_OBVERSEFIRST = "Obverse";
|
||||
OPTVAL_REVERSEFIRST = "Reverse";
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
OptionValue "LookupOrder"
|
||||
{
|
||||
0, "$OPTVAL_OBVERSEFIRST"
|
||||
1, "$OPTVAL_REVERSEFIRST"
|
||||
}
|
||||
|
||||
OptionValue "SpriteclipModes"
|
||||
{
|
||||
0, "$OPTVAL_NEVER"
|
||||
|
@ -226,6 +232,7 @@ OptionMenu "GLPrefOptions"
|
|||
{
|
||||
Title "$GLPREFMNU_TITLE"
|
||||
Option "$GLPREFMNU_SECLIGHTMODE", gl_lightmode, "LightingModes"
|
||||
Option "$GLPREFMNU_SWLMBANDED", gl_bandedswlight, "OnOff"
|
||||
Option "$GLPREFMNU_FOGMODE", gl_fogmode, "FogMode"
|
||||
Option "$GLPREFMNU_FOGFORCEFULLBRIGHT", gl_brightfog, "YesNo"
|
||||
Slider "$GLPREFMNU_WPNLIGHTSTR", gl_weaponlight, 0,32, 2
|
||||
|
@ -249,4 +256,7 @@ OptionMenu "GLPrefOptions"
|
|||
Option "$GLPREFMNU_SSAO", gl_ssao, "SSAOModes"
|
||||
Slider "$GLPREFMNU_SSAO_PORTALS", gl_ssao_portals, 0.0, 4.0, 1.0, 0
|
||||
Option "$GLPREFMNU_FXAA", gl_fxaa, "FXAAQuality"
|
||||
StaticText " "
|
||||
Slider "$GLPREFMNU_PALTONEMAPPOWER", gl_paltonemap_powtable, 0.2, 3.0, 0.1, 1
|
||||
Option "$GLPREFMNU_PALTONEMAPORDER", gl_paltonemap_reverselookup, "LookupOrder"
|
||||
}
|
||||
|
|
|
@ -121,7 +121,11 @@ float R_DoomLightingEquation(float light)
|
|||
/* The zdoom light equation */
|
||||
float vis = globVis / z;
|
||||
float shade = 64.0 - (L + 12.0) * 32.0/128.0;
|
||||
float lightscale = clamp((shade - min(24.0, vis)) / 32.0, 0.0, 31.0/32.0);
|
||||
float lightscale;
|
||||
if (uPalLightLevels != 0)
|
||||
lightscale = clamp(float(int(shade - min(24.0, vis))) / 32.0, 0.0, 31.0/32.0);
|
||||
else
|
||||
lightscale = clamp((shade - min(24.0, vis)) / 32.0, 0.0, 31.0/32.0);
|
||||
|
||||
// Result is the normalized colormap index (0 bright .. 1 dark)
|
||||
return lightscale;
|
||||
|
|
|
@ -41,6 +41,7 @@ uniform vec4 uLightAttr;
|
|||
#define uLightFactor uLightAttr.g
|
||||
#define uLightDist uLightAttr.r
|
||||
uniform int uFogEnabled;
|
||||
uniform int uPalLightLevels;
|
||||
|
||||
// dynamic lights
|
||||
uniform int uLightIndex;
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue