]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Keep showing overlapping player tags but with low alpha 873/head
authorterencehill <piuntn@gmail.com>
Mon, 25 Jan 2021 17:36:37 +0000 (18:36 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 25 Jan 2021 17:36:37 +0000 (18:36 +0100)
_hud_common.cfg
qcsrc/client/shownames.qc
qcsrc/client/shownames.qh

index 4bcb35e746f1bd0067e95dd77332fbf53c045d0f..dad523683eb2cb5756b840a79d07875a39717f28 100644 (file)
@@ -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"
index 0bde46a15cb201c08a9c2cfdae59b88e06fd6d99..f07e66fb573c43dc35ee69f68447352d9cfe1f01 100644 (file)
@@ -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);
index 38d68fa7c2224531d7279cae6ca647fd831efd0b..e281319cf59061bc6cc4e0e8f4b12e998374e168 100644 (file)
@@ -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);