]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_input.c
add TODO markers, possibly for WIP3 version of V_CalcRefdef extension
[xonotic/darkplaces.git] / cl_input.c
index 1067575304129ae07c3f532e8249c338dfb69227..51a5f8dd701630509a2c7f4f2e95edbc9b2a8b99 100644 (file)
@@ -1440,7 +1440,7 @@ static void CL_ClientMovement_Physics_Walk(cl_clientmovement_state_t *s)
        }
 }
 
-void CL_ClientMovement_PlayerMove(cl_clientmovement_state_t *s)
+static void CL_ClientMovement_PlayerMove(cl_clientmovement_state_t *s)
 {
        //Con_Printf(" %f", frametime);
        if (!s->cmd.jump)
@@ -1545,12 +1545,35 @@ void CL_UpdateMoveVars(void)
                cl.movevars_aircontrol_power = 2; // CPMA default
 }
 
+void CL_ClientMovement_PlayerMove_Frame(cl_clientmovement_state_t *s)
+{
+       // if a move is more than 50ms, do it as two moves (matching qwsv)
+       //Con_Printf("%i ", s.cmd.msec);
+       if(s->cmd.frametime > 0.0005)
+       {
+               if (s->cmd.frametime > 0.05)
+               {
+                       s->cmd.frametime /= 2;
+                       CL_ClientMovement_PlayerMove(s);
+               }
+               CL_ClientMovement_PlayerMove(s);
+       }
+       else
+       {
+               // we REALLY need this handling to happen, even if the move is not executed
+               if (!s->cmd.jump)
+                       s->cmd.canjump = true;
+       }
+}
+
 void CL_ClientMovement_Replay(void)
 {
        int i;
        double totalmovemsec;
        cl_clientmovement_state_t s;
 
+       VectorCopy(cl.mvelocity[0], cl.movement_velocity);
+
        if (cl.movement_predicted && !cl.movement_replay)
                return;
 
@@ -1588,23 +1611,8 @@ void CL_ClientMovement_Replay(void)
                        if (i < CL_MAX_USERCMDS - 1)
                                s.cmd.canjump = cl.movecmd[i+1].canjump;
 
-                       // if a move is more than 50ms, do it as two moves (matching qwsv)
-                       //Con_Printf("%i ", s.cmd.msec);
-                       if(s.cmd.frametime > 0.0005)
-                       {
-                               if (s.cmd.frametime > 0.05)
-                               {
-                                       s.cmd.frametime /= 2;
-                                       CL_ClientMovement_PlayerMove(&s);
-                               }
-                               CL_ClientMovement_PlayerMove(&s);
-                       }
-                       else
-                       {
-                               // we REALLY need this handling to happen, even if the move is not executed
-                               if (!s.cmd.jump)
-                                       s.cmd.canjump = true;
-                       }
+                       CL_ClientMovement_PlayerMove_Frame(&s);
+
                        cl.movecmd[i].canjump = s.cmd.canjump;
                }
                //Con_Printf("\n");
@@ -1616,9 +1624,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
@@ -1646,15 +1652,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)