- Replaced P_PathTraverse with an FPathTraverse class, rewrote all code using
P_PathTraverse and got rid of a lot of global variables in the process. SVN r898 (trunk)
This commit is contained in:
parent
a0356a45cd
commit
a390ea6a61
10 changed files with 966 additions and 959 deletions
499
src/p_trace.cpp
499
src/p_trace.cpp
|
|
@ -36,21 +36,26 @@
|
|||
#include "p_local.h"
|
||||
#include "i_system.h"
|
||||
|
||||
static fixed_t StartZ;
|
||||
static fixed_t Vx, Vy, Vz;
|
||||
static DWORD ActorMask, WallMask;
|
||||
static AActor *IgnoreThis;
|
||||
static FTraceResults *Results;
|
||||
static sector_t *CurSector;
|
||||
static fixed_t MaxDist;
|
||||
static fixed_t EnterDist;
|
||||
static bool (*TraceCallback)(FTraceResults &res);
|
||||
static DWORD TraceFlags;
|
||||
struct FTraceInfo
|
||||
{
|
||||
fixed_t StartX, StartY, StartZ;
|
||||
fixed_t Vx, Vy, Vz;
|
||||
DWORD ActorMask, WallMask;
|
||||
AActor *IgnoreThis;
|
||||
FTraceResults *Results;
|
||||
sector_t *CurSector;
|
||||
fixed_t MaxDist;
|
||||
fixed_t EnterDist;
|
||||
bool (*TraceCallback)(FTraceResults &res);
|
||||
DWORD TraceFlags;
|
||||
|
||||
bool TraceTraverse (int ptflags);
|
||||
bool CheckSectorPlane (const sector_t *sector, bool checkFloor);
|
||||
};
|
||||
|
||||
static bool PTR_TraceIterator (intercept_t *);
|
||||
static bool CheckSectorPlane (const sector_t *sector, bool checkFloor);
|
||||
static bool EditTraceResult (DWORD flags, FTraceResults &res);
|
||||
|
||||
|
||||
bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector,
|
||||
fixed_t vx, fixed_t vy, fixed_t vz, fixed_t maxDist,
|
||||
DWORD actorMask, DWORD wallMask, AActor *ignore,
|
||||
|
|
@ -58,42 +63,45 @@ bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector,
|
|||
DWORD flags, bool (*callback)(FTraceResults &res))
|
||||
{
|
||||
int ptflags;
|
||||
FTraceInfo inf;
|
||||
|
||||
ptflags = actorMask ? PT_ADDLINES|PT_ADDTHINGS : PT_ADDLINES;
|
||||
|
||||
StartZ = z;
|
||||
Vx = vx;
|
||||
Vy = vy;
|
||||
Vz = vz;
|
||||
ActorMask = actorMask;
|
||||
WallMask = wallMask;
|
||||
IgnoreThis = ignore;
|
||||
CurSector = sector;
|
||||
MaxDist = maxDist;
|
||||
EnterDist = 0;
|
||||
TraceCallback = callback;
|
||||
TraceFlags = flags;
|
||||
inf.StartX = x;
|
||||
inf.StartY = y;
|
||||
inf.StartZ = z;
|
||||
inf.Vx = vx;
|
||||
inf.Vy = vy;
|
||||
inf.Vz = vz;
|
||||
inf.ActorMask = actorMask;
|
||||
inf.WallMask = wallMask;
|
||||
inf.IgnoreThis = ignore;
|
||||
inf.CurSector = sector;
|
||||
inf.MaxDist = maxDist;
|
||||
inf.EnterDist = 0;
|
||||
inf.TraceCallback = callback;
|
||||
inf.TraceFlags = flags;
|
||||
res.CrossedWater = NULL;
|
||||
Results = &res;
|
||||
inf.Results = &res;
|
||||
|
||||
res.HitType = TRACE_HitNone;
|
||||
|
||||
if (P_PathTraverse (x, y, x + FixedMul (vx, maxDist), y + FixedMul (vy, maxDist),
|
||||
ptflags, PTR_TraceIterator))
|
||||
{ // check for intersection with floor/ceiling
|
||||
res.Sector = CurSector;
|
||||
|
||||
if (CheckSectorPlane (CurSector, true))
|
||||
if (inf.TraceTraverse (ptflags))
|
||||
{ // check for intersection with floor/ceiling
|
||||
res.Sector = inf.CurSector;
|
||||
|
||||
if (inf.CheckSectorPlane (inf.CurSector, true))
|
||||
{
|
||||
res.HitType = TRACE_HitFloor;
|
||||
if (res.CrossedWater == NULL &&
|
||||
CurSector->heightsec != NULL &&
|
||||
CurSector->heightsec->floorplane.ZatPoint (res.X, res.Y) >= res.Z)
|
||||
inf.CurSector->heightsec != NULL &&
|
||||
inf.CurSector->heightsec->floorplane.ZatPoint (res.X, res.Y) >= res.Z)
|
||||
{
|
||||
res.CrossedWater = CurSector;
|
||||
res.CrossedWater = inf.CurSector;
|
||||
}
|
||||
}
|
||||
else if (CheckSectorPlane (CurSector, false))
|
||||
else if (inf.CheckSectorPlane (inf.CurSector, false))
|
||||
{
|
||||
res.HitType = TRACE_HitCeiling;
|
||||
}
|
||||
|
|
@ -122,246 +130,253 @@ bool Trace (fixed_t x, fixed_t y, fixed_t z, sector_t *sector,
|
|||
}
|
||||
}
|
||||
|
||||
static bool PTR_TraceIterator (intercept_t *in)
|
||||
bool FTraceInfo::TraceTraverse (int ptflags)
|
||||
{
|
||||
fixed_t hitx, hity, hitz;
|
||||
fixed_t dist;
|
||||
FPathTraverse it(StartX, StartY, StartX + FixedMul (Vx, MaxDist), StartY + FixedMul (Vy, MaxDist), ptflags);
|
||||
intercept_t *in;
|
||||
|
||||
if (in->isaline)
|
||||
while ((in = it.Next()))
|
||||
{
|
||||
int lineside;
|
||||
sector_t *entersector;
|
||||
fixed_t hitx, hity, hitz;
|
||||
fixed_t dist;
|
||||
|
||||
dist = FixedMul (MaxDist, in->frac);
|
||||
hitx = trace.x + FixedMul (Vx, dist);
|
||||
hity = trace.y + FixedMul (Vy, dist);
|
||||
hitz = StartZ + FixedMul (Vz, dist);
|
||||
|
||||
fixed_t ff, fc, bf = 0, bc = 0;
|
||||
|
||||
if (in->d.line->frontsector == CurSector)
|
||||
if (in->isaline)
|
||||
{
|
||||
lineside = 0;
|
||||
}
|
||||
else if (in->d.line->backsector == CurSector)
|
||||
{
|
||||
lineside = 1;
|
||||
}
|
||||
else
|
||||
{ // Dammit. Why does Doom have to allow non-closed sectors?
|
||||
if (in->d.line->backsector == NULL)
|
||||
int lineside;
|
||||
sector_t *entersector;
|
||||
|
||||
dist = FixedMul (MaxDist, in->frac);
|
||||
hitx = StartX + FixedMul (Vx, dist);
|
||||
hity = StartY + FixedMul (Vy, dist);
|
||||
hitz = StartZ + FixedMul (Vz, dist);
|
||||
|
||||
fixed_t ff, fc, bf = 0, bc = 0;
|
||||
|
||||
if (in->d.line->frontsector == CurSector)
|
||||
{
|
||||
lineside = 0;
|
||||
CurSector = in->d.line->frontsector;
|
||||
}
|
||||
else if (in->d.line->backsector == CurSector)
|
||||
{
|
||||
lineside = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
lineside = P_PointOnLineSide (trace.x, trace.y, in->d.line);
|
||||
CurSector = lineside ? in->d.line->backsector : in->d.line->frontsector;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(in->d.line->flags & ML_TWOSIDED))
|
||||
{
|
||||
entersector = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
entersector = (lineside == 0) ? in->d.line->backsector : in->d.line->frontsector;
|
||||
|
||||
// For backwards compatibility: Ignore lines with the same sector on both sides.
|
||||
// This is the way Doom.exe did it and some WADs (e.g. Alien Vendetta MAP15 need it.
|
||||
if (i_compatflags & COMPATF_TRACE && in->d.line->backsector == in->d.line->frontsector)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ff = CurSector->floorplane.ZatPoint (hitx, hity);
|
||||
fc = CurSector->ceilingplane.ZatPoint (hitx, hity);
|
||||
|
||||
if (entersector != NULL)
|
||||
{
|
||||
bf = entersector->floorplane.ZatPoint (hitx, hity);
|
||||
bc = entersector->ceilingplane.ZatPoint (hitx, hity);
|
||||
}
|
||||
|
||||
if (Results->CrossedWater == NULL &&
|
||||
CurSector->heightsec &&
|
||||
!(CurSector->MoreFlags & SECF_IGNOREHEIGHTSEC) &&
|
||||
//CurSector->heightsec->waterzone &&
|
||||
hitz <= CurSector->heightsec->floorplane.ZatPoint (hitx, hity))
|
||||
{
|
||||
// hit crossed a water plane
|
||||
Results->CrossedWater = CurSector;
|
||||
}
|
||||
|
||||
if (hitz <= ff)
|
||||
{ // hit floor in front of wall
|
||||
Results->HitType = TRACE_HitFloor;
|
||||
}
|
||||
else if (hitz >= fc)
|
||||
{ // hit ceiling in front of wall
|
||||
Results->HitType = TRACE_HitCeiling;
|
||||
}
|
||||
else if (entersector == NULL ||
|
||||
hitz <= bf || hitz >= bc ||
|
||||
in->d.line->flags & WallMask)
|
||||
{ // hit the wall
|
||||
Results->HitType = TRACE_HitWall;
|
||||
Results->Tier =
|
||||
entersector == NULL ? TIER_Middle :
|
||||
hitz <= bf ? TIER_Lower :
|
||||
hitz >= bc ? TIER_Upper : TIER_Middle;
|
||||
if (TraceFlags & TRACE_Impact)
|
||||
{
|
||||
P_ActivateLine (in->d.line, IgnoreThis, lineside, SPAC_IMPACT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // made it past the wall
|
||||
Results->HitType = TRACE_HitNone;
|
||||
if (TraceFlags & TRACE_PCross)
|
||||
{
|
||||
P_ActivateLine (in->d.line, IgnoreThis, lineside, SPAC_PCROSS);
|
||||
}
|
||||
if (TraceFlags & TRACE_Impact)
|
||||
{ // This is incorrect for "impact", but Hexen did this, so
|
||||
// we need to as well, for compatibility
|
||||
P_ActivateLine (in->d.line, IgnoreThis, lineside, SPAC_IMPACT);
|
||||
}
|
||||
}
|
||||
|
||||
if (Results->HitType != TRACE_HitNone)
|
||||
{
|
||||
// We hit something, so figure out where exactly
|
||||
Results->Sector = CurSector;
|
||||
|
||||
if (Results->HitType != TRACE_HitWall &&
|
||||
!CheckSectorPlane (CurSector, Results->HitType == TRACE_HitFloor))
|
||||
{ // trace is parallel to the plane (or right on it)
|
||||
if (entersector == NULL)
|
||||
{ // Dammit. Why does Doom have to allow non-closed sectors?
|
||||
if (in->d.line->backsector == NULL)
|
||||
{
|
||||
Results->HitType = TRACE_HitWall;
|
||||
Results->Tier = TIER_Middle;
|
||||
lineside = 0;
|
||||
CurSector = in->d.line->frontsector;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hitz <= bf || hitz >= bc)
|
||||
{
|
||||
Results->HitType = TRACE_HitWall;
|
||||
Results->Tier =
|
||||
hitz <= bf ? TIER_Lower :
|
||||
hitz >= bc ? TIER_Upper : TIER_Middle;
|
||||
}
|
||||
else
|
||||
{
|
||||
Results->HitType = TRACE_HitNone;
|
||||
}
|
||||
lineside = P_PointOnLineSide (StartX, StartY, in->d.line);
|
||||
CurSector = lineside ? in->d.line->backsector : in->d.line->frontsector;
|
||||
}
|
||||
if (Results->HitType == TRACE_HitWall && TraceFlags & TRACE_Impact)
|
||||
}
|
||||
|
||||
if (!(in->d.line->flags & ML_TWOSIDED))
|
||||
{
|
||||
entersector = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
entersector = (lineside == 0) ? in->d.line->backsector : in->d.line->frontsector;
|
||||
|
||||
// For backwards compatibility: Ignore lines with the same sector on both sides.
|
||||
// This is the way Doom.exe did it and some WADs (e.g. Alien Vendetta MAP15 need it.
|
||||
if (i_compatflags & COMPATF_TRACE && in->d.line->backsector == in->d.line->frontsector)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ff = CurSector->floorplane.ZatPoint (hitx, hity);
|
||||
fc = CurSector->ceilingplane.ZatPoint (hitx, hity);
|
||||
|
||||
if (entersector != NULL)
|
||||
{
|
||||
bf = entersector->floorplane.ZatPoint (hitx, hity);
|
||||
bc = entersector->ceilingplane.ZatPoint (hitx, hity);
|
||||
}
|
||||
|
||||
if (Results->CrossedWater == NULL &&
|
||||
CurSector->heightsec &&
|
||||
!(CurSector->MoreFlags & SECF_IGNOREHEIGHTSEC) &&
|
||||
//CurSector->heightsec->waterzone &&
|
||||
hitz <= CurSector->heightsec->floorplane.ZatPoint (hitx, hity))
|
||||
{
|
||||
// hit crossed a water plane
|
||||
Results->CrossedWater = CurSector;
|
||||
}
|
||||
|
||||
if (hitz <= ff)
|
||||
{ // hit floor in front of wall
|
||||
Results->HitType = TRACE_HitFloor;
|
||||
}
|
||||
else if (hitz >= fc)
|
||||
{ // hit ceiling in front of wall
|
||||
Results->HitType = TRACE_HitCeiling;
|
||||
}
|
||||
else if (entersector == NULL ||
|
||||
hitz <= bf || hitz >= bc ||
|
||||
in->d.line->flags & WallMask)
|
||||
{ // hit the wall
|
||||
Results->HitType = TRACE_HitWall;
|
||||
Results->Tier =
|
||||
entersector == NULL ? TIER_Middle :
|
||||
hitz <= bf ? TIER_Lower :
|
||||
hitz >= bc ? TIER_Upper : TIER_Middle;
|
||||
if (TraceFlags & TRACE_Impact)
|
||||
{
|
||||
P_ActivateLine (in->d.line, IgnoreThis, lineside, SPAC_IMPACT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // made it past the wall
|
||||
Results->HitType = TRACE_HitNone;
|
||||
if (TraceFlags & TRACE_PCross)
|
||||
{
|
||||
P_ActivateLine (in->d.line, IgnoreThis, lineside, SPAC_PCROSS);
|
||||
}
|
||||
if (TraceFlags & TRACE_Impact)
|
||||
{ // This is incorrect for "impact", but Hexen did this, so
|
||||
// we need to as well, for compatibility
|
||||
P_ActivateLine (in->d.line, IgnoreThis, lineside, SPAC_IMPACT);
|
||||
}
|
||||
}
|
||||
|
||||
if (Results->HitType == TRACE_HitWall)
|
||||
if (Results->HitType != TRACE_HitNone)
|
||||
{
|
||||
Results->X = hitx;
|
||||
Results->Y = hity;
|
||||
Results->Z = hitz;
|
||||
Results->Distance = dist;
|
||||
Results->Fraction = in->frac;
|
||||
Results->Line = in->d.line;
|
||||
Results->Side = lineside;
|
||||
// We hit something, so figure out where exactly
|
||||
Results->Sector = CurSector;
|
||||
|
||||
if (Results->HitType != TRACE_HitWall &&
|
||||
!CheckSectorPlane (CurSector, Results->HitType == TRACE_HitFloor))
|
||||
{ // trace is parallel to the plane (or right on it)
|
||||
if (entersector == NULL)
|
||||
{
|
||||
Results->HitType = TRACE_HitWall;
|
||||
Results->Tier = TIER_Middle;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hitz <= bf || hitz >= bc)
|
||||
{
|
||||
Results->HitType = TRACE_HitWall;
|
||||
Results->Tier =
|
||||
hitz <= bf ? TIER_Lower :
|
||||
hitz >= bc ? TIER_Upper : TIER_Middle;
|
||||
}
|
||||
else
|
||||
{
|
||||
Results->HitType = TRACE_HitNone;
|
||||
}
|
||||
}
|
||||
if (Results->HitType == TRACE_HitWall && TraceFlags & TRACE_Impact)
|
||||
{
|
||||
P_ActivateLine (in->d.line, IgnoreThis, lineside, SPAC_IMPACT);
|
||||
}
|
||||
}
|
||||
|
||||
if (Results->HitType == TRACE_HitWall)
|
||||
{
|
||||
Results->X = hitx;
|
||||
Results->Y = hity;
|
||||
Results->Z = hitz;
|
||||
Results->Distance = dist;
|
||||
Results->Fraction = in->frac;
|
||||
Results->Line = in->d.line;
|
||||
Results->Side = lineside;
|
||||
}
|
||||
}
|
||||
|
||||
if (Results->HitType == TRACE_HitNone)
|
||||
{
|
||||
CurSector = entersector;
|
||||
EnterDist = dist;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (TraceCallback != NULL)
|
||||
{
|
||||
if (!TraceCallback (*Results)) return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Results->HitType == TRACE_HitNone)
|
||||
// Encountered an actor
|
||||
if (!(in->d.thing->flags & ActorMask) ||
|
||||
in->d.thing == IgnoreThis)
|
||||
{
|
||||
CurSector = entersector;
|
||||
EnterDist = dist;
|
||||
return true;
|
||||
continue;
|
||||
}
|
||||
|
||||
dist = FixedMul (MaxDist, in->frac);
|
||||
hitx = StartX + FixedMul (Vx, dist);
|
||||
hity = StartY + FixedMul (Vy, dist);
|
||||
hitz = StartZ + FixedMul (Vz, dist);
|
||||
|
||||
if (hitz > in->d.thing->z + in->d.thing->height)
|
||||
{ // trace enters above actor
|
||||
if (Vz >= 0) continue; // Going up: can't hit
|
||||
|
||||
// Does it hit the top of the actor?
|
||||
dist = FixedDiv(in->d.thing->z + in->d.thing->height - StartZ, Vz);
|
||||
|
||||
if (dist > MaxDist) continue;
|
||||
in->frac = FixedDiv(dist, MaxDist);
|
||||
|
||||
hitx = StartX + FixedMul (Vx, dist);
|
||||
hity = StartY + FixedMul (Vy, dist);
|
||||
hitz = StartZ + FixedMul (Vz, dist);
|
||||
|
||||
// calculated coordinate is outside the actor's bounding box
|
||||
if (abs(hitx - in->d.thing->x) > in->d.thing->radius ||
|
||||
abs(hity - in->d.thing->y) > in->d.thing->radius) continue;
|
||||
}
|
||||
else if (hitz < in->d.thing->z)
|
||||
{ // trace enters below actor
|
||||
if (Vz <= 0) continue; // Going down: can't hit
|
||||
|
||||
// Does it hit the bottom of the actor?
|
||||
dist = FixedDiv(in->d.thing->z - StartZ, Vz);
|
||||
if (dist > MaxDist) continue;
|
||||
in->frac = FixedDiv(dist, MaxDist);
|
||||
|
||||
hitx = StartX + FixedMul (Vx, dist);
|
||||
hity = StartY + FixedMul (Vy, dist);
|
||||
hitz = StartZ + FixedMul (Vz, dist);
|
||||
|
||||
// calculated coordinate is outside the actor's bounding box
|
||||
if (abs(hitx - in->d.thing->x) > in->d.thing->radius ||
|
||||
abs(hity - in->d.thing->y) > in->d.thing->radius) continue;
|
||||
}
|
||||
|
||||
|
||||
Results->HitType = TRACE_HitActor;
|
||||
Results->X = hitx;
|
||||
Results->Y = hity;
|
||||
Results->Z = hitz;
|
||||
Results->Distance = dist;
|
||||
Results->Fraction = in->frac;
|
||||
Results->Actor = in->d.thing;
|
||||
|
||||
if (TraceCallback != NULL)
|
||||
{
|
||||
return TraceCallback (*Results);
|
||||
if (!TraceCallback (*Results)) return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Encountered an actor
|
||||
if (!(in->d.thing->flags & ActorMask) ||
|
||||
in->d.thing == IgnoreThis)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
dist = FixedMul (MaxDist, in->frac);
|
||||
hitx = trace.x + FixedMul (Vx, dist);
|
||||
hity = trace.y + FixedMul (Vy, dist);
|
||||
hitz = StartZ + FixedMul (Vz, dist);
|
||||
|
||||
if (hitz > in->d.thing->z + in->d.thing->height)
|
||||
{ // trace enters above actor
|
||||
if (Vz >= 0) return true; // Going up: can't hit
|
||||
|
||||
// Does it hit the top of the actor?
|
||||
dist = FixedDiv(in->d.thing->z + in->d.thing->height - StartZ, Vz);
|
||||
|
||||
if (dist > MaxDist) return true;
|
||||
in->frac = FixedDiv(dist, MaxDist);
|
||||
|
||||
hitx = trace.x + FixedMul (Vx, dist);
|
||||
hity = trace.y + FixedMul (Vy, dist);
|
||||
hitz = StartZ + FixedMul (Vz, dist);
|
||||
|
||||
// calculated coordinate is outside the actor's bounding box
|
||||
if (abs(hitx - in->d.thing->x) > in->d.thing->radius ||
|
||||
abs(hity - in->d.thing->y) > in->d.thing->radius) return true;
|
||||
}
|
||||
else if (hitz < in->d.thing->z)
|
||||
{ // trace enters below actor
|
||||
if (Vz <= 0) return true; // Going down: can't hit
|
||||
|
||||
// Does it hit the bottom of the actor?
|
||||
dist = FixedDiv(in->d.thing->z - StartZ, Vz);
|
||||
if (dist > MaxDist) return true;
|
||||
in->frac = FixedDiv(dist, MaxDist);
|
||||
|
||||
hitx = trace.x + FixedMul (Vx, dist);
|
||||
hity = trace.y + FixedMul (Vy, dist);
|
||||
hitz = StartZ + FixedMul (Vz, dist);
|
||||
|
||||
// calculated coordinate is outside the actor's bounding box
|
||||
if (abs(hitx - in->d.thing->x) > in->d.thing->radius ||
|
||||
abs(hity - in->d.thing->y) > in->d.thing->radius) return true;
|
||||
}
|
||||
|
||||
|
||||
Results->HitType = TRACE_HitActor;
|
||||
Results->X = hitx;
|
||||
Results->Y = hity;
|
||||
Results->Z = hitz;
|
||||
Results->Distance = dist;
|
||||
Results->Fraction = in->frac;
|
||||
Results->Actor = in->d.thing;
|
||||
|
||||
if (TraceCallback != NULL)
|
||||
{
|
||||
return TraceCallback (*Results);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool CheckSectorPlane (const sector_t *sector, bool checkFloor)
|
||||
bool FTraceInfo::CheckSectorPlane (const sector_t *sector, bool checkFloor)
|
||||
{
|
||||
secplane_t plane;
|
||||
|
||||
|
|
@ -378,16 +393,16 @@ static bool CheckSectorPlane (const sector_t *sector, bool checkFloor)
|
|||
|
||||
if (den != 0)
|
||||
{
|
||||
fixed_t num = TMulScale16 (plane.a, trace.x,
|
||||
plane.b, trace.y,
|
||||
fixed_t num = TMulScale16 (plane.a, StartX,
|
||||
plane.b, StartY,
|
||||
plane.c, StartZ) + plane.d;
|
||||
|
||||
fixed_t hitdist = FixedDiv (-num, den);
|
||||
|
||||
if (hitdist > EnterDist && hitdist < MaxDist)
|
||||
{
|
||||
Results->X = trace.x + FixedMul (Vx, hitdist);
|
||||
Results->Y = trace.y + FixedMul (Vy, hitdist);
|
||||
Results->X = StartX + FixedMul (Vx, hitdist);
|
||||
Results->Y = StartY + FixedMul (Vy, hitdist);
|
||||
Results->Z = StartZ + FixedMul (Vz, hitdist);
|
||||
Results->Distance = hitdist;
|
||||
Results->Fraction = FixedDiv (hitdist, MaxDist);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue