From: terencehill Date: Tue, 16 Aug 2016 13:42:01 +0000 (+0200) Subject: When the game is over stop timer and show elapsed time X-Git-Tag: xonotic-v0.8.2~674^2~11 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=41f2fcec6749bfd906e0f4b7fe54161d43083fa2;p=xonotic%2Fxonotic-data.pk3dir.git When the game is over stop timer and show elapsed time --- diff --git a/qcsrc/client/defs.qh b/qcsrc/client/defs.qh index e62f0704f..182f6ace7 100644 --- a/qcsrc/client/defs.qh +++ b/qcsrc/client/defs.qh @@ -120,6 +120,8 @@ int serverflags; float uid2name_dialog; +float gameover_time; + .bool csqcmodel_isdead; // used by shownames and miscfunctions (entcs_IsDead) to know when a player is dead #define player_currententnum (spectatee_status > 0 ? spectatee_status : player_localnum + 1) diff --git a/qcsrc/client/hud/panel/timer.qc b/qcsrc/client/hud/panel/timer.qc index 436a947e8..a56b83ff7 100644 --- a/qcsrc/client/hud/panel/timer.qc +++ b/qcsrc/client/hud/panel/timer.qc @@ -47,14 +47,16 @@ void HUD_Timer() } vector timer_color; - if(minutesLeft >= 5 || warmup_stage || timelimit == 0) //don't use red or yellow in warmup or when there is no timelimit + if(gameover_time || minutesLeft >= 5 || warmup_stage || timelimit == 0) timer_color = '1 1 1'; //white else if(minutesLeft >= 1) timer_color = '1 1 0'; //yellow else timer_color = '1 0 0'; //red - if (autocvar_hud_panel_timer_increment || (!warmup_stage && timelimit == 0) || (warmup_stage && warmup_timeleft <= 0)) { + if (gameover_time) { + timer = seconds_tostring(max(0, floor(gameover_time - STAT(GAMESTARTTIME)))); + } else if (autocvar_hud_panel_timer_increment || (!warmup_stage && timelimit == 0) || (warmup_stage && warmup_timeleft <= 0)) { if (time < STAT(GAMESTARTTIME)) { //while restart is still active, show 00:00 timer = seconds_tostring(0); diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 339d05209..c13b4b5a5 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -1729,6 +1729,9 @@ void CSQC_UpdateView(entity this, float w, float h) if(!postinit) PostInit(); + if(intermission && !gameover_time) + gameover_time = time; + if(intermission && !isdemo() && !(calledhooks & HOOK_END)) { if(calledhooks & HOOK_START)