there's a little bug, overtime, the announcer keeps like O O O O O OVER O O O until the other team cap D or the current team win
@Benoist3012 and I figured out why this happens. There is a third hidden timer that's used during the setup period. The culprit is here:
https://github.com/alliedmodders/hl...42b/game/shared/teamplay_round_timer.cpp#L863
This is the 3rd hidden timer entity's think function during setup (CTeamRoundTimer = team_round_timer), which gets triggered once every 50 ms. The think function sets overtime to 0 on gamerules (CTFGameRules::m_bInOvertime) every 50 ms. Because she forgot to pause this timer, the 3rd timer's think entity kept setting the overtime boolean to 0 during the whole game. When the koth timers are >= 0, this is of no concern because there's no overtime anyway, so setting something that's already 0 to 0 has no effect. It only comes about when one of the timers run down.
During the actual game when both teams can capture the control points, the think function for the 2 koth timers is:
https://github.com/alliedmodders/hl...42b/game/shared/teamplay_round_timer.cpp#L948
Each koth timer calls its own think function every 50 ms. When one of those two timers on the HUD reaches 0 seconds, this is triggered:
https://github.com/alliedmodders/hl...2b/game/shared/teamplay_round_timer.cpp#L1003
So now you got the 3 timers fighting each other: (I'm using 2 as an example here)
(hidden timer) CTeamRoundTimer::RoundTimerSetupThink --> sets overtime to 0
[50 ms later]
(koth timer) CTeamRoundTimer::RoundTimerThink --> sets overtime to 1
[50 ms later]
(hidden timer) CTeamRoundTimer::RoundTimerSetupThink --> sets overtime to 0
[50 ms later]
(koth timer) CTeamRoundTimer::RoundTimerThink --> sets overtime to 1
And this keeps looping itself forever and forever which causes the overtime spam.
The fix is to either:
- Kill the 3rd timer
- Pause the 3rd timer
When the 3rd timer is paused the overtime bug doesn't occur because the think function quits before setting the overtime boolean (exits at line 859, line 863 sets the overtime boolean):
https://github.com/alliedmodders/hl...42b/game/shared/teamplay_round_timer.cpp#L856
Many thanks to
@Benoist3012 for helping me track the root cause of the bug and testing out the fixes.