]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/shownames.qc
Fix hud_shownames_antioverlap not ignoring spectators
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / shownames.qc
index 79acf4fb8a38386e0344b1d55e1219ec9df1261e..add8992aab64f6d74e5305f13fbbe7cd9318aa47 100644 (file)
@@ -1,9 +1,10 @@
 #include "shownames.qh"
 
-#include "hud/all.qh"
+#include "hud/_mod.qh"
 
 #include <common/ent_cs.qh>
 #include <common/constants.qh>
+#include <common/net_linked.qh>
 #include <common/mapinfo.qh>
 #include <common/teams.qh>
 
@@ -34,7 +35,7 @@ const float SHOWNAMES_FADESPEED = 4;
 const float SHOWNAMES_FADEDELAY = 0.4;
 void Draw_ShowNames(entity this)
 {
-       if (this.sv_entnum == player_localentnum)  // self or spectatee
+       if (this.sv_entnum == (current_player + 1))  // self or spectatee
                if (!(autocvar_hud_shownames_self && autocvar_chase_active)) return;
        if (!this.sameteam && !autocvar_hud_shownames_enemies) return;
        bool hit;
@@ -54,7 +55,11 @@ void Draw_ShowNames(entity this)
        if (autocvar_hud_shownames_antioverlap)
        {
                // fade tag out if another tag that is closer to you overlaps
-               LL_EACH(shownames_ent, it != this && entcs_receiver(i), {
+               entity entcs = NULL;
+               LL_EACH(shownames_ent, it != this, {
+                       entcs = entcs_receiver(i);
+                       if (!(entcs && entcs.has_sv_origin))
+                               continue;
                        vector eo = project_3d_to_2d(it.origin);
                        if (eo.z < 0 || eo.x < 0 || eo.y < 0 || eo.x > vid_conwidth || eo.y > vid_conheight) continue;
                        eo.z = 0;
@@ -177,7 +182,7 @@ void Draw_ShowNames_All()
                }
                make_impure(it);
                assert(getthink(entcs), eprint(entcs));
-               WITHSELF(entcs, getthink(entcs)());
+               getthink(entcs)(entcs);
                if (!entcs.has_origin) continue;
                if (entcs.m_entcs_private)
                {