- fixed: Decal things did not spawn their lower decals.

This commit is contained in:
Christoph Oelckers 2021-09-17 00:48:12 +02:00
parent 918e9e9b0d
commit c9d9982b68
3 changed files with 13 additions and 30 deletions

View File

@ -886,7 +886,7 @@ const FDecalTemplate *FDecalLib::GetDecalByName (const char *name) const
FDecalBase *base = ScanTreeForName (name, Root);
if (base != NULL)
{
return static_cast<FDecalTemplate *>(base);
return base->GetDecal();
}
return NULL;
}

View File

@ -708,7 +708,7 @@ void DImpactDecal::Expired()
//
//----------------------------------------------------------------------------
DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, uint32_t bloodTranslation)
DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, uint32_t bloodTranslation)
{
if (cl_maxdecals > 0)
{
@ -719,7 +719,7 @@ DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name,
return StaticCreate (Level, tpl, pos, wall, ffloor, color, bloodTranslation);
}
}
return NULL;
return nullptr;
}
//----------------------------------------------------------------------------
@ -728,10 +728,10 @@ DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name,
//
//----------------------------------------------------------------------------
DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, uint32_t bloodTranslation)
DBaseDecal* DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color, uint32_t bloodTranslation, bool permanent)
{
DImpactDecal *decal = NULL;
if (tpl != NULL && cl_maxdecals > 0 && !(wall->Flags & WALLF_NOAUTODECALS))
DBaseDecal *decal = NULL;
if (tpl != NULL && ((cl_maxdecals > 0 && !(wall->Flags & WALLF_NOAUTODECALS)) || permanent))
{
if (tpl->LowerDecal)
{
@ -745,9 +745,10 @@ DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTempl
uint32_t lowerTrans = (bloodTranslation != 0 ? bloodTranslation : 0);
StaticCreate (Level, tpl_low, pos, wall, ffloor, lowercolor, lowerTrans);
StaticCreate (Level, tpl_low, pos, wall, ffloor, lowercolor, lowerTrans, permanent);
}
decal = Level->CreateThinker<DImpactDecal>(pos.Z);
if (!permanent) decal = Level->CreateThinker<DImpactDecal>(pos.Z);
else decal = Level->CreateThinker<DBaseDecal>(pos.Z);
if (decal == NULL)
{
return NULL;
@ -758,7 +759,7 @@ DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTempl
decal->Destroy();
return NULL;
}
decal->CheckMax();
if (!permanent) static_cast<DImpactDecal*>(decal)->CheckMax();
tpl->ApplyToDecal (decal, wall);
if (color != 0)
@ -885,30 +886,12 @@ DBaseDecal *ShootDecal(FLevelLocals *Level, const FDecalTemplate *tpl, sector_t
}
FTraceResults trace;
DBaseDecal *decal;
side_t *wall;
Trace(DVector3(x,y,z), sec, DVector3(angle.ToVector(), 0), tracedist, 0, 0, NULL, trace, TRACE_NoSky);
if (trace.HitType == TRACE_HitWall)
{
if (permanent)
{
decal = Level->CreateThinker<DBaseDecal>(trace.HitPos.Z);
wall = trace.Line->sidedef[trace.Side];
decal->StickToWall(wall, trace.HitPos.X, trace.HitPos.Y, trace.ffloor);
tpl->ApplyToDecal(decal, wall);
// Spread decal to nearby walls if it does not all fit on this one
if (cl_spreaddecals)
{
decal->Spread(tpl, wall, trace.HitPos.X, trace.HitPos.Y, trace.HitPos.Z, trace.ffloor);
}
return decal;
}
else
{
return DImpactDecal::StaticCreate(Level, tpl, trace.HitPos, trace.Line->sidedef[trace.Side], NULL);
}
return DImpactDecal::StaticCreate(Level, tpl, trace.HitPos, trace.Line->sidedef[trace.Side], NULL, 0, 0, permanent);
}
return NULL;
}

View File

@ -69,8 +69,8 @@ public:
}
void Construct(side_t *wall, const FDecalTemplate *templ);
static DImpactDecal *StaticCreate(FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, uint32_t bloodTranslation = 0);
static DImpactDecal *StaticCreate(FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, uint32_t bloodTranslation = 0);
static DBaseDecal *StaticCreate(FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, uint32_t bloodTranslation = 0);
static DBaseDecal *StaticCreate(FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0, uint32_t bloodTranslation = 0, bool permanent = false);
void BeginPlay ();
void Expired() override;