]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
A temporary hack for GAME_XONOTIC only
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 14 May 2011 16:16:08 +0000 (16:16 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 14 May 2011 16:16:08 +0000 (16:16 +0000)
this commit adds getplayerkey(..., "TEMPHACK_origin") to get a networked
player's origin from csqc; it returns the empty string if the extension is not
supported, or the player is not known to the engine at the moment

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11150 d7cf8633-e32d-0410-b094-e92efae38249

clvm_cmds.c

index 937c21b7df2559ac3478bb6c871aef6e46c2df2e..580eabf21f8b19ff3136b9646c1e3215498ce05f 100644 (file)
@@ -1414,6 +1414,20 @@ static void VM_CL_getplayerkey (void)
        else
                if(!strcasecmp(c, "viewentity"))
                        dpsnprintf(t, sizeof(t), "%i", i+1);
+       else
+               if(gamemode == GAME_XONOTIC && !strcasecmp(c, "TEMPHACK_origin"))
+               {
+                       // PLEASE REMOVE THIS once deltalisten() of EXT_CSQC_1
+                       // is implemented, or Xonotic uses CSQC-networked
+                       // players, whichever comes first
+                       entity_t *e = cl.entities + (i+1);
+                       if(e->state_current.active)
+                       {
+                               vec3_t origin;
+                               Matrix4x4_OriginFromMatrix(&e->render.matrix, origin);
+                               dpsnprintf(t, sizeof(t), "%.9g %.9g %.9g", origin[0], origin[1], origin[2]);
+                       }
+               }
        if(!t[0])
                return;
        PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(t);