1 #include "hud_config.qh"
6 #include "../common/constants.qh"
8 #include "../dpdefs/keycodes.qh"
11 #define HUD_Write(s) fputs(fh, s)
12 // q: quoted, n: not quoted
13 #define HUD_Write_Cvar_n(cvar) HUD_Write(strcat("seta ", cvar, " ", cvar_string(cvar), "\n"))
14 #define HUD_Write_Cvar_q(cvar) HUD_Write(strcat("seta ", cvar, " \"", cvar_string(cvar), "\"\n"))
15 #define HUD_Write_PanelCvar_n(cvar_suf) HUD_Write_Cvar_n(strcat("hud_panel_", panel.panel_name, cvar_suf))
16 #define HUD_Write_PanelCvar_q(cvar_suf) HUD_Write_Cvar_q(strcat("hud_panel_", panel.panel_name, cvar_suf))
18 void HUD_Panel_ExportCfg(string cfgname)
21 string filename = strcat("hud_", autocvar_hud_skin, "_", cfgname, ".cfg");
22 fh = fopen(filename, FILE_WRITE);
25 HUD_Write_Cvar_q("hud_skin");
26 HUD_Write_Cvar_q("hud_panel_bg");
27 HUD_Write_Cvar_q("hud_panel_bg_color");
28 HUD_Write_Cvar_q("hud_panel_bg_color_team");
29 HUD_Write_Cvar_q("hud_panel_bg_alpha");
30 HUD_Write_Cvar_q("hud_panel_bg_border");
31 HUD_Write_Cvar_q("hud_panel_bg_padding");
32 HUD_Write_Cvar_q("hud_panel_fg_alpha");
35 HUD_Write_Cvar_q("hud_dock");
36 HUD_Write_Cvar_q("hud_dock_color");
37 HUD_Write_Cvar_q("hud_dock_color_team");
38 HUD_Write_Cvar_q("hud_dock_alpha");
41 HUD_Write_Cvar_q("hud_progressbar_alpha");
42 HUD_Write_Cvar_q("hud_progressbar_strength_color");
43 HUD_Write_Cvar_q("hud_progressbar_shield_color");
44 HUD_Write_Cvar_q("hud_progressbar_health_color");
45 HUD_Write_Cvar_q("hud_progressbar_armor_color");
46 HUD_Write_Cvar_q("hud_progressbar_fuel_color");
47 HUD_Write_Cvar_q("hud_progressbar_nexball_color");
48 HUD_Write_Cvar_q("hud_progressbar_speed_color");
49 HUD_Write_Cvar_q("hud_progressbar_acceleration_color");
50 HUD_Write_Cvar_q("hud_progressbar_acceleration_neg_color");
53 HUD_Write_Cvar_q("_hud_panelorder");
56 HUD_Write_Cvar_q("hud_configure_grid");
57 HUD_Write_Cvar_q("hud_configure_grid_xsize");
58 HUD_Write_Cvar_q("hud_configure_grid_ysize");
61 // common cvars for all panels
63 for (i = 0; i < HUD_PANEL_NUM; ++i)
67 HUD_Write_PanelCvar_n("");
68 HUD_Write_PanelCvar_q("_pos");
69 HUD_Write_PanelCvar_q("_size");
70 HUD_Write_PanelCvar_q("_bg");
71 HUD_Write_PanelCvar_q("_bg_color");
72 HUD_Write_PanelCvar_q("_bg_color_team");
73 HUD_Write_PanelCvar_q("_bg_alpha");
74 HUD_Write_PanelCvar_q("_bg_border");
75 HUD_Write_PanelCvar_q("_bg_padding");
77 case HUD_PANEL_WEAPONS:
78 HUD_Write_PanelCvar_q("_accuracy");
79 HUD_Write_PanelCvar_q("_label");
80 HUD_Write_PanelCvar_q("_label_scale");
81 HUD_Write_PanelCvar_q("_complainbubble");
82 HUD_Write_PanelCvar_q("_complainbubble_padding");
83 HUD_Write_PanelCvar_q("_complainbubble_time");
84 HUD_Write_PanelCvar_q("_complainbubble_fadetime");
85 HUD_Write_PanelCvar_q("_complainbubble_color_outofammo");
86 HUD_Write_PanelCvar_q("_complainbubble_color_donthave");
87 HUD_Write_PanelCvar_q("_complainbubble_color_unavailable");
88 HUD_Write_PanelCvar_q("_ammo");
89 HUD_Write_PanelCvar_q("_ammo_color");
90 HUD_Write_PanelCvar_q("_ammo_alpha");
91 HUD_Write_PanelCvar_q("_aspect");
92 HUD_Write_PanelCvar_q("_timeout");
93 HUD_Write_PanelCvar_q("_timeout_effect");
94 HUD_Write_PanelCvar_q("_timeout_fadebgmin");
95 HUD_Write_PanelCvar_q("_timeout_fadefgmin");
96 HUD_Write_PanelCvar_q("_timeout_speed_in");
97 HUD_Write_PanelCvar_q("_timeout_speed_out");
98 HUD_Write_PanelCvar_q("_onlyowned");
99 HUD_Write_PanelCvar_q("_noncurrent_alpha");
100 HUD_Write_PanelCvar_q("_noncurrent_scale");
103 HUD_Write_PanelCvar_q("_onlycurrent");
104 HUD_Write_PanelCvar_q("_noncurrent_alpha");
105 HUD_Write_PanelCvar_q("_noncurrent_scale");
106 HUD_Write_PanelCvar_q("_iconalign");
107 HUD_Write_PanelCvar_q("_progressbar");
108 HUD_Write_PanelCvar_q("_progressbar_name");
109 HUD_Write_PanelCvar_q("_progressbar_xoffset");
110 HUD_Write_PanelCvar_q("_text");
112 case HUD_PANEL_POWERUPS:
113 HUD_Write_PanelCvar_q("_iconalign");
114 HUD_Write_PanelCvar_q("_baralign");
115 HUD_Write_PanelCvar_q("_progressbar");
116 HUD_Write_PanelCvar_q("_text");
118 case HUD_PANEL_HEALTHARMOR:
119 HUD_Write_PanelCvar_q("_flip");
120 HUD_Write_PanelCvar_q("_iconalign");
121 HUD_Write_PanelCvar_q("_baralign");
122 HUD_Write_PanelCvar_q("_progressbar");
123 HUD_Write_PanelCvar_q("_progressbar_health");
124 HUD_Write_PanelCvar_q("_progressbar_armor");
125 HUD_Write_PanelCvar_q("_progressbar_gfx");
126 HUD_Write_PanelCvar_q("_progressbar_gfx_smooth");
127 HUD_Write_PanelCvar_q("_text");
129 case HUD_PANEL_NOTIFY:
130 HUD_Write_PanelCvar_q("_flip");
131 HUD_Write_PanelCvar_q("_fontsize");
132 HUD_Write_PanelCvar_q("_time");
133 HUD_Write_PanelCvar_q("_fadetime");
134 HUD_Write_PanelCvar_q("_icon_aspect");
136 case HUD_PANEL_TIMER:
137 HUD_Write_PanelCvar_q("_increment");
139 case HUD_PANEL_RADAR:
140 HUD_Write_PanelCvar_q("_foreground_alpha");
141 HUD_Write_PanelCvar_q("_rotation");
142 HUD_Write_PanelCvar_q("_zoommode");
143 HUD_Write_PanelCvar_q("_scale");
144 HUD_Write_PanelCvar_q("_maximized_scale");
145 HUD_Write_PanelCvar_q("_maximized_size");
146 HUD_Write_PanelCvar_q("_maximized_rotation");
147 HUD_Write_PanelCvar_q("_maximized_zoommode");
149 case HUD_PANEL_SCORE:
150 HUD_Write_PanelCvar_q("_rankings");
153 HUD_Write_PanelCvar_q("_alreadyvoted_alpha");
155 case HUD_PANEL_MODICONS:
156 HUD_Write_PanelCvar_q("_ca_layout");
157 HUD_Write_PanelCvar_q("_dom_layout");
158 HUD_Write_PanelCvar_q("_freezetag_layout");
160 case HUD_PANEL_PRESSEDKEYS:
161 HUD_Write_PanelCvar_q("_aspect");
162 HUD_Write_PanelCvar_q("_attack");
164 case HUD_PANEL_ENGINEINFO:
165 HUD_Write_PanelCvar_q("_framecounter_time");
166 HUD_Write_PanelCvar_q("_framecounter_decimals");
168 case HUD_PANEL_INFOMESSAGES:
169 HUD_Write_PanelCvar_q("_flip");
171 case HUD_PANEL_PHYSICS:
172 HUD_Write_PanelCvar_q("_speed_unit");
173 HUD_Write_PanelCvar_q("_speed_unit_show");
174 HUD_Write_PanelCvar_q("_speed_max");
175 HUD_Write_PanelCvar_q("_speed_vertical");
176 HUD_Write_PanelCvar_q("_topspeed");
177 HUD_Write_PanelCvar_q("_topspeed_time");
178 HUD_Write_PanelCvar_q("_acceleration_max");
179 HUD_Write_PanelCvar_q("_acceleration_vertical");
180 HUD_Write_PanelCvar_q("_flip");
181 HUD_Write_PanelCvar_q("_baralign");
182 HUD_Write_PanelCvar_q("_progressbar");
183 HUD_Write_PanelCvar_q("_progressbar_acceleration_mode");
184 HUD_Write_PanelCvar_q("_progressbar_acceleration_scale");
185 HUD_Write_PanelCvar_q("_progressbar_acceleration_nonlinear");
186 HUD_Write_PanelCvar_q("_text");
187 HUD_Write_PanelCvar_q("_text_scale");
189 case HUD_PANEL_CENTERPRINT:
190 HUD_Write_PanelCvar_q("_align");
191 HUD_Write_PanelCvar_q("_flip");
192 HUD_Write_PanelCvar_q("_fontscale");
193 HUD_Write_PanelCvar_q("_time");
194 HUD_Write_PanelCvar_q("_fade_in");
195 HUD_Write_PanelCvar_q("_fade_out");
196 HUD_Write_PanelCvar_q("_fade_subsequent");
197 HUD_Write_PanelCvar_q("_fade_subsequent_passone");
198 HUD_Write_PanelCvar_q("_fade_subsequent_passone_minalpha");
199 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo");
200 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo_minalpha");
201 HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
202 HUD_Write_PanelCvar_q("_fade_minfontsize");
204 case HUD_PANEL_ITEMSTIME:
205 HUD_Write_PanelCvar_q("_iconalign");
206 HUD_Write_PanelCvar_q("_progressbar");
207 HUD_Write_PanelCvar_q("_progressbar_name");
208 HUD_Write_PanelCvar_q("_progressbar_reduced");
209 HUD_Write_PanelCvar_q("_text");
210 HUD_Write_PanelCvar_q("_ratio");
211 HUD_Write_PanelCvar_q("_dynamicsize");
212 case HUD_PANEL_QUICKMENU:
213 HUD_Write_PanelCvar_q("_align");
218 HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
220 printf(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
224 printf(_("^1Couldn't write to %s\n"), filename);
227 void HUD_Configure_Exit_Force()
232 localcmd("togglemenu\n");
234 cvar_set("_hud_configure", "0");
237 // check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
238 vector HUD_Panel_CheckMove(vector myPos, vector mySize)
240 vector myCenter, targCenter;
241 vector myTarget = myPos;
243 for (i = 0; i < HUD_PANEL_NUM; ++i) {
244 panel = hud_panel[i];
245 if(panel == HUD_PANEL(MAPVOTE)) continue;
246 if(panel == highlightedPanel) continue;
247 HUD_Panel_UpdatePosSize();
248 if(!panel_enabled) continue;
250 panel_pos -= '1 1 0' * panel_bg_border;
251 panel_size += '2 2 0' * panel_bg_border;
253 if(myPos.y + mySize.y < panel_pos.y)
255 if(myPos.y > panel_pos.y + panel_size.y)
258 if(myPos.x + mySize.x < panel_pos.x)
260 if(myPos.x > panel_pos.x + panel_size.x)
263 // OK, there IS a collision.
265 myCenter.x = myPos.x + 0.5 * mySize.x;
266 myCenter.y = myPos.y + 0.5 * mySize.y;
268 targCenter.x = panel_pos.x + 0.5 * panel_size.x;
269 targCenter.y = panel_pos.y + 0.5 * panel_size.y;
271 if(myCenter.x < targCenter.x && myCenter.y < targCenter.y) // top left (of the target panel)
273 if(myPos.x + mySize.x - panel_pos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
274 myTarget.x = panel_pos.x - mySize.x;
275 else // push it upwards
276 myTarget.y = panel_pos.y - mySize.y;
278 else if(myCenter.x > targCenter.x && myCenter.y < targCenter.y) // top right
280 if(panel_pos.x + panel_size.x - myPos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
281 myTarget.x = panel_pos.x + panel_size.x;
282 else // push it upwards
283 myTarget.y = panel_pos.y - mySize.y;
285 else if(myCenter.x < targCenter.x && myCenter.y > targCenter.y) // bottom left
287 if(myPos.x + mySize.x - panel_pos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
288 myTarget.x = panel_pos.x - mySize.x;
289 else // push it downwards
290 myTarget.y = panel_pos.y + panel_size.y;
292 else if(myCenter.x > targCenter.x && myCenter.y > targCenter.y) // bottom right
294 if(panel_pos.x + panel_size.x - myPos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
295 myTarget.x = panel_pos.x + panel_size.x;
296 else // push it downwards
297 myTarget.y = panel_pos.y + panel_size.y;
299 //if(cvar("hud_configure_checkcollisions_debug"))
300 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
306 void HUD_Panel_SetPos(vector pos)
308 panel = highlightedPanel;
309 HUD_Panel_UpdatePosSize();
313 //if(cvar("hud_configure_checkcollisions_debug"))
314 //drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
316 if(autocvar_hud_configure_grid)
318 pos.x = floor((pos.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
319 pos.y = floor((pos.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
322 if(hud_configure_checkcollisions)
323 pos = HUD_Panel_CheckMove(pos, mySize);
325 pos.x = bound(0, pos.x, vid_conwidth - mySize.x);
326 pos.y = bound(0, pos.y, vid_conheight - mySize.y);
329 s = strcat(ftos(pos.x/vid_conwidth), " ", ftos(pos.y/vid_conheight));
331 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
334 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
335 vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
338 float ratio = mySize.x/mySize.y;
340 for (i = 0; i < HUD_PANEL_NUM; ++i) {
341 panel = hud_panel[i];
342 if(panel == HUD_PANEL(MAPVOTE)) continue;
343 if(panel == highlightedPanel) continue;
344 HUD_Panel_UpdatePosSize();
345 if(!panel_enabled) continue;
347 panel_pos -= '1 1 0' * panel_bg_border;
348 panel_size += '2 2 0' * panel_bg_border;
350 targEndPos = panel_pos + panel_size;
352 // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
353 if(resizeorigin.x > panel_pos.x && resizeorigin.x < targEndPos.x && resizeorigin.y > panel_pos.y && resizeorigin.y < targEndPos.y)
356 if (resizeCorner == 1)
358 // check if this panel is on our way
359 if (resizeorigin.x <= panel_pos.x)
361 if (resizeorigin.y <= panel_pos.y)
363 if (targEndPos.x <= resizeorigin.x - mySize.x)
365 if (targEndPos.y <= resizeorigin.y - mySize.y)
368 // there is a collision:
369 // detect which side of the panel we are facing is actually limiting the resizing
370 // (which side the resize direction finds for first) and reduce the size up to there
372 // dist is the distance between resizeorigin and the "analogous" point of the panel
373 // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel
374 dist.x = resizeorigin.x - targEndPos.x;
375 dist.y = resizeorigin.y - targEndPos.y;
376 if (dist.y <= 0 || dist.x / dist.y > ratio)
377 mySize.x = min(mySize.x, dist.x);
379 mySize.y = min(mySize.y, dist.y);
381 else if (resizeCorner == 2)
383 if (resizeorigin.x >= targEndPos.x)
385 if (resizeorigin.y <= panel_pos.y)
387 if (panel_pos.x >= resizeorigin.x + mySize.x)
389 if (targEndPos.y <= resizeorigin.y - mySize.y)
392 dist.x = panel_pos.x - resizeorigin.x;
393 dist.y = resizeorigin.y - targEndPos.y;
394 if (dist.y <= 0 || dist.x / dist.y > ratio)
395 mySize.x = min(mySize.x, dist.x);
397 mySize.y = min(mySize.y, dist.y);
399 else if (resizeCorner == 3)
401 if (resizeorigin.x <= panel_pos.x)
403 if (resizeorigin.y >= targEndPos.y)
405 if (targEndPos.x <= resizeorigin.x - mySize.x)
407 if (panel_pos.y >= resizeorigin.y + mySize.y)
410 dist.x = resizeorigin.x - targEndPos.x;
411 dist.y = panel_pos.y - resizeorigin.y;
412 if (dist.y <= 0 || dist.x / dist.y > ratio)
413 mySize.x = min(mySize.x, dist.x);
415 mySize.y = min(mySize.y, dist.y);
417 else if (resizeCorner == 4)
419 if (resizeorigin.x >= targEndPos.x)
421 if (resizeorigin.y >= targEndPos.y)
423 if (panel_pos.x >= resizeorigin.x + mySize.x)
425 if (panel_pos.y >= resizeorigin.y + mySize.y)
428 dist.x = panel_pos.x - resizeorigin.x;
429 dist.y = panel_pos.y - resizeorigin.y;
430 if (dist.y <= 0 || dist.x / dist.y > ratio)
431 mySize.x = min(mySize.x, dist.x);
433 mySize.y = min(mySize.y, dist.y);
435 //if(cvar("hud_configure_checkcollisions_debug"))
436 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
442 void HUD_Panel_SetPosSize(vector mySize)
444 panel = highlightedPanel;
445 HUD_Panel_UpdatePosSize();
446 vector resizeorigin = panel_click_resizeorigin;
449 // minimum panel size cap
450 mySize.x = max(0.025 * vid_conwidth, mySize.x);
451 mySize.y = max(0.025 * vid_conheight, mySize.y);
453 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.
455 mySize.x = max(17 * autocvar_con_chatsize, mySize.x);
456 mySize.y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize.y);
459 // collision testing|
460 // -----------------+
462 // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
463 if(resizeCorner == 1) {
464 myPos.x = resizeorigin.x - mySize.x;
465 myPos.y = resizeorigin.y - mySize.y;
466 } else if(resizeCorner == 2) {
467 myPos.x = resizeorigin.x;
468 myPos.y = resizeorigin.y - mySize.y;
469 } else if(resizeCorner == 3) {
470 myPos.x = resizeorigin.x - mySize.x;
471 myPos.y = resizeorigin.y;
472 } else { // resizeCorner == 4
473 myPos.x = resizeorigin.x;
474 myPos.y = resizeorigin.y;
477 // left/top screen edges
479 mySize.x = mySize.x + myPos.x;
481 mySize.y = mySize.y + myPos.y;
483 // bottom/right screen edges
484 if(myPos.x + mySize.x > vid_conwidth)
485 mySize.x = vid_conwidth - myPos.x;
486 if(myPos.y + mySize.y > vid_conheight)
487 mySize.y = vid_conheight - myPos.y;
489 //if(cvar("hud_configure_checkcollisions_debug"))
490 //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
492 // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
493 if(autocvar_hud_configure_grid)
495 mySize.x = floor((mySize.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
496 mySize.y = floor((mySize.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
499 if(hud_configure_checkcollisions)
500 mySize = HUD_Panel_CheckResize(mySize, resizeorigin);
502 // 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)
503 mySize.x = max(0.025 * vid_conwidth, mySize.x);
504 mySize.y = max(0.025 * vid_conheight, mySize.y);
506 // do another pos check, as size might have changed by now
507 if(resizeCorner == 1) {
508 myPos.x = resizeorigin.x - mySize.x;
509 myPos.y = resizeorigin.y - mySize.y;
510 } else if(resizeCorner == 2) {
511 myPos.x = resizeorigin.x;
512 myPos.y = resizeorigin.y - mySize.y;
513 } else if(resizeCorner == 3) {
514 myPos.x = resizeorigin.x - mySize.x;
515 myPos.y = resizeorigin.y;
516 } else { // resizeCorner == 4
517 myPos.x = resizeorigin.x;
518 myPos.y = resizeorigin.y;
521 //if(cvar("hud_configure_checkcollisions_debug"))
522 //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
525 s = strcat(ftos(mySize.x/vid_conwidth), " ", ftos(mySize.y/vid_conheight));
526 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
528 s = strcat(ftos(myPos.x/vid_conwidth), " ", ftos(myPos.y/vid_conheight));
529 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
532 float pressed_key_time;
533 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
534 void HUD_Panel_Arrow_Action(float nPrimary)
536 if(!highlightedPanel)
539 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
542 if(autocvar_hud_configure_grid)
544 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
546 if (hudShiftState & S_SHIFT)
547 step = hud_configure_realGridSize.y;
549 step = 2 * hud_configure_realGridSize.y;
553 if (hudShiftState & S_SHIFT)
554 step = hud_configure_realGridSize.x;
556 step = 2 * hud_configure_realGridSize.x;
561 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
562 step = vid_conheight;
565 if (hudShiftState & S_SHIFT)
566 step = (step / 256); // more precision
568 step = (step / 64) * (1 + 2 * (time - pressed_key_time));
571 panel = highlightedPanel;
572 HUD_Panel_UpdatePosSize();
574 highlightedPanel_initial_pos = panel_pos;
575 highlightedPanel_initial_size = panel_size;
577 if (hudShiftState & S_ALT) // resize
579 if(nPrimary == K_UPARROW)
581 else if(nPrimary == K_RIGHTARROW)
583 else if(nPrimary == K_LEFTARROW)
585 else // if(nPrimary == K_DOWNARROW)
588 // ctrl+arrow reduces the size, instead of increasing it
589 // Note that ctrl disables collisions check too, but it's fine
590 // since we don't collide with anything reducing the size
591 if (hudShiftState & S_CTRL) {
593 resizeCorner = 5 - resizeCorner;
598 panel_click_resizeorigin = panel_pos;
599 if(resizeCorner == 1) {
600 panel_click_resizeorigin += mySize;
602 } else if(resizeCorner == 2) {
603 panel_click_resizeorigin.y += mySize.y;
605 } else if(resizeCorner == 3) {
606 panel_click_resizeorigin.x += mySize.x;
608 } else { // resizeCorner == 4
611 HUD_Panel_SetPosSize(mySize);
617 if(nPrimary == K_UPARROW)
619 else if(nPrimary == K_DOWNARROW)
621 else if(nPrimary == K_LEFTARROW)
623 else // if(nPrimary == K_RIGHTARROW)
626 HUD_Panel_SetPos(pos);
629 panel = highlightedPanel;
630 HUD_Panel_UpdatePosSize();
632 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
635 panel_pos_backup = highlightedPanel_initial_pos;
636 panel_size_backup = highlightedPanel_initial_size;
637 highlightedPanel_backup = highlightedPanel;
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));