Merge branch 'waterstep-2' into 'master'

Waterstep 2

Closes #329 and #327

See merge request KartKrew/Kart!774
This commit is contained in:
Sal 2022-11-25 22:42:19 +00:00
commit 90e3d01395
2 changed files with 17 additions and 4 deletions

View file

@ -3445,6 +3445,8 @@ boolean K_WaterRun(mobj_t *mobj)
case MT_PLAYER: case MT_PLAYER:
{ {
fixed_t minspeed = 0;
if (mobj->player == NULL) if (mobj->player == NULL)
{ {
return false; return false;
@ -3455,11 +3457,18 @@ boolean K_WaterRun(mobj_t *mobj)
return K_IsHoldingDownTop(mobj->player) == false; return K_IsHoldingDownTop(mobj->player) == false;
} }
minspeed = 2 * K_GetKartSpeed(mobj->player, false, false); // 200%
if (mobj->player->speed < minspeed / 5) // 40%
{
return false;
}
if (mobj->player->invincibilitytimer if (mobj->player->invincibilitytimer
|| mobj->player->sneakertimer || mobj->player->sneakertimer
|| mobj->player->tiregrease || mobj->player->tiregrease
|| mobj->player->flamedash || mobj->player->flamedash
|| mobj->player->speed > 2 * K_GetKartSpeed(mobj->player, false, false)) || mobj->player->speed > minspeed)
{ {
return true; return true;
} }
@ -10362,6 +10371,9 @@ boolean K_FastFallBounce(player_t *player)
} }
} }
if (player->mo->eflags & MFE_UNDERWATER)
bounce = (117 * bounce) / 200;
S_StartSound(player->mo, sfx_ffbonc); S_StartSound(player->mo, sfx_ffbonc);
player->mo->momz = bounce * P_MobjFlip(player->mo); player->mo->momz = bounce * P_MobjFlip(player->mo);

View file

@ -3222,14 +3222,15 @@ boolean P_CanRunOnWater(mobj_t *mobj, ffloor_t *rover)
// We start water run IF we can step onto it! // We start water run IF we can step onto it!
if (surfDiff <= maxStep && surfDiff >= 0) if (surfDiff <= maxStep && surfDiff >= 0)
{ {
if (ourZAng < 0) pslope_t *groundSlope = (flip ? mobj->subsector->sector->c_slope : mobj->subsector->sector->f_slope);
if (groundSlope != NULL && groundSlope->zangle != 0)
{ {
fixed_t floorheight = flip ? P_GetSectorCeilingZAt(mobj->subsector->sector, mobj->x, mobj->y) : P_GetSectorFloorZAt(mobj->subsector->sector, mobj->x, mobj->y); fixed_t floorheight = flip ? P_GetSectorCeilingZAt(mobj->subsector->sector, mobj->x, mobj->y) : P_GetSectorFloorZAt(mobj->subsector->sector, mobj->x, mobj->y);
fixed_t floorDiff = flip ? (floorheight - mobjbottom) : (mobjbottom - floorheight); fixed_t floorDiff = flip ? (floorheight - mobjbottom) : (mobjbottom - floorheight);
if (floorDiff <= maxStep && floorDiff >= -maxStep) if (floorDiff <= maxStep && floorDiff >= -maxStep)
{ {
// ... but NOT if going down and real floor is in range. // ... but NOT if downward-sloping real floor is in range.
// FIXME: Count solid FOFs in this check // FIXME: Count solid FOFs in these checks
return false; return false;
} }
} }