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] =
{
}
}
-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)
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);
//#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)