From 5c4aff8ab535f28dbf8064768950918439eeac41 Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 14 May 2011 16:16:08 +0000 Subject: [PATCH] A temporary hack for GAME_XONOTIC only 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 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/clvm_cmds.c b/clvm_cmds.c index 87ee706a..d47286a5 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -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); -- 2.39.2