mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 07:22:28 +00:00
Remove redundant conditional in P_IsClimbingValid
This commit is contained in:
parent
478f0f2059
commit
6ffbc89f42
1 changed files with 29 additions and 32 deletions
61
src/p_map.c
61
src/p_map.c
|
@ -3209,6 +3209,7 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
||||||
sector_t *glidesector;
|
sector_t *glidesector;
|
||||||
fixed_t floorz, ceilingz;
|
fixed_t floorz, ceilingz;
|
||||||
mobj_t *mo = player->mo;
|
mobj_t *mo = player->mo;
|
||||||
|
ffloor_t *rover;
|
||||||
|
|
||||||
platx = P_ReturnThrustX(mo, angle, mo->radius + FixedMul(8*FRACUNIT, mo->scale));
|
platx = P_ReturnThrustX(mo, angle, mo->radius + FixedMul(8*FRACUNIT, mo->scale));
|
||||||
platy = P_ReturnThrustY(mo, angle, mo->radius + FixedMul(8*FRACUNIT, mo->scale));
|
platy = P_ReturnThrustY(mo, angle, mo->radius + FixedMul(8*FRACUNIT, mo->scale));
|
||||||
|
@ -3223,41 +3224,37 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
||||||
boolean floorclimb = false;
|
boolean floorclimb = false;
|
||||||
fixed_t topheight, bottomheight;
|
fixed_t topheight, bottomheight;
|
||||||
|
|
||||||
if (glidesector->ffloors)
|
for (rover = glidesector->ffloors; rover; rover = rover->next)
|
||||||
{
|
{
|
||||||
ffloor_t *rover;
|
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER))
|
||||||
for (rover = glidesector->ffloors; rover; rover = rover->next)
|
continue;
|
||||||
|
|
||||||
|
topheight = P_GetFFloorTopZAt (rover, mo->x, mo->y);
|
||||||
|
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
|
||||||
|
|
||||||
|
floorclimb = true;
|
||||||
|
|
||||||
|
if (mo->eflags & MFE_VERTICALFLIP)
|
||||||
{
|
{
|
||||||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER))
|
if ((topheight < mo->z + mo->height) && ((mo->z + mo->height + mo->momz) < topheight))
|
||||||
continue;
|
floorclimb = true;
|
||||||
|
if (topheight < mo->z) // Waaaay below the ledge.
|
||||||
topheight = P_GetFFloorTopZAt (rover, mo->x, mo->y);
|
floorclimb = false;
|
||||||
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
|
if (bottomheight > mo->z + mo->height - FixedMul(16*FRACUNIT,mo->scale))
|
||||||
|
floorclimb = false;
|
||||||
floorclimb = true;
|
|
||||||
|
|
||||||
if (mo->eflags & MFE_VERTICALFLIP)
|
|
||||||
{
|
|
||||||
if ((topheight < mo->z + mo->height) && ((mo->z + mo->height + mo->momz) < topheight))
|
|
||||||
floorclimb = true;
|
|
||||||
if (topheight < mo->z) // Waaaay below the ledge.
|
|
||||||
floorclimb = false;
|
|
||||||
if (bottomheight > mo->z + mo->height - FixedMul(16*FRACUNIT,mo->scale))
|
|
||||||
floorclimb = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((bottomheight > mo->z) && ((mo->z - mo->momz) > bottomheight))
|
|
||||||
floorclimb = true;
|
|
||||||
if (bottomheight > mo->z + mo->height) // Waaaay below the ledge.
|
|
||||||
floorclimb = false;
|
|
||||||
if (topheight < mo->z + FixedMul(16*FRACUNIT,mo->scale))
|
|
||||||
floorclimb = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (floorclimb)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((bottomheight > mo->z) && ((mo->z - mo->momz) > bottomheight))
|
||||||
|
floorclimb = true;
|
||||||
|
if (bottomheight > mo->z + mo->height) // Waaaay below the ledge.
|
||||||
|
floorclimb = false;
|
||||||
|
if (topheight < mo->z + FixedMul(16*FRACUNIT,mo->scale))
|
||||||
|
floorclimb = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (floorclimb)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mo->eflags & MFE_VERTICALFLIP)
|
if (mo->eflags & MFE_VERTICALFLIP)
|
||||||
|
|
Loading…
Reference in a new issue