67 while((s =
fgets(fh)))
74 if(
argv(0) ==
"SIZE_CURSOR")
76 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)
151 if (color.x == 0) color.x = f;
152 if (color.y == 0) color.y = f;
153 if (color.z == 0) color.z = f;
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) / 2), item_count);
176 float ratio, best_ratio = 0;
177 float best_columns = 1, best_rows = 1;
178 bool vertical = (psize.x / psize.y >= item_aspect);
181 psize =
eX * psize.y +
eY * psize.x;
182 item_aspect = 1 / item_aspect;
186 columns =
ceil(item_count/rows);
189 ratio = (psize.x/columns) / (psize.y/rows);
190 if(ratio > item_aspect)
191 ratio = item_aspect * item_aspect / ratio;
193 if(ratio <= best_ratio)
196 best_columns = columns;
204 rows =
ceil(item_count/columns);
207 return (vertical) ?
vec2(best_rows, best_columns) :
vec2(best_columns, best_rows);
231 if (
panel.current_panel_bg !=
"0")
272 TC(
bool, vertical);
TC(
int, drawflag);
273 if(!length_ratio || !theAlpha)
279 if(length_ratio < -1)
282 else if(length_ratio < 0)
293 pic =
"gfx/hud/default/progressbar_vertical";
297 theOrigin.y += (1 - length_ratio) * theSize.y;
298 else if (baralign == 2)
299 theOrigin.y += 0.5 * (1 - length_ratio) * theSize.y;
300 else if (baralign == 3)
303 if (length_ratio > 0)
304 theOrigin.y += theSize.y;
307 theOrigin.y += (1 + length_ratio) * theSize.y;
308 length_ratio = -length_ratio;
311 theSize.y *= length_ratio;
314 width =
eX * theSize.x;
315 height =
eY * theSize.y;
316 if(theSize.y <= theSize.x * 2)
320 square =
eY * theSize.y * 0.5;
321 bH =
eY * (0.25 * theSize.y / (theSize.x * 2));
322 drawsubpic(theOrigin, square + width, pic,
'0 0 0',
eX + bH, theColor, theAlpha, drawflag);
323 drawsubpic(theOrigin + square, square + width, pic,
eY - bH,
eX + bH, theColor, theAlpha, drawflag);
327 square =
eY * theSize.x;
328 drawsubpic(theOrigin, width + square, pic,
'0 0 0',
'1 0.25 0', theColor, theAlpha, drawflag);
329 drawsubpic(theOrigin + square, theSize - 2 * square, pic,
'0 0.25 0',
'1 0.5 0', theColor, theAlpha, drawflag);
330 drawsubpic(theOrigin + height - square, width + square, pic,
'0 0.75 0',
'1 0.25 0', theColor, theAlpha, drawflag);
335 pic =
"gfx/hud/default/progressbar";
339 theOrigin.x += (1 - length_ratio) * theSize.x;
340 else if (baralign == 2)
341 theOrigin.x += 0.5 * (1 - length_ratio) * theSize.x;
342 else if (baralign == 3)
345 if (length_ratio > 0)
346 theOrigin.x += theSize.x;
349 theOrigin.x += (1 + length_ratio) * theSize.x;
350 length_ratio = -length_ratio;
353 theSize.x *= length_ratio;
356 width =
eX * theSize.x;
357 height =
eY * theSize.y;
358 if(theSize.x <= theSize.y * 2)
362 square =
eX * theSize.x * 0.5;
363 bW =
eX * (0.25 * theSize.x / (theSize.y * 2));
364 drawsubpic(theOrigin, square + height, pic,
'0 0 0',
eY + bW, theColor, theAlpha, drawflag);
365 drawsubpic(theOrigin + square, square + height, pic,
eX - bW,
eY + bW, theColor, theAlpha, drawflag);
369 square =
eX * theSize.y;
370 drawsubpic(theOrigin, height + square, pic,
'0 0 0',
'0.25 1 0', theColor, theAlpha, drawflag);
371 drawsubpic(theOrigin + square, theSize - 2 * square, pic,
'0.25 0 0',
'0.5 1 0', theColor, theAlpha, drawflag);
372 drawsubpic(theOrigin + width - square, height + square, pic,
'0.75 0 0',
'0.25 1 0', theColor, theAlpha, drawflag);
389 pic =
"gfx/hud/default/num_leading";
392 drawsubpic(pos,
eX *
min(mySize.x * 0.5, mySize.y) +
eY * mySize.y, pic,
'0 0 0',
'0.25 1 0', color, theAlpha, drawflag);
393 if(mySize.x/mySize.y > 2)
394 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);
395 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);
400 TC(
bool, vertical);
TC(
int, icon_right_align);
401 vector newPos =
'0 0 0', newSize =
'0 0 0';
403 string text = isInfinite ?
"\xE2\x88\x9E" :
ftos(theTime);
407 if(mySize.y/mySize.x > 2)
409 newSize.y = 2 * mySize.x;
410 newSize.x = mySize.x;
412 newPos.y = myPos.y + (mySize.y - newSize.y) / 2;
417 newSize.x = 1/2 * mySize.y;
418 newSize.y = mySize.y;
420 newPos.x = myPos.x + (mySize.x - newSize.x) / 2;
427 picpos = newPos +
eY * newSize.x;
432 numpos = newPos +
eY * newSize.x;
439 numpos.y += newSize.y * ((1 - 0.7) / 2);
445 if(mySize.x/mySize.y > 3)
447 newSize.x = 3 * mySize.y;
448 newSize.y = mySize.y;
450 newPos.x = myPos.x + (mySize.x - newSize.x) / 2;
455 newSize.y = 1/3 * mySize.x;
456 newSize.x = mySize.x;
458 newPos.y = myPos.y + (mySize.y - newSize.y) / 2;
465 picpos = newPos +
eX * 2 * newSize.y;
469 numpos = newPos +
eX * newSize.y;
481 TC(
bool, vertical);
TC(
int, icon_right_align);
482 DrawNumIcon_expanding(myPos, mySize, theTime, icon, vertical, isInfinite, icon_right_align, color, theAlpha, 0);
498 if(
hud == HUD_BUMBLEBEE_GUN)
499 CSQC_BUMBLE_GUN_HUD();
505 if(
hud != HUD_NORMAL &&
lasthud == HUD_NORMAL)
524 bool draw_allowed =
false;
581 int i =
floor(elapsed_time);
585 float f = elapsed_time - i;
610 if (
fabs(ofs.x) < 0.001) ofs.x = 0;
611 if (
fabs(ofs.y) < 0.001) ofs.y = 0;
612 if (
fabs(ofs.z) < 0.001) ofs.z = 0;
613 ofs.x =
bound(-0.1, ofs.x, 0.1);
614 ofs.y =
bound(-0.1, ofs.y, 0.1);
615 ofs.z =
bound(-0.1, ofs.z, 0.1);
627 static float old_health = 0;
636 float new_hud_dynamic_shake_factor = 0;
643 if(new_hud_dynamic_shake_factor >= 1)
644 new_hud_dynamic_shake_factor = 1;
723 if((
teamplay) && hud_dock_color_team) {
725 color =
'1 0 0' * hud_dock_color_team;
730 color =
'1 0 0' * hud_dock_color_team;
735 if(hud_dock_color ==
"shirt") {
739 else if(hud_dock_color ==
"pants") {
744 color =
stov(hud_dock_color);
752 pic =
"gfx/hud/default/dock_medium";
764 bool warning =
false;
786 LOG_TRACE(
"Automatically fixed wrong/missing panel numbers in _hud_panelorder");
void HUD_Configure_Frame()
float autocvar_hud_dynamic_follow_scale
string panel_bg_alpha_str
bool hud_panel_radar_maximized
string panel_bg_color_team_str
void HUD_Panel_Draw(entity panent)
float panel_bg_color_team
void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag)
void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag)
void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag)
const int PANEL_SHOW_WITH_SB
ERASEABLE float blink(float base, float range, float freq)
#define HUD_Panel_GetBg()
entity CSQCModel_server2csqc(int i)
float HUD_GetRowCount(int item_count, vector size, float item_aspect)
vector autocvar_hud_dynamic_follow_scale_xyz
float autocvar_hud_dynamic_shake_damage_min
bool HUD_MinigameMenu_IsOpened()
bool autocvar__hud_configure
string panel_bg_border_str
vector hud_dynamic_shake_realofs
bool autocvar_hud_dock_color_team
#define REGISTRY_GET(id, i)
int panel_order[REGISTRY_MAX(hud_panels)]
float hud_dynamic_shake_factor
float autocvar_hud_dock_alpha
void draw_cursor_normal(vector pos, vector col, float a)
vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect)
void DrawNumIcon(vector myPos, vector mySize, float theTime, string icon, bool vertical, bool isInfinite, int icon_right_align, vector color, float theAlpha)
const int PANEL_CONFIG_MAIN
float hud_dynamic_shake_x[10]
#define HUD_Panel_GetPadding()
#define HUD_Panel_GetColorTeam()
const int PANEL_SHOW_MINIGAME
#define HUD_Panel_GetFgAlpha()
float autocvar_hud_dynamic_shake_scale
bool HUD_WouldShowCursor()
float autocvar_hud_dynamic_follow
#define REGISTRY_COUNT(id)
bool HUD_Radar_Clickable()
void LoadMenuSkinValues()
float autocvar__menu_alpha
void calc_followmodel_ofs(entity view)
#define HUD_Panel_GetBgAlpha()
#define drawpic_aspect_skin(pos, pic, sz, color, theAlpha, drawflag)
vector HUD_Shift(vector v)
void drawstring_aspect_expanding(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag, float fadelerp)
void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
vector HUD_GetFontsize(string cvarname)
string panel_bg_color_str
string panel_bg_padding_str
vector HUD_Scale(vector v)
float hud_dynamic_shake_y[10]
const int PANEL_SHOW_MAINGAME
const float DRAWFLAG_NORMAL
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)
#define Hud_Panel_GetPanelEnabled()
#define CASE_COLOR_BETWEEN(min, max)
void HUD_Configure_PostDraw()
#define HUD_Panel_UpdatePosSize_ForMenu()
float autocvar_hud_dynamic_shake_damage_max
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const int PANEL_SHOW_MAPVOTE
bool autocvar__con_chat_maximized
vector cl_followmodel_ofs
bool QuickMenu_IsOpened()
#define HUD_Panel_GetColor()
float hud_dynamic_shake_time
float autocvar_cl_vehicles_notify_time
string hud_panelorder_prev
vector HUD_Get_Num_Color(float hp, float maxvalue, bool blink)
float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag)
bool autocvar_hud_configure_teamcolorforced
float hud_configure_menu_open
#define HUD_Panel_ScalePosSize()
#define HUD_Panel_GetBorder()
string autocvar_hud_dock_color
void draw_cursor(vector pos, vector ofs, string img, vector col, float a)
string autocvar__hud_panelorder
float autocvar_hud_panel_update_interval
#define FOREACH(list, cond, body)
bool autocvar_hud_cursormode
#define colormapPaletteColor(c, isPants)
float scoreboard_fade_alpha
void HUD_Panel_LoadCvars()
float autocvar_hud_dynamic_shake