]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Making round counter increase after round starts
authorz411 <z411@omaera.org>
Wed, 9 Mar 2022 20:56:59 +0000 (17:56 -0300)
committerz411 <z411@omaera.org>
Wed, 9 Mar 2022 20:56:59 +0000 (17:56 -0300)
Thanks terencehill for the suggestion

qcsrc/client/announcer.qc
qcsrc/common/notifications/all.inc
qcsrc/common/stats.qh
qcsrc/server/command/vote.qc
qcsrc/server/round_handler.qc

index 9f502c387ee3131507230ba920110727a9d888d7..60bcae23ee0166f3ece8c3922bb26a6f24525cb3 100644 (file)
@@ -52,7 +52,7 @@ void Announcer_Countdown(entity this)
        {
                if(inround)
                {
-                       Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTART, countdown_rounded, STAT(ROUND_COUNT));
+                       Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTART, STAT(ROUNDS_PLAYED) + 1, countdown_rounded);
                        Notification annce_num = Announcer_PickNumber(CNT_ROUNDSTART, countdown_rounded);
                        if(annce_num != NULL)
                                Local_Notification(MSG_ANNCE, annce_num);
index 0b2f05a98233784f6711a06adea9996262e0e30a..fc1d4daeb209caeb576f17f5ac2d456d696a695c 100644 (file)
@@ -528,7 +528,7 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input !=
 
     MSG_CENTER_NOTIF(COUNTDOWN_BEGIN,                   N_ENABLE,    0, 0, "",               CPID_ROUND,             "2 0",  _("^BOLDBegin!"), "")
     MSG_CENTER_NOTIF(COUNTDOWN_GAMESTART,               N_ENABLE,    0, 1, "",               CPID_ROUND,             "1 f1", _("^BGGame starts in\n^BOLD^COUNT"), "")
-    MSG_CENTER_NOTIF(COUNTDOWN_ROUNDSTART,              N_ENABLE,    0, 2, "f2",               CPID_ROUND,           "1 f1", _("^BGRound %s starts in\n^BOLD^COUNT"), "")
+    MSG_CENTER_NOTIF(COUNTDOWN_ROUNDSTART,              N_ENABLE,    0, 2, "f1",             CPID_ROUND,             "1 f2", _("^BGRound %s starts in\n^BOLD^COUNT"), "")
     MSG_CENTER_NOTIF(COUNTDOWN_ROUNDSTOP,               N_ENABLE,    0, 0, "",               CPID_ROUND,             "2 0",  _("^F4Round cannot start"), "")
 
     MSG_CENTER_NOTIF(ROUND_TIED,                        N_ENABLE,    0, 0, "",               CPID_ROUND,             "0 0",  _("^BGRound tied"), "")
index e221421a3f7cc898f5b61e1d4b98dd746b310944..128f090c4fd9ec94ff1269b3336bda705be60c8e 100644 (file)
@@ -366,7 +366,7 @@ REGISTER_STAT(Q3COMPAT, int, q3compat)
 #include "physics/movetypes/movetypes.qh"
 float warmup_limit;
 float round_limit;
-int round_count;
+int rounds_played;
 #endif
 
 #ifdef SVQC
@@ -406,7 +406,7 @@ REGISTER_STAT(MOVEVARS_AIRCONTROL, float)
 REGISTER_STAT(FRAGLIMIT, float, autocvar_fraglimit)
 REGISTER_STAT(TIMELIMIT, float, autocvar_timelimit)
 REGISTER_STAT(WARMUP_TIMELIMIT, float, warmup_limit)
-REGISTER_STAT(ROUND_COUNT, int, round_count)
+REGISTER_STAT(ROUNDS_PLAYED, int, rounds_played)
 REGISTER_STAT(ROUND_TIMELIMIT, float, round_limit)
 #ifdef SVQC
 float autocvar_sv_wallfriction;
index 727ac66e97b74bc690e182dfb56d224275b60f39..7ff8d2a133e16abd24425031214f7f11201c35aa 100644 (file)
@@ -349,10 +349,8 @@ void reset_map(bool dorespawn, bool is_fake_round_start)
                        PlayerStats_GameReport_Reset_All();
                }
 
-               if (round_handler_IsActive()) {
-                       round_count = 0;
+               if (round_handler_IsActive())
                        round_handler_Reset(game_starttime);
-               }
        }
 
        if (shuffleteams_on_reset_map)
index 6b7549bf7d29f5e2d5c4093c13d93e5d95e5660b..6c9342b80e30bcb64ec2759cc4a67c245d3bc95f 100644 (file)
@@ -35,16 +35,14 @@ void round_handler_Think(entity this)
        {
                if (this.canRoundStart() && !(autocvar_g_campaign && !campaign_bots_may_start))
                {
-                       if (this.cnt == this.count + 1) {
-                               round_starttime = time + this.count;
-                               ++round_count;
-                       }
+                       if (this.cnt == this.count + 1) round_starttime = time + this.count;
                        int f = this.cnt - 1;
                        if (f == 0)
                        {
                                this.cnt = 0;
                                this.round_endtime = (this.round_timelimit) ? time + this.round_timelimit : 0;
                                this.nextthink = time;
+                               rounds_played++;
                                if (this.roundStart) this.roundStart();
                                return;
                        }
@@ -117,7 +115,10 @@ void round_handler_Reset(float next_think)
                if (this.cnt < this.count + 1) this.cnt = this.count + 1;
        this.nextthink = next_think;
        if (next_think)
+       {
+               if (next_think <= game_starttime) rounds_played = 0;
                round_starttime = next_think + this.count;
+       }
 }
 
 void round_handler_Remove()