]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
make CSQC support the >0.05s/<0.0005s handling of standard player physics so CSQC...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 26 Dec 2011 15:54:33 +0000 (15:54 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 26 Dec 2011 15:54:33 +0000 (15:54 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11622 d7cf8633-e32d-0410-b094-e92efae38249

cl_input.c
client.h
clvm_cmds.c

index af5289f58690c2ae48adebf1a4dba695966224b4..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,6 +1545,27 @@ 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;
@@ -1590,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");
index b5fd04fa4532801cac0483fc203fc477b2c9ae1a..45964700ce7532b71f18522874ebc86ddebe44b2 100644 (file)
--- a/client.h
+++ b/client.h
@@ -1871,7 +1871,7 @@ typedef struct cl_clientmovement_state_s
        usercmd_t cmd;
 }
 cl_clientmovement_state_t;
-void CL_ClientMovement_PlayerMove(cl_clientmovement_state_t *s);
+void CL_ClientMovement_PlayerMove_Frame(cl_clientmovement_state_t *s);
 
 // warpzone prediction hack (CSQC builtin)
 void CL_RotateMoves(const matrix4x4_t *m);
index 7975bf1e9e8c451295c6c81511123b71bb617789..a0cb94688e374d0e9e169a14687128d1d8d82220 100644 (file)
@@ -1490,7 +1490,7 @@ static void VM_CL_runplayerphysics (prvm_prog_t *prog)
        s.cmd.jump = (s.cmd.buttons & 2) != 0;
        s.cmd.crouch = (s.cmd.buttons & 16) != 0;
 
-       CL_ClientMovement_PlayerMove(&s);
+       CL_ClientMovement_PlayerMove_Frame(&s);
 
        if(ent == prog->edicts)
        {