58 draw_currentSkin =
"gfx/menu/wickedx";
62 draw_currentSkin =
strzone(draw_currentSkin);
68 while ((s =
fgets(fh)))
75 if (
argv(0) ==
"SIZE_CURSOR")
77 else if (
argv(0) ==
"OFFSET_CURSOR")
125 const vector COLOR100 =
'0 1 0';
126 const vector COLOR75 =
'0.4 0.9 0';
127 const vector COLOR50 =
'1 1 1';
128 const vector COLOR25 =
'1 1 0.2';
129 const vector COLOR10 =
'1 0 0';
132 float hp_percent = hp / maxvalue * 100;
133 #define CASE_COLOR_BETWEEN(min, max) \
134 if (hp_percent > min) \
135 color = COLOR##min + (COLOR##max - COLOR##min) * ((hp_percent - min) / (max - min))
137 if (hp_percent > 100)
color = COLOR100;
142 else color = COLOR10;
144 #undef CASE_COLOR_BETWEEN
148 if (hp_percent >= 100)
155 else if (hp_percent < 25)
157 float f = (1 - hp_percent / 25) *
sin(2*
M_PI *
time);
168 float aspect = size_y / size_x;
169 return bound(1,
floor((
sqrt(4 * item_aspect * aspect * item_count + aspect * aspect) + aspect + 0.5) * 0.5), item_count);
175 bool vertical = psize.x / psize.y >= item_aspect;
178 psize =
eX * psize.y +
eY * psize.x;
179 item_aspect = 1 / item_aspect;
182 float rows =
ceil(
sqrt(item_count));
183 float columns =
ceil(item_count / rows);
184 float ratio, best_ratio = 0;
185 float best_columns = 1, best_rows = 1;
188 ratio = (psize.x / columns) / (psize.y / rows);
189 if (ratio > item_aspect)
190 ratio = item_aspect * item_aspect / ratio;
192 if (ratio <= best_ratio)
195 best_columns = columns;
203 rows =
ceil(item_count/columns);
206 return vertical ?
vec2(best_rows, best_columns) :
vec2(best_columns, best_rows);
230 if (
panel.current_panel_bg !=
"0")
271 TC(
bool, vertical);
TC(
int, drawflag);
272 if (!length_ratio || !theAlpha)
274 if (length_ratio > 1)
278 if (length_ratio < -1)
281 else if (length_ratio < 0)
292 pic =
"gfx/hud/default/progressbar_vertical";
295 theOrigin.y += (1 - length_ratio) * theSize.y;
296 else if (baralign == 2)
297 theOrigin.y += 0.5 * (1 - length_ratio) * theSize.y;
298 else if (baralign == 3)
301 if (length_ratio > 0)
302 theOrigin.y += theSize.y;
305 theOrigin.y += (1 + length_ratio) * theSize.y;
306 length_ratio = -length_ratio;
309 theSize.y *= length_ratio;
311 width =
eX * theSize.x;
313 if (theSize.y <= theSize.x * 2)
317 square =
eY * theSize.y * 0.5;
318 vector bH =
eY * (0.25 * theSize.y / (theSize.x * 2));
319 drawsubpic(theOrigin, square + width, pic,
'0 0 0',
eX + bH, theColor, theAlpha, drawflag);
320 drawsubpic(theOrigin + square, square + width, pic,
eY - bH,
eX + bH, theColor, theAlpha, drawflag);
324 square =
eY * theSize.x;
325 drawsubpic(theOrigin, width + square, pic,
'0 0 0',
'1 0.25 0', theColor, theAlpha, drawflag);
326 drawsubpic(theOrigin + square, theSize - 2 * square, pic,
'0 0.25 0',
'1 0.5 0', theColor, theAlpha, drawflag);
327 drawsubpic(theOrigin +
height - square, width + square, pic,
'0 0.75 0',
'1 0.25 0', theColor, theAlpha, drawflag);
334 pic =
"gfx/hud/default/progressbar";
337 theOrigin.x += (1 - length_ratio) * theSize.x;
338 else if (baralign == 2)
339 theOrigin.x += 0.5 * (1 - length_ratio) * theSize.x;
340 else if (baralign == 3)
343 if (length_ratio > 0)
344 theOrigin.x += theSize.x;
347 theOrigin.x += (1 + length_ratio) * theSize.x;
348 length_ratio = -length_ratio;
351 theSize.x *= length_ratio;
353 width =
eX * theSize.x;
355 if (theSize.x <= theSize.y * 2)
359 square =
eX * theSize.x * 0.5;
360 vector bW =
eX * (0.25 * theSize.x / (theSize.y * 2));
361 drawsubpic(theOrigin, square +
height, pic,
'0 0 0',
eY + bW, theColor, theAlpha, drawflag);
362 drawsubpic(theOrigin + square, square +
height, pic,
eX - bW,
eY + bW, theColor, theAlpha, drawflag);
366 square =
eX * theSize.y;
367 drawsubpic(theOrigin,
height + square, pic,
'0 0 0',
'0.25 1 0', theColor, theAlpha, drawflag);
368 drawsubpic(theOrigin + square, theSize - 2 * square, pic,
'0.25 0 0',
'0.5 1 0', theColor, theAlpha, drawflag);
369 drawsubpic(theOrigin + width - square,
height + square, pic,
'0.75 0 0',
'0.25 1 0', theColor, theAlpha, drawflag);
385 pic =
"gfx/hud/default/num_leading";
387 drawsubpic(pos,
eX *
min(mySize.x * 0.5, mySize.y) +
eY * mySize.y, pic,
'0 0 0',
'0.25 1 0',
color, theAlpha, drawflag);
388 if (mySize.x / mySize.y > 2)
389 drawsubpic(pos +
eX * mySize.y,
eX * (mySize.x - 2 * mySize.y) +
eY * mySize.y, pic,
'0.25 0 0',
'0.5 1 0',
color, theAlpha, drawflag);
390 drawsubpic(pos +
eX * mySize.x -
eX *
min(mySize.x * 0.5, mySize.y),
eX *
min(mySize.x * 0.5, mySize.y) +
eY * mySize.y, pic,
'0.75 0 0',
'0.25 1 0',
color, theAlpha, drawflag);
395 TC(
bool, vertical);
TC(
int, icon_right_align);
396 vector newPos =
'0 0 0', newSize =
'0 0 0';
398 string text = isInfinite ?
"\xE2\x88\x9E" :
ftos(theTime);
402 if (mySize.y / mySize.x > 2)
404 newSize.y = 2 * mySize.x;
405 newSize.x = mySize.x;
407 newPos.y = myPos.y + (mySize.y - newSize.y) * 0.5;
412 newSize.x = 1/2 * mySize.y;
413 newSize.y = mySize.y;
415 newPos.x = myPos.x + (mySize.x - newSize.x) * 0.5;
419 if (icon_right_align)
422 picpos = newPos +
eY * newSize.x;
427 numpos = newPos +
eY * newSize.x;
434 numpos.y += newSize.y * ((1 - 0.7) / 2);
440 if (mySize.x / mySize.y > 3)
442 newSize.x = 3 * mySize.y;
443 newSize.y = mySize.y;
445 newPos.x = myPos.x + (mySize.x - newSize.x) * 0.5;
450 newSize.y = 1/3 * mySize.x;
451 newSize.x = mySize.x;
453 newPos.y = myPos.y + (mySize.y - newSize.y) * 0.5;
457 if (icon_right_align)
460 picpos = newPos +
eX * 2 * newSize.y;
464 numpos = newPos +
eX * newSize.y;
476 TC(
bool, vertical);
TC(
int, icon_right_align);
520 bool draw_allowed =
false;
575 int i =
floor(elapsed_time);
579 float f = elapsed_time - i;
604 if (
fabs(ofs.x) < 0.001) ofs.x = 0;
605 if (
fabs(ofs.y) < 0.001) ofs.y = 0;
606 if (
fabs(ofs.z) < 0.001) ofs.z = 0;
607 ofs.x =
bound(-0.1, ofs.x, 0.1);
608 ofs.y =
bound(-0.1, ofs.y, 0.1);
609 ofs.z =
bound(-0.1, ofs.z, 0.1);
621 static float old_health = 0;
630 float new_hud_dynamic_shake_factor = 0;
637 if (new_hud_dynamic_shake_factor >= 1)
638 new_hud_dynamic_shake_factor = 1;
713 if (
teamplay && hud_dock_color_team)
716 color =
'1 0 0' * hud_dock_color_team;
721 color =
'1 0 0' * hud_dock_color_team;
726 if (hud_dock_color ==
"shirt")
731 else if (hud_dock_color ==
"pants")
745 pic =
"gfx/hud/default/dock_medium";
780 LOG_TRACE(
"Automatically fixed wrong/missing panel numbers in _hud_panelorder");
void CSQC_BUMBLE_GUN_HUD()
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
bool HUD_MinigameMenu_IsOpened()
float autocvar_cl_vehicles_notify_time
virtual void vr_hud()
(CLIENT) logic to run every frame
void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag)
void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
void drawstring_aspect_expanding(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag, float fadelerp)
#define drawpic_aspect_skin(pos, pic, sz, color, theAlpha, drawflag)
#define drawpic(position, pic, size, rgb, alpha, flag)
bool autocvar__con_chat_maximized
#define colormapPaletteColor(c, isPants)
ERASEABLE float blink(float base, float range, float freq)
const int HUD_BUMBLEBEE_GUN
float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag)
const float DRAWFLAG_NORMAL
entity CSQCModel_server2csqc(int i)
int entcs_GetClientColors(int i)
float autocvar_hud_dynamic_shake_damage_max
float autocvar_hud_dynamic_shake
void draw_cursor_normal(vector pos, vector col, float a)
void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag)
void HUD_Panel_Draw(entity panent)
void HUD_Panel_LoadCvars()
vector HUD_Shift(vector v)
float hud_dynamic_shake_x[10]
void LoadMenuSkinValues()
void DrawNumIcon(vector myPos, vector mySize, float theTime, string icon, bool vertical, bool isInfinite, int icon_right_align, vector color, float theAlpha)
void draw_cursor(vector pos, vector ofs, string img, vector col, float a)
bool HUD_WouldShowCursor()
vector HUD_GetFontsize(string cvarname)
float HUD_GetRowCount(int item_count, vector size, float item_aspect)
float autocvar_hud_dynamic_shake_scale
vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect)
float autocvar_hud_dynamic_shake_damage_min
vector HUD_Scale(vector v)
#define CASE_COLOR_BETWEEN(min, max)
float hud_dynamic_shake_y[10]
vector HUD_Get_Num_Color(float hp, float maxvalue, bool blink)
void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag)
void DrawNumIcon_expanding(vector myPos, vector mySize, float theTime, string icon, bool vertical, bool isInfinite, int icon_right_align, vector color, float theAlpha, float fadelerp)
string panel_bg_color_team_str
float hud_dynamic_shake_time
float autocvar_hud_dock_alpha
string panel_bg_border_str
string autocvar__hud_panelorder
float autocvar__menu_alpha
float hud_dynamic_shake_factor
#define HUD_Panel_GetBg()
string panel_bg_alpha_str
vector hud_dynamic_shake_realofs
vector autocvar_hud_dynamic_follow_scale_xyz
bool hud_panel_radar_maximized
#define HUD_Panel_GetPadding()
int panel_order[REGISTRY_MAX(hud_panels)]
float autocvar_hud_dynamic_follow
float panel_bg_color_team
string panel_bg_color_str
bool autocvar_hud_dock_color_team
string hud_panelorder_prev
#define HUD_Panel_GetColor()
const int PANEL_SHOW_MAPVOTE
const int PANEL_SHOW_MINIGAME
bool QuickMenu_IsOpened()
const int PANEL_SHOW_MAINGAME
string autocvar_hud_dock_color
float autocvar_hud_panel_update_interval
#define HUD_Panel_GetColorTeam()
bool autocvar_hud_cursormode
#define Hud_Panel_GetPanelEnabled()
vector cl_followmodel_ofs
const int PANEL_SHOW_WITH_SB
#define HUD_Panel_GetFgAlpha()
#define HUD_Panel_UpdatePosSize_ForMenu()
#define HUD_Panel_ScalePosSize()
string panel_bg_padding_str
const int PANEL_CONFIG_MAIN
float autocvar_hud_dynamic_follow_scale
#define HUD_Panel_GetBorder()
#define HUD_Panel_GetBgAlpha()
bool HUD_Radar_Clickable()
void HUD_Configure_PostDraw()
void HUD_Configure_Frame()
bool autocvar_hud_configure_teamcolorforced
bool autocvar__hud_configure
float hud_configure_menu_open
#define FOREACH(list, cond, body)
noref float vid_conheight
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define REGISTRY_COUNT(id)
#define REGISTRY_GET(id, i)
float health
Legacy fields for the resources. To be removed.
float scoreboard_fade_alpha
void calc_followmodel_ofs(entity view)