Merge branch 'flipped-waterrun' into 'next'

Allow water running in reverse gravity

See merge request STJr/SRB2!1369
This commit is contained in:
Lachlan Wright 2021-01-19 23:20:57 -05:00
commit ea55a614d1

View file

@ -3188,13 +3188,16 @@ boolean P_SceneryZMovement(mobj_t *mo)
//
boolean P_CanRunOnWater(player_t *player, ffloor_t *rover)
{
fixed_t topheight = P_GetFFloorTopZAt(rover, player->mo->x, player->mo->y);
boolean flip = player->mo->eflags & MFE_VERTICALFLIP;
fixed_t surfaceheight = flip ? P_GetFFloorBottomZAt(rover, player->mo->x, player->mo->y) : P_GetFFloorTopZAt(rover, player->mo->x, player->mo->y);
fixed_t playerbottom = flip ? (player->mo->z + player->mo->height) : player->mo->z;
boolean doifit = flip ? (surfaceheight - player->mo->floorz >= player->mo->height) : (player->mo->ceilingz - surfaceheight >= player->mo->height);
if (!player->powers[pw_carry] && !player->homing
&& ((player->powers[pw_super] || player->charflags & SF_RUNONWATER || player->dashmode >= DASHMODE_THRESHOLD) && player->mo->ceilingz-topheight >= player->mo->height)
&& ((player->powers[pw_super] || player->charflags & SF_RUNONWATER || player->dashmode >= DASHMODE_THRESHOLD) && doifit)
&& (rover->flags & FF_SWIMMABLE) && !(player->pflags & PF_SPINNING) && player->speed > FixedMul(player->runspeed, player->mo->scale)
&& !(player->pflags & PF_SLIDING)
&& abs(player->mo->z - topheight) < FixedMul(30*FRACUNIT, player->mo->scale))
&& abs(playerbottom - surfaceheight) < FixedMul(30*FRACUNIT, player->mo->scale))
return true;
return false;