]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
last patch by LH fixed speedhack 1.0: -20ms + 30ms = 10ms, but moves by 30ms
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 9 Oct 2007 21:35:38 +0000 (21:35 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 9 Oct 2007 21:35:38 +0000 (21:35 +0000)
this patch fixed speedhack 2.0: (cl_movement 0) -10ms + (cl_movement 1) 20ms = 20ms client physics
and now also fixes speedhack 2.0a: (cl_movement 0) -10ms + (cl_movement 1) 20ms = 10ms server physics and 10ms client physics

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7619 d7cf8633-e32d-0410-b094-e92efae38249

sv_user.c

index 5fc53adcc7e0719865043e9bfde560cf5800559d..70d3bafc10d70fca1476b2f8eed640f75aea6ba8 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -371,6 +371,8 @@ void SV_ClientThink (void)
 {
        vec3_t v_angle;
 
+       //Con_Printf("clientthink for %ims\n", (int) (sv.frametime * 1000));
+
        SV_ApplyClientMove();
        // make sure the velocity is sane (not a NaN)
        SV_CheckVelocity(host_client->edict);
@@ -628,6 +630,12 @@ void SV_ExecuteClientMoves(void)
                }
                // now copy the new move
                host_client->cmd = sv_readmoves[sv_numreadmoves-1];
+               host_client->cmd.time = max(host_client->cmd.time, sv.time);
+                       // physics will run up to sv.time, so allow no predicted moves
+                       // before that otherwise, there is a speedhack by turning
+                       // prediction on and off repeatedly on client side because the
+                       // engine would run BOTH client and server physics for the same
+                       // time
                host_client->movesequence = 0;
                // make sure that normal physics takes over immediately
                host_client->clmovement_skipphysicsframes = 0;