seta hud_contents_water_color "0.4 0.3 0.3" "color blend when inside water"
seta hud_shownames 1 "draw names and health/armor of nearby players"
-seta hud_shownames_enemies 2 "1 = draw names of enemies you point at (TODO), 2 = draw names of all enemies in view"
+seta hud_shownames_enemies 1 "show tags for enemies as well"
+seta hud_shownames_crosshairdistance 0 "if set, only draw tags which came within this distance of your crosshair (25 recommended)"
+seta hud_shownames_crosshairdistance_time 5 "how many seconds the tag is still visible after pointing at them"
+seta hud_shownames_crosshairdistance_antioverlap 0 "allow antioverlap to work as normal even with crosshairdistance on"
seta hud_shownames_self 0 "also include your own name to be shown when third person camera mode is on (chase_active/cl_eventchase)"
seta hud_shownames_status 1 "1 = draw health/armor status of teammates"
seta hud_shownames_statusbar_height 4 "height of status bar"
seta hud_shownames_mindistance 1000 "start fading alpha/size at this distance"
seta hud_shownames_maxdistance 5000 "alpha/size is 0 at this distance"
seta hud_shownames_antioverlap 1 "if two tags get too close to each other, fade out the one further away from you"
-seta hud_shownames_antioverlap_distance 100 "2d distance to other tag after which to fade out"
+seta hud_shownames_antioverlap_distance 50 "2d distance to other tag after which to fade out"
seta hud_shownames_offset 52 "offset (along z-axis) tag from player origin by this many units"
\ No newline at end of file
float autocvar_hud_showbinds_limit;
float autocvar_hud_shownames;
float autocvar_hud_shownames_enemies;
+float autocvar_hud_shownames_crosshairdistance;
+float autocvar_hud_shownames_crosshairdistance_time;
+float autocvar_hud_shownames_crosshairdistance_antioverlap;
float autocvar_hud_shownames_self;
float autocvar_hud_shownames_status;
float autocvar_hud_shownames_statusbar_height;
// self.armorvalue
// 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
//
const float SHOWNAMES_FADESPEED = 4;
-const float SHOWNAMES_FADEDELAY = 0.5;
+const float SHOWNAMES_FADEDELAY = 0.4;
void Draw_ShowNames(entity ent)
{
if(!autocvar_hud_shownames)
if(ent.sameteam || (!ent.sameteam && autocvar_hud_shownames_enemies))
{
ent.origin_z += autocvar_hud_shownames_offset;
-
+
float hit;
- if(ent.sameteam)
+ if(ent.sameteam && !autocvar_hud_shownames_crosshairdistance)
{
hit = 1;
}
hit = 1;
}
+ // handle tag fading
+ float overlap, onscreen, crosshairdistance;
vector o, eo;
+
o = project_3d_to_2d(ent.origin);
- float overlap, onscreen;
-
+
if(autocvar_hud_shownames_antioverlap)
{
// fade tag out if another tag that is closer to you overlaps
}
onscreen = (o_z >= 0 && o_x >= 0 && o_y >= 0 && o_x <= vid_conwidth && o_y <= vid_conheight);
+ crosshairdistance = sqrt( pow(o_x - vid_conwidth/2, 2) + pow(o_y - vid_conheight/2, 2) );
+
+ if(autocvar_hud_shownames_crosshairdistance)
+ {
+ if(autocvar_hud_shownames_crosshairdistance > crosshairdistance)
+ ent.pointtime = time;
+
+ if not(ent.pointtime + autocvar_hud_shownames_crosshairdistance_time > time)
+ overlap = TRUE;
+ else
+ overlap = (autocvar_hud_shownames_crosshairdistance_antioverlap ? overlap : FALSE); // override what antioverlap says unless allowed by cvar.
+ }
if(!ent.fadedelay)
ent.fadedelay = time + SHOWNAMES_FADEDELAY;
.float armorvalue;
.float sameteam;
.float fadedelay;
-
+.float pointtime;