]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/countdown_notification' into 'master'
authorMario <zacjardine@y7mail.com>
Sat, 30 Jan 2016 12:34:06 +0000 (12:34 +0000)
committerMario <zacjardine@y7mail.com>
Sat, 30 Jan 2016 12:34:06 +0000 (12:34 +0000)
Countdown notification fix

Line up countdown notification in the infomessages panel and display it when playing too

See merge request !276

qcsrc/client/announcer.qc
qcsrc/client/hud/panel/centerprint.qc
qcsrc/client/hud/panel/infomessages.qc
qcsrc/client/main.qh

index 707e3c8a7657e5b6c8d3495cefe5875ff1111e83..680060cdbe0f3f764d6a2b8a5746471774ebffae 100644 (file)
@@ -77,6 +77,19 @@ void Announcer_Gamestart()
        float roundstarttime = STAT(ROUNDSTARTTIME);
        if(roundstarttime > startTime)
                startTime = roundstarttime;
+       if(intermission)
+       {
+               if(announcer_countdown)
+               {
+                       centerprint_kill(CPID_ROUND);
+                       if(announcer_countdown)
+                       {
+                               remove(announcer_countdown);
+                               announcer_countdown = NULL;
+                       }
+               }
+               return;
+       }
 
        if(previous_game_starttime != startTime)
        {
index 3169d925d24193c34502ed05cfe349d76a66eb38..0c64aa00a9039eb6d74d0cb3f6a0a954289dc8ec 100644 (file)
@@ -87,6 +87,11 @@ void centerprint_generic(int new_id, string strMessage, float duration, int coun
        centerprint_countdown_num[j] = countdown_num;
 }
 
+void centerprint_kill(float id)
+{
+       centerprint_generic(id, "", 0, 0);
+}
+
 void centerprint_hud(string strMessage)
 {
        centerprint_generic(0, strMessage, autocvar_hud_panel_centerprint_time, 0);
index 9153b855da45c510d7c88fcb561b8fb205ea0bac..74b962410c6f748014db3ff0a78ffa5eab52e44a 100644 (file)
@@ -56,7 +56,7 @@ void HUD_InfoMessages()
        string s;
        if(!autocvar__hud_configure)
        {
-               if(spectatee_status && !intermission)
+               if(spectatee_status)
                {
                        a = 1;
                        if(spectatee_status == -1)
@@ -94,18 +94,17 @@ void HUD_InfoMessages()
                        else
                                s = sprintf(_("^1Press ^3%s^1 to join"), getcommandkey("jump", "+jump"));
                        drawInfoMessage(s);
+               }
 
-                       //show restart countdown:
-                       if (time < STAT(GAMESTARTTIME)) {
-                               float countdown;
-                               //we need to ceil, otherwise the countdown would be off by .5 when using round()
-                               countdown = ceil(STAT(GAMESTARTTIME) - time);
-                               s = sprintf(_("^1Game starts in ^3%d^1 seconds"), countdown);
-                               drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
-                               o.y += fontsize.y;
-                       }
+               if (time < STAT(GAMESTARTTIME))
+               {
+                       //we need to ceil, otherwise the countdown would be off by .5 when using round()
+                       float countdown = ceil(STAT(GAMESTARTTIME) - time);
+                       s = sprintf(_("^1Game starts in ^3%d^1 seconds"), countdown);
+                       drawInfoMessage(s);
                }
-               if(warmup_stage && !intermission)
+
+               if(warmup_stage)
                {
                        s = _("^2Currently in ^1warmup^2 stage!");
                        drawInfoMessage(s);
@@ -117,7 +116,7 @@ void HUD_InfoMessages()
                else
                        blinkcolor = "^3";
 
-               if(ready_waiting && !intermission && !spectatee_status)
+               if(ready_waiting && !spectatee_status)
                {
                        if(ready_waiting_for_me)
                        {
@@ -135,13 +134,13 @@ void HUD_InfoMessages()
                        }
                        drawInfoMessage(s);
                }
-               else if(warmup_stage && !intermission && !spectatee_status)
+               else if(warmup_stage && !spectatee_status)
                {
                        s = sprintf(_("^2Press ^3%s^2 to end warmup"), getcommandkey("ready", "ready"));
                        drawInfoMessage(s);
                }
 
-               if(teamplay && !intermission && !spectatee_status && gametype != MAPINFO_TYPE_CA && teamnagger)
+               if(teamplay && !spectatee_status && gametype != MAPINFO_TYPE_CA && teamnagger)
                {
                        float ts_min = 0, ts_max = 0;
                        tm = teams.sort_next;
index 31db3f86e7217733a044b282caaa8dabe7d31ec3..bed4daa268dc2a4afbe08995d70d7b3930913ca7 100644 (file)
@@ -125,6 +125,7 @@ float camera_roll;
 vector camera_direction;
 
 void centerprint_hud(string strMessage);
+void centerprint_kill(float id);
 void centerprint_generic(float new_id, string strMessage, float duration, float countdown_num);
 
 const float ALPHA_MIN_VISIBLE = 0.003;