From f4e1da19263600d2d4b78aa363b0be147ffccf11 Mon Sep 17 00:00:00 2001 From: z411 Date: Sun, 27 Feb 2022 15:56:02 -0300 Subject: [PATCH] Using GAME_STOPPED to freeze the round timer --- qcsrc/client/hud/panel/timer.qc | 4 ++-- qcsrc/client/view.qc | 5 +++++ qcsrc/client/view.qh | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/qcsrc/client/hud/panel/timer.qc b/qcsrc/client/hud/panel/timer.qc index e4deafca1..1b4dc2070 100644 --- a/qcsrc/client/hud/panel/timer.qc +++ b/qcsrc/client/hud/panel/timer.qc @@ -96,7 +96,7 @@ void HUD_Timer() round_timelimit = STAT(ROUND_TIMELIMIT); // Calculate round time left - round_timeleft = round_timelimit + STAT(ROUNDSTARTTIME) - time; + round_timeleft = round_timelimit + STAT(ROUNDSTARTTIME) - (game_stopped_time ? game_stopped_time : time); if (!autocvar_hud_panel_timer_unbound) round_timeleft = bound(0, round_timeleft, round_timelimit); round_timeleft = ceil(round_timeleft); @@ -109,7 +109,7 @@ void HUD_Timer() if (intermission_time) { subtimer = seconds_tostring(max(0, floor(intermission_time - STAT(ROUNDSTARTTIME)))); } else if (autocvar_hud_panel_timer_increment || round_timelimit <= 0) { - float round_time_elapsed = floor(time - STAT(ROUNDSTARTTIME)); + float round_time_elapsed = floor((game_stopped_time ? game_stopped_time : time) - STAT(ROUNDSTARTTIME)); if (!autocvar_hud_panel_timer_unbound) round_time_elapsed = max(0, round_time_elapsed); diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 34ba8595f..90478bb0a 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -1639,6 +1639,11 @@ void CSQC_UpdateView(entity this, float w, float h) if(intermission && !intermission_time) intermission_time = time; + if(STAT(GAME_STOPPED) && !game_stopped_time) + game_stopped_time = time; + else if(game_stopped_time && !STAT(GAME_STOPPED)) + game_stopped_time = 0; + if(intermission && !isdemo() && !(calledhooks & HOOK_END)) { if(calledhooks & HOOK_START) diff --git a/qcsrc/client/view.qh b/qcsrc/client/view.qh index 0abcb13fe..45959383b 100644 --- a/qcsrc/client/view.qh +++ b/qcsrc/client/view.qh @@ -125,3 +125,4 @@ float blurtest_time0, blurtest_time1, blurtest_radius, blurtest_power; #endif float intermission_time; +float game_stopped_time; -- 2.39.2