Fix waypoint traversal with slopes

This commit is contained in:
Sally Coolatta 2023-05-12 23:10:56 -04:00
parent a8af5b7616
commit 66f0c7c9f0
2 changed files with 55 additions and 27 deletions

View file

@ -607,10 +607,20 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
int hi = 0;
int lo = 0;
// set these defaults so that polyobjects don't interfere with collision above or below them
opentop = highceiling = INT32_MAX;
openbottom = lowfloor = INT32_MIN;
openrange = 0;
opentopslope = openbottomslope = NULL;
opentoppic = openbottompic = -1;
openceilingstep = 0;
openceilingdrop = 0;
openfloorstep = 0;
openfloordrop = 0;
if (linedef->sidenum[1] == 0xffff)
{
// single sided line
openrange = 0;
return;
}
@ -637,22 +647,9 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
}
openfloorrover = openceilingrover = NULL;
if (linedef->polyobj)
if (!linedef->polyobj)
{
// set these defaults so that polyobjects don't interfere with collision above or below them
opentop = INT32_MAX;
openbottom = INT32_MIN;
highceiling = INT32_MIN;
lowfloor = INT32_MAX;
opentopslope = openbottomslope = NULL;
opentoppic = openbottompic = -1;
openceilingstep = 0;
openceilingdrop = 0;
openfloorstep = 0;
openfloordrop = 0;
}
else
{ // Set open and high/low values here
// Set open and high/low values here
fixed_t height[2];
const sector_t * sector[2] = { front, back };
@ -774,8 +771,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
highceiling = polybottom;
}
}
if (delta1 <= delta2)
else
{
if (polytop > openbottom)
{
@ -842,8 +838,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
}
}
}
if (delta1 <= delta2)
else
{
// thing is above FOF
if ((rover->fofflags & FOF_INTANGIBLEFLATS) != FOF_REVERSEPLATFORM)
@ -890,8 +885,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
}
}
}
if (delta1 <= delta2)
else
{
// thing is above FOF
if ((rover->fofflags & FOF_INTANGIBLEFLATS) != FOF_REVERSEPLATFORM)
@ -953,14 +947,14 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
openfloorstep = ( botedge[hi] - mobj->z );
openfloordrop = ( botedge[hi] - botedge[lo] );
if (open[lo].top > lowfloor)
if (open[lo].bottom > lowfloor)
{
lowfloor = open[lo].top;
lowfloor = open[lo].bottom;
}
}
else if (open[hi].top > lowfloor)
else if (open[hi].bottom > lowfloor)
{
lowfloor = open[hi].top;
lowfloor = open[hi].bottom;
}
}
}

View file

@ -444,9 +444,38 @@ static boolean P_CanWaypointTraverse(seg_t *seg, divline_t *divl, register los_t
tm.x = los->strace.x + FixedMul(los->strace.dx, frac);
tm.y = los->strace.y + FixedMul(los->strace.dy, frac);
// set openrange, opentop, openbottom
P_LineOpening(line, los->t1);
maxstep = P_GetThingStepUp(los->t1, tm.x, tm.y);
#if 0
if (los->t2->type == MT_WAYPOINT)
{
waypoint_t *wp = K_SearchWaypointHeapForMobj(los->t2);
if (wp != NULL)
{
CONS_Printf(
"========\nID: %d\nopenrange: %.2f >= %.2f\n",
K_GetWaypointID(wp),
FIXED_TO_FLOAT(openrange),
FIXED_TO_FLOAT(los->t1->height)
);
if (openrange >= los->t1->height)
{
CONS_Printf(
"openbottom: %.2f\nlowfloor: %.2f\nstep: %.2f <= %.2f\n",
FIXED_TO_FLOAT(openbottom),
FIXED_TO_FLOAT(lowfloor),
FIXED_TO_FLOAT(openbottom - lowfloor),
FIXED_TO_FLOAT(maxstep)
);
}
}
}
#endif
if (openrange < los->t1->height)
{
// Can't fit
@ -459,7 +488,12 @@ static boolean P_CanWaypointTraverse(seg_t *seg, divline_t *divl, register los_t
// Or if we're on the higher side...
canDropOff = (flip ? (los->t1->z + los->t1->height <= opentop) : (los->t1->z >= openbottom));
return (canStepUp || canDropOff);
if (canStepUp || canDropOff)
{
return true;
}
return false;
}
//