Re-enable the speed cap

Only in midair to prevent pogo jump acceleration to infinity.
This commit is contained in:
Sryder 2019-05-10 20:21:21 +01:00
parent 682a8f6829
commit 00ec2b5f16

View file

@ -4184,31 +4184,35 @@ static void P_3dMovement(player_t *player)
// If "no" to 2, normalize to topspeed, so we can't suddenly run faster than it of our own accord. // If "no" to 2, normalize to topspeed, so we can't suddenly run faster than it of our own accord.
// If "no" to 1, we're not reaching any limits yet, so ignore this entirely! // If "no" to 1, we're not reaching any limits yet, so ignore this entirely!
// -Shadow Hog // -Shadow Hog
/* // Only do this forced cap of speed when in midair, the kart acceleration code takes into account friction, and
newMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0); // doesn't let you accelerate past top speed, so this is unnecessary on the ground, but in the air is needed to
if (newMagnitude > K_GetKartSpeed(player, true)) //topspeed) // allow for being able to change direction on spring jumps without being accelerated into the void - Sryder
if (!P_IsObjectOnGround(player->mo))
{ {
fixed_t tempmomx, tempmomy; newMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
if (oldMagnitude > K_GetKartSpeed(player, true)) if (newMagnitude > K_GetKartSpeed(player, true)) //topspeed)
{ {
if (newMagnitude > oldMagnitude) fixed_t tempmomx, tempmomy;
if (oldMagnitude > K_GetKartSpeed(player, true))
{ {
tempmomx = FixedMul(FixedDiv(player->mo->momx - player->cmomx, newMagnitude), oldMagnitude); if (newMagnitude > oldMagnitude)
tempmomy = FixedMul(FixedDiv(player->mo->momy - player->cmomy, newMagnitude), oldMagnitude); {
tempmomx = FixedMul(FixedDiv(player->mo->momx - player->cmomx, newMagnitude), oldMagnitude);
tempmomy = FixedMul(FixedDiv(player->mo->momy - player->cmomy, newMagnitude), oldMagnitude);
player->mo->momx = tempmomx + player->cmomx;
player->mo->momy = tempmomy + player->cmomy;
}
// else do nothing
}
else
{
tempmomx = FixedMul(FixedDiv(player->mo->momx - player->cmomx, newMagnitude), K_GetKartSpeed(player, true)); //topspeed)
tempmomy = FixedMul(FixedDiv(player->mo->momy - player->cmomy, newMagnitude), K_GetKartSpeed(player, true)); //topspeed)
player->mo->momx = tempmomx + player->cmomx; player->mo->momx = tempmomx + player->cmomx;
player->mo->momy = tempmomy + player->cmomy; player->mo->momy = tempmomy + player->cmomy;
} }
// else do nothing
}
else
{
tempmomx = FixedMul(FixedDiv(player->mo->momx - player->cmomx, newMagnitude), K_GetKartSpeed(player, true)); //topspeed)
tempmomy = FixedMul(FixedDiv(player->mo->momy - player->cmomy, newMagnitude), K_GetKartSpeed(player, true)); //topspeed)
player->mo->momx = tempmomx + player->cmomx;
player->mo->momy = tempmomy + player->cmomy;
} }
} }
*/
} }
// //