]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/client/hud/hud.qc
Display more panels (engineinfo, modicons and timer) while showing the scoreboard
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / hud.qc
1 #include "hud.qh"
2
3 #include "hud_config.qh"
4 #include "../mapvoting.qh"
5 #include "../teamradar.qh"
6 #include <common/t_items.qh>
7 #include <common/deathtypes/all.qh>
8 #include <common/items/all.qc>
9 #include <common/mapinfo.qh>
10 #include <common/vehicles/all.qh>
11 #include <common/mutators/mutator/waypoints/all.qh>
12 #include <common/stats.qh>
13 #include <lib/csqcmodel/cl_player.qh>
14 #include <server/mutators/mutator/gamemode_ctf.qh> // TODO: remove
15
16
17 /*
18 ==================
19 Misc HUD functions
20 ==================
21 */
22
23 vector HUD_Get_Num_Color (float x, float maxvalue)
24 {
25         float blinkingamt;
26         vector color;
27         if(x >= maxvalue) {
28                 color.x = sin(2*M_PI*time);
29                 color.y = 1;
30                 color.z = sin(2*M_PI*time);
31         }
32         else if(x > maxvalue * 0.75) {
33                 color.x = 0.4 - (x-150)*0.02 * 0.4; //red value between 0.4 -> 0
34                 color.y = 0.9 + (x-150)*0.02 * 0.1; // green value between 0.9 -> 1
35                 color.z = 0;
36         }
37         else if(x > maxvalue * 0.5) {
38                 color.x = 1 - (x-100)*0.02 * 0.6; //red value between 1 -> 0.4
39                 color.y = 1 - (x-100)*0.02 * 0.1; // green value between 1 -> 0.9
40                 color.z = 1 - (x-100)*0.02; // blue value between 1 -> 0
41         }
42         else if(x > maxvalue * 0.25) {
43                 color.x = 1;
44                 color.y = 1;
45                 color.z = 0.2 + (x-50)*0.02 * 0.8; // blue value between 0.2 -> 1
46         }
47         else if(x > maxvalue * 0.1) {
48                 color.x = 1;
49                 color.y = (x-20)*90/27/100; // green value between 0 -> 1
50                 color.z = (x-20)*90/27/100 * 0.2; // blue value between 0 -> 0.2
51         }
52         else {
53                 color.x = 1;
54                 color.y = 0;
55                 color.z = 0;
56         }
57
58         blinkingamt = (1 - x/maxvalue/0.25);
59         if(blinkingamt > 0)
60         {
61                 color.x = color.x - color.x * blinkingamt * sin(2*M_PI*time);
62                 color.y = color.y - color.y * blinkingamt * sin(2*M_PI*time);
63                 color.z = color.z - color.z * blinkingamt * sin(2*M_PI*time);
64         }
65         return color;
66 }
67
68 float HUD_GetRowCount(int item_count, vector size, float item_aspect)
69 {
70     TC(int, item_count);
71         float aspect = size_y / size_x;
72         return bound(1, floor((sqrt(4 * item_aspect * aspect * item_count + aspect * aspect) + aspect + 0.5) / 2), item_count);
73 }
74
75 vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect)
76 {
77     TC(int, item_count);
78         float columns, rows;
79         float ratio, best_ratio = 0;
80         float best_columns = 1, best_rows = 1;
81         bool vertical = (psize.x / psize.y >= item_aspect);
82         if(vertical)
83         {
84                 psize = eX * psize.y + eY * psize.x;
85                 item_aspect = 1 / item_aspect;
86         }
87
88         rows = ceil(sqrt(item_count));
89         columns = ceil(item_count/rows);
90         while(columns >= 1)
91         {
92                 ratio = (psize.x/columns) / (psize.y/rows);
93                 if(ratio > item_aspect)
94                         ratio = item_aspect * item_aspect / ratio;
95
96                 if(ratio <= best_ratio)
97                         break; // ratio starts decreasing by now, skip next configurations
98
99                 best_columns = columns;
100                 best_rows = rows;
101                 best_ratio = ratio;
102
103                 if(columns == 1)
104                         break;
105
106                 --columns;
107                 rows = ceil(item_count/columns);
108         }
109
110         if(vertical)
111                 return eX * best_rows + eY * best_columns;
112         else
113                 return eX * best_columns + eY * best_rows;
114 }
115
116 /*
117 ==================
118 HUD panels
119 ==================
120 */
121
122 //basically the same code of draw_ButtonPicture and draw_VertButtonPicture for the menu
123 void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag)
124 {
125     TC(bool, vertical); TC(int, drawflag);
126         if(!length_ratio || !theAlpha)
127                 return;
128         if(length_ratio > 1)
129                 length_ratio = 1;
130         if (baralign == 3)
131         {
132                 if(length_ratio < -1)
133                         length_ratio = -1;
134         }
135         else if(length_ratio < 0)
136                 return;
137
138         theOrigin = HUD_Shift(theOrigin);
139         theSize = HUD_Scale(theSize);
140
141         vector square;
142         vector width, height;
143         if(vertical) {
144                 pic = strcat(hud_skin_path, "/", pic, "_vertical");
145                 if(precache_pic(pic) == "") {
146                         pic = "gfx/hud/default/progressbar_vertical";
147                 }
148
149         if (baralign == 1) // bottom align
150                         theOrigin.y += (1 - length_ratio) * theSize.y;
151         else if (baralign == 2) // center align
152             theOrigin.y += 0.5 * (1 - length_ratio) * theSize.y;
153         else if (baralign == 3) // center align, positive values down, negative up
154                 {
155                         theSize.y *= 0.5;
156                         if (length_ratio > 0)
157                                 theOrigin.y += theSize.y;
158                         else
159                         {
160                                 theOrigin.y += (1 + length_ratio) * theSize.y;
161                                 length_ratio = -length_ratio;
162                         }
163                 }
164                 theSize.y *= length_ratio;
165
166                 vector bH;
167                 width = eX * theSize.x;
168                 height = eY * theSize.y;
169                 if(theSize.y <= theSize.x * 2)
170                 {
171                         // button not high enough
172                         // draw just upper and lower part then
173                         square = eY * theSize.y * 0.5;
174                         bH = eY * (0.25 * theSize.y / (theSize.x * 2));
175                         drawsubpic(theOrigin,          square + width, pic, '0 0 0', eX + bH, theColor, theAlpha, drawflag);
176                         drawsubpic(theOrigin + square, square + width, pic, eY - bH, eX + bH, theColor, theAlpha, drawflag);
177                 }
178                 else
179                 {
180                         square = eY * theSize.x;
181                         drawsubpic(theOrigin,                   width   +     square, pic, '0 0    0', '1 0.25 0', theColor, theAlpha, drawflag);
182                         drawsubpic(theOrigin +          square, theSize - 2 * square, pic, '0 0.25 0', '1 0.5  0', theColor, theAlpha, drawflag);
183                         drawsubpic(theOrigin + height - square, width   +     square, pic, '0 0.75 0', '1 0.25 0', theColor, theAlpha, drawflag);
184                 }
185         } else {
186                 pic = strcat(hud_skin_path, "/", pic);
187                 if(precache_pic(pic) == "") {
188                         pic = "gfx/hud/default/progressbar";
189                 }
190
191                 if (baralign == 1) // right align
192                         theOrigin.x += (1 - length_ratio) * theSize.x;
193         else if (baralign == 2) // center align
194             theOrigin.x += 0.5 * (1 - length_ratio) * theSize.x;
195         else if (baralign == 3) // center align, positive values on the right, negative on the left
196                 {
197                         theSize.x *= 0.5;
198                         if (length_ratio > 0)
199                                 theOrigin.x += theSize.x;
200                         else
201                         {
202                                 theOrigin.x += (1 + length_ratio) * theSize.x;
203                                 length_ratio = -length_ratio;
204                         }
205                 }
206                 theSize.x *= length_ratio;
207
208                 vector bW;
209                 width = eX * theSize.x;
210                 height = eY * theSize.y;
211                 if(theSize.x <= theSize.y * 2)
212                 {
213                         // button not wide enough
214                         // draw just left and right part then
215                         square = eX * theSize.x * 0.5;
216                         bW = eX * (0.25 * theSize.x / (theSize.y * 2));
217                         drawsubpic(theOrigin,          square + height, pic, '0 0 0', eY + bW, theColor, theAlpha, drawflag);
218                         drawsubpic(theOrigin + square, square + height, pic, eX - bW, eY + bW, theColor, theAlpha, drawflag);
219                 }
220                 else
221                 {
222                         square = eX * theSize.y;
223                         drawsubpic(theOrigin,                  height  +     square, pic, '0    0 0', '0.25 1 0', theColor, theAlpha, drawflag);
224                         drawsubpic(theOrigin +         square, theSize - 2 * square, pic, '0.25 0 0', '0.5  1 0', theColor, theAlpha, drawflag);
225                         drawsubpic(theOrigin + width - square, height  +     square, pic, '0.75 0 0', '0.25 1 0', theColor, theAlpha, drawflag);
226                 }
227         }
228 }
229
230 void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag)
231 {
232     TC(int, drawflag);
233         if(!theAlpha)
234                 return;
235
236         pos = HUD_Shift(pos);
237         mySize = HUD_Scale(mySize);
238
239         string pic;
240         pic = strcat(hud_skin_path, "/num_leading");
241         if(precache_pic(pic) == "") {
242                 pic = "gfx/hud/default/num_leading";
243         }
244
245         drawsubpic(pos, eX * min(mySize.x * 0.5, mySize.y) + eY * mySize.y, pic, '0 0 0', '0.25 1 0', color, theAlpha, drawflag);
246         if(mySize.x/mySize.y > 2)
247                 drawsubpic(pos + eX * mySize.y, eX * (mySize.x - 2 * mySize.y) + eY * mySize.y, pic, '0.25 0 0', '0.5 1 0', color, theAlpha, drawflag);
248         drawsubpic(pos + eX * mySize.x - eX * min(mySize.x * 0.5, mySize.y), eX * min(mySize.x * 0.5, mySize.y) + eY * mySize.y, pic, '0.75 0 0', '0.25 1 0', color, theAlpha, drawflag);
249 }
250
251 void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp)
252 {
253     TC(bool, vertical); TC(int, icon_right_align);
254         vector newPos = '0 0 0', newSize = '0 0 0';
255         vector picpos, numpos;
256
257         if (vertical)
258         {
259                 if(mySize.y/mySize.x > 2)
260                 {
261                         newSize.y = 2 * mySize.x;
262                         newSize.x = mySize.x;
263
264                         newPos.y = myPos.y + (mySize.y - newSize.y) / 2;
265                         newPos.x = myPos.x;
266                 }
267                 else
268                 {
269                         newSize.x = 1/2 * mySize.y;
270                         newSize.y = mySize.y;
271
272                         newPos.x = myPos.x + (mySize.x - newSize.x) / 2;
273                         newPos.y = myPos.y;
274                 }
275
276                 if(icon_right_align)
277                 {
278                         numpos = newPos;
279                         picpos = newPos + eY * newSize.x;
280                 }
281                 else
282                 {
283                         picpos = newPos;
284                         numpos = newPos + eY * newSize.x;
285                 }
286
287                 newSize.y /= 2;
288                 drawpic_aspect_skin(picpos, icon, newSize, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
289                 // make number smaller than icon, it looks better
290                 // reduce only y to draw numbers with different number of digits with the same y size
291                 numpos.y += newSize.y * ((1 - 0.7) / 2);
292                 newSize.y *= 0.7;
293                 drawstring_aspect(numpos, ftos(x), newSize, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
294                 return;
295         }
296
297         if(mySize.x/mySize.y > 3)
298         {
299                 newSize.x = 3 * mySize.y;
300                 newSize.y = mySize.y;
301
302                 newPos.x = myPos.x + (mySize.x - newSize.x) / 2;
303                 newPos.y = myPos.y;
304         }
305         else
306         {
307                 newSize.y = 1/3 * mySize.x;
308                 newSize.x = mySize.x;
309
310                 newPos.y = myPos.y + (mySize.y - newSize.y) / 2;
311                 newPos.x = myPos.x;
312         }
313
314         if(icon_right_align) // right align
315         {
316                 numpos = newPos;
317                 picpos = newPos + eX * 2 * newSize.y;
318         }
319         else // left align
320         {
321                 numpos = newPos + eX * newSize.y;
322                 picpos = newPos;
323         }
324
325         // NOTE: newSize_x is always equal to 3 * mySize_y so we can use
326         // '2 1 0' * newSize_y instead of eX * (2/3) * newSize_x + eY * newSize_y
327         drawstring_aspect_expanding(numpos, ftos(x), '2 1 0' * newSize.y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
328         drawpic_aspect_skin_expanding(picpos, icon, '1 1 0' * newSize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
329 }
330
331 void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha)
332 {
333     TC(bool, vertical); TC(int, icon_right_align);
334         DrawNumIcon_expanding(myPos, mySize, x, icon, vertical, icon_right_align, color, theAlpha, 0);
335 }
336
337 #include "all.inc"
338
339 /*
340 ==================
341 Main HUD system
342 ==================
343 */
344
345 void CSQC_BUMBLE_GUN_HUD();
346
347 void HUD_Vehicle()
348 {
349         if(autocvar__hud_configure) return;
350         if(intermission == 2) return;
351
352         if(hud == HUD_BUMBLEBEE_GUN)
353                 CSQC_BUMBLE_GUN_HUD();
354         else {
355                 Vehicle info = Vehicles_from(hud);
356                 info.vr_hud(info);
357         }
358 }
359
360 bool HUD_Panel_CheckFlags(int showflags)
361 {
362     TC(int, showflags);
363         if ( HUD_Minigame_Showpanels() )
364                 return showflags & PANEL_SHOW_MINIGAME;
365         if(intermission == 2)
366                 return showflags & PANEL_SHOW_MAPVOTE;
367         return showflags & PANEL_SHOW_MAINGAME;
368 }
369
370 void HUD_Panel_Draw(entity panent)
371 {
372         panel = panent;
373         if(autocvar__hud_configure)
374         {
375                 if(panel.panel_configflags & PANEL_CONFIG_MAIN)
376                         panel.panel_draw();
377         }
378         else if(HUD_Panel_CheckFlags(panel.panel_showflags))
379                 panel.panel_draw();
380 }
381
382 void HUD_Reset()
383 {
384         // reset gametype specific icons
385         if(gametype.m_modicons_reset)
386                 gametype.m_modicons_reset();
387 }
388
389 float autocvar_hud_dynamic_shake = 1;
390 float autocvar_hud_dynamic_shake_damage_max = 130;
391 float autocvar_hud_dynamic_shake_damage_min = 10;
392 float autocvar_hud_dynamic_shake_scale = 0.2;
393 float hud_dynamic_shake_x[10] = {0,    1, -0.7,  0.5, -0.3,  0.2, -0.1,  0.1,  0.0, 0};
394 float hud_dynamic_shake_y[10] = {0,  0.4,  0.8, -0.2, -0.6,  0.0,  0.3,  0.1, -0.1, 0};
395 bool Hud_Shake_Update()
396 {
397         if(time - hud_dynamic_shake_time < 0)
398                 return false;
399
400         float anim_speed = 17 + 9 * hud_dynamic_shake_factor;
401         float elapsed_time = (time - hud_dynamic_shake_time) * anim_speed;
402         int i = floor(elapsed_time);
403         if(i >= 9)
404                 return false;
405
406         float f = elapsed_time - i;
407         hud_dynamic_shake_realofs.x = (1 - f) * hud_dynamic_shake_x[i] + f * hud_dynamic_shake_x[i+1];
408         hud_dynamic_shake_realofs.y = (1 - f) * hud_dynamic_shake_y[i] + f * hud_dynamic_shake_y[i+1];
409         hud_dynamic_shake_realofs.z = 0;
410         hud_dynamic_shake_realofs *= hud_dynamic_shake_factor * autocvar_hud_dynamic_shake_scale;
411         hud_dynamic_shake_realofs.x = bound(-0.1, hud_dynamic_shake_realofs.x, 0.1) * vid_conwidth;
412         hud_dynamic_shake_realofs.y = bound(-0.1, hud_dynamic_shake_realofs.y, 0.1) * vid_conheight;
413         return true;
414 }
415
416 void calc_followmodel_ofs(entity view);
417 void Hud_Dynamic_Frame()
418 {
419         vector ofs = '0 0 0';
420         hud_scale = '1 1 0';
421         hud_shift = '0 0 0';
422         if (autocvar_hud_dynamic_follow)
423         {
424                 entity view = CSQCModel_server2csqc(player_localentnum - 1);
425                 calc_followmodel_ofs(view);
426                 ofs = -cl_followmodel_ofs * autocvar_hud_dynamic_follow_scale;
427                 ofs.x *= autocvar_hud_dynamic_follow_scale_xyz.z;
428                 ofs.y *= autocvar_hud_dynamic_follow_scale_xyz.x;
429                 ofs.z *= autocvar_hud_dynamic_follow_scale_xyz.y;
430
431                 if (fabs(ofs.x) < 0.001) ofs.x = 0;
432                 if (fabs(ofs.y) < 0.001) ofs.y = 0;
433                 if (fabs(ofs.z) < 0.001) ofs.z = 0;
434                 ofs.x = bound(-0.1, ofs.x, 0.1);
435                 ofs.y = bound(-0.1, ofs.y, 0.1);
436                 ofs.z = bound(-0.1, ofs.z, 0.1);
437
438                 hud_shift.x = ofs.y * vid_conwidth;
439                 hud_shift.y = ofs.z * vid_conheight;
440                 hud_shift.z = ofs.x;
441
442                 hud_scale.x = (1 + hud_shift.z);
443                 hud_scale.y = hud_scale.x;
444         }
445
446         if(autocvar_hud_dynamic_shake > 0)
447         {
448                 static float old_health = 0;
449                 float health = max(-1, STAT(HEALTH));
450                 if(hud_dynamic_shake_factor == -1) // don't allow the effect for this frame
451                 {
452                         hud_dynamic_shake_factor = 0;
453                         old_health = health;
454                 }
455                 else
456                 {
457                         float new_hud_dynamic_shake_factor = 0;
458                         if (old_health - health >= autocvar_hud_dynamic_shake_damage_min
459                                 && autocvar_hud_dynamic_shake_damage_max > autocvar_hud_dynamic_shake_damage_min
460                                 && old_health > 0 && !intermission)
461                         {
462                                 float m = max(autocvar_hud_dynamic_shake_damage_min, 1);
463                                 new_hud_dynamic_shake_factor = (old_health - health - m) / (autocvar_hud_dynamic_shake_damage_max - m);
464                                 if(new_hud_dynamic_shake_factor >= 1)
465                                         new_hud_dynamic_shake_factor = 1;
466                                 if(new_hud_dynamic_shake_factor >= hud_dynamic_shake_factor)
467                                 {
468                                         hud_dynamic_shake_factor = new_hud_dynamic_shake_factor;
469                                         hud_dynamic_shake_time = time;
470                                 }
471                         }
472                         old_health = health;
473                         if(hud_dynamic_shake_factor)
474                                 if(!Hud_Shake_Update())
475                                         hud_dynamic_shake_factor = 0;
476                 }
477
478                 if(hud_dynamic_shake_factor > 0)
479                 {
480                         hud_shift.x += hud_dynamic_shake_realofs.x;
481                         hud_shift.y += hud_dynamic_shake_realofs.y;
482                 }
483         }
484
485         hud_scale_center.x = 0.5 * vid_conwidth;
486         hud_scale_center.y = 0.5 * vid_conheight;
487
488         hud_scale_current = hud_scale;
489         hud_shift_current = hud_shift;
490 }
491
492 void HUD_Main()
493 {
494         int i;
495         if(hud_configure_menu_open == 1)
496                 hud_fade_alpha = 1;
497         else
498                 hud_fade_alpha = 1 - autocvar__menu_alpha;
499
500         HUD_Configure_Frame();
501
502         Hud_Dynamic_Frame();
503
504         if(scoreboard_fade_alpha == 1)
505                 if(autocvar__menu_alpha == 1)
506                         return;
507
508         // Drawing stuff
509         if (hud_skin_prev != autocvar_hud_skin)
510         {
511                 if (hud_skin_path)
512                         strunzone(hud_skin_path);
513                 hud_skin_path = strzone(strcat("gfx/hud/", autocvar_hud_skin));
514                 if (hud_skin_prev)
515                         strunzone(hud_skin_prev);
516                 hud_skin_prev = strzone(autocvar_hud_skin);
517         }
518
519         // draw the dock
520         if(autocvar_hud_dock != "" && autocvar_hud_dock != "0")
521         {
522                 int f;
523                 vector color;
524                 float hud_dock_color_team = autocvar_hud_dock_color_team;
525                 if((teamplay) && hud_dock_color_team) {
526                         if(autocvar__hud_configure && myteam == NUM_SPECTATOR)
527                                 color = '1 0 0' * hud_dock_color_team;
528                         else
529                                 color = myteamcolors * hud_dock_color_team;
530                 }
531                 else if(autocvar_hud_configure_teamcolorforced && autocvar__hud_configure && hud_dock_color_team) {
532                         color = '1 0 0' * hud_dock_color_team;
533                 }
534                 else
535                 {
536                         string hud_dock_color = autocvar_hud_dock_color;
537                         if(hud_dock_color == "shirt") {
538                                 f = stof(getplayerkeyvalue(current_player, "colors"));
539                                 color = colormapPaletteColor(floor(f / 16), 0);
540                         }
541                         else if(hud_dock_color == "pants") {
542                                 f = stof(getplayerkeyvalue(current_player, "colors"));
543                                 color = colormapPaletteColor(f % 16, 1);
544                         }
545                         else
546                                 color = stov(hud_dock_color);
547                 }
548
549                 string pic;
550                 pic = strcat(hud_skin_path, "/", autocvar_hud_dock);
551                 if(precache_pic(pic) == "") {
552                         pic = strcat(hud_skin_path, "/dock_medium");
553                         if(precache_pic(pic) == "") {
554                                 pic = "gfx/hud/default/dock_medium";
555                         }
556                 }
557                 drawpic('0 0 0', pic, eX * vid_conwidth + eY * vid_conheight, color, autocvar_hud_dock_alpha * hud_fade_alpha, DRAWFLAG_NORMAL); // no aspect ratio forcing on dock...
558         }
559
560         // cache the panel order into the panel_order array
561         if(autocvar__hud_panelorder != hud_panelorder_prev) {
562                 for(i = 0; i < hud_panels_COUNT; ++i)
563                         panel_order[i] = -1;
564                 string s = "";
565                 int p_num;
566                 bool warning = false;
567                 int argc = tokenize_console(autocvar__hud_panelorder);
568                 if (argc > hud_panels_COUNT)
569                         warning = true;
570                 //first detect wrong/missing panel numbers
571                 for(i = 0; i < hud_panels_COUNT; ++i) {
572                         p_num = stoi(argv(i));
573                         if (p_num >= 0 && p_num < hud_panels_COUNT) { //correct panel number?
574                                 if (panel_order[p_num] == -1) //found for the first time?
575                                         s = strcat(s, ftos(p_num), " ");
576                                 panel_order[p_num] = 1; //mark as found
577                         }
578                         else
579                                 warning = true;
580                 }
581                 for(i = 0; i < hud_panels_COUNT; ++i) {
582                         if (panel_order[i] == -1) {
583                                 warning = true;
584                                 s = strcat(s, ftos(i), " "); //add missing panel number
585                         }
586                 }
587                 if (warning)
588                         LOG_TRACE("Automatically fixed wrong/missing panel numbers in _hud_panelorder");
589
590                 cvar_set("_hud_panelorder", s);
591                 if(hud_panelorder_prev)
592                         strunzone(hud_panelorder_prev);
593                 hud_panelorder_prev = strzone(s);
594
595                 //now properly set panel_order
596                 tokenize_console(s);
597                 for(i = 0; i < hud_panels_COUNT; ++i) {
598                         panel_order[i] = stof(argv(i));
599                 }
600         }
601
602         hud_draw_maximized = 0;
603         // draw panels in the order specified by panel_order array
604         for(i = hud_panels_COUNT - 1; i >= 0; --i)
605                 HUD_Panel_Draw(hud_panels_from(panel_order[i]));
606
607         HUD_Vehicle();
608
609         hud_draw_maximized = 1; // panels that may be maximized must check this var
610         // draw maximized panels on top
611         if(hud_panel_radar_maximized)
612                 HUD_Panel_Draw(HUD_PANEL(RADAR));
613         if(autocvar__con_chat_maximized)
614                 HUD_Panel_Draw(HUD_PANEL(CHAT));
615         if(hud_panel_quickmenu)
616                 HUD_Panel_Draw(HUD_PANEL(QUICKMENU));
617
618         if (scoreboard_active || intermission == 2)
619                 HUD_Reset();
620
621         HUD_Configure_PostDraw();
622
623         hud_configure_prev = autocvar__hud_configure;
624 }