25 static float health_damagetime, armor_damagetime;
26 static int health_beforedamage, armor_beforedamage;
28 static int old_p_health, old_p_armor;
29 static float old_p_healthtime, old_p_armortime;
31 int health, armor, fuel, air_time, p_health, p_armor;
57 health_beforedamage = 0;
58 armor_beforedamage = 0;
59 health_damagetime = 0;
71 health_damagetime = 0;
84 #define HEALTHARMOR_GFX_SMOOTH(stat) \
85 if (fabs(prev_##stat - stat) >= autocvar_hud_panel_healtharmor_progressbar_gfx_smooth) \
87 if (time - old_p_##stat##time < 1) \
88 old_p_##stat = prev_p_##stat; \
90 old_p_##stat = prev_##stat; \
91 old_p_##stat##time = time; \
93 if (time - old_p_##stat##time < 1) \
95 p_##stat += (old_p_##stat - stat) * (1 - (time - old_p_##stat##time)); \
96 prev_p_##stat = p_##stat; \
100 #undef HEALTHARMOR_GFX_SMOOTH
104 #define HEALTHARMOR_GFX_DAMAGE(stat) \
105 if (prev_##stat - stat >= autocvar_hud_panel_healtharmor_progressbar_gfx_damage) \
107 if (time - stat##_damagetime >= 1) \
108 stat##_beforedamage = prev_##stat; \
109 stat##_damagetime = time; \
113 #undef HEALTHARMOR_GFX_DAMAGE
128 p_armor = armor = 75;
152 if (!
STAT(AIR_FINISHED))
164 air_alpha =
bound(0, start_alpha + (1 - start_alpha) * (1 - f), 1);
173 float f = (100 - fuel) / 50;
174 fuel_alpha =
bound(0, start_alpha + (1 - start_alpha) * f, 1);
185 float hp =
floor(v.x + 1);
187 float maxtotal = maxhealth + maxarmor;
191 biggercount =
"health";
199 biggercount =
"armor";
206 DrawNumIcon(pos, mySize, hp, biggercount,
false,
false, iconalign,
HUD_Get_Num_Color(hp, maxtotal,
true), 1);
215 float panel_ar = mySize.x / mySize.y;
216 bool is_vertical = panel_ar < 1;
217 vector health_offset =
'0 0 0', armor_offset =
'0 0 0';
218 if (panel_ar >= 4 || (panel_ar >= 1/4 && panel_ar < 1))
222 health_offset.x = mySize.x;
224 armor_offset.x = mySize.x;
230 health_offset.y = mySize.y;
232 armor_offset.y = mySize.y;
235 bool health_baralign, armor_baralign, fuel_baralign, air_align;
236 bool health_iconalign, armor_iconalign;
241 air_align = fuel_baralign = health_baralign;
249 air_align = fuel_baralign = armor_baralign;
258 float pain_health_alpha = 1;
262 &&
time - health_damagetime < 1)
264 float health_damagealpha = 1 - (
time - health_damagetime) * (
time - health_damagetime);
268 pain_health_alpha =
blink(0.85, 0.15, 9);
273 DrawNumIcon(pos + health_offset, mySize,
health,
"health", is_vertical,
false, health_iconalign,
HUD_Get_Num_Color(
health, maxhealth,
true), 1);
283 &&
time - armor_damagetime < 1)
285 float armor_damagealpha = 1 - (
time - armor_damagetime) * (
time - armor_damagetime);
293 DrawNumIcon(pos + armor_offset, mySize, armor,
"armor", is_vertical,
false, armor_iconalign,
HUD_Get_Num_Color(armor, maxarmor,
true), 1);
296 vector cell_size = mySize;
297 if (fuel || air_time)
305 else if (panel_ar < 1/4)
311 if (panel_ar > 1 && panel_ar < 4)
312 pos.y += cell_size.y;
313 else if (panel_ar > 1/4 && panel_ar <= 1)
314 pos.x += cell_size.x;
316 pos.x += cell_size.x - mySize.x;
318 pos.y += cell_size.y - mySize.y;
int spectatee_status
the -1 disables HUD panels before CSQC receives necessary data
void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag)
void DrawNumIcon(vector myPos, vector mySize, float theTime, string icon, bool vertical, bool isInfinite, int icon_right_align, vector color, float theAlpha)