change speelines blending condition

uuuhh, so, if you have sneakerboost they always will apply additive blending
otherwise if you go really fast (faster than sneakerboost)
This commit is contained in:
Alug committed 2025-03-10 13:05:55 +01:00
1 parent a686b29a7a
commit 6932a52463
1 file changed
+22 -3
+22 -3
View File
@@ -5397,6 +5397,25 @@ void K_KartPlayerHUDUpdate(player_t *player)
player->kartstuff[k_cardanimation] = 0;
}
static boolean K_SpeedLinesShouldBlend(player_t *player)
{
fixed_t percentspeed = 0;
if (!player->mo)
return false;
if (player->kartstuff[k_sneakertimer])
return true;
// this is how the percentage speedometer calcs, i suck at maths so this was the easiest thing to fo lmao
percentspeed = (FixedDiv(player->speed, FixedMul(K_GetKartSpeed(player, false), ORIG_FRICTION))*100)>>FRACBITS;
if (percentspeed > 127) // sneaker boost is around 25%
return true;
return false;
}
typedef INT32 (*randomFunc)(INT32 min, INT32 max);
static inline void K_SpawnNormalSpeedLines(player_t *player, boolean synched)
@@ -5418,7 +5437,7 @@ static inline void K_SpawnNormalSpeedLines(player_t *player, boolean synched)
if (cv_coloredspeedlines.value)
{
const boolean goodSpeed = (player->speed >= (3*K_GetKartSpeed(player, false))/4);
const boolean colorSpeed = (player->speed >= (3*K_GetKartSpeed(player, false))/4);
if (player->kartstuff[k_eggmanexplode])
{
@@ -5431,7 +5450,7 @@ static inline void K_SpawnNormalSpeedLines(player_t *player, boolean synched)
fast->color = player->mo->color;
fast->colorized = true;
}
else if (goodSpeed)
else if (colorSpeed)
{
UINT8 driftcolor = SKINCOLOR_NONE;
@@ -5450,7 +5469,7 @@ static inline void K_SpawnNormalSpeedLines(player_t *player, boolean synched)
fast->frame |= FF_ADD;
}
if (goodSpeed && ((player->kartstuff[k_growshrinktimer] > 0) || player->kartstuff[k_invincibilitytimer] || player->kartstuff[k_sneakertimer]))
if (colorSpeed && K_SpeedLinesShouldBlend(player))
fast->blendmode = AST_ADD;
}
}