]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix infinite lifetime centerprints
authorSamual Lenks <samual@xonotic.org>
Sun, 3 Mar 2013 08:29:31 +0000 (03:29 -0500)
committerSamual Lenks <samual@xonotic.org>
Sun, 3 Mar 2013 08:29:31 +0000 (03:29 -0500)
qcsrc/client/hud.qc
qcsrc/common/notifications.qc
qcsrc/common/notifications.qh
qcsrc/server/cl_client.qc

index 244ba8926b1f25ea9f30212e64fadb5fcda2abd1..0c162a7579fab09946c8f6a6ee72206d627c70fa 100644 (file)
@@ -4078,6 +4078,7 @@ float centerprint_showing;
 
 void centerprint_generic(float new_id, string strMessage, float duration, float countdown_num)
 {
+       //print(sprintf("centerprint_generic(%d, '%s^7', %d, %d);\n", new_id, strMessage, duration, countdown_num));
        float i, j;
 
        if(strMessage == "" && new_id == 0)
@@ -4137,7 +4138,10 @@ void centerprint_generic(float new_id, string strMessage, float duration, float
        centerprint_messages[j] = strzone(strMessage);
        centerprint_msgID[j] = new_id;
        if (duration < 0)
+       {
                centerprint_time[j] = -1;
+               centerprint_expire_time[j] = time;
+       }
        else
        {
                if(duration == 0)
@@ -4262,14 +4266,17 @@ void HUD_CenterPrint (void)
                                        continue;
                                centerprint_expire_time[j] = centerprint_expire_time[j] + centerprint_time[j];
                        }
-                       else
+                       else if(centerprint_time[j] != -1)
                                continue;
                }
-               
+
+
                // fade the centerprint_hud in/out 
-               if (centerprint_time[j] < 0 || centerprint_expire_time[j] - autocvar_hud_panel_centerprint_fade_out > time)
+               if(centerprint_time[j] < 0)
+                       a = bound(0, (time - centerprint_expire_time[j]) / max(0.0001, autocvar_hud_panel_centerprint_fade_in), 1);
+               else if(centerprint_expire_time[j] - autocvar_hud_panel_centerprint_fade_out > time)
                        a = bound(0, (time - (centerprint_expire_time[j] - centerprint_time[j])) / max(0.0001, autocvar_hud_panel_centerprint_fade_in), 1);
-               else if (centerprint_expire_time[j] > time)
+               else if(centerprint_expire_time[j] > time)
                        a = (centerprint_expire_time[j] - time) / max(0.0001, autocvar_hud_panel_centerprint_fade_out);
                else
                        a = 0;
index 9395013f603d7fd448f759b1d443568ad393d313..a858d9f0e6e103677891b700edc54ec729333255 100644 (file)
@@ -1,6 +1,6 @@
 // ================================================
 //  Unified notification system, written by Samual
-//  Last updated: February, 2013
+//  Last updated: March, 2013
 // ================================================
 
 string Get_Notif_TypeName(float net_type)
index 95b022820df4fa6d5df8d7d55a9a8d594e7ab15b..6175b3563e663237abc9ab4982c9cf6f755d61c6 100644 (file)
@@ -1,6 +1,6 @@
 // ================================================
 //  Unified notification system, written by Samual
-//  Last updated: February, 2013
+//  Last updated: March, 2013
 // ================================================
 
 // main types/groups of notifications
index a95ff18c32a00e3c1db8515d1fc462474a72981b..1778d78bf1866beeab3c17a2fe057c61fa48d8ba 100644 (file)
@@ -2339,9 +2339,9 @@ void LeaveSpectatorMode()
                        if(self.classname == STR_PLAYER)
                                Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_JOIN_PLAY, self.netname);
 
-                       //if(!autocvar_g_campaign)
-                       //if (time < self.jointime + autocvar_welcome_message_time)
-                       //      Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD);
+                       if(!autocvar_g_campaign)
+                       if (time < self.jointime + autocvar_welcome_message_time)
+                               Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD);
 
                        if (self.prevent_join_msgtime)
                        {