From da22c67eb84ab5c92914b797b0cc8b7d68e4fa4c Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 13 Aug 2016 19:14:11 +0200 Subject: [PATCH] Fix centerprint messages not shown for an instant when they are forced to expire (e.g. MOTD) --- qcsrc/client/hud/panel/centerprint.qc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index e2e82acff..118f9bde6 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -57,8 +57,7 @@ void centerprint_generic(int new_id, string strMessage, float duration, int coun { // fade out the current msg (duration and countdown_num are ignored) centerprint_time[j] = min(5, autocvar_hud_panel_centerprint_fade_out); - if (centerprint_expire_time[j] > time + min(5, autocvar_hud_panel_centerprint_fade_out) || centerprint_expire_time[j] < time) - centerprint_expire_time[j] = time + min(5, autocvar_hud_panel_centerprint_fade_out); + centerprint_expire_time[j] = -1; // don't use the variable time here! return; } break; // found a msg with the same id, at position j @@ -80,14 +79,14 @@ void centerprint_generic(int new_id, string strMessage, float duration, int coun if (duration < 0) { centerprint_time[j] = -1; - centerprint_expire_time[j] = time; + centerprint_expire_time[j] = -1; // don't use the variable time here! } else { if(duration == 0) duration = max(1, autocvar_hud_panel_centerprint_time); centerprint_time[j] = duration; - centerprint_expire_time[j] = time + duration; + centerprint_expire_time[j] = -1; // don't use the variable time here! } centerprint_countdown_num[j] = countdown_num; } @@ -228,6 +227,13 @@ void HUD_CenterPrint () { if (j == CENTERPRINT_MAX_MSGS) j = 0; + if (centerprint_expire_time[j] == -1) + { + // here we are sure the time variable is not altered by CSQC_Ent_Update + centerprint_expire_time[j] = time; + if (centerprint_time[j] > 0) + centerprint_expire_time[j] += centerprint_time[j]; + } if (centerprint_expire_time[j] <= time) { if (centerprint_countdown_num[j] && centerprint_time[j] > 0) -- 2.39.2