From: divverent Date: Sat, 12 Nov 2011 19:08:03 +0000 (+0000) Subject: an attempt to do CL_runplayerphysics, not working properly yet X-Git-Tag: xonotic-v0.6.0~163^2~10 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e512a4751f4d5cc4607d9bccc368fba8ff0b1ff8;p=xonotic%2Fdarkplaces.git an attempt to do CL_runplayerphysics, not working properly yet git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11549 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_input.c b/cl_input.c index 41c93080..10675753 100644 --- a/cl_input.c +++ b/cl_input.c @@ -806,40 +806,6 @@ static void CL_UpdatePrydonCursor(void) cl.cmd.cursor_fraction = CL_SelectTraceLine(cl.cmd.cursor_start, cl.cmd.cursor_end, cl.cmd.cursor_impact, cl.cmd.cursor_normal, &cl.cmd.cursor_entitynumber, (chase_active.integer || cl.intermission) ? &cl.entities[cl.playerentity].render : NULL); } -typedef enum waterlevel_e -{ - WATERLEVEL_NONE, - WATERLEVEL_WETFEET, - WATERLEVEL_SWIMMING, - WATERLEVEL_SUBMERGED -} -waterlevel_t; - -typedef struct cl_clientmovement_state_s -{ - // position - vec3_t origin; - vec3_t velocity; - // current bounding box (different if crouched vs standing) - vec3_t mins; - vec3_t maxs; - // currently on the ground - qboolean onground; - // currently crouching - qboolean crouched; - // what kind of water (SUPERCONTENTS_LAVA for instance) - int watertype; - // how deep - waterlevel_t waterlevel; - // weird hacks when jumping out of water - // (this is in seconds and counts down to 0) - float waterjumptime; - - // user command - usercmd_t cmd; -} -cl_clientmovement_state_t; - #define NUMOFFSETS 27 static vec3_t offsets[NUMOFFSETS] = { @@ -1474,7 +1440,7 @@ static void CL_ClientMovement_Physics_Walk(cl_clientmovement_state_t *s) } } -static void CL_ClientMovement_PlayerMove(cl_clientmovement_state_t *s) +void CL_ClientMovement_PlayerMove(cl_clientmovement_state_t *s) { //Con_Printf(" %f", frametime); if (!s->cmd.jump) diff --git a/client.h b/client.h index 3ece601a..8fe40a81 100644 --- a/client.h +++ b/client.h @@ -1838,6 +1838,41 @@ r_refdef_t; extern r_refdef_t r_refdef; +typedef enum waterlevel_e +{ + WATERLEVEL_NONE, + WATERLEVEL_WETFEET, + WATERLEVEL_SWIMMING, + WATERLEVEL_SUBMERGED +} +waterlevel_t; + +typedef struct cl_clientmovement_state_s +{ + // position + vec3_t origin; + vec3_t velocity; + // current bounding box (different if crouched vs standing) + vec3_t mins; + vec3_t maxs; + // currently on the ground + qboolean onground; + // currently crouching + qboolean crouched; + // what kind of water (SUPERCONTENTS_LAVA for instance) + int watertype; + // how deep + waterlevel_t waterlevel; + // weird hacks when jumping out of water + // (this is in seconds and counts down to 0) + float waterjumptime; + + // user command + usercmd_t cmd; +} +cl_clientmovement_state_t; +void CL_ClientMovement_PlayerMove(cl_clientmovement_state_t *s); + // warpzone prediction hack (CSQC builtin) void CL_RotateMoves(const matrix4x4_t *m); diff --git a/clvm_cmds.c b/clvm_cmds.c index 8d571bfc..ed960e8e 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -1441,6 +1441,35 @@ static void VM_CL_setsensitivityscale (prvm_prog_t *prog) //#347 void() runstandardplayerphysics (EXT_CSQC) static void VM_CL_runplayerphysics (prvm_prog_t *prog) { + cl_clientmovement_state_t s; + prvm_edict_t *ent; + + VM_SAFEPARMCOUNT(1, VM_CL_runplayerphysics); + + ent = PRVM_G_EDICT(OFS_PARM0); + VectorCopy(PRVM_clientedictvector(ent, origin), s.origin); + VectorCopy(PRVM_clientedictvector(ent, velocity), s.velocity); + VectorCopy(PRVM_clientglobalvector(pmove_mins), s.mins); + VectorCopy(PRVM_clientglobalvector(pmove_maxs), s.maxs); + s.onground = 0; // ??? + s.crouched = 0; // ??? + s.watertype = 0; // ??? + s.waterlevel = 0; // ??? + s.waterjumptime = 0; // ??? + VectorCopy(PRVM_clientglobalvector(input_angles), s.cmd.viewangles); + s.cmd.forwardmove = PRVM_clientglobalvector(input_movevalues)[0]; + s.cmd.sidemove = PRVM_clientglobalvector(input_movevalues)[1]; + s.cmd.upmove = PRVM_clientglobalvector(input_movevalues)[2]; + s.cmd.buttons = PRVM_clientglobalfloat(input_buttons); + s.cmd.frametime = PRVM_clientglobalfloat(input_timelength); + s.cmd.canjump = 1; // ??? + s.cmd.jump = (s.cmd.buttons & 2) != 0; + s.cmd.crouch = (s.cmd.buttons & 16) != 0; + + CL_ClientMovement_PlayerMove(&s); + + VectorCopy(s.origin, PRVM_clientedictvector(ent, origin)); + VectorCopy(s.velocity, PRVM_clientedictvector(ent, velocity)); } //#348 string(float playernum, string keyname) getplayerkeyvalue (EXT_CSQC)