mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-18 19:41:29 +00:00
Don't thrust orbinauts while airborne
Fixes bonking against a wall transfer.
This commit is contained in:
parent
5f8901b033
commit
b6b7d7a93e
1 changed files with 32 additions and 27 deletions
59
src/p_mobj.c
59
src/p_mobj.c
|
|
@ -6739,40 +6739,45 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
|||
}
|
||||
else
|
||||
{
|
||||
fixed_t finalspeed = mobj->movefactor;
|
||||
const fixed_t currentspeed = R_PointToDist2(0, 0, mobj->momx, mobj->momy);
|
||||
fixed_t thrustamount = 0;
|
||||
fixed_t frictionsafety = (mobj->friction == 0) ? 1 : mobj->friction;
|
||||
mobj_t *ghost = P_SpawnGhostMobj(mobj);
|
||||
ghost->colorized = true; // already has color!
|
||||
|
||||
if (!grounded)
|
||||
{
|
||||
// No friction in the air
|
||||
frictionsafety = FRACUNIT;
|
||||
}
|
||||
|
||||
mobj->angle = K_MomentumAngle(mobj);
|
||||
if (mobj->health <= 5)
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 5; i >= mobj->health; i--)
|
||||
finalspeed = FixedMul(finalspeed, FRACUNIT-FRACUNIT/4);
|
||||
}
|
||||
|
||||
if (currentspeed >= finalspeed)
|
||||
if (P_IsObjectOnGround(mobj))
|
||||
{
|
||||
// Thrust as if you were at top speed, slow down naturally
|
||||
thrustamount = FixedDiv(finalspeed, frictionsafety) - finalspeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
const fixed_t beatfriction = FixedDiv(currentspeed, frictionsafety) - currentspeed;
|
||||
// Thrust to immediately get to top speed
|
||||
thrustamount = beatfriction + FixedDiv(finalspeed - currentspeed, frictionsafety);
|
||||
}
|
||||
fixed_t finalspeed = mobj->movefactor;
|
||||
const fixed_t currentspeed = R_PointToDist2(0, 0, mobj->momx, mobj->momy);
|
||||
fixed_t thrustamount = 0;
|
||||
fixed_t frictionsafety = (mobj->friction == 0) ? 1 : mobj->friction;
|
||||
|
||||
P_Thrust(mobj, mobj->angle, thrustamount);
|
||||
if (!grounded)
|
||||
{
|
||||
// No friction in the air
|
||||
frictionsafety = FRACUNIT;
|
||||
}
|
||||
|
||||
if (mobj->health <= 5)
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 5; i >= mobj->health; i--)
|
||||
finalspeed = FixedMul(finalspeed, FRACUNIT-FRACUNIT/4);
|
||||
}
|
||||
|
||||
if (currentspeed >= finalspeed)
|
||||
{
|
||||
// Thrust as if you were at top speed, slow down naturally
|
||||
thrustamount = FixedDiv(finalspeed, frictionsafety) - finalspeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
const fixed_t beatfriction = FixedDiv(currentspeed, frictionsafety) - currentspeed;
|
||||
// Thrust to immediately get to top speed
|
||||
thrustamount = beatfriction + FixedDiv(finalspeed - currentspeed, frictionsafety);
|
||||
}
|
||||
|
||||
P_Thrust(mobj, mobj->angle, thrustamount);
|
||||
}
|
||||
|
||||
if (P_MobjTouchingSectorSpecial(mobj, 3, 1, true))
|
||||
K_DoPogoSpring(mobj, 0, 1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue