]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
added a sound when the match ends
authorDebugger <pyngot@hotmail.com>
Sat, 23 Mar 2013 12:10:03 +0000 (13:10 +0100)
committerDebugger <pyngot@hotmail.com>
Sat, 23 Mar 2013 12:10:03 +0000 (13:10 +0100)
qcsrc/client/announcer.qc
qcsrc/client/autocvars.qh
sound/announcer/default/matchend.wav [new file with mode: 0644]

index 240d424c6a5ee255eb4eb8135ff4e7137733a0c1..7ef93b40f40298085cfcd68211522644a2d86588 100644 (file)
@@ -5,6 +5,7 @@ string previous_announcement;
 // remaining maptime announcer sounds, true when sound was already played
 float announcer_1min;
 float announcer_5min;
+float announcer_matchend;
 
 void Announcer_Play(string announcement)
 {
@@ -31,7 +32,7 @@ void Announcer_Countdown()
                        Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_BEGIN); 
 
                Announcer_Play("begin");
-               announcer_5min = announcer_1min = FALSE; // reset maptime announcers now as well
+               announcer_5min = announcer_1min = announcer_matchend = FALSE; // reset maptime announcers now as well
                remove(self);
                return;
        }
@@ -132,6 +133,25 @@ void Announcer_Time()
                        }
                }
        }
+       
+       // Check for matchend = 0 seconds remaining
+       if(autocvar_cl_announcer_matchend == 1)
+       {
+               if (announcer_matchend)
+               {
+                       if((!warmup_stage || autocvar_g_warmup_limit == 0) && timeleft == 0)
+                                       announcer_matchend = TRUE;
+               }
+               else if((!warmup_stage || autocvar_g_warmup_limit == 0) && timelimit > 0 && timeleft == 0)
+               {
+                       // if we're in warmup mode, dont play a sound
+                       if not(autocvar_g_warmup_limit == -1 && warmup_stage) 
+                       {
+                               announcer_matchend = TRUE;
+                               Announcer_Play("matchend");
+                       }
+               }
+       }
 }
 
 void Announcer()
@@ -142,6 +162,7 @@ void Announcer()
 
 void Announcer_Precache () 
 {
+       precache_sound (strcat("announcer/", autocvar_cl_announcer, "/matchend.wav"));
        precache_sound (strcat("announcer/", autocvar_cl_announcer, "/1minuteremains.wav"));
        precache_sound (strcat("announcer/", autocvar_cl_announcer, "/5minutesremain.wav"));
 
index 150efb1708ca705054fd00d2c30bbb20d6c18091..3f29ada96e4e54fd45d40d5a1b7f3df710064017 100644 (file)
@@ -21,6 +21,7 @@ float autocvar_cl_allow_uid2name;
 string autocvar_cl_announcer;
 var float autocvar_cl_announcer_antispam = 2;
 var float autocvar_cl_announcer_maptime = 3;
+var float autocvar_cl_announcer_matchend = 1;
 float autocvar_cl_autodemo_delete;
 float autocvar_cl_autodemo_delete_keeprecords;
 float autocvar_cl_casings;
diff --git a/sound/announcer/default/matchend.wav b/sound/announcer/default/matchend.wav
new file mode 100644 (file)
index 0000000..d4fbe5a
Binary files /dev/null and b/sound/announcer/default/matchend.wav differ