FOF step down

This commit is contained in:
James R 2020-10-15 03:33:37 -07:00
parent 894860b9bc
commit 9723283055

View file

@ -427,9 +427,15 @@ void P_CameraLineOpening(line_t *linedef)
void P_LineOpening(line_t *linedef, mobj_t *mobj) void P_LineOpening(line_t *linedef, mobj_t *mobj)
{ {
enum { HIGH, LOW };
sector_t *front, *back; sector_t *front, *back;
vertex_t cross; vertex_t cross;
/* these init to shut compiler up */
fixed_t topedge[2] = {0};
fixed_t botedge[2] = {0};
if (linedef->sidenum[1] == 0xffff) if (linedef->sidenum[1] == 0xffff)
{ {
// single sided line // single sided line
@ -487,11 +493,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
openceilingdiff = ( mobj->z + mobj->height - openceilingdiff = ( mobj->z + mobj->height -
P_GetSectorCeilingZAt(sector[low], cross.x, cross.y) ); P_GetSectorCeilingZAt(sector[low], cross.x, cross.y) );
openceilingdrop = topedge[HIGH] = P_GetSectorCeilingZAt(sector[high], cross.x, cross.y);
( topedge[LOW] = P_GetSectorCeilingZAt(sector[low], cross.x, cross.y);
P_GetSectorCeilingZAt(sector[high], cross.x, cross.y) -
P_GetSectorCeilingZAt(sector[low], cross.x, cross.y) openceilingdrop = ( topedge[HIGH] - topedge[LOW] );
);
height[0] = P_GetFloorZ(mobj, front, tmx, tmy, linedef); height[0] = P_GetFloorZ(mobj, front, tmx, tmy, linedef);
height[1] = P_GetFloorZ(mobj, back, tmx, tmy, linedef); height[1] = P_GetFloorZ(mobj, back, tmx, tmy, linedef);
@ -505,11 +510,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
openfloordiff = openfloordiff =
( P_GetSectorFloorZAt(sector[high], cross.x, cross.y) - mobj->z ); ( P_GetSectorFloorZAt(sector[high], cross.x, cross.y) - mobj->z );
openfloordrop = botedge[HIGH] = P_GetSectorFloorZAt(sector[high], cross.x, cross.y);
( botedge[LOW] = P_GetSectorFloorZAt(sector[low], cross.x, cross.y);
P_GetSectorFloorZAt(sector[high], cross.x, cross.y) -
P_GetSectorFloorZAt(sector[low], cross.x, cross.y) openfloordrop = ( botedge[HIGH] - botedge[LOW] );
);
#undef low #undef low
} }
@ -634,6 +638,23 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
ffloor_t *rover; ffloor_t *rover;
fixed_t delta1, delta2; fixed_t delta1, delta2;
enum { FRONT, BACK };
/* yuck */
struct
{
fixed_t top;
fixed_t bottom;
ffloor_t * ceilingrover;
ffloor_t * floorrover;
} open[2] = {
{ opentop, openbottom, openceilingrover, openfloorrover },
{ opentop, openbottom, openceilingrover, openfloorrover },
};
int lo;
int hi;
const fixed_t oldopentop = opentop; const fixed_t oldopentop = opentop;
const fixed_t oldopenbottom = openbottom; const fixed_t oldopenbottom = openbottom;
@ -658,10 +679,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
if (delta1 >= delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_PLATFORM) // thing is below FOF if (delta1 >= delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_PLATFORM) // thing is below FOF
{ {
if (bottomheight < opentop) { if (bottomheight < open[FRONT].top) {
opentop = bottomheight; open[FRONT].top = bottomheight;
opentopslope = *rover->b_slope; opentopslope = *rover->b_slope;
openceilingrover = rover; open[FRONT].ceilingrover = rover;
} }
else if (bottomheight < highceiling) else if (bottomheight < highceiling)
highceiling = bottomheight; highceiling = bottomheight;
@ -669,10 +690,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
if (delta1 < delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_REVERSEPLATFORM) // thing is above FOF if (delta1 < delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_REVERSEPLATFORM) // thing is above FOF
{ {
if (topheight > openbottom) { if (topheight > open[FRONT].bottom) {
openbottom = topheight; open[FRONT].bottom = topheight;
openbottomslope = *rover->t_slope; openbottomslope = *rover->t_slope;
openfloorrover = rover; open[FRONT].floorrover = rover;
} }
else if (topheight > lowfloor) else if (topheight > lowfloor)
lowfloor = topheight; lowfloor = topheight;
@ -700,10 +721,10 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
if (delta1 >= delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_PLATFORM) // thing is below FOF if (delta1 >= delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_PLATFORM) // thing is below FOF
{ {
if (bottomheight < opentop) { if (bottomheight < open[BACK].top) {
opentop = bottomheight; open[BACK].top = bottomheight;
opentopslope = *rover->b_slope; opentopslope = *rover->b_slope;
openceilingrover = rover; open[BACK].ceilingrover = rover;
} }
else if (bottomheight < highceiling) else if (bottomheight < highceiling)
highceiling = bottomheight; highceiling = bottomheight;
@ -711,26 +732,58 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
if (delta1 < delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_REVERSEPLATFORM) // thing is above FOF if (delta1 < delta2 && (rover->flags & FF_INTANGIBLEFLATS) != FF_REVERSEPLATFORM) // thing is above FOF
{ {
if (topheight > openbottom) { if (topheight > open[BACK].bottom) {
openbottom = topheight; open[BACK].bottom = topheight;
openbottomslope = *rover->t_slope; openbottomslope = *rover->t_slope;
openfloorrover = rover; open[BACK].floorrover = rover;
} }
else if (topheight > lowfloor) else if (topheight > lowfloor)
lowfloor = topheight; lowfloor = topheight;
} }
} }
lo = ( open[0].top > open[1].top );
opentop = open[lo].top;
if (opentop < oldopentop) if (opentop < oldopentop)
{ {
openceilingrover = open[lo].ceilingrover;
openceilingdiff = ( thingtop - openceilingdiff = ( thingtop -
P_GetFFloorBottomZAt(openceilingrover, cross.x, cross.y) ); P_GetFFloorBottomZAt(openceilingrover, cross.x, cross.y) );
hi = ! lo;
topedge[LOW] = P_GetFFloorBottomZAt(open[lo].ceilingrover, cross.x, cross.y);
if (open[hi].top < oldopentop)
{
topedge[HIGH] = P_GetFFloorBottomZAt(open[hi].ceilingrover, cross.x, cross.y);
}
openceilingdrop = ( topedge[HIGH] - topedge[LOW] );
} }
hi = ( open[0].bottom < open[1].bottom );
openbottom = open[hi].bottom;
if (openbottom > oldopenbottom) if (openbottom > oldopenbottom)
{ {
openfloorrover = open[hi].floorrover;
openfloordiff = openfloordiff =
( P_GetFFloorTopZAt(openfloorrover, cross.x, cross.y) - mobj->z ); ( P_GetFFloorTopZAt(openfloorrover, cross.x, cross.y) - mobj->z );
lo = ! hi;
botedge[HIGH] = P_GetFFloorTopZAt(open[hi].floorrover, cross.x, cross.y);
if (open[lo].bottom > oldopenbottom)
{
botedge[LOW] = P_GetFFloorTopZAt(open[lo].floorrover, cross.x, cross.y);
}
openfloordrop = ( botedge[HIGH] - botedge[LOW] );
} }
} }
} }