mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
- 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:
parent
61badfd694
commit
1a94e169ff
1 changed files with 8 additions and 37 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue