mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-03-22 10:51:54 +00:00
Change momentum to be closer to the direction you're facing when not pressing the controls
This commit is contained in:
parent
546b98b4cb
commit
16e0dec70d
3 changed files with 21 additions and 0 deletions
16
src/k_kart.c
16
src/k_kart.c
|
@ -1006,6 +1006,22 @@ static void K_PlayTauntSound(mobj_t *source)
|
|||
}
|
||||
}
|
||||
|
||||
void K_MomentumToFacing(player_t *player)
|
||||
{
|
||||
angle_t dangle = player->mo->angle - R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy);
|
||||
fixed_t speed = R_PointToDist2(0, 0, player->rmomx, player->rmomy);
|
||||
|
||||
if (dangle > ANGLE_180)
|
||||
dangle = InvAngle(dangle);
|
||||
|
||||
// If you aren't on the ground or are moving in too different of a direction don't do this
|
||||
if (!P_IsObjectOnGround(player->mo) || dangle > ANGLE_90)
|
||||
return;
|
||||
|
||||
P_Thrust(player->mo, player->mo->angle, speed - FixedMul(speed, player->mo->friction));
|
||||
player->mo->momx = FixedMul(player->mo->momx, player->mo->friction);
|
||||
player->mo->momy = FixedMul(player->mo->momy, player->mo->friction);
|
||||
}
|
||||
|
||||
// if speed is true it gets the speed boost power, otherwise it gets the acceleration
|
||||
static fixed_t K_GetKartBoostPower(player_t *player, boolean speed)
|
||||
|
|
|
@ -23,6 +23,7 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32
|
|||
void K_SpawnDriftTrail(player_t *player);
|
||||
void K_DoMushroom(player_t *player, boolean doPFlag);
|
||||
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);
|
||||
void K_MomentumToFacing(player_t *player);
|
||||
fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower);
|
||||
fixed_t K_3dKartMovement(player_t *player, boolean onground, boolean forwardmovement);
|
||||
void K_MoveKartPlayer(player_t *player, boolean onground);
|
||||
|
|
|
@ -4789,6 +4789,10 @@ static void P_3dMovement(player_t *player)
|
|||
P_Thrust(player->mo, movepushangle, movepushforward);
|
||||
#endif
|
||||
}
|
||||
else if (!player->kartstuff[k_spinouttimer])
|
||||
{
|
||||
K_MomentumToFacing(player);
|
||||
}
|
||||
// Sideways movement
|
||||
if (player->climbing)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue