Merge branch 'faster-waterskip' into 'master'

Faster waterskipping

See merge request KartKrew/Kart!191
This commit is contained in:
Sal 2019-10-28 20:17:16 -04:00
commit 4960a925cf
2 changed files with 17 additions and 18 deletions

View file

@ -2787,18 +2787,22 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
if (!(thing->flags & MF_NOCLIP)) if (!(thing->flags & MF_NOCLIP))
{ {
//All things are affected by their scale. //All things are affected by their scale.
fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale); const fixed_t maxstepmove = FixedMul(MAXSTEPMOVE, mapobjectscale);
fixed_t maxstep = maxstepmove;
if (thing->player) if (thing->player)
{ {
if (thing->player->kartstuff[k_waterskip])
maxstep += maxstepmove; // Force some stepmove when waterskipping
// If using type Section1:13, double the maxstep. // If using type Section1:13, double the maxstep.
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13) if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13)
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13) || GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13)
maxstep <<= 1; maxstep += maxstepmove;
// If using type Section1:12, no maxstep. For ledges you don't want the player to climb! (see: Egg Zeppelin & SMK port walls) // If using type Section1:12, no maxstep. For ledges you don't want the player to climb! (see: Egg Zeppelin & SMK port walls)
else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12) else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12)
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 12) || GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 12)
maxstep = 0; maxstep -= maxstepmove;
// Don't 'step up' while springing, // Don't 'step up' while springing,
// Only step up "if needed". // Only step up "if needed".

View file

@ -1268,6 +1268,8 @@ fixed_t P_GetMobjGravity(mobj_t *mo)
P_PlayerFlip(mo); P_PlayerFlip(mo);
if (mo->player->kartstuff[k_pogospring]) if (mo->player->kartstuff[k_pogospring])
gravityadd = (5*gravityadd)/2; gravityadd = (5*gravityadd)/2;
if (mo->player->kartstuff[k_waterskip])
gravityadd = (4*gravityadd)/3;
} }
else else
{ {
@ -3301,26 +3303,19 @@ void P_MobjCheckWater(mobj_t *mobj)
// skipping stone! // skipping stone!
if (p && p->kartstuff[k_waterskip] < 2 if (p && p->kartstuff[k_waterskip] < 2
&& ((p->speed/3 > abs(mobj->momz)) // Going more forward than horizontal, so you can skip across the water. && ((p->speed/3 > abs(mobj->momz)) // Going more forward than horizontal, so you can skip across the water.
|| (p->speed > K_GetKartSpeed(p,false)/3 && p->kartstuff[k_waterskip])) // Already skipped once, so you can skip once more! || (p->speed > 20*mapobjectscale && p->kartstuff[k_waterskip])) // Already skipped once, so you can skip once more!
&& ((!(mobj->eflags & MFE_VERTICALFLIP) && thingtop - mobj->momz > mobj->watertop) && ((!(mobj->eflags & MFE_VERTICALFLIP) && thingtop - mobj->momz > mobj->watertop)
|| ((mobj->eflags & MFE_VERTICALFLIP) && mobj->z - mobj->momz < mobj->waterbottom))) || ((mobj->eflags & MFE_VERTICALFLIP) && mobj->z - mobj->momz < mobj->waterbottom)))
{ {
const fixed_t min = 6<<FRACBITS; const fixed_t hop = 5<<FRACBITS;
//const fixed_t max = 8<<FRACBITS;
mobj->momx = mobj->momx/2; mobj->momx = (4*mobj->momx)/5;
mobj->momy = mobj->momy/2; mobj->momy = (4*mobj->momy)/5;
mobj->momz = -mobj->momz/2;
if (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->momz < FixedMul(min, mobj->scale)) if (mobj->eflags & MFE_VERTICALFLIP)
mobj->momz = FixedMul(min, mobj->scale); mobj->momz = FixedMul(-hop, mobj->scale);
else if (mobj->eflags & MFE_VERTICALFLIP && mobj->momz > FixedMul(-min, mobj->scale)) else
mobj->momz = FixedMul(-min, mobj->scale); mobj->momz = FixedMul(hop, mobj->scale);
/*if (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->momz > FixedMul(max, mobj->scale))
mobj->momz = FixedMul(max, mobj->scale);
else if (mobj->eflags & MFE_VERTICALFLIP && mobj->momz < FixedMul(-max, mobj->scale))
mobj->momz = FixedMul(-max, mobj->scale);*/
p->kartstuff[k_waterskip]++; p->kartstuff[k_waterskip]++;
} }