]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
support csqcplayers in crosshair hit test
authorRudolf Polzer <divverent@alientrap.org>
Sat, 18 Feb 2012 16:48:21 +0000 (17:48 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 18 Feb 2012 16:48:21 +0000 (17:48 +0100)
qcsrc/client/View.qc
qcsrc/client/shownames.qc

index f1112b33aa47fbb574dea670058a1ef191dca75c..2cdc9f17eb69a272c8c6eb82838d539841f3bb73 100644 (file)
@@ -220,14 +220,18 @@ void TrueAim_Init()
 
 float EnemyHitCheck()
 {
-       float t;
+       float t, n;
        wcross_origin = project_3d_to_2d(trace_endpos);
        wcross_origin_z = 0;
-       if(trace_networkentity < 1)
+       if(trace_ent)
+               n = trace_ent.entnum;
+       else
+               n = trace_networkentity;
+       if(n < 1)
                return SHOTTYPE_HITWORLD;
-       if(trace_networkentity > maxclients)
+       if(n > maxclients)
                return SHOTTYPE_HITWORLD;
-       t = GetPlayerColor(trace_networkentity - 1);
+       t = GetPlayerColor(n - 1);
        if(teamplay)
                if(t == myteam)
                        return SHOTTYPE_HITTEAM;
index c2bff62c89172c3a0a203a801694182235b1da0a..5309c555e6085050b6a37b36509cf010964c2deb 100644 (file)
@@ -36,7 +36,7 @@ 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;