]> git.rm.cloudns.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)
committerRudolf Polzer <divverent@xonotic.org>
Sat, 14 May 2011 16:15:31 +0000 (18:15 +0200)
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
::stable-branch::merge=7d5e9ee47b468b101a0bdd121de972fdb4bca801

clvm_cmds.c

index 87ee706a4c3376e0e7547a231736b4e495ebe240..d47286a58446eafe9264934c79d4143cc8c7b68f 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);