From: terencehill Date: Sat, 17 Feb 2024 16:24:35 +0000 (+0100) Subject: HUD hit indicator: fade from 0.8 to 0.4 alpha instead of 0 (values are customizable) X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fmerge-requests%2F1262%2Fhead;p=xonotic%2Fxonotic-data.pk3dir.git HUD hit indicator: fade from 0.8 to 0.4 alpha instead of 0 (values are customizable) --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 0736ca4ec..43ff3e2a1 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -828,8 +828,10 @@ void HitIndicatorShow() ofs = -ofs; } org = scr_center + ofs; - float alpha = bound(0, autocvar_cl_hit_indicator_fade_alpha, 1); - alpha *= 1 - (time - HitIndicator_time[i]) / HitIndicator_fade_time; + float alpha_max = bound(0.1, autocvar_cl_hit_indicator_fade_alpha_max, 1); + float alpha_min = bound(0, autocvar_cl_hit_indicator_fade_alpha_min, alpha_max); + float alpha = alpha_min; + alpha += (alpha_max - alpha_min) * (1 - (time - HitIndicator_time[i]) / HitIndicator_fade_time); float size = autocvar_cl_hit_indicator_size; size = map_bound_ranges(HitIndicator_damage[i], 30, 90, size, size * 2); org = drawspritearrow(org, ang, autocvar_cl_hit_indicator_color, alpha, size, true); diff --git a/qcsrc/client/view.qh b/qcsrc/client/view.qh index d8312146c..d15130360 100644 --- a/qcsrc/client/view.qh +++ b/qcsrc/client/view.qh @@ -96,7 +96,8 @@ vector autocvar_cl_gunoffset; bool autocvar_cl_hit_indicator = 1; vector autocvar_cl_hit_indicator_color = '1 0 0'; -float autocvar_cl_hit_indicator_fade_alpha = 0.8; +float autocvar_cl_hit_indicator_fade_alpha_max = 0.8; +float autocvar_cl_hit_indicator_fade_alpha_min = 0.4; float autocvar_cl_hit_indicator_fade_time = 1.5; float autocvar_cl_hit_indicator_radius = 0.15; float autocvar_cl_hit_indicator_size = 1.1; diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 22c38fed1..4e6358399 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -204,7 +204,8 @@ seta cl_voice_directional_taunt_attenuation 0.5 "this defines the distance from seta cl_hit_indicator 1 "show a 2d directional indicator around the screen center when a player hits you" seta cl_hit_indicator_color "1 0 0" "hit indicator color" seta cl_hit_indicator_fade_time 1.5 "how long hit indicator takes to fade away in seconds (max 2 seconds)" -seta cl_hit_indicator_fade_alpha 0.8 "initial hit indicator alpha" +seta cl_hit_indicator_fade_alpha_max 0.8 "initial hit indicator alpha" +seta cl_hit_indicator_fade_alpha_min 0.4 "final hit indicator alpha" seta cl_hit_indicator_radius 0.15 "show the directional indicator at this percentage of the screen from the center" seta cl_hit_indicator_size 1.1 "hit indicator size" seta cl_hit_indicator_text 0 "show damage text together with the hit indicator"