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");
101 HUD_Write_PanelCvar_q("_onlycurrent");
102 HUD_Write_PanelCvar_q("_noncurrent_alpha");
103 HUD_Write_PanelCvar_q("_noncurrent_scale");
104 HUD_Write_PanelCvar_q("_iconalign");
105 HUD_Write_PanelCvar_q("_progressbar");
106 HUD_Write_PanelCvar_q("_progressbar_name");
107 HUD_Write_PanelCvar_q("_progressbar_xoffset");
108 HUD_Write_PanelCvar_q("_text");
110 case HUD_PANEL_POWERUPS:
111 HUD_Write_PanelCvar_q("_flip");
112 HUD_Write_PanelCvar_q("_iconalign");
113 HUD_Write_PanelCvar_q("_baralign");
114 HUD_Write_PanelCvar_q("_progressbar");
115 HUD_Write_PanelCvar_q("_progressbar_strength");
116 HUD_Write_PanelCvar_q("_progressbar_shield");
117 HUD_Write_PanelCvar_q("_text");
119 case HUD_PANEL_HEALTHARMOR:
120 HUD_Write_PanelCvar_q("_flip");
121 HUD_Write_PanelCvar_q("_iconalign");
122 HUD_Write_PanelCvar_q("_baralign");
123 HUD_Write_PanelCvar_q("_progressbar");
124 HUD_Write_PanelCvar_q("_progressbar_health");
125 HUD_Write_PanelCvar_q("_progressbar_armor");
126 HUD_Write_PanelCvar_q("_progressbar_gfx");
127 HUD_Write_PanelCvar_q("_progressbar_gfx_smooth");
128 HUD_Write_PanelCvar_q("_text");
130 case HUD_PANEL_NOTIFY:
131 HUD_Write_PanelCvar_q("_flip");
132 HUD_Write_PanelCvar_q("_fontsize");
133 HUD_Write_PanelCvar_q("_time");
134 HUD_Write_PanelCvar_q("_fadetime");
135 HUD_Write_PanelCvar_q("_icon_aspect");
137 case HUD_PANEL_TIMER:
138 HUD_Write_PanelCvar_q("_increment");
140 case HUD_PANEL_RADAR:
141 HUD_Write_PanelCvar_q("_foreground_alpha");
142 HUD_Write_PanelCvar_q("_rotation");
143 HUD_Write_PanelCvar_q("_zoommode");
144 HUD_Write_PanelCvar_q("_scale");
145 HUD_Write_PanelCvar_q("_maximized_scale");
146 HUD_Write_PanelCvar_q("_maximized_size");
147 HUD_Write_PanelCvar_q("_maximized_rotation");
148 HUD_Write_PanelCvar_q("_maximized_zoommode");
150 case HUD_PANEL_SCORE:
151 HUD_Write_PanelCvar_q("_rankings");
154 HUD_Write_PanelCvar_q("_alreadyvoted_alpha");
156 case HUD_PANEL_MODICONS:
157 HUD_Write_PanelCvar_q("_ca_layout");
158 HUD_Write_PanelCvar_q("_dom_layout");
159 HUD_Write_PanelCvar_q("_freezetag_layout");
161 case HUD_PANEL_PRESSEDKEYS:
162 HUD_Write_PanelCvar_q("_aspect");
163 HUD_Write_PanelCvar_q("_attack");
165 case HUD_PANEL_ENGINEINFO:
166 HUD_Write_PanelCvar_q("_framecounter_time");
167 HUD_Write_PanelCvar_q("_framecounter_decimals");
169 case HUD_PANEL_INFOMESSAGES:
170 HUD_Write_PanelCvar_q("_flip");
172 case HUD_PANEL_PHYSICS:
173 HUD_Write_PanelCvar_q("_speed_unit");
174 HUD_Write_PanelCvar_q("_speed_unit_show");
175 HUD_Write_PanelCvar_q("_speed_max");
176 HUD_Write_PanelCvar_q("_speed_vertical");
177 HUD_Write_PanelCvar_q("_topspeed");
178 HUD_Write_PanelCvar_q("_topspeed_time");
179 HUD_Write_PanelCvar_q("_acceleration_max");
180 HUD_Write_PanelCvar_q("_acceleration_vertical");
181 HUD_Write_PanelCvar_q("_flip");
182 HUD_Write_PanelCvar_q("_baralign");
183 HUD_Write_PanelCvar_q("_progressbar");
184 HUD_Write_PanelCvar_q("_progressbar_acceleration_mode");
185 HUD_Write_PanelCvar_q("_progressbar_acceleration_scale");
186 HUD_Write_PanelCvar_q("_progressbar_acceleration_nonlinear");
187 HUD_Write_PanelCvar_q("_text");
188 HUD_Write_PanelCvar_q("_text_scale");
190 case HUD_PANEL_CENTERPRINT:
191 HUD_Write_PanelCvar_q("_align");
192 HUD_Write_PanelCvar_q("_flip");
193 HUD_Write_PanelCvar_q("_fontscale");
194 HUD_Write_PanelCvar_q("_time");
195 HUD_Write_PanelCvar_q("_fade_in");
196 HUD_Write_PanelCvar_q("_fade_out");
197 HUD_Write_PanelCvar_q("_fade_subsequent");
198 HUD_Write_PanelCvar_q("_fade_subsequent_passone");
199 HUD_Write_PanelCvar_q("_fade_subsequent_passone_minalpha");
200 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo");
201 HUD_Write_PanelCvar_q("_fade_subsequent_passtwo_minalpha");
202 HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
203 HUD_Write_PanelCvar_q("_fade_minfontsize");
205 case HUD_PANEL_ITEMSTIME:
206 HUD_Write_PanelCvar_q("_iconalign");
207 HUD_Write_PanelCvar_q("_progressbar");
208 HUD_Write_PanelCvar_q("_progressbar_name");
209 HUD_Write_PanelCvar_q("_progressbar_reduced");
210 HUD_Write_PanelCvar_q("_showspawned");
211 HUD_Write_PanelCvar_q("_text");
212 HUD_Write_PanelCvar_q("_ratio");
213 HUD_Write_PanelCvar_q("_size_dinamic");
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 == highlightedPanel) continue;
246 HUD_Panel_UpdatePosSize();
247 if(!panel_enabled) continue;
249 panel_pos -= '1 1 0' * panel_bg_border;
250 panel_size += '2 2 0' * panel_bg_border;
252 if(myPos.y + mySize.y < panel_pos.y)
254 if(myPos.y > panel_pos.y + panel_size.y)
257 if(myPos.x + mySize.x < panel_pos.x)
259 if(myPos.x > panel_pos.x + panel_size.x)
262 // OK, there IS a collision.
264 myCenter.x = myPos.x + 0.5 * mySize.x;
265 myCenter.y = myPos.y + 0.5 * mySize.y;
267 targCenter.x = panel_pos.x + 0.5 * panel_size.x;
268 targCenter.y = panel_pos.y + 0.5 * panel_size.y;
270 if(myCenter.x < targCenter.x && myCenter.y < targCenter.y) // top left (of the target panel)
272 if(myPos.x + mySize.x - panel_pos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
273 myTarget.x = panel_pos.x - mySize.x;
274 else // push it upwards
275 myTarget.y = panel_pos.y - mySize.y;
277 else if(myCenter.x > targCenter.x && myCenter.y < targCenter.y) // top right
279 if(panel_pos.x + panel_size.x - myPos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
280 myTarget.x = panel_pos.x + panel_size.x;
281 else // push it upwards
282 myTarget.y = panel_pos.y - mySize.y;
284 else if(myCenter.x < targCenter.x && myCenter.y > targCenter.y) // bottom left
286 if(myPos.x + mySize.x - panel_pos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
287 myTarget.x = panel_pos.x - mySize.x;
288 else // push it downwards
289 myTarget.y = panel_pos.y + panel_size.y;
291 else if(myCenter.x > targCenter.x && myCenter.y > targCenter.y) // bottom right
293 if(panel_pos.x + panel_size.x - myPos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
294 myTarget.x = panel_pos.x + panel_size.x;
295 else // push it downwards
296 myTarget.y = panel_pos.y + panel_size.y;
298 //if(cvar("hud_configure_checkcollisions_debug"))
299 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
305 void HUD_Panel_SetPos(vector pos)
307 panel = highlightedPanel;
308 HUD_Panel_UpdatePosSize();
312 //if(cvar("hud_configure_checkcollisions_debug"))
313 //drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
315 if(autocvar_hud_configure_grid)
317 pos.x = floor((pos.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
318 pos.y = floor((pos.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
321 if(hud_configure_checkcollisions)
322 pos = HUD_Panel_CheckMove(pos, mySize);
324 pos.x = bound(0, pos.x, vid_conwidth - mySize.x);
325 pos.y = bound(0, pos.y, vid_conheight - mySize.y);
328 s = strcat(ftos(pos.x/vid_conwidth), " ", ftos(pos.y/vid_conheight));
330 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
333 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
334 vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
337 float ratio = mySize.x/mySize.y;
339 for (i = 0; i < HUD_PANEL_NUM; ++i) {
340 panel = hud_panel[i];
341 if(panel == highlightedPanel) continue;
342 HUD_Panel_UpdatePosSize();
343 if(!panel_enabled) continue;
345 panel_pos -= '1 1 0' * panel_bg_border;
346 panel_size += '2 2 0' * panel_bg_border;
348 targEndPos = panel_pos + panel_size;
350 // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
351 if(resizeorigin.x > panel_pos.x && resizeorigin.x < targEndPos.x && resizeorigin.y > panel_pos.y && resizeorigin.y < targEndPos.y)
354 if (resizeCorner == 1)
356 // check if this panel is on our way
357 if (resizeorigin.x <= panel_pos.x)
359 if (resizeorigin.y <= panel_pos.y)
361 if (targEndPos.x <= resizeorigin.x - mySize.x)
363 if (targEndPos.y <= resizeorigin.y - mySize.y)
366 // there is a collision:
367 // detect which side of the panel we are facing is actually limiting the resizing
368 // (which side the resize direction finds for first) and reduce the size up to there
370 // dist is the distance between resizeorigin and the "analogous" point of the panel
371 // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel
372 dist.x = resizeorigin.x - targEndPos.x;
373 dist.y = resizeorigin.y - targEndPos.y;
374 if (dist.y <= 0 || dist.x / dist.y > ratio)
375 mySize.x = min(mySize.x, dist.x);
377 mySize.y = min(mySize.y, dist.y);
379 else if (resizeCorner == 2)
381 if (resizeorigin.x >= targEndPos.x)
383 if (resizeorigin.y <= panel_pos.y)
385 if (panel_pos.x >= resizeorigin.x + mySize.x)
387 if (targEndPos.y <= resizeorigin.y - mySize.y)
390 dist.x = panel_pos.x - resizeorigin.x;
391 dist.y = resizeorigin.y - targEndPos.y;
392 if (dist.y <= 0 || dist.x / dist.y > ratio)
393 mySize.x = min(mySize.x, dist.x);
395 mySize.y = min(mySize.y, dist.y);
397 else if (resizeCorner == 3)
399 if (resizeorigin.x <= panel_pos.x)
401 if (resizeorigin.y >= targEndPos.y)
403 if (targEndPos.x <= resizeorigin.x - mySize.x)
405 if (panel_pos.y >= resizeorigin.y + mySize.y)
408 dist.x = resizeorigin.x - targEndPos.x;
409 dist.y = panel_pos.y - resizeorigin.y;
410 if (dist.y <= 0 || dist.x / dist.y > ratio)
411 mySize.x = min(mySize.x, dist.x);
413 mySize.y = min(mySize.y, dist.y);
415 else if (resizeCorner == 4)
417 if (resizeorigin.x >= targEndPos.x)
419 if (resizeorigin.y >= targEndPos.y)
421 if (panel_pos.x >= resizeorigin.x + mySize.x)
423 if (panel_pos.y >= resizeorigin.y + mySize.y)
426 dist.x = panel_pos.x - resizeorigin.x;
427 dist.y = panel_pos.y - resizeorigin.y;
428 if (dist.y <= 0 || dist.x / dist.y > ratio)
429 mySize.x = min(mySize.x, dist.x);
431 mySize.y = min(mySize.y, dist.y);
433 //if(cvar("hud_configure_checkcollisions_debug"))
434 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
440 void HUD_Panel_SetPosSize(vector mySize)
442 panel = highlightedPanel;
443 HUD_Panel_UpdatePosSize();
444 vector resizeorigin = panel_click_resizeorigin;
447 // minimum panel size cap
448 mySize.x = max(0.025 * vid_conwidth, mySize.x);
449 mySize.y = max(0.025 * vid_conheight, mySize.y);
451 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.
453 mySize.x = max(17 * autocvar_con_chatsize, mySize.x);
454 mySize.y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize.y);
457 // collision testing|
458 // -----------------+
460 // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
461 if(resizeCorner == 1) {
462 myPos.x = resizeorigin.x - mySize.x;
463 myPos.y = resizeorigin.y - mySize.y;
464 } else if(resizeCorner == 2) {
465 myPos.x = resizeorigin.x;
466 myPos.y = resizeorigin.y - mySize.y;
467 } else if(resizeCorner == 3) {
468 myPos.x = resizeorigin.x - mySize.x;
469 myPos.y = resizeorigin.y;
470 } else { // resizeCorner == 4
471 myPos.x = resizeorigin.x;
472 myPos.y = resizeorigin.y;
475 // left/top screen edges
477 mySize.x = mySize.x + myPos.x;
479 mySize.y = mySize.y + myPos.y;
481 // bottom/right screen edges
482 if(myPos.x + mySize.x > vid_conwidth)
483 mySize.x = vid_conwidth - myPos.x;
484 if(myPos.y + mySize.y > vid_conheight)
485 mySize.y = vid_conheight - myPos.y;
487 //if(cvar("hud_configure_checkcollisions_debug"))
488 //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
490 // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
491 if(autocvar_hud_configure_grid)
493 mySize.x = floor((mySize.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
494 mySize.y = floor((mySize.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
497 if(hud_configure_checkcollisions)
498 mySize = HUD_Panel_CheckResize(mySize, resizeorigin);
500 // 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)
501 mySize.x = max(0.025 * vid_conwidth, mySize.x);
502 mySize.y = max(0.025 * vid_conheight, mySize.y);
504 // do another pos check, as size might have changed by now
505 if(resizeCorner == 1) {
506 myPos.x = resizeorigin.x - mySize.x;
507 myPos.y = resizeorigin.y - mySize.y;
508 } else if(resizeCorner == 2) {
509 myPos.x = resizeorigin.x;
510 myPos.y = resizeorigin.y - mySize.y;
511 } else if(resizeCorner == 3) {
512 myPos.x = resizeorigin.x - mySize.x;
513 myPos.y = resizeorigin.y;
514 } else { // resizeCorner == 4
515 myPos.x = resizeorigin.x;
516 myPos.y = resizeorigin.y;
519 //if(cvar("hud_configure_checkcollisions_debug"))
520 //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
523 s = strcat(ftos(mySize.x/vid_conwidth), " ", ftos(mySize.y/vid_conheight));
524 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
526 s = strcat(ftos(myPos.x/vid_conwidth), " ", ftos(myPos.y/vid_conheight));
527 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
530 float pressed_key_time;
531 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
532 void HUD_Panel_Arrow_Action(float nPrimary)
534 if(!highlightedPanel)
537 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
540 if(autocvar_hud_configure_grid)
542 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
544 if (hudShiftState & S_SHIFT)
545 step = hud_configure_realGridSize.y;
547 step = 2 * hud_configure_realGridSize.y;
551 if (hudShiftState & S_SHIFT)
552 step = hud_configure_realGridSize.x;
554 step = 2 * hud_configure_realGridSize.x;
559 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
560 step = vid_conheight;
563 if (hudShiftState & S_SHIFT)
564 step = (step / 256); // more precision
566 step = (step / 64) * (1 + 2 * (time - pressed_key_time));
569 panel = highlightedPanel;
570 HUD_Panel_UpdatePosSize();
572 highlightedPanel_initial_pos = panel_pos;
573 highlightedPanel_initial_size = panel_size;
575 if (hudShiftState & S_ALT) // resize
577 if(nPrimary == K_UPARROW)
579 else if(nPrimary == K_RIGHTARROW)
581 else if(nPrimary == K_LEFTARROW)
583 else // if(nPrimary == K_DOWNARROW)
586 // ctrl+arrow reduces the size, instead of increasing it
587 // Note that ctrl disables collisions check too, but it's fine
588 // since we don't collide with anything reducing the size
589 if (hudShiftState & S_CTRL) {
591 resizeCorner = 5 - resizeCorner;
596 panel_click_resizeorigin = panel_pos;
597 if(resizeCorner == 1) {
598 panel_click_resizeorigin += mySize;
600 } else if(resizeCorner == 2) {
601 panel_click_resizeorigin.y += mySize.y;
603 } else if(resizeCorner == 3) {
604 panel_click_resizeorigin.x += mySize.x;
606 } else { // resizeCorner == 4
609 HUD_Panel_SetPosSize(mySize);
615 if(nPrimary == K_UPARROW)
617 else if(nPrimary == K_DOWNARROW)
619 else if(nPrimary == K_LEFTARROW)
621 else // if(nPrimary == K_RIGHTARROW)
624 HUD_Panel_SetPos(pos);
627 panel = highlightedPanel;
628 HUD_Panel_UpdatePosSize();
630 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
633 panel_pos_backup = highlightedPanel_initial_pos;
634 panel_size_backup = highlightedPanel_initial_size;
635 highlightedPanel_backup = highlightedPanel;
639 const int S_MOUSE1 = 1;
640 const int S_MOUSE2 = 2;
641 const int S_MOUSE3 = 4;
643 int prevMouseClicked; // previous state
644 float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks
645 vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks
647 void HUD_Panel_EnableMenu();
648 entity tab_panels[HUD_PANEL_MAX];
650 vector tab_panel_pos;
652 void HUD_Panel_FirstInDrawQ(float id);
653 void reset_tab_panels()
656 for(i = 0; i < HUD_PANEL_NUM; ++i)
657 tab_panels[i] = world;
659 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
666 if(!autocvar__hud_configure)
671 mousepos.x = nPrimary;
672 mousepos.y = nSecondary;
676 // block any input while a menu dialog is fading
677 // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
678 if(autocvar__menu_alpha)
685 // allow console bind to work
688 con_keys = findkeysforcommand("toggleconsole", 0);
689 keys = tokenize(con_keys); // findkeysforcommand returns data for this
691 bool hit_con_bind = false;
693 for (i = 0; i < keys; ++i)
695 if(nPrimary == stof(argv(i)))
699 if(bInputType == 0) {
700 if(nPrimary == K_ALT) hudShiftState |= S_ALT;
701 if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
702 if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
704 else if(bInputType == 1) {
705 if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
706 if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
707 if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
710 if(nPrimary == K_CTRL)
712 if (bInputType == 1) //ctrl has been released
716 //switch to selected panel
717 highlightedPanel = tab_panel;
718 highlightedAction = 0;
719 HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id);
726 if(nPrimary == K_MOUSE1)
728 if(bInputType == 0) // key pressed
729 mouseClicked |= S_MOUSE1;
730 else if(bInputType == 1) // key released
731 mouseClicked -= (mouseClicked & S_MOUSE1);
733 else if(nPrimary == K_MOUSE2)
735 if(bInputType == 0) // key pressed
736 mouseClicked |= S_MOUSE2;
737 else if(bInputType == 1) // key released
738 mouseClicked -= (mouseClicked & S_MOUSE2);
740 else if(nPrimary == K_ESCAPE)
745 localcmd("menu_showhudexit\n");
747 else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
752 cvar_set("_hud_configure", "0");
754 else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel
756 if (bInputType == 1 || mouseClicked)
759 // FIXME minor bug: if a panel is highlighted, has the same pos_x and
760 // lays in the same level of another panel then the next consecutive
761 // CTRL TAB presses will reselect once more the highlighted panel
763 entity starting_panel;
764 entity old_tab_panel = tab_panel;
765 if (!tab_panel) //first press of TAB
767 if (highlightedPanel)
769 panel = highlightedPanel;
770 HUD_Panel_UpdatePosSize();
774 starting_panel = highlightedPanel;
775 tab_panel_pos = panel_pos; //to compute level
779 if ( ((!tab_backward) && (hudShiftState & S_SHIFT)) || (tab_backward && !(hudShiftState & S_SHIFT)) ) //tab direction changed?
781 starting_panel = tab_panel;
783 tab_backward = (hudShiftState & S_SHIFT);
785 float k, level = 0, start_posX;
786 vector candidate_pos = '0 0 0';
787 const float LEVELS_NUM = 4;
788 float level_height = vid_conheight / LEVELS_NUM;
790 level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
791 candidate_pos.x = (!tab_backward) ? vid_conwidth : 0;
792 start_posX = tab_panel_pos.x;
797 for(i = 0; i < HUD_PANEL_NUM; ++i)
799 panel = hud_panel[i];
800 if (panel == tab_panels[i] || panel == starting_panel)
802 HUD_Panel_UpdatePosSize();
803 if (panel_pos.y >= level && (panel_pos.y - level) < level_height)
804 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)) )
805 || ( 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)) ) )
808 tab_panel_pos = candidate_pos = panel_pos;
813 if (k == LEVELS_NUM) //tab_panel not found
821 starting_panel = old_tab_panel;
822 old_tab_panel = world;
823 goto find_tab_panel; //u must find tab_panel!
827 level = (level + level_height) % vid_conheight;
829 candidate_pos.x = vid_conwidth;
833 level = (level - level_height) % vid_conheight;
834 start_posX = vid_conwidth;
839 tab_panels[tab_panel.panel_id] = tab_panel;
841 else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
843 if (bInputType == 1 || mouseClicked)
846 if (highlightedPanel)
847 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
849 cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
851 else if(nPrimary == 'c' && hudShiftState & S_CTRL) // copy highlighted panel size
853 if (bInputType == 1 || mouseClicked)
856 if (highlightedPanel)
858 panel = highlightedPanel;
859 HUD_Panel_UpdatePosSize();
860 panel_size_copied = panel_size;
863 else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
865 if (bInputType == 1 || mouseClicked)
868 if (panel_size_copied == '0 0 0' || !highlightedPanel)
871 panel = highlightedPanel;
872 HUD_Panel_UpdatePosSize();
874 // reduce size if it'd go beyond screen boundaries
875 vector tmp_size = panel_size_copied;
876 if (panel_pos.x + panel_size_copied.x > vid_conwidth)
877 tmp_size.x = vid_conwidth - panel_pos.x;
878 if (panel_pos.y + panel_size_copied.y > vid_conheight)
879 tmp_size.y = vid_conheight - panel_pos.y;
881 if (panel_size == tmp_size)
885 panel_pos_backup = panel_pos;
886 panel_size_backup = panel_size;
887 highlightedPanel_backup = highlightedPanel;
889 s = strcat(ftos(tmp_size.x/vid_conwidth), " ", ftos(tmp_size.y/vid_conheight));
890 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
892 else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
894 if (bInputType == 1 || mouseClicked)
896 //restore previous values
897 if (highlightedPanel_backup)
899 s = strcat(ftos(panel_pos_backup.x/vid_conwidth), " ", ftos(panel_pos_backup.y/vid_conheight));
900 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
901 s = strcat(ftos(panel_size_backup.x/vid_conwidth), " ", ftos(panel_size_backup.y/vid_conheight));
902 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
903 highlightedPanel_backup = world;
906 else if(nPrimary == 's' && hudShiftState & S_CTRL) // save config
908 if (bInputType == 1 || mouseClicked)
910 localcmd("hud save myconfig\n");
912 else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
916 pressed_key_time = 0;
919 else if (pressed_key_time == 0)
920 pressed_key_time = time;
923 HUD_Panel_Arrow_Action(nPrimary); //move or resize panel
925 else if(nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
929 if (highlightedPanel)
930 HUD_Panel_EnableMenu();
932 else if(hit_con_bind || nPrimary == K_PAUSE)
938 float HUD_Panel_Check_Mouse_Pos(float allow_move)
941 while(j < HUD_PANEL_NUM)
946 panel = hud_panel[i];
947 HUD_Panel_UpdatePosSize();
949 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
952 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)
956 // resize from topleft border
957 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)
961 // resize from topright border
962 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)
966 // resize from bottomleft border
967 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)
971 // resize from bottomright border
972 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)
980 // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else)
981 void HUD_Panel_FirstInDrawQ(float id)
985 // find out where in the array our current id is, save into place
986 for(i = 0; i < HUD_PANEL_NUM; ++i)
988 if(panel_order[i] == id)
994 // place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
996 place = HUD_PANEL_NUM - 1;
998 // move all ids up by one step in the array until "place"
999 for(i = place; i > 0; --i)
1001 panel_order[i] = panel_order[i-1];
1003 // now save the new top id
1004 panel_order[0] = id;
1006 // let's save them into the cvar by some strcat trickery
1008 for(i = 0; i < HUD_PANEL_NUM; ++i)
1010 s = strcat(s, ftos(panel_order[i]), " ");
1012 cvar_set("_hud_panelorder", s);
1013 if(hud_panelorder_prev)
1014 strunzone(hud_panelorder_prev);
1015 hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
1018 void HUD_Panel_Highlight(float allow_move)
1022 while(j < HUD_PANEL_NUM)
1027 panel = hud_panel[i];
1028 HUD_Panel_UpdatePosSize();
1030 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
1033 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)
1035 highlightedPanel = hud_panel[i];
1036 HUD_Panel_FirstInDrawQ(i);
1037 highlightedAction = 1;
1038 panel_click_distance = mousepos - panel_pos;
1041 // resize from topleft border
1042 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)
1044 highlightedPanel = hud_panel[i];
1045 HUD_Panel_FirstInDrawQ(i);
1046 highlightedAction = 2;
1048 panel_click_distance = mousepos - panel_pos;
1049 panel_click_resizeorigin = panel_pos + panel_size;
1052 // resize from topright border
1053 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)
1055 highlightedPanel = hud_panel[i];
1056 HUD_Panel_FirstInDrawQ(i);
1057 highlightedAction = 2;
1059 panel_click_distance.x = panel_size.x - mousepos.x + panel_pos.x;
1060 panel_click_distance.y = mousepos.y - panel_pos.y;
1061 panel_click_resizeorigin = panel_pos + eY * panel_size.y;
1064 // resize from bottomleft border
1065 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)
1067 highlightedPanel = hud_panel[i];
1068 HUD_Panel_FirstInDrawQ(i);
1069 highlightedAction = 2;
1071 panel_click_distance.x = mousepos.x - panel_pos.x;
1072 panel_click_distance.y = panel_size.y - mousepos.y + panel_pos.y;
1073 panel_click_resizeorigin = panel_pos + eX * panel_size.x;
1076 // resize from bottomright border
1077 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)
1079 highlightedPanel = hud_panel[i];
1080 HUD_Panel_FirstInDrawQ(i);
1081 highlightedAction = 2;
1083 panel_click_distance = panel_size - mousepos + panel_pos;
1084 panel_click_resizeorigin = panel_pos;
1088 highlightedPanel = world;
1089 highlightedAction = 0;
1092 void HUD_Panel_EnableMenu()
1095 localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
1097 float mouse_over_panel;
1098 void HUD_Panel_Mouse()
1100 if(autocvar__menu_alpha == 1)
1103 if (!autocvar_hud_cursormode)
1105 mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
1107 mousepos.x = bound(0, mousepos.x, vid_conwidth);
1108 mousepos.y = bound(0, mousepos.y, vid_conheight);
1113 if(prevMouseClicked == 0)
1117 //stop ctrl-tab selection
1121 HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
1122 // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
1123 if (highlightedPanel)
1125 highlightedPanel_initial_pos = panel_pos;
1126 highlightedPanel_initial_size = panel_size;
1128 // doubleclick check
1129 if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel && prevMouseClickedPos == mousepos)
1131 mouseClicked = 0; // to prevent spam, I guess.
1132 HUD_Panel_EnableMenu();
1136 if (mouseClicked & S_MOUSE1)
1138 prevMouseClickedTime = time;
1139 prevMouseClickedPos = mousepos;
1141 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(mouseClicked & S_MOUSE1);
1146 panel = highlightedPanel;
1147 HUD_Panel_UpdatePosSize();
1150 if (highlightedPanel)
1152 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1153 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
1155 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
1157 panel_pos_backup = highlightedPanel_initial_pos;
1158 panel_size_backup = highlightedPanel_initial_size;
1159 highlightedPanel_backup = highlightedPanel;
1162 // in case the clicked panel is inside another panel and we aren't
1163 // moving it, avoid the immediate "fix" of its position/size
1164 // (often unwanted and hateful) by disabling collisions check
1165 hud_configure_checkcollisions = false;
1168 if(highlightedAction == 1)
1169 HUD_Panel_SetPos(mousepos - panel_click_distance);
1170 else if(highlightedAction == 2)
1172 vector mySize = '0 0 0';
1173 if(resizeCorner == 1) {
1174 mySize.x = panel_click_resizeorigin.x - (mousepos.x - panel_click_distance.x);
1175 mySize.y = panel_click_resizeorigin.y - (mousepos.y - panel_click_distance.y);
1176 } else if(resizeCorner == 2) {
1177 mySize.x = mousepos.x + panel_click_distance.x - panel_click_resizeorigin.x;
1178 mySize.y = panel_click_distance.y + panel_click_resizeorigin.y - mousepos.y;
1179 } else if(resizeCorner == 3) {
1180 mySize.x = panel_click_resizeorigin.x + panel_click_distance.x - mousepos.x;
1181 mySize.y = mousepos.y + panel_click_distance.y - panel_click_resizeorigin.y;
1182 } else { // resizeCorner == 4
1183 mySize.x = mousepos.x - (panel_click_resizeorigin.x - panel_click_distance.x);
1184 mySize.y = mousepos.y - (panel_click_resizeorigin.y - panel_click_distance.y);
1186 HUD_Panel_SetPosSize(mySize);
1191 if(prevMouseClicked)
1192 highlightedAction = 0;
1193 if(menu_enabled == 2)
1194 mouse_over_panel = 0;
1196 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true);
1197 if (mouse_over_panel && !tab_panel)
1198 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1200 // draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
1201 const vector cursorsize = '32 32 0';
1202 float cursor_alpha = 1 - autocvar__menu_alpha;
1204 if(!mouse_over_panel)
1205 drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1206 else if(mouse_over_panel == 1)
1207 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1208 else if(mouse_over_panel == 2)
1209 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1211 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1213 prevMouseClicked = mouseClicked;
1215 void HUD_Configure_DrawGrid()
1218 if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
1220 hud_configure_gridSize.x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
1221 hud_configure_gridSize.y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
1222 hud_configure_realGridSize.x = hud_configure_gridSize.x * vid_conwidth;
1223 hud_configure_realGridSize.y = hud_configure_gridSize.y * vid_conheight;
1226 s = eX + eY * vid_conheight;
1227 for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
1228 drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1230 s = eY + eX * vid_conwidth;
1231 for(i = 1; i < 1/hud_configure_gridSize.y; ++i)
1232 drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1236 float _menu_alpha_prev;
1237 void HUD_Configure_Frame()
1240 if(autocvar__hud_configure)
1242 if(isdemo() || intermission == 2)
1244 HUD_Configure_Exit_Force();
1248 if(!hud_configure_prev)
1250 if(autocvar_hud_cursormode)
1253 for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
1254 hud_panel[panel_order[i]].update_time = time;
1257 // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
1258 if(autocvar__menu_alpha != _menu_alpha_prev)
1260 if(autocvar__menu_alpha == 0)
1262 _menu_alpha_prev = autocvar__menu_alpha;
1265 HUD_Configure_DrawGrid();
1267 else if(hud_configure_prev)
1271 if(autocvar_hud_cursormode)
1276 const float hlBorderSize = 2;
1277 const string hlBorder = "gfx/hud/default/border_highlighted";
1278 const string hlBorder2 = "gfx/hud/default/border_highlighted2";
1279 void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
1281 drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
1282 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);
1283 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);
1284 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);
1285 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);
1288 void HUD_Configure_PostDraw()
1290 if(autocvar__hud_configure)
1295 HUD_Panel_UpdatePosSize();
1296 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
1298 if(highlightedPanel)
1300 panel = highlightedPanel;
1301 HUD_Panel_UpdatePosSize();
1302 HUD_Panel_HlBorder(panel_bg_border * hlBorderSize, '0 0.5 1', 0.4 * (1 - autocvar__menu_alpha));