From: z411 Date: Sun, 27 Feb 2022 18:56:02 +0000 (-0300) Subject: Using GAME_STOPPED to freeze the round timer X-Git-Tag: xonotic-v0.8.5~177^2~14 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f4e1da19263600d2d4b78aa363b0be147ffccf11;p=xonotic%2Fxonotic-data.pk3dir.git Using GAME_STOPPED to freeze the round timer --- 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;