mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 12:31:10 +00:00
make MSG_ReadDeltaUsercmd use a param rather than global to read the
message.
This commit is contained in:
parent
9dcd2333d9
commit
2697671a9b
5 changed files with 22 additions and 25 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue