Use K_GetForwardMove more universally

Use it here to apply the value just like pogospring. Will make things like quickstartaccel and sneaker forwardmove apply to all uses of forwardmove
This commit is contained in:
NepDisk 2024-10-07 19:52:56 -04:00
parent 7886c6efb4
commit 1b372c4430
2 changed files with 11 additions and 9 deletions

View file

@ -2179,7 +2179,7 @@ void K_KartMoveAnimation(player_t *player)
player->pflags |= PF_GAINAX;
}
}
else if (K_GetForwardMove(player) < 0 && destGlanceDir == 0)
else if (player->cmd.forwardmove < 0 && destGlanceDir == 0)
{
// Reversing -- like looking back, but doesn't stack on the other glances.
if (player->glanceDir != 0)
@ -2997,6 +2997,11 @@ UINT16 K_GetKartButtons(player_t *player)
SINT8 K_GetForwardMove(player_t *player)
{
SINT8 forwardmove = player->cmd.forwardmove;
if ((player->exiting || mapreset))
{
return 0;
}
if ((player->pflags & PF_STASIS) || (player->carry == CR_SLIDING))
{
@ -5978,7 +5983,7 @@ static void K_UpdateEngineSounds(player_t *player)
else
{
// Average out the value of forwardmove and the speed that you're moving at.
targetsnd = (((6 * K_GetForwardMove(player)) / 25) + ((player->speed / mapobjectscale) / 5)) / 2;
targetsnd = (((6 * player->cmd.forwardmove) / 25) + ((player->speed / mapobjectscale) / 5)) / 2;
}
if (targetsnd < 0) { targetsnd = 0; }
@ -8140,7 +8145,7 @@ static void K_AirFailsafe(player_t *player)
return;
}
if ((K_GetKartButtons(player) & BT_ACCELERATE) || K_GetForwardMove(player) != 0)
if ((K_GetKartButtons(player) & BT_ACCELERATE) || player->cmd.forwardmove != 0)
{
// Queue up later
player->pflags |= PF_AIRFAILSAFE;

View file

@ -1791,10 +1791,7 @@ static void P_3dMovement(player_t *player)
if (!player->pogospring)
cmd->sidemove = 0;
if ((player->exiting || mapreset) || player->pflags & PF_STASIS || player->spinouttimer) // pw_introcam?
{
cmd->forwardmove = cmd->sidemove = 0;
}
cmd->forwardmove = K_GetForwardMove(player);
// Get the old momentum; this will be needed at the end of the function! -SH
oldMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
@ -1882,10 +1879,10 @@ static void P_3dMovement(player_t *player)
if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration...
movepushforward = FixedMul(movepushforward, player->mo->movefactor);
if (cmd->buttons & BT_BRAKE && (K_GetForwardMove(player) == 0)) // SRB2kart - braking isn't instant
if (cmd->buttons & BT_BRAKE && (player->cmd.forwardmove == 0)) // SRB2kart - braking isn't instant
movepushforward /= 64;
if (K_GetForwardMove(player) > 0)
if (player->cmd.forwardmove > 0)
player->brakestop = 0;
else if (player->brakestop < 6) // Don't start reversing with brakes until you've made a stop first
{