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("_showspawned");
213 HUD_Write_PanelCvar_q("_text");
214 HUD_Write_PanelCvar_q("_ratio");
215 HUD_Write_PanelCvar_q("_dynamicsize");
220 HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
222 printf(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
226 printf(_("^1Couldn't write to %s\n"), filename);
229 void HUD_Configure_Exit_Force()
234 localcmd("togglemenu\n");
236 cvar_set("_hud_configure", "0");
239 // check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
240 vector HUD_Panel_CheckMove(vector myPos, vector mySize)
242 vector myCenter, targCenter;
243 vector myTarget = myPos;
245 for (i = 0; i < HUD_PANEL_NUM; ++i) {
246 panel = hud_panel[i];
247 if(panel == HUD_PANEL(MAPVOTE)) continue;
248 if(panel == highlightedPanel) continue;
249 HUD_Panel_UpdatePosSize();
250 if(!panel_enabled) continue;
252 panel_pos -= '1 1 0' * panel_bg_border;
253 panel_size += '2 2 0' * panel_bg_border;
255 if(myPos.y + mySize.y < panel_pos.y)
257 if(myPos.y > panel_pos.y + panel_size.y)
260 if(myPos.x + mySize.x < panel_pos.x)
262 if(myPos.x > panel_pos.x + panel_size.x)
265 // OK, there IS a collision.
267 myCenter.x = myPos.x + 0.5 * mySize.x;
268 myCenter.y = myPos.y + 0.5 * mySize.y;
270 targCenter.x = panel_pos.x + 0.5 * panel_size.x;
271 targCenter.y = panel_pos.y + 0.5 * panel_size.y;
273 if(myCenter.x < targCenter.x && myCenter.y < targCenter.y) // top left (of the target panel)
275 if(myPos.x + mySize.x - panel_pos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
276 myTarget.x = panel_pos.x - mySize.x;
277 else // push it upwards
278 myTarget.y = panel_pos.y - mySize.y;
280 else if(myCenter.x > targCenter.x && myCenter.y < targCenter.y) // top right
282 if(panel_pos.x + panel_size.x - myPos.x < myPos.y + mySize.y - panel_pos.y) // push it to the side
283 myTarget.x = panel_pos.x + panel_size.x;
284 else // push it upwards
285 myTarget.y = panel_pos.y - mySize.y;
287 else if(myCenter.x < targCenter.x && myCenter.y > targCenter.y) // bottom left
289 if(myPos.x + mySize.x - panel_pos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
290 myTarget.x = panel_pos.x - mySize.x;
291 else // push it downwards
292 myTarget.y = panel_pos.y + panel_size.y;
294 else if(myCenter.x > targCenter.x && myCenter.y > targCenter.y) // bottom right
296 if(panel_pos.x + panel_size.x - myPos.x < panel_pos.y + panel_size.y - myPos.y) // push it to the side
297 myTarget.x = panel_pos.x + panel_size.x;
298 else // push it downwards
299 myTarget.y = panel_pos.y + panel_size.y;
301 //if(cvar("hud_configure_checkcollisions_debug"))
302 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
308 void HUD_Panel_SetPos(vector pos)
310 panel = highlightedPanel;
311 HUD_Panel_UpdatePosSize();
315 //if(cvar("hud_configure_checkcollisions_debug"))
316 //drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
318 if(autocvar_hud_configure_grid)
320 pos.x = floor((pos.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
321 pos.y = floor((pos.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
324 if(hud_configure_checkcollisions)
325 pos = HUD_Panel_CheckMove(pos, mySize);
327 pos.x = bound(0, pos.x, vid_conwidth - mySize.x);
328 pos.y = bound(0, pos.y, vid_conheight - mySize.y);
331 s = strcat(ftos(pos.x/vid_conwidth), " ", ftos(pos.y/vid_conheight));
333 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
336 // check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
337 vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
340 float ratio = mySize.x/mySize.y;
342 for (i = 0; i < HUD_PANEL_NUM; ++i) {
343 panel = hud_panel[i];
344 if(panel == HUD_PANEL(MAPVOTE)) continue;
345 if(panel == highlightedPanel) continue;
346 HUD_Panel_UpdatePosSize();
347 if(!panel_enabled) continue;
349 panel_pos -= '1 1 0' * panel_bg_border;
350 panel_size += '2 2 0' * panel_bg_border;
352 targEndPos = panel_pos + panel_size;
354 // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
355 if(resizeorigin.x > panel_pos.x && resizeorigin.x < targEndPos.x && resizeorigin.y > panel_pos.y && resizeorigin.y < targEndPos.y)
358 if (resizeCorner == 1)
360 // check if this panel is on our way
361 if (resizeorigin.x <= panel_pos.x)
363 if (resizeorigin.y <= panel_pos.y)
365 if (targEndPos.x <= resizeorigin.x - mySize.x)
367 if (targEndPos.y <= resizeorigin.y - mySize.y)
370 // there is a collision:
371 // detect which side of the panel we are facing is actually limiting the resizing
372 // (which side the resize direction finds for first) and reduce the size up to there
374 // dist is the distance between resizeorigin and the "analogous" point of the panel
375 // in this case between resizeorigin (bottom-right point) and the bottom-right point of the panel
376 dist.x = resizeorigin.x - targEndPos.x;
377 dist.y = resizeorigin.y - targEndPos.y;
378 if (dist.y <= 0 || dist.x / dist.y > ratio)
379 mySize.x = min(mySize.x, dist.x);
381 mySize.y = min(mySize.y, dist.y);
383 else if (resizeCorner == 2)
385 if (resizeorigin.x >= targEndPos.x)
387 if (resizeorigin.y <= panel_pos.y)
389 if (panel_pos.x >= resizeorigin.x + mySize.x)
391 if (targEndPos.y <= resizeorigin.y - mySize.y)
394 dist.x = panel_pos.x - resizeorigin.x;
395 dist.y = resizeorigin.y - targEndPos.y;
396 if (dist.y <= 0 || dist.x / dist.y > ratio)
397 mySize.x = min(mySize.x, dist.x);
399 mySize.y = min(mySize.y, dist.y);
401 else if (resizeCorner == 3)
403 if (resizeorigin.x <= panel_pos.x)
405 if (resizeorigin.y >= targEndPos.y)
407 if (targEndPos.x <= resizeorigin.x - mySize.x)
409 if (panel_pos.y >= resizeorigin.y + mySize.y)
412 dist.x = resizeorigin.x - targEndPos.x;
413 dist.y = panel_pos.y - resizeorigin.y;
414 if (dist.y <= 0 || dist.x / dist.y > ratio)
415 mySize.x = min(mySize.x, dist.x);
417 mySize.y = min(mySize.y, dist.y);
419 else if (resizeCorner == 4)
421 if (resizeorigin.x >= targEndPos.x)
423 if (resizeorigin.y >= targEndPos.y)
425 if (panel_pos.x >= resizeorigin.x + mySize.x)
427 if (panel_pos.y >= resizeorigin.y + mySize.y)
430 dist.x = panel_pos.x - resizeorigin.x;
431 dist.y = panel_pos.y - resizeorigin.y;
432 if (dist.y <= 0 || dist.x / dist.y > ratio)
433 mySize.x = min(mySize.x, dist.x);
435 mySize.y = min(mySize.y, dist.y);
437 //if(cvar("hud_configure_checkcollisions_debug"))
438 //drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
444 void HUD_Panel_SetPosSize(vector mySize)
446 panel = highlightedPanel;
447 HUD_Panel_UpdatePosSize();
448 vector resizeorigin = panel_click_resizeorigin;
451 // minimum panel size cap
452 mySize.x = max(0.025 * vid_conwidth, mySize.x);
453 mySize.y = max(0.025 * vid_conheight, mySize.y);
455 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.
457 mySize.x = max(17 * autocvar_con_chatsize, mySize.x);
458 mySize.y = max(2 * autocvar_con_chatsize + 2 * panel_bg_padding, mySize.y);
461 // collision testing|
462 // -----------------+
464 // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
465 if(resizeCorner == 1) {
466 myPos.x = resizeorigin.x - mySize.x;
467 myPos.y = resizeorigin.y - mySize.y;
468 } else if(resizeCorner == 2) {
469 myPos.x = resizeorigin.x;
470 myPos.y = resizeorigin.y - mySize.y;
471 } else if(resizeCorner == 3) {
472 myPos.x = resizeorigin.x - mySize.x;
473 myPos.y = resizeorigin.y;
474 } else { // resizeCorner == 4
475 myPos.x = resizeorigin.x;
476 myPos.y = resizeorigin.y;
479 // left/top screen edges
481 mySize.x = mySize.x + myPos.x;
483 mySize.y = mySize.y + myPos.y;
485 // bottom/right screen edges
486 if(myPos.x + mySize.x > vid_conwidth)
487 mySize.x = vid_conwidth - myPos.x;
488 if(myPos.y + mySize.y > vid_conheight)
489 mySize.y = vid_conheight - myPos.y;
491 //if(cvar("hud_configure_checkcollisions_debug"))
492 //drawfill(myPos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
494 // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
495 if(autocvar_hud_configure_grid)
497 mySize.x = floor((mySize.x/vid_conwidth)/hud_configure_gridSize.x + 0.5) * hud_configure_realGridSize.x;
498 mySize.y = floor((mySize.y/vid_conheight)/hud_configure_gridSize.y + 0.5) * hud_configure_realGridSize.y;
501 if(hud_configure_checkcollisions)
502 mySize = HUD_Panel_CheckResize(mySize, resizeorigin);
504 // 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)
505 mySize.x = max(0.025 * vid_conwidth, mySize.x);
506 mySize.y = max(0.025 * vid_conheight, mySize.y);
508 // do another pos check, as size might have changed by now
509 if(resizeCorner == 1) {
510 myPos.x = resizeorigin.x - mySize.x;
511 myPos.y = resizeorigin.y - mySize.y;
512 } else if(resizeCorner == 2) {
513 myPos.x = resizeorigin.x;
514 myPos.y = resizeorigin.y - mySize.y;
515 } else if(resizeCorner == 3) {
516 myPos.x = resizeorigin.x - mySize.x;
517 myPos.y = resizeorigin.y;
518 } else { // resizeCorner == 4
519 myPos.x = resizeorigin.x;
520 myPos.y = resizeorigin.y;
523 //if(cvar("hud_configure_checkcollisions_debug"))
524 //drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
527 s = strcat(ftos(mySize.x/vid_conwidth), " ", ftos(mySize.y/vid_conheight));
528 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
530 s = strcat(ftos(myPos.x/vid_conwidth), " ", ftos(myPos.y/vid_conheight));
531 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_pos"), s);
534 float pressed_key_time;
535 vector highlightedPanel_initial_pos, highlightedPanel_initial_size;
536 void HUD_Panel_Arrow_Action(float nPrimary)
538 if(!highlightedPanel)
541 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
544 if(autocvar_hud_configure_grid)
546 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
548 if (hudShiftState & S_SHIFT)
549 step = hud_configure_realGridSize.y;
551 step = 2 * hud_configure_realGridSize.y;
555 if (hudShiftState & S_SHIFT)
556 step = hud_configure_realGridSize.x;
558 step = 2 * hud_configure_realGridSize.x;
563 if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
564 step = vid_conheight;
567 if (hudShiftState & S_SHIFT)
568 step = (step / 256); // more precision
570 step = (step / 64) * (1 + 2 * (time - pressed_key_time));
573 panel = highlightedPanel;
574 HUD_Panel_UpdatePosSize();
576 highlightedPanel_initial_pos = panel_pos;
577 highlightedPanel_initial_size = panel_size;
579 if (hudShiftState & S_ALT) // resize
581 if(nPrimary == K_UPARROW)
583 else if(nPrimary == K_RIGHTARROW)
585 else if(nPrimary == K_LEFTARROW)
587 else // if(nPrimary == K_DOWNARROW)
590 // ctrl+arrow reduces the size, instead of increasing it
591 // Note that ctrl disables collisions check too, but it's fine
592 // since we don't collide with anything reducing the size
593 if (hudShiftState & S_CTRL) {
595 resizeCorner = 5 - resizeCorner;
600 panel_click_resizeorigin = panel_pos;
601 if(resizeCorner == 1) {
602 panel_click_resizeorigin += mySize;
604 } else if(resizeCorner == 2) {
605 panel_click_resizeorigin.y += mySize.y;
607 } else if(resizeCorner == 3) {
608 panel_click_resizeorigin.x += mySize.x;
610 } else { // resizeCorner == 4
613 HUD_Panel_SetPosSize(mySize);
619 if(nPrimary == K_UPARROW)
621 else if(nPrimary == K_DOWNARROW)
623 else if(nPrimary == K_LEFTARROW)
625 else // if(nPrimary == K_RIGHTARROW)
628 HUD_Panel_SetPos(pos);
631 panel = highlightedPanel;
632 HUD_Panel_UpdatePosSize();
634 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
637 panel_pos_backup = highlightedPanel_initial_pos;
638 panel_size_backup = highlightedPanel_initial_size;
639 highlightedPanel_backup = highlightedPanel;
643 const int S_MOUSE1 = 1;
644 const int S_MOUSE2 = 2;
645 const int S_MOUSE3 = 4;
647 int prevMouseClicked; // previous state
648 float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks
649 vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks
651 void HUD_Panel_EnableMenu();
652 entity tab_panels[HUD_PANEL_MAX];
654 vector tab_panel_pos;
656 void HUD_Panel_FirstInDrawQ(float id);
657 void reset_tab_panels()
660 for(i = 0; i < HUD_PANEL_NUM; ++i)
661 tab_panels[i] = world;
663 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
670 if(!autocvar__hud_configure)
675 mousepos.x = nPrimary;
676 mousepos.y = nSecondary;
680 // block any input while a menu dialog is fading
681 // don't block mousepos read as it leads to cursor jumps in the interaction with the menu
682 if(autocvar__menu_alpha)
689 // allow console bind to work
692 con_keys = findkeysforcommand("toggleconsole", 0);
693 keys = tokenize(con_keys); // findkeysforcommand returns data for this
695 bool hit_con_bind = false;
697 for (i = 0; i < keys; ++i)
699 if(nPrimary == stof(argv(i)))
703 if(bInputType == 0) {
704 if(nPrimary == K_ALT) hudShiftState |= S_ALT;
705 if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
706 if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
708 else if(bInputType == 1) {
709 if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
710 if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
711 if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
714 if(nPrimary == K_CTRL)
716 if (bInputType == 1) //ctrl has been released
720 //switch to selected panel
721 highlightedPanel = tab_panel;
722 highlightedAction = 0;
723 HUD_Panel_FirstInDrawQ(highlightedPanel.panel_id);
730 if(nPrimary == K_MOUSE1)
732 if(bInputType == 0) // key pressed
733 mouseClicked |= S_MOUSE1;
734 else if(bInputType == 1) // key released
735 mouseClicked -= (mouseClicked & S_MOUSE1);
737 else if(nPrimary == K_MOUSE2)
739 if(bInputType == 0) // key pressed
740 mouseClicked |= S_MOUSE2;
741 else if(bInputType == 1) // key released
742 mouseClicked -= (mouseClicked & S_MOUSE2);
744 else if(nPrimary == K_ESCAPE)
749 localcmd("menu_showhudexit\n");
751 else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL)
756 cvar_set("_hud_configure", "0");
758 else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel
760 if (bInputType == 1 || mouseClicked)
763 // FIXME minor bug: if a panel is highlighted, has the same pos_x and
764 // lays in the same level of another panel then the next consecutive
765 // CTRL TAB presses will reselect once more the highlighted panel
767 entity starting_panel;
768 entity old_tab_panel = tab_panel;
769 if (!tab_panel) //first press of TAB
771 if (highlightedPanel)
773 panel = highlightedPanel;
774 HUD_Panel_UpdatePosSize();
778 starting_panel = highlightedPanel;
779 tab_panel_pos = panel_pos; //to compute level
783 if ( ((!tab_backward) && (hudShiftState & S_SHIFT)) || (tab_backward && !(hudShiftState & S_SHIFT)) ) //tab direction changed?
785 starting_panel = tab_panel;
787 tab_backward = (hudShiftState & S_SHIFT);
789 float k, level = 0, start_posX;
790 vector candidate_pos = '0 0 0';
791 const float LEVELS_NUM = 4;
792 float level_height = vid_conheight / LEVELS_NUM;
794 level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
795 candidate_pos.x = (!tab_backward) ? vid_conwidth : 0;
796 start_posX = tab_panel_pos.x;
801 for(i = 0; i < HUD_PANEL_NUM; ++i)
803 panel = hud_panel[i];
804 if(panel == HUD_PANEL(MAPVOTE))
806 if (panel == tab_panels[i] || panel == starting_panel)
808 HUD_Panel_UpdatePosSize();
809 if (panel_pos.y >= level && (panel_pos.y - level) < level_height)
810 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)) )
811 || ( 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)) ) )
814 tab_panel_pos = candidate_pos = panel_pos;
819 if (k == LEVELS_NUM) //tab_panel not found
827 starting_panel = old_tab_panel;
828 old_tab_panel = world;
829 goto find_tab_panel; //u must find tab_panel!
833 level = (level + level_height) % vid_conheight;
835 candidate_pos.x = vid_conwidth;
839 level = (level - level_height) % vid_conheight;
840 start_posX = vid_conwidth;
845 tab_panels[tab_panel.panel_id] = tab_panel;
847 else if(nPrimary == K_SPACE && hudShiftState & S_CTRL) // enable/disable highlighted panel or dock
849 if (bInputType == 1 || mouseClicked)
852 if (highlightedPanel)
853 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
855 cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
857 else if(nPrimary == 'c' && hudShiftState & S_CTRL) // copy highlighted panel size
859 if (bInputType == 1 || mouseClicked)
862 if (highlightedPanel)
864 panel = highlightedPanel;
865 HUD_Panel_UpdatePosSize();
866 panel_size_copied = panel_size;
869 else if(nPrimary == 'v' && hudShiftState & S_CTRL) // past copied size on the highlighted panel
871 if (bInputType == 1 || mouseClicked)
874 if (panel_size_copied == '0 0 0' || !highlightedPanel)
877 panel = highlightedPanel;
878 HUD_Panel_UpdatePosSize();
880 // reduce size if it'd go beyond screen boundaries
881 vector tmp_size = panel_size_copied;
882 if (panel_pos.x + panel_size_copied.x > vid_conwidth)
883 tmp_size.x = vid_conwidth - panel_pos.x;
884 if (panel_pos.y + panel_size_copied.y > vid_conheight)
885 tmp_size.y = vid_conheight - panel_pos.y;
887 if (panel_size == tmp_size)
891 panel_pos_backup = panel_pos;
892 panel_size_backup = panel_size;
893 highlightedPanel_backup = highlightedPanel;
895 s = strcat(ftos(tmp_size.x/vid_conwidth), " ", ftos(tmp_size.y/vid_conheight));
896 cvar_set(strcat("hud_panel_", highlightedPanel.panel_name, "_size"), s);
898 else if(nPrimary == 'z' && hudShiftState & S_CTRL) // undo last action
900 if (bInputType == 1 || mouseClicked)
902 //restore previous values
903 if (highlightedPanel_backup)
905 s = strcat(ftos(panel_pos_backup.x/vid_conwidth), " ", ftos(panel_pos_backup.y/vid_conheight));
906 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_pos"), s);
907 s = strcat(ftos(panel_size_backup.x/vid_conwidth), " ", ftos(panel_size_backup.y/vid_conheight));
908 cvar_set(strcat("hud_panel_", highlightedPanel_backup.panel_name, "_size"), s);
909 highlightedPanel_backup = world;
912 else if(nPrimary == 's' && hudShiftState & S_CTRL) // save config
914 if (bInputType == 1 || mouseClicked)
916 localcmd("hud save myconfig\n");
918 else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
922 pressed_key_time = 0;
925 else if (pressed_key_time == 0)
926 pressed_key_time = time;
929 HUD_Panel_Arrow_Action(nPrimary); //move or resize panel
931 else if(nPrimary == K_ENTER || nPrimary == K_SPACE || nPrimary == K_KP_ENTER)
935 if (highlightedPanel)
936 HUD_Panel_EnableMenu();
938 else if(hit_con_bind || nPrimary == K_PAUSE)
944 float HUD_Panel_Check_Mouse_Pos(float allow_move)
947 while(j < HUD_PANEL_NUM)
952 panel = hud_panel[i];
953 if(panel == HUD_PANEL(MAPVOTE)) continue;
954 HUD_Panel_UpdatePosSize();
956 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
959 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)
963 // resize from topleft border
964 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)
968 // resize from topright border
969 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)
973 // resize from bottomleft border
974 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)
978 // resize from bottomright border
979 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)
987 // move a panel to the beginning of the panel order array (which means it gets drawn last, on top of everything else)
988 void HUD_Panel_FirstInDrawQ(float id)
992 // find out where in the array our current id is, save into place
993 for(i = 0; i < HUD_PANEL_NUM; ++i)
995 if(panel_order[i] == id)
1001 // place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
1003 place = HUD_PANEL_NUM - 1;
1005 // move all ids up by one step in the array until "place"
1006 for(i = place; i > 0; --i)
1008 panel_order[i] = panel_order[i-1];
1010 // now save the new top id
1011 panel_order[0] = id;
1013 // let's save them into the cvar by some strcat trickery
1015 for(i = 0; i < HUD_PANEL_NUM; ++i)
1017 s = strcat(s, ftos(panel_order[i]), " ");
1019 cvar_set("_hud_panelorder", s);
1020 if(hud_panelorder_prev)
1021 strunzone(hud_panelorder_prev);
1022 hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
1025 void HUD_Panel_Highlight(float allow_move)
1029 while(j < HUD_PANEL_NUM)
1034 panel = hud_panel[i];
1035 if(panel == HUD_PANEL(MAPVOTE))
1037 HUD_Panel_UpdatePosSize();
1039 float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
1042 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)
1044 highlightedPanel = hud_panel[i];
1045 HUD_Panel_FirstInDrawQ(i);
1046 highlightedAction = 1;
1047 panel_click_distance = mousepos - panel_pos;
1050 // resize from topleft border
1051 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)
1053 highlightedPanel = hud_panel[i];
1054 HUD_Panel_FirstInDrawQ(i);
1055 highlightedAction = 2;
1057 panel_click_distance = mousepos - panel_pos;
1058 panel_click_resizeorigin = panel_pos + panel_size;
1061 // resize from topright border
1062 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)
1064 highlightedPanel = hud_panel[i];
1065 HUD_Panel_FirstInDrawQ(i);
1066 highlightedAction = 2;
1068 panel_click_distance.x = panel_size.x - mousepos.x + panel_pos.x;
1069 panel_click_distance.y = mousepos.y - panel_pos.y;
1070 panel_click_resizeorigin = panel_pos + eY * panel_size.y;
1073 // resize from bottomleft border
1074 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)
1076 highlightedPanel = hud_panel[i];
1077 HUD_Panel_FirstInDrawQ(i);
1078 highlightedAction = 2;
1080 panel_click_distance.x = mousepos.x - panel_pos.x;
1081 panel_click_distance.y = panel_size.y - mousepos.y + panel_pos.y;
1082 panel_click_resizeorigin = panel_pos + eX * panel_size.x;
1085 // resize from bottomright border
1086 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)
1088 highlightedPanel = hud_panel[i];
1089 HUD_Panel_FirstInDrawQ(i);
1090 highlightedAction = 2;
1092 panel_click_distance = panel_size - mousepos + panel_pos;
1093 panel_click_resizeorigin = panel_pos;
1097 highlightedPanel = world;
1098 highlightedAction = 0;
1101 void HUD_Panel_EnableMenu()
1104 localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n");
1106 float mouse_over_panel;
1107 void HUD_Panel_Mouse()
1109 if(autocvar__menu_alpha == 1)
1112 if (!autocvar_hud_cursormode)
1114 mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
1116 mousepos.x = bound(0, mousepos.x, vid_conwidth);
1117 mousepos.y = bound(0, mousepos.y, vid_conheight);
1122 if(prevMouseClicked == 0)
1126 //stop ctrl-tab selection
1130 HUD_Panel_Highlight(mouseClicked & S_MOUSE1); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
1131 // and calls HUD_Panel_UpdatePosSize() for the highlighted panel
1132 if (highlightedPanel)
1134 highlightedPanel_initial_pos = panel_pos;
1135 highlightedPanel_initial_size = panel_size;
1137 // doubleclick check
1138 if ((mouseClicked & S_MOUSE1) && time - prevMouseClickedTime < 0.4 && highlightedPanel && prevMouseClickedPos == mousepos)
1140 mouseClicked = 0; // to prevent spam, I guess.
1141 HUD_Panel_EnableMenu();
1145 if (mouseClicked & S_MOUSE1)
1147 prevMouseClickedTime = time;
1148 prevMouseClickedPos = mousepos;
1150 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(mouseClicked & S_MOUSE1);
1155 panel = highlightedPanel;
1156 HUD_Panel_UpdatePosSize();
1159 if (highlightedPanel)
1161 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1162 if (highlightedPanel_initial_pos != panel_pos || highlightedPanel_initial_size != panel_size)
1164 hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
1166 panel_pos_backup = highlightedPanel_initial_pos;
1167 panel_size_backup = highlightedPanel_initial_size;
1168 highlightedPanel_backup = highlightedPanel;
1171 // in case the clicked panel is inside another panel and we aren't
1172 // moving it, avoid the immediate "fix" of its position/size
1173 // (often unwanted and hateful) by disabling collisions check
1174 hud_configure_checkcollisions = false;
1177 if(highlightedAction == 1)
1178 HUD_Panel_SetPos(mousepos - panel_click_distance);
1179 else if(highlightedAction == 2)
1181 vector mySize = '0 0 0';
1182 if(resizeCorner == 1) {
1183 mySize.x = panel_click_resizeorigin.x - (mousepos.x - panel_click_distance.x);
1184 mySize.y = panel_click_resizeorigin.y - (mousepos.y - panel_click_distance.y);
1185 } else if(resizeCorner == 2) {
1186 mySize.x = mousepos.x + panel_click_distance.x - panel_click_resizeorigin.x;
1187 mySize.y = panel_click_distance.y + panel_click_resizeorigin.y - mousepos.y;
1188 } else if(resizeCorner == 3) {
1189 mySize.x = panel_click_resizeorigin.x + panel_click_distance.x - mousepos.x;
1190 mySize.y = mousepos.y + panel_click_distance.y - panel_click_resizeorigin.y;
1191 } else { // resizeCorner == 4
1192 mySize.x = mousepos.x - (panel_click_resizeorigin.x - panel_click_distance.x);
1193 mySize.y = mousepos.y - (panel_click_resizeorigin.y - panel_click_distance.y);
1195 HUD_Panel_SetPosSize(mySize);
1200 if(prevMouseClicked)
1201 highlightedAction = 0;
1202 if(menu_enabled == 2)
1203 mouse_over_panel = 0;
1205 mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true);
1206 if (mouse_over_panel && !tab_panel)
1207 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .1, DRAWFLAG_NORMAL);
1209 // draw cursor after performing move/resize to have the panel pos/size updated before mouse_over_panel
1210 const vector cursorsize = '32 32 0';
1211 float cursor_alpha = 1 - autocvar__menu_alpha;
1213 if(!mouse_over_panel)
1214 drawpic(mousepos, strcat("gfx/menu/", autocvar_menu_skin, "/cursor.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1215 else if(mouse_over_panel == 1)
1216 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_move.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1217 else if(mouse_over_panel == 2)
1218 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1220 drawpic(mousepos - cursorsize * 0.5, strcat("gfx/menu/", autocvar_menu_skin, "/cursor_resize2.tga"), cursorsize, '1 1 1', cursor_alpha, DRAWFLAG_NORMAL);
1222 prevMouseClicked = mouseClicked;
1224 void HUD_Configure_DrawGrid()
1227 if(autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
1229 hud_configure_gridSize.x = bound(0.005, cvar("hud_configure_grid_xsize"), 0.2);
1230 hud_configure_gridSize.y = bound(0.005, cvar("hud_configure_grid_ysize"), 0.2);
1231 hud_configure_realGridSize.x = hud_configure_gridSize.x * vid_conwidth;
1232 hud_configure_realGridSize.y = hud_configure_gridSize.y * vid_conheight;
1235 s = eX + eY * vid_conheight;
1236 for(i = 1; i < 1/hud_configure_gridSize.x; ++i)
1237 drawfill(eX * i * hud_configure_realGridSize.x, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1239 s = eY + eX * vid_conwidth;
1240 for(i = 1; i < 1/hud_configure_gridSize.y; ++i)
1241 drawfill(eY * i * hud_configure_realGridSize.y, s, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
1245 float _menu_alpha_prev;
1246 void HUD_Configure_Frame()
1249 if(autocvar__hud_configure)
1251 if(isdemo() || intermission == 2)
1253 HUD_Configure_Exit_Force();
1257 if(!hud_configure_prev)
1259 if(autocvar_hud_cursormode)
1262 for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
1263 hud_panel[panel_order[i]].update_time = time;
1266 // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
1267 if(autocvar__menu_alpha != _menu_alpha_prev)
1269 if(autocvar__menu_alpha == 0)
1271 _menu_alpha_prev = autocvar__menu_alpha;
1274 HUD_Configure_DrawGrid();
1276 else if(hud_configure_prev)
1280 if(autocvar_hud_cursormode)
1285 const float hlBorderSize = 2;
1286 const string hlBorder = "gfx/hud/default/border_highlighted";
1287 const string hlBorder2 = "gfx/hud/default/border_highlighted2";
1288 void HUD_Panel_HlBorder(float myBorder, vector color, float theAlpha)
1290 drawfill(panel_pos - '1 1 0' * myBorder, panel_size + '2 2 0' * myBorder, '0 0.5 1', .5 * theAlpha, DRAWFLAG_NORMAL);
1291 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);
1292 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);
1293 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);
1294 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);
1297 void HUD_Configure_PostDraw()
1299 if(autocvar__hud_configure)
1304 HUD_Panel_UpdatePosSize();
1305 drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL);
1307 if(highlightedPanel)
1309 panel = highlightedPanel;
1310 HUD_Panel_UpdatePosSize();
1311 HUD_Panel_HlBorder(panel_bg_border * hlBorderSize, '0 0.5 1', 0.4 * (1 - autocvar__menu_alpha));