]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix "wrong ping times" issue once and for all (I don't see another fix that wouldn...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 13 Apr 2008 14:17:10 +0000 (14:17 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 13 Apr 2008 14:17:10 +0000 (14:17 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8255 d7cf8633-e32d-0410-b094-e92efae38249

client.h
sv_user.c

index 0401a27735690b0307e95c0aae219ef4600b95c9..7a96a47568d3e0680ac33850506bde601ae2b319 100644 (file)
--- a/client.h
+++ b/client.h
@@ -355,8 +355,9 @@ typedef struct usercmd_s
        vec_t   cursor_fraction;
        int             cursor_entitynumber;
 
-       double time;
-       double receivetime;
+       double time; // time the move is executed for (cl_movement: clienttime, non-cl_movement: receivetime)
+       double receivetime; // time the move was received at
+       double clienttime; // time to which server state the move corresponds to
        int msec; // for predicted moves
        int buttons;
        int impulse;
index 0bc1090fb2d25e0306179ac5792e27fad755dfe6..525cf97b2008de05b3992927fed7d2377baa4dfa 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -461,7 +461,7 @@ void SV_ReadClientMove (void)
        // read ping time
        if (sv.protocol != PROTOCOL_QUAKE && sv.protocol != PROTOCOL_QUAKEDP && sv.protocol != PROTOCOL_NEHAHRAMOVIE && sv.protocol != PROTOCOL_NEHAHRABJP && sv.protocol != PROTOCOL_NEHAHRABJP2 && sv.protocol != PROTOCOL_NEHAHRABJP3 && sv.protocol != PROTOCOL_DARKPLACES1 && sv.protocol != PROTOCOL_DARKPLACES2 && sv.protocol != PROTOCOL_DARKPLACES3 && sv.protocol != PROTOCOL_DARKPLACES4 && sv.protocol != PROTOCOL_DARKPLACES5 && sv.protocol != PROTOCOL_DARKPLACES6)
                move->sequence = MSG_ReadLong ();
-       move->time = MSG_ReadFloat ();
+       move->time = move->clienttime = MSG_ReadFloat ();
        if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
        move->receivetime = (float)sv.time;
 
@@ -645,9 +645,9 @@ void SV_ExecuteClientMoves(void)
        }
 
        // calculate average ping time
-       host_client->ping = host_client->cmd.receivetime - host_client->cmd.time;
+       host_client->ping = host_client->cmd.receivetime - host_client->cmd.clienttime;
 #ifdef NUM_PING_TIMES
-       host_client->ping_times[host_client->num_pings % NUM_PING_TIMES] = host_client->cmd.receivetime - host_client->cmd.time;
+       host_client->ping_times[host_client->num_pings % NUM_PING_TIMES] = host_client->cmd.receivetime - host_client->cmd.clienttime;
        host_client->num_pings++;
        for (i=0, total = 0;i < NUM_PING_TIMES;i++)
                total += host_client->ping_times[i];