- give thinkers a 'level' member and change linking to the chain to happen outside the constructor.
This commit is contained in:
parent
df4c7d8f56
commit
8323524014
43 changed files with 201 additions and 228 deletions
|
|
@ -67,44 +67,23 @@ IMPLEMENT_POINTERS_END
|
|||
|
||||
IMPLEMENT_CLASS(DImpactDecal, false, false)
|
||||
|
||||
DBaseDecal::DBaseDecal ()
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(0), ScaleX(1.), ScaleY(1.), Alpha(1.),
|
||||
AlphaColor(0), Translation(0), RenderFlags(0)
|
||||
{
|
||||
RenderStyle = STYLE_None;
|
||||
PicNum.SetInvalid();
|
||||
}
|
||||
|
||||
DBaseDecal::DBaseDecal (double z)
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(1.), ScaleY(1.), Alpha(1.),
|
||||
: WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(1.), ScaleY(1.), Alpha(1.),
|
||||
AlphaColor(0), Translation(0), RenderFlags(0), Side(nullptr), Sector(nullptr)
|
||||
{
|
||||
RenderStyle = STYLE_None;
|
||||
PicNum.SetInvalid();
|
||||
}
|
||||
|
||||
DBaseDecal::DBaseDecal (int statnum, double z)
|
||||
: DThinker(statnum),
|
||||
WallNext(nullptr), WallPrev(nullptr), LeftDistance(0), Z(z), ScaleX(1.), ScaleY(1.), Alpha(1.),
|
||||
AlphaColor(0), Translation(0), RenderFlags(0), Side(nullptr), Sector(nullptr)
|
||||
{
|
||||
RenderStyle = STYLE_None;
|
||||
PicNum.SetInvalid();
|
||||
}
|
||||
|
||||
DBaseDecal::DBaseDecal (const AActor *basis)
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(nullptr), WallPrev(nullptr), LeftDistance(0), Z(basis->Z()), ScaleX(basis->Scale.X), ScaleY(basis->Scale.Y),
|
||||
: WallNext(nullptr), WallPrev(nullptr), LeftDistance(0), Z(basis->Z()), ScaleX(basis->Scale.X), ScaleY(basis->Scale.Y),
|
||||
Alpha(basis->Alpha), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum),
|
||||
RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle), Side(nullptr), Sector(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
DBaseDecal::DBaseDecal (const DBaseDecal *basis)
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(nullptr), WallPrev(nullptr), LeftDistance(basis->LeftDistance), Z(basis->Z), ScaleX(basis->ScaleX),
|
||||
: WallNext(nullptr), WallPrev(nullptr), LeftDistance(basis->LeftDistance), Z(basis->Z), ScaleX(basis->ScaleX),
|
||||
ScaleY(basis->ScaleY), Alpha(basis->Alpha), AlphaColor(basis->AlphaColor), Translation(basis->Translation),
|
||||
PicNum(basis->PicNum), RenderFlags(basis->RenderFlags), RenderStyle(basis->RenderStyle), Side(nullptr), Sector(nullptr)
|
||||
{
|
||||
|
|
@ -521,7 +500,7 @@ void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, double x, doub
|
|||
|
||||
DBaseDecal *DBaseDecal::CloneSelf (const FDecalTemplate *tpl, double ix, double iy, double iz, side_t *wall, F3DFloor * ffloor) const
|
||||
{
|
||||
DBaseDecal *decal = Create<DBaseDecal>(iz);
|
||||
DBaseDecal *decal = Level->CreateThinker<DBaseDecal>(iz);
|
||||
if (decal != NULL)
|
||||
{
|
||||
if (decal->StickToWall (wall, ix, iy, ffloor).isValid())
|
||||
|
|
@ -559,16 +538,6 @@ CUSTOM_CVAR (Int, cl_maxdecals, 1024, CVAR_ARCHIVE)
|
|||
}
|
||||
}
|
||||
|
||||
DImpactDecal::DImpactDecal ()
|
||||
: DBaseDecal (STAT_AUTODECAL, 0.)
|
||||
{
|
||||
}
|
||||
|
||||
DImpactDecal::DImpactDecal (double z)
|
||||
: DBaseDecal (STAT_AUTODECAL, z)
|
||||
{
|
||||
}
|
||||
|
||||
void DImpactDecal::CheckMax ()
|
||||
{
|
||||
if (++level.ImpactDecalCount >= cl_maxdecals)
|
||||
|
|
@ -582,7 +551,7 @@ void DImpactDecal::CheckMax ()
|
|||
}
|
||||
}
|
||||
|
||||
DImpactDecal *DImpactDecal::StaticCreate (const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
|
||||
DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
|
||||
{
|
||||
if (cl_maxdecals > 0)
|
||||
{
|
||||
|
|
@ -590,13 +559,13 @@ DImpactDecal *DImpactDecal::StaticCreate (const char *name, const DVector3 &pos,
|
|||
|
||||
if (tpl != NULL && (tpl = tpl->GetDecal()) != NULL)
|
||||
{
|
||||
return StaticCreate (tpl, pos, wall, ffloor, color);
|
||||
return StaticCreate (Level, tpl, pos, wall, ffloor, color);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
|
||||
DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
|
||||
{
|
||||
DImpactDecal *decal = NULL;
|
||||
if (tpl != NULL && cl_maxdecals > 0 && !(wall->Flags & WALLF_NOAUTODECALS))
|
||||
|
|
@ -610,9 +579,9 @@ DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, const DVect
|
|||
// apply the custom color as well.
|
||||
if (tpl->ShadeColor != tpl_low->ShadeColor) lowercolor=0;
|
||||
else lowercolor = color;
|
||||
StaticCreate (tpl_low, pos, wall, ffloor, lowercolor);
|
||||
StaticCreate (Level, tpl_low, pos, wall, ffloor, lowercolor);
|
||||
}
|
||||
decal = Create<DImpactDecal>(pos.Z);
|
||||
decal = Level->CreateThinker<DImpactDecal>(pos.Z);
|
||||
if (decal == NULL)
|
||||
{
|
||||
return NULL;
|
||||
|
|
@ -648,7 +617,7 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl
|
|||
return NULL;
|
||||
}
|
||||
|
||||
DImpactDecal *decal = Create<DImpactDecal>(iz);
|
||||
DImpactDecal *decal = Level->CreateThinker<DImpactDecal>(iz);
|
||||
if (decal != NULL)
|
||||
{
|
||||
if (decal->StickToWall (wall, ix, iy, ffloor).isValid())
|
||||
|
|
@ -709,12 +678,12 @@ void SprayDecal(AActor *shooter, const char *name, double distance)
|
|||
{
|
||||
if (trace.HitType == TRACE_HitWall)
|
||||
{
|
||||
DImpactDecal::StaticCreate(name, trace.HitPos, trace.Line->sidedef[trace.Side], NULL);
|
||||
DImpactDecal::StaticCreate(shooter->Level, name, trace.HitPos, trace.Line->sidedef[trace.Side], NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DBaseDecal *ShootDecal(const FDecalTemplate *tpl, AActor *basisactor, sector_t *sec, double x, double y, double z, DAngle angle, double tracedist, bool permanent)
|
||||
DBaseDecal *ShootDecal(FLevelLocals *Level, const FDecalTemplate *tpl, sector_t *sec, double x, double y, double z, DAngle angle, double tracedist, bool permanent)
|
||||
{
|
||||
if (tpl == NULL || (tpl = tpl->GetDecal()) == NULL)
|
||||
{
|
||||
|
|
@ -731,7 +700,7 @@ DBaseDecal *ShootDecal(const FDecalTemplate *tpl, AActor *basisactor, sector_t *
|
|||
{
|
||||
if (permanent)
|
||||
{
|
||||
decal = Create<DBaseDecal>(trace.HitPos.Z);
|
||||
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);
|
||||
|
|
@ -744,7 +713,7 @@ DBaseDecal *ShootDecal(const FDecalTemplate *tpl, AActor *basisactor, sector_t *
|
|||
}
|
||||
else
|
||||
{
|
||||
return DImpactDecal::StaticCreate(tpl, trace.HitPos, trace.Line->sidedef[trace.Side], NULL);
|
||||
return DImpactDecal::StaticCreate(Level, tpl, trace.HitPos, trace.Line->sidedef[trace.Side], NULL);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -779,7 +748,7 @@ DEFINE_ACTION_FUNCTION(ADecal, SpawnDecal)
|
|||
// Look for a wall within 64 units behind the actor. If none can be
|
||||
// found, then no decal is created, and this actor is destroyed
|
||||
// without effectively doing anything.
|
||||
if (NULL == ShootDecal(tpl, self, self->Sector, self->X(), self->Y(), self->Z(), self->Angles.Yaw + 180, 64., true))
|
||||
if (!ShootDecal(self->Level, tpl, self->Sector, self->X(), self->Y(), self->Z(), self->Angles.Yaw + 180, 64., true))
|
||||
{
|
||||
DPrintf (DMSG_WARNING, "Could not find a wall to stick decal to at (%f,%f)\n", self->X(), self->Y());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue