Hide player name if their alpha is below a limit
authorMario <mario.mario@y7mail.com>
Mon, 25 Nov 2013 02:25:29 +0000 (13:25 +1100)
committerMario <mario.mario@y7mail.com>
Mon, 25 Nov 2013 02:25:29 +0000 (13:25 +1100)
qcsrc/client/miscfunctions.qc
qcsrc/client/shownames.qc
qcsrc/client/shownames.qh

index 2c2fc56..48aa85f 100644 (file)
@@ -573,6 +573,21 @@ vector getplayerorigin(float pl)
        return GETPLAYERORIGIN_ERROR;
 }
 
+float getplayeralpha(float pl)
+{
+       entity e;
+
+       e = CSQCModel_server2csqc(pl + 1);
+       if(e)
+               return e.alpha;
+
+       e = entcs_receiver[pl];
+       if(e)
+               return e.alpha;
+
+       return 1;
+}
+
 float getplayerisdead(float pl)
 {
        entity e;
index c581fba..beb2a89 100644 (file)
@@ -24,6 +24,7 @@ void Draw_ShowNames(entity ent)
 
        makevectors(view_angles);
 
+       if(getplayeralpha(ent.sv_entnum-1) >= SHOWNAMES_MIN_ALPHA)
        if(ent.sameteam || (!ent.sameteam && autocvar_hud_shownames_enemies))
        {
                ent.origin_z += autocvar_hud_shownames_offset;
index adbfa57..f043d1a 100644 (file)
@@ -3,3 +3,5 @@
 .float sameteam;
 .float fadedelay;
 .float pointtime;
+
+const float SHOWNAMES_MIN_ALPHA = 0.5;