From: havoc Date: Fri, 25 Aug 2006 12:27:02 +0000 (+0000) Subject: fix the jittery gun bug related to onground changing rapidly X-Git-Tag: xonotic-v0.1.0preview~3821 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=36d6d22cf4ec9a2c62efd63e9848b750cd6b7215 fix the jittery gun bug related to onground changing rapidly git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6565 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_input.c b/cl_input.c index 900f1cea..577d8373 100644 --- a/cl_input.c +++ b/cl_input.c @@ -559,7 +559,7 @@ void CL_UpdatePrydonCursor(void) VectorScale(scale, 1000000, scale); // calculate current view matrix - V_CalcRefdef(); + //V_CalcRefdef(); VectorClear(temp); Matrix4x4_Transform(&r_view.matrix, temp, cl.cmd.cursor_start); VectorSet(temp, cl.cmd.cursor_screen[2] * scale[2], cl.cmd.cursor_screen[0] * scale[0], cl.cmd.cursor_screen[1] * scale[1]); @@ -1176,9 +1176,9 @@ void CL_ClientMovement_Replay(void) // get the first movement queue entry to know whether to crouch and such s.q = cl.movement_queue[0]; } + // store replay location CL_ClientMovement_UpdateStatus(&s); - cl.onground = s.onground; cl.movement_time[1] = cl.movement_time[0]; cl.movement_time[0] = cl.movement_queue[cl.movement_numqueue-1].time; VectorCopy(cl.movement_origin, cl.movement_oldorigin); @@ -1186,6 +1186,27 @@ void CL_ClientMovement_Replay(void) VectorCopy(s.velocity, cl.movement_velocity); //VectorCopy(s.origin, cl.entities[cl.playerentity].state_current.origin); //VectorSet(cl.entities[cl.playerentity].state_current.angles, 0, cl.viewangles[1], 0); + + // update the onground flag if appropriate + // when not predicted, cl.onground is only cleared by cl_parse.c, but can + // be set forcefully here to hide server inconsistencies in the onground + // flag (such as when stepping up stairs, the onground flag tends to turn + // off briefly due to precision errors, particularly at high framerates), + // such inconsistencies can mess up the gun bobbing and stair smoothing, + // so they must be avoided. + if (cl.movement_predicted) + cl.onground = s.onground; + else if (s.onground) + cl.onground = true; + + // react to onground state changes (for gun bob) + if (cl.onground) + { + if (!cl.oldonground) + cl.hitgroundtime = cl.time; + cl.lastongroundtime = cl.time; + } + cl.oldonground = cl.onground; } void QW_MSG_WriteDeltaUsercmd(sizebuf_t *buf, qw_usercmd_t *from, qw_usercmd_t *to) diff --git a/cl_parse.c b/cl_parse.c index a8d6fb6c..40288c09 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -1369,7 +1369,6 @@ void CL_ParseClientdata (void) cl.stats[STAT_ITEMS] = MSG_ReadLong (); cl.onground = (bits & SU_ONGROUND) != 0; - csqc_onground = cl.onground; //[515]: cause without this csqc will receive not right value on svc_print =/ cl.inwater = (bits & SU_INWATER) != 0; if (cls.protocol == PROTOCOL_DARKPLACES5) @@ -2200,6 +2199,7 @@ void CL_ParseServerMessage(void) cl.mtime[1] = cl.mtime[0]; cl.mtime[0] = realtime; // qw has no clock cl.movement_needupdate = true; + cl.onground = false; // since there's no clientdata parsing, clear the onground flag here // if true the cl.viewangles are interpolated from cl.mviewangles[] // during this frame // (makes spectating players much smoother and prevents mouse movement from turning)