3 #include <client/draw.qh>
4 #include <client/view.qh>
8 void HUD_Timer_Export(int fh)
10 // allow saving cvars that aesthetically change the panel into hud skin files
15 if(!autocvar__hud_configure)
17 if(!autocvar_hud_panel_timer) return;
20 HUD_Panel_LoadCvars();
28 if (autocvar_hud_panel_timer_dynamichud)
35 pos += '1 1 0' * panel_bg_padding;
36 mySize -= '2 2 0' * panel_bg_padding;
40 float timelimit, timeleft, minutesLeft;
42 timelimit = STAT(TIMELIMIT);
44 timeleft = bound(0, timelimit * 60 + STAT(GAMESTARTTIME) - time, timelimit * 60);
45 timeleft = ceil(timeleft);
47 minutesLeft = floor(timeleft / 60);
49 float warmup_timeleft = 0;
52 float warmup_timelimit = STAT(WARMUP_TIMELIMIT);
53 if(warmup_timelimit > 0)
54 warmup_timeleft = max(0, warmup_timelimit - time + STAT(GAMESTARTTIME));
55 else if(warmup_timelimit == 0)
56 warmup_timeleft = timeleft;
57 warmup_timeleft = ceil(warmup_timeleft);
61 if(intermission_time || minutesLeft >= 5 || warmup_stage || timelimit == 0)
62 timer_color = '1 1 1'; //white
63 else if(minutesLeft >= 1)
64 timer_color = '1 1 0'; //yellow
66 timer_color = '1 0 0'; //red
68 if (intermission_time) {
69 timer = seconds_tostring(max(0, floor(intermission_time - STAT(GAMESTARTTIME))));
70 } else if (warmup_stage && warmup_timeleft >= 60) {
72 } else if (autocvar_hud_panel_timer_increment || (!warmup_stage && timelimit == 0) || (warmup_stage && warmup_timeleft <= 0)) {
73 if (time < STAT(GAMESTARTTIME))
74 timer = seconds_tostring(0); //while restart is still active, show 00:00
76 timer = seconds_tostring(floor(time - STAT(GAMESTARTTIME)));
79 timer = seconds_tostring(warmup_timeleft);
81 timer = seconds_tostring(timeleft);
84 drawstring_aspect(pos, timer, mySize, timer_color, panel_fg_alpha, DRAWFLAG_NORMAL);