X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=sv_user.c;h=5f8bf86a02d65be8e0d1fbdda6d3b97849859265;hb=8367a30715017e7a497f6baf65dbaff5f72d6cf3;hp=377472cca6ae087329465a767c8a9efa8fcd3538;hpb=05441557527d65d14e141fbf7ae50c9bf11ae486;p=xonotic%2Fdarkplaces.git diff --git a/sv_user.c b/sv_user.c index 377472cc..5f8bf86a 100644 --- a/sv_user.c +++ b/sv_user.c @@ -465,7 +465,7 @@ static void SV_ReadClientMove (void) move->receivetime = (float)sv.time; #if DEBUGMOVES - Con_Printf("%s move%i #%i %ims (%ims) %i %i '%i %i %i' '%i %i %i'\n", move->time > move->receivetime ? "^3read future" : "^4read normal", sv_numreadmoves + 1, move->sequence, (int)floor((move->time - host_client->cmd.time) * 1000.0 + 0.5), (int)floor(move->time * 1000.0 + 0.5), move->impulse, move->buttons, (int)move->viewangles[0], (int)move->viewangles[1], (int)move->viewangles[2], (int)move->forwardmove, (int)move->sidemove, (int)move->upmove); + Con_Printf("%s move%i #%u %ims (%ims) %i %i '%i %i %i' '%i %i %i'\n", move->time > move->receivetime ? "^3read future" : "^4read normal", sv_numreadmoves + 1, move->sequence, (int)floor((move->time - host_client->cmd.time) * 1000.0 + 0.5), (int)floor(move->time * 1000.0 + 0.5), move->impulse, move->buttons, (int)move->viewangles[0], (int)move->viewangles[1], (int)move->viewangles[2], (int)move->forwardmove, (int)move->sidemove, (int)move->upmove); #endif // limit reported time to current time // (incase the client is trying to cheat) @@ -551,9 +551,13 @@ static void SV_ReadClientMove (void) if(host_client->movement_highestsequence_seen) { // mark moves in between as lost - if(move->sequence - host_client->movement_highestsequence_seen - 1 < NETGRAPH_PACKETS) - for(i = host_client->movement_highestsequence_seen + 1; i < move->sequence; ++i) - host_client->movement_count[i % NETGRAPH_PACKETS] = -1; + unsigned int delta = move->sequence - host_client->movement_highestsequence_seen - 1; + if(delta < NETGRAPH_PACKETS) + { + unsigned int u; + for(u = 0; u < delta; ++u) + host_client->movement_count[(host_client->movement_highestsequence_seen + 1 + u) % NETGRAPH_PACKETS] = -1; + } else memset(host_client->movement_count, -1, sizeof(host_client->movement_count)); } @@ -608,7 +612,7 @@ static void SV_ExecuteClientMoves(void) if (host_client->movesequence < move->sequence || moveindex == sv_numreadmoves - 1) { #if DEBUGMOVES - Con_Printf("%smove #%i %ims (%ims) %i %i '%i %i %i' '%i %i %i'\n", (move->time - host_client->cmd.time) > sv.frametime * 1.01 ? "^1" : "^2", move->sequence, (int)floor((move->time - host_client->cmd.time) * 1000.0 + 0.5), (int)floor(move->time * 1000.0 + 0.5), move->impulse, move->buttons, (int)move->viewangles[0], (int)move->viewangles[1], (int)move->viewangles[2], (int)move->forwardmove, (int)move->sidemove, (int)move->upmove); + Con_Printf("%smove #%u %ims (%ims) %i %i '%i %i %i' '%i %i %i'\n", (move->time - host_client->cmd.time) > sv.frametime * 1.01 ? "^1" : "^2", move->sequence, (int)floor((move->time - host_client->cmd.time) * 1000.0 + 0.5), (int)floor(move->time * 1000.0 + 0.5), move->impulse, move->buttons, (int)move->viewangles[0], (int)move->viewangles[1], (int)move->viewangles[2], (int)move->forwardmove, (int)move->sidemove, (int)move->upmove); #endif // this is a new move move->time = bound(sv.time - 1, move->time, sv.time); // prevent slowhack/speedhack combos @@ -764,13 +768,18 @@ void SV_ApplyClientMove (void) PRVM_serveredictfloat(host_client->edict, ping_movementloss) = movementloss / (float) NETGRAPH_PACKETS; } -static void SV_FrameLost(int framenum) +static qboolean SV_FrameLost(int framenum) { if (host_client->entitydatabase5) { - EntityFrame5_LostFrame(host_client->entitydatabase5, framenum); - EntityFrameCSQC_LostFrame(host_client, framenum); + if (framenum <= host_client->entitydatabase5->latestframenum) + { + EntityFrame5_LostFrame(host_client->entitydatabase5, framenum); + EntityFrameCSQC_LostFrame(host_client, framenum); + return true; + } } + return false; } static void SV_FrameAck(int framenum) @@ -878,7 +887,7 @@ void SV_ReadClientMessage(void) clc_stringcmd_invalid: Con_Printf("Received invalid stringcmd from %s\n", host_client->name); if(developer.integer > 0) - Com_HexDumpToConsole((unsigned char *) s, strlen(s)); + Com_HexDumpToConsole((unsigned char *) s, (int)strlen(s)); break; case clc_disconnect: @@ -954,7 +963,8 @@ clc_stringcmd_invalid: { int i; for (i = host_client->latestframenum + 1;i < num;i++) - SV_FrameLost(i); + if (!SV_FrameLost(i)) + break; SV_FrameAck(num); host_client->latestframenum = num; }