]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
add a getplayerorigin() function that finds any player's origin if the system knows it
authorRudolf Polzer <divverent@xonotic.org>
Sat, 14 May 2011 18:06:49 +0000 (20:06 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Sat, 14 May 2011 18:06:49 +0000 (20:06 +0200)
qcsrc/client/Main.qc
qcsrc/client/main.qh
qcsrc/client/miscfunctions.qc

index 03cbd528a2cf3cbf983ef500bc57edcaf3addee3..f03c2b33d0bd8f87d0a3fbe8708bd124764039db 100644 (file)
@@ -665,6 +665,7 @@ void Ent_ReadEntCS()
        self.origin_z = ReadShort();
        self.angles_y = ReadByte() * 360.0 / 256;
        self.origin_z = self.angles_x = self.angles_z = 0;
+       entcs_receiver[self.sv_entnum] = self;
 
        InterpolateOrigin_Note();
 }
index aacd41589aae6de1dbdd65a6704f733c6d246e9e..af849e18c57c92dce1d1580b3342962b5b23403d 100644 (file)
@@ -162,3 +162,5 @@ float g_balance_grenadelauncher_bouncestop;
 float g_balance_electro_secondary_bouncefactor;
 float g_balance_electro_secondary_bouncestop;
 float g_trueaim_minrange;
+
+entity entcs_receiver[255]; // 255 is the engine limit on maxclients
index 247dc4b35a64dedc2c7de722420154e9084df48e..fdaaf7da6d5ef03c5ee2aaf1918f80f24ba1fb82 100644 (file)
@@ -754,3 +754,15 @@ void DrawCircleClippedPic(vector centre, float radius, string pic, float f, vect
                R_EndPolygon();
        }
 }
+
+const vector GETPLAYERORIGIN_ERROR = '1123581321 2357111317 3141592653'; // way out of bounds for anything on the map
+vector getplayerorigin(float pl)
+{
+       string s;
+       s = getplayerkey(pl, "TEMPHACK_origin");
+       if(s != "")
+               return stov(s);
+       if(entcs_receiver[pl].classname == "entcs_receiver")
+               return entcs_receiver[pl].origin;
+       return GETPLAYERORIGIN_ERROR;
+}