From: Samual Lenks Date: Sun, 3 Mar 2013 08:29:31 +0000 (-0500) Subject: Fix infinite lifetime centerprints X-Git-Tag: xonotic-v0.7.0~62^2~23^2~29 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c835373b4523fc731df99fdb81575c2cac8ce3a1;p=xonotic%2Fxonotic-data.pk3dir.git Fix infinite lifetime centerprints --- diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 244ba8926..0c162a757 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -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; diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 9395013f6..a858d9f0e 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -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) diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index 95b022820..6175b3563 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -1,6 +1,6 @@ // ================================================ // Unified notification system, written by Samual -// Last updated: February, 2013 +// Last updated: March, 2013 // ================================================ // main types/groups of notifications diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index a95ff18c3..1778d78bf 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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) {