1 #include "hud_config.qh"
5 #define HUD_Write(s) fputs(fh, s)
6 #define HUD_Write_Cvar(cvar) HUD_Write(strcat("seta ", cvar, " \"", cvar_string(cvar), "\"\n"))
7 #define HUD_Write_PanelCvar(cvar_suf) HUD_Write_Cvar(strcat("hud_panel_", panel.panel_name, cvar_suf))
9 void HUD_Panel_ExportCfg(string cfgname)
12 string filename = strcat("hud_", autocvar_hud_skin, "_", cfgname, ".cfg");
13 fh = fopen(filename, FILE_WRITE);
16 HUD_Write("//title \n");
17 HUD_Write("//author \n");
19 HUD_Write_Cvar("hud_skin");
20 HUD_Write_Cvar("hud_panel_bg");
21 HUD_Write_Cvar("hud_panel_bg_color");
22 HUD_Write_Cvar("hud_panel_bg_color_team");
23 HUD_Write_Cvar("hud_panel_bg_alpha");
24 HUD_Write_Cvar("hud_panel_bg_border");
25 HUD_Write_Cvar("hud_panel_bg_padding");
26 HUD_Write_Cvar("hud_panel_fg_alpha");
29 HUD_Write_Cvar("hud_dock");
30 HUD_Write_Cvar("hud_dock_color");
31 HUD_Write_Cvar("hud_dock_color_team");
32 HUD_Write_Cvar("hud_dock_alpha");
35 HUD_Write_Cvar("hud_progressbar_alpha");
36 HUD_Write_Cvar("hud_progressbar_strength_color");
37 HUD_Write_Cvar("hud_progressbar_superweapons_color");
38 HUD_Write_Cvar("hud_progressbar_shield_color");
39 HUD_Write_Cvar("hud_progressbar_health_color");
40 HUD_Write_Cvar("hud_progressbar_armor_color");
41 HUD_Write_Cvar("hud_progressbar_fuel_color");
42 HUD_Write_Cvar("hud_progressbar_nexball_color");
43 HUD_Write_Cvar("hud_progressbar_speed_color");
44 HUD_Write_Cvar("hud_progressbar_acceleration_color");
45 HUD_Write_Cvar("hud_progressbar_acceleration_neg_color");
46 HUD_Write_Cvar("hud_progressbar_vehicles_ammo1_color");
47 HUD_Write_Cvar("hud_progressbar_vehicles_ammo2_color");
50 HUD_Write_Cvar("_hud_panelorder");
53 HUD_Write_Cvar("hud_configure_grid");
54 HUD_Write_Cvar("hud_configure_grid_xsize");
55 HUD_Write_Cvar("hud_configure_grid_ysize");
58 // common cvars for all panels
59 for (int i = 0; i < hud_panels_COUNT; ++i)
61 panel = hud_panels_from(i);
63 HUD_Write_PanelCvar("");
64 HUD_Write_PanelCvar("_pos");
65 HUD_Write_PanelCvar("_size");
66 HUD_Write_PanelCvar("_bg");
67 HUD_Write_PanelCvar("_bg_color");
68 HUD_Write_PanelCvar("_bg_color_team");
69 HUD_Write_PanelCvar("_bg_alpha");
70 HUD_Write_PanelCvar("_bg_border");
71 HUD_Write_PanelCvar("_bg_padding");
73 case HUD_PANEL_WEAPONS:
74 HUD_Write_PanelCvar("_accuracy");
75 HUD_Write_PanelCvar("_label");
76 HUD_Write_PanelCvar("_label_scale");
77 HUD_Write_PanelCvar("_complainbubble");
78 HUD_Write_PanelCvar("_complainbubble_padding");
79 HUD_Write_PanelCvar("_complainbubble_time");
80 HUD_Write_PanelCvar("_complainbubble_fadetime");
81 HUD_Write_PanelCvar("_complainbubble_color_outofammo");
82 HUD_Write_PanelCvar("_complainbubble_color_donthave");
83 HUD_Write_PanelCvar("_complainbubble_color_unavailable");
84 HUD_Write_PanelCvar("_ammo");
85 HUD_Write_PanelCvar("_ammo_color");
86 HUD_Write_PanelCvar("_ammo_alpha");
87 HUD_Write_PanelCvar("_aspect");
88 HUD_Write_PanelCvar("_timeout");
89 HUD_Write_PanelCvar("_timeout_effect");
90 HUD_Write_PanelCvar("_timeout_fadebgmin");
91 HUD_Write_PanelCvar("_timeout_fadefgmin");
92 HUD_Write_PanelCvar("_timeout_speed_in");
93 HUD_Write_PanelCvar("_timeout_speed_out");
94 HUD_Write_PanelCvar("_onlyowned");
95 HUD_Write_PanelCvar("_noncurrent_alpha");
96 HUD_Write_PanelCvar("_noncurrent_scale");
99 HUD_Write_PanelCvar("_onlycurrent");
100 HUD_Write_PanelCvar("_noncurrent_alpha");
101 HUD_Write_PanelCvar("_noncurrent_scale");
102 HUD_Write_PanelCvar("_iconalign");
103 HUD_Write_PanelCvar("_progressbar");
104 HUD_Write_PanelCvar("_progressbar_name");
105 HUD_Write_PanelCvar("_progressbar_xoffset");
106 HUD_Write_PanelCvar("_text");
108 case HUD_PANEL_POWERUPS:
109 HUD_Write_PanelCvar("_iconalign");
110 HUD_Write_PanelCvar("_baralign");
111 HUD_Write_PanelCvar("_progressbar");
112 HUD_Write_PanelCvar("_text");
114 case HUD_PANEL_HEALTHARMOR:
115 HUD_Write_PanelCvar("_flip");
116 HUD_Write_PanelCvar("_iconalign");
117 HUD_Write_PanelCvar("_baralign");
118 HUD_Write_PanelCvar("_progressbar");
119 HUD_Write_PanelCvar("_progressbar_health");
120 HUD_Write_PanelCvar("_progressbar_armor");
121 HUD_Write_PanelCvar("_progressbar_gfx");
122 HUD_Write_PanelCvar("_progressbar_gfx_smooth");
123 HUD_Write_PanelCvar("_text");
125 case HUD_PANEL_NOTIFY:
126 HUD_Write_PanelCvar("_flip");
127 HUD_Write_PanelCvar("_fontsize");
128 HUD_Write_PanelCvar("_time");
129 HUD_Write_PanelCvar("_fadetime");
130 HUD_Write_PanelCvar("_icon_aspect");
132 case HUD_PANEL_TIMER:
134 case HUD_PANEL_RADAR:
135 HUD_Write_PanelCvar("_foreground_alpha");
136 HUD_Write_PanelCvar("_rotation");
137 HUD_Write_PanelCvar("_zoommode");
138 HUD_Write_PanelCvar("_scale");
139 HUD_Write_PanelCvar("_maximized_scale");
140 HUD_Write_PanelCvar("_maximized_size");
141 HUD_Write_PanelCvar("_maximized_rotation");
142 HUD_Write_PanelCvar("_maximized_zoommode");
144 case HUD_PANEL_SCORE:
145 HUD_Write_PanelCvar("_rankings");
148 HUD_Write_PanelCvar("_alreadyvoted_alpha");
150 case HUD_PANEL_MODICONS:
151 HUD_Write_PanelCvar("_ca_layout");
152 HUD_Write_PanelCvar("_dom_layout");
153 HUD_Write_PanelCvar("_freezetag_layout");
155 case HUD_PANEL_PRESSEDKEYS:
156 HUD_Write_PanelCvar("_aspect");
157 HUD_Write_PanelCvar("_attack");
159 case HUD_PANEL_ENGINEINFO:
160 HUD_Write_PanelCvar("_framecounter_time");
161 HUD_Write_PanelCvar("_framecounter_decimals");
163 case HUD_PANEL_INFOMESSAGES:
164 HUD_Write_PanelCvar("_flip");
166 case HUD_PANEL_PHYSICS:
167 HUD_Write_PanelCvar("_speed_unit_show");
168 HUD_Write_PanelCvar("_speed_max");
169 HUD_Write_PanelCvar("_speed_vertical");
170 HUD_Write_PanelCvar("_topspeed");
171 HUD_Write_PanelCvar("_topspeed_time");
172 HUD_Write_PanelCvar("_acceleration_max");
173 HUD_Write_PanelCvar("_acceleration_vertical");
174 HUD_Write_PanelCvar("_flip");
175 HUD_Write_PanelCvar("_baralign");
176 HUD_Write_PanelCvar("_progressbar");
177 HUD_Write_PanelCvar("_acceleration_progressbar_mode");
178 HUD_Write_PanelCvar("_acceleration_progressbar_scale");
179 HUD_Write_PanelCvar("_acceleration_progressbar_nonlinear");
180 HUD_Write_PanelCvar("_text");
181 HUD_Write_PanelCvar("_text_scale");
183 case HUD_PANEL_CENTERPRINT:
184 HUD_Write_PanelCvar("_align");
185 HUD_Write_PanelCvar("_flip");
186 HUD_Write_PanelCvar("_fontscale");
187 HUD_Write_PanelCvar("_time");
188 HUD_Write_PanelCvar("_fade_in");
189 HUD_Write_PanelCvar("_fade_out");
190 HUD_Write_PanelCvar("_fade_subsequent");
191 HUD_Write_PanelCvar("_fade_subsequent_passone");
192 HUD_Write_PanelCvar("_fade_subsequent_passone_minalpha");
193 HUD_Write_PanelCvar("_fade_subsequent_passtwo");
194 HUD_Write_PanelCvar("_fade_subsequent_passtwo_minalpha");
195 HUD_Write_PanelCvar("_fade_subsequent_minfontsize");
196 HUD_Write_PanelCvar("_fade_minfontsize");
198 case HUD_PANEL_ITEMSTIME:
199 HUD_Write_PanelCvar("_iconalign");
200 HUD_Write_PanelCvar("_progressbar");
201 HUD_Write_PanelCvar("_progressbar_name");
202 HUD_Write_PanelCvar("_progressbar_reduced");
203 HUD_Write_PanelCvar("_text");
204 HUD_Write_PanelCvar("_ratio");
205 HUD_Write_PanelCvar("_dynamicsize");
207 case HUD_PANEL_QUICKMENU:
208 HUD_Write_PanelCvar("_align");
213 HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
215 LOG_INFOF(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
219 LOG_INFOF(_("^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_panels_COUNT; ++i) {
239 panel = hud_panels_from(i);
240 if(!(panel.panel_configflags & PANEL_CONFIG_MAIN)) continue;
241 if(panel == highlightedPanel) continue;
242 HUD_Panel_UpdatePosSize();
243 if(!panel_enabled) continue;
245 panel_pos -= '1 1 0' * panel_bg_border;
246 panel_size += '2 2 0' * panel_bg_border;
248 if(myPos.y + mySize.y < panel_pos.y)
250 if(myPos.y > panel_pos.y + panel_size.y)
253 if(myPos.x + mySize.x < panel_pos.x)
255 if(myPos.x > panel_pos.x + panel_size.x)
258 // OK, there IS a collision.
260 myCenter.x = myPos.x + 0.5 * mySize.x;
261 myCenter.y = myPos.y + 0.5 * mySize.y;
263 targCenter.x = panel_pos.x + 0.5 * panel_size.x;
264 targCenter.y = panel_pos.y + 0.5 * panel_size.y;
266 if(myCenter.x < targCenter.x && myCenter.y < targCenter.y) // top left (of the target panel)
268 if(myPos.x + mySize.x - panel_pos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
269 myTarget.x = panel_pos.x - mySize.x;
270 else // push it upwards
271 myTarget.y = panel_pos.y - mySize.y;
273 else if(myCenter.x > targCenter.x && myCenter.y < targCenter.y) // top right
275 if(panel_pos.x + panel_size.x - myPos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
276 myTarget.x = panel_pos.x + panel_size.x;
277 else // push it upwards
278 myTarget.y = panel_pos.y - mySize.y;
280 else if(myCenter.x < targCenter.x && myCenter.y > targCenter.y) // bottom left
282 if(myPos.x + mySize.x - panel_pos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
283 myTarget.x = panel_pos.x - mySize.x;
284 else // push it downwards
285 myTarget.y = panel_pos.y + panel_size.y;
287 else if(myCenter.x > targCenter.x && myCenter.y > targCenter.y) // bottom right
289 if(panel_pos.x + panel_size.x - myPos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
290 myTarget.x = panel_pos.x + panel_size.x;
291 else // push it downwards
292 myTarget.y = panel_pos.y + panel_size.y;
294 //if(cvar("hud_configure_checkcollisions_debug"))
295 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
301 void HUD_Panel_SetPos(vector pos)
303 panel = highlightedPanel;
304 HUD_Panel_UpdatePosSize();
308 //if(cvar("hud_configure_checkcollisions_debug"))
309 //drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
311 if(autocvar_hud_configure_grid)
313 pos.x = floor((pos.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
314 pos.y = floor((pos.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
317 if(hud_configure_checkcollisions)
318 pos = HUD_Panel_CheckMove(pos, mySize);
320 pos.x = bound(0, pos.x, vid_conwidth - mySize.x);
321 pos.y = bound(0, pos.y, vid_conheight - mySize.y);
324 s = strcat(ftos(pos.x/vid_conwidth), " ", ftos(pos.y/vid_conheight));
326 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
329 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
330 vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
333 float ratio = mySize.x/mySize.y;
335 for (i = 0; i < hud_panels_COUNT; ++i) {
336 panel = hud_panels_from(i);
337 if(!(panel.panel_configflags & PANEL_CONFIG_MAIN)) continue;
338 if(panel == highlightedPanel) continue;
339 HUD_Panel_UpdatePosSize();
340 if(!panel_enabled) continue;
342 panel_pos -= '1 1 0' * panel_bg_border;
343 panel_size += '2 2 0' * panel_bg_border;
345 targEndPos = panel_pos + panel_size;
347 // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
348 if(resizeorigin.x > panel_pos.x && resizeorigin.x < targEndPos.x && resizeorigin.y > panel_pos.y && resizeorigin.y < targEndPos.y)
351 if (resizeCorner == 1)
353 // check if this panel is on our way
354 if (resizeorigin.x <= panel_pos.x)
356 if (resizeorigin.y <= panel_pos.y)
358 if (targEndPos.x <= resizeorigin.x - mySize.x)
360 if (targEndPos.y <= resizeorigin.y - mySize.y)
363 // there is a collision:
364 // detect which side of the panel we are facing is actually limiting the resizing
365 // (which side the resize direction finds for first) and reduce the size up to there
367 // dist is the distance between resizeorigin and the "analogous" point of the panel
368 // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel
369 dist.x = resizeorigin.x - targEndPos.x;
370 dist.y = resizeorigin.y - targEndPos.y;
371 if (dist.y <= 0 || dist.x / dist.y > ratio)
372 mySize.x = min(mySize.x, dist.x);
374 mySize.y = min(mySize.y, dist.y);
376 else if (resizeCorner == 2)
378 if (resizeorigin.x >= targEndPos.x)
380 if (resizeorigin.y <= panel_pos.y)
382 if (panel_pos.x >= resizeorigin.x + mySize.x)
384 if (targEndPos.y <= resizeorigin.y - mySize.y)
387 dist.x = panel_pos.x - resizeorigin.x;
388 dist.y = resizeorigin.y - targEndPos.y;
389 if (dist.y <= 0 || dist.x / dist.y > ratio)
390 mySize.x = min(mySize.x, dist.x);
392 mySize.y = min(mySize.y, dist.y);
394 else if (resizeCorner == 3)
396 if (resizeorigin.x <= panel_pos.x)
398 if (resizeorigin.y >= targEndPos.y)
400 if (targEndPos.x <= resizeorigin.x - mySize.x)
402 if (panel_pos.y >= resizeorigin.y + mySize.y)
405 dist.x = resizeorigin.x - targEndPos.x;
406 dist.y = panel_pos.y - resizeorigin.y;
407 if (dist.y <= 0 || dist.x / dist.y > ratio)
408 mySize.x = min(mySize.x, dist.x);
410 mySize.y = min(mySize.y, dist.y);
412 else if (resizeCorner == 4)
414 if (resizeorigin.x >= targEndPos.x)
416 if (resizeorigin.y >= targEndPos.y)
418 if (panel_pos.x >= resizeorigin.x + mySize.x)
420 if (panel_pos.y >= resizeorigin.y + mySize.y)
423 dist.x = panel_pos.x - resizeorigin.x;
424 dist.y = panel_pos.y - resizeorigin.y;
425 if (dist.y <= 0 || dist.x / dist.y > ratio)
426 mySize.x = min(mySize.x, dist.x);
428 mySize.y = min(mySize.y, dist.y);
430 //if(cvar("hud_configure_checkcollisions_debug"))
431 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
437 void HUD_Panel_SetPosSize(vector mySize)
439 panel = highlightedPanel;
440 HUD_Panel_UpdatePosSize();
441 vector resizeorigin = panel_click_resizeorigin;
444 // minimum panel size cap
445 mySize.x = max(0.025 * vid_conwidth, mySize.x);
446 mySize.y = max(0.025 * vid_conheight, mySize.y);
448 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.
450 mySize.x = max(17 * autocvar_con_chatsize, mySize.x);
451 mySize.y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize.y);
454 // collision testing|
455 // -----------------+
457 // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
458 if(resizeCorner == 1) {
459 myPos.x = resizeorigin.x - mySize.x;
460 myPos.y = resizeorigin.y - mySize.y;
461 } else if(resizeCorner == 2) {
462 myPos.x = resizeorigin.x;
463 myPos.y = resizeorigin.y - mySize.y;
464 } else if(resizeCorner == 3) {
465 myPos.x = resizeorigin.x - mySize.x;
466 myPos.y = resizeorigin.y;
467 } else { // resizeCorner == 4
468 myPos.x = resizeorigin.x;
469 myPos.y = resizeorigin.y;
472 // left/top screen edges
474 mySize.x = mySize.x + myPos.x;
476 mySize.y = mySize.y + myPos.y;
478 // bottom/right screen edges
479 if(myPos.x + mySize.x > vid_conwidth)
480 mySize.x = vid_conwidth - myPos.x;
481 if(myPos.y + mySize.y > vid_conheight)
482 mySize.y = vid_conheight - myPos.y;
484 //if(cvar("hud_configure_checkcollisions_debug"))
485 //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
487 // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
488 if(autocvar_hud_configure_grid)
490 mySize.x = floor((mySize.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
491 mySize.y = floor((mySize.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
494 if(hud_configure_checkcollisions)
495 mySize = HUD_Panel_CheckResize(mySize, resizeorigin);
497 // 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)
498 mySize.x = max(0.025 * vid_conwidth, mySize.x);
499 mySize.y = max(0.025 * vid_conheight, mySize.y);
501 // do another pos check, as size might have changed by now
502 if(resizeCorner == 1) {
503 myPos.x = resizeorigin.x - mySize.x;
504 myPos.y = resizeorigin.y - mySize.y;
505 } else if(resizeCorner == 2) {
506 myPos.x = resizeorigin.x;
507 myPos.y = resizeorigin.y - mySize.y;
508 } else if(resizeCorner == 3) {
509 myPos.x = resizeorigin.x - mySize.x;
510 myPos.y = resizeorigin.y;
511 } else { // resizeCorner == 4
512 myPos.x = resizeorigin.x;
513 myPos.y = resizeorigin.y;
516 //if(cvar("hud_configure_checkcollisions_debug"))
517 //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
520 s = strcat(ftos(mySize.x/vid_conwidth), " ", ftos(mySize.y/vid_conheight));
521 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
523 s = strcat(ftos(myPos.x/vid_conwidth), " ", ftos(myPos.y/vid_conheight));
524 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
527 float pressed_key_time;
528 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
529 void HUD_Panel_Arrow_Action(float nPrimary)
531 if(!highlightedPanel)
534 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
537 if(autocvar_hud_configure_grid)
539 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
541 if (hudShiftState & S_SHIFT)
542 step = hud_configure_realGridSize.y;
544 step = 2 * hud_configure_realGridSize.y;
548 if (hudShiftState & S_SHIFT)
549 step = hud_configure_realGridSize.x;
551 step = 2 * hud_configure_realGridSize.x;
556 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
557 step = vid_conheight;
560 if (hudShiftState & S_SHIFT)
561 step = (step / 256); // more precision
563 step = (step / 64) * (1 + 2 * (time - pressed_key_time));
566 panel = highlightedPanel;
567 HUD_Panel_UpdatePosSize();
569 highlightedPanel_initial_pos = panel_pos;
570 highlightedPanel_initial_size = panel_size;
572 if (hudShiftState & S_ALT) // resize
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);
612 if(nPrimary == K_UPARROW)
614 else if(nPrimary == K_DOWNARROW)
616 else if(nPrimary == K_LEFTARROW)
618 else // if(nPrimary == K_RIGHTARROW)
621 HUD_Panel_SetPos(pos);
624 panel = highlightedPanel;
625 HUD_Panel_UpdatePosSize();
627 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
630 panel_pos_backup = highlightedPanel_initial_pos;
631 panel_size_backup = highlightedPanel_initial_size;
632 highlightedPanel_backup = highlightedPanel;
636 void HUD_Panel_EnableMenu();
637 entity tab_panels[hud_panels_MAX];
639 vector tab_panel_pos;
641 void HUD_Panel_FirstInDrawQ(float id);
642 void reset_tab_panels()
645 for(i = 0; i < hud_panels_COUNT; ++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 bool hit_con_bind = false;
682 for (i = 0; i < keys; ++i)
684 if(nPrimary == stof(argv(i)))
688 if(bInputType == 0) {
689 if(nPrimary == K_ALT) hudShiftState |= S_ALT;
690 if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
691 if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
693 else if(bInputType == 1) {
694 if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
695 if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
696 if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
699 if(nPrimary == K_CTRL)
701 if (bInputType == 1) //ctrl has been released
705 //switch to selected panel
706 highlightedPanel = tab_panel;
707 highlightedAction = 0;
708 HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id);
715 if(nPrimary == K_MOUSE1)
717 if(bInputType == 0) // key pressed
718 mouseClicked |= S_MOUSE1;
719 else if(bInputType == 1) // key released
720 mouseClicked -= (mouseClicked & S_MOUSE1);
722 else if(nPrimary == K_MOUSE2)
724 if(bInputType == 0) // key pressed
725 mouseClicked |= S_MOUSE2;
726 else if(bInputType == 1) // key released
727 mouseClicked -= (mouseClicked & S_MOUSE2);
729 else if(nPrimary == K_ESCAPE)
734 localcmd("menu_showhudexit\n");
736 else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
741 cvar_set("_hud_configure", "0");
743 else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel
745 if (bInputType == 1 || mouseClicked)
748 // FIXME minor bug: if a panel is highlighted, has the same pos_x and
749 // lays in the same level of another panel then the next consecutive
750 // CTRL TAB presses will reselect once more the highlighted panel
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_posX;
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_posX = tab_panel_pos.x;
786 for(i = 0; i < hud_panels_COUNT; ++i)
788 panel = hud_panels_from(i);
789 if(!(panel.panel_configflags & PANEL_CONFIG_MAIN))
791 if (panel == tab_panels[i] || panel == starting_panel)
793 HUD_Panel_UpdatePosSize();
794 if (panel_pos.y >= level && (panel_pos.y - level) < level_height)
795 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)) )
796 || ( 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)) ) )
799 tab_panel_pos = candidate_pos = panel_pos;
804 if (k == LEVELS_NUM) //tab_panel not found
812 starting_panel = old_tab_panel;
813 old_tab_panel = world;
814 goto find_tab_panel; //u must find tab_panel!
818 level = (level + level_height) % vid_conheight;
820 candidate_pos.x = vid_conwidth;
824 level = (level - level_height) % vid_conheight;
825 start_posX = vid_conwidth;
830 tab_panels[tab_panel.panel_id] = tab_panel;
832 else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
834 if (bInputType == 1 || mouseClicked)
837 if (highlightedPanel)
838 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
840 cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
842 else if(nPrimary == 'c' && hudShiftState & S_CTRL) // copy highlighted panel size
844 if (bInputType == 1 || mouseClicked)
847 if (highlightedPanel)
849 panel = highlightedPanel;
850 HUD_Panel_UpdatePosSize();
851 panel_size_copied = panel_size;
854 else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
856 if (bInputType == 1 || mouseClicked)
859 if (panel_size_copied == '0 0 0' || !highlightedPanel)
862 panel = highlightedPanel;
863 HUD_Panel_UpdatePosSize();
865 // reduce size if it'd go beyond screen boundaries
866 vector tmp_size = panel_size_copied;
867 if (panel_pos.x + panel_size_copied.x > vid_conwidth)
868 tmp_size.x = vid_conwidth - panel_pos.x;
869 if (panel_pos.y + panel_size_copied.y > vid_conheight)
870 tmp_size.y = vid_conheight - panel_pos.y;
872 if (panel_size == tmp_size)
876 panel_pos_backup = panel_pos;
877 panel_size_backup = panel_size;
878 highlightedPanel_backup = highlightedPanel;
880 s = strcat(ftos(tmp_size.x/vid_conwidth), " ", ftos(tmp_size.y/vid_conheight));
881 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
883 else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
885 if (bInputType == 1 || mouseClicked)
887 //restore previous values
888 if (highlightedPanel_backup)
890 s = strcat(ftos(panel_pos_backup.x/vid_conwidth), " ", ftos(panel_pos_backup.y/vid_conheight));
891 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
892 s = strcat(ftos(panel_size_backup.x/vid_conwidth), " ", ftos(panel_size_backup.y/vid_conheight));
893 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
894 highlightedPanel_backup = world;
897 else if(nPrimary == 's' && hudShiftState & S_CTRL) // save config
899 if (bInputType == 1 || mouseClicked)
901 localcmd("hud save myconfig\n");
903 else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
907 pressed_key_time = 0;
910 else if (pressed_key_time == 0)
911 pressed_key_time = time;
914 HUD_Panel_Arrow_Action(nPrimary); //move or resize panel
916 else if(nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
920 if (highlightedPanel)
921 HUD_Panel_EnableMenu();
923 else if(hit_con_bind || nPrimary == K_PAUSE)
929 float HUD_Panel_Check_Mouse_Pos(float allow_move)
932 while(j < hud_panels_COUNT)
937 panel = hud_panels_from(i);
938 if(!(panel.panel_configflags & PANEL_CONFIG_MAIN)) continue;
939 HUD_Panel_UpdatePosSize();
941 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
944 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)
948 // resize from topleft border
949 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)
953 // resize from topright border
954 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)
958 // resize from bottomleft border
959 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)
963 // resize from bottomright border
964 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)
972 // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else)
973 void HUD_Panel_FirstInDrawQ(float id)
977 // find out where in the array our current id is, save into place
978 for(i = 0; i < hud_panels_COUNT; ++i)
980 if(panel_order[i] == id)
986 // place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
988 place = hud_panels_COUNT - 1;
990 // move all ids up by one step in the array until "place"
991 for(i = place; i > 0; --i)
993 panel_order[i] = panel_order[i-1];
995 // now save the new top id
998 // let's save them into the cvar by some strcat trickery
1000 for(i = 0; i < hud_panels_COUNT; ++i)
1002 s = strcat(s, ftos(panel_order[i]), " ");
1004 cvar_set("_hud_panelorder", s);
1005 if(hud_panelorder_prev)
1006 strunzone(hud_panelorder_prev);
1007 hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
1010 void HUD_Panel_Highlight(float allow_move)
1014 while(j < hud_panels_COUNT)
1019 panel = hud_panels_from(i);
1020 if(!(panel.panel_configflags & PANEL_CONFIG_MAIN))
1022 HUD_Panel_UpdatePosSize();
1024 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
1027 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)
1029 highlightedPanel = hud_panels_from(i);
1030 HUD_Panel_FirstInDrawQ(i);
1031 highlightedAction = 1;
1032 panel_click_distance = mousepos - panel_pos;
1035 // resize from topleft border
1036 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)
1038 highlightedPanel = hud_panels_from(i);
1039 HUD_Panel_FirstInDrawQ(i);
1040 highlightedAction = 2;
1042 panel_click_distance = mousepos - panel_pos;
1043 panel_click_resizeorigin = panel_pos + panel_size;
1046 // resize from topright border
1047 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)
1049 highlightedPanel = hud_panels_from(i);
1050 HUD_Panel_FirstInDrawQ(i);
1051 highlightedAction = 2;
1053 panel_click_distance.x = panel_size.x - mousepos.x + panel_pos.x;
1054 panel_click_distance.y = mousepos.y - panel_pos.y;
1055 panel_click_resizeorigin = panel_pos + eY * panel_size.y;
1058 // resize from bottomleft border
1059 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)
1061 highlightedPanel = hud_panels_from(i);
1062 HUD_Panel_FirstInDrawQ(i);
1063 highlightedAction = 2;
1065 panel_click_distance.x = mousepos.x - panel_pos.x;
1066 panel_click_distance.y = panel_size.y - mousepos.y + panel_pos.y;
1067 panel_click_resizeorigin = panel_pos + eX * panel_size.x;
1070 // resize from bottomright border
1071 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)
1073 highlightedPanel = hud_panels_from(i);
1074 HUD_Panel_FirstInDrawQ(i);
1075 highlightedAction = 2;
1077 panel_click_distance = panel_size - mousepos + panel_pos;
1078 panel_click_resizeorigin = panel_pos;
1082 highlightedPanel = world;
1083 highlightedAction = 0;
1086 void HUD_Panel_EnableMenu()
1089 localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
1091 float mouse_over_panel;
1092 void HUD_Panel_Mouse()
1094 if(autocvar__menu_alpha == 1)
1097 if (!autocvar_hud_cursormode)
1099 mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
1101 mousepos.x = bound(0, mousepos.x, vid_conwidth);
1102 mousepos.y = bound(0, mousepos.y, vid_conheight);
1107 if(prevMouseClicked == 0)
1111 //stop ctrl-tab selection
1115 HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
1116 // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
1117 if (highlightedPanel)
1119 highlightedPanel_initial_pos = panel_pos;
1120 highlightedPanel_initial_size = panel_size;
1122 // doubleclick check
1123 if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel && prevMouseClickedPos == mousepos)
1125 mouseClicked = 0; // to prevent spam, I guess.
1126 HUD_Panel_EnableMenu();
1130 if (mouseClicked & S_MOUSE1)
1132 prevMouseClickedTime = time;
1133 prevMouseClickedPos = mousepos;
1135 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(mouseClicked & S_MOUSE1);
1140 panel = highlightedPanel;
1141 HUD_Panel_UpdatePosSize();
1144 if (highlightedPanel)
1146 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1147 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
1149 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
1151 panel_pos_backup = highlightedPanel_initial_pos;
1152 panel_size_backup = highlightedPanel_initial_size;
1153 highlightedPanel_backup = highlightedPanel;
1156 // in case the clicked panel is inside another panel and we aren't
1157 // moving it, avoid the immediate "fix" of its position/size
1158 // (often unwanted and hateful) by disabling collisions check
1159 hud_configure_checkcollisions = false;
1162 if(highlightedAction == 1)
1163 HUD_Panel_SetPos(mousepos - panel_click_distance);
1164 else if(highlightedAction == 2)
1166 vector mySize = '0 0 0';
1167 if(resizeCorner == 1) {
1168 mySize.x = panel_click_resizeorigin.x - (mousepos.x - panel_click_distance.x);
1169 mySize.y = panel_click_resizeorigin.y - (mousepos.y - panel_click_distance.y);
1170 } else if(resizeCorner == 2) {
1171 mySize.x = mousepos.x + panel_click_distance.x - panel_click_resizeorigin.x;
1172 mySize.y = panel_click_distance.y + panel_click_resizeorigin.y - mousepos.y;
1173 } else if(resizeCorner == 3) {
1174 mySize.x = panel_click_resizeorigin.x + panel_click_distance.x - mousepos.x;
1175 mySize.y = mousepos.y + panel_click_distance.y - panel_click_resizeorigin.y;
1176 } else { // resizeCorner == 4
1177 mySize.x = mousepos.x - (panel_click_resizeorigin.x - panel_click_distance.x);
1178 mySize.y = mousepos.y - (panel_click_resizeorigin.y - panel_click_distance.y);
1180 HUD_Panel_SetPosSize(mySize);
1185 if(prevMouseClicked)
1186 highlightedAction = 0;
1187 if(menu_enabled == 2)
1188 mouse_over_panel = 0;
1190 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true);
1191 if (mouse_over_panel && !tab_panel)
1192 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1194 // draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
1195 const vector cursorsize = '32 32 0';
1196 float cursor_alpha = 1 - autocvar__menu_alpha;
1198 if(!mouse_over_panel)
1199 drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1200 else if(mouse_over_panel == 1)
1201 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1202 else if(mouse_over_panel == 2)
1203 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1205 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1207 prevMouseClicked = mouseClicked;
1209 void HUD_Configure_DrawGrid()
1212 if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
1214 hud_configure_gridSize.x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
1215 hud_configure_gridSize.y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
1216 hud_configure_realGridSize.x = hud_configure_gridSize.x * vid_conwidth;
1217 hud_configure_realGridSize.y = hud_configure_gridSize.y * vid_conheight;
1220 s = eX + eY * vid_conheight;
1221 for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
1222 drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1224 s = eY + eX * vid_conwidth;
1225 for(i = 1; i < 1/hud_configure_gridSize.y; ++i)
1226 drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1230 float _menu_alpha_prev;
1231 void HUD_Configure_Frame()
1234 if(autocvar__hud_configure)
1236 if(isdemo() || intermission == 2)
1238 HUD_Configure_Exit_Force();
1242 if(!hud_configure_prev)
1244 if(autocvar_hud_cursormode)
1247 for(i = hud_panels_COUNT - 1; i >= 0; --i)
1248 hud_panels_from(panel_order[i]).update_time = time;
1251 // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
1252 if(autocvar__menu_alpha != _menu_alpha_prev)
1254 if(autocvar__menu_alpha == 0)
1256 _menu_alpha_prev = autocvar__menu_alpha;
1259 HUD_Configure_DrawGrid();
1261 else if(hud_configure_prev)
1265 if(autocvar_hud_cursormode)
1270 const float hlBorderSize = 2;
1271 const string hlBorder = "gfx/hud/default/border_highlighted";
1272 const string hlBorder2 = "gfx/hud/default/border_highlighted2";
1273 void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
1275 drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
1276 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);
1277 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);
1278 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);
1279 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);
1282 void HUD_Configure_PostDraw()
1284 if(autocvar__hud_configure)
1289 HUD_Panel_UpdatePosSize();
1290 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
1292 if(highlightedPanel)
1294 panel = highlightedPanel;
1295 HUD_Panel_UpdatePosSize();
1296 HUD_Panel_HlBorder(panel_bg_border * hlBorderSize, '0 0.5 1', 0.4 * (1 - autocvar__menu_alpha));