]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix the jittery gun bug related to onground changing rapidly
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 25 Aug 2006 12:27:02 +0000 (12:27 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 25 Aug 2006 12:27:02 +0000 (12:27 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6565 d7cf8633-e32d-0410-b094-e92efae38249

cl_input.c
cl_parse.c

index 900f1cea63a62bc392f375c4f4adaa7be99cbc98..577d837389c850b2e5e72b6401d398b38a3a5eef 100644 (file)
@@ -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)
index a8d6fb6cadd40b1358974e42a02cfedc50074c5b..40288c0919215a295d852bb1c57d30e8a98a0674 100644 (file)
@@ -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)