1 #include "hud_config.qh"
6 #include "../common/constants.qh"
9 #define HUD_Write(s) fputs(fh, s)
10 // q: quoted, n: not quoted
11 #define HUD_Write_Cvar_n(cvar) HUD_Write(strcat("seta ", cvar, " ", cvar_string(cvar), "\n"))
12 #define HUD_Write_Cvar_q(cvar) HUD_Write(strcat("seta ", cvar, " \"", cvar_string(cvar), "\"\n"))
13 #define HUD_Write_PanelCvar_n(cvar_suf) HUD_Write_Cvar_n(strcat("hud_panel_", panel.panel_name, cvar_suf))
14 #define HUD_Write_PanelCvar_q(cvar_suf) HUD_Write_Cvar_q(strcat("hud_panel_", panel.panel_name, cvar_suf))
16 void HUD_Panel_ExportCfg(string cfgname)
19 string filename = strcat("hud_", autocvar_hud_skin, "_", cfgname, ".cfg");
20 fh = fopen(filename, FILE_WRITE);
23 HUD_Write_Cvar_q("hud_skin");
24 HUD_Write_Cvar_q("hud_panel_bg");
25 HUD_Write_Cvar_q("hud_panel_bg_color");
26 HUD_Write_Cvar_q("hud_panel_bg_color_team");
27 HUD_Write_Cvar_q("hud_panel_bg_alpha");
28 HUD_Write_Cvar_q("hud_panel_bg_border");
29 HUD_Write_Cvar_q("hud_panel_bg_padding");
30 HUD_Write_Cvar_q("hud_panel_fg_alpha");
33 HUD_Write_Cvar_q("hud_dock");
34 HUD_Write_Cvar_q("hud_dock_color");
35 HUD_Write_Cvar_q("hud_dock_color_team");
36 HUD_Write_Cvar_q("hud_dock_alpha");
39 HUD_Write_Cvar_q("hud_progressbar_alpha");
40 HUD_Write_Cvar_q("hud_progressbar_strength_color");
41 HUD_Write_Cvar_q("hud_progressbar_shield_color");
42 HUD_Write_Cvar_q("hud_progressbar_health_color");
43 HUD_Write_Cvar_q("hud_progressbar_armor_color");
44 HUD_Write_Cvar_q("hud_progressbar_fuel_color");
45 HUD_Write_Cvar_q("hud_progressbar_nexball_color");
46 HUD_Write_Cvar_q("hud_progressbar_speed_color");
47 HUD_Write_Cvar_q("hud_progressbar_acceleration_color");
48 HUD_Write_Cvar_q("hud_progressbar_acceleration_neg_color");
51 HUD_Write_Cvar_q("_hud_panelorder");
54 HUD_Write_Cvar_q("hud_configure_grid");
55 HUD_Write_Cvar_q("hud_configure_grid_xsize");
56 HUD_Write_Cvar_q("hud_configure_grid_ysize");
59 // common cvars for all panels
60 for (int i = 0; i < hud_panels_COUNT; ++i)
62 panel = hud_panels[i];
64 HUD_Write_PanelCvar_n("");
65 HUD_Write_PanelCvar_q("_pos");
66 HUD_Write_PanelCvar_q("_size");
67 HUD_Write_PanelCvar_q("_bg");
68 HUD_Write_PanelCvar_q("_bg_color");
69 HUD_Write_PanelCvar_q("_bg_color_team");
70 HUD_Write_PanelCvar_q("_bg_alpha");
71 HUD_Write_PanelCvar_q("_bg_border");
72 HUD_Write_PanelCvar_q("_bg_padding");
74 case HUD_PANEL_WEAPONS:
75 HUD_Write_PanelCvar_q("_accuracy");
76 HUD_Write_PanelCvar_q("_label");
77 HUD_Write_PanelCvar_q("_label_scale");
78 HUD_Write_PanelCvar_q("_complainbubble");
79 HUD_Write_PanelCvar_q("_complainbubble_padding");
80 HUD_Write_PanelCvar_q("_complainbubble_time");
81 HUD_Write_PanelCvar_q("_complainbubble_fadetime");
82 HUD_Write_PanelCvar_q("_complainbubble_color_outofammo");
83 HUD_Write_PanelCvar_q("_complainbubble_color_donthave");
84 HUD_Write_PanelCvar_q("_complainbubble_color_unavailable");
85 HUD_Write_PanelCvar_q("_ammo");
86 HUD_Write_PanelCvar_q("_ammo_color");
87 HUD_Write_PanelCvar_q("_ammo_alpha");
88 HUD_Write_PanelCvar_q("_aspect");
89 HUD_Write_PanelCvar_q("_timeout");
90 HUD_Write_PanelCvar_q("_timeout_effect");
91 HUD_Write_PanelCvar_q("_timeout_fadebgmin");
92 HUD_Write_PanelCvar_q("_timeout_fadefgmin");
93 HUD_Write_PanelCvar_q("_timeout_speed_in");
94 HUD_Write_PanelCvar_q("_timeout_speed_out");
95 HUD_Write_PanelCvar_q("_onlyowned");
96 HUD_Write_PanelCvar_q("_noncurrent_alpha");
97 HUD_Write_PanelCvar_q("_noncurrent_scale");
100 HUD_Write_PanelCvar_q("_onlycurrent");
101 HUD_Write_PanelCvar_q("_noncurrent_alpha");
102 HUD_Write_PanelCvar_q("_noncurrent_scale");
103 HUD_Write_PanelCvar_q("_iconalign");
104 HUD_Write_PanelCvar_q("_progressbar");
105 HUD_Write_PanelCvar_q("_progressbar_name");
106 HUD_Write_PanelCvar_q("_progressbar_xoffset");
107 HUD_Write_PanelCvar_q("_text");
109 case HUD_PANEL_POWERUPS:
110 HUD_Write_PanelCvar_q("_iconalign");
111 HUD_Write_PanelCvar_q("_baralign");
112 HUD_Write_PanelCvar_q("_progressbar");
113 HUD_Write_PanelCvar_q("_text");
115 case HUD_PANEL_HEALTHARMOR:
116 HUD_Write_PanelCvar_q("_flip");
117 HUD_Write_PanelCvar_q("_iconalign");
118 HUD_Write_PanelCvar_q("_baralign");
119 HUD_Write_PanelCvar_q("_progressbar");
120 HUD_Write_PanelCvar_q("_progressbar_health");
121 HUD_Write_PanelCvar_q("_progressbar_armor");
122 HUD_Write_PanelCvar_q("_progressbar_gfx");
123 HUD_Write_PanelCvar_q("_progressbar_gfx_smooth");
124 HUD_Write_PanelCvar_q("_text");
126 case HUD_PANEL_NOTIFY:
127 HUD_Write_PanelCvar_q("_flip");
128 HUD_Write_PanelCvar_q("_fontsize");
129 HUD_Write_PanelCvar_q("_time");
130 HUD_Write_PanelCvar_q("_fadetime");
131 HUD_Write_PanelCvar_q("_icon_aspect");
133 case HUD_PANEL_TIMER:
134 HUD_Write_PanelCvar_q("_increment");
136 case HUD_PANEL_RADAR:
137 HUD_Write_PanelCvar_q("_foreground_alpha");
138 HUD_Write_PanelCvar_q("_rotation");
139 HUD_Write_PanelCvar_q("_zoommode");
140 HUD_Write_PanelCvar_q("_scale");
141 HUD_Write_PanelCvar_q("_maximized_scale");
142 HUD_Write_PanelCvar_q("_maximized_size");
143 HUD_Write_PanelCvar_q("_maximized_rotation");
144 HUD_Write_PanelCvar_q("_maximized_zoommode");
146 case HUD_PANEL_SCORE:
147 HUD_Write_PanelCvar_q("_rankings");
150 HUD_Write_PanelCvar_q("_alreadyvoted_alpha");
152 case HUD_PANEL_MODICONS:
153 HUD_Write_PanelCvar_q("_ca_layout");
154 HUD_Write_PanelCvar_q("_dom_layout");
155 HUD_Write_PanelCvar_q("_freezetag_layout");
157 case HUD_PANEL_PRESSEDKEYS:
158 HUD_Write_PanelCvar_q("_aspect");
159 HUD_Write_PanelCvar_q("_attack");
161 case HUD_PANEL_ENGINEINFO:
162 HUD_Write_PanelCvar_q("_framecounter_time");
163 HUD_Write_PanelCvar_q("_framecounter_decimals");
165 case HUD_PANEL_INFOMESSAGES:
166 HUD_Write_PanelCvar_q("_flip");
168 case HUD_PANEL_PHYSICS:
169 HUD_Write_PanelCvar_q("_speed_unit");
170 HUD_Write_PanelCvar_q("_speed_unit_show");
171 HUD_Write_PanelCvar_q("_speed_max");
172 HUD_Write_PanelCvar_q("_speed_vertical");
173 HUD_Write_PanelCvar_q("_topspeed");
174 HUD_Write_PanelCvar_q("_topspeed_time");
175 HUD_Write_PanelCvar_q("_acceleration_max");
176 HUD_Write_PanelCvar_q("_acceleration_vertical");
177 HUD_Write_PanelCvar_q("_flip");
178 HUD_Write_PanelCvar_q("_baralign");
179 HUD_Write_PanelCvar_q("_progressbar");
180 HUD_Write_PanelCvar_q("_progressbar_acceleration_mode");
181 HUD_Write_PanelCvar_q("_progressbar_acceleration_scale");
182 HUD_Write_PanelCvar_q("_progressbar_acceleration_nonlinear");
183 HUD_Write_PanelCvar_q("_text");
184 HUD_Write_PanelCvar_q("_text_scale");
186 case HUD_PANEL_CENTERPRINT:
187 HUD_Write_PanelCvar_q("_align");
188 HUD_Write_PanelCvar_q("_flip");
189 HUD_Write_PanelCvar_q("_fontscale");
190 HUD_Write_PanelCvar_q("_time");
191 HUD_Write_PanelCvar_q("_fade_in");
192 HUD_Write_PanelCvar_q("_fade_out");
193 HUD_Write_PanelCvar_q("_fade_subsequent");
194 HUD_Write_PanelCvar_q("_fade_subsequent_passone");
195 HUD_Write_PanelCvar_q("_fade_subsequent_passone_minalpha");
196 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo");
197 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo_minalpha");
198 HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
199 HUD_Write_PanelCvar_q("_fade_minfontsize");
201 case HUD_PANEL_ITEMSTIME:
202 HUD_Write_PanelCvar_q("_iconalign");
203 HUD_Write_PanelCvar_q("_progressbar");
204 HUD_Write_PanelCvar_q("_progressbar_name");
205 HUD_Write_PanelCvar_q("_progressbar_reduced");
206 HUD_Write_PanelCvar_q("_text");
207 HUD_Write_PanelCvar_q("_ratio");
208 HUD_Write_PanelCvar_q("_dynamicsize");
209 case HUD_PANEL_QUICKMENU:
210 HUD_Write_PanelCvar_q("_align");
215 HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
217 LOG_INFOF(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
221 LOG_INFOF(_("^1Couldn't write to %s\n"), filename);
224 void HUD_Configure_Exit_Force()
229 localcmd("togglemenu\n");
231 cvar_set("_hud_configure", "0");
234 // check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
235 vector HUD_Panel_CheckMove(vector myPos, vector mySize)
237 vector myCenter, targCenter;
238 vector myTarget = myPos;
240 for (i = 0; i < hud_panels_COUNT; ++i) {
241 panel = hud_panels[i];
242 if(panel == HUD_PANEL(MAPVOTE)) continue;
243 if(panel == highlightedPanel) continue;
244 HUD_Panel_UpdatePosSize();
245 if(!panel_enabled) continue;
247 panel_pos -= '1 1 0' * panel_bg_border;
248 panel_size += '2 2 0' * panel_bg_border;
250 if(myPos.y + mySize.y < panel_pos.y)
252 if(myPos.y > panel_pos.y + panel_size.y)
255 if(myPos.x + mySize.x < panel_pos.x)
257 if(myPos.x > panel_pos.x + panel_size.x)
260 // OK, there IS a collision.
262 myCenter.x = myPos.x + 0.5 * mySize.x;
263 myCenter.y = myPos.y + 0.5 * mySize.y;
265 targCenter.x = panel_pos.x + 0.5 * panel_size.x;
266 targCenter.y = panel_pos.y + 0.5 * panel_size.y;
268 if(myCenter.x < targCenter.x && myCenter.y < targCenter.y) // top left (of the target panel)
270 if(myPos.x + mySize.x - panel_pos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
271 myTarget.x = panel_pos.x - mySize.x;
272 else // push it upwards
273 myTarget.y = panel_pos.y - mySize.y;
275 else if(myCenter.x > targCenter.x && myCenter.y < targCenter.y) // top right
277 if(panel_pos.x + panel_size.x - myPos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
278 myTarget.x = panel_pos.x + panel_size.x;
279 else // push it upwards
280 myTarget.y = panel_pos.y - mySize.y;
282 else if(myCenter.x < targCenter.x && myCenter.y > targCenter.y) // bottom left
284 if(myPos.x + mySize.x - panel_pos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
285 myTarget.x = panel_pos.x - mySize.x;
286 else // push it downwards
287 myTarget.y = panel_pos.y + panel_size.y;
289 else if(myCenter.x > targCenter.x && myCenter.y > targCenter.y) // bottom right
291 if(panel_pos.x + panel_size.x - myPos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
292 myTarget.x = panel_pos.x + panel_size.x;
293 else // push it downwards
294 myTarget.y = panel_pos.y + panel_size.y;
296 //if(cvar("hud_configure_checkcollisions_debug"))
297 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
303 void HUD_Panel_SetPos(vector pos)
305 panel = highlightedPanel;
306 HUD_Panel_UpdatePosSize();
310 //if(cvar("hud_configure_checkcollisions_debug"))
311 //drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
313 if(autocvar_hud_configure_grid)
315 pos.x = floor((pos.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
316 pos.y = floor((pos.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
319 if(hud_configure_checkcollisions)
320 pos = HUD_Panel_CheckMove(pos, mySize);
322 pos.x = bound(0, pos.x, vid_conwidth - mySize.x);
323 pos.y = bound(0, pos.y, vid_conheight - mySize.y);
326 s = strcat(ftos(pos.x/vid_conwidth), " ", ftos(pos.y/vid_conheight));
328 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
331 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
332 vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
335 float ratio = mySize.x/mySize.y;
337 for (i = 0; i < hud_panels_COUNT; ++i) {
338 panel = hud_panels[i];
339 if(panel == HUD_PANEL(MAPVOTE)) continue;
340 if(panel == highlightedPanel) continue;
341 HUD_Panel_UpdatePosSize();
342 if(!panel_enabled) continue;
344 panel_pos -= '1 1 0' * panel_bg_border;
345 panel_size += '2 2 0' * panel_bg_border;
347 targEndPos = panel_pos + panel_size;
349 // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
350 if(resizeorigin.x > panel_pos.x && resizeorigin.x < targEndPos.x && resizeorigin.y > panel_pos.y && resizeorigin.y < targEndPos.y)
353 if (resizeCorner == 1)
355 // check if this panel is on our way
356 if (resizeorigin.x <= panel_pos.x)
358 if (resizeorigin.y <= panel_pos.y)
360 if (targEndPos.x <= resizeorigin.x - mySize.x)
362 if (targEndPos.y <= resizeorigin.y - mySize.y)
365 // there is a collision:
366 // detect which side of the panel we are facing is actually limiting the resizing
367 // (which side the resize direction finds for first) and reduce the size up to there
369 // dist is the distance between resizeorigin and the "analogous" point of the panel
370 // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel
371 dist.x = resizeorigin.x - targEndPos.x;
372 dist.y = resizeorigin.y - targEndPos.y;
373 if (dist.y <= 0 || dist.x / dist.y > ratio)
374 mySize.x = min(mySize.x, dist.x);
376 mySize.y = min(mySize.y, dist.y);
378 else if (resizeCorner == 2)
380 if (resizeorigin.x >= targEndPos.x)
382 if (resizeorigin.y <= panel_pos.y)
384 if (panel_pos.x >= resizeorigin.x + mySize.x)
386 if (targEndPos.y <= resizeorigin.y - mySize.y)
389 dist.x = panel_pos.x - resizeorigin.x;
390 dist.y = resizeorigin.y - targEndPos.y;
391 if (dist.y <= 0 || dist.x / dist.y > ratio)
392 mySize.x = min(mySize.x, dist.x);
394 mySize.y = min(mySize.y, dist.y);
396 else if (resizeCorner == 3)
398 if (resizeorigin.x <= panel_pos.x)
400 if (resizeorigin.y >= targEndPos.y)
402 if (targEndPos.x <= resizeorigin.x - mySize.x)
404 if (panel_pos.y >= resizeorigin.y + mySize.y)
407 dist.x = resizeorigin.x - targEndPos.x;
408 dist.y = panel_pos.y - resizeorigin.y;
409 if (dist.y <= 0 || dist.x / dist.y > ratio)
410 mySize.x = min(mySize.x, dist.x);
412 mySize.y = min(mySize.y, dist.y);
414 else if (resizeCorner == 4)
416 if (resizeorigin.x >= targEndPos.x)
418 if (resizeorigin.y >= targEndPos.y)
420 if (panel_pos.x >= resizeorigin.x + mySize.x)
422 if (panel_pos.y >= resizeorigin.y + mySize.y)
425 dist.x = panel_pos.x - resizeorigin.x;
426 dist.y = panel_pos.y - resizeorigin.y;
427 if (dist.y <= 0 || dist.x / dist.y > ratio)
428 mySize.x = min(mySize.x, dist.x);
430 mySize.y = min(mySize.y, dist.y);
432 //if(cvar("hud_configure_checkcollisions_debug"))
433 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
439 void HUD_Panel_SetPosSize(vector mySize)
441 panel = highlightedPanel;
442 HUD_Panel_UpdatePosSize();
443 vector resizeorigin = panel_click_resizeorigin;
446 // minimum panel size cap
447 mySize.x = max(0.025 * vid_conwidth, mySize.x);
448 mySize.y = max(0.025 * vid_conheight, mySize.y);
450 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.
452 mySize.x = max(17 * autocvar_con_chatsize, mySize.x);
453 mySize.y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize.y);
456 // collision testing|
457 // -----------------+
459 // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
460 if(resizeCorner == 1) {
461 myPos.x = resizeorigin.x - mySize.x;
462 myPos.y = resizeorigin.y - mySize.y;
463 } else if(resizeCorner == 2) {
464 myPos.x = resizeorigin.x;
465 myPos.y = resizeorigin.y - mySize.y;
466 } else if(resizeCorner == 3) {
467 myPos.x = resizeorigin.x - mySize.x;
468 myPos.y = resizeorigin.y;
469 } else { // resizeCorner == 4
470 myPos.x = resizeorigin.x;
471 myPos.y = resizeorigin.y;
474 // left/top screen edges
476 mySize.x = mySize.x + myPos.x;
478 mySize.y = mySize.y + myPos.y;
480 // bottom/right screen edges
481 if(myPos.x + mySize.x > vid_conwidth)
482 mySize.x = vid_conwidth - myPos.x;
483 if(myPos.y + mySize.y > vid_conheight)
484 mySize.y = vid_conheight - myPos.y;
486 //if(cvar("hud_configure_checkcollisions_debug"))
487 //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
489 // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
490 if(autocvar_hud_configure_grid)
492 mySize.x = floor((mySize.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
493 mySize.y = floor((mySize.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
496 if(hud_configure_checkcollisions)
497 mySize = HUD_Panel_CheckResize(mySize, resizeorigin);
499 // 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)
500 mySize.x = max(0.025 * vid_conwidth, mySize.x);
501 mySize.y = max(0.025 * vid_conheight, mySize.y);
503 // do another pos check, as size might have changed by now
504 if(resizeCorner == 1) {
505 myPos.x = resizeorigin.x - mySize.x;
506 myPos.y = resizeorigin.y - mySize.y;
507 } else if(resizeCorner == 2) {
508 myPos.x = resizeorigin.x;
509 myPos.y = resizeorigin.y - mySize.y;
510 } else if(resizeCorner == 3) {
511 myPos.x = resizeorigin.x - mySize.x;
512 myPos.y = resizeorigin.y;
513 } else { // resizeCorner == 4
514 myPos.x = resizeorigin.x;
515 myPos.y = resizeorigin.y;
518 //if(cvar("hud_configure_checkcollisions_debug"))
519 //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
522 s = strcat(ftos(mySize.x/vid_conwidth), " ", ftos(mySize.y/vid_conheight));
523 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
525 s = strcat(ftos(myPos.x/vid_conwidth), " ", ftos(myPos.y/vid_conheight));
526 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
529 float pressed_key_time;
530 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
531 void HUD_Panel_Arrow_Action(float nPrimary)
533 if(!highlightedPanel)
536 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
539 if(autocvar_hud_configure_grid)
541 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
543 if (hudShiftState & S_SHIFT)
544 step = hud_configure_realGridSize.y;
546 step = 2 * hud_configure_realGridSize.y;
550 if (hudShiftState & S_SHIFT)
551 step = hud_configure_realGridSize.x;
553 step = 2 * hud_configure_realGridSize.x;
558 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
559 step = vid_conheight;
562 if (hudShiftState & S_SHIFT)
563 step = (step / 256); // more precision
565 step = (step / 64) * (1 + 2 * (time - pressed_key_time));
568 panel = highlightedPanel;
569 HUD_Panel_UpdatePosSize();
571 highlightedPanel_initial_pos = panel_pos;
572 highlightedPanel_initial_size = panel_size;
574 if (hudShiftState & S_ALT) // resize
576 if(nPrimary == K_UPARROW)
578 else if(nPrimary == K_RIGHTARROW)
580 else if(nPrimary == K_LEFTARROW)
582 else // if(nPrimary == K_DOWNARROW)
585 // ctrl+arrow reduces the size, instead of increasing it
586 // Note that ctrl disables collisions check too, but it's fine
587 // since we don't collide with anything reducing the size
588 if (hudShiftState & S_CTRL) {
590 resizeCorner = 5 - resizeCorner;
595 panel_click_resizeorigin = panel_pos;
596 if(resizeCorner == 1) {
597 panel_click_resizeorigin += mySize;
599 } else if(resizeCorner == 2) {
600 panel_click_resizeorigin.y += mySize.y;
602 } else if(resizeCorner == 3) {
603 panel_click_resizeorigin.x += mySize.x;
605 } else { // resizeCorner == 4
608 HUD_Panel_SetPosSize(mySize);
614 if(nPrimary == K_UPARROW)
616 else if(nPrimary == K_DOWNARROW)
618 else if(nPrimary == K_LEFTARROW)
620 else // if(nPrimary == K_RIGHTARROW)
623 HUD_Panel_SetPos(pos);
626 panel = highlightedPanel;
627 HUD_Panel_UpdatePosSize();
629 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
632 panel_pos_backup = highlightedPanel_initial_pos;
633 panel_size_backup = highlightedPanel_initial_size;
634 highlightedPanel_backup = highlightedPanel;
638 void HUD_Panel_EnableMenu();
639 entity tab_panels[hud_panels_MAX];
641 vector tab_panel_pos;
643 void HUD_Panel_FirstInDrawQ(float id);
644 void reset_tab_panels()
647 for(i = 0; i < hud_panels_COUNT; ++i)
648 tab_panels[i] = world;
650 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
657 if(!autocvar__hud_configure)
662 mousepos.x = nPrimary;
663 mousepos.y = nSecondary;
667 // block any input while a menu dialog is fading
668 // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
669 if(autocvar__menu_alpha)
676 // allow console bind to work
679 con_keys = findkeysforcommand("toggleconsole", 0);
680 keys = tokenize(con_keys); // findkeysforcommand returns data for this
682 bool hit_con_bind = false;
684 for (i = 0; i < keys; ++i)
686 if(nPrimary == stof(argv(i)))
690 if(bInputType == 0) {
691 if(nPrimary == K_ALT) hudShiftState |= S_ALT;
692 if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
693 if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
695 else if(bInputType == 1) {
696 if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
697 if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
698 if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
701 if(nPrimary == K_CTRL)
703 if (bInputType == 1) //ctrl has been released
707 //switch to selected panel
708 highlightedPanel = tab_panel;
709 highlightedAction = 0;
710 HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id);
717 if(nPrimary == K_MOUSE1)
719 if(bInputType == 0) // key pressed
720 mouseClicked |= S_MOUSE1;
721 else if(bInputType == 1) // key released
722 mouseClicked -= (mouseClicked & S_MOUSE1);
724 else if(nPrimary == K_MOUSE2)
726 if(bInputType == 0) // key pressed
727 mouseClicked |= S_MOUSE2;
728 else if(bInputType == 1) // key released
729 mouseClicked -= (mouseClicked & S_MOUSE2);
731 else if(nPrimary == K_ESCAPE)
736 localcmd("menu_showhudexit\n");
738 else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
743 cvar_set("_hud_configure", "0");
745 else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel
747 if (bInputType == 1 || mouseClicked)
750 // FIXME minor bug: if a panel is highlighted, has the same pos_x and
751 // lays in the same level of another panel then the next consecutive
752 // CTRL TAB presses will reselect once more the highlighted panel
754 entity starting_panel;
755 entity old_tab_panel = tab_panel;
756 if (!tab_panel) //first press of TAB
758 if (highlightedPanel)
760 panel = highlightedPanel;
761 HUD_Panel_UpdatePosSize();
765 starting_panel = highlightedPanel;
766 tab_panel_pos = panel_pos; //to compute level
770 if ( ((!tab_backward) && (hudShiftState & S_SHIFT)) || (tab_backward && !(hudShiftState & S_SHIFT)) ) //tab direction changed?
772 starting_panel = tab_panel;
774 tab_backward = (hudShiftState & S_SHIFT);
776 float k, level = 0, start_posX;
777 vector candidate_pos = '0 0 0';
778 const float LEVELS_NUM = 4;
779 float level_height = vid_conheight / LEVELS_NUM;
781 level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
782 candidate_pos.x = (!tab_backward) ? vid_conwidth : 0;
783 start_posX = tab_panel_pos.x;
788 for(i = 0; i < hud_panels_COUNT; ++i)
790 panel = hud_panels[i];
791 if(panel == HUD_PANEL(MAPVOTE))
793 if (panel == tab_panels[i] || panel == starting_panel)
795 HUD_Panel_UpdatePosSize();
796 if (panel_pos.y >= level && (panel_pos.y - level) < level_height)
797 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)) )
798 || ( 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)) ) )
801 tab_panel_pos = candidate_pos = panel_pos;
806 if (k == LEVELS_NUM) //tab_panel not found
814 starting_panel = old_tab_panel;
815 old_tab_panel = world;
816 goto find_tab_panel; //u must find tab_panel!
820 level = (level + level_height) % vid_conheight;
822 candidate_pos.x = vid_conwidth;
826 level = (level - level_height) % vid_conheight;
827 start_posX = vid_conwidth;
832 tab_panels[tab_panel.panel_id] = tab_panel;
834 else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
836 if (bInputType == 1 || mouseClicked)
839 if (highlightedPanel)
840 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
842 cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
844 else if(nPrimary == 'c' && hudShiftState & S_CTRL) // copy highlighted panel size
846 if (bInputType == 1 || mouseClicked)
849 if (highlightedPanel)
851 panel = highlightedPanel;
852 HUD_Panel_UpdatePosSize();
853 panel_size_copied = panel_size;
856 else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
858 if (bInputType == 1 || mouseClicked)
861 if (panel_size_copied == '0 0 0' || !highlightedPanel)
864 panel = highlightedPanel;
865 HUD_Panel_UpdatePosSize();
867 // reduce size if it'd go beyond screen boundaries
868 vector tmp_size = panel_size_copied;
869 if (panel_pos.x + panel_size_copied.x > vid_conwidth)
870 tmp_size.x = vid_conwidth - panel_pos.x;
871 if (panel_pos.y + panel_size_copied.y > vid_conheight)
872 tmp_size.y = vid_conheight - panel_pos.y;
874 if (panel_size == tmp_size)
878 panel_pos_backup = panel_pos;
879 panel_size_backup = panel_size;
880 highlightedPanel_backup = highlightedPanel;
882 s = strcat(ftos(tmp_size.x/vid_conwidth), " ", ftos(tmp_size.y/vid_conheight));
883 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
885 else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
887 if (bInputType == 1 || mouseClicked)
889 //restore previous values
890 if (highlightedPanel_backup)
892 s = strcat(ftos(panel_pos_backup.x/vid_conwidth), " ", ftos(panel_pos_backup.y/vid_conheight));
893 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
894 s = strcat(ftos(panel_size_backup.x/vid_conwidth), " ", ftos(panel_size_backup.y/vid_conheight));
895 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
896 highlightedPanel_backup = world;
899 else if(nPrimary == 's' && hudShiftState & S_CTRL) // save config
901 if (bInputType == 1 || mouseClicked)
903 localcmd("hud save myconfig\n");
905 else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
909 pressed_key_time = 0;
912 else if (pressed_key_time == 0)
913 pressed_key_time = time;
916 HUD_Panel_Arrow_Action(nPrimary); //move or resize panel
918 else if(nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
922 if (highlightedPanel)
923 HUD_Panel_EnableMenu();
925 else if(hit_con_bind || nPrimary == K_PAUSE)
931 float HUD_Panel_Check_Mouse_Pos(float allow_move)
934 while(j < hud_panels_COUNT)
939 panel = hud_panels[i];
940 if(panel == HUD_PANEL(MAPVOTE)) continue;
941 HUD_Panel_UpdatePosSize();
943 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
946 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)
950 // resize from topleft border
951 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)
955 // resize from topright border
956 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)
960 // resize from bottomleft border
961 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)
965 // resize from bottomright border
966 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)
974 // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else)
975 void HUD_Panel_FirstInDrawQ(float id)
979 // find out where in the array our current id is, save into place
980 for(i = 0; i < hud_panels_COUNT; ++i)
982 if(panel_order[i] == id)
988 // place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
990 place = hud_panels_COUNT - 1;
992 // move all ids up by one step in the array until "place"
993 for(i = place; i > 0; --i)
995 panel_order[i] = panel_order[i-1];
997 // now save the new top id
1000 // let's save them into the cvar by some strcat trickery
1002 for(i = 0; i < hud_panels_COUNT; ++i)
1004 s = strcat(s, ftos(panel_order[i]), " ");
1006 cvar_set("_hud_panelorder", s);
1007 if(hud_panelorder_prev)
1008 strunzone(hud_panelorder_prev);
1009 hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
1012 void HUD_Panel_Highlight(float allow_move)
1016 while(j < hud_panels_COUNT)
1021 panel = hud_panels[i];
1022 if(panel == HUD_PANEL(MAPVOTE))
1024 HUD_Panel_UpdatePosSize();
1026 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
1029 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)
1031 highlightedPanel = hud_panels[i];
1032 HUD_Panel_FirstInDrawQ(i);
1033 highlightedAction = 1;
1034 panel_click_distance = mousepos - panel_pos;
1037 // resize from topleft border
1038 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)
1040 highlightedPanel = hud_panels[i];
1041 HUD_Panel_FirstInDrawQ(i);
1042 highlightedAction = 2;
1044 panel_click_distance = mousepos - panel_pos;
1045 panel_click_resizeorigin = panel_pos + panel_size;
1048 // resize from topright border
1049 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)
1051 highlightedPanel = hud_panels[i];
1052 HUD_Panel_FirstInDrawQ(i);
1053 highlightedAction = 2;
1055 panel_click_distance.x = panel_size.x - mousepos.x + panel_pos.x;
1056 panel_click_distance.y = mousepos.y - panel_pos.y;
1057 panel_click_resizeorigin = panel_pos + eY * panel_size.y;
1060 // resize from bottomleft border
1061 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)
1063 highlightedPanel = hud_panels[i];
1064 HUD_Panel_FirstInDrawQ(i);
1065 highlightedAction = 2;
1067 panel_click_distance.x = mousepos.x - panel_pos.x;
1068 panel_click_distance.y = panel_size.y - mousepos.y + panel_pos.y;
1069 panel_click_resizeorigin = panel_pos + eX * panel_size.x;
1072 // resize from bottomright border
1073 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)
1075 highlightedPanel = hud_panels[i];
1076 HUD_Panel_FirstInDrawQ(i);
1077 highlightedAction = 2;
1079 panel_click_distance = panel_size - mousepos + panel_pos;
1080 panel_click_resizeorigin = panel_pos;
1084 highlightedPanel = world;
1085 highlightedAction = 0;
1088 void HUD_Panel_EnableMenu()
1091 localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
1093 float mouse_over_panel;
1094 void HUD_Panel_Mouse()
1096 if(autocvar__menu_alpha == 1)
1099 if (!autocvar_hud_cursormode)
1101 mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
1103 mousepos.x = bound(0, mousepos.x, vid_conwidth);
1104 mousepos.y = bound(0, mousepos.y, vid_conheight);
1109 if(prevMouseClicked == 0)
1113 //stop ctrl-tab selection
1117 HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
1118 // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
1119 if (highlightedPanel)
1121 highlightedPanel_initial_pos = panel_pos;
1122 highlightedPanel_initial_size = panel_size;
1124 // doubleclick check
1125 if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel && prevMouseClickedPos == mousepos)
1127 mouseClicked = 0; // to prevent spam, I guess.
1128 HUD_Panel_EnableMenu();
1132 if (mouseClicked & S_MOUSE1)
1134 prevMouseClickedTime = time;
1135 prevMouseClickedPos = mousepos;
1137 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(mouseClicked & S_MOUSE1);
1142 panel = highlightedPanel;
1143 HUD_Panel_UpdatePosSize();
1146 if (highlightedPanel)
1148 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1149 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
1151 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
1153 panel_pos_backup = highlightedPanel_initial_pos;
1154 panel_size_backup = highlightedPanel_initial_size;
1155 highlightedPanel_backup = highlightedPanel;
1158 // in case the clicked panel is inside another panel and we aren't
1159 // moving it, avoid the immediate "fix" of its position/size
1160 // (often unwanted and hateful) by disabling collisions check
1161 hud_configure_checkcollisions = false;
1164 if(highlightedAction == 1)
1165 HUD_Panel_SetPos(mousepos - panel_click_distance);
1166 else if(highlightedAction == 2)
1168 vector mySize = '0 0 0';
1169 if(resizeCorner == 1) {
1170 mySize.x = panel_click_resizeorigin.x - (mousepos.x - panel_click_distance.x);
1171 mySize.y = panel_click_resizeorigin.y - (mousepos.y - panel_click_distance.y);
1172 } else if(resizeCorner == 2) {
1173 mySize.x = mousepos.x + panel_click_distance.x - panel_click_resizeorigin.x;
1174 mySize.y = panel_click_distance.y + panel_click_resizeorigin.y - mousepos.y;
1175 } else if(resizeCorner == 3) {
1176 mySize.x = panel_click_resizeorigin.x + panel_click_distance.x - mousepos.x;
1177 mySize.y = mousepos.y + panel_click_distance.y - panel_click_resizeorigin.y;
1178 } else { // resizeCorner == 4
1179 mySize.x = mousepos.x - (panel_click_resizeorigin.x - panel_click_distance.x);
1180 mySize.y = mousepos.y - (panel_click_resizeorigin.y - panel_click_distance.y);
1182 HUD_Panel_SetPosSize(mySize);
1187 if(prevMouseClicked)
1188 highlightedAction = 0;
1189 if(menu_enabled == 2)
1190 mouse_over_panel = 0;
1192 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true);
1193 if (mouse_over_panel && !tab_panel)
1194 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1196 // draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
1197 const vector cursorsize = '32 32 0';
1198 float cursor_alpha = 1 - autocvar__menu_alpha;
1200 if(!mouse_over_panel)
1201 drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1202 else if(mouse_over_panel == 1)
1203 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1204 else if(mouse_over_panel == 2)
1205 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1207 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1209 prevMouseClicked = mouseClicked;
1211 void HUD_Configure_DrawGrid()
1214 if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
1216 hud_configure_gridSize.x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
1217 hud_configure_gridSize.y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
1218 hud_configure_realGridSize.x = hud_configure_gridSize.x * vid_conwidth;
1219 hud_configure_realGridSize.y = hud_configure_gridSize.y * vid_conheight;
1222 s = eX + eY * vid_conheight;
1223 for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
1224 drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1226 s = eY + eX * vid_conwidth;
1227 for(i = 1; i < 1/hud_configure_gridSize.y; ++i)
1228 drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1232 float _menu_alpha_prev;
1233 void HUD_Configure_Frame()
1236 if(autocvar__hud_configure)
1238 if(isdemo() || intermission == 2)
1240 HUD_Configure_Exit_Force();
1244 if(!hud_configure_prev)
1246 if(autocvar_hud_cursormode)
1249 for(i = hud_panels_COUNT - 1; i >= 0; --i)
1250 hud_panels[panel_order[i]].update_time = time;
1253 // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
1254 if(autocvar__menu_alpha != _menu_alpha_prev)
1256 if(autocvar__menu_alpha == 0)
1258 _menu_alpha_prev = autocvar__menu_alpha;
1261 HUD_Configure_DrawGrid();
1263 else if(hud_configure_prev)
1267 if(autocvar_hud_cursormode)
1272 const float hlBorderSize = 2;
1273 const string hlBorder = "gfx/hud/default/border_highlighted";
1274 const string hlBorder2 = "gfx/hud/default/border_highlighted2";
1275 void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
1277 drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
1278 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);
1279 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);
1280 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);
1281 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);
1284 void HUD_Configure_PostDraw()
1286 if(autocvar__hud_configure)
1291 HUD_Panel_UpdatePosSize();
1292 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
1294 if(highlightedPanel)
1296 panel = highlightedPanel;
1297 HUD_Panel_UpdatePosSize();
1298 HUD_Panel_HlBorder(panel_bg_border * hlBorderSize, '0 0.5 1', 0.4 * (1 - autocvar__menu_alpha));