an attempt to do CL_runplayerphysics, not working properly yet
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 12 Nov 2011 19:08:03 +0000 (19:08 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 12 Nov 2011 19:08:03 +0000 (19:08 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11549 d7cf8633-e32d-0410-b094-e92efae38249

cl_input.c
client.h
clvm_cmds.c

index 41c9308..1067575 100644 (file)
@@ -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)
index 3ece601..8fe40a8 100644 (file)
--- 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);
 
index 8d571bf..ed960e8 100644 (file)
@@ -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)