Permalink
Browse files

- properly un-count faded out decals without involving the Destroy me…

…thod.
  • Loading branch information...
coelckers committed Feb 7, 2019
1 parent 97e3e85 commit 9dec214c156ecfb05f2757cf6bdf4228995f51ae
Showing with 16 additions and 0 deletions.
  1. +1 −0 src/g_shared/a_decalfx.cpp
  2. +13 −0 src/g_shared/a_decals.cpp
  3. +2 −0 src/g_shared/a_sharedglobal.h
@@ -76,6 +76,7 @@ void DDecalFader::Tick ()
}
else if (Level->maptime >= TimeToEndDecay)
{
TheDecal->Expired(); // for impact decal bookkeeping.
TheDecal->Destroy (); // remove the decal
Destroy (); // remove myself
return;
@@ -666,6 +666,8 @@ DBaseDecal *DBaseDecal::CloneSelf (const FDecalTemplate *tpl, double ix, double

void DImpactDecal::CheckMax ()
{
static int SpawnCounter;

if (++Level->ImpactDecalCount >= cl_maxdecals)
{
DThinker *thinker = Level->FirstThinker (STAT_AUTODECAL);
@@ -683,6 +685,17 @@ void DImpactDecal::CheckMax ()
//
//----------------------------------------------------------------------------

void DImpactDecal::Expired()
{
Level->ImpactDecalCount--;
}

//----------------------------------------------------------------------------
//
//
//
//----------------------------------------------------------------------------

DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
{
if (cl_maxdecals > 0)
@@ -26,6 +26,7 @@ class DBaseDecal : public DThinker

void Serialize(FSerializer &arc);
void OnDestroy() override;
virtual void Expired() {} // For thinkers that can remove their decal. For impact decal bookkeeping.
FTextureID StickToWall(side_t *wall, double x, double y, F3DFloor * ffloor);
double GetRealZ (const side_t *wall) const;
void SetShade (uint32_t rgb);
@@ -71,6 +72,7 @@ class DImpactDecal : public DBaseDecal
static DImpactDecal *StaticCreate(FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0);

void BeginPlay ();
void Expired() override;

protected:
DBaseDecal *CloneSelf(const FDecalTemplate *tpl, double x, double y, double z, side_t *wall, F3DFloor * ffloor) const;

0 comments on commit 9dec214

Please sign in to comment.