diff --git a/src/p_maputl.c b/src/p_maputl.c index 14958c941..10aa4bb3d 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -754,24 +754,30 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj, opening_t *open) if (delta1 > delta2) { - if (polybottom < open->ceiling) + if (open->fofType != LO_FOF_FLOORS) { - open->ceiling = polybottom; - } - else if (polybottom < open->highceiling) - { - open->highceiling = polybottom; + if (polybottom < open->ceiling) + { + open->ceiling = polybottom; + } + else if (polybottom < open->highceiling) + { + open->highceiling = polybottom; + } } } else { - if (polytop > open->floor) + if (open->fofType != LO_FOF_CEILINGS) { - open->floor = polytop; - } - else if (polytop > open->lowfloor) - { - open->lowfloor = polytop; + if (polytop > open->floor) + { + open->floor = polytop; + } + else if (polytop > open->lowfloor) + { + open->lowfloor = polytop; + } } } } @@ -811,15 +817,28 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj, opening_t *open) || (rover->fofflags & FOF_BLOCKOTHERS && !mobj->player))) continue; - topheight = P_GetFOFTopZ(mobj, front, rover, tm.x, tm.y, linedef); - bottomheight = P_GetFOFBottomZ(mobj, front, rover, tm.x, tm.y, linedef); + if (open->fofType != LO_FOF_ANY) + { + topheight = P_VeryTopOfFOF(rover); + bottomheight = P_VeryBottomOfFOF(rover); + } + else + { + topheight = P_GetFOFTopZ(mobj, front, rover, tm.x, tm.y, linedef); + bottomheight = P_GetFOFBottomZ(mobj, front, rover, tm.x, tm.y, linedef); + } midheight = bottomheight + (topheight - bottomheight) / 2; delta1 = abs(mobj->z - midheight); delta2 = abs(thingtop - midheight); - if (delta1 >= delta2) + if (delta1 > delta2) { + if (open->fofType == LO_FOF_FLOORS) + { + continue; + } + // thing is below FOF if ((rover->fofflags & FOF_INTANGIBLEFLATS) != FOF_PLATFORM) { @@ -832,6 +851,11 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj, opening_t *open) } else { + if (open->fofType == LO_FOF_CEILINGS) + { + continue; + } + // thing is above FOF if ((rover->fofflags & FOF_INTANGIBLEFLATS) != FOF_REVERSEPLATFORM) { @@ -858,15 +882,28 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj, opening_t *open) || (rover->fofflags & FOF_BLOCKOTHERS && !mobj->player))) continue; - topheight = P_GetFOFTopZ(mobj, back, rover, tm.x, tm.y, linedef); - bottomheight = P_GetFOFBottomZ(mobj, back, rover, tm.x, tm.y, linedef); + if (open->fofType != LO_FOF_ANY) + { + topheight = P_VeryTopOfFOF(rover); + bottomheight = P_VeryBottomOfFOF(rover); + } + else + { + topheight = P_GetFOFTopZ(mobj, back, rover, tm.x, tm.y, linedef); + bottomheight = P_GetFOFBottomZ(mobj, back, rover, tm.x, tm.y, linedef); + } midheight = bottomheight + (topheight - bottomheight) / 2; delta1 = abs(mobj->z - midheight); delta2 = abs(thingtop - midheight); - if (delta1 >= delta2) + if (delta1 > delta2) { + if (open->fofType == LO_FOF_FLOORS) + { + continue; + } + // thing is below FOF if ((rover->fofflags & FOF_INTANGIBLEFLATS) != FOF_PLATFORM) { @@ -879,6 +916,11 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj, opening_t *open) } else { + if (open->fofType == LO_FOF_CEILINGS) + { + continue; + } + // thing is above FOF if ((rover->fofflags & FOF_INTANGIBLEFLATS) != FOF_REVERSEPLATFORM) { diff --git a/src/p_maputl.h b/src/p_maputl.h index 4656ffdd4..0d6d5a346 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -70,8 +70,13 @@ struct opening_t fixed_t ceilingstep, ceilingdrop; fixed_t floorstep, floordrop; INT32 ceilingpic, floorpic; + UINT8 fofType; // LO_FOF_ types for forcing FOF collide }; +#define LO_FOF_ANY (0) +#define LO_FOF_FLOORS (1) +#define LO_FOF_CEILINGS (2) + void P_LineOpening(line_t *plinedef, mobj_t *mobj, opening_t *open); typedef enum diff --git a/src/p_sight.c b/src/p_sight.c index 761b4b47b..20d94484d 100644 --- a/src/p_sight.c +++ b/src/p_sight.c @@ -384,6 +384,7 @@ static boolean P_CanBotTraverse(seg_t *seg, divline_t *divl, register los_t *los tm.y = los->strace.y + FixedMul(los->strace.dy, frac); // set openrange, opentop, openbottom + open.fofType = (flip ? LO_FOF_CEILINGS : LO_FOF_FLOORS); P_LineOpening(line, los->t1, &open); maxstep = P_GetThingStepUp(los->t1, tm.x, tm.y); @@ -451,10 +452,11 @@ static boolean P_CanWaypointTraverse(seg_t *seg, divline_t *divl, register los_t tm.y = los->strace.y + FixedMul(los->strace.dy, frac); // set openrange, opentop, openbottom + open.fofType = (flip ? LO_FOF_CEILINGS : LO_FOF_FLOORS); P_LineOpening(line, los->t1, &open); maxstep = P_GetThingStepUp(los->t1, tm.x, tm.y); -#if 1 +#if 0 if (los->t2->type == MT_WAYPOINT) { waypoint_t *wp = K_SearchWaypointHeapForMobj(los->t2);