]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_user.c
stop predicting movement when no server packets have been received for
[xonotic/darkplaces.git] / sv_user.c
index ec6f7a18c14d1c375e129fdaec6a362ade5fd7bb..4ea1916196efa9c4cd04b4b69ad9d5025e385940 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -392,7 +392,7 @@ void SV_ClientThink (void)
        if (host_client->edict->fields.server->movetype == MOVETYPE_NONE)
                return;
 
-       onground = (int)host_client->edict->fields.server->flags & FL_ONGROUND;
+       onground = ((int)host_client->edict->fields.server->flags & FL_ONGROUND) != 0;
 
        DropPunchAngle ();
 
@@ -586,6 +586,13 @@ void SV_ExecuteClientMoves(void)
                                move->time = bound(sv.time - 1, move->time, sv.time); // prevent slowhack/speedhack combos
                                move->time = max(move->time, host_client->cmd.time); // prevent backstepping of time
                                moveframetime = bound(0, move->time - host_client->cmd.time, min(0.1, sv_clmovement_inputtimeout.value));
+
+                               // discard (treat like lost) moves with too low distance from
+                               // the previous one to prevent hacks using float inaccuracy
+                               // clients will see this as packet loss in the netgraph
+                               if(moveframetime < 0.0005)
+                                       continue;
+
                                //Con_Printf("movesequence = %i (%i lost), moveframetime = %f\n", move->sequence, move->sequence ? move->sequence - host_client->movesequence - 1 : 0, moveframetime);
                                host_client->cmd = *move;
                                host_client->movesequence = move->sequence;