]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/shownames.qc
Merge branch 'master' into Mario/mutator_minstagib
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / shownames.qc
index 21e8bcd420799ac3688e938abcefcc780cf67fd4..31a6cb5e8719f1e5f520f885dae46cd66db88330 100644 (file)
@@ -5,7 +5,8 @@
 // self.sameteam = player is on same team as local client
 // self.fadedelay = time to wait before name tag starts fading in for enemies
 // self.pointtime = last time you pointed at this player
-//
+// self.csqcmodel_isdead = value of csqcmodel_isdead to know when the player is dead or not
+
 const float SHOWNAMES_FADESPEED = 4;
 const float SHOWNAMES_FADEDELAY = 0.4;
 void Draw_ShowNames(entity ent)
@@ -13,7 +14,11 @@ void Draw_ShowNames(entity ent)
        if(!autocvar_hud_shownames)
                return;
        
+#ifdef COMPAT_XON050_ENGINE
        if((ent.sv_entnum == player_localentnum) || (ent.sv_entnum == spectatee_status)) // ent is me or person i'm spectating
+#else
+       if(ent.sv_entnum == player_localentnum) // ent is me or person i'm spectating
+#endif
                if not (autocvar_hud_shownames_self && autocvar_chase_active) 
                        return;
 
@@ -31,14 +36,14 @@ void Draw_ShowNames(entity ent)
                else
                {
                        traceline(view_origin, ent.origin, MOVE_NORMAL, ent);
-                       if(trace_fraction < 1 && trace_networkentity != ent.sv_entnum)
+                       if(trace_fraction < 1 && (trace_networkentity != ent.sv_entnum && trace_ent.entnum != ent.sv_entnum))
                                hit = 0;
                        else
                                hit = 1;
                }
 
                // handle tag fading
-               float overlap, onscreen, crosshairdistance;
+               float overlap = FALSE, onscreen, crosshairdistance;
                vector o, eo;
                
                o = project_3d_to_2d(ent.origin);
@@ -86,7 +91,7 @@ void Draw_ShowNames(entity ent)
                        ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime); 
                        ent.fadedelay = 0; // reset fade in delay, enemy has left the view
                }
-               else if(ent.healthvalue < 1) // dead player, fade out slowly
+               else if(ent.csqcmodel_isdead) // dead player, fade out slowly
                        ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * 0.25 * frametime); 
                else if(overlap) // tag overlap detected, fade out
                        ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime); 
@@ -213,6 +218,8 @@ void Draw_ShowNames_All()
                e.origin = getplayerorigin(i);
                if(e.origin == GETPLAYERORIGIN_ERROR)
                        continue;
+                       
+               e.csqcmodel_isdead = getplayerisdead(i);
 
                Draw_ShowNames(e);
        }