- got rid of secplane_t::fA and fB. All uses could be replaced by other functions.

This commit is contained in:
Christoph Oelckers 2016-04-03 19:46:00 +02:00
parent fc5f98a0be
commit 4e5ba49aca
4 changed files with 10 additions and 19 deletions

View file

@ -2945,7 +2945,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
double t; double t;
dest = actor->Pos() + move; dest = actor->Pos() + move;
t = plane->fA() * dest.X + plane->fB() * dest.Y + plane->fC() * actor->Z() + plane->fD(); t = (plane->Normal() | DVector3(dest, actor->Z())) + plane->fD();
if (t < 0) if (t < 0)
{ // Desired location is behind (below) the plane { // Desired location is behind (below) the plane
// (i.e. Walking up the plane) // (i.e. Walking up the plane)
@ -2979,16 +2979,16 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
} }
if (dopush) if (dopush)
{ {
actor->Vel.X = move.X = plane->fA() * 2; move = plane->Normal() * 2;
actor->Vel.Y = move.Y = plane->fB() * 2; actor->Vel.X = move.X;
actor->Vel.Y = move.Y;
} }
return (actor->floorsector == actor->Sector) ? plane : NULL; return (actor->floorsector == actor->Sector) ? plane : NULL;
} }
} }
// Slide the desired location along the plane's normal // Slide the desired location along the plane's normal
// so that it lies on the plane's surface // so that it lies on the plane's surface
dest.X -= plane->fA() * t; dest -= plane->Normal() * t;
dest.Y -= plane->fB() * t;
move = dest - actor->Pos().XY(); move = dest - actor->Pos().XY();
return (actor->floorsector == actor->Sector) ? plane : NULL; return (actor->floorsector == actor->Sector) ? plane : NULL;
} }
@ -2998,8 +2998,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
{ {
// Actor's current spot is on/in the plane, so walk down it // Actor's current spot is on/in the plane, so walk down it
// Same principle as walking up, except reversed // Same principle as walking up, except reversed
dest.X += plane->fA() * t; dest += plane->Normal() * t;
dest.Y += plane->fB() * t;
move = dest - actor->Pos().XY(); move = dest - actor->Pos().XY();
return (actor->floorsector == actor->Sector) ? plane : NULL; return (actor->floorsector == actor->Sector) ? plane : NULL;
} }

View file

@ -1086,11 +1086,11 @@ bool secplane_t::CopyPlaneIfValid (secplane_t *dest, const secplane_t *opp) cons
// If the planes do not have matching slopes, then always copy them // If the planes do not have matching slopes, then always copy them
// because clipping would require creating new sectors. // because clipping would require creating new sectors.
if (fA() != dest->fA() || fB() != dest->fB() || fC() != dest->fC()) if (Normal() != dest->Normal())
{ {
copy = true; copy = true;
} }
else if (opp->fA() != -dest->fA() || opp->fB() != -dest->fB() || opp->fC() != -dest->fC()) else if (opp->Normal() != -dest->Normal())
{ {
if (fD() < dest->fD()) if (fD() < dest->fD())
{ {

View file

@ -877,11 +877,11 @@ bool FTraceInfo::TraceTraverse (int ptflags)
bool FTraceInfo::CheckPlane (const secplane_t &plane) bool FTraceInfo::CheckPlane (const secplane_t &plane)
{ {
double den = plane.fA() * Vec.X + plane.fB() * Vec.Y + plane.fC() * Vec.Z; double den = plane.Normal() | Vec;
if (den != 0) if (den != 0)
{ {
double num = plane.fA() * Start.X + plane.fB() * Start.Y + plane.fC() * Start.Z + plane.fD(); double num = (plane.Normal() | Start) + plane.fD();
double hitdist = -num / den; double hitdist = -num / den;

View file

@ -302,14 +302,6 @@ public:
D = dd; D = dd;
} }
double fA() const
{
return normal.X;
}
double fB() const
{
return normal.Y;
}
double fC() const double fC() const
{ {
return normal.Z; return normal.Z;