From 55b980042bd1225db16091ecc67c2db37593185e Mon Sep 17 00:00:00 2001 From: z411 Date: Fri, 7 May 2021 15:28:46 -0400 Subject: [PATCH] Timer: Add countdown sound --- qcsrc/client/hud/panel/timer.qc | 8 ++++++++ qcsrc/common/sounds/all.inc | 1 + 2 files changed, 9 insertions(+) diff --git a/qcsrc/client/hud/panel/timer.qc b/qcsrc/client/hud/panel/timer.qc index 34c9d3cff..6e37db992 100644 --- a/qcsrc/client/hud/panel/timer.qc +++ b/qcsrc/client/hud/panel/timer.qc @@ -4,6 +4,8 @@ #include // 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; diff --git a/qcsrc/common/sounds/all.inc b/qcsrc/common/sounds/all.inc index e0c754cb1..f296df93a 100644 --- a/qcsrc/common/sounds/all.inc +++ b/qcsrc/common/sounds/all.inc @@ -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"); -- 2.39.2