]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix double "5 minutes remaining" announcement if timelimit is <= 5 on map start and...
authorterencehill <piuntn@gmail.com>
Tue, 8 Mar 2022 20:48:12 +0000 (21:48 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 8 Mar 2022 20:48:12 +0000 (21:48 +0100)
qcsrc/client/announcer.qc

index 5baaddeffe659fe95552824a287e526088ab7c90..1bbf900375e025f66f059202f7eae6c5b826b50d 100644 (file)
@@ -28,8 +28,6 @@ void Announcer_Countdown(entity this)
                announcer_countdown = NULL;
                return;
        }
-       if(starttime <= time && roundstarttime != starttime) // game start time has passed
-               announcer_5min = announcer_1min = false; // reset maptime announcers now as well
 
        bool inround = (roundstarttime && time >= starttime);
        float countdown = (inround ? roundstarttime - time : starttime - time);
@@ -127,9 +125,25 @@ MACRO_END
 
 void Announcer_Time()
 {
+       static bool warmup_stage_prev;
+
        if(intermission)
                return;
 
+       if (warmup_stage != warmup_stage_prev)
+       {
+               announcer_5min = announcer_1min = false;
+               warmup_stage_prev = warmup_stage;
+               return;
+       }
+
+       float starttime = STAT(GAMESTARTTIME);
+       if(time < starttime)
+       {
+               announcer_5min = announcer_1min = false;
+               return;
+       }
+
        float timeleft;
        if(warmup_stage)
        {
@@ -140,7 +154,7 @@ void Announcer_Time()
                        timeleft = 0;
        }
        else
-               timeleft = max(0, STAT(TIMELIMIT) * 60 + STAT(GAMESTARTTIME) - time);
+               timeleft = max(0, STAT(TIMELIMIT) * 60 + starttime - time);
 
        if(autocvar_cl_announcer_maptime >= 2)
                ANNOUNCER_CHECKMINUTE(5);