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");
207 case HUD_PANEL_ITEMSTIME:
208 HUD_Write_PanelCvar_q("_iconalign");
209 HUD_Write_PanelCvar_q("_progressbar");
210 HUD_Write_PanelCvar_q("_progressbar_name");
211 HUD_Write_PanelCvar_q("_progressbar_reduced");
212 HUD_Write_PanelCvar_q("_text");
213 HUD_Write_PanelCvar_q("_ratio");
214 HUD_Write_PanelCvar_q("_dynamicsize");
219 HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
221 printf(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
225 printf(_("^1Couldn't write to %s\n"), filename);
228 void HUD_Configure_Exit_Force()
233 localcmd("togglemenu\n");
235 cvar_set("_hud_configure", "0");
238 // check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
239 vector HUD_Panel_CheckMove(vector myPos, vector mySize)
241 vector myCenter, targCenter;
242 vector myTarget = myPos;
244 for (i = 0; i < HUD_PANEL_NUM; ++i) {
245 panel = hud_panel[i];
246 if(panel == HUD_PANEL(MAPVOTE)) continue;
247 if(panel == highlightedPanel) continue;
248 HUD_Panel_UpdatePosSize();
249 if(!panel_enabled) continue;
251 panel_pos -= '1 1 0' * panel_bg_border;
252 panel_size += '2 2 0' * panel_bg_border;
254 if(myPos.y + mySize.y < panel_pos.y)
256 if(myPos.y > panel_pos.y + panel_size.y)
259 if(myPos.x + mySize.x < panel_pos.x)
261 if(myPos.x > panel_pos.x + panel_size.x)
264 // OK, there IS a collision.
266 myCenter.x = myPos.x + 0.5 * mySize.x;
267 myCenter.y = myPos.y + 0.5 * mySize.y;
269 targCenter.x = panel_pos.x + 0.5 * panel_size.x;
270 targCenter.y = panel_pos.y + 0.5 * panel_size.y;
272 if(myCenter.x < targCenter.x && myCenter.y < targCenter.y) // top left (of the target panel)
274 if(myPos.x + mySize.x - panel_pos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
275 myTarget.x = panel_pos.x - mySize.x;
276 else // push it upwards
277 myTarget.y = panel_pos.y - mySize.y;
279 else if(myCenter.x > targCenter.x && myCenter.y < targCenter.y) // top right
281 if(panel_pos.x + panel_size.x - myPos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
282 myTarget.x = panel_pos.x + panel_size.x;
283 else // push it upwards
284 myTarget.y = panel_pos.y - mySize.y;
286 else if(myCenter.x < targCenter.x && myCenter.y > targCenter.y) // bottom left
288 if(myPos.x + mySize.x - panel_pos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
289 myTarget.x = panel_pos.x - mySize.x;
290 else // push it downwards
291 myTarget.y = panel_pos.y + panel_size.y;
293 else if(myCenter.x > targCenter.x && myCenter.y > targCenter.y) // bottom right
295 if(panel_pos.x + panel_size.x - myPos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
296 myTarget.x = panel_pos.x + panel_size.x;
297 else // push it downwards
298 myTarget.y = panel_pos.y + panel_size.y;
300 //if(cvar("hud_configure_checkcollisions_debug"))
301 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
307 void HUD_Panel_SetPos(vector pos)
309 panel = highlightedPanel;
310 HUD_Panel_UpdatePosSize();
314 //if(cvar("hud_configure_checkcollisions_debug"))
315 //drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
317 if(autocvar_hud_configure_grid)
319 pos.x = floor((pos.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
320 pos.y = floor((pos.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
323 if(hud_configure_checkcollisions)
324 pos = HUD_Panel_CheckMove(pos, mySize);
326 pos.x = bound(0, pos.x, vid_conwidth - mySize.x);
327 pos.y = bound(0, pos.y, vid_conheight - mySize.y);
330 s = strcat(ftos(pos.x/vid_conwidth), " ", ftos(pos.y/vid_conheight));
332 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
335 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
336 vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
339 float ratio = mySize.x/mySize.y;
341 for (i = 0; i < HUD_PANEL_NUM; ++i) {
342 panel = hud_panel[i];
343 if(panel == HUD_PANEL(MAPVOTE)) continue;
344 if(panel == highlightedPanel) continue;
345 HUD_Panel_UpdatePosSize();
346 if(!panel_enabled) continue;
348 panel_pos -= '1 1 0' * panel_bg_border;
349 panel_size += '2 2 0' * panel_bg_border;
351 targEndPos = panel_pos + panel_size;
353 // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
354 if(resizeorigin.x > panel_pos.x && resizeorigin.x < targEndPos.x && resizeorigin.y > panel_pos.y && resizeorigin.y < targEndPos.y)
357 if (resizeCorner == 1)
359 // check if this panel is on our way
360 if (resizeorigin.x <= panel_pos.x)
362 if (resizeorigin.y <= panel_pos.y)
364 if (targEndPos.x <= resizeorigin.x - mySize.x)
366 if (targEndPos.y <= resizeorigin.y - mySize.y)
369 // there is a collision:
370 // detect which side of the panel we are facing is actually limiting the resizing
371 // (which side the resize direction finds for first) and reduce the size up to there
373 // dist is the distance between resizeorigin and the "analogous" point of the panel
374 // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel
375 dist.x = resizeorigin.x - targEndPos.x;
376 dist.y = resizeorigin.y - targEndPos.y;
377 if (dist.y <= 0 || dist.x / dist.y > ratio)
378 mySize.x = min(mySize.x, dist.x);
380 mySize.y = min(mySize.y, dist.y);
382 else if (resizeCorner == 2)
384 if (resizeorigin.x >= targEndPos.x)
386 if (resizeorigin.y <= panel_pos.y)
388 if (panel_pos.x >= resizeorigin.x + mySize.x)
390 if (targEndPos.y <= resizeorigin.y - mySize.y)
393 dist.x = panel_pos.x - resizeorigin.x;
394 dist.y = resizeorigin.y - targEndPos.y;
395 if (dist.y <= 0 || dist.x / dist.y > ratio)
396 mySize.x = min(mySize.x, dist.x);
398 mySize.y = min(mySize.y, dist.y);
400 else if (resizeCorner == 3)
402 if (resizeorigin.x <= panel_pos.x)
404 if (resizeorigin.y >= targEndPos.y)
406 if (targEndPos.x <= resizeorigin.x - mySize.x)
408 if (panel_pos.y >= resizeorigin.y + mySize.y)
411 dist.x = resizeorigin.x - targEndPos.x;
412 dist.y = panel_pos.y - resizeorigin.y;
413 if (dist.y <= 0 || dist.x / dist.y > ratio)
414 mySize.x = min(mySize.x, dist.x);
416 mySize.y = min(mySize.y, dist.y);
418 else if (resizeCorner == 4)
420 if (resizeorigin.x >= targEndPos.x)
422 if (resizeorigin.y >= targEndPos.y)
424 if (panel_pos.x >= resizeorigin.x + mySize.x)
426 if (panel_pos.y >= resizeorigin.y + mySize.y)
429 dist.x = panel_pos.x - resizeorigin.x;
430 dist.y = panel_pos.y - resizeorigin.y;
431 if (dist.y <= 0 || dist.x / dist.y > ratio)
432 mySize.x = min(mySize.x, dist.x);
434 mySize.y = min(mySize.y, dist.y);
436 //if(cvar("hud_configure_checkcollisions_debug"))
437 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
443 void HUD_Panel_SetPosSize(vector mySize)
445 panel = highlightedPanel;
446 HUD_Panel_UpdatePosSize();
447 vector resizeorigin = panel_click_resizeorigin;
450 // minimum panel size cap
451 mySize.x = max(0.025 * vid_conwidth, mySize.x);
452 mySize.y = max(0.025 * vid_conheight, mySize.y);
454 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.
456 mySize.x = max(17 * autocvar_con_chatsize, mySize.x);
457 mySize.y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize.y);
460 // collision testing|
461 // -----------------+
463 // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
464 if(resizeCorner == 1) {
465 myPos.x = resizeorigin.x - mySize.x;
466 myPos.y = resizeorigin.y - mySize.y;
467 } else if(resizeCorner == 2) {
468 myPos.x = resizeorigin.x;
469 myPos.y = resizeorigin.y - mySize.y;
470 } else if(resizeCorner == 3) {
471 myPos.x = resizeorigin.x - mySize.x;
472 myPos.y = resizeorigin.y;
473 } else { // resizeCorner == 4
474 myPos.x = resizeorigin.x;
475 myPos.y = resizeorigin.y;
478 // left/top screen edges
480 mySize.x = mySize.x + myPos.x;
482 mySize.y = mySize.y + myPos.y;
484 // bottom/right screen edges
485 if(myPos.x + mySize.x > vid_conwidth)
486 mySize.x = vid_conwidth - myPos.x;
487 if(myPos.y + mySize.y > vid_conheight)
488 mySize.y = vid_conheight - myPos.y;
490 //if(cvar("hud_configure_checkcollisions_debug"))
491 //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
493 // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
494 if(autocvar_hud_configure_grid)
496 mySize.x = floor((mySize.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
497 mySize.y = floor((mySize.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
500 if(hud_configure_checkcollisions)
501 mySize = HUD_Panel_CheckResize(mySize, resizeorigin);
503 // 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)
504 mySize.x = max(0.025 * vid_conwidth, mySize.x);
505 mySize.y = max(0.025 * vid_conheight, mySize.y);
507 // do another pos check, as size might have changed by now
508 if(resizeCorner == 1) {
509 myPos.x = resizeorigin.x - mySize.x;
510 myPos.y = resizeorigin.y - mySize.y;
511 } else if(resizeCorner == 2) {
512 myPos.x = resizeorigin.x;
513 myPos.y = resizeorigin.y - mySize.y;
514 } else if(resizeCorner == 3) {
515 myPos.x = resizeorigin.x - mySize.x;
516 myPos.y = resizeorigin.y;
517 } else { // resizeCorner == 4
518 myPos.x = resizeorigin.x;
519 myPos.y = resizeorigin.y;
522 //if(cvar("hud_configure_checkcollisions_debug"))
523 //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
526 s = strcat(ftos(mySize.x/vid_conwidth), " ", ftos(mySize.y/vid_conheight));
527 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
529 s = strcat(ftos(myPos.x/vid_conwidth), " ", ftos(myPos.y/vid_conheight));
530 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
533 float pressed_key_time;
534 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
535 void HUD_Panel_Arrow_Action(float nPrimary)
537 if(!highlightedPanel)
540 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
543 if(autocvar_hud_configure_grid)
545 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
547 if (hudShiftState & S_SHIFT)
548 step = hud_configure_realGridSize.y;
550 step = 2 * hud_configure_realGridSize.y;
554 if (hudShiftState & S_SHIFT)
555 step = hud_configure_realGridSize.x;
557 step = 2 * hud_configure_realGridSize.x;
562 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
563 step = vid_conheight;
566 if (hudShiftState & S_SHIFT)
567 step = (step / 256); // more precision
569 step = (step / 64) * (1 + 2 * (time - pressed_key_time));
572 panel = highlightedPanel;
573 HUD_Panel_UpdatePosSize();
575 highlightedPanel_initial_pos = panel_pos;
576 highlightedPanel_initial_size = panel_size;
578 if (hudShiftState & S_ALT) // resize
580 if(nPrimary == K_UPARROW)
582 else if(nPrimary == K_RIGHTARROW)
584 else if(nPrimary == K_LEFTARROW)
586 else // if(nPrimary == K_DOWNARROW)
589 // ctrl+arrow reduces the size, instead of increasing it
590 // Note that ctrl disables collisions check too, but it's fine
591 // since we don't collide with anything reducing the size
592 if (hudShiftState & S_CTRL) {
594 resizeCorner = 5 - resizeCorner;
599 panel_click_resizeorigin = panel_pos;
600 if(resizeCorner == 1) {
601 panel_click_resizeorigin += mySize;
603 } else if(resizeCorner == 2) {
604 panel_click_resizeorigin.y += mySize.y;
606 } else if(resizeCorner == 3) {
607 panel_click_resizeorigin.x += mySize.x;
609 } else { // resizeCorner == 4
612 HUD_Panel_SetPosSize(mySize);
618 if(nPrimary == K_UPARROW)
620 else if(nPrimary == K_DOWNARROW)
622 else if(nPrimary == K_LEFTARROW)
624 else // if(nPrimary == K_RIGHTARROW)
627 HUD_Panel_SetPos(pos);
630 panel = highlightedPanel;
631 HUD_Panel_UpdatePosSize();
633 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
636 panel_pos_backup = highlightedPanel_initial_pos;
637 panel_size_backup = highlightedPanel_initial_size;
638 highlightedPanel_backup = highlightedPanel;
642 const int S_MOUSE1 = 1;
643 const int S_MOUSE2 = 2;
644 const int S_MOUSE3 = 4;
646 int prevMouseClicked; // previous state
647 float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks
648 vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks
650 void HUD_Panel_EnableMenu();
651 entity tab_panels[HUD_PANEL_MAX];
653 vector tab_panel_pos;
655 void HUD_Panel_FirstInDrawQ(float id);
656 void reset_tab_panels()
659 for(i = 0; i < HUD_PANEL_NUM; ++i)
660 tab_panels[i] = world;
662 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
669 if(!autocvar__hud_configure)
674 mousepos.x = nPrimary;
675 mousepos.y = nSecondary;
679 // block any input while a menu dialog is fading
680 // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
681 if(autocvar__menu_alpha)
688 // allow console bind to work
691 con_keys = findkeysforcommand("toggleconsole", 0);
692 keys = tokenize(con_keys); // findkeysforcommand returns data for this
694 bool hit_con_bind = false;
696 for (i = 0; i < keys; ++i)
698 if(nPrimary == stof(argv(i)))
702 if(bInputType == 0) {
703 if(nPrimary == K_ALT) hudShiftState |= S_ALT;
704 if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
705 if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
707 else if(bInputType == 1) {
708 if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
709 if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
710 if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
713 if(nPrimary == K_CTRL)
715 if (bInputType == 1) //ctrl has been released
719 //switch to selected panel
720 highlightedPanel = tab_panel;
721 highlightedAction = 0;
722 HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id);
729 if(nPrimary == K_MOUSE1)
731 if(bInputType == 0) // key pressed
732 mouseClicked |= S_MOUSE1;
733 else if(bInputType == 1) // key released
734 mouseClicked -= (mouseClicked & S_MOUSE1);
736 else if(nPrimary == K_MOUSE2)
738 if(bInputType == 0) // key pressed
739 mouseClicked |= S_MOUSE2;
740 else if(bInputType == 1) // key released
741 mouseClicked -= (mouseClicked & S_MOUSE2);
743 else if(nPrimary == K_ESCAPE)
748 localcmd("menu_showhudexit\n");
750 else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
755 cvar_set("_hud_configure", "0");
757 else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel
759 if (bInputType == 1 || mouseClicked)
762 // FIXME minor bug: if a panel is highlighted, has the same pos_x and
763 // lays in the same level of another panel then the next consecutive
764 // CTRL TAB presses will reselect once more the highlighted panel
766 entity starting_panel;
767 entity old_tab_panel = tab_panel;
768 if (!tab_panel) //first press of TAB
770 if (highlightedPanel)
772 panel = highlightedPanel;
773 HUD_Panel_UpdatePosSize();
777 starting_panel = highlightedPanel;
778 tab_panel_pos = panel_pos; //to compute level
782 if ( ((!tab_backward) && (hudShiftState & S_SHIFT)) || (tab_backward && !(hudShiftState & S_SHIFT)) ) //tab direction changed?
784 starting_panel = tab_panel;
786 tab_backward = (hudShiftState & S_SHIFT);
788 float k, level = 0, start_posX;
789 vector candidate_pos = '0 0 0';
790 const float LEVELS_NUM = 4;
791 float level_height = vid_conheight / LEVELS_NUM;
793 level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
794 candidate_pos.x = (!tab_backward) ? vid_conwidth : 0;
795 start_posX = tab_panel_pos.x;
800 for(i = 0; i < HUD_PANEL_NUM; ++i)
802 panel = hud_panel[i];
803 if(panel == HUD_PANEL(MAPVOTE))
805 if (panel == tab_panels[i] || panel == starting_panel)
807 HUD_Panel_UpdatePosSize();
808 if (panel_pos.y >= level && (panel_pos.y - level) < level_height)
809 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)) )
810 || ( 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)) ) )
813 tab_panel_pos = candidate_pos = panel_pos;
818 if (k == LEVELS_NUM) //tab_panel not found
826 starting_panel = old_tab_panel;
827 old_tab_panel = world;
828 goto find_tab_panel; //u must find tab_panel!
832 level = (level + level_height) % vid_conheight;
834 candidate_pos.x = vid_conwidth;
838 level = (level - level_height) % vid_conheight;
839 start_posX = vid_conwidth;
844 tab_panels[tab_panel.panel_id] = tab_panel;
846 else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
848 if (bInputType == 1 || mouseClicked)
851 if (highlightedPanel)
852 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
854 cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
856 else if(nPrimary == 'c' && hudShiftState & S_CTRL) // copy highlighted panel size
858 if (bInputType == 1 || mouseClicked)
861 if (highlightedPanel)
863 panel = highlightedPanel;
864 HUD_Panel_UpdatePosSize();
865 panel_size_copied = panel_size;
868 else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
870 if (bInputType == 1 || mouseClicked)
873 if (panel_size_copied == '0 0 0' || !highlightedPanel)
876 panel = highlightedPanel;
877 HUD_Panel_UpdatePosSize();
879 // reduce size if it'd go beyond screen boundaries
880 vector tmp_size = panel_size_copied;
881 if (panel_pos.x + panel_size_copied.x > vid_conwidth)
882 tmp_size.x = vid_conwidth - panel_pos.x;
883 if (panel_pos.y + panel_size_copied.y > vid_conheight)
884 tmp_size.y = vid_conheight - panel_pos.y;
886 if (panel_size == tmp_size)
890 panel_pos_backup = panel_pos;
891 panel_size_backup = panel_size;
892 highlightedPanel_backup = highlightedPanel;
894 s = strcat(ftos(tmp_size.x/vid_conwidth), " ", ftos(tmp_size.y/vid_conheight));
895 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
897 else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
899 if (bInputType == 1 || mouseClicked)
901 //restore previous values
902 if (highlightedPanel_backup)
904 s = strcat(ftos(panel_pos_backup.x/vid_conwidth), " ", ftos(panel_pos_backup.y/vid_conheight));
905 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
906 s = strcat(ftos(panel_size_backup.x/vid_conwidth), " ", ftos(panel_size_backup.y/vid_conheight));
907 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
908 highlightedPanel_backup = world;
911 else if(nPrimary == 's' && hudShiftState & S_CTRL) // save config
913 if (bInputType == 1 || mouseClicked)
915 localcmd("hud save myconfig\n");
917 else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
921 pressed_key_time = 0;
924 else if (pressed_key_time == 0)
925 pressed_key_time = time;
928 HUD_Panel_Arrow_Action(nPrimary); //move or resize panel
930 else if(nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
934 if (highlightedPanel)
935 HUD_Panel_EnableMenu();
937 else if(hit_con_bind || nPrimary == K_PAUSE)
943 float HUD_Panel_Check_Mouse_Pos(float allow_move)
946 while(j < HUD_PANEL_NUM)
951 panel = hud_panel[i];
952 if(panel == HUD_PANEL(MAPVOTE)) continue;
953 HUD_Panel_UpdatePosSize();
955 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
958 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)
962 // resize from topleft border
963 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)
967 // resize from topright border
968 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)
972 // resize from bottomleft border
973 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)
977 // resize from bottomright border
978 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)
986 // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else)
987 void HUD_Panel_FirstInDrawQ(float id)
991 // find out where in the array our current id is, save into place
992 for(i = 0; i < HUD_PANEL_NUM; ++i)
994 if(panel_order[i] == id)
1000 // place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
1002 place = HUD_PANEL_NUM - 1;
1004 // move all ids up by one step in the array until "place"
1005 for(i = place; i > 0; --i)
1007 panel_order[i] = panel_order[i-1];
1009 // now save the new top id
1010 panel_order[0] = id;
1012 // let's save them into the cvar by some strcat trickery
1014 for(i = 0; i < HUD_PANEL_NUM; ++i)
1016 s = strcat(s, ftos(panel_order[i]), " ");
1018 cvar_set("_hud_panelorder", s);
1019 if(hud_panelorder_prev)
1020 strunzone(hud_panelorder_prev);
1021 hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
1024 void HUD_Panel_Highlight(float allow_move)
1028 while(j < HUD_PANEL_NUM)
1033 panel = hud_panel[i];
1034 if(panel == HUD_PANEL(MAPVOTE))
1036 HUD_Panel_UpdatePosSize();
1038 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
1041 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)
1043 highlightedPanel = hud_panel[i];
1044 HUD_Panel_FirstInDrawQ(i);
1045 highlightedAction = 1;
1046 panel_click_distance = mousepos - panel_pos;
1049 // resize from topleft border
1050 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)
1052 highlightedPanel = hud_panel[i];
1053 HUD_Panel_FirstInDrawQ(i);
1054 highlightedAction = 2;
1056 panel_click_distance = mousepos - panel_pos;
1057 panel_click_resizeorigin = panel_pos + panel_size;
1060 // resize from topright border
1061 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)
1063 highlightedPanel = hud_panel[i];
1064 HUD_Panel_FirstInDrawQ(i);
1065 highlightedAction = 2;
1067 panel_click_distance.x = panel_size.x - mousepos.x + panel_pos.x;
1068 panel_click_distance.y = mousepos.y - panel_pos.y;
1069 panel_click_resizeorigin = panel_pos + eY * panel_size.y;
1072 // resize from bottomleft border
1073 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)
1075 highlightedPanel = hud_panel[i];
1076 HUD_Panel_FirstInDrawQ(i);
1077 highlightedAction = 2;
1079 panel_click_distance.x = mousepos.x - panel_pos.x;
1080 panel_click_distance.y = panel_size.y - mousepos.y + panel_pos.y;
1081 panel_click_resizeorigin = panel_pos + eX * panel_size.x;
1084 // resize from bottomright border
1085 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)
1087 highlightedPanel = hud_panel[i];
1088 HUD_Panel_FirstInDrawQ(i);
1089 highlightedAction = 2;
1091 panel_click_distance = panel_size - mousepos + panel_pos;
1092 panel_click_resizeorigin = panel_pos;
1096 highlightedPanel = world;
1097 highlightedAction = 0;
1100 void HUD_Panel_EnableMenu()
1103 localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
1105 float mouse_over_panel;
1106 void HUD_Panel_Mouse()
1108 if(autocvar__menu_alpha == 1)
1111 if (!autocvar_hud_cursormode)
1113 mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
1115 mousepos.x = bound(0, mousepos.x, vid_conwidth);
1116 mousepos.y = bound(0, mousepos.y, vid_conheight);
1121 if(prevMouseClicked == 0)
1125 //stop ctrl-tab selection
1129 HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
1130 // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
1131 if (highlightedPanel)
1133 highlightedPanel_initial_pos = panel_pos;
1134 highlightedPanel_initial_size = panel_size;
1136 // doubleclick check
1137 if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel && prevMouseClickedPos == mousepos)
1139 mouseClicked = 0; // to prevent spam, I guess.
1140 HUD_Panel_EnableMenu();
1144 if (mouseClicked & S_MOUSE1)
1146 prevMouseClickedTime = time;
1147 prevMouseClickedPos = mousepos;
1149 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(mouseClicked & S_MOUSE1);
1154 panel = highlightedPanel;
1155 HUD_Panel_UpdatePosSize();
1158 if (highlightedPanel)
1160 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1161 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
1163 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
1165 panel_pos_backup = highlightedPanel_initial_pos;
1166 panel_size_backup = highlightedPanel_initial_size;
1167 highlightedPanel_backup = highlightedPanel;
1170 // in case the clicked panel is inside another panel and we aren't
1171 // moving it, avoid the immediate "fix" of its position/size
1172 // (often unwanted and hateful) by disabling collisions check
1173 hud_configure_checkcollisions = false;
1176 if(highlightedAction == 1)
1177 HUD_Panel_SetPos(mousepos - panel_click_distance);
1178 else if(highlightedAction == 2)
1180 vector mySize = '0 0 0';
1181 if(resizeCorner == 1) {
1182 mySize.x = panel_click_resizeorigin.x - (mousepos.x - panel_click_distance.x);
1183 mySize.y = panel_click_resizeorigin.y - (mousepos.y - panel_click_distance.y);
1184 } else if(resizeCorner == 2) {
1185 mySize.x = mousepos.x + panel_click_distance.x - panel_click_resizeorigin.x;
1186 mySize.y = panel_click_distance.y + panel_click_resizeorigin.y - mousepos.y;
1187 } else if(resizeCorner == 3) {
1188 mySize.x = panel_click_resizeorigin.x + panel_click_distance.x - mousepos.x;
1189 mySize.y = mousepos.y + panel_click_distance.y - panel_click_resizeorigin.y;
1190 } else { // resizeCorner == 4
1191 mySize.x = mousepos.x - (panel_click_resizeorigin.x - panel_click_distance.x);
1192 mySize.y = mousepos.y - (panel_click_resizeorigin.y - panel_click_distance.y);
1194 HUD_Panel_SetPosSize(mySize);
1199 if(prevMouseClicked)
1200 highlightedAction = 0;
1201 if(menu_enabled == 2)
1202 mouse_over_panel = 0;
1204 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true);
1205 if (mouse_over_panel && !tab_panel)
1206 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1208 // draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
1209 const vector cursorsize = '32 32 0';
1210 float cursor_alpha = 1 - autocvar__menu_alpha;
1212 if(!mouse_over_panel)
1213 drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1214 else if(mouse_over_panel == 1)
1215 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1216 else if(mouse_over_panel == 2)
1217 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1219 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1221 prevMouseClicked = mouseClicked;
1223 void HUD_Configure_DrawGrid()
1226 if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
1228 hud_configure_gridSize.x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
1229 hud_configure_gridSize.y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
1230 hud_configure_realGridSize.x = hud_configure_gridSize.x * vid_conwidth;
1231 hud_configure_realGridSize.y = hud_configure_gridSize.y * vid_conheight;
1234 s = eX + eY * vid_conheight;
1235 for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
1236 drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1238 s = eY + eX * vid_conwidth;
1239 for(i = 1; i < 1/hud_configure_gridSize.y; ++i)
1240 drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1244 float _menu_alpha_prev;
1245 void HUD_Configure_Frame()
1248 if(autocvar__hud_configure)
1250 if(isdemo() || intermission == 2)
1252 HUD_Configure_Exit_Force();
1256 if(!hud_configure_prev)
1258 if(autocvar_hud_cursormode)
1261 for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
1262 hud_panel[panel_order[i]].update_time = time;
1265 // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
1266 if(autocvar__menu_alpha != _menu_alpha_prev)
1268 if(autocvar__menu_alpha == 0)
1270 _menu_alpha_prev = autocvar__menu_alpha;
1273 HUD_Configure_DrawGrid();
1275 else if(hud_configure_prev)
1279 if(autocvar_hud_cursormode)
1284 const float hlBorderSize = 2;
1285 const string hlBorder = "gfx/hud/default/border_highlighted";
1286 const string hlBorder2 = "gfx/hud/default/border_highlighted2";
1287 void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
1289 drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
1290 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);
1291 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);
1292 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);
1293 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);
1296 void HUD_Configure_PostDraw()
1298 if(autocvar__hud_configure)
1303 HUD_Panel_UpdatePosSize();
1304 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
1306 if(highlightedPanel)
1308 panel = highlightedPanel;
1309 HUD_Panel_UpdatePosSize();
1310 HUD_Panel_HlBorder(panel_bg_border * hlBorderSize, '0 0.5 1', 0.4 * (1 - autocvar__menu_alpha));