Condense variables, rename 'diff' to 'step'

This commit is contained in:
James R 2020-10-15 14:23:02 -07:00
parent 1db22403bb
commit 0bf00aad35
3 changed files with 41 additions and 55 deletions

View file

@ -58,8 +58,8 @@ mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz
mobj_t *tmhitthing; // the solid thing you bumped into (for collisions) mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
ffloor_t *tmfloorrover, *tmceilingrover; ffloor_t *tmfloorrover, *tmceilingrover;
pslope_t *tmfloorslope, *tmceilingslope; pslope_t *tmfloorslope, *tmceilingslope;
static fixed_t tmfloordiff; static fixed_t tmfloorstep;
static fixed_t tmceilingdiff; static fixed_t tmceilingstep;
// keep track of the line that lowers the ceiling, // keep track of the line that lowers the ceiling,
// so missiles don't explode against sky hack walls // so missiles don't explode against sky hack walls
@ -1706,7 +1706,7 @@ static boolean PIT_CheckLine(line_t *ld)
ceilingline = ld; ceilingline = ld;
tmceilingrover = openceilingrover; tmceilingrover = openceilingrover;
tmceilingslope = opentopslope; tmceilingslope = opentopslope;
tmceilingdiff = openceilingdiff; tmceilingstep = openceilingstep;
tmthing->ceilingdrop = openceilingdrop; tmthing->ceilingdrop = openceilingdrop;
} }
@ -1715,7 +1715,7 @@ static boolean PIT_CheckLine(line_t *ld)
tmfloorz = openbottom; tmfloorz = openbottom;
tmfloorrover = openfloorrover; tmfloorrover = openfloorrover;
tmfloorslope = openbottomslope; tmfloorslope = openbottomslope;
tmfloordiff = openfloordiff; tmfloorstep = openfloorstep;
tmthing->floordrop = openfloordrop; tmthing->floordrop = openfloordrop;
} }
@ -1806,8 +1806,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
tmfloorslope = newsubsec->sector->f_slope; tmfloorslope = newsubsec->sector->f_slope;
tmceilingslope = newsubsec->sector->c_slope; tmceilingslope = newsubsec->sector->c_slope;
tmfloordiff = 0; tmfloorstep = 0;
tmceilingdiff = 0; tmceilingstep = 0;
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered. // Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
if (newsubsec->sector->ffloors) if (newsubsec->sector->ffloors)
@ -2542,7 +2542,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
thing->eflags |= MFE_JUSTSTEPPEDDOWN; thing->eflags |= MFE_JUSTSTEPPEDDOWN;
thing->ceilingdrop = 0; thing->ceilingdrop = 0;
} }
else if (tmceilingz < thingtop && tmceilingdiff <= maxstep) else if (tmceilingz < thingtop && tmceilingstep <= maxstep)
{ {
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
thing->ceilingrover = tmceilingrover; thing->ceilingrover = tmceilingrover;
@ -2556,7 +2556,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
thing->eflags |= MFE_JUSTSTEPPEDDOWN; thing->eflags |= MFE_JUSTSTEPPEDDOWN;
thing->floordrop = 0; thing->floordrop = 0;
} }
else if (tmfloorz > thing->z && tmfloordiff <= maxstep) else if (tmfloorz > thing->z && tmfloorstep <= maxstep)
{ {
thing->z = thing->floorz = tmfloorz; thing->z = thing->floorz = tmfloorz;
thing->floorrover = tmfloorrover; thing->floorrover = tmfloorrover;

View file

@ -279,10 +279,10 @@ fixed_t P_InterceptVector(divline_t *v2, divline_t *v1)
fixed_t opentop, openbottom, openrange, lowfloor, highceiling; fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
pslope_t *opentopslope, *openbottomslope; pslope_t *opentopslope, *openbottomslope;
ffloor_t *openfloorrover, *openceilingrover; ffloor_t *openfloorrover, *openceilingrover;
fixed_t openfloordiff; fixed_t openceilingstep;
fixed_t openceilingdiff;
fixed_t openfloordrop;
fixed_t openceilingdrop; fixed_t openceilingdrop;
fixed_t openfloorstep;
fixed_t openfloordrop;
// P_CameraLineOpening // P_CameraLineOpening
// P_LineOpening, but for camera // P_LineOpening, but for camera
@ -437,6 +437,9 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
fixed_t topedge[2] = {0}; fixed_t topedge[2] = {0};
fixed_t botedge[2] = {0}; fixed_t botedge[2] = {0};
int hi;
int lo;
if (linedef->sidenum[1] == 0xffff) if (linedef->sidenum[1] == 0xffff)
{ {
// single sided line // single sided line
@ -475,59 +478,53 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
highceiling = INT32_MIN; highceiling = INT32_MIN;
lowfloor = INT32_MAX; lowfloor = INT32_MAX;
opentopslope = openbottomslope = NULL; opentopslope = openbottomslope = NULL;
openfloordiff = 0; openceilingstep = 0;
openceilingdiff = 0; openceilingdrop = 0;
openfloorstep = 0;
openfloordrop = 0;
} }
else else
{ // Set open and high/low values here { // Set open and high/low values here
fixed_t height[2]; fixed_t height[2];
const sector_t * sector[2] = { front, back }; const sector_t * sector[2] = { front, back };
int high;
#define low ! high
height[FRONT] = P_GetCeilingZ(mobj, front, tmx, tmy, linedef); height[FRONT] = P_GetCeilingZ(mobj, front, tmx, tmy, linedef);
height[BACK] = P_GetCeilingZ(mobj, back, tmx, tmy, linedef); height[BACK] = P_GetCeilingZ(mobj, back, tmx, tmy, linedef);
high = ( height[0] < height[1] ); hi = ( height[0] < height[1] );
lo = ! hi;
opentop = height[low]; opentop = height[lo];
highceiling = height[high]; highceiling = height[hi];
opentopslope = sector[low]->c_slope; opentopslope = sector[lo]->c_slope;
if (mobj) if (mobj)
{ {
openceilingdiff = ( thingtop -
P_GetSectorCeilingZAt(sector[low], cross.x, cross.y) );
topedge[FRONT] = P_GetSectorCeilingZAt(front, cross.x, cross.y); topedge[FRONT] = P_GetSectorCeilingZAt(front, cross.x, cross.y);
topedge[BACK] = P_GetSectorCeilingZAt(back, cross.x, cross.y); topedge[BACK] = P_GetSectorCeilingZAt(back, cross.x, cross.y);
openceilingdrop = ( topedge[high] - topedge[low] ); openceilingstep = ( thingtop - topedge[lo] );
openceilingdrop = ( topedge[hi] - topedge[lo] );
} }
height[FRONT] = P_GetFloorZ(mobj, front, tmx, tmy, linedef); height[FRONT] = P_GetFloorZ(mobj, front, tmx, tmy, linedef);
height[BACK] = P_GetFloorZ(mobj, back, tmx, tmy, linedef); height[BACK] = P_GetFloorZ(mobj, back, tmx, tmy, linedef);
high = ( height[0] < height[1] ); hi = ( height[0] < height[1] );
lo = ! hi;
openbottom = height[high]; openbottom = height[hi];
lowfloor = height[low]; lowfloor = height[lo];
openbottomslope = sector[high]->f_slope; openbottomslope = sector[hi]->f_slope;
if (mobj) if (mobj)
{ {
openfloordiff =
( P_GetSectorFloorZAt(sector[high], cross.x, cross.y) - mobj->z );
botedge[FRONT] = P_GetSectorFloorZAt(front, cross.x, cross.y); botedge[FRONT] = P_GetSectorFloorZAt(front, cross.x, cross.y);
botedge[BACK] = P_GetSectorFloorZAt(back, cross.x, cross.y); botedge[BACK] = P_GetSectorFloorZAt(back, cross.x, cross.y);
openfloordrop = ( botedge[high] - botedge[low] ); openfloorstep = ( botedge[hi] - mobj->z );
openfloordrop = ( botedge[hi] - botedge[lo] );
} }
#undef low
} }
if (mobj) if (mobj)
@ -583,13 +580,11 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
if (delta1 > delta2) { // Below if (delta1 > delta2) { // Below
if (opentop > texbottom) if (opentop > texbottom)
{ {
openceilingdiff = ( opentop - texbottom );
opentop = texbottom; opentop = texbottom;
} }
} else { // Above } else { // Above
if (openbottom < textop) if (openbottom < textop)
{ {
openfloordiff = ( textop - openbottom );
openbottom = textop; openbottom = textop;
} }
} }
@ -620,7 +615,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
if (polybottom < opentop && delta1 >= delta2) if (polybottom < opentop && delta1 >= delta2)
{ {
openceilingdiff = ( opentop - polybottom );
opentop = polybottom; opentop = polybottom;
} }
else if (polybottom < highceiling && delta1 >= delta2) else if (polybottom < highceiling && delta1 >= delta2)
@ -630,7 +624,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
if (polytop > openbottom && delta1 < delta2) if (polytop > openbottom && delta1 < delta2)
{ {
openfloordiff = ( polytop - openbottom );
openbottom = polytop; openbottom = polytop;
} }
else if (polytop > lowfloor && delta1 < delta2) else if (polytop > lowfloor && delta1 < delta2)
@ -660,9 +653,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
{ INT32_MAX, INT32_MIN, NULL, NULL }, { INT32_MAX, INT32_MIN, NULL, NULL },
}; };
int lo;
int hi;
const fixed_t oldopentop = opentop; const fixed_t oldopentop = opentop;
const fixed_t oldopenbottom = openbottom; const fixed_t oldopenbottom = openbottom;
@ -754,11 +744,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
if (open[lo].top <= oldopentop) if (open[lo].top <= oldopentop)
{ {
opentop = open[lo].top;
openceilingrover = open[lo].ceilingrover;
openceilingdiff = ( thingtop -
P_GetFFloorBottomZAt(openceilingrover, cross.x, cross.y) );
hi = ! lo; hi = ! lo;
topedge[lo] = P_GetFFloorBottomZAt(open[lo].ceilingrover, cross.x, cross.y); topedge[lo] = P_GetFFloorBottomZAt(open[lo].ceilingrover, cross.x, cross.y);
@ -768,6 +753,9 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
topedge[hi] = P_GetFFloorBottomZAt(open[hi].ceilingrover, cross.x, cross.y); topedge[hi] = P_GetFFloorBottomZAt(open[hi].ceilingrover, cross.x, cross.y);
} }
opentop = open[lo].top;
openceilingrover = open[lo].ceilingrover;
openceilingstep = ( thingtop - topedge[lo] );
openceilingdrop = ( topedge[hi] - topedge[lo] ); openceilingdrop = ( topedge[hi] - topedge[lo] );
} }
@ -775,11 +763,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
if (open[hi].bottom >= oldopenbottom) if (open[hi].bottom >= oldopenbottom)
{ {
openbottom = open[hi].bottom;
openfloorrover = open[hi].floorrover;
openfloordiff =
( P_GetFFloorTopZAt(openfloorrover, cross.x, cross.y) - mobj->z );
lo = ! hi; lo = ! hi;
botedge[hi] = P_GetFFloorTopZAt(open[hi].floorrover, cross.x, cross.y); botedge[hi] = P_GetFFloorTopZAt(open[hi].floorrover, cross.x, cross.y);
@ -789,6 +772,9 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
botedge[lo] = P_GetFFloorTopZAt(open[lo].floorrover, cross.x, cross.y); botedge[lo] = P_GetFFloorTopZAt(open[lo].floorrover, cross.x, cross.y);
} }
openbottom = open[hi].bottom;
openfloorrover = open[hi].floorrover;
openfloorstep = ( botedge[hi] - mobj->z );
openfloordrop = ( botedge[hi] - botedge[lo] ); openfloordrop = ( botedge[hi] - botedge[lo] );
} }
} }

View file

@ -58,10 +58,10 @@ void P_HitSpecialLines(mobj_t *thing, fixed_t x, fixed_t y, fixed_t momx, fixed_
extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling; extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
extern pslope_t *opentopslope, *openbottomslope; extern pslope_t *opentopslope, *openbottomslope;
extern ffloor_t *openfloorrover, *openceilingrover; extern ffloor_t *openfloorrover, *openceilingrover;
extern fixed_t openfloordiff; extern fixed_t openceilingstep;
extern fixed_t openceilingdiff;
extern fixed_t openfloordrop;
extern fixed_t openceilingdrop; extern fixed_t openceilingdrop;
extern fixed_t openfloorstep;
extern fixed_t openfloordrop;
void P_LineOpening(line_t *plinedef, mobj_t *mobj); void P_LineOpening(line_t *plinedef, mobj_t *mobj);