mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-31 12:13:16 +00:00
More logic to spinning your wheels
Use "tire spinning" animations when you're moving on the ground and/or holding accelerate! The two cases that are changed are: - If you're in the air and not pressing accelerate, your tires won't spin anymore. - If you're on the ground, but not moving, but you're still pressing accelerate, they will spin in place. (right now only happens for start boosting, later it will be for spindashing) Isn't really a tell for anything, just thought it'd be fun attention to detail :) Additionally, we can use drift frames in the air. Just makes sense because we have air sparks now.
This commit is contained in:
parent
9ea37836e2
commit
c2b18a989c
2 changed files with 141 additions and 91 deletions
228
src/k_kart.c
228
src/k_kart.c
|
|
@ -2404,11 +2404,15 @@ void K_RespawnChecker(player_t *player)
|
|||
void K_KartMoveAnimation(player_t *player)
|
||||
{
|
||||
const INT16 minturn = KART_FULLTURN/8;
|
||||
SINT8 turndir = 0;
|
||||
|
||||
const fixed_t fastspeed = (K_GetKartSpeed(player, false) * 17) / 20; // 85%
|
||||
const fixed_t speedthreshold = player->mo->scale / 8;
|
||||
|
||||
const boolean onground = P_IsObjectOnGround(player->mo);
|
||||
|
||||
ticcmd_t *cmd = &player->cmd;
|
||||
SINT8 turndir = 0;
|
||||
const boolean spinningwheels = ((cmd->buttons & BT_ACCELERATE) || (onground && player->speed > 0));
|
||||
|
||||
if (cmd->driftturn < -minturn)
|
||||
{
|
||||
|
|
@ -2419,108 +2423,158 @@ void K_KartMoveAnimation(player_t *player)
|
|||
turndir = 1;
|
||||
}
|
||||
|
||||
if (player->speed == 0)
|
||||
if (!onground)
|
||||
{
|
||||
// Completely still.
|
||||
// Only use certain frames in the air, to make it look like your tires are spinning fruitlessly!
|
||||
|
||||
if ((turndir == -1)
|
||||
&& !(player->mo->state >= &states[S_KART_STILL1_R] && player->mo->state <= &states[S_KART_STILL2_R]))
|
||||
if (player->kartstuff[k_drift] > 0)
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_STILL1_R);
|
||||
if (!spinningwheels || !(player->mo->state >= &states[S_KART_DRIFT1_L] && player->mo->state <= &states[S_KART_DRIFT2_L]))
|
||||
{
|
||||
// Neutral drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_L);
|
||||
}
|
||||
}
|
||||
else if ((turndir == 1)
|
||||
&& !(player->mo->state >= &states[S_KART_STILL1_L] && player->mo->state <= &states[S_KART_STILL2_L]))
|
||||
else if (player->kartstuff[k_drift] > 0)
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_STILL1_L);
|
||||
if (!spinningwheels || !(player->mo->state >= &states[S_KART_DRIFT1_R] && player->mo->state <= &states[S_KART_DRIFT2_R]))
|
||||
{
|
||||
// Neutral drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_R);
|
||||
}
|
||||
}
|
||||
else if ((turndir == 0)
|
||||
&& !(player->mo->state >= &states[S_KART_STILL1] && player->mo->state <= &states[S_KART_STILL2]))
|
||||
else
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_STILL1);
|
||||
}
|
||||
}
|
||||
else if (player->kartstuff[k_drift] > 0 && onground)
|
||||
{
|
||||
// Drifting LEFT!
|
||||
|
||||
if ((turndir == -1)
|
||||
&& !(player->mo->state >= &states[S_KART_DRIFT1_L_OUT] && player->mo->state <= &states[S_KART_DRIFT2_L_OUT]))
|
||||
{
|
||||
// Right -- outwards drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_L_OUT);
|
||||
}
|
||||
else if ((turndir == 1)
|
||||
&& !(player->mo->state >= &states[S_KART_DRIFT1_L_IN] && player->mo->state <= &states[S_KART_DRIFT4_L_IN]))
|
||||
{
|
||||
// Left -- inwards drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_L_IN);
|
||||
}
|
||||
else if ((turndir == 0)
|
||||
&& !(player->mo->state >= &states[S_KART_DRIFT1_L] && player->mo->state <= &states[S_KART_DRIFT2_L]))
|
||||
{
|
||||
// Neutral drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_L);
|
||||
}
|
||||
}
|
||||
else if (player->kartstuff[k_drift] < 0 && onground)
|
||||
{
|
||||
// Drifting RIGHT!
|
||||
|
||||
if ((turndir == -1)
|
||||
&& !(player->mo->state >= &states[S_KART_DRIFT1_R_IN] && player->mo->state <= &states[S_KART_DRIFT4_R_IN]))
|
||||
{
|
||||
// Right -- inwards drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_R_IN);
|
||||
}
|
||||
else if ((turndir == 1)
|
||||
&& !(player->mo->state >= &states[S_KART_DRIFT1_R_OUT] && player->mo->state <= &states[S_KART_DRIFT2_R_OUT]))
|
||||
{
|
||||
// Left -- outwards drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_R_OUT);
|
||||
}
|
||||
else if ((turndir == 0)
|
||||
&& !(player->mo->state >= &states[S_KART_DRIFT1_R] && player->mo->state <= &states[S_KART_DRIFT2_R]))
|
||||
{
|
||||
// Neutral drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_R);
|
||||
}
|
||||
}
|
||||
else if (player->speed >= fastspeed && (!onground || player->speed >= (player->lastspeed - speedthreshold)))
|
||||
{
|
||||
// Going REAL fast!
|
||||
if ((turndir == -1)
|
||||
&& !(player->mo->state >= &states[S_KART_FAST1_R] && player->mo->state <= &states[S_KART_FAST2_R]))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_FAST1_R);
|
||||
}
|
||||
else if ((turndir == 1)
|
||||
&& !(player->mo->state >= &states[S_KART_FAST1_L] && player->mo->state <= &states[S_KART_FAST2_L]))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_FAST1_L);
|
||||
}
|
||||
else if ((turndir == 0)
|
||||
&& !(player->mo->state >= &states[S_KART_FAST1] && player->mo->state <= &states[S_KART_FAST2]))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_FAST1);
|
||||
if ((turndir == -1)
|
||||
&& (!spinningwheels || !(player->mo->state >= &states[S_KART_FAST1_R] && player->mo->state <= &states[S_KART_FAST2_R])))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_FAST2_R);
|
||||
}
|
||||
else if ((turndir == 1)
|
||||
&& (!spinningwheels || !(player->mo->state >= &states[S_KART_FAST1_L] && player->mo->state <= &states[S_KART_FAST2_L])))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_FAST2_L);
|
||||
}
|
||||
else if ((turndir == 0)
|
||||
&& (!spinningwheels || !(player->mo->state >= &states[S_KART_FAST1] && player->mo->state <= &states[S_KART_FAST2])))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_FAST2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Slowing down...
|
||||
if ((turndir == -1)
|
||||
&& !(player->mo->state >= &states[S_KART_SLOW1_R] && player->mo->state <= &states[S_KART_SLOW2_R]))
|
||||
if (player->kartstuff[k_drift] > 0)
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SLOW1_R);
|
||||
// Drifting LEFT!
|
||||
|
||||
if ((turndir == -1)
|
||||
&& !(player->mo->state >= &states[S_KART_DRIFT1_L_OUT] && player->mo->state <= &states[S_KART_DRIFT2_L_OUT]))
|
||||
{
|
||||
// Right -- outwards drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_L_OUT);
|
||||
}
|
||||
else if ((turndir == 1)
|
||||
&& !(player->mo->state >= &states[S_KART_DRIFT1_L_IN] && player->mo->state <= &states[S_KART_DRIFT4_L_IN]))
|
||||
{
|
||||
// Left -- inwards drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_L_IN);
|
||||
}
|
||||
else if ((turndir == 0)
|
||||
&& !(player->mo->state >= &states[S_KART_DRIFT1_L] && player->mo->state <= &states[S_KART_DRIFT2_L]))
|
||||
{
|
||||
// Neutral drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_L);
|
||||
}
|
||||
}
|
||||
else if ((turndir == 1)
|
||||
&& !(player->mo->state >= &states[S_KART_SLOW1_L] && player->mo->state <= &states[S_KART_SLOW2_L]))
|
||||
else if (player->kartstuff[k_drift] < 0)
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SLOW1_L);
|
||||
// Drifting RIGHT!
|
||||
|
||||
if ((turndir == -1)
|
||||
&& !(player->mo->state >= &states[S_KART_DRIFT1_R_IN] && player->mo->state <= &states[S_KART_DRIFT4_R_IN]))
|
||||
{
|
||||
// Right -- inwards drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_R_IN);
|
||||
}
|
||||
else if ((turndir == 1)
|
||||
&& !(player->mo->state >= &states[S_KART_DRIFT1_R_OUT] && player->mo->state <= &states[S_KART_DRIFT2_R_OUT]))
|
||||
{
|
||||
// Left -- outwards drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_R_OUT);
|
||||
}
|
||||
else if ((turndir == 0)
|
||||
&& !(player->mo->state >= &states[S_KART_DRIFT1_R] && player->mo->state <= &states[S_KART_DRIFT2_R]))
|
||||
{
|
||||
// Neutral drift
|
||||
P_SetPlayerMobjState(player->mo, S_KART_DRIFT1_R);
|
||||
}
|
||||
}
|
||||
else if ((turndir == 0)
|
||||
&& !(player->mo->state >= &states[S_KART_SLOW1] && player->mo->state <= &states[S_KART_SLOW2]))
|
||||
else
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SLOW1);
|
||||
if (player->speed >= fastspeed && player->speed >= (player->lastspeed - speedthreshold))
|
||||
{
|
||||
// Going REAL fast!
|
||||
|
||||
if ((turndir == -1)
|
||||
&& !(player->mo->state >= &states[S_KART_FAST1_R] && player->mo->state <= &states[S_KART_FAST2_R]))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_FAST1_R);
|
||||
}
|
||||
else if ((turndir == 1)
|
||||
&& !(player->mo->state >= &states[S_KART_FAST1_L] && player->mo->state <= &states[S_KART_FAST2_L]))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_FAST1_L);
|
||||
}
|
||||
else if ((turndir == 0)
|
||||
&& !(player->mo->state >= &states[S_KART_FAST1] && player->mo->state <= &states[S_KART_FAST2]))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_FAST1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (spinningwheels)
|
||||
{
|
||||
// Drivin' slow.
|
||||
|
||||
if ((turndir == -1)
|
||||
&& !(player->mo->state >= &states[S_KART_SLOW1_R] && player->mo->state <= &states[S_KART_SLOW2_R]))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SLOW1_R);
|
||||
}
|
||||
else if ((turndir == 1)
|
||||
&& !(player->mo->state >= &states[S_KART_SLOW1_L] && player->mo->state <= &states[S_KART_SLOW2_L]))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SLOW1_L);
|
||||
}
|
||||
else if ((turndir == 0)
|
||||
&& !(player->mo->state >= &states[S_KART_SLOW1] && player->mo->state <= &states[S_KART_SLOW2]))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SLOW1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Completely still.
|
||||
|
||||
if ((turndir == -1)
|
||||
&& !(player->mo->state >= &states[S_KART_STILL1_R] && player->mo->state <= &states[S_KART_STILL2_R]))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_STILL1_R);
|
||||
}
|
||||
else if ((turndir == 1)
|
||||
&& !(player->mo->state >= &states[S_KART_STILL1_L] && player->mo->state <= &states[S_KART_STILL2_L]))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_STILL1_L);
|
||||
}
|
||||
else if ((turndir == 0)
|
||||
&& !(player->mo->state >= &states[S_KART_STILL1] && player->mo->state <= &states[S_KART_STILL2]))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_KART_STILL1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5906,10 +5906,6 @@ static void P_MovePlayer(player_t *player)
|
|||
|
||||
player->mo->movefactor = FRACUNIT; // We're not going to do any more with this, so let's change it back for the next frame.
|
||||
|
||||
// If you are stopped and are still walking, stand still!
|
||||
if (!player->mo->momx && !player->mo->momy && !player->mo->momz && player->panim == PA_WALK)
|
||||
P_SetPlayerMobjState(player->mo, S_KART_STILL1); // SRB2kart - was S_PLAY_STND
|
||||
|
||||
//{ SRB2kart
|
||||
|
||||
// Drifting sound
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue