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("_flip");
114 HUD_Write_PanelCvar_q("_iconalign");
115 HUD_Write_PanelCvar_q("_baralign");
116 HUD_Write_PanelCvar_q("_progressbar");
117 HUD_Write_PanelCvar_q("_progressbar_strength");
118 HUD_Write_PanelCvar_q("_progressbar_shield");
119 HUD_Write_PanelCvar_q("_text");
121 case HUD_PANEL_HEALTHARMOR:
122 HUD_Write_PanelCvar_q("_flip");
123 HUD_Write_PanelCvar_q("_iconalign");
124 HUD_Write_PanelCvar_q("_baralign");
125 HUD_Write_PanelCvar_q("_progressbar");
126 HUD_Write_PanelCvar_q("_progressbar_health");
127 HUD_Write_PanelCvar_q("_progressbar_armor");
128 HUD_Write_PanelCvar_q("_progressbar_gfx");
129 HUD_Write_PanelCvar_q("_progressbar_gfx_smooth");
130 HUD_Write_PanelCvar_q("_text");
132 case HUD_PANEL_NOTIFY:
133 HUD_Write_PanelCvar_q("_flip");
134 HUD_Write_PanelCvar_q("_fontsize");
135 HUD_Write_PanelCvar_q("_time");
136 HUD_Write_PanelCvar_q("_fadetime");
137 HUD_Write_PanelCvar_q("_icon_aspect");
139 case HUD_PANEL_TIMER:
140 HUD_Write_PanelCvar_q("_increment");
142 case HUD_PANEL_RADAR:
143 HUD_Write_PanelCvar_q("_foreground_alpha");
144 HUD_Write_PanelCvar_q("_rotation");
145 HUD_Write_PanelCvar_q("_zoommode");
146 HUD_Write_PanelCvar_q("_scale");
147 HUD_Write_PanelCvar_q("_maximized_scale");
148 HUD_Write_PanelCvar_q("_maximized_size");
149 HUD_Write_PanelCvar_q("_maximized_rotation");
150 HUD_Write_PanelCvar_q("_maximized_zoommode");
152 case HUD_PANEL_SCORE:
153 HUD_Write_PanelCvar_q("_rankings");
156 HUD_Write_PanelCvar_q("_alreadyvoted_alpha");
158 case HUD_PANEL_MODICONS:
159 HUD_Write_PanelCvar_q("_ca_layout");
160 HUD_Write_PanelCvar_q("_dom_layout");
161 HUD_Write_PanelCvar_q("_freezetag_layout");
163 case HUD_PANEL_PRESSEDKEYS:
164 HUD_Write_PanelCvar_q("_aspect");
165 HUD_Write_PanelCvar_q("_attack");
167 case HUD_PANEL_ENGINEINFO:
168 HUD_Write_PanelCvar_q("_framecounter_time");
169 HUD_Write_PanelCvar_q("_framecounter_decimals");
171 case HUD_PANEL_INFOMESSAGES:
172 HUD_Write_PanelCvar_q("_flip");
174 case HUD_PANEL_PHYSICS:
175 HUD_Write_PanelCvar_q("_speed_unit");
176 HUD_Write_PanelCvar_q("_speed_unit_show");
177 HUD_Write_PanelCvar_q("_speed_max");
178 HUD_Write_PanelCvar_q("_speed_vertical");
179 HUD_Write_PanelCvar_q("_topspeed");
180 HUD_Write_PanelCvar_q("_topspeed_time");
181 HUD_Write_PanelCvar_q("_acceleration_max");
182 HUD_Write_PanelCvar_q("_acceleration_vertical");
183 HUD_Write_PanelCvar_q("_flip");
184 HUD_Write_PanelCvar_q("_baralign");
185 HUD_Write_PanelCvar_q("_progressbar");
186 HUD_Write_PanelCvar_q("_progressbar_acceleration_mode");
187 HUD_Write_PanelCvar_q("_progressbar_acceleration_scale");
188 HUD_Write_PanelCvar_q("_progressbar_acceleration_nonlinear");
189 HUD_Write_PanelCvar_q("_text");
190 HUD_Write_PanelCvar_q("_text_scale");
192 case HUD_PANEL_CENTERPRINT:
193 HUD_Write_PanelCvar_q("_align");
194 HUD_Write_PanelCvar_q("_flip");
195 HUD_Write_PanelCvar_q("_fontscale");
196 HUD_Write_PanelCvar_q("_time");
197 HUD_Write_PanelCvar_q("_fade_in");
198 HUD_Write_PanelCvar_q("_fade_out");
199 HUD_Write_PanelCvar_q("_fade_subsequent");
200 HUD_Write_PanelCvar_q("_fade_subsequent_passone");
201 HUD_Write_PanelCvar_q("_fade_subsequent_passone_minalpha");
202 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo");
203 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo_minalpha");
204 HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
205 HUD_Write_PanelCvar_q("_fade_minfontsize");
210 HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
212 printf(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
216 printf(_("^1Couldn't write to %s\n"), filename);
219 void HUD_Configure_Exit_Force()
224 localcmd("togglemenu\n");
226 cvar_set("_hud_configure", "0");
229 // check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
230 vector HUD_Panel_CheckMove(vector myPos, vector mySize)
232 vector myCenter, targCenter;
233 vector myTarget = myPos;
235 for (i = 0; i < HUD_PANEL_NUM; ++i) {
236 panel = hud_panel[i];
237 if(panel == HUD_PANEL(MAPVOTE)) continue;
238 if(panel == highlightedPanel) continue;
239 HUD_Panel_UpdatePosSize();
240 if(!panel_enabled) continue;
242 panel_pos -= '1 1 0' * panel_bg_border;
243 panel_size += '2 2 0' * panel_bg_border;
245 if(myPos.y + mySize.y < panel_pos.y)
247 if(myPos.y > panel_pos.y + panel_size.y)
250 if(myPos.x + mySize.x < panel_pos.x)
252 if(myPos.x > panel_pos.x + panel_size.x)
255 // OK, there IS a collision.
257 myCenter.x = myPos.x + 0.5 * mySize.x;
258 myCenter.y = myPos.y + 0.5 * mySize.y;
260 targCenter.x = panel_pos.x + 0.5 * panel_size.x;
261 targCenter.y = panel_pos.y + 0.5 * panel_size.y;
263 if(myCenter.x < targCenter.x && myCenter.y < targCenter.y) // top left (of the target panel)
265 if(myPos.x + mySize.x - panel_pos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
266 myTarget.x = panel_pos.x - mySize.x;
267 else // push it upwards
268 myTarget.y = panel_pos.y - mySize.y;
270 else if(myCenter.x > targCenter.x && myCenter.y < targCenter.y) // top right
272 if(panel_pos.x + panel_size.x - myPos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
273 myTarget.x = panel_pos.x + panel_size.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) // bottom left
279 if(myPos.x + mySize.x - panel_pos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
280 myTarget.x = panel_pos.x - mySize.x;
281 else // push it downwards
282 myTarget.y = panel_pos.y + panel_size.y;
284 else if(myCenter.x > targCenter.x && myCenter.y > targCenter.y) // bottom right
286 if(panel_pos.x + panel_size.x - myPos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
287 myTarget.x = panel_pos.x + panel_size.x;
288 else // push it downwards
289 myTarget.y = panel_pos.y + panel_size.y;
291 //if(cvar("hud_configure_checkcollisions_debug"))
292 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
298 void HUD_Panel_SetPos(vector pos)
300 panel = highlightedPanel;
301 HUD_Panel_UpdatePosSize();
305 //if(cvar("hud_configure_checkcollisions_debug"))
306 //drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
308 if(autocvar_hud_configure_grid)
310 pos.x = floor((pos.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
311 pos.y = floor((pos.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
314 if(hud_configure_checkcollisions)
315 pos = HUD_Panel_CheckMove(pos, mySize);
317 pos.x = bound(0, pos.x, vid_conwidth - mySize.x);
318 pos.y = bound(0, pos.y, vid_conheight - mySize.y);
321 s = strcat(ftos(pos.x/vid_conwidth), " ", ftos(pos.y/vid_conheight));
323 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
326 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
327 vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
330 float ratio = mySize.x/mySize.y;
332 for (i = 0; i < HUD_PANEL_NUM; ++i) {
333 panel = hud_panel[i];
334 if(panel == HUD_PANEL(MAPVOTE)) continue;
335 if(panel == highlightedPanel) continue;
336 HUD_Panel_UpdatePosSize();
337 if(!panel_enabled) continue;
339 panel_pos -= '1 1 0' * panel_bg_border;
340 panel_size += '2 2 0' * panel_bg_border;
342 targEndPos = panel_pos + panel_size;
344 // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
345 if(resizeorigin.x > panel_pos.x && resizeorigin.x < targEndPos.x && resizeorigin.y > panel_pos.y && resizeorigin.y < targEndPos.y)
348 if (resizeCorner == 1)
350 // check if this panel is on our way
351 if (resizeorigin.x <= panel_pos.x)
353 if (resizeorigin.y <= panel_pos.y)
355 if (targEndPos.x <= resizeorigin.x - mySize.x)
357 if (targEndPos.y <= resizeorigin.y - mySize.y)
360 // there is a collision:
361 // detect which side of the panel we are facing is actually limiting the resizing
362 // (which side the resize direction finds for first) and reduce the size up to there
364 // dist is the distance between resizeorigin and the "analogous" point of the panel
365 // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel
366 dist.x = resizeorigin.x - targEndPos.x;
367 dist.y = resizeorigin.y - targEndPos.y;
368 if (dist.y <= 0 || dist.x / dist.y > ratio)
369 mySize.x = min(mySize.x, dist.x);
371 mySize.y = min(mySize.y, dist.y);
373 else if (resizeCorner == 2)
375 if (resizeorigin.x >= targEndPos.x)
377 if (resizeorigin.y <= panel_pos.y)
379 if (panel_pos.x >= resizeorigin.x + mySize.x)
381 if (targEndPos.y <= resizeorigin.y - mySize.y)
384 dist.x = panel_pos.x - resizeorigin.x;
385 dist.y = resizeorigin.y - targEndPos.y;
386 if (dist.y <= 0 || dist.x / dist.y > ratio)
387 mySize.x = min(mySize.x, dist.x);
389 mySize.y = min(mySize.y, dist.y);
391 else if (resizeCorner == 3)
393 if (resizeorigin.x <= panel_pos.x)
395 if (resizeorigin.y >= targEndPos.y)
397 if (targEndPos.x <= resizeorigin.x - mySize.x)
399 if (panel_pos.y >= resizeorigin.y + mySize.y)
402 dist.x = resizeorigin.x - targEndPos.x;
403 dist.y = panel_pos.y - resizeorigin.y;
404 if (dist.y <= 0 || dist.x / dist.y > ratio)
405 mySize.x = min(mySize.x, dist.x);
407 mySize.y = min(mySize.y, dist.y);
409 else if (resizeCorner == 4)
411 if (resizeorigin.x >= targEndPos.x)
413 if (resizeorigin.y >= targEndPos.y)
415 if (panel_pos.x >= resizeorigin.x + mySize.x)
417 if (panel_pos.y >= resizeorigin.y + mySize.y)
420 dist.x = panel_pos.x - resizeorigin.x;
421 dist.y = panel_pos.y - resizeorigin.y;
422 if (dist.y <= 0 || dist.x / dist.y > ratio)
423 mySize.x = min(mySize.x, dist.x);
425 mySize.y = min(mySize.y, dist.y);
427 //if(cvar("hud_configure_checkcollisions_debug"))
428 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
434 void HUD_Panel_SetPosSize(vector mySize)
436 panel = highlightedPanel;
437 HUD_Panel_UpdatePosSize();
438 vector resizeorigin = panel_click_resizeorigin;
441 // minimum panel size cap
442 mySize.x = max(0.025 * vid_conwidth, mySize.x);
443 mySize.y = max(0.025 * vid_conheight, mySize.y);
445 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.
447 mySize.x = max(17 * autocvar_con_chatsize, mySize.x);
448 mySize.y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize.y);
451 // collision testing|
452 // -----------------+
454 // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
455 if(resizeCorner == 1) {
456 myPos.x = resizeorigin.x - mySize.x;
457 myPos.y = resizeorigin.y - mySize.y;
458 } else if(resizeCorner == 2) {
459 myPos.x = resizeorigin.x;
460 myPos.y = resizeorigin.y - mySize.y;
461 } else if(resizeCorner == 3) {
462 myPos.x = resizeorigin.x - mySize.x;
463 myPos.y = resizeorigin.y;
464 } else { // resizeCorner == 4
465 myPos.x = resizeorigin.x;
466 myPos.y = resizeorigin.y;
469 // left/top screen edges
471 mySize.x = mySize.x + myPos.x;
473 mySize.y = mySize.y + myPos.y;
475 // bottom/right screen edges
476 if(myPos.x + mySize.x > vid_conwidth)
477 mySize.x = vid_conwidth - myPos.x;
478 if(myPos.y + mySize.y > vid_conheight)
479 mySize.y = vid_conheight - myPos.y;
481 //if(cvar("hud_configure_checkcollisions_debug"))
482 //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
484 // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
485 if(autocvar_hud_configure_grid)
487 mySize.x = floor((mySize.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
488 mySize.y = floor((mySize.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
491 if(hud_configure_checkcollisions)
492 mySize = HUD_Panel_CheckResize(mySize, resizeorigin);
494 // 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)
495 mySize.x = max(0.025 * vid_conwidth, mySize.x);
496 mySize.y = max(0.025 * vid_conheight, mySize.y);
498 // do another pos check, as size might have changed by now
499 if(resizeCorner == 1) {
500 myPos.x = resizeorigin.x - mySize.x;
501 myPos.y = resizeorigin.y - mySize.y;
502 } else if(resizeCorner == 2) {
503 myPos.x = resizeorigin.x;
504 myPos.y = resizeorigin.y - mySize.y;
505 } else if(resizeCorner == 3) {
506 myPos.x = resizeorigin.x - mySize.x;
507 myPos.y = resizeorigin.y;
508 } else { // resizeCorner == 4
509 myPos.x = resizeorigin.x;
510 myPos.y = resizeorigin.y;
513 //if(cvar("hud_configure_checkcollisions_debug"))
514 //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
517 s = strcat(ftos(mySize.x/vid_conwidth), " ", ftos(mySize.y/vid_conheight));
518 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
520 s = strcat(ftos(myPos.x/vid_conwidth), " ", ftos(myPos.y/vid_conheight));
521 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
524 float pressed_key_time;
525 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
526 void HUD_Panel_Arrow_Action(float nPrimary)
528 if(!highlightedPanel)
531 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
534 if(autocvar_hud_configure_grid)
536 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
538 if (hudShiftState & S_SHIFT)
539 step = hud_configure_realGridSize.y;
541 step = 2 * hud_configure_realGridSize.y;
545 if (hudShiftState & S_SHIFT)
546 step = hud_configure_realGridSize.x;
548 step = 2 * hud_configure_realGridSize.x;
553 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
554 step = vid_conheight;
557 if (hudShiftState & S_SHIFT)
558 step = (step / 256); // more precision
560 step = (step / 64) * (1 + 2 * (time - pressed_key_time));
563 panel = highlightedPanel;
564 HUD_Panel_UpdatePosSize();
566 highlightedPanel_initial_pos = panel_pos;
567 highlightedPanel_initial_size = panel_size;
569 if (hudShiftState & S_ALT) // resize
571 if(nPrimary == K_UPARROW)
573 else if(nPrimary == K_RIGHTARROW)
575 else if(nPrimary == K_LEFTARROW)
577 else // if(nPrimary == K_DOWNARROW)
580 // ctrl+arrow reduces the size, instead of increasing it
581 // Note that ctrl disables collisions check too, but it's fine
582 // since we don't collide with anything reducing the size
583 if (hudShiftState & S_CTRL) {
585 resizeCorner = 5 - resizeCorner;
590 panel_click_resizeorigin = panel_pos;
591 if(resizeCorner == 1) {
592 panel_click_resizeorigin += mySize;
594 } else if(resizeCorner == 2) {
595 panel_click_resizeorigin.y += mySize.y;
597 } else if(resizeCorner == 3) {
598 panel_click_resizeorigin.x += mySize.x;
600 } else { // resizeCorner == 4
603 HUD_Panel_SetPosSize(mySize);
609 if(nPrimary == K_UPARROW)
611 else if(nPrimary == K_DOWNARROW)
613 else if(nPrimary == K_LEFTARROW)
615 else // if(nPrimary == K_RIGHTARROW)
618 HUD_Panel_SetPos(pos);
621 panel = highlightedPanel;
622 HUD_Panel_UpdatePosSize();
624 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
627 panel_pos_backup = highlightedPanel_initial_pos;
628 panel_size_backup = highlightedPanel_initial_size;
629 highlightedPanel_backup = highlightedPanel;
633 const int S_MOUSE1 = 1;
634 const int S_MOUSE2 = 2;
635 const int S_MOUSE3 = 4;
637 int prevMouseClicked; // previous state
638 float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks
639 vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks
641 void HUD_Panel_EnableMenu();
642 entity tab_panels[HUD_PANEL_MAX];
644 vector tab_panel_pos;
646 void HUD_Panel_FirstInDrawQ(float id);
647 void reset_tab_panels()
650 for(i = 0; i < HUD_PANEL_NUM; ++i)
651 tab_panels[i] = world;
653 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
660 if(!autocvar__hud_configure)
665 mousepos.x = nPrimary;
666 mousepos.y = nSecondary;
670 // block any input while a menu dialog is fading
671 // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
672 if(autocvar__menu_alpha)
679 // allow console bind to work
682 con_keys = findkeysforcommand("toggleconsole", 0);
683 keys = tokenize(con_keys); // findkeysforcommand returns data for this
685 bool hit_con_bind = false;
687 for (i = 0; i < keys; ++i)
689 if(nPrimary == stof(argv(i)))
693 if(bInputType == 0) {
694 if(nPrimary == K_ALT) hudShiftState |= S_ALT;
695 if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
696 if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
698 else if(bInputType == 1) {
699 if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
700 if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
701 if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
704 if(nPrimary == K_CTRL)
706 if (bInputType == 1) //ctrl has been released
710 //switch to selected panel
711 highlightedPanel = tab_panel;
712 highlightedAction = 0;
713 HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id);
720 if(nPrimary == K_MOUSE1)
722 if(bInputType == 0) // key pressed
723 mouseClicked |= S_MOUSE1;
724 else if(bInputType == 1) // key released
725 mouseClicked -= (mouseClicked & S_MOUSE1);
727 else if(nPrimary == K_MOUSE2)
729 if(bInputType == 0) // key pressed
730 mouseClicked |= S_MOUSE2;
731 else if(bInputType == 1) // key released
732 mouseClicked -= (mouseClicked & S_MOUSE2);
734 else if(nPrimary == K_ESCAPE)
739 localcmd("menu_showhudexit\n");
741 else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
746 cvar_set("_hud_configure", "0");
748 else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel
750 if (bInputType == 1 || mouseClicked)
753 // FIXME minor bug: if a panel is highlighted, has the same pos_x and
754 // lays in the same level of another panel then the next consecutive
755 // CTRL TAB presses will reselect once more the highlighted panel
757 entity starting_panel;
758 entity old_tab_panel = tab_panel;
759 if (!tab_panel) //first press of TAB
761 if (highlightedPanel)
763 panel = highlightedPanel;
764 HUD_Panel_UpdatePosSize();
768 starting_panel = highlightedPanel;
769 tab_panel_pos = panel_pos; //to compute level
773 if ( ((!tab_backward) && (hudShiftState & S_SHIFT)) || (tab_backward && !(hudShiftState & S_SHIFT)) ) //tab direction changed?
775 starting_panel = tab_panel;
777 tab_backward = (hudShiftState & S_SHIFT);
779 float k, level = 0, start_posX;
780 vector candidate_pos = '0 0 0';
781 const float LEVELS_NUM = 4;
782 float level_height = vid_conheight / LEVELS_NUM;
784 level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
785 candidate_pos.x = (!tab_backward) ? vid_conwidth : 0;
786 start_posX = tab_panel_pos.x;
791 for(i = 0; i < HUD_PANEL_NUM; ++i)
793 panel = hud_panel[i];
794 if(panel == HUD_PANEL(MAPVOTE))
796 if (panel == tab_panels[i] || panel == starting_panel)
798 HUD_Panel_UpdatePosSize();
799 if (panel_pos.y >= level && (panel_pos.y - level) < level_height)
800 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)) )
801 || ( 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)) ) )
804 tab_panel_pos = candidate_pos = panel_pos;
809 if (k == LEVELS_NUM) //tab_panel not found
817 starting_panel = old_tab_panel;
818 old_tab_panel = world;
819 goto find_tab_panel; //u must find tab_panel!
823 level = (level + level_height) % vid_conheight;
825 candidate_pos.x = vid_conwidth;
829 level = (level - level_height) % vid_conheight;
830 start_posX = vid_conwidth;
835 tab_panels[tab_panel.panel_id] = tab_panel;
837 else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
839 if (bInputType == 1 || mouseClicked)
842 if (highlightedPanel)
843 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
845 cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
847 else if(nPrimary == 'c' && hudShiftState & S_CTRL) // copy highlighted panel size
849 if (bInputType == 1 || mouseClicked)
852 if (highlightedPanel)
854 panel = highlightedPanel;
855 HUD_Panel_UpdatePosSize();
856 panel_size_copied = panel_size;
859 else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
861 if (bInputType == 1 || mouseClicked)
864 if (panel_size_copied == '0 0 0' || !highlightedPanel)
867 panel = highlightedPanel;
868 HUD_Panel_UpdatePosSize();
870 // reduce size if it'd go beyond screen boundaries
871 vector tmp_size = panel_size_copied;
872 if (panel_pos.x + panel_size_copied.x > vid_conwidth)
873 tmp_size.x = vid_conwidth - panel_pos.x;
874 if (panel_pos.y + panel_size_copied.y > vid_conheight)
875 tmp_size.y = vid_conheight - panel_pos.y;
877 if (panel_size == tmp_size)
881 panel_pos_backup = panel_pos;
882 panel_size_backup = panel_size;
883 highlightedPanel_backup = highlightedPanel;
885 s = strcat(ftos(tmp_size.x/vid_conwidth), " ", ftos(tmp_size.y/vid_conheight));
886 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
888 else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
890 if (bInputType == 1 || mouseClicked)
892 //restore previous values
893 if (highlightedPanel_backup)
895 s = strcat(ftos(panel_pos_backup.x/vid_conwidth), " ", ftos(panel_pos_backup.y/vid_conheight));
896 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
897 s = strcat(ftos(panel_size_backup.x/vid_conwidth), " ", ftos(panel_size_backup.y/vid_conheight));
898 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
899 highlightedPanel_backup = world;
902 else if(nPrimary == 's' && hudShiftState & S_CTRL) // save config
904 if (bInputType == 1 || mouseClicked)
906 localcmd("hud save myconfig\n");
908 else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
912 pressed_key_time = 0;
915 else if (pressed_key_time == 0)
916 pressed_key_time = time;
919 HUD_Panel_Arrow_Action(nPrimary); //move or resize panel
921 else if(nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
925 if (highlightedPanel)
926 HUD_Panel_EnableMenu();
928 else if(hit_con_bind || nPrimary == K_PAUSE)
934 float HUD_Panel_Check_Mouse_Pos(float allow_move)
937 while(j < HUD_PANEL_NUM)
942 panel = hud_panel[i];
943 if(panel == HUD_PANEL(MAPVOTE)) continue;
944 HUD_Panel_UpdatePosSize();
946 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
949 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)
953 // resize from topleft border
954 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)
958 // resize from topright border
959 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)
963 // resize from bottomleft border
964 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)
968 // resize from bottomright border
969 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)
977 // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else)
978 void HUD_Panel_FirstInDrawQ(float id)
982 // find out where in the array our current id is, save into place
983 for(i = 0; i < HUD_PANEL_NUM; ++i)
985 if(panel_order[i] == id)
991 // place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
993 place = HUD_PANEL_NUM - 1;
995 // move all ids up by one step in the array until "place"
996 for(i = place; i > 0; --i)
998 panel_order[i] = panel_order[i-1];
1000 // now save the new top id
1001 panel_order[0] = id;
1003 // let's save them into the cvar by some strcat trickery
1005 for(i = 0; i < HUD_PANEL_NUM; ++i)
1007 s = strcat(s, ftos(panel_order[i]), " ");
1009 cvar_set("_hud_panelorder", s);
1010 if(hud_panelorder_prev)
1011 strunzone(hud_panelorder_prev);
1012 hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
1015 void HUD_Panel_Highlight(float allow_move)
1019 while(j < HUD_PANEL_NUM)
1024 panel = hud_panel[i];
1025 if(panel == HUD_PANEL(MAPVOTE))
1027 HUD_Panel_UpdatePosSize();
1029 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
1032 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)
1034 highlightedPanel = hud_panel[i];
1035 HUD_Panel_FirstInDrawQ(i);
1036 highlightedAction = 1;
1037 panel_click_distance = mousepos - panel_pos;
1040 // resize from topleft border
1041 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)
1043 highlightedPanel = hud_panel[i];
1044 HUD_Panel_FirstInDrawQ(i);
1045 highlightedAction = 2;
1047 panel_click_distance = mousepos - panel_pos;
1048 panel_click_resizeorigin = panel_pos + panel_size;
1051 // resize from topright border
1052 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)
1054 highlightedPanel = hud_panel[i];
1055 HUD_Panel_FirstInDrawQ(i);
1056 highlightedAction = 2;
1058 panel_click_distance.x = panel_size.x - mousepos.x + panel_pos.x;
1059 panel_click_distance.y = mousepos.y - panel_pos.y;
1060 panel_click_resizeorigin = panel_pos + eY * panel_size.y;
1063 // resize from bottomleft border
1064 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)
1066 highlightedPanel = hud_panel[i];
1067 HUD_Panel_FirstInDrawQ(i);
1068 highlightedAction = 2;
1070 panel_click_distance.x = mousepos.x - panel_pos.x;
1071 panel_click_distance.y = panel_size.y - mousepos.y + panel_pos.y;
1072 panel_click_resizeorigin = panel_pos + eX * panel_size.x;
1075 // resize from bottomright border
1076 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)
1078 highlightedPanel = hud_panel[i];
1079 HUD_Panel_FirstInDrawQ(i);
1080 highlightedAction = 2;
1082 panel_click_distance = panel_size - mousepos + panel_pos;
1083 panel_click_resizeorigin = panel_pos;
1087 highlightedPanel = world;
1088 highlightedAction = 0;
1091 void HUD_Panel_EnableMenu()
1094 localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
1096 float mouse_over_panel;
1097 void HUD_Panel_Mouse()
1099 if(autocvar__menu_alpha == 1)
1102 if (!autocvar_hud_cursormode)
1104 mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
1106 mousepos.x = bound(0, mousepos.x, vid_conwidth);
1107 mousepos.y = bound(0, mousepos.y, vid_conheight);
1112 if(prevMouseClicked == 0)
1116 //stop ctrl-tab selection
1120 HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
1121 // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
1122 if (highlightedPanel)
1124 highlightedPanel_initial_pos = panel_pos;
1125 highlightedPanel_initial_size = panel_size;
1127 // doubleclick check
1128 if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel && prevMouseClickedPos == mousepos)
1130 mouseClicked = 0; // to prevent spam, I guess.
1131 HUD_Panel_EnableMenu();
1135 if (mouseClicked & S_MOUSE1)
1137 prevMouseClickedTime = time;
1138 prevMouseClickedPos = mousepos;
1140 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(mouseClicked & S_MOUSE1);
1145 panel = highlightedPanel;
1146 HUD_Panel_UpdatePosSize();
1149 if (highlightedPanel)
1151 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1152 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
1154 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
1156 panel_pos_backup = highlightedPanel_initial_pos;
1157 panel_size_backup = highlightedPanel_initial_size;
1158 highlightedPanel_backup = highlightedPanel;
1161 // in case the clicked panel is inside another panel and we aren't
1162 // moving it, avoid the immediate "fix" of its position/size
1163 // (often unwanted and hateful) by disabling collisions check
1164 hud_configure_checkcollisions = false;
1167 if(highlightedAction == 1)
1168 HUD_Panel_SetPos(mousepos - panel_click_distance);
1169 else if(highlightedAction == 2)
1171 vector mySize = '0 0 0';
1172 if(resizeCorner == 1) {
1173 mySize.x = panel_click_resizeorigin.x - (mousepos.x - panel_click_distance.x);
1174 mySize.y = panel_click_resizeorigin.y - (mousepos.y - panel_click_distance.y);
1175 } else if(resizeCorner == 2) {
1176 mySize.x = mousepos.x + panel_click_distance.x - panel_click_resizeorigin.x;
1177 mySize.y = panel_click_distance.y + panel_click_resizeorigin.y - mousepos.y;
1178 } else if(resizeCorner == 3) {
1179 mySize.x = panel_click_resizeorigin.x + panel_click_distance.x - mousepos.x;
1180 mySize.y = mousepos.y + panel_click_distance.y - panel_click_resizeorigin.y;
1181 } else { // resizeCorner == 4
1182 mySize.x = mousepos.x - (panel_click_resizeorigin.x - panel_click_distance.x);
1183 mySize.y = mousepos.y - (panel_click_resizeorigin.y - panel_click_distance.y);
1185 HUD_Panel_SetPosSize(mySize);
1190 if(prevMouseClicked)
1191 highlightedAction = 0;
1192 if(menu_enabled == 2)
1193 mouse_over_panel = 0;
1195 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true);
1196 if (mouse_over_panel && !tab_panel)
1197 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1199 // draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
1200 const vector cursorsize = '32 32 0';
1201 float cursor_alpha = 1 - autocvar__menu_alpha;
1203 if(!mouse_over_panel)
1204 drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1205 else if(mouse_over_panel == 1)
1206 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1207 else if(mouse_over_panel == 2)
1208 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1210 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1212 prevMouseClicked = mouseClicked;
1214 void HUD_Configure_DrawGrid()
1217 if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
1219 hud_configure_gridSize.x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
1220 hud_configure_gridSize.y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
1221 hud_configure_realGridSize.x = hud_configure_gridSize.x * vid_conwidth;
1222 hud_configure_realGridSize.y = hud_configure_gridSize.y * vid_conheight;
1225 s = eX + eY * vid_conheight;
1226 for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
1227 drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1229 s = eY + eX * vid_conwidth;
1230 for(i = 1; i < 1/hud_configure_gridSize.y; ++i)
1231 drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1235 float _menu_alpha_prev;
1236 void HUD_Configure_Frame()
1239 if(autocvar__hud_configure)
1241 if(isdemo() || intermission == 2)
1243 HUD_Configure_Exit_Force();
1247 if(!hud_configure_prev)
1249 if(autocvar_hud_cursormode)
1252 for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
1253 hud_panel[panel_order[i]].update_time = time;
1256 // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
1257 if(autocvar__menu_alpha != _menu_alpha_prev)
1259 if(autocvar__menu_alpha == 0)
1261 _menu_alpha_prev = autocvar__menu_alpha;
1264 HUD_Configure_DrawGrid();
1266 else if(hud_configure_prev)
1270 if(autocvar_hud_cursormode)
1275 const float hlBorderSize = 2;
1276 const string hlBorder = "gfx/hud/default/border_highlighted";
1277 const string hlBorder2 = "gfx/hud/default/border_highlighted2";
1278 void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
1280 drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
1281 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);
1282 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);
1283 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);
1284 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);
1287 void HUD_Configure_PostDraw()
1289 if(autocvar__hud_configure)
1294 HUD_Panel_UpdatePosSize();
1295 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
1297 if(highlightedPanel)
1299 panel = highlightedPanel;
1300 HUD_Panel_UpdatePosSize();
1301 HUD_Panel_HlBorder(panel_bg_border * hlBorderSize, '0 0.5 1', 0.4 * (1 - autocvar__menu_alpha));