From 2697671a9bfd2c26d48ffe8d28cccdb4ecfb39e6 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 27 Apr 2005 12:16:15 +0000 Subject: [PATCH] make MSG_ReadDeltaUsercmd use a param rather than global to read the message. --- include/qw/msg_ucmd.h | 8 ++++---- libs/qw/msg_ucmd.c | 25 +++++++++++-------------- qtv/source/client.c | 6 +++--- qw/source/cl_ents.c | 2 +- qw/source/sv_user.c | 6 +++--- 5 files changed, 22 insertions(+), 25 deletions(-) diff --git a/include/qw/msg_ucmd.h b/include/qw/msg_ucmd.h index b5a19e4da..c05cc45d2 100644 --- a/include/qw/msg_ucmd.h +++ b/include/qw/msg_ucmd.h @@ -28,11 +28,11 @@ #ifndef __msg_ucmd_h #define __msg_ucmd_h -#include "QF/sizebuf.h" - extern struct usercmd_s nullcmd; +struct msg_s; +struct sizebuf_s; -void MSG_WriteDeltaUsercmd (sizebuf_t *sb, struct usercmd_s *from, struct usercmd_s *cmd); -void MSG_ReadDeltaUsercmd (struct usercmd_s *from, struct usercmd_s *cmd); +void MSG_WriteDeltaUsercmd (struct sizebuf_s *sb, struct usercmd_s *from, struct usercmd_s *cmd); +void MSG_ReadDeltaUsercmd (struct msg_s *msg, struct usercmd_s *from, struct usercmd_s *cmd); #endif // __msg_ucmd_h diff --git a/libs/qw/msg_ucmd.c b/libs/qw/msg_ucmd.c index 21d865c5f..fcce5cb20 100644 --- a/libs/qw/msg_ucmd.c +++ b/libs/qw/msg_ucmd.c @@ -45,11 +45,8 @@ static __attribute__ ((unused)) const char rcsid[] = #include "qw/msg_ucmd.h" #include "qw/protocol.h" -#include "netchan.h" - struct usercmd_s nullcmd; - void MSG_WriteDeltaUsercmd (sizebuf_t *buf, usercmd_t *from, usercmd_t *cmd) { @@ -97,37 +94,37 @@ MSG_WriteDeltaUsercmd (sizebuf_t *buf, usercmd_t *from, usercmd_t *cmd) } void -MSG_ReadDeltaUsercmd (usercmd_t *from, usercmd_t *move) +MSG_ReadDeltaUsercmd (qmsg_t *msg, usercmd_t *from, usercmd_t *move) { int bits; memcpy (move, from, sizeof (*move)); - bits = MSG_ReadByte (net_message); + bits = MSG_ReadByte (msg); // read current angles if (bits & CM_ANGLE1) - move->angles[0] = MSG_ReadAngle16 (net_message); + move->angles[0] = MSG_ReadAngle16 (msg); if (bits & CM_ANGLE2) - move->angles[1] = MSG_ReadAngle16 (net_message); + move->angles[1] = MSG_ReadAngle16 (msg); if (bits & CM_ANGLE3) - move->angles[2] = MSG_ReadAngle16 (net_message); + move->angles[2] = MSG_ReadAngle16 (msg); // read movement if (bits & CM_FORWARD) - move->forwardmove = MSG_ReadShort (net_message); + move->forwardmove = MSG_ReadShort (msg); if (bits & CM_SIDE) - move->sidemove = MSG_ReadShort (net_message); + move->sidemove = MSG_ReadShort (msg); if (bits & CM_UP) - move->upmove = MSG_ReadShort (net_message); + move->upmove = MSG_ReadShort (msg); // read buttons if (bits & CM_BUTTONS) - move->buttons = MSG_ReadByte (net_message); + move->buttons = MSG_ReadByte (msg); if (bits & CM_IMPULSE) - move->impulse = MSG_ReadByte (net_message); + move->impulse = MSG_ReadByte (msg); // read time to run command - move->msec = MSG_ReadByte (net_message); + move->msec = MSG_ReadByte (msg); } diff --git a/qtv/source/client.c b/qtv/source/client.c index 8fc1c406f..0ce50327d 100644 --- a/qtv/source/client.c +++ b/qtv/source/client.c @@ -254,9 +254,9 @@ client_parse_message (client_t *cl) /*checksum = (byte) */MSG_ReadByte (net_message); // read loss percentage /*cl->lossage = */MSG_ReadByte (net_message); - MSG_ReadDeltaUsercmd (&nullcmd, &oldest); - MSG_ReadDeltaUsercmd (&oldest, &oldcmd); - MSG_ReadDeltaUsercmd (&oldcmd, &newcmd); + MSG_ReadDeltaUsercmd (net_message, &nullcmd, &oldest); + MSG_ReadDeltaUsercmd (net_message, &oldest, &oldcmd); + MSG_ReadDeltaUsercmd (net_message, &oldcmd, &newcmd); #if 0 if (cl->state != cs_spawned) break; diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index e1073da31..f2229b6c0 100644 --- a/qw/source/cl_ents.c +++ b/qw/source/cl_ents.c @@ -739,7 +739,7 @@ CL_ParsePlayerinfo (void) state->state_time = parsecounttime; if (flags & PF_COMMAND) - MSG_ReadDeltaUsercmd (&nullcmd, &state->command); + MSG_ReadDeltaUsercmd (net_message, &nullcmd, &state->command); for (i = 0; i < 3; i++) { if (flags & (PF_VELOCITY1 << i)) diff --git a/qw/source/sv_user.c b/qw/source/sv_user.c index 58bd232d4..b8c26820f 100644 --- a/qw/source/sv_user.c +++ b/qw/source/sv_user.c @@ -1842,9 +1842,9 @@ SV_ExecuteClientMessage (client_t *cl) // read loss percentage cl->lossage = MSG_ReadByte (net_message); - MSG_ReadDeltaUsercmd (&nullcmd, &oldest); - MSG_ReadDeltaUsercmd (&oldest, &oldcmd); - MSG_ReadDeltaUsercmd (&oldcmd, &newcmd); + MSG_ReadDeltaUsercmd (net_message, &nullcmd, &oldest); + MSG_ReadDeltaUsercmd (net_message, &oldest, &oldcmd); + MSG_ReadDeltaUsercmd (net_message, &oldcmd, &newcmd); if (cl->state != cs_spawned) break;