]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Timer: Add countdown sound
authorz411 <z411@omaera.org>
Fri, 7 May 2021 19:28:46 +0000 (15:28 -0400)
committerz411 <z411@omaera.org>
Fri, 7 May 2021 19:41:12 +0000 (15:41 -0400)
qcsrc/client/hud/panel/timer.qc
qcsrc/common/sounds/all.inc

index 34c9d3cffa8a52f46e3f26c188e3e233c31df25d..6e37db992f866add78f40046cfc85c186f9d2bda 100644 (file)
@@ -4,6 +4,8 @@
 #include <client/view.qh>
 
 // Timer (#5)
+float last_timeleft;
+bool autocvar_hud_panel_timer_count = true;
 
 void HUD_Timer_Export(int fh)
 {
@@ -46,6 +48,12 @@ void HUD_Timer()
        timeleft = max(0, timelimit * 60 + STAT(GAMESTARTTIME) - time);
        timeleft = ceil(timeleft);
 
+       // countdown sound
+       if(autocvar_hud_panel_timer_count && timeleft > 0 && timeleft != last_timeleft && timeleft <= 10) {
+               sound(NULL, CH_INFO, SND_ENDCOUNT, VOL_BASE, ATTN_NONE);
+               last_timeleft = timeleft;
+       }
+
        minutesLeft = floor(timeleft / 60);
 
        float warmup_timeleft = 0;
index e0c754cb1c722df31b45fbd8381b42c385d56821..f296df93a2aa41ebd6b795640b136aca977cd910 100644 (file)
@@ -275,6 +275,7 @@ SOUND(HIT, "misc/hit");
 SOUND(TYPEHIT, "misc/typehit");
 SOUND(KILL, "misc/kill");
 SOUND(DEATH, "misc/death");
+SOUND(ENDCOUNT, "misc/endcount");
 SOUND(ENDMATCH, "misc/endmatch");
 SOUND(OVERTIME, "misc/overtime");
 SOUND(TIMEOUT, "misc/timeout");