From: terencehill Date: Mon, 25 Jan 2021 17:36:37 +0000 (+0100) Subject: Keep showing overlapping player tags but with low alpha X-Git-Tag: xonotic-v0.8.5~559^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1a9850f08ef611dd6b0a0b58ff8d40d7523e0d4b;p=xonotic%2Fxonotic-data.pk3dir.git Keep showing overlapping player tags but with low alpha --- diff --git a/_hud_common.cfg b/_hud_common.cfg index 4bcb35e74..dad523683 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -252,4 +252,5 @@ seta hud_shownames_resize 1 "enable resizing of the names, then the size cvars w seta hud_shownames_mindistance 1000 "start fading alpha/size at this distance" seta hud_shownames_maxdistance 5000 "alpha/size is 0 at this distance" seta hud_shownames_antioverlap 1 "if two tags overlap, fade out the one further away from you" +seta hud_shownames_antioverlap_minalpha 0.4 "fade out overlapping tags to this alpha value" seta hud_shownames_offset 52 "offset (along z-axis) tag from player origin by this many units" diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index 0bde46a15..f07e66fb5 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -108,10 +108,18 @@ void Draw_ShowNames(entity this) this.alpha = max(0, this.alpha - SHOWNAMES_FADESPEED * frametime); this.fadedelay = 0; // reset fade in delay, enemy has left the view } - else if (OFF_SCREEN(o) || overlap > 0) // out of view or tag overlap detected, fade out + else if (OFF_SCREEN(o)) // out of view, fade out { this.alpha = max(0, this.alpha - SHOWNAMES_FADESPEED * frametime); } + else if (overlap > 0) // tag overlap detected, fade out + { + float minalpha = autocvar_hud_shownames_antioverlap_minalpha; + if (this.alpha >= minalpha) + this.alpha = max(minalpha, this.alpha - SHOWNAMES_FADESPEED * frametime); + else + this.alpha = min(minalpha, this.alpha + SHOWNAMES_FADESPEED * frametime); + } else if (this.sameteam) // fade in for team mates { this.alpha = min(1, this.alpha + SHOWNAMES_FADESPEED * frametime); diff --git a/qcsrc/client/shownames.qh b/qcsrc/client/shownames.qh index 38d68fa7c..e281319cf 100644 --- a/qcsrc/client/shownames.qh +++ b/qcsrc/client/shownames.qh @@ -17,6 +17,7 @@ bool autocvar_hud_shownames_resize; float autocvar_hud_shownames_mindistance; float autocvar_hud_shownames_maxdistance; bool autocvar_hud_shownames_antioverlap; +float autocvar_hud_shownames_antioverlap_minalpha = 0.4; float autocvar_hud_shownames_offset; entityclass(ShowNames);