- floatified the decal code.
This commit is contained in:
parent
6b3c0ecbd3
commit
301f5abadc
12 changed files with 178 additions and 158 deletions
|
|
@ -47,8 +47,8 @@
|
|||
#include "farchive.h"
|
||||
#include "doomdata.h"
|
||||
|
||||
static fixed_t DecalWidth, DecalLeft, DecalRight;
|
||||
static fixed_t SpreadZ;
|
||||
static double DecalWidth, DecalLeft, DecalRight;
|
||||
static double SpreadZ;
|
||||
static const DBaseDecal *SpreadSource;
|
||||
static const FDecalTemplate *SpreadTemplate;
|
||||
static TArray<side_t *> SpreadStack;
|
||||
|
|
@ -65,25 +65,25 @@ IMPLEMENT_CLASS (DImpactDecal)
|
|||
|
||||
DBaseDecal::DBaseDecal ()
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(0), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(OPAQUE),
|
||||
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 (fixed_t z)
|
||||
DBaseDecal::DBaseDecal (double z)
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(OPAQUE),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(1.), ScaleY(1.), Alpha(1.),
|
||||
AlphaColor(0), Translation(0), RenderFlags(0)
|
||||
{
|
||||
RenderStyle = STYLE_None;
|
||||
PicNum.SetInvalid();
|
||||
}
|
||||
|
||||
DBaseDecal::DBaseDecal (int statnum, fixed_t z)
|
||||
DBaseDecal::DBaseDecal (int statnum, double z)
|
||||
: DThinker(statnum),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(FRACUNIT), ScaleY(FRACUNIT), Alpha(OPAQUE),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(1.), ScaleY(1.), Alpha(1.),
|
||||
AlphaColor(0), Translation(0), RenderFlags(0)
|
||||
{
|
||||
RenderStyle = STYLE_None;
|
||||
|
|
@ -92,8 +92,8 @@ DBaseDecal::DBaseDecal (int statnum, fixed_t z)
|
|||
|
||||
DBaseDecal::DBaseDecal (const AActor *basis)
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->_f_Z()), ScaleX(FLOAT2FIXED(basis->Scale.X)), ScaleY(FLOAT2FIXED(basis->Scale.Y)),
|
||||
Alpha(FLOAT2FIXED(basis->Alpha)), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum),
|
||||
WallNext(0), WallPrev(0), 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)
|
||||
{
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ DBaseDecal::DBaseDecal (const AActor *basis)
|
|||
DBaseDecal::DBaseDecal (const DBaseDecal *basis)
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(0), WallPrev(0), LeftDistance(basis->LeftDistance), Z(basis->Z), ScaleX(basis->ScaleX),
|
||||
ScaleY(basis->ScaleY), Alpha(basis->Alpha), AlphaColor(basis->AlphaColor), Translation(basis->Translation),
|
||||
ScaleY(basis->ScaleY), Alpha(basis->Alpha), AlphaColor(basis->AlphaColor), Translation(basis->Translation),
|
||||
PicNum(basis->PicNum), RenderFlags(basis->RenderFlags), RenderStyle(basis->RenderStyle)
|
||||
{
|
||||
}
|
||||
|
|
@ -174,7 +174,7 @@ void DBaseDecal::SerializeChain (FArchive &arc, DBaseDecal **first)
|
|||
}
|
||||
}
|
||||
|
||||
void DBaseDecal::GetXY (side_t *wall, fixed_t &ox, fixed_t &oy) const
|
||||
void DBaseDecal::GetXY (side_t *wall, double &ox, double &oy) const
|
||||
{
|
||||
line_t *line = wall->linedef;
|
||||
vertex_t *v1, *v2;
|
||||
|
|
@ -190,11 +190,11 @@ void DBaseDecal::GetXY (side_t *wall, fixed_t &ox, fixed_t &oy) const
|
|||
v2 = line->v1;
|
||||
}
|
||||
|
||||
fixed_t dx = v2->x - v1->x;
|
||||
fixed_t dy = v2->y - v1->y;
|
||||
double dx = v2->fX() - v1->fX();
|
||||
double dy = v2->fY() - v1->fY();
|
||||
|
||||
ox = v1->x + MulScale30 (LeftDistance, dx);
|
||||
oy = v1->y + MulScale30 (LeftDistance, dy);
|
||||
ox = v1->fX() + LeftDistance * dx;
|
||||
oy = v1->fY() + LeftDistance * dy;
|
||||
}
|
||||
|
||||
void DBaseDecal::SetShade (DWORD rgb)
|
||||
|
|
@ -209,7 +209,7 @@ void DBaseDecal::SetShade (int r, int g, int b)
|
|||
}
|
||||
|
||||
// Returns the texture the decal stuck to.
|
||||
FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor *ffloor)
|
||||
FTextureID DBaseDecal::StickToWall (side_t *wall, double x, double y, F3DFloor *ffloor)
|
||||
{
|
||||
// Stick the decal at the end of the chain so it appears on top
|
||||
DBaseDecal *next, **prev;
|
||||
|
|
@ -250,27 +250,27 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor
|
|||
{
|
||||
RenderFlags |= RF_RELMID;
|
||||
if (line->flags & ML_DONTPEGBOTTOM)
|
||||
Z -= front->GetPlaneTexZ(sector_t::floor);
|
||||
Z -= front->GetPlaneTexZF(sector_t::floor);
|
||||
else
|
||||
Z -= front->GetPlaneTexZ(sector_t::ceiling);
|
||||
Z -= front->GetPlaneTexZF(sector_t::ceiling);
|
||||
tex = wall->GetTexture(side_t::mid);
|
||||
}
|
||||
else if (back->floorplane.ZatPoint (x, y) >= Z)
|
||||
{
|
||||
RenderFlags |= RF_RELLOWER|RF_CLIPLOWER;
|
||||
if (line->flags & ML_DONTPEGBOTTOM)
|
||||
Z -= front->GetPlaneTexZ(sector_t::ceiling);
|
||||
Z -= front->GetPlaneTexZF(sector_t::ceiling);
|
||||
else
|
||||
Z -= back->GetPlaneTexZ(sector_t::floor);
|
||||
Z -= back->GetPlaneTexZF(sector_t::floor);
|
||||
tex = wall->GetTexture(side_t::bottom);
|
||||
}
|
||||
else if (back->ceilingplane.ZatPoint (x, y) <= Z)
|
||||
{
|
||||
RenderFlags |= RF_RELUPPER|RF_CLIPUPPER;
|
||||
if (line->flags & ML_DONTPEGTOP)
|
||||
Z -= front->GetPlaneTexZ(sector_t::ceiling);
|
||||
Z -= front->GetPlaneTexZF(sector_t::ceiling);
|
||||
else
|
||||
Z -= back->GetPlaneTexZ(sector_t::ceiling);
|
||||
Z -= back->GetPlaneTexZF(sector_t::ceiling);
|
||||
tex = wall->GetTexture(side_t::top);
|
||||
}
|
||||
else if (ffloor) // this is a 3d-floor segment - do this only if we know which one!
|
||||
|
|
@ -278,9 +278,9 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor
|
|||
Sector=ffloor->model;
|
||||
RenderFlags |= RF_RELMID|RF_CLIPMID;
|
||||
if (line->flags & ML_DONTPEGBOTTOM)
|
||||
Z -= Sector->GetPlaneTexZ(sector_t::floor);
|
||||
Z -= Sector->GetPlaneTexZF(sector_t::floor);
|
||||
else
|
||||
Z -= Sector->GetPlaneTexZ(sector_t::ceiling);
|
||||
Z -= Sector->GetPlaneTexZF(sector_t::ceiling);
|
||||
|
||||
if (ffloor->flags & FF_UPPERTEXTURE)
|
||||
{
|
||||
|
|
@ -308,7 +308,7 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, fixed_t x, fixed_t y, F3DFloor
|
|||
return tex;
|
||||
}
|
||||
|
||||
fixed_t DBaseDecal::GetRealZ (const side_t *wall) const
|
||||
double DBaseDecal::GetRealZ (const side_t *wall) const
|
||||
{
|
||||
const line_t *line = wall->linedef;
|
||||
const sector_t *front, *back;
|
||||
|
|
@ -335,34 +335,34 @@ fixed_t DBaseDecal::GetRealZ (const side_t *wall) const
|
|||
case RF_RELUPPER:
|
||||
if (line->flags & ML_DONTPEGTOP)
|
||||
{
|
||||
return Z + front->GetPlaneTexZ(sector_t::ceiling);
|
||||
return Z + front->GetPlaneTexZF(sector_t::ceiling);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Z + back->GetPlaneTexZ(sector_t::ceiling);
|
||||
return Z + back->GetPlaneTexZF(sector_t::ceiling);
|
||||
}
|
||||
case RF_RELLOWER:
|
||||
if (line->flags & ML_DONTPEGBOTTOM)
|
||||
{
|
||||
return Z + front->GetPlaneTexZ(sector_t::ceiling);
|
||||
return Z + front->GetPlaneTexZF(sector_t::ceiling);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Z + back->GetPlaneTexZ(sector_t::floor);
|
||||
return Z + back->GetPlaneTexZF(sector_t::floor);
|
||||
}
|
||||
case RF_RELMID:
|
||||
if (line->flags & ML_DONTPEGBOTTOM)
|
||||
{
|
||||
return Z + front->GetPlaneTexZ(sector_t::floor);
|
||||
return Z + front->GetPlaneTexZF(sector_t::floor);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Z + front->GetPlaneTexZ(sector_t::ceiling);
|
||||
return Z + front->GetPlaneTexZF(sector_t::ceiling);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DBaseDecal::CalcFracPos (side_t *wall, fixed_t x, fixed_t y)
|
||||
void DBaseDecal::CalcFracPos (side_t *wall, double x, double y)
|
||||
{
|
||||
line_t *line = wall->linedef;
|
||||
vertex_t *v1, *v2;
|
||||
|
|
@ -378,16 +378,16 @@ void DBaseDecal::CalcFracPos (side_t *wall, fixed_t x, fixed_t y)
|
|||
v2 = line->v1;
|
||||
}
|
||||
|
||||
fixed_t dx = v2->x - v1->x;
|
||||
fixed_t dy = v2->y - v1->y;
|
||||
double dx = v2->fX() - v1->fX();
|
||||
double dy = v2->fY() - v1->fY();
|
||||
|
||||
if (abs(dx) > abs(dy))
|
||||
if (fabs(dx) > fabs(dy))
|
||||
{
|
||||
LeftDistance = SafeDivScale30 (x - v1->x, dx);
|
||||
LeftDistance = (x - v1->fX()) / dx;
|
||||
}
|
||||
else if (dy != 0)
|
||||
{
|
||||
LeftDistance = SafeDivScale30 (y - v1->y, dy);
|
||||
LeftDistance = (y - v1->fY()) / dy;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -395,26 +395,26 @@ void DBaseDecal::CalcFracPos (side_t *wall, fixed_t x, fixed_t y)
|
|||
}
|
||||
}
|
||||
|
||||
static void GetWallStuff (side_t *wall, vertex_t *&v1, fixed_t &ldx, fixed_t &ldy)
|
||||
static void GetWallStuff (side_t *wall, vertex_t *&v1, double &ldx, double &ldy)
|
||||
{
|
||||
line_t *line = wall->linedef;
|
||||
if (line->sidedef[0] == wall)
|
||||
{
|
||||
v1 = line->v1;
|
||||
ldx = line->dx;
|
||||
ldy = line->dy;
|
||||
ldx = line->Delta().X;
|
||||
ldy = line->Delta().Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
v1 = line->v2;
|
||||
ldx = -line->dx;
|
||||
ldy = -line->dy;
|
||||
ldx = -line->Delta().X;
|
||||
ldy = -line->Delta().Y;
|
||||
}
|
||||
}
|
||||
|
||||
static fixed_t Length (fixed_t dx, fixed_t dy)
|
||||
static double Length (double dx, double dy)
|
||||
{
|
||||
return (fixed_t)g_sqrt ((double)dx*(double)dx+(double)dy*(double)dy);
|
||||
return DVector2(dx, dy).Length();
|
||||
}
|
||||
|
||||
static side_t *NextWall (const side_t *wall)
|
||||
|
|
@ -435,25 +435,25 @@ static side_t *NextWall (const side_t *wall)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void DBaseDecal::SpreadLeft (fixed_t r, vertex_t *v1, side_t *feelwall, F3DFloor *ffloor)
|
||||
void DBaseDecal::SpreadLeft (double r, vertex_t *v1, side_t *feelwall, F3DFloor *ffloor)
|
||||
{
|
||||
fixed_t ldx, ldy;
|
||||
double ldx, ldy;
|
||||
|
||||
SpreadStack.Push (feelwall);
|
||||
|
||||
while (r < 0 && feelwall->LeftSide != NO_SIDE)
|
||||
{
|
||||
fixed_t startr = r;
|
||||
double startr = r;
|
||||
|
||||
fixed_t x = v1->x;
|
||||
fixed_t y = v1->y;
|
||||
double x = v1->fX();
|
||||
double y = v1->fY();
|
||||
|
||||
feelwall = &sides[feelwall->LeftSide];
|
||||
GetWallStuff (feelwall, v1, ldx, ldy);
|
||||
fixed_t wallsize = Length (ldx, ldy);
|
||||
double wallsize = Length (ldx, ldy);
|
||||
r += DecalLeft;
|
||||
x += Scale (r, ldx, wallsize);
|
||||
y += Scale (r, ldy, wallsize);
|
||||
x += r*ldx / wallsize;
|
||||
y += r*ldy / wallsize;
|
||||
r = wallsize + startr;
|
||||
SpreadSource->CloneSelf (SpreadTemplate, x, y, SpreadZ, feelwall, ffloor);
|
||||
SpreadStack.Push (feelwall);
|
||||
|
|
@ -479,10 +479,10 @@ void DBaseDecal::SpreadLeft (fixed_t r, vertex_t *v1, side_t *feelwall, F3DFloor
|
|||
}
|
||||
}
|
||||
|
||||
void DBaseDecal::SpreadRight (fixed_t r, side_t *feelwall, fixed_t wallsize, F3DFloor *ffloor)
|
||||
void DBaseDecal::SpreadRight (double r, side_t *feelwall, double wallsize, F3DFloor *ffloor)
|
||||
{
|
||||
vertex_t *v1;
|
||||
fixed_t x, y, ldx, ldy;
|
||||
double x, y, ldx, ldy;
|
||||
|
||||
SpreadStack.Push (feelwall);
|
||||
|
||||
|
|
@ -508,25 +508,25 @@ void DBaseDecal::SpreadRight (fixed_t r, side_t *feelwall, fixed_t wallsize, F3D
|
|||
|
||||
r = DecalWidth - r + wallsize - DecalLeft;
|
||||
GetWallStuff (feelwall, v1, ldx, ldy);
|
||||
x = v1->x;
|
||||
y = v1->y;
|
||||
x = v1->fX();
|
||||
y = v1->fY();
|
||||
wallsize = Length (ldx, ldy);
|
||||
x -= Scale (r, ldx, wallsize);
|
||||
y -= Scale (r, ldy, wallsize);
|
||||
x -= r*ldx / wallsize;
|
||||
y -= r*ldy / wallsize;
|
||||
r = DecalRight - r;
|
||||
SpreadSource->CloneSelf (SpreadTemplate, x, y, SpreadZ, feelwall, ffloor);
|
||||
SpreadStack.Push (feelwall);
|
||||
}
|
||||
}
|
||||
|
||||
void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, fixed_t x, fixed_t y, fixed_t z, F3DFloor * ffloor)
|
||||
void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, double x, double y, double z, F3DFloor * ffloor)
|
||||
{
|
||||
FTexture *tex;
|
||||
vertex_t *v1;
|
||||
fixed_t rorg, ldx, ldy;
|
||||
double rorg, ldx, ldy;
|
||||
|
||||
GetWallStuff (wall, v1, ldx, ldy);
|
||||
rorg = Length (x - v1->x, y - v1->y);
|
||||
rorg = Length (x - v1->fX(), y - v1->fY());
|
||||
|
||||
if ((tex = TexMan[PicNum]) == NULL)
|
||||
{
|
||||
|
|
@ -548,11 +548,11 @@ void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, fixed_t x, fix
|
|||
|
||||
// Then try spreading right
|
||||
SpreadRight (rorg + DecalRight, wall,
|
||||
Length (wall->linedef->dx, wall->linedef->dy), ffloor);
|
||||
Length (wall->linedef->Delta().X, wall->linedef->Delta().Y), ffloor);
|
||||
SpreadStack.Clear ();
|
||||
}
|
||||
|
||||
DBaseDecal *DBaseDecal::CloneSelf (const FDecalTemplate *tpl, fixed_t ix, fixed_t iy, fixed_t iz, side_t *wall, F3DFloor * ffloor) const
|
||||
DBaseDecal *DBaseDecal::CloneSelf (const FDecalTemplate *tpl, double ix, double iy, double iz, side_t *wall, F3DFloor * ffloor) const
|
||||
{
|
||||
DBaseDecal *decal = new DBaseDecal(iz);
|
||||
if (decal != NULL)
|
||||
|
|
@ -615,12 +615,12 @@ void DImpactDecal::Serialize (FArchive &arc)
|
|||
}
|
||||
|
||||
DImpactDecal::DImpactDecal ()
|
||||
: DBaseDecal (STAT_AUTODECAL, 0)
|
||||
: DBaseDecal (STAT_AUTODECAL, 0.)
|
||||
{
|
||||
ImpactCount++;
|
||||
}
|
||||
|
||||
DImpactDecal::DImpactDecal (fixed_t z)
|
||||
DImpactDecal::DImpactDecal (double z)
|
||||
: DBaseDecal (STAT_AUTODECAL, z)
|
||||
{
|
||||
ImpactCount++;
|
||||
|
|
@ -638,7 +638,7 @@ void DImpactDecal::CheckMax ()
|
|||
}
|
||||
}
|
||||
|
||||
DImpactDecal *DImpactDecal::StaticCreate (const char *name, const fixedvec3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
|
||||
DImpactDecal *DImpactDecal::StaticCreate (const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
|
||||
{
|
||||
if (cl_maxdecals > 0)
|
||||
{
|
||||
|
|
@ -652,7 +652,7 @@ DImpactDecal *DImpactDecal::StaticCreate (const char *name, const fixedvec3 &pos
|
|||
return NULL;
|
||||
}
|
||||
|
||||
DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, const fixedvec3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
|
||||
DImpactDecal *DImpactDecal::StaticCreate (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))
|
||||
|
|
@ -669,13 +669,13 @@ DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, const fixed
|
|||
StaticCreate (tpl_low, pos, wall, ffloor, lowercolor);
|
||||
}
|
||||
DImpactDecal::CheckMax();
|
||||
decal = new DImpactDecal (pos.z);
|
||||
decal = new DImpactDecal (pos.Z);
|
||||
if (decal == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!decal->StickToWall (wall, pos.x, pos.y, ffloor).isValid())
|
||||
if (!decal->StickToWall (wall, pos.X, pos.Y, ffloor).isValid())
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -692,12 +692,12 @@ DImpactDecal *DImpactDecal::StaticCreate (const FDecalTemplate *tpl, const fixed
|
|||
}
|
||||
|
||||
// Spread decal to nearby walls if it does not all fit on this one
|
||||
decal->Spread (tpl, wall, pos.x, pos.y, pos.z, ffloor);
|
||||
decal->Spread (tpl, wall, pos.X, pos.Y, pos.Z, ffloor);
|
||||
}
|
||||
return decal;
|
||||
}
|
||||
|
||||
DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, fixed_t ix, fixed_t iy, fixed_t iz, side_t *wall, F3DFloor * ffloor) const
|
||||
DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, double iy, double iz, side_t *wall, F3DFloor * ffloor) const
|
||||
{
|
||||
if (wall->Flags & WALLF_NOAUTODECALS)
|
||||
{
|
||||
|
|
@ -758,7 +758,7 @@ CCMD (spray)
|
|||
Net_WriteString (argv[1]);
|
||||
}
|
||||
|
||||
DBaseDecal *ShootDecal(const FDecalTemplate *tpl, AActor *basisactor, sector_t *sec, fixed_t x, fixed_t y, fixed_t z, angle_t angle, fixed_t tracedist, bool permanent)
|
||||
DBaseDecal *ShootDecal(const FDecalTemplate *tpl, AActor *basisactor, sector_t *sec, double x, double y, double z, DAngle angle, double tracedist, bool permanent)
|
||||
{
|
||||
if (tpl == NULL || (tpl = tpl->GetDecal()) == NULL)
|
||||
{
|
||||
|
|
@ -769,30 +769,28 @@ DBaseDecal *ShootDecal(const FDecalTemplate *tpl, AActor *basisactor, sector_t *
|
|||
DBaseDecal *decal;
|
||||
side_t *wall;
|
||||
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
|
||||
Trace(x, y, z, sec,
|
||||
finecosine[angle], finesine[angle], 0,
|
||||
tracedist, 0, 0, NULL, trace, TRACE_NoSky);
|
||||
Trace(FLOAT2FIXED(x), FLOAT2FIXED(y), FLOAT2FIXED(z), sec,
|
||||
FLOAT2FIXED(angle.Cos()), FLOAT2FIXED(angle.Sin()), 0,
|
||||
FLOAT2FIXED(tracedist), 0, 0, NULL, trace, TRACE_NoSky);
|
||||
|
||||
if (trace.HitType == TRACE_HitWall)
|
||||
{
|
||||
if (permanent)
|
||||
{
|
||||
decal = new DBaseDecal(trace.HitPos.z);
|
||||
decal = new DBaseDecal(FIXED2DBL(trace.HitPos.z));
|
||||
wall = trace.Line->sidedef[trace.Side];
|
||||
decal->StickToWall(wall, trace.HitPos.x, trace.HitPos.y, trace.ffloor);
|
||||
decal->StickToWall(wall, FIXED2DBL(trace.HitPos.x), FIXED2DBL(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);
|
||||
decal->Spread(tpl, wall, FIXED2DBL(trace.HitPos.x), FIXED2DBL(trace.HitPos.y), FIXED2DBL(trace.HitPos.z), trace.ffloor);
|
||||
}
|
||||
return decal;
|
||||
}
|
||||
else
|
||||
{
|
||||
return DImpactDecal::StaticCreate(tpl, trace.HitPos, trace.Line->sidedef[trace.Side], NULL);
|
||||
return DImpactDecal::StaticCreate(tpl, DVector3(FIXED2DBL(trace.HitPos.x), FIXED2DBL(trace.HitPos.y), FIXED2DBL(trace.HitPos.z)), trace.Line->sidedef[trace.Side], NULL);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -827,7 +825,7 @@ void ADecal::BeginPlay ()
|
|||
// 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, this, Sector, _f_X(), _f_Y(), _f_Z(), FLOAT2ANGLE(Angles.Yaw.Degrees) + ANGLE_180, 64*FRACUNIT, true))
|
||||
if (NULL == ShootDecal(tpl, this, Sector, X(), Y(), Z(), Angles.Yaw + 180, 64., true))
|
||||
{
|
||||
DPrintf ("Could not find a wall to stick decal to at (%f,%f)\n", X(), Y());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue