From db56583b0bc19ed5e998b0c37e24931a7a7032f1 Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 20 Feb 2006 04:07:22 +0000 Subject: [PATCH] fix player not being able to move bug introduced by recent input accumulation code git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5997 d7cf8633-e32d-0410-b094-e92efae38249 --- client.h | 1 + sv_user.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client.h b/client.h index 262c2ec2..412afbdb 100644 --- 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 diff --git a/sv_user.c b/sv_user.c index 606d79aa..2c148e85 100644 --- 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) -- 2.39.2