1 #include "hud_config.qh"
6 #include "../common/constants.qh"
8 #include "../dpdefs/keycodes.qh"
11 #define HUD_Write(s) fputs(fh, s)
12 // q: quoted, n: not quoted
13 #define HUD_Write_Cvar_n(cvar) HUD_Write(strcat("seta ", cvar, " ", cvar_string(cvar), "\n"))
14 #define HUD_Write_Cvar_q(cvar) HUD_Write(strcat("seta ", cvar, " \"", cvar_string(cvar), "\"\n"))
15 #define HUD_Write_PanelCvar_n(cvar_suf) HUD_Write_Cvar_n(strcat("hud_panel_", panel.panel_name, cvar_suf))
16 #define HUD_Write_PanelCvar_q(cvar_suf) HUD_Write_Cvar_q(strcat("hud_panel_", panel.panel_name, cvar_suf))
18 void HUD_Panel_ExportCfg(string cfgname)
21 string filename = strcat("hud_", autocvar_hud_skin, "_", cfgname, ".cfg");
22 fh = fopen(filename, FILE_WRITE);
25 HUD_Write_Cvar_q("hud_skin");
26 HUD_Write_Cvar_q("hud_panel_bg");
27 HUD_Write_Cvar_q("hud_panel_bg_color");
28 HUD_Write_Cvar_q("hud_panel_bg_color_team");
29 HUD_Write_Cvar_q("hud_panel_bg_alpha");
30 HUD_Write_Cvar_q("hud_panel_bg_border");
31 HUD_Write_Cvar_q("hud_panel_bg_padding");
32 HUD_Write_Cvar_q("hud_panel_fg_alpha");
35 HUD_Write_Cvar_q("hud_dock");
36 HUD_Write_Cvar_q("hud_dock_color");
37 HUD_Write_Cvar_q("hud_dock_color_team");
38 HUD_Write_Cvar_q("hud_dock_alpha");
41 HUD_Write_Cvar_q("hud_progressbar_alpha");
42 HUD_Write_Cvar_q("hud_progressbar_strength_color");
43 HUD_Write_Cvar_q("hud_progressbar_shield_color");
44 HUD_Write_Cvar_q("hud_progressbar_health_color");
45 HUD_Write_Cvar_q("hud_progressbar_armor_color");
46 HUD_Write_Cvar_q("hud_progressbar_fuel_color");
47 HUD_Write_Cvar_q("hud_progressbar_nexball_color");
48 HUD_Write_Cvar_q("hud_progressbar_speed_color");
49 HUD_Write_Cvar_q("hud_progressbar_acceleration_color");
50 HUD_Write_Cvar_q("hud_progressbar_acceleration_neg_color");
53 HUD_Write_Cvar_q("_hud_panelorder");
56 HUD_Write_Cvar_q("hud_configure_grid");
57 HUD_Write_Cvar_q("hud_configure_grid_xsize");
58 HUD_Write_Cvar_q("hud_configure_grid_ysize");
61 // common cvars for all panels
63 for (i = 0; i < HUD_PANEL_NUM; ++i)
67 HUD_Write_PanelCvar_n("");
68 HUD_Write_PanelCvar_q("_pos");
69 HUD_Write_PanelCvar_q("_size");
70 HUD_Write_PanelCvar_q("_bg");
71 HUD_Write_PanelCvar_q("_bg_color");
72 HUD_Write_PanelCvar_q("_bg_color_team");
73 HUD_Write_PanelCvar_q("_bg_alpha");
74 HUD_Write_PanelCvar_q("_bg_border");
75 HUD_Write_PanelCvar_q("_bg_padding");
77 case HUD_PANEL_WEAPONS:
78 HUD_Write_PanelCvar_q("_accuracy");
79 HUD_Write_PanelCvar_q("_label");
80 HUD_Write_PanelCvar_q("_label_scale");
81 HUD_Write_PanelCvar_q("_complainbubble");
82 HUD_Write_PanelCvar_q("_complainbubble_padding");
83 HUD_Write_PanelCvar_q("_complainbubble_time");
84 HUD_Write_PanelCvar_q("_complainbubble_fadetime");
85 HUD_Write_PanelCvar_q("_complainbubble_color_outofammo");
86 HUD_Write_PanelCvar_q("_complainbubble_color_donthave");
87 HUD_Write_PanelCvar_q("_complainbubble_color_unavailable");
88 HUD_Write_PanelCvar_q("_ammo");
89 HUD_Write_PanelCvar_q("_ammo_color");
90 HUD_Write_PanelCvar_q("_ammo_alpha");
91 HUD_Write_PanelCvar_q("_aspect");
92 HUD_Write_PanelCvar_q("_timeout");
93 HUD_Write_PanelCvar_q("_timeout_effect");
94 HUD_Write_PanelCvar_q("_timeout_fadebgmin");
95 HUD_Write_PanelCvar_q("_timeout_fadefgmin");
96 HUD_Write_PanelCvar_q("_timeout_speed_in");
97 HUD_Write_PanelCvar_q("_timeout_speed_out");
98 HUD_Write_PanelCvar_q("_onlyowned");
99 HUD_Write_PanelCvar_q("_noncurrent_alpha");
100 HUD_Write_PanelCvar_q("_noncurrent_scale");
103 HUD_Write_PanelCvar_q("_onlycurrent");
104 HUD_Write_PanelCvar_q("_noncurrent_alpha");
105 HUD_Write_PanelCvar_q("_noncurrent_scale");
106 HUD_Write_PanelCvar_q("_iconalign");
107 HUD_Write_PanelCvar_q("_progressbar");
108 HUD_Write_PanelCvar_q("_progressbar_name");
109 HUD_Write_PanelCvar_q("_progressbar_xoffset");
110 HUD_Write_PanelCvar_q("_text");
112 case HUD_PANEL_POWERUPS:
113 HUD_Write_PanelCvar_q("_iconalign");
114 HUD_Write_PanelCvar_q("_baralign");
115 HUD_Write_PanelCvar_q("_progressbar");
116 HUD_Write_PanelCvar_q("_text");
118 case HUD_PANEL_HEALTHARMOR:
119 HUD_Write_PanelCvar_q("_flip");
120 HUD_Write_PanelCvar_q("_iconalign");
121 HUD_Write_PanelCvar_q("_baralign");
122 HUD_Write_PanelCvar_q("_progressbar");
123 HUD_Write_PanelCvar_q("_progressbar_health");
124 HUD_Write_PanelCvar_q("_progressbar_armor");
125 HUD_Write_PanelCvar_q("_progressbar_gfx");
126 HUD_Write_PanelCvar_q("_progressbar_gfx_smooth");
127 HUD_Write_PanelCvar_q("_text");
129 case HUD_PANEL_NOTIFY:
130 HUD_Write_PanelCvar_q("_flip");
131 HUD_Write_PanelCvar_q("_fontsize");
132 HUD_Write_PanelCvar_q("_time");
133 HUD_Write_PanelCvar_q("_fadetime");
134 HUD_Write_PanelCvar_q("_icon_aspect");
136 case HUD_PANEL_TIMER:
137 HUD_Write_PanelCvar_q("_increment");
139 case HUD_PANEL_RADAR:
140 HUD_Write_PanelCvar_q("_foreground_alpha");
141 HUD_Write_PanelCvar_q("_rotation");
142 HUD_Write_PanelCvar_q("_zoommode");
143 HUD_Write_PanelCvar_q("_scale");
144 HUD_Write_PanelCvar_q("_maximized_scale");
145 HUD_Write_PanelCvar_q("_maximized_size");
146 HUD_Write_PanelCvar_q("_maximized_rotation");
147 HUD_Write_PanelCvar_q("_maximized_zoommode");
149 case HUD_PANEL_SCORE:
150 HUD_Write_PanelCvar_q("_rankings");
153 HUD_Write_PanelCvar_q("_alreadyvoted_alpha");
155 case HUD_PANEL_MODICONS:
156 HUD_Write_PanelCvar_q("_ca_layout");
157 HUD_Write_PanelCvar_q("_dom_layout");
158 HUD_Write_PanelCvar_q("_freezetag_layout");
160 case HUD_PANEL_PRESSEDKEYS:
161 HUD_Write_PanelCvar_q("_aspect");
162 HUD_Write_PanelCvar_q("_attack");
164 case HUD_PANEL_ENGINEINFO:
165 HUD_Write_PanelCvar_q("_framecounter_time");
166 HUD_Write_PanelCvar_q("_framecounter_decimals");
168 case HUD_PANEL_INFOMESSAGES:
169 HUD_Write_PanelCvar_q("_flip");
171 case HUD_PANEL_PHYSICS:
172 HUD_Write_PanelCvar_q("_speed_unit");
173 HUD_Write_PanelCvar_q("_speed_unit_show");
174 HUD_Write_PanelCvar_q("_speed_max");
175 HUD_Write_PanelCvar_q("_speed_vertical");
176 HUD_Write_PanelCvar_q("_topspeed");
177 HUD_Write_PanelCvar_q("_topspeed_time");
178 HUD_Write_PanelCvar_q("_acceleration_max");
179 HUD_Write_PanelCvar_q("_acceleration_vertical");
180 HUD_Write_PanelCvar_q("_flip");
181 HUD_Write_PanelCvar_q("_baralign");
182 HUD_Write_PanelCvar_q("_progressbar");
183 HUD_Write_PanelCvar_q("_progressbar_acceleration_mode");
184 HUD_Write_PanelCvar_q("_progressbar_acceleration_scale");
185 HUD_Write_PanelCvar_q("_progressbar_acceleration_nonlinear");
186 HUD_Write_PanelCvar_q("_text");
187 HUD_Write_PanelCvar_q("_text_scale");
189 case HUD_PANEL_CENTERPRINT:
190 HUD_Write_PanelCvar_q("_align");
191 HUD_Write_PanelCvar_q("_flip");
192 HUD_Write_PanelCvar_q("_fontscale");
193 HUD_Write_PanelCvar_q("_time");
194 HUD_Write_PanelCvar_q("_fade_in");
195 HUD_Write_PanelCvar_q("_fade_out");
196 HUD_Write_PanelCvar_q("_fade_subsequent");
197 HUD_Write_PanelCvar_q("_fade_subsequent_passone");
198 HUD_Write_PanelCvar_q("_fade_subsequent_passone_minalpha");
199 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo");
200 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo_minalpha");
201 HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
202 HUD_Write_PanelCvar_q("_fade_minfontsize");
206 HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
208 printf(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
212 printf(_("^1Couldn't write to %s\n"), filename);
215 void HUD_Configure_Exit_Force()
220 localcmd("togglemenu\n");
222 cvar_set("_hud_configure", "0");
225 // check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
226 vector HUD_Panel_CheckMove(vector myPos, vector mySize)
228 vector myCenter, targCenter;
229 vector myTarget = myPos;
231 for (i = 0; i < HUD_PANEL_NUM; ++i) {
232 panel = hud_panel[i];
233 if(panel == HUD_PANEL(MAPVOTE)) continue;
234 if(panel == highlightedPanel) continue;
235 HUD_Panel_UpdatePosSize();
236 if(!panel_enabled) continue;
238 panel_pos -= '1 1 0' * panel_bg_border;
239 panel_size += '2 2 0' * panel_bg_border;
241 if(myPos.y + mySize.y < panel_pos.y)
243 if(myPos.y > panel_pos.y + panel_size.y)
246 if(myPos.x + mySize.x < panel_pos.x)
248 if(myPos.x > panel_pos.x + panel_size.x)
251 // OK, there IS a collision.
253 myCenter.x = myPos.x + 0.5 * mySize.x;
254 myCenter.y = myPos.y + 0.5 * mySize.y;
256 targCenter.x = panel_pos.x + 0.5 * panel_size.x;
257 targCenter.y = panel_pos.y + 0.5 * panel_size.y;
259 if(myCenter.x < targCenter.x && myCenter.y < targCenter.y) // top left (of the target panel)
261 if(myPos.x + mySize.x - panel_pos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
262 myTarget.x = panel_pos.x - mySize.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) // top right
268 if(panel_pos.x + panel_size.x - myPos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
269 myTarget.x = panel_pos.x + panel_size.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) // bottom left
275 if(myPos.x + mySize.x - panel_pos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
276 myTarget.x = panel_pos.x - mySize.x;
277 else // push it downwards
278 myTarget.y = panel_pos.y + panel_size.y;
280 else if(myCenter.x > targCenter.x && myCenter.y > targCenter.y) // bottom right
282 if(panel_pos.x + panel_size.x - myPos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
283 myTarget.x = panel_pos.x + panel_size.x;
284 else // push it downwards
285 myTarget.y = panel_pos.y + panel_size.y;
287 //if(cvar("hud_configure_checkcollisions_debug"))
288 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
294 void HUD_Panel_SetPos(vector pos)
296 panel = highlightedPanel;
297 HUD_Panel_UpdatePosSize();
301 //if(cvar("hud_configure_checkcollisions_debug"))
302 //drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
304 if(autocvar_hud_configure_grid)
306 pos.x = floor((pos.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
307 pos.y = floor((pos.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
310 if(hud_configure_checkcollisions)
311 pos = HUD_Panel_CheckMove(pos, mySize);
313 pos.x = bound(0, pos.x, vid_conwidth - mySize.x);
314 pos.y = bound(0, pos.y, vid_conheight - mySize.y);
317 s = strcat(ftos(pos.x/vid_conwidth), " ", ftos(pos.y/vid_conheight));
319 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
322 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
323 vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
326 float ratio = mySize.x/mySize.y;
328 for (i = 0; i < HUD_PANEL_NUM; ++i) {
329 panel = hud_panel[i];
330 if(panel == HUD_PANEL(MAPVOTE)) continue;
331 if(panel == highlightedPanel) continue;
332 HUD_Panel_UpdatePosSize();
333 if(!panel_enabled) continue;
335 panel_pos -= '1 1 0' * panel_bg_border;
336 panel_size += '2 2 0' * panel_bg_border;
338 targEndPos = panel_pos + panel_size;
340 // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
341 if(resizeorigin.x > panel_pos.x && resizeorigin.x < targEndPos.x && resizeorigin.y > panel_pos.y && resizeorigin.y < targEndPos.y)
344 if (resizeCorner == 1)
346 // check if this panel is on our way
347 if (resizeorigin.x <= panel_pos.x)
349 if (resizeorigin.y <= panel_pos.y)
351 if (targEndPos.x <= resizeorigin.x - mySize.x)
353 if (targEndPos.y <= resizeorigin.y - mySize.y)
356 // there is a collision:
357 // detect which side of the panel we are facing is actually limiting the resizing
358 // (which side the resize direction finds for first) and reduce the size up to there
360 // dist is the distance between resizeorigin and the "analogous" point of the panel
361 // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel
362 dist.x = resizeorigin.x - targEndPos.x;
363 dist.y = resizeorigin.y - targEndPos.y;
364 if (dist.y <= 0 || dist.x / dist.y > ratio)
365 mySize.x = min(mySize.x, dist.x);
367 mySize.y = min(mySize.y, dist.y);
369 else if (resizeCorner == 2)
371 if (resizeorigin.x >= targEndPos.x)
373 if (resizeorigin.y <= panel_pos.y)
375 if (panel_pos.x >= resizeorigin.x + mySize.x)
377 if (targEndPos.y <= resizeorigin.y - mySize.y)
380 dist.x = panel_pos.x - resizeorigin.x;
381 dist.y = resizeorigin.y - targEndPos.y;
382 if (dist.y <= 0 || dist.x / dist.y > ratio)
383 mySize.x = min(mySize.x, dist.x);
385 mySize.y = min(mySize.y, dist.y);
387 else if (resizeCorner == 3)
389 if (resizeorigin.x <= panel_pos.x)
391 if (resizeorigin.y >= targEndPos.y)
393 if (targEndPos.x <= resizeorigin.x - mySize.x)
395 if (panel_pos.y >= resizeorigin.y + mySize.y)
398 dist.x = resizeorigin.x - targEndPos.x;
399 dist.y = panel_pos.y - resizeorigin.y;
400 if (dist.y <= 0 || dist.x / dist.y > ratio)
401 mySize.x = min(mySize.x, dist.x);
403 mySize.y = min(mySize.y, dist.y);
405 else if (resizeCorner == 4)
407 if (resizeorigin.x >= targEndPos.x)
409 if (resizeorigin.y >= targEndPos.y)
411 if (panel_pos.x >= resizeorigin.x + mySize.x)
413 if (panel_pos.y >= resizeorigin.y + mySize.y)
416 dist.x = panel_pos.x - resizeorigin.x;
417 dist.y = panel_pos.y - resizeorigin.y;
418 if (dist.y <= 0 || dist.x / dist.y > ratio)
419 mySize.x = min(mySize.x, dist.x);
421 mySize.y = min(mySize.y, dist.y);
423 //if(cvar("hud_configure_checkcollisions_debug"))
424 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
430 void HUD_Panel_SetPosSize(vector mySize)
432 panel = highlightedPanel;
433 HUD_Panel_UpdatePosSize();
434 vector resizeorigin = panel_click_resizeorigin;
437 // minimum panel size cap
438 mySize.x = max(0.025 * vid_conwidth, mySize.x);
439 mySize.y = max(0.025 * vid_conheight, mySize.y);
441 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.
443 mySize.x = max(17 * autocvar_con_chatsize, mySize.x);
444 mySize.y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize.y);
447 // collision testing|
448 // -----------------+
450 // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
451 if(resizeCorner == 1) {
452 myPos.x = resizeorigin.x - mySize.x;
453 myPos.y = resizeorigin.y - mySize.y;
454 } else if(resizeCorner == 2) {
455 myPos.x = resizeorigin.x;
456 myPos.y = resizeorigin.y - mySize.y;
457 } else if(resizeCorner == 3) {
458 myPos.x = resizeorigin.x - mySize.x;
459 myPos.y = resizeorigin.y;
460 } else { // resizeCorner == 4
461 myPos.x = resizeorigin.x;
462 myPos.y = resizeorigin.y;
465 // left/top screen edges
467 mySize.x = mySize.x + myPos.x;
469 mySize.y = mySize.y + myPos.y;
471 // bottom/right screen edges
472 if(myPos.x + mySize.x > vid_conwidth)
473 mySize.x = vid_conwidth - myPos.x;
474 if(myPos.y + mySize.y > vid_conheight)
475 mySize.y = vid_conheight - myPos.y;
477 //if(cvar("hud_configure_checkcollisions_debug"))
478 //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
480 // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
481 if(autocvar_hud_configure_grid)
483 mySize.x = floor((mySize.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
484 mySize.y = floor((mySize.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
487 if(hud_configure_checkcollisions)
488 mySize = HUD_Panel_CheckResize(mySize, resizeorigin);
490 // 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)
491 mySize.x = max(0.025 * vid_conwidth, mySize.x);
492 mySize.y = max(0.025 * vid_conheight, mySize.y);
494 // do another pos check, as size might have changed by now
495 if(resizeCorner == 1) {
496 myPos.x = resizeorigin.x - mySize.x;
497 myPos.y = resizeorigin.y - mySize.y;
498 } else if(resizeCorner == 2) {
499 myPos.x = resizeorigin.x;
500 myPos.y = resizeorigin.y - mySize.y;
501 } else if(resizeCorner == 3) {
502 myPos.x = resizeorigin.x - mySize.x;
503 myPos.y = resizeorigin.y;
504 } else { // resizeCorner == 4
505 myPos.x = resizeorigin.x;
506 myPos.y = resizeorigin.y;
509 //if(cvar("hud_configure_checkcollisions_debug"))
510 //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
513 s = strcat(ftos(mySize.x/vid_conwidth), " ", ftos(mySize.y/vid_conheight));
514 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
516 s = strcat(ftos(myPos.x/vid_conwidth), " ", ftos(myPos.y/vid_conheight));
517 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
520 float pressed_key_time;
521 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
522 void HUD_Panel_Arrow_Action(float nPrimary)
524 if(!highlightedPanel)
527 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
530 if(autocvar_hud_configure_grid)
532 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
534 if (hudShiftState & S_SHIFT)
535 step = hud_configure_realGridSize.y;
537 step = 2 * hud_configure_realGridSize.y;
541 if (hudShiftState & S_SHIFT)
542 step = hud_configure_realGridSize.x;
544 step = 2 * hud_configure_realGridSize.x;
549 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
550 step = vid_conheight;
553 if (hudShiftState & S_SHIFT)
554 step = (step / 256); // more precision
556 step = (step / 64) * (1 + 2 * (time - pressed_key_time));
559 panel = highlightedPanel;
560 HUD_Panel_UpdatePosSize();
562 highlightedPanel_initial_pos = panel_pos;
563 highlightedPanel_initial_size = panel_size;
565 if (hudShiftState & S_ALT) // resize
567 if(nPrimary == K_UPARROW)
569 else if(nPrimary == K_RIGHTARROW)
571 else if(nPrimary == K_LEFTARROW)
573 else // if(nPrimary == K_DOWNARROW)
576 // ctrl+arrow reduces the size, instead of increasing it
577 // Note that ctrl disables collisions check too, but it's fine
578 // since we don't collide with anything reducing the size
579 if (hudShiftState & S_CTRL) {
581 resizeCorner = 5 - resizeCorner;
586 panel_click_resizeorigin = panel_pos;
587 if(resizeCorner == 1) {
588 panel_click_resizeorigin += mySize;
590 } else if(resizeCorner == 2) {
591 panel_click_resizeorigin.y += mySize.y;
593 } else if(resizeCorner == 3) {
594 panel_click_resizeorigin.x += mySize.x;
596 } else { // resizeCorner == 4
599 HUD_Panel_SetPosSize(mySize);
605 if(nPrimary == K_UPARROW)
607 else if(nPrimary == K_DOWNARROW)
609 else if(nPrimary == K_LEFTARROW)
611 else // if(nPrimary == K_RIGHTARROW)
614 HUD_Panel_SetPos(pos);
617 panel = highlightedPanel;
618 HUD_Panel_UpdatePosSize();
620 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
623 panel_pos_backup = highlightedPanel_initial_pos;
624 panel_size_backup = highlightedPanel_initial_size;
625 highlightedPanel_backup = highlightedPanel;
629 const int S_MOUSE1 = 1;
630 const int S_MOUSE2 = 2;
631 const int S_MOUSE3 = 4;
633 int prevMouseClicked; // previous state
634 float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks
635 vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks
637 void HUD_Panel_EnableMenu();
638 entity tab_panels[HUD_PANEL_MAX];
640 vector tab_panel_pos;
642 void HUD_Panel_FirstInDrawQ(float id);
643 void reset_tab_panels()
646 for(i = 0; i < HUD_PANEL_NUM; ++i)
647 tab_panels[i] = world;
649 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
656 if(!autocvar__hud_configure)
661 mousepos.x = nPrimary;
662 mousepos.y = nSecondary;
666 // block any input while a menu dialog is fading
667 // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
668 if(autocvar__menu_alpha)
675 // allow console bind to work
678 con_keys = findkeysforcommand("toggleconsole", 0);
679 keys = tokenize(con_keys); // findkeysforcommand returns data for this
681 bool hit_con_bind = false;
683 for (i = 0; i < keys; ++i)
685 if(nPrimary == stof(argv(i)))
689 if(bInputType == 0) {
690 if(nPrimary == K_ALT) hudShiftState |= S_ALT;
691 if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
692 if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
694 else if(bInputType == 1) {
695 if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
696 if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
697 if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
700 if(nPrimary == K_CTRL)
702 if (bInputType == 1) //ctrl has been released
706 //switch to selected panel
707 highlightedPanel = tab_panel;
708 highlightedAction = 0;
709 HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id);
716 if(nPrimary == K_MOUSE1)
718 if(bInputType == 0) // key pressed
719 mouseClicked |= S_MOUSE1;
720 else if(bInputType == 1) // key released
721 mouseClicked -= (mouseClicked & S_MOUSE1);
723 else if(nPrimary == K_MOUSE2)
725 if(bInputType == 0) // key pressed
726 mouseClicked |= S_MOUSE2;
727 else if(bInputType == 1) // key released
728 mouseClicked -= (mouseClicked & S_MOUSE2);
730 else if(nPrimary == K_ESCAPE)
735 localcmd("menu_showhudexit\n");
737 else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
742 cvar_set("_hud_configure", "0");
744 else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel
746 if (bInputType == 1 || mouseClicked)
749 // FIXME minor bug: if a panel is highlighted, has the same pos_x and
750 // lays in the same level of another panel then the next consecutive
751 // CTRL TAB presses will reselect once more the highlighted panel
753 entity starting_panel;
754 entity old_tab_panel = tab_panel;
755 if (!tab_panel) //first press of TAB
757 if (highlightedPanel)
759 panel = highlightedPanel;
760 HUD_Panel_UpdatePosSize();
764 starting_panel = highlightedPanel;
765 tab_panel_pos = panel_pos; //to compute level
769 if ( ((!tab_backward) && (hudShiftState & S_SHIFT)) || (tab_backward && !(hudShiftState & S_SHIFT)) ) //tab direction changed?
771 starting_panel = tab_panel;
773 tab_backward = (hudShiftState & S_SHIFT);
775 float k, level = 0, start_posX;
776 vector candidate_pos = '0 0 0';
777 const float LEVELS_NUM = 4;
778 float level_height = vid_conheight / LEVELS_NUM;
780 level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
781 candidate_pos.x = (!tab_backward) ? vid_conwidth : 0;
782 start_posX = tab_panel_pos.x;
787 for(i = 0; i < HUD_PANEL_NUM; ++i)
789 panel = hud_panel[i];
790 if(panel == HUD_PANEL(MAPVOTE))
792 if (panel == tab_panels[i] || panel == starting_panel)
794 HUD_Panel_UpdatePosSize();
795 if (panel_pos.y >= level && (panel_pos.y - level) < level_height)
796 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)) )
797 || ( 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)) ) )
800 tab_panel_pos = candidate_pos = panel_pos;
805 if (k == LEVELS_NUM) //tab_panel not found
813 starting_panel = old_tab_panel;
814 old_tab_panel = world;
815 goto find_tab_panel; //u must find tab_panel!
819 level = (level + level_height) % vid_conheight;
821 candidate_pos.x = vid_conwidth;
825 level = (level - level_height) % vid_conheight;
826 start_posX = vid_conwidth;
831 tab_panels[tab_panel.panel_id] = tab_panel;
833 else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
835 if (bInputType == 1 || mouseClicked)
838 if (highlightedPanel)
839 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
841 cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
843 else if(nPrimary == 'c' && hudShiftState & S_CTRL) // copy highlighted panel size
845 if (bInputType == 1 || mouseClicked)
848 if (highlightedPanel)
850 panel = highlightedPanel;
851 HUD_Panel_UpdatePosSize();
852 panel_size_copied = panel_size;
855 else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
857 if (bInputType == 1 || mouseClicked)
860 if (panel_size_copied == '0 0 0' || !highlightedPanel)
863 panel = highlightedPanel;
864 HUD_Panel_UpdatePosSize();
866 // reduce size if it'd go beyond screen boundaries
867 vector tmp_size = panel_size_copied;
868 if (panel_pos.x + panel_size_copied.x > vid_conwidth)
869 tmp_size.x = vid_conwidth - panel_pos.x;
870 if (panel_pos.y + panel_size_copied.y > vid_conheight)
871 tmp_size.y = vid_conheight - panel_pos.y;
873 if (panel_size == tmp_size)
877 panel_pos_backup = panel_pos;
878 panel_size_backup = panel_size;
879 highlightedPanel_backup = highlightedPanel;
881 s = strcat(ftos(tmp_size.x/vid_conwidth), " ", ftos(tmp_size.y/vid_conheight));
882 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
884 else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
886 if (bInputType == 1 || mouseClicked)
888 //restore previous values
889 if (highlightedPanel_backup)
891 s = strcat(ftos(panel_pos_backup.x/vid_conwidth), " ", ftos(panel_pos_backup.y/vid_conheight));
892 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
893 s = strcat(ftos(panel_size_backup.x/vid_conwidth), " ", ftos(panel_size_backup.y/vid_conheight));
894 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
895 highlightedPanel_backup = world;
898 else if(nPrimary == 's' && hudShiftState & S_CTRL) // save config
900 if (bInputType == 1 || mouseClicked)
902 localcmd("hud save myconfig\n");
904 else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
908 pressed_key_time = 0;
911 else if (pressed_key_time == 0)
912 pressed_key_time = time;
915 HUD_Panel_Arrow_Action(nPrimary); //move or resize panel
917 else if(nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
921 if (highlightedPanel)
922 HUD_Panel_EnableMenu();
924 else if(hit_con_bind || nPrimary == K_PAUSE)
930 float HUD_Panel_Check_Mouse_Pos(float allow_move)
933 while(j < HUD_PANEL_NUM)
938 panel = hud_panel[i];
939 if(panel == HUD_PANEL(MAPVOTE)) continue;
940 HUD_Panel_UpdatePosSize();
942 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
945 if(allow_move && mousepos.x > panel_pos.x && mousepos.y > panel_pos.y && mousepos.x < panel_pos.x + panel_size.x && mousepos.y < panel_pos.y + panel_size.y)
949 // resize from topleft border
950 else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
954 // resize from topright border
955 else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
959 // resize from bottomleft border
960 else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + panel_size.y + border)
964 // resize from bottomright border
965 else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + panel_size.y + border)
973 // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else)
974 void HUD_Panel_FirstInDrawQ(float id)
978 // find out where in the array our current id is, save into place
979 for(i = 0; i < HUD_PANEL_NUM; ++i)
981 if(panel_order[i] == id)
987 // place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
989 place = HUD_PANEL_NUM - 1;
991 // move all ids up by one step in the array until "place"
992 for(i = place; i > 0; --i)
994 panel_order[i] = panel_order[i-1];
996 // now save the new top id
999 // let's save them into the cvar by some strcat trickery
1001 for(i = 0; i < HUD_PANEL_NUM; ++i)
1003 s = strcat(s, ftos(panel_order[i]), " ");
1005 cvar_set("_hud_panelorder", s);
1006 if(hud_panelorder_prev)
1007 strunzone(hud_panelorder_prev);
1008 hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
1011 void HUD_Panel_Highlight(float allow_move)
1015 while(j < HUD_PANEL_NUM)
1020 panel = hud_panel[i];
1021 if(panel == HUD_PANEL(MAPVOTE))
1023 HUD_Panel_UpdatePosSize();
1025 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
1028 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)
1030 highlightedPanel = hud_panel[i];
1031 HUD_Panel_FirstInDrawQ(i);
1032 highlightedAction = 1;
1033 panel_click_distance = mousepos - panel_pos;
1036 // resize from topleft border
1037 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)
1039 highlightedPanel = hud_panel[i];
1040 HUD_Panel_FirstInDrawQ(i);
1041 highlightedAction = 2;
1043 panel_click_distance = mousepos - panel_pos;
1044 panel_click_resizeorigin = panel_pos + panel_size;
1047 // resize from topright border
1048 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)
1050 highlightedPanel = hud_panel[i];
1051 HUD_Panel_FirstInDrawQ(i);
1052 highlightedAction = 2;
1054 panel_click_distance.x = panel_size.x - mousepos.x + panel_pos.x;
1055 panel_click_distance.y = mousepos.y - panel_pos.y;
1056 panel_click_resizeorigin = panel_pos + eY * panel_size.y;
1059 // resize from bottomleft border
1060 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)
1062 highlightedPanel = hud_panel[i];
1063 HUD_Panel_FirstInDrawQ(i);
1064 highlightedAction = 2;
1066 panel_click_distance.x = mousepos.x - panel_pos.x;
1067 panel_click_distance.y = panel_size.y - mousepos.y + panel_pos.y;
1068 panel_click_resizeorigin = panel_pos + eX * panel_size.x;
1071 // resize from bottomright border
1072 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)
1074 highlightedPanel = hud_panel[i];
1075 HUD_Panel_FirstInDrawQ(i);
1076 highlightedAction = 2;
1078 panel_click_distance = panel_size - mousepos + panel_pos;
1079 panel_click_resizeorigin = panel_pos;
1083 highlightedPanel = world;
1084 highlightedAction = 0;
1087 void HUD_Panel_EnableMenu()
1090 localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
1092 float mouse_over_panel;
1093 void HUD_Panel_Mouse()
1095 if(autocvar__menu_alpha == 1)
1098 if (!autocvar_hud_cursormode)
1100 mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
1102 mousepos.x = bound(0, mousepos.x, vid_conwidth);
1103 mousepos.y = bound(0, mousepos.y, vid_conheight);
1108 if(prevMouseClicked == 0)
1112 //stop ctrl-tab selection
1116 HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
1117 // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
1118 if (highlightedPanel)
1120 highlightedPanel_initial_pos = panel_pos;
1121 highlightedPanel_initial_size = panel_size;
1123 // doubleclick check
1124 if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel && prevMouseClickedPos == mousepos)
1126 mouseClicked = 0; // to prevent spam, I guess.
1127 HUD_Panel_EnableMenu();
1131 if (mouseClicked & S_MOUSE1)
1133 prevMouseClickedTime = time;
1134 prevMouseClickedPos = mousepos;
1136 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(mouseClicked & S_MOUSE1);
1141 panel = highlightedPanel;
1142 HUD_Panel_UpdatePosSize();
1145 if (highlightedPanel)
1147 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1148 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
1150 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
1152 panel_pos_backup = highlightedPanel_initial_pos;
1153 panel_size_backup = highlightedPanel_initial_size;
1154 highlightedPanel_backup = highlightedPanel;
1157 // in case the clicked panel is inside another panel and we aren't
1158 // moving it, avoid the immediate "fix" of its position/size
1159 // (often unwanted and hateful) by disabling collisions check
1160 hud_configure_checkcollisions = false;
1163 if(highlightedAction == 1)
1164 HUD_Panel_SetPos(mousepos - panel_click_distance);
1165 else if(highlightedAction == 2)
1167 vector mySize = '0 0 0';
1168 if(resizeCorner == 1) {
1169 mySize.x = panel_click_resizeorigin.x - (mousepos.x - panel_click_distance.x);
1170 mySize.y = panel_click_resizeorigin.y - (mousepos.y - panel_click_distance.y);
1171 } else if(resizeCorner == 2) {
1172 mySize.x = mousepos.x + panel_click_distance.x - panel_click_resizeorigin.x;
1173 mySize.y = panel_click_distance.y + panel_click_resizeorigin.y - mousepos.y;
1174 } else if(resizeCorner == 3) {
1175 mySize.x = panel_click_resizeorigin.x + panel_click_distance.x - mousepos.x;
1176 mySize.y = mousepos.y + panel_click_distance.y - panel_click_resizeorigin.y;
1177 } else { // resizeCorner == 4
1178 mySize.x = mousepos.x - (panel_click_resizeorigin.x - panel_click_distance.x);
1179 mySize.y = mousepos.y - (panel_click_resizeorigin.y - panel_click_distance.y);
1181 HUD_Panel_SetPosSize(mySize);
1186 if(prevMouseClicked)
1187 highlightedAction = 0;
1188 if(menu_enabled == 2)
1189 mouse_over_panel = 0;
1191 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true);
1192 if (mouse_over_panel && !tab_panel)
1193 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1195 // draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
1196 const vector cursorsize = '32 32 0';
1197 float cursor_alpha = 1 - autocvar__menu_alpha;
1199 if(!mouse_over_panel)
1200 drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1201 else if(mouse_over_panel == 1)
1202 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1203 else if(mouse_over_panel == 2)
1204 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1206 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1208 prevMouseClicked = mouseClicked;
1210 void HUD_Configure_DrawGrid()
1213 if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
1215 hud_configure_gridSize.x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
1216 hud_configure_gridSize.y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
1217 hud_configure_realGridSize.x = hud_configure_gridSize.x * vid_conwidth;
1218 hud_configure_realGridSize.y = hud_configure_gridSize.y * vid_conheight;
1221 s = eX + eY * vid_conheight;
1222 for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
1223 drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1225 s = eY + eX * vid_conwidth;
1226 for(i = 1; i < 1/hud_configure_gridSize.y; ++i)
1227 drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1231 float _menu_alpha_prev;
1232 void HUD_Configure_Frame()
1235 if(autocvar__hud_configure)
1237 if(isdemo() || intermission == 2)
1239 HUD_Configure_Exit_Force();
1243 if(!hud_configure_prev)
1245 if(autocvar_hud_cursormode)
1248 for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
1249 hud_panel[panel_order[i]].update_time = time;
1252 // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
1253 if(autocvar__menu_alpha != _menu_alpha_prev)
1255 if(autocvar__menu_alpha == 0)
1257 _menu_alpha_prev = autocvar__menu_alpha;
1260 HUD_Configure_DrawGrid();
1262 else if(hud_configure_prev)
1266 if(autocvar_hud_cursormode)
1271 const float hlBorderSize = 2;
1272 const string hlBorder = "gfx/hud/default/border_highlighted";
1273 const string hlBorder2 = "gfx/hud/default/border_highlighted2";
1274 void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
1276 drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
1277 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);
1278 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);
1279 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);
1280 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);
1283 void HUD_Configure_PostDraw()
1285 if(autocvar__hud_configure)
1290 HUD_Panel_UpdatePosSize();
1291 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
1293 if(highlightedPanel)
1295 panel = highlightedPanel;
1296 HUD_Panel_UpdatePosSize();
1297 HUD_Panel_HlBorder(panel_bg_border * hlBorderSize, '0 0.5 1', 0.4 * (1 - autocvar__menu_alpha));