From: z411 Date: Wed, 9 Mar 2022 20:56:59 +0000 (-0300) Subject: Making round counter increase after round starts X-Git-Tag: xonotic-v0.8.5~128^2~22 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=76caf1d948403873f70290943902825f5075d4c6;p=xonotic%2Fxonotic-data.pk3dir.git Making round counter increase after round starts Thanks terencehill for the suggestion --- diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index 9f502c387..60bcae23e 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -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); diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc index 0b2f05a98..fc1d4daeb 100644 --- a/qcsrc/common/notifications/all.inc +++ b/qcsrc/common/notifications/all.inc @@ -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"), "") diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index e221421a3..128f090c4 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -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; diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 727ac66e9..7ff8d2a13 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -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) diff --git a/qcsrc/server/round_handler.qc b/qcsrc/server/round_handler.qc index 6b7549bf7..6c9342b80 100644 --- a/qcsrc/server/round_handler.qc +++ b/qcsrc/server/round_handler.qc @@ -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()