]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix player not being able to move bug introduced by recent input accumulation code
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 20 Feb 2006 04:07:22 +0000 (04:07 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 20 Feb 2006 04:07:22 +0000 (04:07 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5997 d7cf8633-e32d-0410-b094-e92efae38249

client.h
sv_user.c

index 262c2ec2aed5b2d45e2cd3e697a78c0a6a4a76a0..412afbdb5a0c5ada199f8a094784c8927ee48c8b 100644 (file)
--- a/client.h
+++ b/client.h
@@ -355,6 +355,7 @@ typedef struct usercmd_s
        int buttons;
        int impulse;
        int sequence;
+       qboolean applied; // if false we're still accumulating a move
 } usercmd_t;
 
 typedef struct lightstyle_s
index 606d79aa20d8e55a36ae3ce9e65f1f1bf50edb64..2c148e852d87e1c2d0d538c3c612a420a522de6d 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -610,6 +610,10 @@ qboolean SV_ReadClientMove (void)
 
        oldmovetime = move->time;
 
+       // if this move has been applied, clear it, and start accumulating new data
+       if (move->applied)
+               memset(move, 0, sizeof(*move));
+
        if (msg_badread) Con_Printf("SV_ReadClientMessage: badread at %s:%i\n", __FILE__, __LINE__);
 
        // read ping time
@@ -712,7 +716,6 @@ qboolean SV_ReadClientMove (void)
 
 void SV_ApplyClientMove (void)
 {
-       double movetime;
 #ifdef NUM_PING_TIMES
        int i;
        float total;
@@ -720,9 +723,11 @@ void SV_ApplyClientMove (void)
        prvm_eval_t *val;
        usercmd_t *move = &host_client->cmd;
 
-       if (!move->receivetime)
+       if (!move->receivetime || move->applied)
                return;
 
+       move->applied = true;
+
        // calculate average ping time
        host_client->ping = move->receivetime - move->time;
 #ifdef NUM_PING_TIMES
@@ -762,11 +767,6 @@ void SV_ApplyClientMove (void)
        if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_cursor_trace_endpos))) VectorCopy(move->cursor_impact, val->vector);
        if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_cursor_trace_ent))) val->edict = PRVM_EDICT_TO_PROG(PRVM_EDICT_NUM(move->cursor_entitynumber));
        if ((val = PRVM_GETEDICTFIELDVALUE(host_client->edict, eval_ping))) val->_float = host_client->ping * 1000.0;
-
-       // don't clear move->time as it is used for applying cl_movement 1 moves
-       movetime = move->time;
-       memset(move, 0, sizeof(*move));
-       move->time = movetime;
 }
 
 void SV_FrameLost(int framenum)