// 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)
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;
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);
e.origin = getplayerorigin(i);
if(e.origin == GETPLAYERORIGIN_ERROR)
continue;
+
+ e.csqcmodel_isdead = getplayerisdead(i);
Draw_ShowNames(e);
}