FTE/CLIENT: Tweak HUD health display to account for Juggernog

This commit is contained in:
cypress 2023-07-18 12:23:14 -04:00
parent b4f8a15cc3
commit b691428e3c
3 changed files with 8 additions and 3 deletions

View file

@ -49,14 +49,17 @@ string(string img) getImage = {
void(float width, float height) HUD_Health =
{
local float health;
float health;
float max_health;
float alpha;
health = getstatf(STAT_HEALTH);
max_health = getstatf(STAT_MAXHEALTH);
if (health < 100)
if (health < max_health)
{
alpha = (100.0 - ((1.25 * health) - 25))/100*255;
alpha = 255 - ((health/max_health))*255;
if (alpha <= 0.0)
return;
float modifier = (sin(time * 10) * 20) - 20;//always negative

View file

@ -320,6 +320,7 @@ void() worldspawn =
clientstat(STAT_PLAYERSTANCE, EV_FLOAT, stance);
clientstat(STAT_FACINGENEMY, EV_FLOAT, facingenemy);
clientstat(STAT_VIEWZOOM, EV_FLOAT, viewzoom);
clientstat(STAT_MAXHEALTH, EV_FLOAT, max_health);
#endif // FTE

View file

@ -220,6 +220,7 @@ const float EVENT_SONGPLAY = 41;
#define STAT_PLAYERNUM 64
#define STAT_PLAYERSTANCE 65
#define STAT_FACINGENEMY 66
#define STAT_MAXHEALTH 67
//
// invert float takes in float value between 0 and 1, inverts position