]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Multiply shownames alpha by player alpha
authorSamual Lenks <samual@xonotic.org>
Sun, 29 Dec 2013 09:14:32 +0000 (04:14 -0500)
committerSamual Lenks <samual@xonotic.org>
Sun, 29 Dec 2013 09:14:32 +0000 (04:14 -0500)
qcsrc/client/shownames.qc

index c035da1b2e31a40361c669099d5f8183b9876511..413eaaf54714170958e354c59a6d5cf39c1bdffb 100644 (file)
@@ -9,7 +9,6 @@
 
 const float SHOWNAMES_FADESPEED = 4;
 const float SHOWNAMES_FADEDELAY = 0.4;
-const float SHOWNAMES_MIN_ALPHA = 0.5;
 void Draw_ShowNames(entity ent)
 {
        if(!autocvar_hud_shownames)
@@ -25,7 +24,6 @@ void Draw_ShowNames(entity ent)
 
        makevectors(view_angles);
 
-       if(ent.sameteam || (getplayeralpha(ent.sv_entnum-1) >= SHOWNAMES_MIN_ALPHA))
        if(ent.sameteam || (!ent.sameteam && autocvar_hud_shownames_enemies))
        {
                ent.origin_z += autocvar_hud_shownames_offset;
@@ -102,7 +100,11 @@ void Draw_ShowNames(entity ent)
                else if(time > ent.fadedelay) // fade in for enemies
                        ent.alpha = min(1, ent.alpha + SHOWNAMES_FADESPEED * frametime);
 
-               if(!ent.alpha)
+               // multiply by player alpha
+               if(!ent.sameteam || (ent.sv_entnum == player_localentnum))
+                       ent.alpha *= getplayeralpha(ent.sv_entnum-1);
+
+               if(ent.alpha < ALPHA_MIN_VISIBLE)
                        return;
 
                float dist;