2a53444669b7829c9818ca342ae8bf6484f0fafa
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / hud.qh
1 #pragma once
2
3 #include <common/weapons/all.qh>
4
5 bool HUD_Radar_Clickable();
6 void HUD_Radar_Mouse();
7
8 REGISTRY(hud_panels, BITS(6))
9 #define hud_panels_from(i) _hud_panels_from(i, NULL)
10 REGISTER_REGISTRY(hud_panels)
11
12 #define REGISTER_HUD_PANEL(id, draw_func, name, configflags, showflags) \
13         void draw_func(); \
14         REGISTER(hud_panels, HUD_PANEL, id, m_id, new_pure(hud_panel)) { \
15                 this.panel_id = this.m_id; \
16                 this.panel_draw = draw_func; \
17                 this.panel_name = #name; \
18                 this.panel_configflags = configflags; \
19                 this.panel_showflags = showflags; \
20         }
21
22 #define HUD_PANEL(NAME) HUD_PANEL_##NAME
23
24 // draw the background/borders
25 #define HUD_Panel_DrawBg(theAlpha) MACRO_BEGIN { \
26         if(panel.current_panel_bg != "0" && panel.current_panel_bg != "") \
27                 draw_BorderPicture( \
28                         HUD_Shift(panel_pos - '1 1 0' * panel_bg_border), \
29                         panel.current_panel_bg, \
30                         HUD_Scale(panel_size + '1 1 0' * 2 * panel_bg_border), \
31                         panel_bg_color, \
32                         panel_bg_alpha * theAlpha, \
33                         HUD_Scale('1 1 0' * (panel_bg_border/BORDER_MULTIPLIER)) \
34                 ); \
35 } MACRO_END
36
37 int panel_order[hud_panels_MAX];
38 string hud_panelorder_prev;
39
40 bool hud_draw_maximized;
41 bool hud_panel_radar_maximized;
42 bool hud_panel_radar_mouse;
43 float hud_panel_radar_bottom;
44 bool hud_panel_radar_temp_hidden;
45 bool chat_panel_modified;
46 bool radar_panel_modified;
47
48 float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary);
49 void HUD_Radar_Hide_Maximized();
50
51 float HUD_GetRowCount(int item_count, vector size, float item_aspect);
52 vector HUD_Get_Num_Color (float x, float maxvalue);
53 void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha);
54 void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp);
55 void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag);
56 vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect);
57
58 void HUD_Reset ();
59 void HUD_Main ();
60
61 int race_CheckName(string net_name);
62 string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname);
63
64 int vote_yescount;
65 int vote_nocount;
66 int vote_needed;
67 int vote_highlighted; // currently selected vote
68
69 int vote_active; // is there an active vote?
70 int vote_prev; // previous state of vote_active to check for a change
71 float vote_alpha;
72 float vote_change; // "time" when vote_active changed
73
74 float hud_panel_quickmenu;
75
76 vector mousepos;
77 vector panel_click_distance; // mouse cursor distance from the top left corner of the panel (saved only upon a click)
78 vector panel_click_resizeorigin; // coordinates for opposite point when resizing
79 float resizeCorner; // 1 = topleft, 2 = topright, 3 = bottomleft, 4 = bottomright
80 entity highlightedPanel;
81 float highlightedAction; // 0 = nothing, 1 = move, 2 = resize
82
83 const float BORDER_MULTIPLIER = 0.25;
84 float scoreboard_bottom;
85 int weapon_accuracy[Weapons_MAX];
86
87 int complain_weapon;
88 float complain_weapon_type;
89 float complain_weapon_time;
90
91 int ps_primary, ps_secondary;
92 int ts_primary, ts_secondary;
93
94 Weapon last_switchweapon;
95 Weapon last_activeweapon;
96 float weapontime;
97 float weaponprevtime;
98
99 float teamnagger;
100
101 float hud_configure_checkcollisions;
102 float hud_configure_prev;
103 vector hud_configure_gridSize;
104 vector hud_configure_realGridSize;
105
106 int hudShiftState;
107 const int S_SHIFT = 1;
108 const int S_CTRL = 2;
109 const int S_ALT = 4;
110
111 float menu_enabled; // 1 showing the entire HUD, 2 showing only the clicked panel
112
113 float hud_fade_alpha;
114
115 string hud_skin_path;
116 string hud_skin_prev;
117
118 vector myteamcolors;
119
120 entity highlightedPanel_backup;
121 vector panel_pos_backup;
122 vector panel_size_backup;
123
124 vector panel_size_copied;
125
126 entity panel;
127 entityclass(HUDPanel);
128 class(HUDPanel) .string panel_name;
129 class(HUDPanel) .int panel_id;
130 class(HUDPanel) .vector current_panel_pos;
131 class(HUDPanel) .vector current_panel_size;
132 class(HUDPanel) .string current_panel_bg;
133 class(HUDPanel) .float current_panel_bg_alpha;
134 class(HUDPanel) .float current_panel_bg_border;
135 class(HUDPanel) .vector current_panel_bg_color;
136 class(HUDPanel) .float current_panel_bg_color_team;
137 class(HUDPanel) .float current_panel_bg_padding;
138 class(HUDPanel) .float current_panel_fg_alpha;
139 class(HUDPanel) .float update_time;
140 float panel_enabled;
141 vector panel_pos;
142 vector panel_size;
143 string panel_bg_str; // "_str" vars contain the raw value of the cvar, non-"_str" contains what hud.qc code should use
144 vector panel_bg_color;
145 string panel_bg_color_str;
146 float panel_bg_color_team;
147 string panel_bg_color_team_str;
148 float panel_fg_alpha;
149 float panel_bg_alpha;
150 string panel_bg_alpha_str;
151 float panel_bg_border;
152 string panel_bg_border_str;
153 float panel_bg_padding;
154 string panel_bg_padding_str;
155
156 class(HUDPanel) .void() panel_draw;
157
158 // chat panel can be reduced / moved while the mapvote is active
159 // let know the mapvote panel about chat pos and size
160 float chat_posy;
161 float chat_sizey;
162
163 float current_player;
164
165 float autocvar_hud_dynamic_follow;
166 float autocvar_hud_dynamic_follow_scale;
167 vector autocvar_hud_dynamic_follow_scale_xyz;
168
169 vector hud_dynamic_shake_realofs;
170 float hud_dynamic_shake_factor;
171 float hud_dynamic_shake_time;
172
173 // shared across viewmodel effects and dynamic hud code
174 vector cl_followmodel_ofs;
175 float cl_followmodel_time;
176
177 vector hud_scale;
178 vector hud_scale_current;
179 vector hud_shift;
180 vector hud_shift_current;
181 vector hud_scale_center;
182
183 float stringwidth_colors(string s, vector theSize);
184 float stringwidth_nocolors(string s, vector theSize);
185 void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag);
186
187 .int panel_showflags;
188 const int PANEL_SHOW_NEVER    = 0x00;
189 const int PANEL_SHOW_MAINGAME = 0x01;
190 const int PANEL_SHOW_MINIGAME = 0x02;
191 const int PANEL_SHOW_MAPVOTE  = 0x04;
192 const int PANEL_SHOW_ALWAYS   = 0xff;
193 bool HUD_Panel_CheckFlags(int showflags);
194
195 .int panel_configflags;
196 const int PANEL_CONFIG_NO    = 0x00;
197 const int PANEL_CONFIG_MAIN  = 0x01;
198
199
200 // prev_* vars contain the health/armor at the previous FRAME
201 // set to -1 when player is dead or was not playing
202 int prev_health, prev_armor;
203 float health_damagetime, armor_damagetime;
204 int health_beforedamage, armor_beforedamage;
205 // old_p_* vars keep track of previous values when smoothing value changes of the progressbar
206 int old_p_health, old_p_armor;
207 float old_p_healthtime, old_p_armortime;
208 // prev_p_* vars contain the health/armor progressbar value at the previous FRAME
209 // set to -1 to forcedly stop effects when we switch spectated player (e.g. from playerX: 70h to playerY: 50h)
210 int prev_p_health, prev_p_armor;
211
212 void HUD_ItemsTime();
213
214 REGISTER_HUD_PANEL(WEAPONS,         HUD_Weapons,        weapons,        PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
215 REGISTER_HUD_PANEL(AMMO,            HUD_Ammo,           ammo,           PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
216 REGISTER_HUD_PANEL(POWERUPS,        HUD_Powerups,       powerups,       PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
217 REGISTER_HUD_PANEL(HEALTHARMOR,     HUD_HealthArmor,    healtharmor,    PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
218 REGISTER_HUD_PANEL(NOTIFY,          HUD_Notify,         notify,         PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS & ~PANEL_SHOW_MAPVOTE)
219 REGISTER_HUD_PANEL(TIMER,           HUD_Timer,          timer,          PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS & ~PANEL_SHOW_MAPVOTE)
220 REGISTER_HUD_PANEL(RADAR,           HUD_Radar,          radar,          PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
221 REGISTER_HUD_PANEL(SCORE,           HUD_Score,          score,          PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS & ~PANEL_SHOW_MAPVOTE)
222 REGISTER_HUD_PANEL(RACETIMER,       HUD_RaceTimer,      racetimer,      PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
223 REGISTER_HUD_PANEL(VOTE,            HUD_Vote,           vote,           PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS  )
224 REGISTER_HUD_PANEL(MODICONS,        HUD_ModIcons,       modicons,       PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
225 REGISTER_HUD_PANEL(PRESSEDKEYS,     HUD_PressedKeys,    pressedkeys,    PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
226 REGISTER_HUD_PANEL(CHAT,            HUD_Chat,           chat,           PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS  )
227 REGISTER_HUD_PANEL(ENGINEINFO,      HUD_EngineInfo,     engineinfo,     PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS  )
228 REGISTER_HUD_PANEL(INFOMESSAGES,    HUD_InfoMessages,   infomessages,   PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
229 REGISTER_HUD_PANEL(PHYSICS,         HUD_Physics,        physics,        PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
230 REGISTER_HUD_PANEL(CENTERPRINT,     HUD_CenterPrint,    centerprint,    PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
231 REGISTER_HUD_PANEL(MINIGAME_BOARD,  HUD_MinigameBoard,  minigameboard,  PANEL_CONFIG_NO  , PANEL_SHOW_MINIGAME)
232 REGISTER_HUD_PANEL(MINIGAME_STATUS, HUD_MinigameStatus, minigamestatus, PANEL_CONFIG_NO  , PANEL_SHOW_MINIGAME)
233 REGISTER_HUD_PANEL(MINIGAME_HELP,   HUD_MinigameHelp,   minigamehelp,   PANEL_CONFIG_NO  , PANEL_SHOW_MINIGAME)
234 REGISTER_HUD_PANEL(MINIGAME_MENU,   HUD_MinigameMenu,   minigamemenu,   PANEL_CONFIG_NO  , PANEL_SHOW_ALWAYS  )
235 REGISTER_HUD_PANEL(MAPVOTE,         MapVote_Draw,       mapvote,        PANEL_CONFIG_NO  , PANEL_SHOW_MAPVOTE )
236 REGISTER_HUD_PANEL(ITEMSTIME,       HUD_ItemsTime,      itemstime,      PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
237 REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      quickmenu,      PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
238 // always add new panels to the end of list
239
240 // Because calling lots of functions in QC apparently cuts fps in half on many machines:
241 // ----------------------
242 // MACRO HELL STARTS HERE
243 // ----------------------
244 // Little help for the poor people who have to make sense of this: Start from the bottom ;)
245
246 // Get value for panel.current_panel_bg: if "" fetch default, else use panel_bg_str
247 // comment on last line of macro: // we probably want to see a background in config mode at all times...
248 #define HUD_Panel_GetBg() MACRO_BEGIN {                                                                             \
249         string panel_bg;                                                                                                \
250         if (!autocvar__hud_configure && panel_bg_str == "0") {                                                          \
251                 panel_bg = "0";                                                                                             \
252         } else {                                                                                                        \
253                 if (panel_bg_str == "") {                                                                                   \
254                         panel_bg_str = autocvar_hud_panel_bg;                                                                   \
255                 }                                                                                                           \
256                 if (panel_bg_str == "0" && !autocvar__hud_configure) {                                                      \
257                         panel_bg = "0";                                                                                         \
258                 } else {                                                                                                    \
259                         if (panel_bg_str == "0" && autocvar__hud_configure)                                                     \
260                                 panel_bg_alpha_str = "0";                                                                           \
261                         panel_bg = strcat(hud_skin_path, "/", panel_bg_str);                                                    \
262                         if (precache_pic(panel_bg) == "") {                                                                     \
263                                 panel_bg = strcat(hud_skin_path, "/", "border_default");                                            \
264                                 if (precache_pic(panel_bg) == "") {                                                                 \
265                                         panel_bg = strcat("gfx/hud/default/", "border_default");                                        \
266                                 }                                                                                                   \
267                         }                                                                                                       \
268                 }                                                                                                           \
269         }                                                                                                               \
270         if (panel.current_panel_bg)                                                                                     \
271                 strunzone(panel.current_panel_bg);                                                                          \
272         panel.current_panel_bg = strzone(panel_bg);                                                                     \
273 } MACRO_END
274
275 // Get value for panel_bg_color: if "" fetch default, else use panel_bg_color. Convert pants, shirt or teamcolor into a vector.
276 #define HUD_Panel_GetColor() MACRO_BEGIN {                                                                          \
277         if ((teamplay) && panel_bg_color_team) {                                                                        \
278                 if (autocvar__hud_configure && myteam == NUM_SPECTATOR)                                                     \
279                         panel_bg_color = '1 0 0' * panel_bg_color_team;                                                         \
280                 else                                                                                                        \
281                         panel_bg_color = myteamcolors * panel_bg_color_team;                                                    \
282         } else if (autocvar_hud_configure_teamcolorforced && autocvar__hud_configure && panel_bg_color_team) {          \
283                 panel_bg_color = '1 0 0' * panel_bg_color_team;                                                             \
284         } else {                                                                                                        \
285                 if (panel_bg_color_str == "") {                                                                             \
286                         panel_bg_color = autocvar_hud_panel_bg_color;                                                           \
287                 } else {                                                                                                    \
288                         if (panel_bg_color_str == "shirt") {                                                                    \
289                                 panel_bg_color = colormapPaletteColor(floor(stof(getplayerkeyvalue(current_player, "colors")) / 16), 0); \
290                         } else if (panel_bg_color_str == "pants") {                                                             \
291                                 panel_bg_color = colormapPaletteColor(stof(getplayerkeyvalue(current_player, "colors")) % 16, 1); \
292                         } else {                                                                                                \
293                                 panel_bg_color = stov(panel_bg_color_str);                                                          \
294                         }                                                                                                       \
295                 }                                                                                                           \
296         }                                                                                                               \
297 } MACRO_END
298
299 // Get value for panel_bg_color_team: if "" fetch default, else use panel_bg_color_team_str
300 #define HUD_Panel_GetColorTeam() MACRO_BEGIN {                                                                      \
301         if (panel_bg_color_team_str == "") {                                                                            \
302                 panel_bg_color_team = autocvar_hud_panel_bg_color_team;                                                     \
303         } else {                                                                                                        \
304                 panel_bg_color_team = stof(panel_bg_color_team_str);                                                        \
305         }                                                                                                               \
306 } MACRO_END
307
308 // Get value for panel_bg_alpha: if "" fetch default, else use panel_bg_alpha. Also do various menu dialog fadeout/in checks, and minalpha checks
309 // comment on line 3 of macro: // do not set a minalpha cap when showing the config dialog for this panel
310 #define HUD_Panel_GetBgAlpha() MACRO_BEGIN {                                                                        \
311         if (panel_bg_alpha_str == "") {                                                                                 \
312                 panel_bg_alpha_str = ftos(autocvar_hud_panel_bg_alpha);                                                     \
313         }                                                                                                               \
314         panel_bg_alpha = stof(panel_bg_alpha_str);                                                                      \
315         if (autocvar__hud_configure) {                                                                                  \
316                 if (!panel_enabled)                                                                                         \
317                         panel_bg_alpha = 0.25;                                                                                  \
318                 else if (menu_enabled == 2 && panel == highlightedPanel)                                                    \
319                         panel_bg_alpha = (1 - autocvar__menu_alpha) * max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha) + autocvar__menu_alpha * panel_bg_alpha;\
320                 else                                                                                                        \
321                         panel_bg_alpha = max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha);                                \
322         }                                                                                                               \
323 } MACRO_END
324
325 // Get value for panel_fg_alpha. Also do various minalpha checks
326 // comment on line 2 of macro: // ALWAYS show disabled panels at 0.25 alpha when in config mode
327 #define HUD_Panel_GetFgAlpha() MACRO_BEGIN {                                                                        \
328         panel_fg_alpha = autocvar_hud_panel_fg_alpha;                                                                   \
329         if (autocvar__hud_configure && !panel_enabled)                                                                  \
330                 panel_fg_alpha = 0.25;                                                                                      \
331 } MACRO_END
332
333 // Get border. See comments above, it's similar.
334 #define HUD_Panel_GetBorder() MACRO_BEGIN {                                                                         \
335         if (panel_bg_border_str == "") {                                                                                \
336                 panel_bg_border = autocvar_hud_panel_bg_border;                                                             \
337         } else {                                                                                                        \
338                 panel_bg_border = stof(panel_bg_border_str);                                                                \
339         }                                                                                                               \
340 } MACRO_END
341
342 // Get padding. See comments above, it's similar.
343 // last line is a port of the old function, basically always make sure the panel contents are at least 5 pixels tall/wide, to disallow extreme padding values
344 #define HUD_Panel_GetPadding() MACRO_BEGIN {                                                                        \
345         if (panel_bg_padding_str == "") {                                                                               \
346                 panel_bg_padding = autocvar_hud_panel_bg_padding;                                                           \
347         } else {                                                                                                        \
348                 panel_bg_padding = stof(panel_bg_padding_str);                                                              \
349         }                                                                                                               \
350         panel_bg_padding = min(min(panel_size.x, panel_size.y)/2 - 5, panel_bg_padding);                                \
351 } MACRO_END
352
353 // return smoothly faded pos and size of given panel when a dialog is active
354 // don't center too wide panels, it doesn't work with different resolutions
355 #define HUD_Panel_UpdatePosSize_ForMenu() MACRO_BEGIN { \
356         vector menu_enable_size = panel_size; \
357         float max_panel_width = 0.52 * vid_conwidth; \
358         if(panel_size.x > max_panel_width) \
359         { \
360                 menu_enable_size.x = max_panel_width; \
361                 menu_enable_size.y = panel_size.y * (menu_enable_size.x / panel_size.x); \
362         } \
363         vector menu_enable_pos = eX * (panel_bg_border + 0.5 * max_panel_width) + eY * 0.5 * vid_conheight - 0.5 * menu_enable_size; \
364         panel_pos = (1 - autocvar__menu_alpha) * panel_pos + (autocvar__menu_alpha) * menu_enable_pos; \
365         panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * menu_enable_size; \
366 } MACRO_END
367
368 // Scale the pos and size vectors to absolute coordinates
369 #define HUD_Panel_ScalePosSize() MACRO_BEGIN {                                                                      \
370         panel_pos.x *= vid_conwidth;  panel_pos.y *= vid_conheight;                                                     \
371         panel_size.x *= vid_conwidth; panel_size.y *= vid_conheight;                                                    \
372 } MACRO_END
373
374 // NOTE: in hud_configure mode cvars must be reloaded every frame
375 #define HUD_Panel_UpdateCvars() MACRO_BEGIN {                                                                       \
376         if (panel.update_time <= time) {                                                                                \
377                 if (autocvar__hud_configure) panel_enabled = cvar(strcat("hud_panel_", panel.panel_name));                  \
378                 panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos")));                              \
379                 panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size")));                            \
380                 HUD_Panel_ScalePosSize();                                                                                   \
381                 panel_bg_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg"));                                  \
382                 panel_bg_color_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_color"));                      \
383                 panel_bg_color_team_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_color_team"));            \
384                 panel_bg_alpha_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_alpha"));                      \
385                 panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border"));                    \
386                 panel_bg_padding_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_padding"));                  \
387                 HUD_Panel_GetBg();                                                                                          \
388                 if (panel.current_panel_bg != "0") {                                                                        \
389                         HUD_Panel_GetColorTeam();                                                                               \
390                         HUD_Panel_GetColor();                                                                                   \
391                         HUD_Panel_GetBgAlpha();                                                                                 \
392                         HUD_Panel_GetBorder();                                                                                  \
393                 }                                                                                                           \
394                 HUD_Panel_GetFgAlpha();                                                                                     \
395                 HUD_Panel_GetPadding();                                                                                     \
396                 panel.current_panel_bg_alpha = panel_bg_alpha;                                                              \
397                 panel.current_panel_fg_alpha = panel_fg_alpha;                                                              \
398                 if (menu_enabled == 2 && panel == highlightedPanel) {                                                       \
399                         HUD_Panel_UpdatePosSize_ForMenu();                                                                      \
400                 } else {                                                                                                    \
401                         panel_bg_alpha *= hud_fade_alpha;                                                                       \
402                         panel_fg_alpha *= hud_fade_alpha;                                                                       \
403                 }                                                                                                           \
404                 panel.current_panel_pos = panel_pos;                                                                        \
405                 panel.current_panel_size = panel_size;                                                                      \
406                 panel.current_panel_bg_border = panel_bg_border;                                                            \
407                 panel.current_panel_bg_color = panel_bg_color;                                                              \
408                 panel.current_panel_bg_color_team = panel_bg_color_team;                                                    \
409                 panel.current_panel_bg_padding = panel_bg_padding;                                                          \
410                 panel.update_time = (autocvar__hud_configure) ? time : time + autocvar_hud_panel_update_interval;           \
411         } else {                                                                                                        \
412                 panel_pos = panel.current_panel_pos;                                                                        \
413                 panel_size = panel.current_panel_size;                                                                      \
414                 panel_bg_alpha = panel.current_panel_bg_alpha * hud_fade_alpha;                                             \
415                 panel_bg_border = panel.current_panel_bg_border;                                                            \
416                 panel_bg_color = panel.current_panel_bg_color;                                                              \
417                 panel_bg_color_team = panel.current_panel_bg_color_team;                                                    \
418                 panel_bg_padding = panel.current_panel_bg_padding;                                                          \
419                 panel_fg_alpha = panel.current_panel_fg_alpha * hud_fade_alpha;                                             \
420         }                                                                                                               \
421 } MACRO_END
422
423 #define HUD_Panel_UpdatePosSize() MACRO_BEGIN {                                                                     \
424         panel_enabled = cvar(strcat("hud_panel_", panel.panel_name));                                                   \
425         panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos")));                                  \
426         panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size")));                                \
427         HUD_Panel_ScalePosSize();                                                                                       \
428         if (menu_enabled == 2 && panel == highlightedPanel) {                                                           \
429                 HUD_Panel_UpdatePosSize_ForMenu();                                                                          \
430         }                                                                                                               \
431         panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border"));                        \
432         HUD_Panel_GetBorder();                                                                                          \
433 } MACRO_END
434
435 const int NOTIFY_MAX_ENTRIES = 10;
436 const float NOTIFY_ICON_MARGIN = 0.02;
437
438 int notify_index;
439 int notify_count;
440 float notify_times[NOTIFY_MAX_ENTRIES];
441 string notify_attackers[NOTIFY_MAX_ENTRIES];
442 string notify_victims[NOTIFY_MAX_ENTRIES];
443 string notify_icons[NOTIFY_MAX_ENTRIES];
444
445 void HUD_Notify_Push(string icon, string attacker, string victim);
446
447 var void HUD_ModIcons_GameType(vector pos, vector size);
448 void HUD_ModIcons_SetFunc();