]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote branch 'origin/master' into samual/shownames_fixes
authorSamual <samual@xonotic.org>
Tue, 30 Aug 2011 08:52:17 +0000 (04:52 -0400)
committerSamual <samual@xonotic.org>
Tue, 30 Aug 2011 08:52:17 +0000 (04:52 -0400)
defaultXonotic.cfg
qcsrc/client/autocvars.qh
qcsrc/client/shownames.qc
qcsrc/client/shownames.qh
qcsrc/server/ent_cs.qc

index e9d5b285bd05c74d083b9128b7d7b04d95d844e1..56aa6d39acb461fff67d93baf42bedb20afed807 100644 (file)
@@ -1525,6 +1525,7 @@ seta hud_contents_water_color "0.4 0.3 0.3"
 
 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_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_aspect 8 "aspect ratio of total drawing area per name"
index 2f2b80cc5971eb4ab07dc93f33e2edbf8515fdb7..bf425fc477921897eefd7cb7bfeaabb02d7feed8 100644 (file)
@@ -310,6 +310,7 @@ float autocvar_hud_showbinds;
 float autocvar_hud_showbinds_limit;
 float autocvar_hud_shownames;
 float autocvar_hud_shownames_enemies;
+float autocvar_hud_shownames_self;
 float autocvar_hud_shownames_status;
 float autocvar_hud_shownames_statusbar_height;
 float autocvar_hud_shownames_aspect;
index e3c6f3d4bda4575b2ee531d8e251c8d3953039fc..b13f6122c268cdaaa1b4cd18a0783ff70387d82d 100644 (file)
@@ -3,15 +3,18 @@
 // self.healthvalue
 // 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
 //
 const float SHOWNAMES_FADESPEED = 4;
+const float SHOWNAMES_FADEDELAY = 0.5;
 void Draw_ShowNames(entity ent)
 {
        if(!autocvar_hud_shownames)
                return;
-
-       if(ent.sv_entnum == player_localentnum && !autocvar_chase_active)
-               return;
+       
+       if((ent.sv_entnum == player_localentnum) || (ent.sv_entnum == spectatee_status)) // ent is me or person i'm spectating
+               if not (autocvar_hud_shownames_self && autocvar_chase_active) 
+                       return;
 
        makevectors(view_angles);
 
@@ -59,19 +62,27 @@ void Draw_ShowNames(entity ent)
                }
 
                onscreen = (o_z >= 0 && o_x >= 0 && o_y >= 0 && o_x <= vid_conwidth && o_y <= vid_conheight);
+               
+               if(!ent.fadedelay)
+                       ent.fadedelay = time + SHOWNAMES_FADEDELAY;
 
                if(!ent.sameteam && (!onscreen || !hit)) // out of view, fade out
-                       ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime);
+               { 
+                       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
-                       ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * 0.25 * frametime);
+                       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);
-               else // fade in
+                       ent.alpha = max(0, ent.alpha - SHOWNAMES_FADESPEED * frametime); 
+               else if(ent.sameteam) // fade in for team mates
+                       ent.alpha = min(1, ent.alpha + SHOWNAMES_FADESPEED * frametime);
+               else if(time > ent.fadedelay) // fade in for enemies
                        ent.alpha = min(1, ent.alpha + SHOWNAMES_FADESPEED * frametime);
 
                if(!ent.alpha)
                        return;
-
+               
                float dist;
                dist = vlen(ent.origin - view_origin);
 
index 50380e8209531ce2552bd974dbff5e43ac4d8916..d30f1acce3801f0d4b948465fcb518286ac317a7 100644 (file)
@@ -1,4 +1,5 @@
 .float healthvalue;
 .float armorvalue;
 .float sameteam;
+.float fadedelay;
 
index 9c4bf59758770d4fc6f90f6abcf3560a21e27081..f127fb26e83e7a4471b7f6dfe09faaacf648becd 100644 (file)
@@ -30,7 +30,7 @@ float entcs_customize()
                return FALSE;
        if(other == o)
                return FALSE;
-       if(other.classname == "player")
+       if((other.classname == "player") || other.caplayer)
                if(!teamplay || o.team != other.team)
                        if not (radar_showennemies)
                                return FALSE;