From 1a94e169ff519123809b73181dee4d99b6407d58 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 18 Aug 2019 19:28:40 +0200 Subject: [PATCH] - 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. --- src/g_statusbar/shared_sbar.cpp | 45 ++++++--------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index f15a495ff..dc836d032 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -1112,45 +1112,16 @@ void DBaseStatusBar::DrawCrosshair () } else if (crosshairhealth == 2) { - // "Enhanced" crosshair health (green-white-yellow-red) - int health = Scale(CPlayer->health, 100, CPlayer->mo->GetDefault()->health); - int red, green, blue; + // "Enhanced" crosshair health (blue-green-yellow-red) + int health = clamp(Scale(CPlayer->health, 100, CPlayer->mo->GetDefault()->health), 0, 200); + float rr, gg, bb; - if (health < 0) - { - health = 0; - } + float saturation = health < 150 ? 1.f : 1.f - (health - 150) / 100.f; - if (health <= 25) - { - red = 255; - green = 0; - 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; - } + HSVtoRGB(&rr, &gg, &bb, health * 1.2f, saturation, 1); + int red = int(rr * 255); + int green = int(gg * 255); + int blue = int(bb * 255); color = (red<<16) | (green<<8) | blue; }