]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
When the game is over stop timer and show elapsed time
authorterencehill <piuntn@gmail.com>
Tue, 16 Aug 2016 13:42:01 +0000 (15:42 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 16 Aug 2016 13:42:01 +0000 (15:42 +0200)
qcsrc/client/defs.qh
qcsrc/client/hud/panel/timer.qc
qcsrc/client/view.qc

index e62f0704f16119b2236c847d90abeba704347da5..182f6ace743c71437f9a9f6fb6d323abf6bf21cc 100644 (file)
@@ -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)
index 436a947e8c91da1e4ce5b0e4208e4f9499a10d2d..a56b83ff7e1208074b947633d40fdb9e4a2ac280 100644 (file)
@@ -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);
index 339d05209d2e891dbc195458fecfd2ed7574838e..c13b4b5a5d1479f938f15c1f469e606b6d74cd9b 100644 (file)
@@ -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)