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("_label_scale");
71 HUD_Write_PanelCvar_q("_complainbubble");
72 HUD_Write_PanelCvar_q("_complainbubble_padding");
73 HUD_Write_PanelCvar_q("_complainbubble_time");
74 HUD_Write_PanelCvar_q("_complainbubble_fadetime");
75 HUD_Write_PanelCvar_q("_complainbubble_color_outofammo");
76 HUD_Write_PanelCvar_q("_complainbubble_color_donthave");
77 HUD_Write_PanelCvar_q("_complainbubble_color_unavailable");
78 HUD_Write_PanelCvar_q("_ammo");
79 HUD_Write_PanelCvar_q("_ammo_color");
80 HUD_Write_PanelCvar_q("_ammo_alpha");
81 HUD_Write_PanelCvar_q("_aspect");
82 HUD_Write_PanelCvar_q("_timeout");
83 HUD_Write_PanelCvar_q("_timeout_effect");
84 HUD_Write_PanelCvar_q("_timeout_fadebgmin");
85 HUD_Write_PanelCvar_q("_timeout_fadefgmin");
86 HUD_Write_PanelCvar_q("_timeout_speed_in");
87 HUD_Write_PanelCvar_q("_timeout_speed_out");
88 HUD_Write_PanelCvar_q("_onlyowned");
91 HUD_Write_PanelCvar_q("_onlycurrent");
92 HUD_Write_PanelCvar_q("_noncurrent_alpha");
93 HUD_Write_PanelCvar_q("_noncurrent_scale");
94 HUD_Write_PanelCvar_q("_iconalign");
95 HUD_Write_PanelCvar_q("_progressbar");
96 HUD_Write_PanelCvar_q("_progressbar_name");
97 HUD_Write_PanelCvar_q("_progressbar_xoffset");
98 HUD_Write_PanelCvar_q("_text");
100 case HUD_PANEL_POWERUPS:
101 HUD_Write_PanelCvar_q("_flip");
102 HUD_Write_PanelCvar_q("_iconalign");
103 HUD_Write_PanelCvar_q("_baralign");
104 HUD_Write_PanelCvar_q("_progressbar");
105 HUD_Write_PanelCvar_q("_progressbar_strength");
106 HUD_Write_PanelCvar_q("_progressbar_shield");
107 HUD_Write_PanelCvar_q("_text");
109 case HUD_PANEL_HEALTHARMOR:
110 HUD_Write_PanelCvar_q("_flip");
111 HUD_Write_PanelCvar_q("_iconalign");
112 HUD_Write_PanelCvar_q("_baralign");
113 HUD_Write_PanelCvar_q("_progressbar");
114 HUD_Write_PanelCvar_q("_progressbar_health");
115 HUD_Write_PanelCvar_q("_progressbar_armor");
116 HUD_Write_PanelCvar_q("_progressbar_gfx");
117 HUD_Write_PanelCvar_q("_progressbar_gfx_smooth");
118 HUD_Write_PanelCvar_q("_text");
120 case HUD_PANEL_NOTIFY:
121 HUD_Write_PanelCvar_q("_flip");
122 HUD_Write_PanelCvar_q("_fontsize");
123 HUD_Write_PanelCvar_q("_time");
124 HUD_Write_PanelCvar_q("_fadetime");
125 HUD_Write_PanelCvar_q("_icon_aspect");
127 case HUD_PANEL_TIMER:
128 HUD_Write_PanelCvar_q("_increment");
130 case HUD_PANEL_RADAR:
131 HUD_Write_PanelCvar_q("_foreground_alpha");
132 HUD_Write_PanelCvar_q("_rotation");
133 HUD_Write_PanelCvar_q("_zoommode");
134 HUD_Write_PanelCvar_q("_scale");
135 HUD_Write_PanelCvar_q("_maximized_scale");
136 HUD_Write_PanelCvar_q("_maximized_size");
137 HUD_Write_PanelCvar_q("_maximized_rotation");
138 HUD_Write_PanelCvar_q("_maximized_zoommode");
140 case HUD_PANEL_SCORE:
141 HUD_Write_PanelCvar_q("_rankings");
144 HUD_Write_PanelCvar_q("_alreadyvoted_alpha");
146 case HUD_PANEL_MODICONS:
147 HUD_Write_PanelCvar_q("_ca_layout");
148 HUD_Write_PanelCvar_q("_dom_layout");
149 HUD_Write_PanelCvar_q("_freezetag_layout");
151 case HUD_PANEL_PRESSEDKEYS:
152 HUD_Write_PanelCvar_q("_aspect");
153 HUD_Write_PanelCvar_q("_attack");
155 case HUD_PANEL_ENGINEINFO:
156 HUD_Write_PanelCvar_q("_framecounter_time");
157 HUD_Write_PanelCvar_q("_framecounter_decimals");
159 case HUD_PANEL_INFOMESSAGES:
160 HUD_Write_PanelCvar_q("_flip");
162 case HUD_PANEL_PHYSICS:
163 HUD_Write_PanelCvar_q("_speed_unit");
164 HUD_Write_PanelCvar_q("_speed_unit_show");
165 HUD_Write_PanelCvar_q("_speed_max");
166 HUD_Write_PanelCvar_q("_speed_vertical");
167 HUD_Write_PanelCvar_q("_topspeed");
168 HUD_Write_PanelCvar_q("_topspeed_time");
169 HUD_Write_PanelCvar_q("_acceleration_max");
170 HUD_Write_PanelCvar_q("_acceleration_vertical");
171 HUD_Write_PanelCvar_q("_flip");
172 HUD_Write_PanelCvar_q("_baralign");
173 HUD_Write_PanelCvar_q("_progressbar");
174 HUD_Write_PanelCvar_q("_progressbar_acceleration_mode");
175 HUD_Write_PanelCvar_q("_progressbar_acceleration_scale");
176 HUD_Write_PanelCvar_q("_progressbar_acceleration_nonlinear");
177 HUD_Write_PanelCvar_q("_text");
178 HUD_Write_PanelCvar_q("_text_scale");
180 case HUD_PANEL_CENTERPRINT:
181 HUD_Write_PanelCvar_q("_align");
182 HUD_Write_PanelCvar_q("_flip");
183 HUD_Write_PanelCvar_q("_fontscale");
184 HUD_Write_PanelCvar_q("_time");
185 HUD_Write_PanelCvar_q("_fade_in");
186 HUD_Write_PanelCvar_q("_fade_out");
187 HUD_Write_PanelCvar_q("_fade_subsequent");
188 HUD_Write_PanelCvar_q("_fade_subsequent_passone");
189 HUD_Write_PanelCvar_q("_fade_subsequent_passone_minalpha");
190 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo");
191 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo_minalpha");
192 HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
193 HUD_Write_PanelCvar_q("_fade_minfontsize");
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)
220 vector myCenter, targCenter;
221 vector myTarget = myPos;
223 for (i = 0; i < HUD_PANEL_NUM; ++i) {
224 panel = hud_panel[i];
225 if(panel == highlightedPanel) continue;
226 HUD_Panel_UpdatePosSize();
227 if(!panel_enabled) continue;
229 panel_pos -= '1 1 0' * panel_bg_border;
230 panel_size += '2 2 0' * panel_bg_border;
232 if(myPos.y + mySize.y < panel_pos.y)
234 if(myPos.y > panel_pos.y + panel_size.y)
237 if(myPos.x + mySize.x < panel_pos.x)
239 if(myPos.x > panel_pos.x + panel_size.x)
242 // OK, there IS a collision.
244 myCenter_x = myPos.x + 0.5 * mySize.x;
245 myCenter_y = myPos.y + 0.5 * mySize.y;
247 targCenter_x = panel_pos.x + 0.5 * panel_size.x;
248 targCenter_y = panel_pos.y + 0.5 * panel_size.y;
250 if(myCenter.x < targCenter.x && myCenter.y < targCenter.y) // top left (of the target panel)
252 if(myPos.x + mySize.x - panel_pos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
253 myTarget_x = panel_pos.x - mySize.x;
254 else // push it upwards
255 myTarget_y = panel_pos.y - mySize.y;
257 else if(myCenter.x > targCenter.x && myCenter.y < targCenter.y) // top right
259 if(panel_pos.x + panel_size.x - myPos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
260 myTarget_x = panel_pos.x + panel_size.x;
261 else // push it upwards
262 myTarget_y = panel_pos.y - mySize.y;
264 else if(myCenter.x < targCenter.x && myCenter.y > targCenter.y) // bottom left
266 if(myPos.x + mySize.x - panel_pos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
267 myTarget_x = panel_pos.x - mySize.x;
268 else // push it downwards
269 myTarget_y = panel_pos.y + panel_size.y;
271 else if(myCenter.x > targCenter.x && myCenter.y > targCenter.y) // bottom right
273 if(panel_pos.x + panel_size.x - myPos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
274 myTarget_x = panel_pos.x + panel_size.x;
275 else // push it downwards
276 myTarget_y = panel_pos.y + panel_size.y;
278 //if(cvar("hud_configure_checkcollisions_debug"))
279 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
285 void HUD_Panel_SetPos(vector pos)
287 panel = highlightedPanel;
288 HUD_Panel_UpdatePosSize();
292 //if(cvar("hud_configure_checkcollisions_debug"))
293 //drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
295 if(autocvar_hud_configure_grid)
297 pos_x = floor((pos.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
298 pos_y = floor((pos.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
301 if(hud_configure_checkcollisions)
302 pos = HUD_Panel_CheckMove(pos, mySize);
304 pos_x = bound(0, pos.x, vid_conwidth - mySize.x);
305 pos_y = bound(0, pos.y, vid_conheight - mySize.y);
308 s = strcat(ftos(pos.x/vid_conwidth), " ", ftos(pos.y/vid_conheight));
310 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
313 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
314 vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
321 ratio = mySize.x/mySize.y;
323 for (i = 0; i < HUD_PANEL_NUM; ++i) {
324 panel = hud_panel[i];
325 if(panel == highlightedPanel) continue;
326 HUD_Panel_UpdatePosSize();
327 if(!panel_enabled) continue;
329 panel_pos -= '1 1 0' * panel_bg_border;
330 panel_size += '2 2 0' * panel_bg_border;
332 targEndPos = panel_pos + panel_size;
334 // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
335 if(resizeorigin.x > panel_pos.x && resizeorigin.x < targEndPos.x && resizeorigin.y > panel_pos.y && resizeorigin.y < targEndPos.y)
338 if (resizeCorner == 1)
340 // check if this panel is on our way
341 if (resizeorigin.x <= panel_pos.x)
343 if (resizeorigin.y <= panel_pos.y)
345 if (targEndPos.x <= resizeorigin.x - mySize.x)
347 if (targEndPos.y <= resizeorigin.y - mySize.y)
350 // there is a collision:
351 // detect which side of the panel we are facing is actually limiting the resizing
352 // (which side the resize direction finds for first) and reduce the size up to there
354 // dist is the distance between resizeorigin and the "analogous" point of the panel
355 // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel
356 dist_x = resizeorigin.x - targEndPos.x;
357 dist_y = resizeorigin.y - targEndPos.y;
358 if (dist.y <= 0 || dist.x / dist.y > ratio)
359 mySize_x = min(mySize.x, dist.x);
361 mySize_y = min(mySize.y, dist.y);
363 else if (resizeCorner == 2)
365 if (resizeorigin.x >= targEndPos.x)
367 if (resizeorigin.y <= panel_pos.y)
369 if (panel_pos.x >= resizeorigin.x + mySize.x)
371 if (targEndPos.y <= resizeorigin.y - mySize.y)
374 dist_x = panel_pos.x - resizeorigin.x;
375 dist_y = resizeorigin.y - targEndPos.y;
376 if (dist.y <= 0 || dist.x / dist.y > ratio)
377 mySize_x = min(mySize.x, dist.x);
379 mySize_y = min(mySize.y, dist.y);
381 else if (resizeCorner == 3)
383 if (resizeorigin.x <= panel_pos.x)
385 if (resizeorigin.y >= targEndPos.y)
387 if (targEndPos.x <= resizeorigin.x - mySize.x)
389 if (panel_pos.y >= resizeorigin.y + mySize.y)
392 dist_x = resizeorigin.x - targEndPos.x;
393 dist_y = panel_pos.y - resizeorigin.y;
394 if (dist.y <= 0 || dist.x / dist.y > ratio)
395 mySize_x = min(mySize.x, dist.x);
397 mySize_y = min(mySize.y, dist.y);
399 else if (resizeCorner == 4)
401 if (resizeorigin.x >= targEndPos.x)
403 if (resizeorigin.y >= targEndPos.y)
405 if (panel_pos.x >= resizeorigin.x + mySize.x)
407 if (panel_pos.y >= resizeorigin.y + mySize.y)
410 dist_x = panel_pos.x - resizeorigin.x;
411 dist_y = panel_pos.y - resizeorigin.y;
412 if (dist.y <= 0 || dist.x / dist.y > ratio)
413 mySize_x = min(mySize.x, dist.x);
415 mySize_y = min(mySize.y, dist.y);
417 //if(cvar("hud_configure_checkcollisions_debug"))
418 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
424 void HUD_Panel_SetPosSize(vector mySize)
426 panel = highlightedPanel;
427 HUD_Panel_UpdatePosSize();
429 resizeorigin = panel_click_resizeorigin;
432 // minimum panel size cap
433 mySize_x = max(0.025 * vid_conwidth, mySize.x);
434 mySize_y = max(0.025 * vid_conheight, mySize.y);
436 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.
438 mySize_x = max(17 * autocvar_con_chatsize, mySize.x);
439 mySize_y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize.y);
442 // collision testing|
443 // -----------------+
445 // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
446 if(resizeCorner == 1) {
447 myPos_x = resizeorigin.x - mySize.x;
448 myPos_y = resizeorigin.y - mySize.y;
449 } else if(resizeCorner == 2) {
450 myPos_x = resizeorigin.x;
451 myPos_y = resizeorigin.y - mySize.y;
452 } else if(resizeCorner == 3) {
453 myPos_x = resizeorigin.x - mySize.x;
454 myPos_y = resizeorigin.y;
455 } else { // resizeCorner == 4
456 myPos_x = resizeorigin.x;
457 myPos_y = resizeorigin.y;
460 // left/top screen edges
462 mySize_x = mySize.x + myPos.x;
464 mySize_y = mySize.y + myPos.y;
466 // bottom/right screen edges
467 if(myPos.x + mySize.x > vid_conwidth)
468 mySize_x = vid_conwidth - myPos.x;
469 if(myPos.y + mySize.y > vid_conheight)
470 mySize_y = vid_conheight - myPos.y;
472 //if(cvar("hud_configure_checkcollisions_debug"))
473 //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
475 // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
476 if(autocvar_hud_configure_grid)
478 mySize_x = floor((mySize.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
479 mySize_y = floor((mySize.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
482 if(hud_configure_checkcollisions)
483 mySize = HUD_Panel_CheckResize(mySize, resizeorigin);
485 // 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)
486 mySize_x = max(0.025 * vid_conwidth, mySize.x);
487 mySize_y = max(0.025 * vid_conheight, mySize.y);
489 // do another pos check, as size might have changed by now
490 if(resizeCorner == 1) {
491 myPos_x = resizeorigin.x - mySize.x;
492 myPos_y = resizeorigin.y - mySize.y;
493 } else if(resizeCorner == 2) {
494 myPos_x = resizeorigin.x;
495 myPos_y = resizeorigin.y - mySize.y;
496 } else if(resizeCorner == 3) {
497 myPos_x = resizeorigin.x - mySize.x;
498 myPos_y = resizeorigin.y;
499 } else { // resizeCorner == 4
500 myPos_x = resizeorigin.x;
501 myPos_y = resizeorigin.y;
504 //if(cvar("hud_configure_checkcollisions_debug"))
505 //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
508 s = strcat(ftos(mySize.x/vid_conwidth), " ", ftos(mySize.y/vid_conheight));
509 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
511 s = strcat(ftos(myPos.x/vid_conwidth), " ", ftos(myPos.y/vid_conheight));
512 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
515 float pressed_key_time;
516 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
517 void HUD_Panel_Arrow_Action(float nPrimary)
519 if(!highlightedPanel)
522 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
525 if(autocvar_hud_configure_grid)
527 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
529 if (hudShiftState & S_SHIFT)
530 step = hud_configure_realGridSize.y;
532 step = 2 * hud_configure_realGridSize.y;
536 if (hudShiftState & S_SHIFT)
537 step = hud_configure_realGridSize.x;
539 step = 2 * hud_configure_realGridSize.x;
544 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
545 step = vid_conheight;
548 if (hudShiftState & S_SHIFT)
549 step = (step / 256); // more precision
551 step = (step / 64) * (1 + 2 * (time - pressed_key_time));
554 panel = highlightedPanel;
555 HUD_Panel_UpdatePosSize();
557 highlightedPanel_initial_pos = panel_pos;
558 highlightedPanel_initial_size = panel_size;
560 if (hudShiftState & S_ALT) // resize
562 highlightedAction = 1;
563 if(nPrimary == K_UPARROW)
565 else if(nPrimary == K_RIGHTARROW)
567 else if(nPrimary == K_LEFTARROW)
569 else // if(nPrimary == K_DOWNARROW)
572 // ctrl+arrow reduces the size, instead of increasing it
573 // Note that ctrl disables collisions check too, but it's fine
574 // since we don't collide with anything reducing the size
575 if (hudShiftState & S_CTRL) {
577 resizeCorner = 5 - resizeCorner;
582 panel_click_resizeorigin = panel_pos;
583 if(resizeCorner == 1) {
584 panel_click_resizeorigin += mySize;
586 } else if(resizeCorner == 2) {
587 panel_click_resizeorigin.y += mySize.y;
589 } else if(resizeCorner == 3) {
590 panel_click_resizeorigin.x += mySize.x;
592 } else { // resizeCorner == 4
595 HUD_Panel_SetPosSize(mySize);
599 highlightedAction = 2;
602 if(nPrimary == K_UPARROW)
604 else if(nPrimary == K_DOWNARROW)
606 else if(nPrimary == K_LEFTARROW)
608 else // if(nPrimary == K_RIGHTARROW)
611 HUD_Panel_SetPos(pos);
614 panel = highlightedPanel;
615 HUD_Panel_UpdatePosSize();
617 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
620 panel_pos_backup = highlightedPanel_initial_pos;
621 panel_size_backup = highlightedPanel_initial_size;
622 highlightedPanel_backup = highlightedPanel;
626 const int S_MOUSE1 = 1;
627 const int S_MOUSE2 = 2;
628 const int S_MOUSE3 = 4;
630 int prevMouseClicked; // previous state
631 float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks
632 vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks
634 void HUD_Panel_EnableMenu();
635 entity tab_panels[HUD_PANEL_MAX];
637 vector tab_panel_pos;
639 void HUD_Panel_FirstInDrawQ(float id);
640 void reset_tab_panels()
643 for(i = 0; i < HUD_PANEL_NUM; ++i)
644 tab_panels[i] = world;
646 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
653 if(!autocvar__hud_configure)
658 mousepos_x = nPrimary;
659 mousepos_y = nSecondary;
663 // block any input while a menu dialog is fading
664 // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
665 if(autocvar__menu_alpha)
672 // allow console bind to work
675 con_keys = findkeysforcommand("toggleconsole", 0);
676 keys = tokenize(con_keys); // findkeysforcommand returns data for this
678 float hit_con_bind = 0, i;
679 for (i = 0; i < keys; ++i)
681 if(nPrimary == stof(argv(i)))
685 if(bInputType == 0) {
686 if(nPrimary == K_ALT) hudShiftState |= S_ALT;
687 if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
688 if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
690 else if(bInputType == 1) {
691 if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
692 if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
693 if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
696 if(nPrimary == K_CTRL)
698 if (bInputType == 1) //ctrl has been released
702 //switch to selected panel
703 highlightedPanel = tab_panel;
704 highlightedAction = 0;
705 HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id);
712 if(nPrimary == K_MOUSE1)
714 if(bInputType == 0) // key pressed
715 mouseClicked |= S_MOUSE1;
716 else if(bInputType == 1) // key released
717 mouseClicked -= (mouseClicked & S_MOUSE1);
719 else if(nPrimary == K_MOUSE2)
721 if(bInputType == 0) // key pressed
722 mouseClicked |= S_MOUSE2;
723 else if(bInputType == 1) // key released
724 mouseClicked -= (mouseClicked & S_MOUSE2);
726 else if(nPrimary == K_ESCAPE)
731 localcmd("menu_showhudexit\n");
733 else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
738 cvar_set("_hud_configure", "0");
740 else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // select and highlight another panel
742 if (bInputType == 1 || mouseClicked)
745 //FIXME: if a panel is highlighted, has the same pos_x and lays in the same level
746 //of other panels then next consecutive ctrl-tab will select the highlighted panel too
747 //(it should only after every other panel of the hud)
748 //It's a minor bug anyway, we can live with it
750 entity starting_panel;
751 entity old_tab_panel = tab_panel;
752 if (!tab_panel) //first press of TAB
754 if (highlightedPanel)
756 panel = highlightedPanel;
757 HUD_Panel_UpdatePosSize();
761 starting_panel = highlightedPanel;
762 tab_panel_pos = panel_pos; //to compute level
766 if ( ((!tab_backward) && (hudShiftState & S_SHIFT)) || (tab_backward && !(hudShiftState & S_SHIFT)) ) //tab direction changed?
768 starting_panel = tab_panel;
770 tab_backward = (hudShiftState & S_SHIFT);
772 float k, level = 0, start_posX;
773 vector candidate_pos = '0 0 0';
774 const float LEVELS_NUM = 4;
775 float level_height = vid_conheight / LEVELS_NUM;
777 level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
778 candidate_pos_x = (!tab_backward) ? vid_conwidth : 0;
779 start_posX = tab_panel_pos.x;
784 for(i = 0; i < HUD_PANEL_NUM; ++i)
786 panel = hud_panel[i];
787 if (panel == tab_panels[i] || panel == starting_panel)
789 HUD_Panel_UpdatePosSize();
790 if (panel_pos.y >= level && (panel_pos.y - level) < level_height)
791 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)) )
792 || ( 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)) ) )
795 tab_panel_pos = candidate_pos = panel_pos;
800 if (k == LEVELS_NUM) //tab_panel not found
808 starting_panel = old_tab_panel;
809 old_tab_panel = world;
810 goto find_tab_panel; //u must find tab_panel!
814 level = (level + level_height) % vid_conheight;
816 candidate_pos_x = vid_conwidth;
820 level = (level - level_height) % vid_conheight;
821 start_posX = vid_conwidth;
826 tab_panels[tab_panel.panel_id] = tab_panel;
828 else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
830 if (bInputType == 1 || mouseClicked)
833 if (highlightedPanel)
834 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
836 cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
838 else if(nPrimary == 'c' && hudShiftState & S_CTRL) // copy highlighted panel size
840 if (bInputType == 1 || mouseClicked)
843 if (highlightedPanel)
845 panel = highlightedPanel;
846 HUD_Panel_UpdatePosSize();
847 panel_size_copied = panel_size;
850 else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
852 if (bInputType == 1 || mouseClicked)
855 if (panel_size_copied == '0 0 0' || !highlightedPanel)
858 panel = highlightedPanel;
859 HUD_Panel_UpdatePosSize();
861 // reduce size if it'd go beyond screen boundaries
862 vector tmp_size = panel_size_copied;
863 if (panel_pos.x + panel_size_copied.x > vid_conwidth)
864 tmp_size_x = vid_conwidth - panel_pos.x;
865 if (panel_pos.y + panel_size_copied.y > vid_conheight)
866 tmp_size_y = vid_conheight - panel_pos.y;
868 if (panel_size == tmp_size)
872 panel_pos_backup = panel_pos;
873 panel_size_backup = panel_size;
874 highlightedPanel_backup = highlightedPanel;
876 s = strcat(ftos(tmp_size.x/vid_conwidth), " ", ftos(tmp_size.y/vid_conheight));
877 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
879 else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
881 if (bInputType == 1 || mouseClicked)
883 //restore previous values
884 if (highlightedPanel_backup)
886 s = strcat(ftos(panel_pos_backup.x/vid_conwidth), " ", ftos(panel_pos_backup.y/vid_conheight));
887 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
888 s = strcat(ftos(panel_size_backup.x/vid_conwidth), " ", ftos(panel_size_backup.y/vid_conheight));
889 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
890 highlightedPanel_backup = world;
893 else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
897 pressed_key_time = 0;
900 else if (pressed_key_time == 0)
901 pressed_key_time = time;
904 HUD_Panel_Arrow_Action(nPrimary); //move or resize panel
906 else if(nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
910 if (highlightedPanel)
911 HUD_Panel_EnableMenu();
913 else if(hit_con_bind)
919 float HUD_Panel_Check_Mouse_Pos(float allow_move)
921 float i, j = 0, border;
923 while(j < HUD_PANEL_NUM)
928 panel = hud_panel[i];
929 HUD_Panel_UpdatePosSize();
931 border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
934 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)
938 // resize from topleft border
939 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)
943 // resize from topright border
944 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)
948 // resize from bottomleft border
949 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)
953 // resize from bottomright border
954 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)
962 // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else)
963 void HUD_Panel_FirstInDrawQ(float id)
967 // find out where in the array our current id is, save into place
968 for(i = 0; i < HUD_PANEL_NUM; ++i)
970 if(panel_order[i] == id)
976 // place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
978 place = HUD_PANEL_NUM - 1;
980 // move all ids up by one step in the array until "place"
981 for(i = place; i > 0; --i)
983 panel_order[i] = panel_order[i-1];
985 // now save the new top id
988 // let's save them into the cvar by some strcat trickery
990 for(i = 0; i < HUD_PANEL_NUM; ++i)
992 s = strcat(s, ftos(panel_order[i]), " ");
994 cvar_set("_hud_panelorder", s);
995 if(hud_panelorder_prev)
996 strunzone(hud_panelorder_prev);
997 hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
1000 void HUD_Panel_Highlight(float allow_move)
1002 float i, j = 0, border;
1004 while(j < HUD_PANEL_NUM)
1009 panel = hud_panel[i];
1010 HUD_Panel_UpdatePosSize();
1012 border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
1015 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)
1017 highlightedPanel = hud_panel[i];
1018 HUD_Panel_FirstInDrawQ(i);
1019 highlightedAction = 1;
1020 panel_click_distance = mousepos - panel_pos;
1023 // resize from topleft border
1024 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)
1026 highlightedPanel = hud_panel[i];
1027 HUD_Panel_FirstInDrawQ(i);
1028 highlightedAction = 2;
1030 panel_click_distance = mousepos - panel_pos;
1031 panel_click_resizeorigin = panel_pos + panel_size;
1034 // resize from topright border
1035 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)
1037 highlightedPanel = hud_panel[i];
1038 HUD_Panel_FirstInDrawQ(i);
1039 highlightedAction = 2;
1041 panel_click_distance_x = panel_size.x - mousepos.x + panel_pos.x;
1042 panel_click_distance_y = mousepos.y - panel_pos.y;
1043 panel_click_resizeorigin = panel_pos + eY * panel_size.y;
1046 // resize from bottomleft border
1047 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)
1049 highlightedPanel = hud_panel[i];
1050 HUD_Panel_FirstInDrawQ(i);
1051 highlightedAction = 2;
1053 panel_click_distance_x = mousepos.x - panel_pos.x;
1054 panel_click_distance_y = panel_size.y - mousepos.y + panel_pos.y;
1055 panel_click_resizeorigin = panel_pos + eX * panel_size.x;
1058 // resize from bottomright border
1059 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)
1061 highlightedPanel = hud_panel[i];
1062 HUD_Panel_FirstInDrawQ(i);
1063 highlightedAction = 2;
1065 panel_click_distance = panel_size - mousepos + panel_pos;
1066 panel_click_resizeorigin = panel_pos;
1070 highlightedPanel = world;
1071 highlightedAction = 0;
1074 void HUD_Panel_EnableMenu()
1077 localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
1079 float mouse_over_panel;
1080 void HUD_Panel_Mouse()
1082 if(autocvar__menu_alpha == 1)
1085 if (!autocvar_hud_cursormode)
1087 mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
1089 mousepos_x = bound(0, mousepos.x, vid_conwidth);
1090 mousepos_y = bound(0, mousepos.y, vid_conheight);
1095 if(prevMouseClicked == 0)
1099 //stop ctrl-tab selection
1103 HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
1104 // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
1105 if (highlightedPanel)
1107 highlightedPanel_initial_pos = panel_pos;
1108 highlightedPanel_initial_size = panel_size;
1110 // doubleclick check
1111 if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel && prevMouseClickedPos == mousepos)
1113 mouseClicked = 0; // to prevent spam, I guess.
1114 HUD_Panel_EnableMenu();
1118 if (mouseClicked & S_MOUSE1)
1120 prevMouseClickedTime = time;
1121 prevMouseClickedPos = mousepos;
1123 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(mouseClicked & S_MOUSE1);
1128 panel = highlightedPanel;
1129 HUD_Panel_UpdatePosSize();
1132 if (highlightedPanel)
1134 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1135 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
1137 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
1139 panel_pos_backup = highlightedPanel_initial_pos;
1140 panel_size_backup = highlightedPanel_initial_size;
1141 highlightedPanel_backup = highlightedPanel;
1144 // in case the clicked panel is inside another panel and we aren't
1145 // moving it, avoid the immediate "fix" of its position/size
1146 // (often unwanted and hateful) by disabling collisions check
1147 hud_configure_checkcollisions = false;
1150 if(highlightedAction == 1)
1151 HUD_Panel_SetPos(mousepos - panel_click_distance);
1152 else if(highlightedAction == 2)
1154 vector mySize = '0 0 0';
1155 if(resizeCorner == 1) {
1156 mySize_x = panel_click_resizeorigin.x - (mousepos.x - panel_click_distance.x);
1157 mySize_y = panel_click_resizeorigin.y - (mousepos.y - panel_click_distance.y);
1158 } else if(resizeCorner == 2) {
1159 mySize_x = mousepos.x + panel_click_distance.x - panel_click_resizeorigin.x;
1160 mySize_y = panel_click_distance.y + panel_click_resizeorigin.y - mousepos.y;
1161 } else if(resizeCorner == 3) {
1162 mySize_x = panel_click_resizeorigin.x + panel_click_distance.x - mousepos.x;
1163 mySize_y = mousepos.y + panel_click_distance.y - panel_click_resizeorigin.y;
1164 } else { // resizeCorner == 4
1165 mySize_x = mousepos.x - (panel_click_resizeorigin.x - panel_click_distance.x);
1166 mySize_y = mousepos.y - (panel_click_resizeorigin.y - panel_click_distance.y);
1168 HUD_Panel_SetPosSize(mySize);
1173 if(menu_enabled == 2)
1174 mouse_over_panel = 0;
1176 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true);
1177 if (mouse_over_panel && !tab_panel)
1178 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1180 // draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
1181 const vector cursorsize = '32 32 0';
1182 float cursor_alpha = 1 - autocvar__menu_alpha;
1184 if(!mouse_over_panel)
1185 drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1186 else if(mouse_over_panel == 1)
1187 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1188 else if(mouse_over_panel == 2)
1189 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1191 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1193 prevMouseClicked = mouseClicked;
1195 void HUD_Configure_DrawGrid()
1198 if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
1200 hud_configure_gridSize_x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
1201 hud_configure_gridSize_y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
1202 hud_configure_realGridSize_x = hud_configure_gridSize.x * vid_conwidth;
1203 hud_configure_realGridSize_y = hud_configure_gridSize.y * vid_conheight;
1206 s = eX + eY * vid_conheight;
1207 for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
1208 drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1210 s = eY + eX * vid_conwidth;
1211 for(i = 1; i < 1/hud_configure_gridSize.y; ++i)
1212 drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1216 float _menu_alpha_prev;
1217 void HUD_Configure_Frame()
1220 if(autocvar__hud_configure)
1222 if(isdemo() || intermission == 2)
1224 HUD_Configure_Exit_Force();
1228 if(!hud_configure_prev || hud_configure_prev == -1)
1230 if(autocvar_hud_cursormode)
1233 for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
1234 hud_panel[panel_order[i]].update_time = time;
1237 // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
1238 if(autocvar__menu_alpha != _menu_alpha_prev)
1240 if(autocvar__menu_alpha == 0)
1242 _menu_alpha_prev = autocvar__menu_alpha;
1245 HUD_Configure_DrawGrid();
1247 else if(hud_configure_prev)
1251 if(autocvar_hud_cursormode)
1256 const float hlBorderSize = 2;
1257 const string hlBorder = "gfx/hud/default/border_highlighted";
1258 const string hlBorder2 = "gfx/hud/default/border_highlighted2";
1259 void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
1261 drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
1262 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);
1263 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);
1264 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);
1265 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);
1268 void HUD_Configure_PostDraw()
1270 if(autocvar__hud_configure)
1275 HUD_Panel_UpdatePosSize();
1276 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
1278 if(highlightedPanel)
1280 panel = highlightedPanel;
1281 HUD_Panel_UpdatePosSize();
1282 HUD_Panel_HlBorder(panel_bg_border * hlBorderSize, '0 0.5 1', 0.4 * (1 - autocvar__menu_alpha));