- changed colors for crosshair health display to keep this in line with other health indicators on the HUD.

Use green for 100% health, not 200% and move toward blue for higher health.
This commit is contained in:
Christoph Oelckers 2019-08-18 19:28:40 +02:00
parent 61badfd694
commit 1a94e169ff
1 changed files with 8 additions and 37 deletions

View File

@ -1112,45 +1112,16 @@ void DBaseStatusBar::DrawCrosshair ()
} }
else if (crosshairhealth == 2) else if (crosshairhealth == 2)
{ {
// "Enhanced" crosshair health (green-white-yellow-red) // "Enhanced" crosshair health (blue-green-yellow-red)
int health = Scale(CPlayer->health, 100, CPlayer->mo->GetDefault()->health); int health = clamp(Scale(CPlayer->health, 100, CPlayer->mo->GetDefault()->health), 0, 200);
int red, green, blue; float rr, gg, bb;
if (health < 0) float saturation = health < 150 ? 1.f : 1.f - (health - 150) / 100.f;
{
health = 0;
}
if (health <= 25) HSVtoRGB(&rr, &gg, &bb, health * 1.2f, saturation, 1);
{ int red = int(rr * 255);
red = 255; int green = int(gg * 255);
green = 0; int blue = int(bb * 255);
blue = 0;
}
else if (health <= 65)
{
red = 255;
green = 255 * ((health - 25) / 40.0);
blue = 0;
}
else if (health <= 100)
{
red = 255;
green = 255;
blue = 255 * ((health - 65) / 35.0);
}
else if (health < 200)
{
red = 255 - 255 * ((health - 100) / 100.0);
green = 255;
blue = 255 - 255 * ((health - 100) / 100.0);
}
else
{
red = 0;
green = 255;
blue = 0;
}
color = (red<<16) | (green<<8) | blue; color = (red<<16) | (green<<8) | blue;
} }