X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=cl_input.c;h=01850effe830f6a3f26c155d0a29a1fdb188c297;hb=c47fb5c923c0e3b6c44bb068ceb44f7795834f5c;hp=6959b14f44394df66d11d557359012b13cd037b6;hpb=cfee52a1ec9db338098789cae89ae5cf1f7a6fbf;p=xonotic%2Fdarkplaces.git diff --git a/cl_input.c b/cl_input.c index 6959b14f..01850eff 100644 --- a/cl_input.c +++ b/cl_input.c @@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "csprogs.h" +#include "thread.h" /* =============================================================================== @@ -805,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] = { @@ -1473,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) @@ -1584,6 +1551,8 @@ void CL_ClientMovement_Replay(void) double totalmovemsec; cl_clientmovement_state_t s; + VectorCopy(cl.mvelocity[0], cl.movement_velocity); + if (cl.movement_predicted && !cl.movement_replay) return; @@ -1649,9 +1618,7 @@ void CL_ClientMovement_Replay(void) s.cmd = cl.movecmd[0]; } - if (cls.demoplayback) // for bob, speedometer - VectorCopy(cl.mvelocity[0], cl.movement_velocity); - else + if (!cls.demoplayback) // for bob, speedometer { cl.movement_replay = false; // update the interpolation target position and velocity @@ -1679,15 +1646,6 @@ void CL_ClientMovement_Replay(void) if (s.onground) cl.onground = true; } - - // react to onground state changes (for gun bob) - if (cl.onground) - { - if (!cl.oldonground) - cl.hitgroundtime = cl.movecmd[0].time; - cl.lastongroundtime = cl.movecmd[0].time; - } - cl.oldonground = cl.onground; } static void QW_MSG_WriteDeltaUsercmd(sizebuf_t *buf, usercmd_t *from, usercmd_t *to) @@ -1836,7 +1794,10 @@ void CL_SendMove(void) cl.cmd.msec = (unsigned char)bound(0, msecdelta, 255); // ridiculous value rejection (matches qw) if (cl.cmd.msec > 250) + { + Con_Printf("RIDICULOUS! %f - %f > 0.25 sec, namely, %d ms, quemove=%d\n", cl.cmd.time, cl.movecmd[1].time, (int) msecdelta, (int) quemove); cl.cmd.msec = 100; + } cl.cmd.frametime = cl.cmd.msec * (1.0 / 1000.0); cl.cmd.predicted = cl_movement.integer != 0;