From: terencehill Date: Mon, 7 Mar 2022 14:29:28 +0000 (+0100) Subject: Fade in centerprint messages that last less than 2 seconds (with default setting... X-Git-Tag: xonotic-v0.8.5~169 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5d9cd673687cab5884807f299861b501885c2bae;p=xonotic%2Fxonotic-data.pk3dir.git Fade in centerprint messages that last less than 2 seconds (with default setting only countdown messages last less than 2 seconds) --- diff --git a/_hud_common.cfg b/_hud_common.cfg index 82e5b579a..83eb2490d 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -120,6 +120,7 @@ seta hud_panel_infomessages_group_fadetime 0.4 "group message fade in/out time" seta hud_panel_centerprint_time 3 "message duration (NOTE: certain messages have a fixed duration)" seta hud_panel_centerprint_fade_in 0.15 "how long a message takes to fade in" +seta hud_panel_centerprint_fade_in_short 0 " "how long a message that lasts 2 or less seconds takes to fade in" seta hud_panel_centerprint_fade_out 0.15 "how long a message takes to fade out (this time is included in the message duration and can't be > 5)" seta hud_panel_centerprint_fade_subsequent 1 "enable extra fading effects for each additional message, so that the more messages you have the more they become faded out" seta hud_panel_centerprint_fade_subsequent_passone 3 "division factor for the first pass for alpha fading, with 2 all messages after the first have half alpha" diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index 105908094..07a752a8e 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -274,11 +274,15 @@ void HUD_CenterPrint() all_messages_expired = false; + float fade_in_time = autocvar_hud_panel_centerprint_fade_in; + if (centerprint_time[j] <= 2) + fade_in_time = autocvar_hud_panel_centerprint_fade_in_short; + // fade if(centerprint_time[j] < 0) // Expired but forced. Expire time is the fade-in time. - a = (time - centerprint_expire_time[j]) / max(0.0001, autocvar_hud_panel_centerprint_fade_in); + a = (time - centerprint_expire_time[j]) / max(0.0001, fade_in_time); else if(centerprint_expire_time[j] - autocvar_hud_panel_centerprint_fade_out > time) // Regularily printed. Not fading out yet. - a = (time - (centerprint_expire_time[j] - centerprint_time[j])) / max(0.0001, autocvar_hud_panel_centerprint_fade_in); + a = (time - (centerprint_expire_time[j] - centerprint_time[j])) / max(0.0001, fade_in_time); else // Expiring soon, so fade it out. a = (centerprint_expire_time[j] - time) / max(0.0001, autocvar_hud_panel_centerprint_fade_out); diff --git a/qcsrc/client/hud/panel/centerprint.qh b/qcsrc/client/hud/panel/centerprint.qh index a143fa0a2..a3646f4d1 100644 --- a/qcsrc/client/hud/panel/centerprint.qh +++ b/qcsrc/client/hud/panel/centerprint.qh @@ -4,6 +4,7 @@ bool autocvar_hud_panel_centerprint; float autocvar_hud_panel_centerprint_align; float autocvar_hud_panel_centerprint_fade_in = 0.15; +float autocvar_hud_panel_centerprint_fade_in_short = 0; float autocvar_hud_panel_centerprint_fade_out = 0.15; float autocvar_hud_panel_centerprint_fade_subsequent = 1; float autocvar_hud_panel_centerprint_fade_subsequent_passone = 3;