- ignore COMPAT_POINTONSIDE in a few places where the side effects of the old P_PointOn*Side functions are either not needed or problematic:

* the sight checking code needs to be as precise as possible and should not depend on some old semi-broken routines. (This is more a precision issue of these routines - P_PointOnDivlineSide removes the lower 8 bits of each value - than having an issue with returning the wrong side in some cases.)
 * for slope creations it is flat out wrong to use the old routines at all.
 * also ignore this in the modern (box-shaped) case of FPathTraverse::AddLineIntercepts. This functionality is new to ZDoom and therefore not subject to compatibility concerns.
 * the line-to-line teleporter. It seems the hideous fudging code was just there to work around the design issues of these functions, so let's better not ever call them here in the first place.
 * A_PainShootSkull: Its usage here does not depend on these issues.
 * P_ExplodeMissile: New code exclusive to ZDoom.
 * FPolyObj::CheckMobjBlocking

All occurences in p_map.cpp have been left alone although most of them probably won't need the compatibility option either.
This commit is contained in:
Christoph Oelckers 2016-01-15 12:56:27 +01:00
parent 6a87c6cd19
commit 867b7767ef
8 changed files with 26 additions and 14 deletions

View file

@ -103,7 +103,7 @@ void A_PainShootSkull (AActor *self, angle_t angle, const PClass *spawntype, int
box.Top() < ld->bbox[BOXBOTTOM] ||
box.Bottom() > ld->bbox[BOXTOP]))
{
if (P_PointOnLineSide(self->x,self->y,ld) != P_PointOnLineSide(x,y,ld))
if (P_PointOnLineSidePrecise(self->x,self->y,ld) != P_PointOnLineSidePrecise(x,y,ld))
return; // line blocks trajectory // ^
}
}

View file

@ -249,6 +249,12 @@ inline int P_PointOnLineSide (fixed_t x, fixed_t y, const line_t *line)
: DMulScale32 (y-line->v1->y, line->dx, line->v1->x-x, line->dy) > 0;
}
inline int P_PointOnLineSidePrecise (fixed_t x, fixed_t y, const line_t *line)
{
return DMulScale32 (y-line->v1->y, line->dx, line->v1->x-x, line->dy) > 0;
}
//==========================================================================
//
// P_PointOnDivlineSide
@ -267,6 +273,12 @@ inline int P_PointOnDivlineSide (fixed_t x, fixed_t y, const divline_t *line)
: (DMulScale32 (y-line->y, line->dx, line->x-x, line->dy) > 0);
}
inline int P_PointOnDivlineSidePrecise (fixed_t x, fixed_t y, const divline_t *line)
{
return DMulScale32 (y-line->y, line->dx, line->x-x, line->dy) > 0;
}
//==========================================================================
//
// P_MakeDivline

View file

@ -1056,13 +1056,13 @@ void FPathTraverse::AddThingIntercepts (int bx, int by, FBlockThingsIterator &it
break;
}
// Check if this side is facing the trace origin
if (P_PointOnDivlineSide (trace.x, trace.y, &line) == 0)
if (P_PointOnDivlineSidePrecise (trace.x, trace.y, &line) == 0)
{
numfronts++;
// If it is, see if the trace crosses it
if (P_PointOnDivlineSide (line.x, line.y, &trace) !=
P_PointOnDivlineSide (line.x + line.dx, line.y + line.dy, &trace))
if (P_PointOnDivlineSidePrecise (line.x, line.y, &trace) !=
P_PointOnDivlineSidePrecise (line.x + line.dx, line.y + line.dy, &trace))
{
// It's a hit
fixed_t frac = P_InterceptVector (&trace, &line);

View file

@ -1284,7 +1284,7 @@ void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target)
if (line != NULL && cl_missiledecals)
{
int side = P_PointOnLineSide (mo->x, mo->y, line);
int side = P_PointOnLineSidePrecise (mo->x, mo->y, line);
if (line->sidedef[side] == NULL)
side ^= 1;
if (line->sidedef[side] != NULL)

View file

@ -132,7 +132,7 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in)
{
int frontflag;
frontflag = P_PointOnLineSide(sightthing->x, sightthing->y, li);
frontflag = P_PointOnLineSidePrecise(sightthing->x, sightthing->y, li);
//Check 3D FLOORS!
for(int i=1;i<=2;i++)
@ -241,14 +241,14 @@ bool SightCheck::P_SightCheckLine (line_t *ld)
return true;
}
ld->validcount = validcount;
if (P_PointOnDivlineSide (ld->v1->x, ld->v1->y, &trace) ==
P_PointOnDivlineSide (ld->v2->x, ld->v2->y, &trace))
if (P_PointOnDivlineSidePrecise (ld->v1->x, ld->v1->y, &trace) ==
P_PointOnDivlineSidePrecise (ld->v2->x, ld->v2->y, &trace))
{
return true; // line isn't crossed
}
P_MakeDivline (ld, &dl);
if (P_PointOnDivlineSide (trace.x, trace.y, &dl) ==
P_PointOnDivlineSide (trace.x+trace.dx, trace.y+trace.dy, &dl))
if (P_PointOnDivlineSidePrecise (trace.x, trace.y, &dl) ==
P_PointOnDivlineSidePrecise (trace.x+trace.dx, trace.y+trace.dy, &dl))
{
return true; // line isn't crossed
}

View file

@ -54,7 +54,7 @@ static void P_SlopeLineToPoint (int lineid, fixed_t x, fixed_t y, fixed_t z, boo
sector_t *sec;
secplane_t *plane;
if (P_PointOnLineSide (x, y, line) == 0)
if (P_PointOnLineSidePrecise (x, y, line) == 0)
{
sec = line->frontsector;
}
@ -363,7 +363,7 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
z3 = h3? *h3 : j==0? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling);
vt3.Z = FIXED2FLOAT(z3);
if (P_PointOnLineSide(vertexes[vi3].x, vertexes[vi3].y, sec->lines[0]) == 0)
if (P_PointOnLineSidePrecise(vertexes[vi3].x, vertexes[vi3].y, sec->lines[0]) == 0)
{
vec1 = vt2 - vt3;
vec2 = vt1 - vt3;

View file

@ -530,7 +530,7 @@ bool EV_SilentLineTeleport (line_t *line, int side, AActor *thing, int id, INTBO
int fudge = FUDGEFACTOR;
// Make sure we are on correct side of exit linedef.
while (P_PointOnLineSide(x, y, l) != side && --fudge >= 0)
while (P_PointOnLineSidePrecise(x, y, l) != side && --fudge >= 0)
{
if (abs(l->dx) > abs(l->dy))
y -= (l->dx < 0) != side ? -1 : 1;

View file

@ -1231,7 +1231,7 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
// Best use the one facing the player and ignore the back side.
if (ld->sidedef[1] != NULL)
{
int side = P_PointOnLineSide(mobj->x, mobj->y, ld);
int side = P_PointOnLineSidePrecise(mobj->x, mobj->y, ld);
if (ld->sidedef[side] != sd)
{
continue;