mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-18 23:41:48 +00:00
Re-implement the small turn-back after a drift ends
This commit is contained in:
parent
6b83d1cdc5
commit
680fdf1416
2 changed files with 20 additions and 0 deletions
|
@ -252,6 +252,7 @@ typedef enum
|
|||
k_spinouttype, // Determines whether to thrust forward or not while spinning out; 0 = move forwards, 1 = stay still
|
||||
|
||||
k_drift, // Drifting Left or Right, plus a bigger counter = sharper turn
|
||||
k_driftend, // Drift has ended, used to adjust character angle after drift
|
||||
k_driftcharge, // Charge your drift so you can release a burst of speed
|
||||
k_driftboost, // Boost you get from drifting
|
||||
k_boostcharge, // Charge-up for boosting at the start of the race, or when Lakitu drops you
|
||||
|
|
19
src/k_kart.c
19
src/k_kart.c
|
@ -1749,6 +1749,10 @@ INT16 K_GetKartDriftValue(player_t *player, SINT8 turndir)
|
|||
{
|
||||
turntype = 1;
|
||||
}
|
||||
else if (player->kartstuff[k_driftend] != 0)
|
||||
{
|
||||
turntype = 4;
|
||||
}
|
||||
|
||||
switch (turntype)
|
||||
{
|
||||
|
@ -1761,6 +1765,13 @@ INT16 K_GetKartDriftValue(player_t *player, SINT8 turndir)
|
|||
case 3:
|
||||
driftangle = 450; // Drifting with no input
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
fixed_t p_maxspeed = FixedMul(K_GetKartSpeed(player, false), 3*FRACUNIT);
|
||||
fixed_t adjustangle = FixedDiv((p_maxspeed>>16) - (player->speed>>16), (p_maxspeed>>16) + player->kartweight);
|
||||
driftangle = FixedMul(-800, adjustangle);// Drift has ended and we are tweaking their angle back a bit
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return driftangle*(player->kartstuff[k_drift] / abs(player->kartstuff[k_drift]));
|
||||
|
@ -1814,9 +1825,17 @@ static void K_KartDrift(player_t *player, boolean onground)
|
|||
else if (player->kartstuff[k_jmp] == 0) // || player->kartstuff[k_turndir] == 0)
|
||||
{
|
||||
if (player->kartstuff[k_drift] > 0)
|
||||
{
|
||||
player->kartstuff[k_drift]--;
|
||||
player->kartstuff[k_driftend] = 1;
|
||||
}
|
||||
else if (player->kartstuff[k_drift] < 0)
|
||||
{
|
||||
player->kartstuff[k_drift]++;
|
||||
player->kartstuff[k_driftend] = 1;
|
||||
}
|
||||
else
|
||||
player->kartstuff[k_driftend] = 0;
|
||||
}
|
||||
|
||||
// Incease/decrease the drift value to continue drifting in that direction
|
||||
|
|
Loading…
Reference in a new issue