1 #define HUD_Write(s) fputs(fh, s)
2 // q: quoted, n: not quoted
3 #define HUD_Write_Cvar_n(cvar) HUD_Write(strcat("seta ", cvar, " ", cvar_string(cvar), "\n"))
4 #define HUD_Write_Cvar_q(cvar) HUD_Write(strcat("seta ", cvar, " \"", cvar_string(cvar), "\"\n"))
5 #define HUD_Write_PanelCvar_n(cvar_suf) HUD_Write_Cvar_n(strcat("hud_panel_", panel.panel_name, cvar_suf))
6 #define HUD_Write_PanelCvar_q(cvar_suf) HUD_Write_Cvar_q(strcat("hud_panel_", panel.panel_name, cvar_suf))
8 void HUD_Panel_ExportCfg(string cfgname)
11 string filename = strcat("hud_", autocvar_hud_skin, "_", cfgname, ".cfg");
12 fh = fopen(filename, FILE_WRITE);
15 HUD_Write_Cvar_q("hud_skin");
16 HUD_Write_Cvar_q("hud_panel_bg");
17 HUD_Write_Cvar_q("hud_panel_bg_color");
18 HUD_Write_Cvar_q("hud_panel_bg_color_team");
19 HUD_Write_Cvar_q("hud_panel_bg_alpha");
20 HUD_Write_Cvar_q("hud_panel_bg_border");
21 HUD_Write_Cvar_q("hud_panel_bg_padding");
22 HUD_Write_Cvar_q("hud_panel_fg_alpha");
25 HUD_Write_Cvar_q("hud_dock");
26 HUD_Write_Cvar_q("hud_dock_color");
27 HUD_Write_Cvar_q("hud_dock_color_team");
28 HUD_Write_Cvar_q("hud_dock_alpha");
31 HUD_Write_Cvar_q("hud_progressbar_alpha");
32 HUD_Write_Cvar_q("hud_progressbar_strength_color");
33 HUD_Write_Cvar_q("hud_progressbar_shield_color");
34 HUD_Write_Cvar_q("hud_progressbar_health_color");
35 HUD_Write_Cvar_q("hud_progressbar_armor_color");
36 HUD_Write_Cvar_q("hud_progressbar_fuel_color");
37 HUD_Write_Cvar_q("hud_progressbar_nexball_color");
38 HUD_Write_Cvar_q("hud_progressbar_speed_color");
39 HUD_Write_Cvar_q("hud_progressbar_acceleration_color");
40 HUD_Write_Cvar_q("hud_progressbar_acceleration_neg_color");
43 HUD_Write_Cvar_q("_hud_panelorder");
46 HUD_Write_Cvar_q("hud_configure_grid");
47 HUD_Write_Cvar_q("hud_configure_grid_xsize");
48 HUD_Write_Cvar_q("hud_configure_grid_ysize");
51 // common cvars for all panels
53 for (i = 0; i < HUD_PANEL_NUM; ++i)
57 HUD_Write_PanelCvar_n("");
58 HUD_Write_PanelCvar_q("_pos");
59 HUD_Write_PanelCvar_q("_size");
60 HUD_Write_PanelCvar_q("_bg");
61 HUD_Write_PanelCvar_q("_bg_color");
62 HUD_Write_PanelCvar_q("_bg_color_team");
63 HUD_Write_PanelCvar_q("_bg_alpha");
64 HUD_Write_PanelCvar_q("_bg_border");
65 HUD_Write_PanelCvar_q("_bg_padding");
67 case HUD_PANEL_WEAPONS:
68 HUD_Write_PanelCvar_q("_accuracy");
69 HUD_Write_PanelCvar_q("_label");
70 HUD_Write_PanelCvar_q("_complainbubble");
71 HUD_Write_PanelCvar_q("_complainbubble_padding");
72 HUD_Write_PanelCvar_q("_complainbubble_time");
73 HUD_Write_PanelCvar_q("_complainbubble_fadetime");
74 HUD_Write_PanelCvar_q("_complainbubble_color_outofammo");
75 HUD_Write_PanelCvar_q("_complainbubble_color_donthave");
76 HUD_Write_PanelCvar_q("_complainbubble_color_unavailable");
77 HUD_Write_PanelCvar_q("_ammo");
78 HUD_Write_PanelCvar_q("_ammo_color");
79 HUD_Write_PanelCvar_q("_ammo_alpha");
80 HUD_Write_PanelCvar_q("_aspect");
81 HUD_Write_PanelCvar_q("_timeout");
82 HUD_Write_PanelCvar_q("_timeout_effect");
83 HUD_Write_PanelCvar_q("_timeout_fadebgmin");
84 HUD_Write_PanelCvar_q("_timeout_fadefgmin");
85 HUD_Write_PanelCvar_q("_timeout_speed_in");
86 HUD_Write_PanelCvar_q("_timeout_speed_out");
87 HUD_Write_PanelCvar_q("_onlyowned");
90 HUD_Write_PanelCvar_q("_onlycurrent");
91 HUD_Write_PanelCvar_q("_iconalign");
92 HUD_Write_PanelCvar_q("_progressbar");
93 HUD_Write_PanelCvar_q("_progressbar_name");
94 HUD_Write_PanelCvar_q("_progressbar_xoffset");
95 HUD_Write_PanelCvar_q("_text");
97 case HUD_PANEL_POWERUPS:
98 HUD_Write_PanelCvar_q("_flip");
99 HUD_Write_PanelCvar_q("_iconalign");
100 HUD_Write_PanelCvar_q("_baralign");
101 HUD_Write_PanelCvar_q("_progressbar");
102 HUD_Write_PanelCvar_q("_progressbar_strength");
103 HUD_Write_PanelCvar_q("_progressbar_shield");
104 HUD_Write_PanelCvar_q("_text");
106 case HUD_PANEL_HEALTHARMOR:
107 HUD_Write_PanelCvar_q("_flip");
108 HUD_Write_PanelCvar_q("_iconalign");
109 HUD_Write_PanelCvar_q("_baralign");
110 HUD_Write_PanelCvar_q("_progressbar");
111 HUD_Write_PanelCvar_q("_progressbar_health");
112 HUD_Write_PanelCvar_q("_progressbar_armor");
113 HUD_Write_PanelCvar_q("_progressbar_gfx");
114 HUD_Write_PanelCvar_q("_progressbar_gfx_smooth");
115 HUD_Write_PanelCvar_q("_text");
117 case HUD_PANEL_NOTIFY:
118 HUD_Write_PanelCvar_q("_flip");
119 HUD_Write_PanelCvar_q("_fontsize");
120 HUD_Write_PanelCvar_q("_time");
121 HUD_Write_PanelCvar_q("_fadetime");
122 HUD_Write_PanelCvar_q("_icon_aspect");
124 case HUD_PANEL_TIMER:
125 HUD_Write_PanelCvar_q("_increment");
127 case HUD_PANEL_RADAR:
128 HUD_Write_PanelCvar_q("_foreground_alpha");
129 HUD_Write_PanelCvar_q("_rotation");
130 HUD_Write_PanelCvar_q("_zoommode");
131 HUD_Write_PanelCvar_q("_scale");
132 HUD_Write_PanelCvar_q("_maximized_scale");
133 HUD_Write_PanelCvar_q("_maximized_size");
134 HUD_Write_PanelCvar_q("_maximized_rotation");
135 HUD_Write_PanelCvar_q("_maximized_zoommode");
137 case HUD_PANEL_SCORE:
138 HUD_Write_PanelCvar_q("_rankings");
141 HUD_Write_PanelCvar_q("_alreadyvoted_alpha");
143 case HUD_PANEL_MODICONS:
144 HUD_Write_PanelCvar_q("_ca_layout");
145 HUD_Write_PanelCvar_q("_dom_layout");
146 HUD_Write_PanelCvar_q("_freezetag_layout");
148 case HUD_PANEL_PRESSEDKEYS:
149 HUD_Write_PanelCvar_q("_aspect");
150 HUD_Write_PanelCvar_q("_attack");
152 case HUD_PANEL_ENGINEINFO:
153 HUD_Write_PanelCvar_q("_framecounter_time");
154 HUD_Write_PanelCvar_q("_framecounter_decimals");
156 case HUD_PANEL_INFOMESSAGES:
157 HUD_Write_PanelCvar_q("_flip");
159 case HUD_PANEL_PHYSICS:
160 HUD_Write_PanelCvar_q("_speed_unit");
161 HUD_Write_PanelCvar_q("_speed_unit_show");
162 HUD_Write_PanelCvar_q("_speed_max");
163 HUD_Write_PanelCvar_q("_speed_vertical");
164 HUD_Write_PanelCvar_q("_topspeed");
165 HUD_Write_PanelCvar_q("_topspeed_time");
166 HUD_Write_PanelCvar_q("_acceleration_max");
167 HUD_Write_PanelCvar_q("_acceleration_vertical");
168 HUD_Write_PanelCvar_q("_flip");
169 HUD_Write_PanelCvar_q("_baralign");
170 HUD_Write_PanelCvar_q("_progressbar");
171 HUD_Write_PanelCvar_q("_progressbar_acceleration_mode");
172 HUD_Write_PanelCvar_q("_progressbar_acceleration_scale");
173 HUD_Write_PanelCvar_q("_progressbar_acceleration_nonlinear");
174 HUD_Write_PanelCvar_q("_text");
175 HUD_Write_PanelCvar_q("_text_scale");
177 case HUD_PANEL_CENTERPRINT:
178 HUD_Write_PanelCvar_q("_align");
179 HUD_Write_PanelCvar_q("_flip");
180 HUD_Write_PanelCvar_q("_fontscale");
181 HUD_Write_PanelCvar_q("_time");
182 HUD_Write_PanelCvar_q("_fade_in");
183 HUD_Write_PanelCvar_q("_fade_out");
184 HUD_Write_PanelCvar_q("_fade_subsequent");
185 HUD_Write_PanelCvar_q("_fade_subsequent_passone");
186 HUD_Write_PanelCvar_q("_fade_subsequent_passone_minalpha");
187 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo");
188 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo_minalpha");
189 HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
190 HUD_Write_PanelCvar_q("_fade_minfontsize");
192 case HUD_PANEL_QUICKMENU:
193 HUD_Write_PanelCvar_q("_align");
198 HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
200 printf(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
204 printf(_("^1Couldn't write to %s\n"), filename);
207 void HUD_Configure_Exit_Force()
212 localcmd("togglemenu\n");
214 cvar_set("_hud_configure", "0");
217 // check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
218 vector HUD_Panel_CheckMove(vector myPos, vector mySize)
221 float myCenter_x, myCenter_y, targCenter_x, targCenter_y;
225 for (i = 0; i < HUD_PANEL_NUM; ++i) {
226 panel = hud_panel[i];
227 if(panel == highlightedPanel) continue;
228 HUD_Panel_UpdatePosSize()
229 if(!panel_enabled) continue;
231 panel_pos -= '1 1 0' * panel_bg_border;
232 panel_size += '2 2 0' * panel_bg_border;
234 if(myPos_y + mySize_y < panel_pos_y)
236 if(myPos_y > panel_pos_y + panel_size_y)
239 if(myPos_x + mySize_x < panel_pos_x)
241 if(myPos_x > panel_pos_x + panel_size_x)
244 // OK, there IS a collision.
246 myCenter_x = myPos_x + 0.5 * mySize_x;
247 myCenter_y = myPos_y + 0.5 * mySize_y;
249 targCenter_x = panel_pos_x + 0.5 * panel_size_x;
250 targCenter_y = panel_pos_y + 0.5 * panel_size_y;
252 if(myCenter_x < targCenter_x && myCenter_y < targCenter_y) // top left (of the target panel)
254 if(myPos_x + mySize_x - panel_pos_x < myPos_y + mySize_y - panel_pos_y) // push it to the side
255 myTarget_x = panel_pos_x - mySize_x;
256 else // push it upwards
257 myTarget_y = panel_pos_y - mySize_y;
259 else if(myCenter_x > targCenter_x && myCenter_y < targCenter_y) // top right
261 if(panel_pos_x + panel_size_x - myPos_x < myPos_y + mySize_y - panel_pos_y) // push it to the side
262 myTarget_x = panel_pos_x + panel_size_x;
263 else // push it upwards
264 myTarget_y = panel_pos_y - mySize_y;
266 else if(myCenter_x < targCenter_x && myCenter_y > targCenter_y) // bottom left
268 if(myPos_x + mySize_x - panel_pos_x < panel_pos_y + panel_size_y - myPos_y) // push it to the side
269 myTarget_x = panel_pos_x - mySize_x;
270 else // push it downwards
271 myTarget_y = panel_pos_y + panel_size_y;
273 else if(myCenter_x > targCenter_x && myCenter_y > targCenter_y) // bottom right
275 if(panel_pos_x + panel_size_x - myPos_x < panel_pos_y + panel_size_y - myPos_y) // push it to the side
276 myTarget_x = panel_pos_x + panel_size_x;
277 else // push it downwards
278 myTarget_y = panel_pos_y + panel_size_y;
280 //if(cvar("hud_configure_checkcollisions_debug"))
281 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
287 void HUD_Panel_SetPos(vector pos)
289 panel = highlightedPanel;
290 HUD_Panel_UpdatePosSize()
294 //if(cvar("hud_configure_checkcollisions_debug"))
295 //drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
297 if(autocvar_hud_configure_grid)
299 pos_x = floor((pos_x/vid_conwidth)/hud_configure_gridSize_x + 0.5) * hud_configure_realGridSize_x;
300 pos_y = floor((pos_y/vid_conheight)/hud_configure_gridSize_y + 0.5) * hud_configure_realGridSize_y;
303 if(hud_configure_checkcollisions)
304 pos = HUD_Panel_CheckMove(pos, mySize);
306 pos_x = bound(0, pos_x, vid_conwidth - mySize_x);
307 pos_y = bound(0, pos_y, vid_conheight - mySize_y);
310 s = strcat(ftos(pos_x/vid_conwidth), " ", ftos(pos_y/vid_conheight));
312 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
315 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
316 vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
321 float dist_x, dist_y;
323 ratio = mySize_x/mySize_y;
325 for (i = 0; i < HUD_PANEL_NUM; ++i) {
326 panel = hud_panel[i];
327 if(panel == highlightedPanel) continue;
328 HUD_Panel_UpdatePosSize()
329 if(!panel_enabled) continue;
331 panel_pos -= '1 1 0' * panel_bg_border;
332 panel_size += '2 2 0' * panel_bg_border;
334 targEndPos = panel_pos + panel_size;
336 // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
337 if(resizeorigin_x > panel_pos_x && resizeorigin_x < targEndPos_x && resizeorigin_y > panel_pos_y && resizeorigin_y < targEndPos_y)
340 if (resizeCorner == 1)
342 // check if this panel is on our way
343 if (resizeorigin_x <= panel_pos_x)
345 if (resizeorigin_y <= panel_pos_y)
347 if (targEndPos_x <= resizeorigin_x - mySize_x)
349 if (targEndPos_y <= resizeorigin_y - mySize_y)
352 // there is a collision:
353 // detect which side of the panel we are facing is actually limiting the resizing
354 // (which side the resize direction finds for first) and reduce the size up to there
356 // dist is the distance between resizeorigin and the "analogous" point of the panel
357 // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel
358 dist_x = resizeorigin_x - targEndPos_x;
359 dist_y = resizeorigin_y - targEndPos_y;
360 if (dist_y <= 0 || dist_x / dist_y > ratio)
361 mySize_x = min(mySize_x, dist_x);
363 mySize_y = min(mySize_y, dist_y);
365 else if (resizeCorner == 2)
367 if (resizeorigin_x >= targEndPos_x)
369 if (resizeorigin_y <= panel_pos_y)
371 if (panel_pos_x >= resizeorigin_x + mySize_x)
373 if (targEndPos_y <= resizeorigin_y - mySize_y)
376 dist_x = panel_pos_x - resizeorigin_x;
377 dist_y = resizeorigin_y - targEndPos_y;
378 if (dist_y <= 0 || dist_x / dist_y > ratio)
379 mySize_x = min(mySize_x, dist_x);
381 mySize_y = min(mySize_y, dist_y);
383 else if (resizeCorner == 3)
385 if (resizeorigin_x <= panel_pos_x)
387 if (resizeorigin_y >= targEndPos_y)
389 if (targEndPos_x <= resizeorigin_x - mySize_x)
391 if (panel_pos_y >= resizeorigin_y + mySize_y)
394 dist_x = resizeorigin_x - targEndPos_x;
395 dist_y = panel_pos_y - resizeorigin_y;
396 if (dist_y <= 0 || dist_x / dist_y > ratio)
397 mySize_x = min(mySize_x, dist_x);
399 mySize_y = min(mySize_y, dist_y);
401 else if (resizeCorner == 4)
403 if (resizeorigin_x >= targEndPos_x)
405 if (resizeorigin_y >= targEndPos_y)
407 if (panel_pos_x >= resizeorigin_x + mySize_x)
409 if (panel_pos_y >= resizeorigin_y + mySize_y)
412 dist_x = panel_pos_x - resizeorigin_x;
413 dist_y = panel_pos_y - resizeorigin_y;
414 if (dist_y <= 0 || dist_x / dist_y > ratio)
415 mySize_x = min(mySize_x, dist_x);
417 mySize_y = min(mySize_y, dist_y);
419 //if(cvar("hud_configure_checkcollisions_debug"))
420 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
426 void HUD_Panel_SetPosSize(vector mySize)
428 panel = highlightedPanel;
429 HUD_Panel_UpdatePosSize()
431 resizeorigin = panel_click_resizeorigin;
432 local noref vector myPos; // fteqcc sucks
434 // minimum panel size cap
435 mySize_x = max(0.025 * vid_conwidth, mySize_x);
436 mySize_y = max(0.025 * vid_conheight, mySize_y);
438 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.
440 mySize_x = max(17 * autocvar_con_chatsize, mySize_x);
441 mySize_y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize_y);
444 // collision testing|
445 // -----------------+
447 // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
448 if(resizeCorner == 1) {
449 myPos_x = resizeorigin_x - mySize_x;
450 myPos_y = resizeorigin_y - mySize_y;
451 } else if(resizeCorner == 2) {
452 myPos_x = resizeorigin_x;
453 myPos_y = resizeorigin_y - mySize_y;
454 } else if(resizeCorner == 3) {
455 myPos_x = resizeorigin_x - mySize_x;
456 myPos_y = resizeorigin_y;
457 } else { // resizeCorner == 4
458 myPos_x = resizeorigin_x;
459 myPos_y = resizeorigin_y;
462 // left/top screen edges
464 mySize_x = mySize_x + myPos_x;
466 mySize_y = mySize_y + myPos_y;
468 // bottom/right screen edges
469 if(myPos_x + mySize_x > vid_conwidth)
470 mySize_x = vid_conwidth - myPos_x;
471 if(myPos_y + mySize_y > vid_conheight)
472 mySize_y = vid_conheight - myPos_y;
474 //if(cvar("hud_configure_checkcollisions_debug"))
475 //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
477 // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
478 if(autocvar_hud_configure_grid)
480 mySize_x = floor((mySize_x/vid_conwidth)/hud_configure_gridSize_x + 0.5) * hud_configure_realGridSize_x;
481 mySize_y = floor((mySize_y/vid_conheight)/hud_configure_gridSize_y + 0.5) * hud_configure_realGridSize_y;
484 if(hud_configure_checkcollisions)
485 mySize = HUD_Panel_CheckResize(mySize, resizeorigin);
487 // 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)
488 mySize_x = max(0.025 * vid_conwidth, mySize_x);
489 mySize_y = max(0.025 * vid_conheight, mySize_y);
491 // do another pos check, as size might have changed by now
492 if(resizeCorner == 1) {
493 myPos_x = resizeorigin_x - mySize_x;
494 myPos_y = resizeorigin_y - mySize_y;
495 } else if(resizeCorner == 2) {
496 myPos_x = resizeorigin_x;
497 myPos_y = resizeorigin_y - mySize_y;
498 } else if(resizeCorner == 3) {
499 myPos_x = resizeorigin_x - mySize_x;
500 myPos_y = resizeorigin_y;
501 } else { // resizeCorner == 4
502 myPos_x = resizeorigin_x;
503 myPos_y = resizeorigin_y;
506 //if(cvar("hud_configure_checkcollisions_debug"))
507 //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
510 s = strcat(ftos(mySize_x/vid_conwidth), " ", ftos(mySize_y/vid_conheight));
511 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
513 s = strcat(ftos(myPos_x/vid_conwidth), " ", ftos(myPos_y/vid_conheight));
514 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
517 float pressed_key_time;
518 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
519 void HUD_Panel_Arrow_Action(float nPrimary)
521 if(!highlightedPanel)
524 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
527 if(autocvar_hud_configure_grid)
529 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
531 if (hudShiftState & S_SHIFT)
532 step = hud_configure_realGridSize_y;
534 step = 2 * hud_configure_realGridSize_y;
538 if (hudShiftState & S_SHIFT)
539 step = hud_configure_realGridSize_x;
541 step = 2 * hud_configure_realGridSize_x;
546 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
547 step = vid_conheight;
550 if (hudShiftState & S_SHIFT)
551 step = (step / 256); // more precision
553 step = (step / 64) * (1 + 2 * (time - pressed_key_time));
556 panel = highlightedPanel;
557 HUD_Panel_UpdatePosSize()
559 highlightedPanel_initial_pos = panel_pos;
560 highlightedPanel_initial_size = panel_size;
562 if (hudShiftState & S_ALT) // resize
564 highlightedAction = 1;
565 if(nPrimary == K_UPARROW)
567 else if(nPrimary == K_RIGHTARROW)
569 else if(nPrimary == K_LEFTARROW)
571 else // if(nPrimary == K_DOWNARROW)
574 // ctrl+arrow reduces the size, instead of increasing it
575 // Note that ctrl disables collisions check too, but it's fine
576 // since we don't collide with anything reducing the size
577 if (hudShiftState & S_CTRL) {
579 resizeCorner = 5 - resizeCorner;
584 panel_click_resizeorigin = panel_pos;
585 if(resizeCorner == 1) {
586 panel_click_resizeorigin += mySize;
588 } else if(resizeCorner == 2) {
589 panel_click_resizeorigin_y += mySize_y;
591 } else if(resizeCorner == 3) {
592 panel_click_resizeorigin_x += mySize_x;
594 } else { // resizeCorner == 4
597 HUD_Panel_SetPosSize(mySize);
601 highlightedAction = 2;
604 if(nPrimary == K_UPARROW)
606 else if(nPrimary == K_DOWNARROW)
608 else if(nPrimary == K_LEFTARROW)
610 else // if(nPrimary == K_RIGHTARROW)
613 HUD_Panel_SetPos(pos);
616 panel = highlightedPanel;
617 HUD_Panel_UpdatePosSize()
619 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
622 panel_pos_backup = highlightedPanel_initial_pos;
623 panel_size_backup = highlightedPanel_initial_size;
624 highlightedPanel_backup = highlightedPanel;
628 const float S_MOUSE1 = 1;
629 const float S_MOUSE2 = 2;
630 const float S_MOUSE3 = 4;
632 float prevMouseClicked; // previous state
633 float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks
634 vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks
636 void HUD_Panel_EnableMenu();
637 entity tab_panels[HUD_PANEL_MAX];
639 vector tab_panel_pos;
641 void HUD_Panel_FirstInDrawQ(float id);
642 void reset_tab_panels()
645 for(i = 0; i < HUD_PANEL_NUM; ++i)
646 tab_panels[i] = world;
648 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
655 if(!autocvar__hud_configure)
660 mousepos_x = nPrimary;
661 mousepos_y = nSecondary;
665 // block any input while a menu dialog is fading
666 // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
667 if(autocvar__menu_alpha)
674 // allow console bind to work
677 con_keys = findkeysforcommand("toggleconsole", 0);
678 keys = tokenize(con_keys); // findkeysforcommand returns data for this
680 float hit_con_bind = 0, i;
681 for (i = 0; i < keys; ++i)
683 if(nPrimary == stof(argv(i)))
687 if(bInputType == 0) {
688 if(nPrimary == K_ALT) hudShiftState |= S_ALT;
689 if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
690 if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
692 else if(bInputType == 1) {
693 if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
694 if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
695 if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
698 if(nPrimary == K_CTRL)
700 if (bInputType == 1) //ctrl has been released
704 //switch to selected panel
705 highlightedPanel = tab_panel;
706 highlightedAction = 0;
707 HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id);
714 if(nPrimary == K_MOUSE1)
716 if(bInputType == 0) // key pressed
717 mouseClicked |= S_MOUSE1;
718 else if(bInputType == 1) // key released
719 mouseClicked -= (mouseClicked & S_MOUSE1);
721 else if(nPrimary == K_MOUSE2)
723 if(bInputType == 0) // key pressed
724 mouseClicked |= S_MOUSE2;
725 else if(bInputType == 1) // key released
726 mouseClicked -= (mouseClicked & S_MOUSE2);
728 else if(nPrimary == K_ESCAPE)
733 localcmd("menu_showhudexit\n");
735 else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
740 cvar_set("_hud_configure", "0");
742 else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // select and highlight another panel
744 if (bInputType == 1 || mouseClicked)
747 //FIXME: if a panel is highlighted, has the same pos_x and lays in the same level
748 //of other panels then next consecutive ctrl-tab will select the highlighted panel too
749 //(it should only after every other panel of the hud)
750 //It's a minor bug anyway, we can live with it
752 entity starting_panel;
753 entity old_tab_panel = tab_panel;
754 if (!tab_panel) //first press of TAB
756 if (highlightedPanel)
758 panel = highlightedPanel;
759 HUD_Panel_UpdatePosSize()
763 starting_panel = highlightedPanel;
764 tab_panel_pos = panel_pos; //to compute level
768 if ( ((!tab_backward) && (hudShiftState & S_SHIFT)) || (tab_backward && !(hudShiftState & S_SHIFT)) ) //tab direction changed?
770 starting_panel = tab_panel;
772 tab_backward = (hudShiftState & S_SHIFT);
774 float k, level = 0, start_pos_x;
775 vector candidate_pos = '0 0 0';
776 const float LEVELS_NUM = 4;
777 float level_height = vid_conheight / LEVELS_NUM;
779 level = floor(tab_panel_pos_y / level_height) * level_height; //starting level
780 candidate_pos_x = (!tab_backward) ? vid_conwidth : 0;
781 start_pos_x = tab_panel_pos_x;
786 for(i = 0; i < HUD_PANEL_NUM; ++i)
788 panel = hud_panel[i];
789 if (panel == tab_panels[i] || panel == starting_panel)
791 HUD_Panel_UpdatePosSize()
792 if (panel_pos_y >= level && (panel_pos_y - level) < level_height)
793 if ( ( !tab_backward && panel_pos_x >= start_pos_x && (panel_pos_x < candidate_pos_x || (panel_pos_x == candidate_pos_x && panel_pos_y <= candidate_pos_y)) )
794 || ( tab_backward && panel_pos_x <= start_pos_x && (panel_pos_x > candidate_pos_x || (panel_pos_x == candidate_pos_x && panel_pos_y >= candidate_pos_y)) ) )
797 tab_panel_pos = candidate_pos = panel_pos;
802 if (k == LEVELS_NUM) //tab_panel not found
810 starting_panel = old_tab_panel;
811 old_tab_panel = world;
812 goto find_tab_panel; //u must find tab_panel!
816 level = (level + level_height) % vid_conheight;
818 candidate_pos_x = vid_conwidth;
822 level = (level - level_height) % vid_conheight;
823 start_pos_x = vid_conwidth;
828 tab_panels[tab_panel.panel_id] = tab_panel;
830 else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
832 if (bInputType == 1 || mouseClicked)
835 if (highlightedPanel)
836 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
838 cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
840 else if(nPrimary == 'c' && hudShiftState & S_CTRL) // copy highlighted panel size
842 if (bInputType == 1 || mouseClicked)
845 if (highlightedPanel)
847 panel = highlightedPanel;
848 HUD_Panel_UpdatePosSize()
849 panel_size_copied = panel_size;
852 else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
854 if (bInputType == 1 || mouseClicked)
857 if (panel_size_copied == '0 0 0' || !highlightedPanel)
860 panel = highlightedPanel;
861 HUD_Panel_UpdatePosSize()
863 // reduce size if it'd go beyond screen boundaries
864 vector tmp_size = panel_size_copied;
865 if (panel_pos_x + panel_size_copied_x > vid_conwidth)
866 tmp_size_x = vid_conwidth - panel_pos_x;
867 if (panel_pos_y + panel_size_copied_y > vid_conheight)
868 tmp_size_y = vid_conheight - panel_pos_y;
870 if (panel_size == tmp_size)
874 panel_pos_backup = panel_pos;
875 panel_size_backup = panel_size;
876 highlightedPanel_backup = highlightedPanel;
878 s = strcat(ftos(tmp_size_x/vid_conwidth), " ", ftos(tmp_size_y/vid_conheight));
879 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
881 else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
883 if (bInputType == 1 || mouseClicked)
885 //restore previous values
886 if (highlightedPanel_backup)
888 s = strcat(ftos(panel_pos_backup_x/vid_conwidth), " ", ftos(panel_pos_backup_y/vid_conheight));
889 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
890 s = strcat(ftos(panel_size_backup_x/vid_conwidth), " ", ftos(panel_size_backup_y/vid_conheight));
891 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
892 highlightedPanel_backup = world;
895 else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
899 pressed_key_time = 0;
902 else if (pressed_key_time == 0)
903 pressed_key_time = time;
906 HUD_Panel_Arrow_Action(nPrimary); //move or resize panel
908 else if(nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
912 if (highlightedPanel)
913 HUD_Panel_EnableMenu();
915 else if(hit_con_bind)
921 float HUD_Panel_Check_Mouse_Pos(float allow_move)
923 float i, j = 0, border;
925 while(j < HUD_PANEL_NUM)
930 panel = hud_panel[i];
931 HUD_Panel_UpdatePosSize()
933 border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
936 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)
940 // resize from topleft border
941 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)
945 // resize from topright border
946 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)
950 // resize from bottomleft border
951 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)
955 // resize from bottomright border
956 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)
964 // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else)
965 void HUD_Panel_FirstInDrawQ(float id)
968 var float place = -1;
969 // find out where in the array our current id is, save into place
970 for(i = 0; i < HUD_PANEL_NUM; ++i)
972 if(panel_order[i] == id)
978 // place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
980 place = HUD_PANEL_NUM - 1;
982 // move all ids up by one step in the array until "place"
983 for(i = place; i > 0; --i)
985 panel_order[i] = panel_order[i-1];
987 // now save the new top id
990 // let's save them into the cvar by some strcat trickery
992 for(i = 0; i < HUD_PANEL_NUM; ++i)
994 s = strcat(s, ftos(panel_order[i]), " ");
996 cvar_set("_hud_panelorder", s);
997 if(hud_panelorder_prev)
998 strunzone(hud_panelorder_prev);
999 hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
1002 void HUD_Panel_Highlight(float allow_move)
1004 float i, j = 0, border;
1006 while(j < HUD_PANEL_NUM)
1011 panel = hud_panel[i];
1012 HUD_Panel_UpdatePosSize()
1014 border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
1017 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)
1019 highlightedPanel = hud_panel[i];
1020 HUD_Panel_FirstInDrawQ(i);
1021 highlightedAction = 1;
1022 panel_click_distance = mousepos - panel_pos;
1025 // resize from topleft border
1026 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)
1028 highlightedPanel = hud_panel[i];
1029 HUD_Panel_FirstInDrawQ(i);
1030 highlightedAction = 2;
1032 panel_click_distance = mousepos - panel_pos;
1033 panel_click_resizeorigin = panel_pos + panel_size;
1036 // resize from topright border
1037 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)
1039 highlightedPanel = hud_panel[i];
1040 HUD_Panel_FirstInDrawQ(i);
1041 highlightedAction = 2;
1043 panel_click_distance_x = panel_size_x - mousepos_x + panel_pos_x;
1044 panel_click_distance_y = mousepos_y - panel_pos_y;
1045 panel_click_resizeorigin = panel_pos + eY * panel_size_y;
1048 // resize from bottomleft border
1049 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)
1051 highlightedPanel = hud_panel[i];
1052 HUD_Panel_FirstInDrawQ(i);
1053 highlightedAction = 2;
1055 panel_click_distance_x = mousepos_x - panel_pos_x;
1056 panel_click_distance_y = panel_size_y - mousepos_y + panel_pos_y;
1057 panel_click_resizeorigin = panel_pos + eX * panel_size_x;
1060 // resize from bottomright border
1061 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)
1063 highlightedPanel = hud_panel[i];
1064 HUD_Panel_FirstInDrawQ(i);
1065 highlightedAction = 2;
1067 panel_click_distance = panel_size - mousepos + panel_pos;
1068 panel_click_resizeorigin = panel_pos;
1072 highlightedPanel = world;
1073 highlightedAction = 0;
1076 void HUD_Panel_EnableMenu()
1079 localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
1081 float mouse_over_panel;
1082 void HUD_Panel_Mouse()
1084 if(autocvar__menu_alpha == 1)
1087 if (!autocvar_hud_cursormode)
1089 mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
1091 mousepos_x = bound(0, mousepos_x, vid_conwidth);
1092 mousepos_y = bound(0, mousepos_y, vid_conheight);
1097 if(prevMouseClicked == 0)
1101 //stop ctrl-tab selection
1105 HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
1106 // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
1107 if (highlightedPanel)
1109 highlightedPanel_initial_pos = panel_pos;
1110 highlightedPanel_initial_size = panel_size;
1112 // doubleclick check
1113 if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel && prevMouseClickedPos == mousepos)
1115 mouseClicked = 0; // to prevent spam, I guess.
1116 HUD_Panel_EnableMenu();
1120 if (mouseClicked & S_MOUSE1)
1122 prevMouseClickedTime = time;
1123 prevMouseClickedPos = mousepos;
1125 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(mouseClicked & S_MOUSE1);
1130 panel = highlightedPanel;
1131 HUD_Panel_UpdatePosSize()
1134 if (highlightedPanel)
1136 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1137 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
1139 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
1141 panel_pos_backup = highlightedPanel_initial_pos;
1142 panel_size_backup = highlightedPanel_initial_size;
1143 highlightedPanel_backup = highlightedPanel;
1146 // in case the clicked panel is inside another panel and we aren't
1147 // moving it, avoid the immediate "fix" of its position/size
1148 // (often unwanted and hateful) by disabling collisions check
1149 hud_configure_checkcollisions = false;
1152 if(highlightedAction == 1)
1153 HUD_Panel_SetPos(mousepos - panel_click_distance);
1154 else if(highlightedAction == 2)
1156 vector mySize = '0 0 0';
1157 if(resizeCorner == 1) {
1158 mySize_x = panel_click_resizeorigin_x - (mousepos_x - panel_click_distance_x);
1159 mySize_y = panel_click_resizeorigin_y - (mousepos_y - panel_click_distance_y);
1160 } else if(resizeCorner == 2) {
1161 mySize_x = mousepos_x + panel_click_distance_x - panel_click_resizeorigin_x;
1162 mySize_y = panel_click_distance_y + panel_click_resizeorigin_y - mousepos_y;
1163 } else if(resizeCorner == 3) {
1164 mySize_x = panel_click_resizeorigin_x + panel_click_distance_x - mousepos_x;
1165 mySize_y = mousepos_y + panel_click_distance_y - panel_click_resizeorigin_y;
1166 } else { // resizeCorner == 4
1167 mySize_x = mousepos_x - (panel_click_resizeorigin_x - panel_click_distance_x);
1168 mySize_y = mousepos_y - (panel_click_resizeorigin_y - panel_click_distance_y);
1170 HUD_Panel_SetPosSize(mySize);
1175 if(menu_enabled == 2)
1176 mouse_over_panel = 0;
1178 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(TRUE);
1179 if (mouse_over_panel && !tab_panel)
1180 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1182 // draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
1183 const vector cursorsize = '32 32 0';
1184 float cursor_alpha = 1 - autocvar__menu_alpha;
1186 if(!mouse_over_panel)
1187 drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1188 else if(mouse_over_panel == 1)
1189 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1190 else if(mouse_over_panel == 2)
1191 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1193 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1195 prevMouseClicked = mouseClicked;
1197 void HUD_Configure_DrawGrid()
1200 if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
1202 hud_configure_gridSize_x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
1203 hud_configure_gridSize_y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
1204 hud_configure_realGridSize_x = hud_configure_gridSize_x * vid_conwidth;
1205 hud_configure_realGridSize_y = hud_configure_gridSize_y * vid_conheight;
1208 s = eX + eY * vid_conheight;
1209 for(i = 1; i < 1/hud_configure_gridSize_x; ++i)
1210 drawfill(eX * i * hud_configure_realGridSize_x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1212 s = eY + eX * vid_conwidth;
1213 for(i = 1; i < 1/hud_configure_gridSize_y; ++i)
1214 drawfill(eY * i * hud_configure_realGridSize_y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1218 float _menu_alpha_prev;
1219 void HUD_Configure_Frame()
1222 if(autocvar__hud_configure)
1224 if(isdemo() || intermission == 2)
1226 HUD_Configure_Exit_Force();
1230 if(!hud_configure_prev || hud_configure_prev == -1)
1232 if(autocvar_hud_cursormode)
1235 for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
1236 hud_panel[panel_order[i]].update_time = time;
1239 // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
1240 if(autocvar__menu_alpha != _menu_alpha_prev)
1242 if(autocvar__menu_alpha == 0)
1244 _menu_alpha_prev = autocvar__menu_alpha;
1247 HUD_Configure_DrawGrid();
1249 else if(hud_configure_prev)
1253 if(autocvar_hud_cursormode)
1258 const float hlBorderSize = 4;
1259 const string hlBorder = "gfx/hud/default/border_highlighted";
1260 const string hlBorder2 = "gfx/hud/default/border_highlighted2";
1261 void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
1263 drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
1264 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);
1265 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);
1266 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);
1267 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);
1270 void HUD_Configure_PostDraw()
1272 if(autocvar__hud_configure)
1277 HUD_Panel_UpdatePosSize()
1278 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
1280 if(highlightedPanel)
1282 panel = highlightedPanel;
1283 HUD_Panel_UpdatePosSize()
1284 HUD_Panel_HlBorder(panel_bg_border + 1.5 * hlBorderSize, '0 0.5 1', 0.25 * (1 - autocvar__menu_alpha));