2 #include "../dpdefs/csprogsdefs.qh"
4 #include "../dpdefs/keycodes.qh"
5 #include "../common/constants.qh"
6 #include "autocvars.qh"
13 #define HUD_Write(s) fputs(fh, s)
14 // q: quoted, n: not quoted
15 #define HUD_Write_Cvar_n(cvar) HUD_Write(strcat("seta ", cvar, " ", cvar_string(cvar), "\n"))
16 #define HUD_Write_Cvar_q(cvar) HUD_Write(strcat("seta ", cvar, " \"", cvar_string(cvar), "\"\n"))
17 #define HUD_Write_PanelCvar_n(cvar_suf) HUD_Write_Cvar_n(strcat("hud_panel_", panel.panel_name, cvar_suf))
18 #define HUD_Write_PanelCvar_q(cvar_suf) HUD_Write_Cvar_q(strcat("hud_panel_", panel.panel_name, cvar_suf))
20 void HUD_Panel_ExportCfg(string cfgname)
23 string filename = strcat("hud_", autocvar_hud_skin, "_", cfgname, ".cfg");
24 fh = fopen(filename, FILE_WRITE);
27 HUD_Write_Cvar_q("hud_skin");
28 HUD_Write_Cvar_q("hud_panel_bg");
29 HUD_Write_Cvar_q("hud_panel_bg_color");
30 HUD_Write_Cvar_q("hud_panel_bg_color_team");
31 HUD_Write_Cvar_q("hud_panel_bg_alpha");
32 HUD_Write_Cvar_q("hud_panel_bg_border");
33 HUD_Write_Cvar_q("hud_panel_bg_padding");
34 HUD_Write_Cvar_q("hud_panel_fg_alpha");
37 HUD_Write_Cvar_q("hud_dock");
38 HUD_Write_Cvar_q("hud_dock_color");
39 HUD_Write_Cvar_q("hud_dock_color_team");
40 HUD_Write_Cvar_q("hud_dock_alpha");
43 HUD_Write_Cvar_q("hud_progressbar_alpha");
44 HUD_Write_Cvar_q("hud_progressbar_strength_color");
45 HUD_Write_Cvar_q("hud_progressbar_shield_color");
46 HUD_Write_Cvar_q("hud_progressbar_health_color");
47 HUD_Write_Cvar_q("hud_progressbar_armor_color");
48 HUD_Write_Cvar_q("hud_progressbar_fuel_color");
49 HUD_Write_Cvar_q("hud_progressbar_nexball_color");
50 HUD_Write_Cvar_q("hud_progressbar_speed_color");
51 HUD_Write_Cvar_q("hud_progressbar_acceleration_color");
52 HUD_Write_Cvar_q("hud_progressbar_acceleration_neg_color");
55 HUD_Write_Cvar_q("_hud_panelorder");
58 HUD_Write_Cvar_q("hud_configure_grid");
59 HUD_Write_Cvar_q("hud_configure_grid_xsize");
60 HUD_Write_Cvar_q("hud_configure_grid_ysize");
63 // common cvars for all panels
65 for (i = 0; i < HUD_PANEL_NUM; ++i)
69 HUD_Write_PanelCvar_n("");
70 HUD_Write_PanelCvar_q("_pos");
71 HUD_Write_PanelCvar_q("_size");
72 HUD_Write_PanelCvar_q("_bg");
73 HUD_Write_PanelCvar_q("_bg_color");
74 HUD_Write_PanelCvar_q("_bg_color_team");
75 HUD_Write_PanelCvar_q("_bg_alpha");
76 HUD_Write_PanelCvar_q("_bg_border");
77 HUD_Write_PanelCvar_q("_bg_padding");
79 case HUD_PANEL_WEAPONS:
80 HUD_Write_PanelCvar_q("_accuracy");
81 HUD_Write_PanelCvar_q("_label");
82 HUD_Write_PanelCvar_q("_label_scale");
83 HUD_Write_PanelCvar_q("_complainbubble");
84 HUD_Write_PanelCvar_q("_complainbubble_padding");
85 HUD_Write_PanelCvar_q("_complainbubble_time");
86 HUD_Write_PanelCvar_q("_complainbubble_fadetime");
87 HUD_Write_PanelCvar_q("_complainbubble_color_outofammo");
88 HUD_Write_PanelCvar_q("_complainbubble_color_donthave");
89 HUD_Write_PanelCvar_q("_complainbubble_color_unavailable");
90 HUD_Write_PanelCvar_q("_ammo");
91 HUD_Write_PanelCvar_q("_ammo_color");
92 HUD_Write_PanelCvar_q("_ammo_alpha");
93 HUD_Write_PanelCvar_q("_aspect");
94 HUD_Write_PanelCvar_q("_timeout");
95 HUD_Write_PanelCvar_q("_timeout_effect");
96 HUD_Write_PanelCvar_q("_timeout_fadebgmin");
97 HUD_Write_PanelCvar_q("_timeout_fadefgmin");
98 HUD_Write_PanelCvar_q("_timeout_speed_in");
99 HUD_Write_PanelCvar_q("_timeout_speed_out");
100 HUD_Write_PanelCvar_q("_onlyowned");
103 HUD_Write_PanelCvar_q("_onlycurrent");
104 HUD_Write_PanelCvar_q("_noncurrent_alpha");
105 HUD_Write_PanelCvar_q("_noncurrent_scale");
106 HUD_Write_PanelCvar_q("_iconalign");
107 HUD_Write_PanelCvar_q("_progressbar");
108 HUD_Write_PanelCvar_q("_progressbar_name");
109 HUD_Write_PanelCvar_q("_progressbar_xoffset");
110 HUD_Write_PanelCvar_q("_text");
112 case HUD_PANEL_POWERUPS:
113 HUD_Write_PanelCvar_q("_flip");
114 HUD_Write_PanelCvar_q("_iconalign");
115 HUD_Write_PanelCvar_q("_baralign");
116 HUD_Write_PanelCvar_q("_progressbar");
117 HUD_Write_PanelCvar_q("_progressbar_strength");
118 HUD_Write_PanelCvar_q("_progressbar_shield");
119 HUD_Write_PanelCvar_q("_text");
121 case HUD_PANEL_HEALTHARMOR:
122 HUD_Write_PanelCvar_q("_flip");
123 HUD_Write_PanelCvar_q("_iconalign");
124 HUD_Write_PanelCvar_q("_baralign");
125 HUD_Write_PanelCvar_q("_progressbar");
126 HUD_Write_PanelCvar_q("_progressbar_health");
127 HUD_Write_PanelCvar_q("_progressbar_armor");
128 HUD_Write_PanelCvar_q("_progressbar_gfx");
129 HUD_Write_PanelCvar_q("_progressbar_gfx_smooth");
130 HUD_Write_PanelCvar_q("_text");
132 case HUD_PANEL_NOTIFY:
133 HUD_Write_PanelCvar_q("_flip");
134 HUD_Write_PanelCvar_q("_fontsize");
135 HUD_Write_PanelCvar_q("_time");
136 HUD_Write_PanelCvar_q("_fadetime");
137 HUD_Write_PanelCvar_q("_icon_aspect");
139 case HUD_PANEL_TIMER:
140 HUD_Write_PanelCvar_q("_increment");
142 case HUD_PANEL_RADAR:
143 HUD_Write_PanelCvar_q("_foreground_alpha");
144 HUD_Write_PanelCvar_q("_rotation");
145 HUD_Write_PanelCvar_q("_zoommode");
146 HUD_Write_PanelCvar_q("_scale");
147 HUD_Write_PanelCvar_q("_maximized_scale");
148 HUD_Write_PanelCvar_q("_maximized_size");
149 HUD_Write_PanelCvar_q("_maximized_rotation");
150 HUD_Write_PanelCvar_q("_maximized_zoommode");
152 case HUD_PANEL_SCORE:
153 HUD_Write_PanelCvar_q("_rankings");
156 HUD_Write_PanelCvar_q("_alreadyvoted_alpha");
158 case HUD_PANEL_MODICONS:
159 HUD_Write_PanelCvar_q("_ca_layout");
160 HUD_Write_PanelCvar_q("_dom_layout");
161 HUD_Write_PanelCvar_q("_freezetag_layout");
163 case HUD_PANEL_PRESSEDKEYS:
164 HUD_Write_PanelCvar_q("_aspect");
165 HUD_Write_PanelCvar_q("_attack");
167 case HUD_PANEL_ENGINEINFO:
168 HUD_Write_PanelCvar_q("_framecounter_time");
169 HUD_Write_PanelCvar_q("_framecounter_decimals");
171 case HUD_PANEL_INFOMESSAGES:
172 HUD_Write_PanelCvar_q("_flip");
174 case HUD_PANEL_PHYSICS:
175 HUD_Write_PanelCvar_q("_speed_unit");
176 HUD_Write_PanelCvar_q("_speed_unit_show");
177 HUD_Write_PanelCvar_q("_speed_max");
178 HUD_Write_PanelCvar_q("_speed_vertical");
179 HUD_Write_PanelCvar_q("_topspeed");
180 HUD_Write_PanelCvar_q("_topspeed_time");
181 HUD_Write_PanelCvar_q("_acceleration_max");
182 HUD_Write_PanelCvar_q("_acceleration_vertical");
183 HUD_Write_PanelCvar_q("_flip");
184 HUD_Write_PanelCvar_q("_baralign");
185 HUD_Write_PanelCvar_q("_progressbar");
186 HUD_Write_PanelCvar_q("_progressbar_acceleration_mode");
187 HUD_Write_PanelCvar_q("_progressbar_acceleration_scale");
188 HUD_Write_PanelCvar_q("_progressbar_acceleration_nonlinear");
189 HUD_Write_PanelCvar_q("_text");
190 HUD_Write_PanelCvar_q("_text_scale");
192 case HUD_PANEL_CENTERPRINT:
193 HUD_Write_PanelCvar_q("_align");
194 HUD_Write_PanelCvar_q("_flip");
195 HUD_Write_PanelCvar_q("_fontscale");
196 HUD_Write_PanelCvar_q("_time");
197 HUD_Write_PanelCvar_q("_fade_in");
198 HUD_Write_PanelCvar_q("_fade_out");
199 HUD_Write_PanelCvar_q("_fade_subsequent");
200 HUD_Write_PanelCvar_q("_fade_subsequent_passone");
201 HUD_Write_PanelCvar_q("_fade_subsequent_passone_minalpha");
202 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo");
203 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo_minalpha");
204 HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
205 HUD_Write_PanelCvar_q("_fade_minfontsize");
207 case HUD_PANEL_QUICKMENU:
208 HUD_Write_PanelCvar_q("_align");
213 HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
215 printf(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
219 printf(_("^1Couldn't write to %s\n"), filename);
222 void HUD_Configure_Exit_Force()
227 localcmd("togglemenu\n");
229 cvar_set("_hud_configure", "0");
232 // check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
233 vector HUD_Panel_CheckMove(vector myPos, vector mySize)
235 vector myCenter, targCenter;
236 vector myTarget = myPos;
238 for (i = 0; i < HUD_PANEL_NUM; ++i) {
239 panel = hud_panel[i];
240 if(panel == highlightedPanel) continue;
241 HUD_Panel_UpdatePosSize();
242 if(!panel_enabled) continue;
244 panel_pos -= '1 1 0' * panel_bg_border;
245 panel_size += '2 2 0' * panel_bg_border;
247 if(myPos.y + mySize.y < panel_pos.y)
249 if(myPos.y > panel_pos.y + panel_size.y)
252 if(myPos.x + mySize.x < panel_pos.x)
254 if(myPos.x > panel_pos.x + panel_size.x)
257 // OK, there IS a collision.
259 myCenter.x = myPos.x + 0.5 * mySize.x;
260 myCenter.y = myPos.y + 0.5 * mySize.y;
262 targCenter.x = panel_pos.x + 0.5 * panel_size.x;
263 targCenter.y = panel_pos.y + 0.5 * panel_size.y;
265 if(myCenter.x < targCenter.x && myCenter.y < targCenter.y) // top left (of the target panel)
267 if(myPos.x + mySize.x - panel_pos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
268 myTarget.x = panel_pos.x - mySize.x;
269 else // push it upwards
270 myTarget.y = panel_pos.y - mySize.y;
272 else if(myCenter.x > targCenter.x && myCenter.y < targCenter.y) // top right
274 if(panel_pos.x + panel_size.x - myPos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
275 myTarget.x = panel_pos.x + panel_size.x;
276 else // push it upwards
277 myTarget.y = panel_pos.y - mySize.y;
279 else if(myCenter.x < targCenter.x && myCenter.y > targCenter.y) // bottom left
281 if(myPos.x + mySize.x - panel_pos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
282 myTarget.x = panel_pos.x - mySize.x;
283 else // push it downwards
284 myTarget.y = panel_pos.y + panel_size.y;
286 else if(myCenter.x > targCenter.x && myCenter.y > targCenter.y) // bottom right
288 if(panel_pos.x + panel_size.x - myPos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
289 myTarget.x = panel_pos.x + panel_size.x;
290 else // push it downwards
291 myTarget.y = panel_pos.y + panel_size.y;
293 //if(cvar("hud_configure_checkcollisions_debug"))
294 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
300 void HUD_Panel_SetPos(vector pos)
302 panel = highlightedPanel;
303 HUD_Panel_UpdatePosSize();
307 //if(cvar("hud_configure_checkcollisions_debug"))
308 //drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
310 if(autocvar_hud_configure_grid)
312 pos.x = floor((pos.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
313 pos.y = floor((pos.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
316 if(hud_configure_checkcollisions)
317 pos = HUD_Panel_CheckMove(pos, mySize);
319 pos.x = bound(0, pos.x, vid_conwidth - mySize.x);
320 pos.y = bound(0, pos.y, vid_conheight - mySize.y);
323 s = strcat(ftos(pos.x/vid_conwidth), " ", ftos(pos.y/vid_conheight));
325 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
328 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
329 vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
332 float ratio = mySize.x/mySize.y;
334 for (i = 0; i < HUD_PANEL_NUM; ++i) {
335 panel = hud_panel[i];
336 if(panel == highlightedPanel) continue;
337 HUD_Panel_UpdatePosSize();
338 if(!panel_enabled) continue;
340 panel_pos -= '1 1 0' * panel_bg_border;
341 panel_size += '2 2 0' * panel_bg_border;
343 targEndPos = panel_pos + panel_size;
345 // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
346 if(resizeorigin.x > panel_pos.x && resizeorigin.x < targEndPos.x && resizeorigin.y > panel_pos.y && resizeorigin.y < targEndPos.y)
349 if (resizeCorner == 1)
351 // check if this panel is on our way
352 if (resizeorigin.x <= panel_pos.x)
354 if (resizeorigin.y <= panel_pos.y)
356 if (targEndPos.x <= resizeorigin.x - mySize.x)
358 if (targEndPos.y <= resizeorigin.y - mySize.y)
361 // there is a collision:
362 // detect which side of the panel we are facing is actually limiting the resizing
363 // (which side the resize direction finds for first) and reduce the size up to there
365 // dist is the distance between resizeorigin and the "analogous" point of the panel
366 // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel
367 dist.x = resizeorigin.x - targEndPos.x;
368 dist.y = resizeorigin.y - targEndPos.y;
369 if (dist.y <= 0 || dist.x / dist.y > ratio)
370 mySize.x = min(mySize.x, dist.x);
372 mySize.y = min(mySize.y, dist.y);
374 else if (resizeCorner == 2)
376 if (resizeorigin.x >= targEndPos.x)
378 if (resizeorigin.y <= panel_pos.y)
380 if (panel_pos.x >= resizeorigin.x + mySize.x)
382 if (targEndPos.y <= resizeorigin.y - mySize.y)
385 dist.x = panel_pos.x - resizeorigin.x;
386 dist.y = resizeorigin.y - targEndPos.y;
387 if (dist.y <= 0 || dist.x / dist.y > ratio)
388 mySize.x = min(mySize.x, dist.x);
390 mySize.y = min(mySize.y, dist.y);
392 else if (resizeCorner == 3)
394 if (resizeorigin.x <= panel_pos.x)
396 if (resizeorigin.y >= targEndPos.y)
398 if (targEndPos.x <= resizeorigin.x - mySize.x)
400 if (panel_pos.y >= resizeorigin.y + mySize.y)
403 dist.x = resizeorigin.x - targEndPos.x;
404 dist.y = panel_pos.y - resizeorigin.y;
405 if (dist.y <= 0 || dist.x / dist.y > ratio)
406 mySize.x = min(mySize.x, dist.x);
408 mySize.y = min(mySize.y, dist.y);
410 else if (resizeCorner == 4)
412 if (resizeorigin.x >= targEndPos.x)
414 if (resizeorigin.y >= targEndPos.y)
416 if (panel_pos.x >= resizeorigin.x + mySize.x)
418 if (panel_pos.y >= resizeorigin.y + mySize.y)
421 dist.x = panel_pos.x - resizeorigin.x;
422 dist.y = panel_pos.y - resizeorigin.y;
423 if (dist.y <= 0 || dist.x / dist.y > ratio)
424 mySize.x = min(mySize.x, dist.x);
426 mySize.y = min(mySize.y, dist.y);
428 //if(cvar("hud_configure_checkcollisions_debug"))
429 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
435 void HUD_Panel_SetPosSize(vector mySize)
437 panel = highlightedPanel;
438 HUD_Panel_UpdatePosSize();
440 resizeorigin = panel_click_resizeorigin;
443 // minimum panel size cap
444 mySize.x = max(0.025 * vid_conwidth, mySize.x);
445 mySize.y = max(0.025 * vid_conheight, mySize.y);
447 if(highlightedPanel == HUD_PANEL(CHAT)) // some panels have their own restrictions, like the chat panel (which actually only moves the engine chat print around). Looks bad if it's too small.
449 mySize.x = max(17 * autocvar_con_chatsize, mySize.x);
450 mySize.y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize.y);
453 // collision testing|
454 // -----------------+
456 // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
457 if(resizeCorner == 1) {
458 myPos.x = resizeorigin.x - mySize.x;
459 myPos.y = resizeorigin.y - mySize.y;
460 } else if(resizeCorner == 2) {
461 myPos.x = resizeorigin.x;
462 myPos.y = resizeorigin.y - mySize.y;
463 } else if(resizeCorner == 3) {
464 myPos.x = resizeorigin.x - mySize.x;
465 myPos.y = resizeorigin.y;
466 } else { // resizeCorner == 4
467 myPos.x = resizeorigin.x;
468 myPos.y = resizeorigin.y;
471 // left/top screen edges
473 mySize.x = mySize.x + myPos.x;
475 mySize.y = mySize.y + myPos.y;
477 // bottom/right screen edges
478 if(myPos.x + mySize.x > vid_conwidth)
479 mySize.x = vid_conwidth - myPos.x;
480 if(myPos.y + mySize.y > vid_conheight)
481 mySize.y = vid_conheight - myPos.y;
483 //if(cvar("hud_configure_checkcollisions_debug"))
484 //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
486 // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
487 if(autocvar_hud_configure_grid)
489 mySize.x = floor((mySize.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
490 mySize.y = floor((mySize.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
493 if(hud_configure_checkcollisions)
494 mySize = HUD_Panel_CheckResize(mySize, resizeorigin);
496 // minimum panel size cap, do this once more so we NEVER EVER EVER have a panel smaller than this, JUST IN CASE above code still makes the panel eg negative (impossible to resize back without changing cvars manually then)
497 mySize.x = max(0.025 * vid_conwidth, mySize.x);
498 mySize.y = max(0.025 * vid_conheight, mySize.y);
500 // do another pos check, as size might have changed by now
501 if(resizeCorner == 1) {
502 myPos.x = resizeorigin.x - mySize.x;
503 myPos.y = resizeorigin.y - mySize.y;
504 } else if(resizeCorner == 2) {
505 myPos.x = resizeorigin.x;
506 myPos.y = resizeorigin.y - mySize.y;
507 } else if(resizeCorner == 3) {
508 myPos.x = resizeorigin.x - mySize.x;
509 myPos.y = resizeorigin.y;
510 } else { // resizeCorner == 4
511 myPos.x = resizeorigin.x;
512 myPos.y = resizeorigin.y;
515 //if(cvar("hud_configure_checkcollisions_debug"))
516 //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
519 s = strcat(ftos(mySize.x/vid_conwidth), " ", ftos(mySize.y/vid_conheight));
520 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
522 s = strcat(ftos(myPos.x/vid_conwidth), " ", ftos(myPos.y/vid_conheight));
523 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
526 float pressed_key_time;
527 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
528 void HUD_Panel_Arrow_Action(float nPrimary)
530 if(!highlightedPanel)
533 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
536 if(autocvar_hud_configure_grid)
538 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
540 if (hudShiftState & S_SHIFT)
541 step = hud_configure_realGridSize.y;
543 step = 2 * hud_configure_realGridSize.y;
547 if (hudShiftState & S_SHIFT)
548 step = hud_configure_realGridSize.x;
550 step = 2 * hud_configure_realGridSize.x;
555 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
556 step = vid_conheight;
559 if (hudShiftState & S_SHIFT)
560 step = (step / 256); // more precision
562 step = (step / 64) * (1 + 2 * (time - pressed_key_time));
565 panel = highlightedPanel;
566 HUD_Panel_UpdatePosSize();
568 highlightedPanel_initial_pos = panel_pos;
569 highlightedPanel_initial_size = panel_size;
571 if (hudShiftState & S_ALT) // resize
573 highlightedAction = 1;
574 if(nPrimary == K_UPARROW)
576 else if(nPrimary == K_RIGHTARROW)
578 else if(nPrimary == K_LEFTARROW)
580 else // if(nPrimary == K_DOWNARROW)
583 // ctrl+arrow reduces the size, instead of increasing it
584 // Note that ctrl disables collisions check too, but it's fine
585 // since we don't collide with anything reducing the size
586 if (hudShiftState & S_CTRL) {
588 resizeCorner = 5 - resizeCorner;
593 panel_click_resizeorigin = panel_pos;
594 if(resizeCorner == 1) {
595 panel_click_resizeorigin += mySize;
597 } else if(resizeCorner == 2) {
598 panel_click_resizeorigin.y += mySize.y;
600 } else if(resizeCorner == 3) {
601 panel_click_resizeorigin.x += mySize.x;
603 } else { // resizeCorner == 4
606 HUD_Panel_SetPosSize(mySize);
610 highlightedAction = 2;
613 if(nPrimary == K_UPARROW)
615 else if(nPrimary == K_DOWNARROW)
617 else if(nPrimary == K_LEFTARROW)
619 else // if(nPrimary == K_RIGHTARROW)
622 HUD_Panel_SetPos(pos);
625 panel = highlightedPanel;
626 HUD_Panel_UpdatePosSize();
628 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
631 panel_pos_backup = highlightedPanel_initial_pos;
632 panel_size_backup = highlightedPanel_initial_size;
633 highlightedPanel_backup = highlightedPanel;
637 const int S_MOUSE1 = 1;
638 const int S_MOUSE2 = 2;
639 const int S_MOUSE3 = 4;
641 int prevMouseClicked; // previous state
642 float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks
643 vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks
645 void HUD_Panel_EnableMenu();
646 entity tab_panels[HUD_PANEL_MAX];
648 vector tab_panel_pos;
650 void HUD_Panel_FirstInDrawQ(float id);
651 void reset_tab_panels()
654 for(i = 0; i < HUD_PANEL_NUM; ++i)
655 tab_panels[i] = world;
657 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
664 if(!autocvar__hud_configure)
669 mousepos.x = nPrimary;
670 mousepos.y = nSecondary;
674 // block any input while a menu dialog is fading
675 // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
676 if(autocvar__menu_alpha)
683 // allow console bind to work
686 con_keys = findkeysforcommand("toggleconsole", 0);
687 keys = tokenize(con_keys); // findkeysforcommand returns data for this
689 bool hit_con_bind = false;
691 for (i = 0; i < keys; ++i)
693 if(nPrimary == stof(argv(i)))
697 if(bInputType == 0) {
698 if(nPrimary == K_ALT) hudShiftState |= S_ALT;
699 if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
700 if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
702 else if(bInputType == 1) {
703 if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
704 if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
705 if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
708 if(nPrimary == K_CTRL)
710 if (bInputType == 1) //ctrl has been released
714 //switch to selected panel
715 highlightedPanel = tab_panel;
716 highlightedAction = 0;
717 HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id);
724 if(nPrimary == K_MOUSE1)
726 if(bInputType == 0) // key pressed
727 mouseClicked |= S_MOUSE1;
728 else if(bInputType == 1) // key released
729 mouseClicked -= (mouseClicked & S_MOUSE1);
731 else if(nPrimary == K_MOUSE2)
733 if(bInputType == 0) // key pressed
734 mouseClicked |= S_MOUSE2;
735 else if(bInputType == 1) // key released
736 mouseClicked -= (mouseClicked & S_MOUSE2);
738 else if(nPrimary == K_ESCAPE)
743 localcmd("menu_showhudexit\n");
745 else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
750 cvar_set("_hud_configure", "0");
752 else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // select and highlight another panel
754 if (bInputType == 1 || mouseClicked)
757 //FIXME: if a panel is highlighted, has the same pos_x and lays in the same level
758 //of other panels then next consecutive ctrl-tab will select the highlighted panel too
759 //(it should only after every other panel of the hud)
760 //It's a minor bug anyway, we can live with it
762 entity starting_panel;
763 entity old_tab_panel = tab_panel;
764 if (!tab_panel) //first press of TAB
766 if (highlightedPanel)
768 panel = highlightedPanel;
769 HUD_Panel_UpdatePosSize();
773 starting_panel = highlightedPanel;
774 tab_panel_pos = panel_pos; //to compute level
778 if ( ((!tab_backward) && (hudShiftState & S_SHIFT)) || (tab_backward && !(hudShiftState & S_SHIFT)) ) //tab direction changed?
780 starting_panel = tab_panel;
782 tab_backward = (hudShiftState & S_SHIFT);
784 float k, level = 0, start_posX;
785 vector candidate_pos = '0 0 0';
786 const float LEVELS_NUM = 4;
787 float level_height = vid_conheight / LEVELS_NUM;
789 level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
790 candidate_pos.x = (!tab_backward) ? vid_conwidth : 0;
791 start_posX = tab_panel_pos.x;
796 for(i = 0; i < HUD_PANEL_NUM; ++i)
798 panel = hud_panel[i];
799 if (panel == tab_panels[i] || panel == starting_panel)
801 HUD_Panel_UpdatePosSize();
802 if (panel_pos.y >= level && (panel_pos.y - level) < level_height)
803 if ( ( !tab_backward && panel_pos.x >= start_posX && (panel_pos.x < candidate_pos.x || (panel_pos.x == candidate_pos.x && panel_pos.y <= candidate_pos.y)) )
804 || ( tab_backward && panel_pos.x <= start_posX && (panel_pos.x > candidate_pos.x || (panel_pos.x == candidate_pos.x && panel_pos.y >= candidate_pos.y)) ) )
807 tab_panel_pos = candidate_pos = panel_pos;
812 if (k == LEVELS_NUM) //tab_panel not found
820 starting_panel = old_tab_panel;
821 old_tab_panel = world;
822 goto find_tab_panel; //u must find tab_panel!
826 level = (level + level_height) % vid_conheight;
828 candidate_pos.x = vid_conwidth;
832 level = (level - level_height) % vid_conheight;
833 start_posX = vid_conwidth;
838 tab_panels[tab_panel.panel_id] = tab_panel;
840 else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
842 if (bInputType == 1 || mouseClicked)
845 if (highlightedPanel)
846 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
848 cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
850 else if(nPrimary == 'c' && hudShiftState & S_CTRL) // copy highlighted panel size
852 if (bInputType == 1 || mouseClicked)
855 if (highlightedPanel)
857 panel = highlightedPanel;
858 HUD_Panel_UpdatePosSize();
859 panel_size_copied = panel_size;
862 else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
864 if (bInputType == 1 || mouseClicked)
867 if (panel_size_copied == '0 0 0' || !highlightedPanel)
870 panel = highlightedPanel;
871 HUD_Panel_UpdatePosSize();
873 // reduce size if it'd go beyond screen boundaries
874 vector tmp_size = panel_size_copied;
875 if (panel_pos.x + panel_size_copied.x > vid_conwidth)
876 tmp_size.x = vid_conwidth - panel_pos.x;
877 if (panel_pos.y + panel_size_copied.y > vid_conheight)
878 tmp_size.y = vid_conheight - panel_pos.y;
880 if (panel_size == tmp_size)
884 panel_pos_backup = panel_pos;
885 panel_size_backup = panel_size;
886 highlightedPanel_backup = highlightedPanel;
888 s = strcat(ftos(tmp_size.x/vid_conwidth), " ", ftos(tmp_size.y/vid_conheight));
889 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
891 else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
893 if (bInputType == 1 || mouseClicked)
895 //restore previous values
896 if (highlightedPanel_backup)
898 s = strcat(ftos(panel_pos_backup.x/vid_conwidth), " ", ftos(panel_pos_backup.y/vid_conheight));
899 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
900 s = strcat(ftos(panel_size_backup.x/vid_conwidth), " ", ftos(panel_size_backup.y/vid_conheight));
901 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
902 highlightedPanel_backup = world;
905 else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
909 pressed_key_time = 0;
912 else if (pressed_key_time == 0)
913 pressed_key_time = time;
916 HUD_Panel_Arrow_Action(nPrimary); //move or resize panel
918 else if(nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
922 if (highlightedPanel)
923 HUD_Panel_EnableMenu();
925 else if(hit_con_bind)
931 float HUD_Panel_Check_Mouse_Pos(float allow_move)
934 while(j < HUD_PANEL_NUM)
939 panel = hud_panel[i];
940 HUD_Panel_UpdatePosSize();
942 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
945 if(allow_move && mousepos.x > panel_pos.x && mousepos.y > panel_pos.y && mousepos.x < panel_pos.x + panel_size.x && mousepos.y < panel_pos.y + panel_size.y)
949 // resize from topleft border
950 else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
954 // resize from topright border
955 else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
959 // resize from bottomleft border
960 else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + panel_size.y + border)
964 // resize from bottomright border
965 else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + panel_size.y + border)
973 // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else)
974 void HUD_Panel_FirstInDrawQ(float id)
978 // find out where in the array our current id is, save into place
979 for(i = 0; i < HUD_PANEL_NUM; ++i)
981 if(panel_order[i] == id)
987 // place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
989 place = HUD_PANEL_NUM - 1;
991 // move all ids up by one step in the array until "place"
992 for(i = place; i > 0; --i)
994 panel_order[i] = panel_order[i-1];
996 // now save the new top id
999 // let's save them into the cvar by some strcat trickery
1001 for(i = 0; i < HUD_PANEL_NUM; ++i)
1003 s = strcat(s, ftos(panel_order[i]), " ");
1005 cvar_set("_hud_panelorder", s);
1006 if(hud_panelorder_prev)
1007 strunzone(hud_panelorder_prev);
1008 hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
1011 void HUD_Panel_Highlight(float allow_move)
1015 while(j < HUD_PANEL_NUM)
1020 panel = hud_panel[i];
1021 HUD_Panel_UpdatePosSize();
1023 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
1026 if(allow_move && mousepos.x > panel_pos.x && mousepos.y > panel_pos.y && mousepos.x < panel_pos.x + panel_size.x && mousepos.y < panel_pos.y + panel_size.y)
1028 highlightedPanel = hud_panel[i];
1029 HUD_Panel_FirstInDrawQ(i);
1030 highlightedAction = 1;
1031 panel_click_distance = mousepos - panel_pos;
1034 // resize from topleft border
1035 else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
1037 highlightedPanel = hud_panel[i];
1038 HUD_Panel_FirstInDrawQ(i);
1039 highlightedAction = 2;
1041 panel_click_distance = mousepos - panel_pos;
1042 panel_click_resizeorigin = panel_pos + panel_size;
1045 // resize from topright border
1046 else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
1048 highlightedPanel = hud_panel[i];
1049 HUD_Panel_FirstInDrawQ(i);
1050 highlightedAction = 2;
1052 panel_click_distance.x = panel_size.x - mousepos.x + panel_pos.x;
1053 panel_click_distance.y = mousepos.y - panel_pos.y;
1054 panel_click_resizeorigin = panel_pos + eY * panel_size.y;
1057 // resize from bottomleft border
1058 else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + panel_size.y + border)
1060 highlightedPanel = hud_panel[i];
1061 HUD_Panel_FirstInDrawQ(i);
1062 highlightedAction = 2;
1064 panel_click_distance.x = mousepos.x - panel_pos.x;
1065 panel_click_distance.y = panel_size.y - mousepos.y + panel_pos.y;
1066 panel_click_resizeorigin = panel_pos + eX * panel_size.x;
1069 // resize from bottomright border
1070 else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + panel_size.y + border)
1072 highlightedPanel = hud_panel[i];
1073 HUD_Panel_FirstInDrawQ(i);
1074 highlightedAction = 2;
1076 panel_click_distance = panel_size - mousepos + panel_pos;
1077 panel_click_resizeorigin = panel_pos;
1081 highlightedPanel = world;
1082 highlightedAction = 0;
1085 void HUD_Panel_EnableMenu()
1088 localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
1090 float mouse_over_panel;
1091 void HUD_Panel_Mouse()
1093 if(autocvar__menu_alpha == 1)
1096 if (!autocvar_hud_cursormode)
1098 mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
1100 mousepos.x = bound(0, mousepos.x, vid_conwidth);
1101 mousepos.y = bound(0, mousepos.y, vid_conheight);
1106 if(prevMouseClicked == 0)
1110 //stop ctrl-tab selection
1114 HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
1115 // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
1116 if (highlightedPanel)
1118 highlightedPanel_initial_pos = panel_pos;
1119 highlightedPanel_initial_size = panel_size;
1121 // doubleclick check
1122 if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel && prevMouseClickedPos == mousepos)
1124 mouseClicked = 0; // to prevent spam, I guess.
1125 HUD_Panel_EnableMenu();
1129 if (mouseClicked & S_MOUSE1)
1131 prevMouseClickedTime = time;
1132 prevMouseClickedPos = mousepos;
1134 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(mouseClicked & S_MOUSE1);
1139 panel = highlightedPanel;
1140 HUD_Panel_UpdatePosSize();
1143 if (highlightedPanel)
1145 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1146 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
1148 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
1150 panel_pos_backup = highlightedPanel_initial_pos;
1151 panel_size_backup = highlightedPanel_initial_size;
1152 highlightedPanel_backup = highlightedPanel;
1155 // in case the clicked panel is inside another panel and we aren't
1156 // moving it, avoid the immediate "fix" of its position/size
1157 // (often unwanted and hateful) by disabling collisions check
1158 hud_configure_checkcollisions = false;
1161 if(highlightedAction == 1)
1162 HUD_Panel_SetPos(mousepos - panel_click_distance);
1163 else if(highlightedAction == 2)
1165 vector mySize = '0 0 0';
1166 if(resizeCorner == 1) {
1167 mySize.x = panel_click_resizeorigin.x - (mousepos.x - panel_click_distance.x);
1168 mySize.y = panel_click_resizeorigin.y - (mousepos.y - panel_click_distance.y);
1169 } else if(resizeCorner == 2) {
1170 mySize.x = mousepos.x + panel_click_distance.x - panel_click_resizeorigin.x;
1171 mySize.y = panel_click_distance.y + panel_click_resizeorigin.y - mousepos.y;
1172 } else if(resizeCorner == 3) {
1173 mySize.x = panel_click_resizeorigin.x + panel_click_distance.x - mousepos.x;
1174 mySize.y = mousepos.y + panel_click_distance.y - panel_click_resizeorigin.y;
1175 } else { // resizeCorner == 4
1176 mySize.x = mousepos.x - (panel_click_resizeorigin.x - panel_click_distance.x);
1177 mySize.y = mousepos.y - (panel_click_resizeorigin.y - panel_click_distance.y);
1179 HUD_Panel_SetPosSize(mySize);
1184 if(menu_enabled == 2)
1185 mouse_over_panel = 0;
1187 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true);
1188 if (mouse_over_panel && !tab_panel)
1189 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1191 // draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
1192 const vector cursorsize = '32 32 0';
1193 float cursor_alpha = 1 - autocvar__menu_alpha;
1195 if(!mouse_over_panel)
1196 drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1197 else if(mouse_over_panel == 1)
1198 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1199 else if(mouse_over_panel == 2)
1200 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1202 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1204 prevMouseClicked = mouseClicked;
1206 void HUD_Configure_DrawGrid()
1209 if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
1211 hud_configure_gridSize.x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
1212 hud_configure_gridSize.y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
1213 hud_configure_realGridSize.x = hud_configure_gridSize.x * vid_conwidth;
1214 hud_configure_realGridSize.y = hud_configure_gridSize.y * vid_conheight;
1217 s = eX + eY * vid_conheight;
1218 for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
1219 drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1221 s = eY + eX * vid_conwidth;
1222 for(i = 1; i < 1/hud_configure_gridSize.y; ++i)
1223 drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1227 float _menu_alpha_prev;
1228 void HUD_Configure_Frame()
1231 if(autocvar__hud_configure)
1233 if(isdemo() || intermission == 2)
1235 HUD_Configure_Exit_Force();
1239 if(!hud_configure_prev || hud_configure_prev == -1)
1241 if(autocvar_hud_cursormode)
1244 for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
1245 hud_panel[panel_order[i]].update_time = time;
1248 // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
1249 if(autocvar__menu_alpha != _menu_alpha_prev)
1251 if(autocvar__menu_alpha == 0)
1253 _menu_alpha_prev = autocvar__menu_alpha;
1256 HUD_Configure_DrawGrid();
1258 else if(hud_configure_prev)
1262 if(autocvar_hud_cursormode)
1267 const float hlBorderSize = 2;
1268 const string hlBorder = "gfx/hud/default/border_highlighted";
1269 const string hlBorder2 = "gfx/hud/default/border_highlighted2";
1270 void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
1272 drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
1273 drawpic_tiled(panel_pos - '1 1 0' * myBorder, hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size.x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
1274 drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * (panel_size.y + 2 * myBorder - hlBorderSize), hlBorder, '8 1 0' * hlBorderSize, eX * (panel_size.x + 2 * myBorder) + eY * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
1275 drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize, hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size.y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
1276 drawpic_tiled(panel_pos - '1 1 0' * myBorder + eY * hlBorderSize + eX * (panel_size.x + 2 * myBorder - hlBorderSize), hlBorder2, '1 8 0' * hlBorderSize, eY * (panel_size.y + 2 * myBorder - 2 * hlBorderSize) + eX * hlBorderSize, color, theAlpha, DRAWFLAG_NORMAL);
1279 void HUD_Configure_PostDraw()
1281 if(autocvar__hud_configure)
1286 HUD_Panel_UpdatePosSize();
1287 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
1289 if(highlightedPanel)
1291 panel = highlightedPanel;
1292 HUD_Panel_UpdatePosSize();
1293 HUD_Panel_HlBorder(panel_bg_border * hlBorderSize, '0 0.5 1', 0.4 * (1 - autocvar__menu_alpha));