From eebdda083338a7216883c6dd03473121b69b6a17 Mon Sep 17 00:00:00 2001 From: SeventhSentinel Date: Sun, 6 Jan 2019 17:17:52 -0500 Subject: [PATCH] Minimum speed to get drift sparks --- src/d_player.h | 1 + src/dehacked.c | 3 ++- src/k_kart.c | 17 +++++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 1b1d4d0a..2d9ed5c8 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -351,6 +351,7 @@ typedef enum // v1.0.2 vars k_itemblink, // Item flashing after roulette, prevents Hyudoro stealing AND serves as a mashing indicator k_itemblinkmode, // Type of flashing: 0 = white (normal), 1 = red (mashing), 2 = rainbow (enhanced items) + k_getsparks, // Disable drift sparks at low speed, JUST enough to give acceleration the actual headstart above speed NUMKARTSTUFF } kartstufftype_t; diff --git a/src/dehacked.c b/src/dehacked.c index 8cb70412..3f6fcecb 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8281,7 +8281,8 @@ static const char *const KARTSTUFF_LIST[] = { "YOUGOTEM", "ITEMBLINK", - "ITEMBLINKMODE" + "ITEMBLINKMODE", + "GETSPARKS" }; static const char *const HUDITEMS_LIST[] = { diff --git a/src/k_kart.c b/src/k_kart.c index 28a566c9..ccc0f64d 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4585,6 +4585,7 @@ INT32 K_GetKartDriftSparkValue(player_t *player) static void K_KartDrift(player_t *player, boolean onground) { + fixed_t minspeed = (10 * player->mo->scale); INT32 dsone = K_GetKartDriftSparkValue(player); INT32 dstwo = dsone*2; INT32 dsthree = dstwo*2; @@ -4635,14 +4636,14 @@ static void K_KartDrift(player_t *player, boolean onground) } // Drifting: left or right? - if ((player->cmd.driftturn > 0) && player->speed > FixedMul(10<<16, player->mo->scale) && player->kartstuff[k_jmp] == 1 + if ((player->cmd.driftturn > 0) && player->speed > minspeed && player->kartstuff[k_jmp] == 1 && (player->kartstuff[k_drift] == 0 || player->kartstuff[k_driftend] == 1)) // && player->kartstuff[k_drift] != 1) { // Starting left drift player->kartstuff[k_drift] = 1; player->kartstuff[k_driftend] = player->kartstuff[k_driftcharge] = 0; } - else if ((player->cmd.driftturn < 0) && player->speed > FixedMul(10<<16, player->mo->scale) && player->kartstuff[k_jmp] == 1 + else if ((player->cmd.driftturn < 0) && player->speed > minspeed && player->kartstuff[k_jmp] == 1 && (player->kartstuff[k_drift] == 0 || player->kartstuff[k_driftend] == 1)) // && player->kartstuff[k_drift] != -1) { // Starting right drift @@ -4666,6 +4667,8 @@ static void K_KartDrift(player_t *player, boolean onground) player->kartstuff[k_driftend] = 0; } + + // Incease/decrease the drift value to continue drifting in that direction if (player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_jmp] == 1 && onground && player->kartstuff[k_drift] != 0) { @@ -4694,6 +4697,12 @@ static void K_KartDrift(player_t *player, boolean onground) driftadditive -= abs(player->cmd.driftturn)/75; } + // Disable drift-sparks until you're going fast enough + if (player->kartstuff[k_getsparks] == 0) + driftadditive = 0; + if (player->speed > minspeed*2) + player->kartstuff[k_getsparks] = 1; + // This spawns the drift sparks if (player->kartstuff[k_driftcharge] + driftadditive >= dsone) K_SpawnDriftSparks(player); @@ -4713,11 +4722,11 @@ static void K_KartDrift(player_t *player, boolean onground) } // Stop drifting - if (player->kartstuff[k_spinouttimer] > 0 // banana peel - || player->speed < FixedMul(10<<16, player->mo->scale)) // you're too slow! + if (player->kartstuff[k_spinouttimer] > 0 || player->speed < minspeed) { player->kartstuff[k_drift] = player->kartstuff[k_driftcharge] = 0; player->kartstuff[k_aizdriftstrat] = player->kartstuff[k_brakedrift] = 0; + player->kartstuff[k_getsparks] = 0; } if ((!player->kartstuff[k_sneakertimer])