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
62 for (int i = 0; i < hud_panels_COUNT; ++i)
64 panel = hud_panels[i];
66 HUD_Write_PanelCvar_n("");
67 HUD_Write_PanelCvar_q("_pos");
68 HUD_Write_PanelCvar_q("_size");
69 HUD_Write_PanelCvar_q("_bg");
70 HUD_Write_PanelCvar_q("_bg_color");
71 HUD_Write_PanelCvar_q("_bg_color_team");
72 HUD_Write_PanelCvar_q("_bg_alpha");
73 HUD_Write_PanelCvar_q("_bg_border");
74 HUD_Write_PanelCvar_q("_bg_padding");
76 case HUD_PANEL_WEAPONS:
77 HUD_Write_PanelCvar_q("_accuracy");
78 HUD_Write_PanelCvar_q("_label");
79 HUD_Write_PanelCvar_q("_label_scale");
80 HUD_Write_PanelCvar_q("_complainbubble");
81 HUD_Write_PanelCvar_q("_complainbubble_padding");
82 HUD_Write_PanelCvar_q("_complainbubble_time");
83 HUD_Write_PanelCvar_q("_complainbubble_fadetime");
84 HUD_Write_PanelCvar_q("_complainbubble_color_outofammo");
85 HUD_Write_PanelCvar_q("_complainbubble_color_donthave");
86 HUD_Write_PanelCvar_q("_complainbubble_color_unavailable");
87 HUD_Write_PanelCvar_q("_ammo");
88 HUD_Write_PanelCvar_q("_ammo_color");
89 HUD_Write_PanelCvar_q("_ammo_alpha");
90 HUD_Write_PanelCvar_q("_aspect");
91 HUD_Write_PanelCvar_q("_timeout");
92 HUD_Write_PanelCvar_q("_timeout_effect");
93 HUD_Write_PanelCvar_q("_timeout_fadebgmin");
94 HUD_Write_PanelCvar_q("_timeout_fadefgmin");
95 HUD_Write_PanelCvar_q("_timeout_speed_in");
96 HUD_Write_PanelCvar_q("_timeout_speed_out");
97 HUD_Write_PanelCvar_q("_onlyowned");
98 HUD_Write_PanelCvar_q("_noncurrent_alpha");
99 HUD_Write_PanelCvar_q("_noncurrent_scale");
102 HUD_Write_PanelCvar_q("_onlycurrent");
103 HUD_Write_PanelCvar_q("_noncurrent_alpha");
104 HUD_Write_PanelCvar_q("_noncurrent_scale");
105 HUD_Write_PanelCvar_q("_iconalign");
106 HUD_Write_PanelCvar_q("_progressbar");
107 HUD_Write_PanelCvar_q("_progressbar_name");
108 HUD_Write_PanelCvar_q("_progressbar_xoffset");
109 HUD_Write_PanelCvar_q("_text");
111 case HUD_PANEL_POWERUPS:
112 HUD_Write_PanelCvar_q("_iconalign");
113 HUD_Write_PanelCvar_q("_baralign");
114 HUD_Write_PanelCvar_q("_progressbar");
115 HUD_Write_PanelCvar_q("_text");
117 case HUD_PANEL_HEALTHARMOR:
118 HUD_Write_PanelCvar_q("_flip");
119 HUD_Write_PanelCvar_q("_iconalign");
120 HUD_Write_PanelCvar_q("_baralign");
121 HUD_Write_PanelCvar_q("_progressbar");
122 HUD_Write_PanelCvar_q("_progressbar_health");
123 HUD_Write_PanelCvar_q("_progressbar_armor");
124 HUD_Write_PanelCvar_q("_progressbar_gfx");
125 HUD_Write_PanelCvar_q("_progressbar_gfx_smooth");
126 HUD_Write_PanelCvar_q("_text");
128 case HUD_PANEL_NOTIFY:
129 HUD_Write_PanelCvar_q("_flip");
130 HUD_Write_PanelCvar_q("_fontsize");
131 HUD_Write_PanelCvar_q("_time");
132 HUD_Write_PanelCvar_q("_fadetime");
133 HUD_Write_PanelCvar_q("_icon_aspect");
135 case HUD_PANEL_TIMER:
136 HUD_Write_PanelCvar_q("_increment");
138 case HUD_PANEL_RADAR:
139 HUD_Write_PanelCvar_q("_foreground_alpha");
140 HUD_Write_PanelCvar_q("_rotation");
141 HUD_Write_PanelCvar_q("_zoommode");
142 HUD_Write_PanelCvar_q("_scale");
143 HUD_Write_PanelCvar_q("_maximized_scale");
144 HUD_Write_PanelCvar_q("_maximized_size");
145 HUD_Write_PanelCvar_q("_maximized_rotation");
146 HUD_Write_PanelCvar_q("_maximized_zoommode");
148 case HUD_PANEL_SCORE:
149 HUD_Write_PanelCvar_q("_rankings");
152 HUD_Write_PanelCvar_q("_alreadyvoted_alpha");
154 case HUD_PANEL_MODICONS:
155 HUD_Write_PanelCvar_q("_ca_layout");
156 HUD_Write_PanelCvar_q("_dom_layout");
157 HUD_Write_PanelCvar_q("_freezetag_layout");
159 case HUD_PANEL_PRESSEDKEYS:
160 HUD_Write_PanelCvar_q("_aspect");
161 HUD_Write_PanelCvar_q("_attack");
163 case HUD_PANEL_ENGINEINFO:
164 HUD_Write_PanelCvar_q("_framecounter_time");
165 HUD_Write_PanelCvar_q("_framecounter_decimals");
167 case HUD_PANEL_INFOMESSAGES:
168 HUD_Write_PanelCvar_q("_flip");
170 case HUD_PANEL_PHYSICS:
171 HUD_Write_PanelCvar_q("_speed_unit");
172 HUD_Write_PanelCvar_q("_speed_unit_show");
173 HUD_Write_PanelCvar_q("_speed_max");
174 HUD_Write_PanelCvar_q("_speed_vertical");
175 HUD_Write_PanelCvar_q("_topspeed");
176 HUD_Write_PanelCvar_q("_topspeed_time");
177 HUD_Write_PanelCvar_q("_acceleration_max");
178 HUD_Write_PanelCvar_q("_acceleration_vertical");
179 HUD_Write_PanelCvar_q("_flip");
180 HUD_Write_PanelCvar_q("_baralign");
181 HUD_Write_PanelCvar_q("_progressbar");
182 HUD_Write_PanelCvar_q("_progressbar_acceleration_mode");
183 HUD_Write_PanelCvar_q("_progressbar_acceleration_scale");
184 HUD_Write_PanelCvar_q("_progressbar_acceleration_nonlinear");
185 HUD_Write_PanelCvar_q("_text");
186 HUD_Write_PanelCvar_q("_text_scale");
188 case HUD_PANEL_CENTERPRINT:
189 HUD_Write_PanelCvar_q("_align");
190 HUD_Write_PanelCvar_q("_flip");
191 HUD_Write_PanelCvar_q("_fontscale");
192 HUD_Write_PanelCvar_q("_time");
193 HUD_Write_PanelCvar_q("_fade_in");
194 HUD_Write_PanelCvar_q("_fade_out");
195 HUD_Write_PanelCvar_q("_fade_subsequent");
196 HUD_Write_PanelCvar_q("_fade_subsequent_passone");
197 HUD_Write_PanelCvar_q("_fade_subsequent_passone_minalpha");
198 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo");
199 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo_minalpha");
200 HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
201 HUD_Write_PanelCvar_q("_fade_minfontsize");
203 case HUD_PANEL_ITEMSTIME:
204 HUD_Write_PanelCvar_q("_iconalign");
205 HUD_Write_PanelCvar_q("_progressbar");
206 HUD_Write_PanelCvar_q("_progressbar_name");
207 HUD_Write_PanelCvar_q("_progressbar_reduced");
208 HUD_Write_PanelCvar_q("_text");
209 HUD_Write_PanelCvar_q("_ratio");
210 HUD_Write_PanelCvar_q("_dynamicsize");
211 case HUD_PANEL_QUICKMENU:
212 HUD_Write_PanelCvar_q("_align");
217 HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
219 LOG_INFOF(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
223 LOG_INFOF(_("^1Couldn't write to %s\n"), filename);
226 void HUD_Configure_Exit_Force()
231 localcmd("togglemenu\n");
233 cvar_set("_hud_configure", "0");
236 // check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
237 vector HUD_Panel_CheckMove(vector myPos, vector mySize)
239 vector myCenter, targCenter;
240 vector myTarget = myPos;
242 for (i = 0; i < hud_panels_COUNT; ++i) {
243 panel = hud_panels[i];
244 if(panel == HUD_PANEL(MAPVOTE)) continue;
245 if(panel == highlightedPanel) continue;
246 HUD_Panel_UpdatePosSize();
247 if(!panel_enabled) continue;
249 panel_pos -= '1 1 0' * panel_bg_border;
250 panel_size += '2 2 0' * panel_bg_border;
252 if(myPos.y + mySize.y < panel_pos.y)
254 if(myPos.y > panel_pos.y + panel_size.y)
257 if(myPos.x + mySize.x < panel_pos.x)
259 if(myPos.x > panel_pos.x + panel_size.x)
262 // OK, there IS a collision.
264 myCenter.x = myPos.x + 0.5 * mySize.x;
265 myCenter.y = myPos.y + 0.5 * mySize.y;
267 targCenter.x = panel_pos.x + 0.5 * panel_size.x;
268 targCenter.y = panel_pos.y + 0.5 * panel_size.y;
270 if(myCenter.x < targCenter.x && myCenter.y < targCenter.y) // top left (of the target panel)
272 if(myPos.x + mySize.x - panel_pos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
273 myTarget.x = panel_pos.x - mySize.x;
274 else // push it upwards
275 myTarget.y = panel_pos.y - mySize.y;
277 else if(myCenter.x > targCenter.x && myCenter.y < targCenter.y) // top right
279 if(panel_pos.x + panel_size.x - myPos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
280 myTarget.x = panel_pos.x + panel_size.x;
281 else // push it upwards
282 myTarget.y = panel_pos.y - mySize.y;
284 else if(myCenter.x < targCenter.x && myCenter.y > targCenter.y) // bottom left
286 if(myPos.x + mySize.x - panel_pos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
287 myTarget.x = panel_pos.x - mySize.x;
288 else // push it downwards
289 myTarget.y = panel_pos.y + panel_size.y;
291 else if(myCenter.x > targCenter.x && myCenter.y > targCenter.y) // bottom right
293 if(panel_pos.x + panel_size.x - myPos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
294 myTarget.x = panel_pos.x + panel_size.x;
295 else // push it downwards
296 myTarget.y = panel_pos.y + panel_size.y;
298 //if(cvar("hud_configure_checkcollisions_debug"))
299 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
305 void HUD_Panel_SetPos(vector pos)
307 panel = highlightedPanel;
308 HUD_Panel_UpdatePosSize();
312 //if(cvar("hud_configure_checkcollisions_debug"))
313 //drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
315 if(autocvar_hud_configure_grid)
317 pos.x = floor((pos.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
318 pos.y = floor((pos.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
321 if(hud_configure_checkcollisions)
322 pos = HUD_Panel_CheckMove(pos, mySize);
324 pos.x = bound(0, pos.x, vid_conwidth - mySize.x);
325 pos.y = bound(0, pos.y, vid_conheight - mySize.y);
328 s = strcat(ftos(pos.x/vid_conwidth), " ", ftos(pos.y/vid_conheight));
330 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
333 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
334 vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
337 float ratio = mySize.x/mySize.y;
339 for (i = 0; i < hud_panels_COUNT; ++i) {
340 panel = hud_panels[i];
341 if(panel == HUD_PANEL(MAPVOTE)) continue;
342 if(panel == highlightedPanel) continue;
343 HUD_Panel_UpdatePosSize();
344 if(!panel_enabled) continue;
346 panel_pos -= '1 1 0' * panel_bg_border;
347 panel_size += '2 2 0' * panel_bg_border;
349 targEndPos = panel_pos + panel_size;
351 // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
352 if(resizeorigin.x > panel_pos.x && resizeorigin.x < targEndPos.x && resizeorigin.y > panel_pos.y && resizeorigin.y < targEndPos.y)
355 if (resizeCorner == 1)
357 // check if this panel is on our way
358 if (resizeorigin.x <= panel_pos.x)
360 if (resizeorigin.y <= panel_pos.y)
362 if (targEndPos.x <= resizeorigin.x - mySize.x)
364 if (targEndPos.y <= resizeorigin.y - mySize.y)
367 // there is a collision:
368 // detect which side of the panel we are facing is actually limiting the resizing
369 // (which side the resize direction finds for first) and reduce the size up to there
371 // dist is the distance between resizeorigin and the "analogous" point of the panel
372 // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel
373 dist.x = resizeorigin.x - targEndPos.x;
374 dist.y = resizeorigin.y - targEndPos.y;
375 if (dist.y <= 0 || dist.x / dist.y > ratio)
376 mySize.x = min(mySize.x, dist.x);
378 mySize.y = min(mySize.y, dist.y);
380 else if (resizeCorner == 2)
382 if (resizeorigin.x >= targEndPos.x)
384 if (resizeorigin.y <= panel_pos.y)
386 if (panel_pos.x >= resizeorigin.x + mySize.x)
388 if (targEndPos.y <= resizeorigin.y - mySize.y)
391 dist.x = panel_pos.x - resizeorigin.x;
392 dist.y = resizeorigin.y - targEndPos.y;
393 if (dist.y <= 0 || dist.x / dist.y > ratio)
394 mySize.x = min(mySize.x, dist.x);
396 mySize.y = min(mySize.y, dist.y);
398 else if (resizeCorner == 3)
400 if (resizeorigin.x <= panel_pos.x)
402 if (resizeorigin.y >= targEndPos.y)
404 if (targEndPos.x <= resizeorigin.x - mySize.x)
406 if (panel_pos.y >= resizeorigin.y + mySize.y)
409 dist.x = resizeorigin.x - targEndPos.x;
410 dist.y = panel_pos.y - resizeorigin.y;
411 if (dist.y <= 0 || dist.x / dist.y > ratio)
412 mySize.x = min(mySize.x, dist.x);
414 mySize.y = min(mySize.y, dist.y);
416 else if (resizeCorner == 4)
418 if (resizeorigin.x >= targEndPos.x)
420 if (resizeorigin.y >= targEndPos.y)
422 if (panel_pos.x >= resizeorigin.x + mySize.x)
424 if (panel_pos.y >= resizeorigin.y + mySize.y)
427 dist.x = panel_pos.x - resizeorigin.x;
428 dist.y = panel_pos.y - resizeorigin.y;
429 if (dist.y <= 0 || dist.x / dist.y > ratio)
430 mySize.x = min(mySize.x, dist.x);
432 mySize.y = min(mySize.y, dist.y);
434 //if(cvar("hud_configure_checkcollisions_debug"))
435 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
441 void HUD_Panel_SetPosSize(vector mySize)
443 panel = highlightedPanel;
444 HUD_Panel_UpdatePosSize();
445 vector resizeorigin = panel_click_resizeorigin;
448 // minimum panel size cap
449 mySize.x = max(0.025 * vid_conwidth, mySize.x);
450 mySize.y = max(0.025 * vid_conheight, mySize.y);
452 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.
454 mySize.x = max(17 * autocvar_con_chatsize, mySize.x);
455 mySize.y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize.y);
458 // collision testing|
459 // -----------------+
461 // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
462 if(resizeCorner == 1) {
463 myPos.x = resizeorigin.x - mySize.x;
464 myPos.y = resizeorigin.y - mySize.y;
465 } else if(resizeCorner == 2) {
466 myPos.x = resizeorigin.x;
467 myPos.y = resizeorigin.y - mySize.y;
468 } else if(resizeCorner == 3) {
469 myPos.x = resizeorigin.x - mySize.x;
470 myPos.y = resizeorigin.y;
471 } else { // resizeCorner == 4
472 myPos.x = resizeorigin.x;
473 myPos.y = resizeorigin.y;
476 // left/top screen edges
478 mySize.x = mySize.x + myPos.x;
480 mySize.y = mySize.y + myPos.y;
482 // bottom/right screen edges
483 if(myPos.x + mySize.x > vid_conwidth)
484 mySize.x = vid_conwidth - myPos.x;
485 if(myPos.y + mySize.y > vid_conheight)
486 mySize.y = vid_conheight - myPos.y;
488 //if(cvar("hud_configure_checkcollisions_debug"))
489 //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
491 // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
492 if(autocvar_hud_configure_grid)
494 mySize.x = floor((mySize.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
495 mySize.y = floor((mySize.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
498 if(hud_configure_checkcollisions)
499 mySize = HUD_Panel_CheckResize(mySize, resizeorigin);
501 // 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)
502 mySize.x = max(0.025 * vid_conwidth, mySize.x);
503 mySize.y = max(0.025 * vid_conheight, mySize.y);
505 // do another pos check, as size might have changed by now
506 if(resizeCorner == 1) {
507 myPos.x = resizeorigin.x - mySize.x;
508 myPos.y = resizeorigin.y - mySize.y;
509 } else if(resizeCorner == 2) {
510 myPos.x = resizeorigin.x;
511 myPos.y = resizeorigin.y - mySize.y;
512 } else if(resizeCorner == 3) {
513 myPos.x = resizeorigin.x - mySize.x;
514 myPos.y = resizeorigin.y;
515 } else { // resizeCorner == 4
516 myPos.x = resizeorigin.x;
517 myPos.y = resizeorigin.y;
520 //if(cvar("hud_configure_checkcollisions_debug"))
521 //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
524 s = strcat(ftos(mySize.x/vid_conwidth), " ", ftos(mySize.y/vid_conheight));
525 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
527 s = strcat(ftos(myPos.x/vid_conwidth), " ", ftos(myPos.y/vid_conheight));
528 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
531 float pressed_key_time;
532 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
533 void HUD_Panel_Arrow_Action(float nPrimary)
535 if(!highlightedPanel)
538 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
541 if(autocvar_hud_configure_grid)
543 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
545 if (hudShiftState & S_SHIFT)
546 step = hud_configure_realGridSize.y;
548 step = 2 * hud_configure_realGridSize.y;
552 if (hudShiftState & S_SHIFT)
553 step = hud_configure_realGridSize.x;
555 step = 2 * hud_configure_realGridSize.x;
560 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
561 step = vid_conheight;
564 if (hudShiftState & S_SHIFT)
565 step = (step / 256); // more precision
567 step = (step / 64) * (1 + 2 * (time - pressed_key_time));
570 panel = highlightedPanel;
571 HUD_Panel_UpdatePosSize();
573 highlightedPanel_initial_pos = panel_pos;
574 highlightedPanel_initial_size = panel_size;
576 if (hudShiftState & S_ALT) // resize
578 if(nPrimary == K_UPARROW)
580 else if(nPrimary == K_RIGHTARROW)
582 else if(nPrimary == K_LEFTARROW)
584 else // if(nPrimary == K_DOWNARROW)
587 // ctrl+arrow reduces the size, instead of increasing it
588 // Note that ctrl disables collisions check too, but it's fine
589 // since we don't collide with anything reducing the size
590 if (hudShiftState & S_CTRL) {
592 resizeCorner = 5 - resizeCorner;
597 panel_click_resizeorigin = panel_pos;
598 if(resizeCorner == 1) {
599 panel_click_resizeorigin += mySize;
601 } else if(resizeCorner == 2) {
602 panel_click_resizeorigin.y += mySize.y;
604 } else if(resizeCorner == 3) {
605 panel_click_resizeorigin.x += mySize.x;
607 } else { // resizeCorner == 4
610 HUD_Panel_SetPosSize(mySize);
616 if(nPrimary == K_UPARROW)
618 else if(nPrimary == K_DOWNARROW)
620 else if(nPrimary == K_LEFTARROW)
622 else // if(nPrimary == K_RIGHTARROW)
625 HUD_Panel_SetPos(pos);
628 panel = highlightedPanel;
629 HUD_Panel_UpdatePosSize();
631 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
634 panel_pos_backup = highlightedPanel_initial_pos;
635 panel_size_backup = highlightedPanel_initial_size;
636 highlightedPanel_backup = highlightedPanel;
640 void HUD_Panel_EnableMenu();
641 entity tab_panels[hud_panels_MAX];
643 vector tab_panel_pos;
645 void HUD_Panel_FirstInDrawQ(float id);
646 void reset_tab_panels()
649 for(i = 0; i < hud_panels_COUNT; ++i)
650 tab_panels[i] = world;
652 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
659 if(!autocvar__hud_configure)
664 mousepos.x = nPrimary;
665 mousepos.y = nSecondary;
669 // block any input while a menu dialog is fading
670 // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
671 if(autocvar__menu_alpha)
678 // allow console bind to work
681 con_keys = findkeysforcommand("toggleconsole", 0);
682 keys = tokenize(con_keys); // findkeysforcommand returns data for this
684 bool hit_con_bind = false;
686 for (i = 0; i < keys; ++i)
688 if(nPrimary == stof(argv(i)))
692 if(bInputType == 0) {
693 if(nPrimary == K_ALT) hudShiftState |= S_ALT;
694 if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
695 if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
697 else if(bInputType == 1) {
698 if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
699 if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
700 if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
703 if(nPrimary == K_CTRL)
705 if (bInputType == 1) //ctrl has been released
709 //switch to selected panel
710 highlightedPanel = tab_panel;
711 highlightedAction = 0;
712 HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id);
719 if(nPrimary == K_MOUSE1)
721 if(bInputType == 0) // key pressed
722 mouseClicked |= S_MOUSE1;
723 else if(bInputType == 1) // key released
724 mouseClicked -= (mouseClicked & S_MOUSE1);
726 else if(nPrimary == K_MOUSE2)
728 if(bInputType == 0) // key pressed
729 mouseClicked |= S_MOUSE2;
730 else if(bInputType == 1) // key released
731 mouseClicked -= (mouseClicked & S_MOUSE2);
733 else if(nPrimary == K_ESCAPE)
738 localcmd("menu_showhudexit\n");
740 else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
745 cvar_set("_hud_configure", "0");
747 else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel
749 if (bInputType == 1 || mouseClicked)
752 // FIXME minor bug: if a panel is highlighted, has the same pos_x and
753 // lays in the same level of another panel then the next consecutive
754 // CTRL TAB presses will reselect once more the highlighted panel
756 entity starting_panel;
757 entity old_tab_panel = tab_panel;
758 if (!tab_panel) //first press of TAB
760 if (highlightedPanel)
762 panel = highlightedPanel;
763 HUD_Panel_UpdatePosSize();
767 starting_panel = highlightedPanel;
768 tab_panel_pos = panel_pos; //to compute level
772 if ( ((!tab_backward) && (hudShiftState & S_SHIFT)) || (tab_backward && !(hudShiftState & S_SHIFT)) ) //tab direction changed?
774 starting_panel = tab_panel;
776 tab_backward = (hudShiftState & S_SHIFT);
778 float k, level = 0, start_posX;
779 vector candidate_pos = '0 0 0';
780 const float LEVELS_NUM = 4;
781 float level_height = vid_conheight / LEVELS_NUM;
783 level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
784 candidate_pos.x = (!tab_backward) ? vid_conwidth : 0;
785 start_posX = tab_panel_pos.x;
790 for(i = 0; i < hud_panels_COUNT; ++i)
792 panel = hud_panels[i];
793 if(panel == HUD_PANEL(MAPVOTE))
795 if (panel == tab_panels[i] || panel == starting_panel)
797 HUD_Panel_UpdatePosSize();
798 if (panel_pos.y >= level && (panel_pos.y - level) < level_height)
799 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)) )
800 || ( 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)) ) )
803 tab_panel_pos = candidate_pos = panel_pos;
808 if (k == LEVELS_NUM) //tab_panel not found
816 starting_panel = old_tab_panel;
817 old_tab_panel = world;
818 goto find_tab_panel; //u must find tab_panel!
822 level = (level + level_height) % vid_conheight;
824 candidate_pos.x = vid_conwidth;
828 level = (level - level_height) % vid_conheight;
829 start_posX = vid_conwidth;
834 tab_panels[tab_panel.panel_id] = tab_panel;
836 else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
838 if (bInputType == 1 || mouseClicked)
841 if (highlightedPanel)
842 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
844 cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
846 else if(nPrimary == 'c' && hudShiftState & S_CTRL) // copy highlighted panel size
848 if (bInputType == 1 || mouseClicked)
851 if (highlightedPanel)
853 panel = highlightedPanel;
854 HUD_Panel_UpdatePosSize();
855 panel_size_copied = panel_size;
858 else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
860 if (bInputType == 1 || mouseClicked)
863 if (panel_size_copied == '0 0 0' || !highlightedPanel)
866 panel = highlightedPanel;
867 HUD_Panel_UpdatePosSize();
869 // reduce size if it'd go beyond screen boundaries
870 vector tmp_size = panel_size_copied;
871 if (panel_pos.x + panel_size_copied.x > vid_conwidth)
872 tmp_size.x = vid_conwidth - panel_pos.x;
873 if (panel_pos.y + panel_size_copied.y > vid_conheight)
874 tmp_size.y = vid_conheight - panel_pos.y;
876 if (panel_size == tmp_size)
880 panel_pos_backup = panel_pos;
881 panel_size_backup = panel_size;
882 highlightedPanel_backup = highlightedPanel;
884 s = strcat(ftos(tmp_size.x/vid_conwidth), " ", ftos(tmp_size.y/vid_conheight));
885 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
887 else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
889 if (bInputType == 1 || mouseClicked)
891 //restore previous values
892 if (highlightedPanel_backup)
894 s = strcat(ftos(panel_pos_backup.x/vid_conwidth), " ", ftos(panel_pos_backup.y/vid_conheight));
895 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
896 s = strcat(ftos(panel_size_backup.x/vid_conwidth), " ", ftos(panel_size_backup.y/vid_conheight));
897 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
898 highlightedPanel_backup = world;
901 else if(nPrimary == 's' && hudShiftState & S_CTRL) // save config
903 if (bInputType == 1 || mouseClicked)
905 localcmd("hud save myconfig\n");
907 else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
911 pressed_key_time = 0;
914 else if (pressed_key_time == 0)
915 pressed_key_time = time;
918 HUD_Panel_Arrow_Action(nPrimary); //move or resize panel
920 else if(nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
924 if (highlightedPanel)
925 HUD_Panel_EnableMenu();
927 else if(hit_con_bind || nPrimary == K_PAUSE)
933 float HUD_Panel_Check_Mouse_Pos(float allow_move)
936 while(j < hud_panels_COUNT)
941 panel = hud_panels[i];
942 if(panel == HUD_PANEL(MAPVOTE)) continue;
943 HUD_Panel_UpdatePosSize();
945 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
948 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)
952 // resize from topleft border
953 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)
957 // resize from topright border
958 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)
962 // resize from bottomleft border
963 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)
967 // resize from bottomright border
968 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)
976 // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else)
977 void HUD_Panel_FirstInDrawQ(float id)
981 // find out where in the array our current id is, save into place
982 for(i = 0; i < hud_panels_COUNT; ++i)
984 if(panel_order[i] == id)
990 // place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
992 place = hud_panels_COUNT - 1;
994 // move all ids up by one step in the array until "place"
995 for(i = place; i > 0; --i)
997 panel_order[i] = panel_order[i-1];
999 // now save the new top id
1000 panel_order[0] = id;
1002 // let's save them into the cvar by some strcat trickery
1004 for(i = 0; i < hud_panels_COUNT; ++i)
1006 s = strcat(s, ftos(panel_order[i]), " ");
1008 cvar_set("_hud_panelorder", s);
1009 if(hud_panelorder_prev)
1010 strunzone(hud_panelorder_prev);
1011 hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
1014 void HUD_Panel_Highlight(float allow_move)
1018 while(j < hud_panels_COUNT)
1023 panel = hud_panels[i];
1024 if(panel == HUD_PANEL(MAPVOTE))
1026 HUD_Panel_UpdatePosSize();
1028 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
1031 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)
1033 highlightedPanel = hud_panels[i];
1034 HUD_Panel_FirstInDrawQ(i);
1035 highlightedAction = 1;
1036 panel_click_distance = mousepos - panel_pos;
1039 // resize from topleft border
1040 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)
1042 highlightedPanel = hud_panels[i];
1043 HUD_Panel_FirstInDrawQ(i);
1044 highlightedAction = 2;
1046 panel_click_distance = mousepos - panel_pos;
1047 panel_click_resizeorigin = panel_pos + panel_size;
1050 // resize from topright border
1051 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)
1053 highlightedPanel = hud_panels[i];
1054 HUD_Panel_FirstInDrawQ(i);
1055 highlightedAction = 2;
1057 panel_click_distance.x = panel_size.x - mousepos.x + panel_pos.x;
1058 panel_click_distance.y = mousepos.y - panel_pos.y;
1059 panel_click_resizeorigin = panel_pos + eY * panel_size.y;
1062 // resize from bottomleft border
1063 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)
1065 highlightedPanel = hud_panels[i];
1066 HUD_Panel_FirstInDrawQ(i);
1067 highlightedAction = 2;
1069 panel_click_distance.x = mousepos.x - panel_pos.x;
1070 panel_click_distance.y = panel_size.y - mousepos.y + panel_pos.y;
1071 panel_click_resizeorigin = panel_pos + eX * panel_size.x;
1074 // resize from bottomright border
1075 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)
1077 highlightedPanel = hud_panels[i];
1078 HUD_Panel_FirstInDrawQ(i);
1079 highlightedAction = 2;
1081 panel_click_distance = panel_size - mousepos + panel_pos;
1082 panel_click_resizeorigin = panel_pos;
1086 highlightedPanel = world;
1087 highlightedAction = 0;
1090 void HUD_Panel_EnableMenu()
1093 localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
1095 float mouse_over_panel;
1096 void HUD_Panel_Mouse()
1098 if(autocvar__menu_alpha == 1)
1101 if (!autocvar_hud_cursormode)
1103 mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
1105 mousepos.x = bound(0, mousepos.x, vid_conwidth);
1106 mousepos.y = bound(0, mousepos.y, vid_conheight);
1111 if(prevMouseClicked == 0)
1115 //stop ctrl-tab selection
1119 HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
1120 // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
1121 if (highlightedPanel)
1123 highlightedPanel_initial_pos = panel_pos;
1124 highlightedPanel_initial_size = panel_size;
1126 // doubleclick check
1127 if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel && prevMouseClickedPos == mousepos)
1129 mouseClicked = 0; // to prevent spam, I guess.
1130 HUD_Panel_EnableMenu();
1134 if (mouseClicked & S_MOUSE1)
1136 prevMouseClickedTime = time;
1137 prevMouseClickedPos = mousepos;
1139 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(mouseClicked & S_MOUSE1);
1144 panel = highlightedPanel;
1145 HUD_Panel_UpdatePosSize();
1148 if (highlightedPanel)
1150 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1151 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
1153 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
1155 panel_pos_backup = highlightedPanel_initial_pos;
1156 panel_size_backup = highlightedPanel_initial_size;
1157 highlightedPanel_backup = highlightedPanel;
1160 // in case the clicked panel is inside another panel and we aren't
1161 // moving it, avoid the immediate "fix" of its position/size
1162 // (often unwanted and hateful) by disabling collisions check
1163 hud_configure_checkcollisions = false;
1166 if(highlightedAction == 1)
1167 HUD_Panel_SetPos(mousepos - panel_click_distance);
1168 else if(highlightedAction == 2)
1170 vector mySize = '0 0 0';
1171 if(resizeCorner == 1) {
1172 mySize.x = panel_click_resizeorigin.x - (mousepos.x - panel_click_distance.x);
1173 mySize.y = panel_click_resizeorigin.y - (mousepos.y - panel_click_distance.y);
1174 } else if(resizeCorner == 2) {
1175 mySize.x = mousepos.x + panel_click_distance.x - panel_click_resizeorigin.x;
1176 mySize.y = panel_click_distance.y + panel_click_resizeorigin.y - mousepos.y;
1177 } else if(resizeCorner == 3) {
1178 mySize.x = panel_click_resizeorigin.x + panel_click_distance.x - mousepos.x;
1179 mySize.y = mousepos.y + panel_click_distance.y - panel_click_resizeorigin.y;
1180 } else { // resizeCorner == 4
1181 mySize.x = mousepos.x - (panel_click_resizeorigin.x - panel_click_distance.x);
1182 mySize.y = mousepos.y - (panel_click_resizeorigin.y - panel_click_distance.y);
1184 HUD_Panel_SetPosSize(mySize);
1189 if(prevMouseClicked)
1190 highlightedAction = 0;
1191 if(menu_enabled == 2)
1192 mouse_over_panel = 0;
1194 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true);
1195 if (mouse_over_panel && !tab_panel)
1196 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1198 // draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
1199 const vector cursorsize = '32 32 0';
1200 float cursor_alpha = 1 - autocvar__menu_alpha;
1202 if(!mouse_over_panel)
1203 drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1204 else if(mouse_over_panel == 1)
1205 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1206 else if(mouse_over_panel == 2)
1207 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1209 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1211 prevMouseClicked = mouseClicked;
1213 void HUD_Configure_DrawGrid()
1216 if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
1218 hud_configure_gridSize.x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
1219 hud_configure_gridSize.y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
1220 hud_configure_realGridSize.x = hud_configure_gridSize.x * vid_conwidth;
1221 hud_configure_realGridSize.y = hud_configure_gridSize.y * vid_conheight;
1224 s = eX + eY * vid_conheight;
1225 for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
1226 drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1228 s = eY + eX * vid_conwidth;
1229 for(i = 1; i < 1/hud_configure_gridSize.y; ++i)
1230 drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1234 float _menu_alpha_prev;
1235 void HUD_Configure_Frame()
1238 if(autocvar__hud_configure)
1240 if(isdemo() || intermission == 2)
1242 HUD_Configure_Exit_Force();
1246 if(!hud_configure_prev)
1248 if(autocvar_hud_cursormode)
1251 for(i = hud_panels_COUNT - 1; i >= 0; --i)
1252 hud_panels[panel_order[i]].update_time = time;
1255 // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
1256 if(autocvar__menu_alpha != _menu_alpha_prev)
1258 if(autocvar__menu_alpha == 0)
1260 _menu_alpha_prev = autocvar__menu_alpha;
1263 HUD_Configure_DrawGrid();
1265 else if(hud_configure_prev)
1269 if(autocvar_hud_cursormode)
1274 const float hlBorderSize = 2;
1275 const string hlBorder = "gfx/hud/default/border_highlighted";
1276 const string hlBorder2 = "gfx/hud/default/border_highlighted2";
1277 void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
1279 drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
1280 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);
1281 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);
1282 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);
1283 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);
1286 void HUD_Configure_PostDraw()
1288 if(autocvar__hud_configure)
1293 HUD_Panel_UpdatePosSize();
1294 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
1296 if(highlightedPanel)
1298 panel = highlightedPanel;
1299 HUD_Panel_UpdatePosSize();
1300 HUD_Panel_HlBorder(panel_bg_border * hlBorderSize, '0 0.5 1', 0.4 * (1 - autocvar__menu_alpha));