Skip to content

Commit

Permalink
fix speed colours for z and xyz vels
Browse files Browse the repository at this point in the history
  • Loading branch information
qawery-just-sad committed May 3, 2021
1 parent ad9fa0b commit 450a550
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions addons/sourcemod/scripting/surftimer/misc.sp
Original file line number Diff line number Diff line change
Expand Up @@ -4382,23 +4382,28 @@ public void CheckBonusStyleRanks(int client, int zGroup, int style)
public void GetSpeedColour(int client, int speed, int type)
{
int pos;
if (speed < 0)
{
speed = speed * -1;
}

if (g_fMaxVelocity == 10000.0)
{
if (type == 1 && g_SpeedMode[client] == 0) // green
if (type == 1) // green
{
pos = RoundToFloor(speed / 400.0);
if (pos > 24)
pos = 24;
Format(g_szSpeedColour[client], sizeof(g_szSpeedColour), g_sz10000mvGradient[pos]);
}
else if (type == 2 && g_SpeedMode[client] == 0) // rainbow
else if (type == 2) // rainbow
{
pos = RoundToFloor(speed / 476.0);
if (pos > 21)
pos = 21;
Format(g_szSpeedColour[client], sizeof(g_szSpeedColour), g_szRainbowGradient[pos]);
}
else if (type == 3 && g_SpeedMode[client] == 0) // gain/loss
else if (type == 3) // gain/loss
{
if (speed >= GetConVarInt(g_hMaxVelocity))
Format(g_szSpeedColour[client], sizeof(g_szSpeedColour), "#b8b");
Expand All @@ -4414,22 +4419,22 @@ public void GetSpeedColour(int client, int speed, int type)
}
else
{
if (type == 1 && g_SpeedMode[client] == 0) // green
if (type == 1) // green
{
pos = RoundToFloor(speed / 100.0);
if (pos > 34)
pos = 34;
Format(g_szSpeedColour[client], sizeof(g_szSpeedColour), g_sz3500mvGradient[pos]);
}
else if (type == 2 && g_SpeedMode[client] == 0) // rainbow
else if (type == 2) // rainbow
{
pos = RoundToFloor(speed / 166.0);
if (pos > 21)
pos = 21;

Format(g_szSpeedColour[client], sizeof(g_szSpeedColour), g_szRainbowGradient[pos]);
}
else if (type == 3 && g_SpeedMode[client] == 0) // gain/loss
else if (type == 3) // gain/loss
{
if (speed >= GetConVarInt(g_hMaxVelocity))
Format(g_szSpeedColour[client], sizeof(g_szSpeedColour), "#b8b");
Expand Down

0 comments on commit 450a550

Please sign in to comment.