mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-07 01:42:04 +00:00
looks like utils is more or less complete for now, except for some fixes in
nq for abyss etc (ie, the magical -<mod> args). The interface to the message subsystem got a revamp and all the mods to the .c files reflect this. currently a little ugly, but I plan on abstracting msg further to clean it up and make it more oo.
This commit is contained in:
parent
b4cbb49ca0
commit
2bfeed6820
46 changed files with 1066 additions and 1557 deletions
|
@ -30,8 +30,6 @@
|
|||
|
||||
#include "sizebuf.h"
|
||||
|
||||
extern struct usercmd_s nullcmd;
|
||||
|
||||
void MSG_WriteChar (sizebuf_t *sb, int c);
|
||||
void MSG_WriteByte (sizebuf_t *sb, int c);
|
||||
void MSG_WriteShort (sizebuf_t *sb, int c);
|
||||
|
@ -41,24 +39,25 @@ void MSG_WriteString (sizebuf_t *sb, char *s);
|
|||
void MSG_WriteCoord (sizebuf_t *sb, float f);
|
||||
void MSG_WriteAngle (sizebuf_t *sb, float f);
|
||||
void MSG_WriteAngle16 (sizebuf_t *sb, float f);
|
||||
void MSG_WriteDeltaUsercmd (sizebuf_t *sb, struct usercmd_s *from, struct usercmd_s *cmd);
|
||||
|
||||
extern int msg_readcount;
|
||||
extern qboolean msg_badread; // set if a read goes beyond end of message
|
||||
typedef struct msg_s {
|
||||
int readcount;
|
||||
qboolean badread; // set if a read goes beyond end of message
|
||||
sizebuf_t *message;
|
||||
} msg_t;
|
||||
|
||||
void MSG_BeginReading (void);
|
||||
int MSG_GetReadCount(void);
|
||||
int MSG_ReadChar (void);
|
||||
int MSG_ReadByte (void);
|
||||
int MSG_ReadShort (void);
|
||||
int MSG_ReadLong (void);
|
||||
float MSG_ReadFloat (void);
|
||||
char *MSG_ReadString (void);
|
||||
char *MSG_ReadStringLine (void);
|
||||
void MSG_BeginReading (msg_t *msg);
|
||||
int MSG_GetReadCount(msg_t *msg);
|
||||
int MSG_ReadChar (msg_t *msg);
|
||||
int MSG_ReadByte (msg_t *msg);
|
||||
int MSG_ReadShort (msg_t *msg);
|
||||
int MSG_ReadLong (msg_t *msg);
|
||||
float MSG_ReadFloat (msg_t *msg);
|
||||
char *MSG_ReadString (msg_t *msg);
|
||||
char *MSG_ReadStringLine (msg_t *msg);
|
||||
|
||||
float MSG_ReadCoord (void);
|
||||
float MSG_ReadAngle (void);
|
||||
float MSG_ReadAngle16 (void);
|
||||
void MSG_ReadDeltaUsercmd (struct usercmd_s *from, struct usercmd_s *cmd);
|
||||
float MSG_ReadCoord (msg_t *msg);
|
||||
float MSG_ReadAngle (msg_t *msg);
|
||||
float MSG_ReadAngle16 (msg_t *msg);
|
||||
|
||||
#endif
|
1
libs/.gitignore
vendored
1
libs/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
.vimrc
|
||||
Makefile.in
|
||||
Makefile
|
||||
|
|
1
libs/util/.gitignore
vendored
1
libs/util/.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
.vimrc
|
||||
Makefile.in
|
||||
Makefile
|
||||
.deps
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
noinst_LIBRARIES = libqfutil.a
|
||||
|
||||
libqfutil_a_SOURCES = checksum.c cmd.c crc.c cvar.c hash.c mdfour.c qfplist.c sizebuf.c va.c zone.c
|
||||
libqfutil_a_SOURCES = checksum.c cmd.c crc.c cvar.c hash.c info.c link.c mdfour.c msg.c qargs.c qendian.c qfplist.c sizebuf.c va.c zone.c
|
||||
|
||||
all-local: ../libqfutil.a
|
||||
|
||||
|
|
315
libs/util/msg.c
Normal file
315
libs/util/msg.c
Normal file
|
@ -0,0 +1,315 @@
|
|||
/*
|
||||
msg.c
|
||||
|
||||
(description)
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "msg.h"
|
||||
#include "qendian.h"
|
||||
#include "sys.h"
|
||||
|
||||
/*
|
||||
MESSAGE IO FUNCTIONS
|
||||
|
||||
Handles byte ordering and avoids alignment errors
|
||||
*/
|
||||
|
||||
//
|
||||
// writing functions
|
||||
//
|
||||
|
||||
void
|
||||
MSG_WriteChar (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
#ifdef PARANOID
|
||||
if (c < -128 || c > 127)
|
||||
Sys_Error ("MSG_WriteChar: range error");
|
||||
#endif
|
||||
|
||||
buf = SZ_GetSpace (sb, 1);
|
||||
buf[0] = c;
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteByte (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
#ifdef PARANOID
|
||||
if (c < 0 || c > 255)
|
||||
Sys_Error ("MSG_WriteByte: range error");
|
||||
#endif
|
||||
|
||||
buf = SZ_GetSpace (sb, 1);
|
||||
buf[0] = c;
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteShort (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
#ifdef PARANOID
|
||||
if (c < ((short) 0x8000) || c > (short) 0x7fff)
|
||||
Sys_Error ("MSG_WriteShort: range error");
|
||||
#endif
|
||||
|
||||
buf = SZ_GetSpace (sb, 2);
|
||||
buf[0] = c & 0xff;
|
||||
buf[1] = c >> 8;
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteLong (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
buf = SZ_GetSpace (sb, 4);
|
||||
buf[0] = c & 0xff;
|
||||
buf[1] = (c >> 8) & 0xff;
|
||||
buf[2] = (c >> 16) & 0xff;
|
||||
buf[3] = c >> 24;
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteFloat (sizebuf_t *sb, float f)
|
||||
{
|
||||
union {
|
||||
float f;
|
||||
int l;
|
||||
} dat;
|
||||
|
||||
|
||||
dat.f = f;
|
||||
dat.l = LittleLong (dat.l);
|
||||
|
||||
SZ_Write (sb, &dat.l, 4);
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteString (sizebuf_t *sb, char *s)
|
||||
{
|
||||
if (!s)
|
||||
SZ_Write (sb, "", 1);
|
||||
else
|
||||
SZ_Write (sb, s, strlen (s) + 1);
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteCoord (sizebuf_t *sb, float f)
|
||||
{
|
||||
MSG_WriteShort (sb, (int) (f * 8));
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteAngle (sizebuf_t *sb, float f)
|
||||
{
|
||||
MSG_WriteByte (sb, (int) (f * 256 / 360) & 255);
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteAngle16 (sizebuf_t *sb, float f)
|
||||
{
|
||||
MSG_WriteShort (sb, (int) (f * 65536 / 360) & 65535);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// reading functions
|
||||
//
|
||||
|
||||
void
|
||||
MSG_BeginReading (msg_t *msg)
|
||||
{
|
||||
msg->readcount = 0;
|
||||
msg->badread = false;
|
||||
}
|
||||
|
||||
int
|
||||
MSG_GetReadCount (msg_t *msg)
|
||||
{
|
||||
return msg->readcount;
|
||||
}
|
||||
|
||||
// returns -1 and sets msg->badread if no more characters are available
|
||||
int
|
||||
MSG_ReadChar (msg_t *msg)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (msg->readcount + 1 > msg->message->cursize) {
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = (signed char) msg->message->data[msg->readcount];
|
||||
msg->readcount++;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int
|
||||
MSG_ReadByte (msg_t *msg)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (msg->readcount + 1 > msg->message->cursize) {
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = (unsigned char) msg->message->data[msg->readcount];
|
||||
msg->readcount++;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int
|
||||
MSG_ReadShort (msg_t *msg)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (msg->readcount + 2 > msg->message->cursize) {
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = (short) (msg->message->data[msg->readcount]
|
||||
+ (msg->message->data[msg->readcount + 1] << 8));
|
||||
|
||||
msg->readcount += 2;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int
|
||||
MSG_ReadLong (msg_t *msg)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (msg->readcount + 4 > msg->message->cursize) {
|
||||
msg->badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = msg->message->data[msg->readcount]
|
||||
+ (msg->message->data[msg->readcount + 1] << 8)
|
||||
+ (msg->message->data[msg->readcount + 2] << 16)
|
||||
+ (msg->message->data[msg->readcount + 3] << 24);
|
||||
|
||||
msg->readcount += 4;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float
|
||||
MSG_ReadFloat (msg_t *msg)
|
||||
{
|
||||
union {
|
||||
byte b[4];
|
||||
float f;
|
||||
int l;
|
||||
} dat;
|
||||
|
||||
dat.b[0] = msg->message->data[msg->readcount];
|
||||
dat.b[1] = msg->message->data[msg->readcount + 1];
|
||||
dat.b[2] = msg->message->data[msg->readcount + 2];
|
||||
dat.b[3] = msg->message->data[msg->readcount + 3];
|
||||
msg->readcount += 4;
|
||||
|
||||
dat.l = LittleLong (dat.l);
|
||||
|
||||
return dat.f;
|
||||
}
|
||||
|
||||
char *
|
||||
MSG_ReadString (msg_t *msg)
|
||||
{
|
||||
static char string[2048];
|
||||
int l, c;
|
||||
|
||||
l = 0;
|
||||
do {
|
||||
c = MSG_ReadChar (msg);
|
||||
if (c == -1 || c == 0)
|
||||
break;
|
||||
string[l] = c;
|
||||
l++;
|
||||
} while (l < sizeof (string) - 1);
|
||||
|
||||
string[l] = 0;
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
char *
|
||||
MSG_ReadStringLine (msg_t *msg)
|
||||
{
|
||||
static char string[2048];
|
||||
int l, c;
|
||||
|
||||
l = 0;
|
||||
do {
|
||||
c = MSG_ReadChar (msg);
|
||||
if (c == -1 || c == 0 || c == '\n')
|
||||
break;
|
||||
string[l] = c;
|
||||
l++;
|
||||
} while (l < sizeof (string) - 1);
|
||||
|
||||
string[l] = 0;
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
float
|
||||
MSG_ReadCoord (msg_t *msg)
|
||||
{
|
||||
return MSG_ReadShort (msg) * (1.0 / 8);
|
||||
}
|
||||
|
||||
float
|
||||
MSG_ReadAngle (msg_t *msg)
|
||||
{
|
||||
return MSG_ReadChar (msg) * (360.0 / 256);
|
||||
}
|
||||
|
||||
float
|
||||
MSG_ReadAngle16 (msg_t *msg)
|
||||
{
|
||||
return MSG_ReadShort (msg) * (360.0 / 65536);
|
||||
}
|
|
@ -43,16 +43,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "client.h"
|
||||
#include "commdef.h"
|
||||
#include "console.h"
|
||||
#include "cmd.h"
|
||||
#include "crc.h"
|
||||
#include "qtypes.h"
|
||||
#include "sys.h"
|
||||
|
||||
usercmd_t nullcmd; // guarenteed to be zero
|
||||
|
||||
static char **largv;
|
||||
static char *argvdummy = " ";
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
info.h
|
||||
|
||||
(server|local)info definitions and prototypes
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef _INFO_H
|
||||
#define _INFO_H
|
||||
|
||||
#define MAX_INFO_STRING 512
|
||||
#define MAX_SERVERINFO_STRING 512
|
||||
#define MAX_LOCALINFO_STRING 32768
|
||||
|
||||
char *Info_ValueForKey (char *s, char *key);
|
||||
void Info_RemoveKey (char *s, char *key);
|
||||
void Info_RemovePrefixedKeys (char *start, char prefix);
|
||||
void Info_SetValueForKey (char *s, char *key, char *value, int maxsize);
|
||||
void Info_SetValueForStarKey (char *s, char *key, char *value, int maxsize);
|
||||
void Info_Print (char *s);
|
||||
|
||||
#endif // _INFO_H
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
msg.h
|
||||
|
||||
(description)
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
#ifndef _MSG_H
|
||||
#define _MSG_H
|
||||
|
||||
#include "sizebuf.h"
|
||||
|
||||
extern struct usercmd_s nullcmd;
|
||||
|
||||
void MSG_WriteChar (sizebuf_t *sb, int c);
|
||||
void MSG_WriteByte (sizebuf_t *sb, int c);
|
||||
void MSG_WriteShort (sizebuf_t *sb, int c);
|
||||
void MSG_WriteLong (sizebuf_t *sb, int c);
|
||||
void MSG_WriteFloat (sizebuf_t *sb, float f);
|
||||
void MSG_WriteString (sizebuf_t *sb, char *s);
|
||||
void MSG_WriteCoord (sizebuf_t *sb, float f);
|
||||
void MSG_WriteAngle (sizebuf_t *sb, float f);
|
||||
void MSG_WriteAngle16 (sizebuf_t *sb, float f);
|
||||
void MSG_WriteDeltaUsercmd (sizebuf_t *sb, struct usercmd_s *from, struct usercmd_s *cmd);
|
||||
|
||||
extern int msg_readcount;
|
||||
extern qboolean msg_badread; // set if a read goes beyond end of message
|
||||
|
||||
void MSG_BeginReading (void);
|
||||
int MSG_GetReadCount(void);
|
||||
int MSG_ReadChar (void);
|
||||
int MSG_ReadByte (void);
|
||||
int MSG_ReadShort (void);
|
||||
int MSG_ReadLong (void);
|
||||
float MSG_ReadFloat (void);
|
||||
char *MSG_ReadString (void);
|
||||
char *MSG_ReadStringLine (void);
|
||||
|
||||
float MSG_ReadCoord (void);
|
||||
float MSG_ReadAngle (void);
|
||||
float MSG_ReadAngle16 (void);
|
||||
void MSG_ReadDeltaUsercmd (struct usercmd_s *from, struct usercmd_s *cmd);
|
||||
|
||||
#endif
|
|
@ -277,7 +277,7 @@ qboolean IsID(struct qsockaddr *addr);
|
|||
//============================================================================
|
||||
|
||||
extern double net_time;
|
||||
extern sizebuf_t net_message;
|
||||
extern struct msg_s *net_message;
|
||||
extern int net_activeconnections;
|
||||
|
||||
void NET_Init (void);
|
||||
|
|
|
@ -51,8 +51,8 @@ common_ASM= sys_ia32.S worlda.S $(math_ASM)
|
|||
|
||||
common_SOURCES= mathlib.c wad.c world.c \
|
||||
model.c model_alias.c model_brush.c model_sprite.c \
|
||||
msg.c qendian.c qargs.c quakefs.c \
|
||||
quakeio.c link.c com.c \
|
||||
quakefs.c \
|
||||
quakeio.c com.c \
|
||||
$(common_ASM)
|
||||
|
||||
#
|
||||
|
|
|
@ -90,14 +90,14 @@ void CL_WriteDemoMessage (void)
|
|||
int i;
|
||||
float f;
|
||||
|
||||
len = LittleLong (net_message.cursize);
|
||||
len = LittleLong (net_message->message->cursize);
|
||||
Qwrite (cls.demofile, &len, 4);
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
f = LittleFloat (cl.viewangles[i]);
|
||||
Qwrite (cls.demofile, &f, 4);
|
||||
}
|
||||
Qwrite (cls.demofile, net_message.data, net_message.cursize);
|
||||
Qwrite (cls.demofile, net_message->message->data, net_message->message->cursize);
|
||||
Qflush (cls.demofile);
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ int CL_GetMessage (void)
|
|||
}
|
||||
|
||||
// get the next message
|
||||
Qread (cls.demofile, &net_message.cursize, 4);
|
||||
Qread (cls.demofile, &net_message->message->cursize, 4);
|
||||
VectorCopy (cl.mviewangles[0], cl.mviewangles[1]);
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
|
@ -143,11 +143,11 @@ int CL_GetMessage (void)
|
|||
cl.mviewangles[0][i] = LittleFloat (f);
|
||||
}
|
||||
|
||||
net_message.cursize = LittleLong (net_message.cursize);
|
||||
if (net_message.cursize > MAX_MSGLEN)
|
||||
net_message->message->cursize = LittleLong (net_message->message->cursize);
|
||||
if (net_message->message->cursize > MAX_MSGLEN)
|
||||
Sys_Error ("Demo message > MAX_MSGLEN");
|
||||
r = Qread (cls.demofile, net_message.data, net_message.cursize);
|
||||
if (r != net_message.cursize)
|
||||
r = Qread (cls.demofile, net_message->message->data, net_message->message->cursize);
|
||||
if (r != net_message->message->cursize)
|
||||
{
|
||||
CL_StopPlayback ();
|
||||
return 0;
|
||||
|
@ -164,7 +164,7 @@ int CL_GetMessage (void)
|
|||
return r;
|
||||
|
||||
// discard nop keepalive message
|
||||
if (net_message.cursize == 1 && net_message.data[0] == svc_nop)
|
||||
if (net_message->message->cursize == 1 && net_message->message->data[0] == svc_nop)
|
||||
Con_Printf ("<-- server to client keepalive\n");
|
||||
else
|
||||
break;
|
||||
|
@ -196,8 +196,8 @@ void CL_Stop_f (void)
|
|||
}
|
||||
|
||||
// write a disconnect message to the demo file
|
||||
SZ_Clear (&net_message);
|
||||
MSG_WriteByte (&net_message, svc_disconnect);
|
||||
SZ_Clear (net_message->message);
|
||||
MSG_WriteByte (net_message->message, svc_disconnect);
|
||||
CL_WriteDemoMessage ();
|
||||
|
||||
// finish up
|
||||
|
|
|
@ -132,20 +132,20 @@ void CL_ParseStartSoundPacket(void)
|
|||
float attenuation;
|
||||
int i;
|
||||
|
||||
field_mask = MSG_ReadByte();
|
||||
field_mask = MSG_ReadByte(net_message);
|
||||
|
||||
if (field_mask & SND_VOLUME)
|
||||
volume = MSG_ReadByte ();
|
||||
volume = MSG_ReadByte (net_message);
|
||||
else
|
||||
volume = DEFAULT_SOUND_PACKET_VOLUME;
|
||||
|
||||
if (field_mask & SND_ATTENUATION)
|
||||
attenuation = MSG_ReadByte () / 64.0;
|
||||
attenuation = MSG_ReadByte (net_message) / 64.0;
|
||||
else
|
||||
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
|
||||
|
||||
channel = MSG_ReadShort ();
|
||||
sound_num = MSG_ReadByte ();
|
||||
channel = MSG_ReadShort (net_message);
|
||||
sound_num = MSG_ReadByte (net_message);
|
||||
|
||||
ent = channel >> 3;
|
||||
channel &= 7;
|
||||
|
@ -154,7 +154,7 @@ void CL_ParseStartSoundPacket(void)
|
|||
Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent);
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
pos[i] = MSG_ReadCoord ();
|
||||
pos[i] = MSG_ReadCoord (net_message);
|
||||
|
||||
S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation);
|
||||
}
|
||||
|
@ -181,8 +181,8 @@ void CL_KeepaliveMessage (void)
|
|||
return;
|
||||
|
||||
// read messages from server, should just be nops
|
||||
old = net_message;
|
||||
memcpy (olddata, net_message.data, net_message.cursize);
|
||||
old = *net_message->message;
|
||||
memcpy (olddata, net_message->message->data, net_message->message->cursize);
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -197,14 +197,14 @@ void CL_KeepaliveMessage (void)
|
|||
Host_Error ("CL_KeepaliveMessage: received a message");
|
||||
break;
|
||||
case 2:
|
||||
if (MSG_ReadByte() != svc_nop)
|
||||
if (MSG_ReadByte(net_message) != svc_nop)
|
||||
Host_Error ("CL_KeepaliveMessage: datagram wasn't a nop");
|
||||
break;
|
||||
}
|
||||
} while (ret);
|
||||
|
||||
net_message = old;
|
||||
memcpy (net_message.data, olddata, net_message.cursize);
|
||||
*net_message->message = old;
|
||||
memcpy (net_message->message->data, olddata, net_message->message->cursize);
|
||||
|
||||
// check time
|
||||
time = Sys_DoubleTime ();
|
||||
|
@ -240,7 +240,7 @@ void CL_ParseServerInfo (void)
|
|||
CL_ClearState ();
|
||||
|
||||
// parse protocol version number
|
||||
i = MSG_ReadLong ();
|
||||
i = MSG_ReadLong (net_message);
|
||||
if (i != PROTOCOL_VERSION)
|
||||
{
|
||||
Con_Printf ("Server returned version %i, not %i", i, PROTOCOL_VERSION);
|
||||
|
@ -248,7 +248,7 @@ void CL_ParseServerInfo (void)
|
|||
}
|
||||
|
||||
// parse maxclients
|
||||
cl.maxclients = MSG_ReadByte ();
|
||||
cl.maxclients = MSG_ReadByte (net_message);
|
||||
if (cl.maxclients < 1 || cl.maxclients > MAX_SCOREBOARD)
|
||||
{
|
||||
Con_Printf("Bad maxclients (%u) from server\n", cl.maxclients);
|
||||
|
@ -257,10 +257,10 @@ void CL_ParseServerInfo (void)
|
|||
cl.scores = Hunk_AllocName (cl.maxclients*sizeof(*cl.scores), "scores");
|
||||
|
||||
// parse gametype
|
||||
cl.gametype = MSG_ReadByte ();
|
||||
cl.gametype = MSG_ReadByte (net_message);
|
||||
|
||||
// parse signon message
|
||||
str = MSG_ReadString ();
|
||||
str = MSG_ReadString (net_message);
|
||||
strncpy (cl.levelname, str, sizeof(cl.levelname)-1);
|
||||
|
||||
// seperate the printfs so the server message can have a color
|
||||
|
@ -277,7 +277,7 @@ void CL_ParseServerInfo (void)
|
|||
memset (cl.model_precache, 0, sizeof(cl.model_precache));
|
||||
for (nummodels=1 ; ; nummodels++)
|
||||
{
|
||||
str = MSG_ReadString ();
|
||||
str = MSG_ReadString (net_message);
|
||||
if (!str[0])
|
||||
break;
|
||||
if (nummodels==MAX_MODELS)
|
||||
|
@ -293,7 +293,7 @@ void CL_ParseServerInfo (void)
|
|||
memset (cl.sound_precache, 0, sizeof(cl.sound_precache));
|
||||
for (numsounds=1 ; ; numsounds++)
|
||||
{
|
||||
str = MSG_ReadString ();
|
||||
str = MSG_ReadString (net_message);
|
||||
if (!str[0])
|
||||
break;
|
||||
if (numsounds==MAX_SOUNDS)
|
||||
|
@ -369,14 +369,14 @@ void CL_ParseUpdate (int bits)
|
|||
|
||||
if (bits & U_MOREBITS)
|
||||
{
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
bits |= (i<<8);
|
||||
}
|
||||
|
||||
if (bits & U_LONGENTITY)
|
||||
num = MSG_ReadShort ();
|
||||
num = MSG_ReadShort (net_message);
|
||||
else
|
||||
num = MSG_ReadByte ();
|
||||
num = MSG_ReadByte (net_message);
|
||||
|
||||
ent = CL_EntityNum (num);
|
||||
|
||||
|
@ -393,7 +393,7 @@ if (bits&(1<<i))
|
|||
|
||||
if (bits & U_MODEL)
|
||||
{
|
||||
modnum = MSG_ReadByte ();
|
||||
modnum = MSG_ReadByte (net_message);
|
||||
if (modnum >= MAX_MODELS)
|
||||
Host_Error ("CL_ParseModel: bad modnum");
|
||||
}
|
||||
|
@ -420,12 +420,12 @@ if (bits&(1<<i))
|
|||
}
|
||||
|
||||
if (bits & U_FRAME)
|
||||
ent->frame = MSG_ReadByte ();
|
||||
ent->frame = MSG_ReadByte (net_message);
|
||||
else
|
||||
ent->frame = ent->baseline.frame;
|
||||
|
||||
if (bits & U_COLORMAP)
|
||||
i = MSG_ReadByte();
|
||||
i = MSG_ReadByte(net_message);
|
||||
else
|
||||
i = ent->baseline.colormap;
|
||||
if (!i)
|
||||
|
@ -438,7 +438,7 @@ if (bits&(1<<i))
|
|||
}
|
||||
|
||||
if (bits & U_SKIN)
|
||||
skin = MSG_ReadByte();
|
||||
skin = MSG_ReadByte(net_message);
|
||||
else
|
||||
skin = ent->baseline.skin;
|
||||
if (skin != ent->skinnum) {
|
||||
|
@ -448,7 +448,7 @@ if (bits&(1<<i))
|
|||
}
|
||||
|
||||
if (bits & U_EFFECTS)
|
||||
ent->effects = MSG_ReadByte();
|
||||
ent->effects = MSG_ReadByte(net_message);
|
||||
else
|
||||
ent->effects = ent->baseline.effects;
|
||||
|
||||
|
@ -457,29 +457,29 @@ if (bits&(1<<i))
|
|||
VectorCopy (ent->msg_angles[0], ent->msg_angles[1]);
|
||||
|
||||
if (bits & U_ORIGIN1)
|
||||
ent->msg_origins[0][0] = MSG_ReadCoord ();
|
||||
ent->msg_origins[0][0] = MSG_ReadCoord (net_message);
|
||||
else
|
||||
ent->msg_origins[0][0] = ent->baseline.origin[0];
|
||||
if (bits & U_ANGLE1)
|
||||
ent->msg_angles[0][0] = MSG_ReadAngle();
|
||||
ent->msg_angles[0][0] = MSG_ReadAngle(net_message);
|
||||
else
|
||||
ent->msg_angles[0][0] = ent->baseline.angles[0];
|
||||
|
||||
if (bits & U_ORIGIN2)
|
||||
ent->msg_origins[0][1] = MSG_ReadCoord ();
|
||||
ent->msg_origins[0][1] = MSG_ReadCoord (net_message);
|
||||
else
|
||||
ent->msg_origins[0][1] = ent->baseline.origin[1];
|
||||
if (bits & U_ANGLE2)
|
||||
ent->msg_angles[0][1] = MSG_ReadAngle();
|
||||
ent->msg_angles[0][1] = MSG_ReadAngle(net_message);
|
||||
else
|
||||
ent->msg_angles[0][1] = ent->baseline.angles[1];
|
||||
|
||||
if (bits & U_ORIGIN3)
|
||||
ent->msg_origins[0][2] = MSG_ReadCoord ();
|
||||
ent->msg_origins[0][2] = MSG_ReadCoord (net_message);
|
||||
else
|
||||
ent->msg_origins[0][2] = ent->baseline.origin[2];
|
||||
if (bits & U_ANGLE3)
|
||||
ent->msg_angles[0][2] = MSG_ReadAngle();
|
||||
ent->msg_angles[0][2] = MSG_ReadAngle(net_message);
|
||||
else
|
||||
ent->msg_angles[0][2] = ent->baseline.angles[2];
|
||||
|
||||
|
@ -505,14 +505,14 @@ void CL_ParseBaseline (entity_t *ent)
|
|||
{
|
||||
int i;
|
||||
|
||||
ent->baseline.modelindex = MSG_ReadByte ();
|
||||
ent->baseline.frame = MSG_ReadByte ();
|
||||
ent->baseline.colormap = MSG_ReadByte();
|
||||
ent->baseline.skin = MSG_ReadByte();
|
||||
ent->baseline.modelindex = MSG_ReadByte (net_message);
|
||||
ent->baseline.frame = MSG_ReadByte (net_message);
|
||||
ent->baseline.colormap = MSG_ReadByte(net_message);
|
||||
ent->baseline.skin = MSG_ReadByte(net_message);
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
ent->baseline.origin[i] = MSG_ReadCoord ();
|
||||
ent->baseline.angles[i] = MSG_ReadAngle ();
|
||||
ent->baseline.origin[i] = MSG_ReadCoord (net_message);
|
||||
ent->baseline.angles[i] = MSG_ReadAngle (net_message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -529,12 +529,12 @@ void CL_ParseClientdata (int bits)
|
|||
int i, j;
|
||||
|
||||
if (bits & SU_VIEWHEIGHT)
|
||||
cl.viewheight = MSG_ReadChar ();
|
||||
cl.viewheight = MSG_ReadChar (net_message);
|
||||
else
|
||||
cl.viewheight = DEFAULT_VIEWHEIGHT;
|
||||
|
||||
if (bits & SU_IDEALPITCH)
|
||||
cl.idealpitch = MSG_ReadChar ();
|
||||
cl.idealpitch = MSG_ReadChar (net_message);
|
||||
else
|
||||
cl.idealpitch = 0;
|
||||
|
||||
|
@ -542,17 +542,17 @@ void CL_ParseClientdata (int bits)
|
|||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
if (bits & (SU_PUNCH1<<i) )
|
||||
cl.punchangle[i] = MSG_ReadChar();
|
||||
cl.punchangle[i] = MSG_ReadChar(net_message);
|
||||
else
|
||||
cl.punchangle[i] = 0;
|
||||
if (bits & (SU_VELOCITY1<<i) )
|
||||
cl.mvelocity[0][i] = MSG_ReadChar()*16;
|
||||
cl.mvelocity[0][i] = MSG_ReadChar(net_message)*16;
|
||||
else
|
||||
cl.mvelocity[0][i] = 0;
|
||||
}
|
||||
|
||||
// [always sent] if (bits & SU_ITEMS)
|
||||
i = MSG_ReadLong ();
|
||||
i = MSG_ReadLong (net_message);
|
||||
|
||||
if (cl.items != i)
|
||||
{ // set flash times
|
||||
|
@ -567,12 +567,12 @@ void CL_ParseClientdata (int bits)
|
|||
cl.inwater = (bits & SU_INWATER) != 0;
|
||||
|
||||
if (bits & SU_WEAPONFRAME)
|
||||
cl.stats[STAT_WEAPONFRAME] = MSG_ReadByte ();
|
||||
cl.stats[STAT_WEAPONFRAME] = MSG_ReadByte (net_message);
|
||||
else
|
||||
cl.stats[STAT_WEAPONFRAME] = 0;
|
||||
|
||||
if (bits & SU_ARMOR)
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
else
|
||||
i = 0;
|
||||
if (cl.stats[STAT_ARMOR] != i)
|
||||
|
@ -582,7 +582,7 @@ void CL_ParseClientdata (int bits)
|
|||
}
|
||||
|
||||
if (bits & SU_WEAPON)
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
else
|
||||
i = 0;
|
||||
if (cl.stats[STAT_WEAPON] != i)
|
||||
|
@ -591,14 +591,14 @@ void CL_ParseClientdata (int bits)
|
|||
Sbar_Changed ();
|
||||
}
|
||||
|
||||
i = MSG_ReadShort ();
|
||||
i = MSG_ReadShort (net_message);
|
||||
if (cl.stats[STAT_HEALTH] != i)
|
||||
{
|
||||
cl.stats[STAT_HEALTH] = i;
|
||||
Sbar_Changed ();
|
||||
}
|
||||
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (cl.stats[STAT_AMMO] != i)
|
||||
{
|
||||
cl.stats[STAT_AMMO] = i;
|
||||
|
@ -607,7 +607,7 @@ void CL_ParseClientdata (int bits)
|
|||
|
||||
for (i=0 ; i<4 ; i++)
|
||||
{
|
||||
j = MSG_ReadByte ();
|
||||
j = MSG_ReadByte (net_message);
|
||||
if (cl.stats[STAT_SHELLS+i] != j)
|
||||
{
|
||||
cl.stats[STAT_SHELLS+i] = j;
|
||||
|
@ -615,7 +615,7 @@ void CL_ParseClientdata (int bits)
|
|||
}
|
||||
}
|
||||
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
|
||||
if (standard_quake)
|
||||
{
|
||||
|
@ -712,16 +712,16 @@ void CL_ParseStaticSound (void)
|
|||
int i;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
org[i] = MSG_ReadCoord ();
|
||||
sound_num = MSG_ReadByte ();
|
||||
vol = MSG_ReadByte ();
|
||||
atten = MSG_ReadByte ();
|
||||
org[i] = MSG_ReadCoord (net_message);
|
||||
sound_num = MSG_ReadByte (net_message);
|
||||
vol = MSG_ReadByte (net_message);
|
||||
atten = MSG_ReadByte (net_message);
|
||||
|
||||
S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
|
||||
}
|
||||
|
||||
|
||||
#define SHOWNET(x) if(cl_shownet->int_val==2)Con_Printf ("%3i:%s\n", msg_readcount-1, x);
|
||||
#define SHOWNET(x) if(cl_shownet->int_val==2)Con_Printf ("%3i:%s\n", net_message->readcount-1, x);
|
||||
|
||||
/*
|
||||
=====================
|
||||
|
@ -737,7 +737,7 @@ void CL_ParseServerMessage (void)
|
|||
// if recording demos, copy the message out
|
||||
//
|
||||
if (cl_shownet->int_val == 1)
|
||||
Con_Printf ("%i ",net_message.cursize);
|
||||
Con_Printf ("%i ",net_message->message->cursize);
|
||||
else if (cl_shownet->int_val == 2)
|
||||
Con_Printf ("------------------\n");
|
||||
|
||||
|
@ -745,14 +745,14 @@ void CL_ParseServerMessage (void)
|
|||
//
|
||||
// parse the message
|
||||
//
|
||||
MSG_BeginReading ();
|
||||
MSG_BeginReading (net_message);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (msg_badread)
|
||||
if (net_message->badread)
|
||||
Host_Error ("CL_ParseServerMessage: Bad server message");
|
||||
|
||||
cmd = MSG_ReadByte ();
|
||||
cmd = MSG_ReadByte (net_message);
|
||||
|
||||
if (cmd == -1)
|
||||
{
|
||||
|
@ -783,16 +783,16 @@ void CL_ParseServerMessage (void)
|
|||
|
||||
case svc_time:
|
||||
cl.mtime[1] = cl.mtime[0];
|
||||
cl.mtime[0] = MSG_ReadFloat ();
|
||||
cl.mtime[0] = MSG_ReadFloat (net_message);
|
||||
break;
|
||||
|
||||
case svc_clientdata:
|
||||
i = MSG_ReadShort ();
|
||||
i = MSG_ReadShort (net_message);
|
||||
CL_ParseClientdata (i);
|
||||
break;
|
||||
|
||||
case svc_version:
|
||||
i = MSG_ReadLong ();
|
||||
i = MSG_ReadLong (net_message);
|
||||
if (i != PROTOCOL_VERSION)
|
||||
Host_Error ("CL_ParseServerMessage: Server is protocol %i instead of %i\n", i, PROTOCOL_VERSION);
|
||||
break;
|
||||
|
@ -801,15 +801,15 @@ void CL_ParseServerMessage (void)
|
|||
Host_EndGame ("Server disconnected\n");
|
||||
|
||||
case svc_print:
|
||||
Con_Printf ("%s", MSG_ReadString ());
|
||||
Con_Printf ("%s", MSG_ReadString (net_message));
|
||||
break;
|
||||
|
||||
case svc_centerprint:
|
||||
SCR_CenterPrint (MSG_ReadString ());
|
||||
SCR_CenterPrint (MSG_ReadString (net_message));
|
||||
break;
|
||||
|
||||
case svc_stufftext:
|
||||
Cbuf_AddText (MSG_ReadString ());
|
||||
Cbuf_AddText (MSG_ReadString (net_message));
|
||||
break;
|
||||
|
||||
case svc_damage:
|
||||
|
@ -823,18 +823,18 @@ void CL_ParseServerMessage (void)
|
|||
|
||||
case svc_setangle:
|
||||
for (i=0 ; i<3 ; i++)
|
||||
cl.viewangles[i] = MSG_ReadAngle ();
|
||||
cl.viewangles[i] = MSG_ReadAngle (net_message);
|
||||
break;
|
||||
|
||||
case svc_setview:
|
||||
cl.viewentity = MSG_ReadShort ();
|
||||
cl.viewentity = MSG_ReadShort (net_message);
|
||||
break;
|
||||
|
||||
case svc_lightstyle:
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= MAX_LIGHTSTYLES)
|
||||
Sys_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
|
||||
strcpy (cl_lightstyle[i].map, MSG_ReadString());
|
||||
strcpy (cl_lightstyle[i].map, MSG_ReadString(net_message));
|
||||
cl_lightstyle[i].length = strlen(cl_lightstyle[i].map);
|
||||
break;
|
||||
|
||||
|
@ -843,32 +843,32 @@ void CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_stopsound:
|
||||
i = MSG_ReadShort();
|
||||
i = MSG_ReadShort(net_message);
|
||||
S_StopSound(i>>3, i&7);
|
||||
break;
|
||||
|
||||
case svc_updatename:
|
||||
Sbar_Changed ();
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= cl.maxclients)
|
||||
Host_Error ("CL_ParseServerMessage: svc_updatename > MAX_SCOREBOARD");
|
||||
strcpy (cl.scores[i].name, MSG_ReadString ());
|
||||
strcpy (cl.scores[i].name, MSG_ReadString (net_message));
|
||||
break;
|
||||
|
||||
case svc_updatefrags:
|
||||
Sbar_Changed ();
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= cl.maxclients)
|
||||
Host_Error ("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD");
|
||||
cl.scores[i].frags = MSG_ReadShort ();
|
||||
cl.scores[i].frags = MSG_ReadShort (net_message);
|
||||
break;
|
||||
|
||||
case svc_updatecolors:
|
||||
Sbar_Changed ();
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= cl.maxclients)
|
||||
Host_Error ("CL_ParseServerMessage: svc_updatecolors > MAX_SCOREBOARD");
|
||||
cl.scores[i].colors = MSG_ReadByte ();
|
||||
cl.scores[i].colors = MSG_ReadByte (net_message);
|
||||
CL_NewTranslation (i);
|
||||
break;
|
||||
|
||||
|
@ -877,7 +877,7 @@ void CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_spawnbaseline:
|
||||
i = MSG_ReadShort ();
|
||||
i = MSG_ReadShort (net_message);
|
||||
// must use CL_EntityNum() to force cl.num_entities up
|
||||
CL_ParseBaseline (CL_EntityNum(i));
|
||||
break;
|
||||
|
@ -890,7 +890,7 @@ void CL_ParseServerMessage (void)
|
|||
|
||||
case svc_setpause:
|
||||
{
|
||||
cl.paused = MSG_ReadByte ();
|
||||
cl.paused = MSG_ReadByte (net_message);
|
||||
|
||||
if (cl.paused)
|
||||
{
|
||||
|
@ -908,7 +908,7 @@ void CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_signonnum:
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i <= cls.signon)
|
||||
Host_Error ("Received signon %i when at %i", i, cls.signon);
|
||||
cls.signon = i;
|
||||
|
@ -924,10 +924,10 @@ void CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_updatestat:
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i < 0 || i >= MAX_CL_STATS)
|
||||
Sys_Error ("svc_updatestat: %i is invalid", i);
|
||||
cl.stats[i] = MSG_ReadLong ();;
|
||||
cl.stats[i] = MSG_ReadLong (net_message);;
|
||||
break;
|
||||
|
||||
case svc_spawnstaticsound:
|
||||
|
@ -935,8 +935,8 @@ void CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_cdtrack:
|
||||
cl.cdtrack = MSG_ReadByte ();
|
||||
cl.looptrack = MSG_ReadByte ();
|
||||
cl.cdtrack = MSG_ReadByte (net_message);
|
||||
cl.looptrack = MSG_ReadByte (net_message);
|
||||
if ( (cls.demoplayback || cls.demorecording) && (cls.forcetrack != -1) )
|
||||
CDAudio_Play ((byte)cls.forcetrack, true);
|
||||
else
|
||||
|
@ -953,14 +953,14 @@ void CL_ParseServerMessage (void)
|
|||
cl.intermission = 2;
|
||||
cl.completed_time = cl.time;
|
||||
vid.recalc_refdef = true; // go to full screen
|
||||
SCR_CenterPrint (MSG_ReadString ());
|
||||
SCR_CenterPrint (MSG_ReadString (net_message));
|
||||
break;
|
||||
|
||||
case svc_cutscene:
|
||||
cl.intermission = 3;
|
||||
cl.completed_time = cl.time;
|
||||
vid.recalc_refdef = true; // go to full screen
|
||||
SCR_CenterPrint (MSG_ReadString ());
|
||||
SCR_CenterPrint (MSG_ReadString (net_message));
|
||||
break;
|
||||
|
||||
case svc_sellscreen:
|
||||
|
|
|
@ -84,15 +84,15 @@ void CL_ParseBeam (model_t *m)
|
|||
beam_t *b;
|
||||
int i;
|
||||
|
||||
ent = MSG_ReadShort ();
|
||||
ent = MSG_ReadShort (net_message);
|
||||
|
||||
start[0] = MSG_ReadCoord ();
|
||||
start[1] = MSG_ReadCoord ();
|
||||
start[2] = MSG_ReadCoord ();
|
||||
start[0] = MSG_ReadCoord (net_message);
|
||||
start[1] = MSG_ReadCoord (net_message);
|
||||
start[2] = MSG_ReadCoord (net_message);
|
||||
|
||||
end[0] = MSG_ReadCoord ();
|
||||
end[1] = MSG_ReadCoord ();
|
||||
end[2] = MSG_ReadCoord ();
|
||||
end[0] = MSG_ReadCoord (net_message);
|
||||
end[1] = MSG_ReadCoord (net_message);
|
||||
end[2] = MSG_ReadCoord (net_message);
|
||||
|
||||
// override any beam with the same entity
|
||||
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
|
||||
|
@ -138,29 +138,29 @@ void CL_ParseTEnt (void)
|
|||
int rnd;
|
||||
int colorStart, colorLength;
|
||||
|
||||
type = MSG_ReadByte ();
|
||||
type = MSG_ReadByte (net_message);
|
||||
switch (type)
|
||||
{
|
||||
case TE_WIZSPIKE: // spike hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunParticleEffect (pos, vec3_origin, 20, 30);
|
||||
S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1);
|
||||
break;
|
||||
|
||||
case TE_KNIGHTSPIKE: // spike hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunParticleEffect (pos, vec3_origin, 226, 20);
|
||||
S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1);
|
||||
break;
|
||||
|
||||
case TE_SPIKE: // spike hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
#ifdef GLTEST
|
||||
Test_Spawn (pos);
|
||||
#else
|
||||
|
@ -180,9 +180,9 @@ void CL_ParseTEnt (void)
|
|||
}
|
||||
break;
|
||||
case TE_SUPERSPIKE: // super spike hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunParticleEffect (pos, vec3_origin, 0, 20);
|
||||
|
||||
if ( rand() % 5 )
|
||||
|
@ -200,16 +200,16 @@ void CL_ParseTEnt (void)
|
|||
break;
|
||||
|
||||
case TE_GUNSHOT: // bullet hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunParticleEffect (pos, vec3_origin, 0, 20);
|
||||
break;
|
||||
|
||||
case TE_EXPLOSION: // rocket explosion
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_ParticleExplosion (pos);
|
||||
dl = CL_AllocDlight (0);
|
||||
VectorCopy (pos, dl->origin);
|
||||
|
@ -223,9 +223,9 @@ void CL_ParseTEnt (void)
|
|||
break;
|
||||
|
||||
case TE_TAREXPLOSION: // tarbaby explosion
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_BlobExplosion (pos);
|
||||
|
||||
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
|
||||
|
@ -250,25 +250,25 @@ void CL_ParseTEnt (void)
|
|||
// PGM 01/21/97
|
||||
|
||||
case TE_LAVASPLASH:
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_LavaSplash (pos);
|
||||
break;
|
||||
|
||||
case TE_TELEPORT:
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_TeleportSplash (pos);
|
||||
break;
|
||||
|
||||
case TE_EXPLOSION2: // color mapped explosion
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
colorStart = MSG_ReadByte ();
|
||||
colorLength = MSG_ReadByte ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
colorStart = MSG_ReadByte (net_message);
|
||||
colorLength = MSG_ReadByte (net_message);
|
||||
R_ParticleExplosion2 (pos, colorStart, colorLength);
|
||||
dl = CL_AllocDlight (0);
|
||||
VectorCopy (pos, dl->origin);
|
||||
|
@ -283,19 +283,19 @@ void CL_ParseTEnt (void)
|
|||
|
||||
#ifdef QUAKE2
|
||||
case TE_IMPLOSION:
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
S_StartSound (-1, 0, cl_sfx_imp, pos, 1, 1);
|
||||
break;
|
||||
|
||||
case TE_RAILTRAIL:
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
endpos[0] = MSG_ReadCoord ();
|
||||
endpos[1] = MSG_ReadCoord ();
|
||||
endpos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
endpos[0] = MSG_ReadCoord (net_message);
|
||||
endpos[1] = MSG_ReadCoord (net_message);
|
||||
endpos[2] = MSG_ReadCoord (net_message);
|
||||
S_StartSound (-1, 0, cl_sfx_rail, pos, 1, 1);
|
||||
S_StartSound (-1, 1, cl_sfx_r_exp3, endpos, 1, 1);
|
||||
R_RocketTrail (pos, endpos, 0+128);
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
link.c
|
||||
|
||||
(description)
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include "link.h"
|
||||
|
||||
// ClearLink is used for new headnodes
|
||||
void ClearLink (link_t *l)
|
||||
{
|
||||
l->prev = l->next = l;
|
||||
}
|
||||
|
||||
void RemoveLink (link_t *l)
|
||||
{
|
||||
l->next->prev = l->prev;
|
||||
l->prev->next = l->next;
|
||||
}
|
||||
|
||||
void InsertLinkBefore (link_t *l, link_t *before)
|
||||
{
|
||||
l->next = before;
|
||||
l->prev = before->prev;
|
||||
l->prev->next = l;
|
||||
l->next->prev = l;
|
||||
}
|
||||
void InsertLinkAfter (link_t *l, link_t *after)
|
||||
{
|
||||
l->next = after->next;
|
||||
l->prev = after;
|
||||
l->prev->next = l;
|
||||
l->next->prev = l;
|
||||
}
|
||||
|
265
nq/source/msg.c
265
nq/source/msg.c
|
@ -1,265 +0,0 @@
|
|||
/*
|
||||
msg.c
|
||||
|
||||
@description@
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "msg.h"
|
||||
#include "qendian.h"
|
||||
#include "net.h"
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
MESSAGE IO FUNCTIONS
|
||||
|
||||
Handles byte ordering and avoids alignment errors
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
//
|
||||
// writing functions
|
||||
//
|
||||
|
||||
void MSG_WriteChar (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
#ifdef PARANOID
|
||||
if (c < -128 || c > 127)
|
||||
Sys_Error ("MSG_WriteChar: range error");
|
||||
#endif
|
||||
|
||||
buf = SZ_GetSpace (sb, 1);
|
||||
buf[0] = c;
|
||||
}
|
||||
|
||||
void MSG_WriteByte (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
#ifdef PARANOID
|
||||
if (c < 0 || c > 255)
|
||||
Sys_Error ("MSG_WriteByte: range error");
|
||||
#endif
|
||||
|
||||
buf = SZ_GetSpace (sb, 1);
|
||||
buf[0] = c;
|
||||
}
|
||||
|
||||
void MSG_WriteShort (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
#ifdef PARANOID
|
||||
if (c < ((short)0x8000) || c > (short)0x7fff)
|
||||
Sys_Error ("MSG_WriteShort: range error");
|
||||
#endif
|
||||
|
||||
buf = SZ_GetSpace (sb, 2);
|
||||
buf[0] = c&0xff;
|
||||
buf[1] = c>>8;
|
||||
}
|
||||
|
||||
void MSG_WriteLong (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
buf = SZ_GetSpace (sb, 4);
|
||||
buf[0] = c&0xff;
|
||||
buf[1] = (c>>8)&0xff;
|
||||
buf[2] = (c>>16)&0xff;
|
||||
buf[3] = c>>24;
|
||||
}
|
||||
|
||||
void MSG_WriteFloat (sizebuf_t *sb, float f)
|
||||
{
|
||||
union
|
||||
{
|
||||
float f;
|
||||
int l;
|
||||
} dat;
|
||||
|
||||
|
||||
dat.f = f;
|
||||
dat.l = LittleLong (dat.l);
|
||||
|
||||
SZ_Write (sb, &dat.l, 4);
|
||||
}
|
||||
|
||||
void MSG_WriteString (sizebuf_t *sb, char *s)
|
||||
{
|
||||
if (!s)
|
||||
SZ_Write (sb, "", 1);
|
||||
else
|
||||
SZ_Write (sb, s, strlen(s)+1);
|
||||
}
|
||||
|
||||
void MSG_WriteCoord (sizebuf_t *sb, float f)
|
||||
{
|
||||
MSG_WriteShort (sb, (int)(f*8));
|
||||
}
|
||||
|
||||
void MSG_WriteAngle (sizebuf_t *sb, float f)
|
||||
{
|
||||
MSG_WriteByte (sb, ((int)f*256/360) & 255);
|
||||
}
|
||||
|
||||
//
|
||||
// reading functions
|
||||
//
|
||||
int msg_readcount;
|
||||
qboolean msg_badread;
|
||||
|
||||
void MSG_BeginReading (void)
|
||||
{
|
||||
msg_readcount = 0;
|
||||
msg_badread = false;
|
||||
}
|
||||
|
||||
// returns -1 and sets msg_badread if no more characters are available
|
||||
int MSG_ReadChar (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (msg_readcount+1 > net_message.cursize)
|
||||
{
|
||||
msg_badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = (signed char)net_message.data[msg_readcount];
|
||||
msg_readcount++;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int MSG_ReadByte (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (msg_readcount+1 > net_message.cursize)
|
||||
{
|
||||
msg_badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = (unsigned char)net_message.data[msg_readcount];
|
||||
msg_readcount++;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int MSG_ReadShort (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (msg_readcount+2 > net_message.cursize)
|
||||
{
|
||||
msg_badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = (short)(net_message.data[msg_readcount]
|
||||
+ (net_message.data[msg_readcount+1]<<8));
|
||||
|
||||
msg_readcount += 2;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int MSG_ReadLong (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (msg_readcount+4 > net_message.cursize)
|
||||
{
|
||||
msg_badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = net_message.data[msg_readcount]
|
||||
+ (net_message.data[msg_readcount+1]<<8)
|
||||
+ (net_message.data[msg_readcount+2]<<16)
|
||||
+ (net_message.data[msg_readcount+3]<<24);
|
||||
|
||||
msg_readcount += 4;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float MSG_ReadFloat (void)
|
||||
{
|
||||
union
|
||||
{
|
||||
byte b[4];
|
||||
float f;
|
||||
int l;
|
||||
} dat;
|
||||
|
||||
dat.b[0] = net_message.data[msg_readcount];
|
||||
dat.b[1] = net_message.data[msg_readcount+1];
|
||||
dat.b[2] = net_message.data[msg_readcount+2];
|
||||
dat.b[3] = net_message.data[msg_readcount+3];
|
||||
msg_readcount += 4;
|
||||
|
||||
dat.l = LittleLong (dat.l);
|
||||
|
||||
return dat.f;
|
||||
}
|
||||
|
||||
char *MSG_ReadString (void)
|
||||
{
|
||||
static char string[2048];
|
||||
int l,c;
|
||||
|
||||
l = 0;
|
||||
do
|
||||
{
|
||||
c = MSG_ReadChar ();
|
||||
if (c == -1 || c == 0)
|
||||
break;
|
||||
string[l] = c;
|
||||
l++;
|
||||
} while (l < sizeof(string)-1);
|
||||
|
||||
string[l] = 0;
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
float MSG_ReadCoord (void)
|
||||
{
|
||||
return MSG_ReadShort() * (1.0/8);
|
||||
}
|
||||
|
||||
float MSG_ReadAngle (void)
|
||||
{
|
||||
return MSG_ReadChar() * (360.0/256);
|
||||
}
|
|
@ -410,8 +410,8 @@ int Datagram_GetMessage (qsocket_t *sock)
|
|||
|
||||
length -= NET_HEADERSIZE;
|
||||
|
||||
SZ_Clear (&net_message);
|
||||
SZ_Write (&net_message, packetBuffer.data, length);
|
||||
SZ_Clear (net_message->message);
|
||||
SZ_Write (net_message->message, packetBuffer.data, length);
|
||||
|
||||
ret = 2;
|
||||
break;
|
||||
|
@ -466,9 +466,9 @@ int Datagram_GetMessage (qsocket_t *sock)
|
|||
|
||||
if (flags & NETFLAG_EOM)
|
||||
{
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Write(&net_message, sock->receiveMessage, sock->receiveMessageLength);
|
||||
SZ_Write(&net_message, packetBuffer.data, length);
|
||||
SZ_Clear(net_message->message);
|
||||
SZ_Write(net_message->message, sock->receiveMessage, sock->receiveMessageLength);
|
||||
SZ_Write(net_message->message, packetBuffer.data, length);
|
||||
sock->receiveMessageLength = 0;
|
||||
|
||||
ret = 1;
|
||||
|
@ -560,15 +560,15 @@ static void Test_Poll(void)
|
|||
|
||||
while (1)
|
||||
{
|
||||
len = dfunc.Read (testSocket, net_message.data, net_message.maxsize, &clientaddr);
|
||||
len = dfunc.Read (testSocket, net_message->message->data, net_message->message->maxsize, &clientaddr);
|
||||
if (len < sizeof(int))
|
||||
break;
|
||||
|
||||
net_message.cursize = len;
|
||||
net_message->message->cursize = len;
|
||||
|
||||
MSG_BeginReading ();
|
||||
control = BigLong(*((int *)net_message.data));
|
||||
MSG_ReadLong();
|
||||
MSG_BeginReading (net_message);
|
||||
control = BigLong(*((int *)net_message->message->data));
|
||||
MSG_ReadLong(net_message);
|
||||
if (control == -1)
|
||||
break;
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != NETFLAG_CTL)
|
||||
|
@ -576,15 +576,15 @@ static void Test_Poll(void)
|
|||
if ((control & NETFLAG_LENGTH_MASK) != len)
|
||||
break;
|
||||
|
||||
if (MSG_ReadByte() != CCREP_PLAYER_INFO)
|
||||
if (MSG_ReadByte(net_message) != CCREP_PLAYER_INFO)
|
||||
Sys_Error("Unexpected repsonse to Player Info request\n");
|
||||
|
||||
playerNumber = MSG_ReadByte();
|
||||
strcpy(name, MSG_ReadString());
|
||||
colors = MSG_ReadLong();
|
||||
frags = MSG_ReadLong();
|
||||
connectTime = MSG_ReadLong();
|
||||
strcpy(address, MSG_ReadString());
|
||||
playerNumber = MSG_ReadByte(net_message);
|
||||
strcpy(name, MSG_ReadString(net_message));
|
||||
colors = MSG_ReadLong(net_message);
|
||||
frags = MSG_ReadLong(net_message);
|
||||
connectTime = MSG_ReadLong(net_message);
|
||||
strcpy(address, MSG_ReadString(net_message));
|
||||
|
||||
Con_Printf("%s\n frags:%3i colors:%u %u time:%u\n %s\n", name, frags, colors >> 4, colors & 0x0f, connectTime / 60, address);
|
||||
}
|
||||
|
@ -652,15 +652,15 @@ JustDoIt:
|
|||
|
||||
for (n = 0; n < max; n++)
|
||||
{
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
// save space for the header, filled in later
|
||||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREQ_PLAYER_INFO);
|
||||
MSG_WriteByte(&net_message, n);
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (testSocket, net_message.data, net_message.cursize, &sendaddr);
|
||||
MSG_WriteLong(net_message->message, 0);
|
||||
MSG_WriteByte(net_message->message, CCREQ_PLAYER_INFO);
|
||||
MSG_WriteByte(net_message->message, n);
|
||||
*((int *)net_message->message->data) = BigLong(NETFLAG_CTL | (net_message->message->cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (testSocket, net_message->message->data, net_message->message->cursize, &sendaddr);
|
||||
}
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
SchedulePollProcedure(&testPollProcedure, 0.1);
|
||||
}
|
||||
|
||||
|
@ -683,15 +683,15 @@ static void Test2_Poll(void)
|
|||
net_landriverlevel = test2Driver;
|
||||
name[0] = 0;
|
||||
|
||||
len = dfunc.Read (test2Socket, net_message.data, net_message.maxsize, &clientaddr);
|
||||
len = dfunc.Read (test2Socket, net_message->message->data, net_message->message->maxsize, &clientaddr);
|
||||
if (len < sizeof(int))
|
||||
goto Reschedule;
|
||||
|
||||
net_message.cursize = len;
|
||||
net_message->message->cursize = len;
|
||||
|
||||
MSG_BeginReading ();
|
||||
control = BigLong(*((int *)net_message.data));
|
||||
MSG_ReadLong();
|
||||
MSG_BeginReading (net_message);
|
||||
control = BigLong(*((int *)net_message->message->data));
|
||||
MSG_ReadLong(net_message);
|
||||
if (control == -1)
|
||||
goto Error;
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != NETFLAG_CTL)
|
||||
|
@ -699,24 +699,24 @@ static void Test2_Poll(void)
|
|||
if ((control & NETFLAG_LENGTH_MASK) != len)
|
||||
goto Error;
|
||||
|
||||
if (MSG_ReadByte() != CCREP_RULE_INFO)
|
||||
if (MSG_ReadByte(net_message) != CCREP_RULE_INFO)
|
||||
goto Error;
|
||||
|
||||
strcpy(name, MSG_ReadString());
|
||||
strcpy(name, MSG_ReadString(net_message));
|
||||
if (name[0] == 0)
|
||||
goto Done;
|
||||
strcpy(value, MSG_ReadString());
|
||||
strcpy(value, MSG_ReadString(net_message));
|
||||
|
||||
Con_Printf("%-16.16s %-16.16s\n", name, value);
|
||||
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
// save space for the header, filled in later
|
||||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREQ_RULE_INFO);
|
||||
MSG_WriteString(&net_message, name);
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (test2Socket, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
MSG_WriteLong(net_message->message, 0);
|
||||
MSG_WriteByte(net_message->message, CCREQ_RULE_INFO);
|
||||
MSG_WriteString(net_message->message, name);
|
||||
*((int *)net_message->message->data) = BigLong(NETFLAG_CTL | (net_message->message->cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (test2Socket, net_message->message->data, net_message->message->cursize, &clientaddr);
|
||||
SZ_Clear(net_message->message);
|
||||
|
||||
Reschedule:
|
||||
SchedulePollProcedure(&test2PollProcedure, 0.05);
|
||||
|
@ -776,14 +776,14 @@ JustDoIt:
|
|||
test2InProgress = true;
|
||||
test2Driver = net_landriverlevel;
|
||||
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
// save space for the header, filled in later
|
||||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREQ_RULE_INFO);
|
||||
MSG_WriteString(&net_message, "");
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (test2Socket, net_message.data, net_message.cursize, &sendaddr);
|
||||
SZ_Clear(&net_message);
|
||||
MSG_WriteLong(net_message->message, 0);
|
||||
MSG_WriteByte(net_message->message, CCREQ_RULE_INFO);
|
||||
MSG_WriteString(net_message->message, "");
|
||||
*((int *)net_message->message->data) = BigLong(NETFLAG_CTL | (net_message->message->cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (test2Socket, net_message->message->data, net_message->message->cursize, &sendaddr);
|
||||
SZ_Clear(net_message->message);
|
||||
SchedulePollProcedure(&test2PollProcedure, 0.05);
|
||||
}
|
||||
|
||||
|
@ -869,16 +869,16 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
if (acceptsock == -1)
|
||||
return NULL;
|
||||
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
|
||||
len = dfunc.Read (acceptsock, net_message.data, net_message.maxsize, &clientaddr);
|
||||
len = dfunc.Read (acceptsock, net_message->message->data, net_message->message->maxsize, &clientaddr);
|
||||
if (len < sizeof(int))
|
||||
return NULL;
|
||||
net_message.cursize = len;
|
||||
net_message->message->cursize = len;
|
||||
|
||||
MSG_BeginReading ();
|
||||
control = BigLong(*((int *)net_message.data));
|
||||
MSG_ReadLong();
|
||||
MSG_BeginReading (net_message);
|
||||
control = BigLong(*((int *)net_message->message->data));
|
||||
MSG_ReadLong(net_message);
|
||||
if (control == -1)
|
||||
return NULL;
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != NETFLAG_CTL)
|
||||
|
@ -886,26 +886,26 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
if ((control & NETFLAG_LENGTH_MASK) != len)
|
||||
return NULL;
|
||||
|
||||
command = MSG_ReadByte();
|
||||
command = MSG_ReadByte(net_message);
|
||||
if (command == CCREQ_SERVER_INFO)
|
||||
{
|
||||
if (strcmp(MSG_ReadString(), "QUAKE") != 0)
|
||||
if (strcmp(MSG_ReadString(net_message), "QUAKE") != 0)
|
||||
return NULL;
|
||||
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
// save space for the header, filled in later
|
||||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREP_SERVER_INFO);
|
||||
MSG_WriteLong(net_message->message, 0);
|
||||
MSG_WriteByte(net_message->message, CCREP_SERVER_INFO);
|
||||
dfunc.GetSocketAddr(acceptsock, &newaddr);
|
||||
MSG_WriteString(&net_message, dfunc.AddrToString(&newaddr));
|
||||
MSG_WriteString(&net_message, hostname->string);
|
||||
MSG_WriteString(&net_message, sv.name);
|
||||
MSG_WriteByte(&net_message, net_activeconnections);
|
||||
MSG_WriteByte(&net_message, svs.maxclients);
|
||||
MSG_WriteByte(&net_message, NET_PROTOCOL_VERSION);
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
MSG_WriteString(net_message->message, dfunc.AddrToString(&newaddr));
|
||||
MSG_WriteString(net_message->message, hostname->string);
|
||||
MSG_WriteString(net_message->message, sv.name);
|
||||
MSG_WriteByte(net_message->message, net_activeconnections);
|
||||
MSG_WriteByte(net_message->message, svs.maxclients);
|
||||
MSG_WriteByte(net_message->message, NET_PROTOCOL_VERSION);
|
||||
*((int *)net_message->message->data) = BigLong(NETFLAG_CTL | (net_message->message->cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message->message->data, net_message->message->cursize, &clientaddr);
|
||||
SZ_Clear(net_message->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -916,7 +916,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
int clientNumber;
|
||||
client_t *client;
|
||||
|
||||
playerNumber = MSG_ReadByte();
|
||||
playerNumber = MSG_ReadByte(net_message);
|
||||
activeNumber = -1;
|
||||
for (clientNumber = 0, client = svs.clients; clientNumber < svs.maxclients; clientNumber++, client++)
|
||||
{
|
||||
|
@ -930,19 +930,19 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
if (clientNumber == svs.maxclients)
|
||||
return NULL;
|
||||
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
// save space for the header, filled in later
|
||||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREP_PLAYER_INFO);
|
||||
MSG_WriteByte(&net_message, playerNumber);
|
||||
MSG_WriteString(&net_message, client->name);
|
||||
MSG_WriteLong(&net_message, client->colors);
|
||||
MSG_WriteLong(&net_message, (int)client->edict->v.frags);
|
||||
MSG_WriteLong(&net_message, (int)(net_time - client->netconnection->connecttime));
|
||||
MSG_WriteString(&net_message, client->netconnection->address);
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
MSG_WriteLong(net_message->message, 0);
|
||||
MSG_WriteByte(net_message->message, CCREP_PLAYER_INFO);
|
||||
MSG_WriteByte(net_message->message, playerNumber);
|
||||
MSG_WriteString(net_message->message, client->name);
|
||||
MSG_WriteLong(net_message->message, client->colors);
|
||||
MSG_WriteLong(net_message->message, (int)client->edict->v.frags);
|
||||
MSG_WriteLong(net_message->message, (int)(net_time - client->netconnection->connecttime));
|
||||
MSG_WriteString(net_message->message, client->netconnection->address);
|
||||
*((int *)net_message->message->data) = BigLong(NETFLAG_CTL | (net_message->message->cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message->message->data, net_message->message->cursize, &clientaddr);
|
||||
SZ_Clear(net_message->message);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -953,7 +953,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
cvar_t *var;
|
||||
|
||||
// find the search start location
|
||||
prevCvarName = MSG_ReadString();
|
||||
prevCvarName = MSG_ReadString(net_message);
|
||||
if (*prevCvarName)
|
||||
{
|
||||
var = Cvar_FindVar (prevCvarName);
|
||||
|
@ -974,18 +974,18 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
|
||||
// send the response
|
||||
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
// save space for the header, filled in later
|
||||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREP_RULE_INFO);
|
||||
MSG_WriteLong(net_message->message, 0);
|
||||
MSG_WriteByte(net_message->message, CCREP_RULE_INFO);
|
||||
if (var)
|
||||
{
|
||||
MSG_WriteString(&net_message, var->name);
|
||||
MSG_WriteString(&net_message, var->string);
|
||||
MSG_WriteString(net_message->message, var->name);
|
||||
MSG_WriteString(net_message->message, var->string);
|
||||
}
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
*((int *)net_message->message->data) = BigLong(NETFLAG_CTL | (net_message->message->cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message->message->data, net_message->message->cursize, &clientaddr);
|
||||
SZ_Clear(net_message->message);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -993,19 +993,19 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
if (command != CCREQ_CONNECT)
|
||||
return NULL;
|
||||
|
||||
if (strcmp(MSG_ReadString(), "QUAKE") != 0)
|
||||
if (strcmp(MSG_ReadString(net_message), "QUAKE") != 0)
|
||||
return NULL;
|
||||
|
||||
if (MSG_ReadByte() != NET_PROTOCOL_VERSION)
|
||||
if (MSG_ReadByte(net_message) != NET_PROTOCOL_VERSION)
|
||||
{
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
// save space for the header, filled in later
|
||||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREP_REJECT);
|
||||
MSG_WriteString(&net_message, "Incompatible version.\n");
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
MSG_WriteLong(net_message->message, 0);
|
||||
MSG_WriteByte(net_message->message, CCREP_REJECT);
|
||||
MSG_WriteString(net_message->message, "Incompatible version.\n");
|
||||
*((int *)net_message->message->data) = BigLong(NETFLAG_CTL | (net_message->message->cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message->message->data, net_message->message->cursize, &clientaddr);
|
||||
SZ_Clear(net_message->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1017,14 +1017,14 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
testAddr = ((struct sockaddr_in *)&clientaddr)->sin_addr.s_addr;
|
||||
if ((testAddr & banMask) == banAddr)
|
||||
{
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
// save space for the header, filled in later
|
||||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREP_REJECT);
|
||||
MSG_WriteString(&net_message, "You have been banned.\n");
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
MSG_WriteLong(net_message->message, 0);
|
||||
MSG_WriteByte(net_message->message, CCREP_REJECT);
|
||||
MSG_WriteString(net_message->message, "You have been banned.\n");
|
||||
*((int *)net_message->message->data) = BigLong(NETFLAG_CTL | (net_message->message->cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message->message->data, net_message->message->cursize, &clientaddr);
|
||||
SZ_Clear(net_message->message);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1042,15 +1042,15 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
if (ret == 0 && net_time - s->connecttime < 2.0)
|
||||
{
|
||||
// yes, so send a duplicate reply
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
// save space for the header, filled in later
|
||||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREP_ACCEPT);
|
||||
MSG_WriteLong(net_message->message, 0);
|
||||
MSG_WriteByte(net_message->message, CCREP_ACCEPT);
|
||||
dfunc.GetSocketAddr(s->socket, &newaddr);
|
||||
MSG_WriteLong(&net_message, dfunc.GetSocketPort(&newaddr));
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
MSG_WriteLong(net_message->message, dfunc.GetSocketPort(&newaddr));
|
||||
*((int *)net_message->message->data) = BigLong(NETFLAG_CTL | (net_message->message->cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message->message->data, net_message->message->cursize, &clientaddr);
|
||||
SZ_Clear(net_message->message);
|
||||
return NULL;
|
||||
}
|
||||
// it's somebody coming back in from a crash/disconnect
|
||||
|
@ -1065,14 +1065,14 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
if (sock == NULL)
|
||||
{
|
||||
// no room; try to let him know
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
// save space for the header, filled in later
|
||||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREP_REJECT);
|
||||
MSG_WriteString(&net_message, "Server is full.\n");
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
MSG_WriteLong(net_message->message, 0);
|
||||
MSG_WriteByte(net_message->message, CCREP_REJECT);
|
||||
MSG_WriteString(net_message->message, "Server is full.\n");
|
||||
*((int *)net_message->message->data) = BigLong(NETFLAG_CTL | (net_message->message->cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message->message->data, net_message->message->cursize, &clientaddr);
|
||||
SZ_Clear(net_message->message);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1099,16 +1099,16 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
|
|||
strcpy(sock->address, dfunc.AddrToString(&clientaddr));
|
||||
|
||||
// send him back the info about the server connection he has been allocated
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
// save space for the header, filled in later
|
||||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREP_ACCEPT);
|
||||
MSG_WriteLong(net_message->message, 0);
|
||||
MSG_WriteByte(net_message->message, CCREP_ACCEPT);
|
||||
dfunc.GetSocketAddr(newsock, &newaddr);
|
||||
MSG_WriteLong(&net_message, dfunc.GetSocketPort(&newaddr));
|
||||
// MSG_WriteString(&net_message, dfunc.AddrToString(&newaddr));
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
|
||||
SZ_Clear(&net_message);
|
||||
MSG_WriteLong(net_message->message, dfunc.GetSocketPort(&newaddr));
|
||||
// MSG_WriteString(net_message->message, dfunc.AddrToString(&newaddr));
|
||||
*((int *)net_message->message->data) = BigLong(NETFLAG_CTL | (net_message->message->cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (acceptsock, net_message->message->data, net_message->message->cursize, &clientaddr);
|
||||
SZ_Clear(net_message->message);
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
@ -1137,22 +1137,22 @@ static void _Datagram_SearchForHosts (qboolean xmit)
|
|||
dfunc.GetSocketAddr (dfunc.controlSock, &myaddr);
|
||||
if (xmit)
|
||||
{
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
// save space for the header, filled in later
|
||||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREQ_SERVER_INFO);
|
||||
MSG_WriteString(&net_message, "QUAKE");
|
||||
MSG_WriteByte(&net_message, NET_PROTOCOL_VERSION);
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Broadcast(dfunc.controlSock, net_message.data, net_message.cursize);
|
||||
SZ_Clear(&net_message);
|
||||
MSG_WriteLong(net_message->message, 0);
|
||||
MSG_WriteByte(net_message->message, CCREQ_SERVER_INFO);
|
||||
MSG_WriteString(net_message->message, "QUAKE");
|
||||
MSG_WriteByte(net_message->message, NET_PROTOCOL_VERSION);
|
||||
*((int *)net_message->message->data) = BigLong(NETFLAG_CTL | (net_message->message->cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Broadcast(dfunc.controlSock, net_message->message->data, net_message->message->cursize);
|
||||
SZ_Clear(net_message->message);
|
||||
}
|
||||
|
||||
while ((ret = dfunc.Read (dfunc.controlSock, net_message.data, net_message.maxsize, &readaddr)) > 0)
|
||||
while ((ret = dfunc.Read (dfunc.controlSock, net_message->message->data, net_message->message->maxsize, &readaddr)) > 0)
|
||||
{
|
||||
if (ret < sizeof(int))
|
||||
continue;
|
||||
net_message.cursize = ret;
|
||||
net_message->message->cursize = ret;
|
||||
|
||||
// don't answer our own query
|
||||
if (dfunc.AddrCompare(&readaddr, &myaddr) >= 0)
|
||||
|
@ -1162,9 +1162,9 @@ static void _Datagram_SearchForHosts (qboolean xmit)
|
|||
if (hostCacheCount == HOSTCACHESIZE)
|
||||
continue;
|
||||
|
||||
MSG_BeginReading ();
|
||||
control = BigLong(*((int *)net_message.data));
|
||||
MSG_ReadLong();
|
||||
MSG_BeginReading (net_message);
|
||||
control = BigLong(*((int *)net_message->message->data));
|
||||
MSG_ReadLong(net_message);
|
||||
if (control == -1)
|
||||
continue;
|
||||
if ((control & (~NETFLAG_LENGTH_MASK)) != NETFLAG_CTL)
|
||||
|
@ -1172,10 +1172,10 @@ static void _Datagram_SearchForHosts (qboolean xmit)
|
|||
if ((control & NETFLAG_LENGTH_MASK) != ret)
|
||||
continue;
|
||||
|
||||
if (MSG_ReadByte() != CCREP_SERVER_INFO)
|
||||
if (MSG_ReadByte(net_message) != CCREP_SERVER_INFO)
|
||||
continue;
|
||||
|
||||
dfunc.GetAddrFromName(MSG_ReadString(), &readaddr);
|
||||
dfunc.GetAddrFromName(MSG_ReadString(net_message), &readaddr);
|
||||
// search the cache for this server
|
||||
for (n = 0; n < hostCacheCount; n++)
|
||||
if (dfunc.AddrCompare(&readaddr, &hostcache[n].addr) == 0)
|
||||
|
@ -1187,11 +1187,11 @@ static void _Datagram_SearchForHosts (qboolean xmit)
|
|||
|
||||
// add it
|
||||
hostCacheCount++;
|
||||
strcpy(hostcache[n].name, MSG_ReadString());
|
||||
strcpy(hostcache[n].map, MSG_ReadString());
|
||||
hostcache[n].users = MSG_ReadByte();
|
||||
hostcache[n].maxusers = MSG_ReadByte();
|
||||
if (MSG_ReadByte() != NET_PROTOCOL_VERSION)
|
||||
strcpy(hostcache[n].name, MSG_ReadString(net_message));
|
||||
strcpy(hostcache[n].map, MSG_ReadString(net_message));
|
||||
hostcache[n].users = MSG_ReadByte(net_message);
|
||||
hostcache[n].maxusers = MSG_ReadByte(net_message);
|
||||
if (MSG_ReadByte(net_message) != NET_PROTOCOL_VERSION)
|
||||
{
|
||||
strcpy(hostcache[n].cname, hostcache[n].name);
|
||||
hostcache[n].cname[14] = 0;
|
||||
|
@ -1272,18 +1272,18 @@ static qsocket_t *_Datagram_Connect (char *host)
|
|||
|
||||
for (reps = 0; reps < 3; reps++)
|
||||
{
|
||||
SZ_Clear(&net_message);
|
||||
SZ_Clear(net_message->message);
|
||||
// save space for the header, filled in later
|
||||
MSG_WriteLong(&net_message, 0);
|
||||
MSG_WriteByte(&net_message, CCREQ_CONNECT);
|
||||
MSG_WriteString(&net_message, "QUAKE");
|
||||
MSG_WriteByte(&net_message, NET_PROTOCOL_VERSION);
|
||||
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (newsock, net_message.data, net_message.cursize, &sendaddr);
|
||||
SZ_Clear(&net_message);
|
||||
MSG_WriteLong(net_message->message, 0);
|
||||
MSG_WriteByte(net_message->message, CCREQ_CONNECT);
|
||||
MSG_WriteString(net_message->message, "QUAKE");
|
||||
MSG_WriteByte(net_message->message, NET_PROTOCOL_VERSION);
|
||||
*((int *)net_message->message->data) = BigLong(NETFLAG_CTL | (net_message->message->cursize & NETFLAG_LENGTH_MASK));
|
||||
dfunc.Write (newsock, net_message->message->data, net_message->message->cursize, &sendaddr);
|
||||
SZ_Clear(net_message->message);
|
||||
do
|
||||
{
|
||||
ret = dfunc.Read (newsock, net_message.data, net_message.maxsize, &readaddr);
|
||||
ret = dfunc.Read (newsock, net_message->message->data, net_message->message->maxsize, &readaddr);
|
||||
// if we got something, validate it
|
||||
if (ret > 0)
|
||||
{
|
||||
|
@ -1306,11 +1306,11 @@ static qsocket_t *_Datagram_Connect (char *host)
|
|||
continue;
|
||||
}
|
||||
|
||||
net_message.cursize = ret;
|
||||
MSG_BeginReading ();
|
||||
net_message->message->cursize = ret;
|
||||
MSG_BeginReading (net_message);
|
||||
|
||||
control = BigLong(*((int *)net_message.data));
|
||||
MSG_ReadLong();
|
||||
control = BigLong(*((int *)net_message->message->data));
|
||||
MSG_ReadLong(net_message);
|
||||
if (control == -1)
|
||||
{
|
||||
ret = 0;
|
||||
|
@ -1351,10 +1351,10 @@ static qsocket_t *_Datagram_Connect (char *host)
|
|||
goto ErrorReturn;
|
||||
}
|
||||
|
||||
ret = MSG_ReadByte();
|
||||
ret = MSG_ReadByte(net_message);
|
||||
if (ret == CCREP_REJECT)
|
||||
{
|
||||
reason = MSG_ReadString();
|
||||
reason = MSG_ReadString(net_message);
|
||||
Con_Printf(reason);
|
||||
strncpy(m_return_reason, reason, 31);
|
||||
goto ErrorReturn;
|
||||
|
@ -1363,7 +1363,7 @@ static qsocket_t *_Datagram_Connect (char *host)
|
|||
if (ret == CCREP_ACCEPT)
|
||||
{
|
||||
memcpy(&sock->addr, &sendaddr, sizeof(struct qsockaddr));
|
||||
dfunc.SetSocketPort (&sock->addr, MSG_ReadLong());
|
||||
dfunc.SetSocketPort (&sock->addr, MSG_ReadLong(net_message));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "msg.h"
|
||||
#include "net.h"
|
||||
#include "net_loop.h"
|
||||
#include "client.h"
|
||||
|
@ -150,8 +151,8 @@ int Loop_GetMessage (qsocket_t *sock)
|
|||
ret = sock->receiveMessage[0];
|
||||
length = sock->receiveMessage[1] + (sock->receiveMessage[2] << 8);
|
||||
// alignment byte skipped here
|
||||
SZ_Clear (&net_message);
|
||||
SZ_Write (&net_message, &sock->receiveMessage[4], length);
|
||||
SZ_Clear (net_message->message);
|
||||
SZ_Write (net_message->message, &sock->receiveMessage[4], length);
|
||||
|
||||
length = IntAlign(length + 4);
|
||||
sock->receiveMessageLength -= length;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "cmd.h"
|
||||
#include "msg.h"
|
||||
#include "net.h"
|
||||
#include "net_vcr.h"
|
||||
#include "qargs.h"
|
||||
|
@ -74,7 +75,9 @@ PollProcedure slistSendProcedure = {NULL, 0.0, Slist_Send};
|
|||
PollProcedure slistPollProcedure = {NULL, 0.0, Slist_Poll};
|
||||
|
||||
|
||||
sizebuf_t net_message;
|
||||
static sizebuf_t _net_message_message;
|
||||
static msg_t _net_message = {0, 0, &_net_message_message};
|
||||
msg_t *net_message = &_net_message;
|
||||
int net_activeconnections = 0;
|
||||
|
||||
int messagesSent = 0;
|
||||
|
@ -597,9 +600,9 @@ int NET_GetMessage (qsocket_t *sock)
|
|||
vcrGetMessage.op = VCR_OP_GETMESSAGE;
|
||||
vcrGetMessage.session = (long)sock;
|
||||
vcrGetMessage.ret = ret;
|
||||
vcrGetMessage.len = net_message.cursize;
|
||||
vcrGetMessage.len = _net_message_message.cursize;
|
||||
Sys_FileWrite (vcrFile, &vcrGetMessage, 24);
|
||||
Sys_FileWrite (vcrFile, net_message.data, net_message.cursize);
|
||||
Sys_FileWrite (vcrFile, _net_message_message.data, _net_message_message.cursize);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -863,7 +866,7 @@ void NET_Init (void)
|
|||
}
|
||||
|
||||
// allocate space for network message buffer
|
||||
SZ_Alloc (&net_message, NET_MAXMESSAGE);
|
||||
SZ_Alloc (&_net_message_message, NET_MAXMESSAGE);
|
||||
|
||||
net_messagetimeout = Cvar_Get("net_messagetimeout", "300", CVAR_NONE, "None");
|
||||
hostname = Cvar_Get("hostname", "UNNAMED", CVAR_NONE, "None");
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "msg.h"
|
||||
#include "net.h"
|
||||
#include "net_vcr.h"
|
||||
#include "sys.h"
|
||||
|
@ -101,8 +102,8 @@ int VCR_GetMessage (qsocket_t *sock)
|
|||
return ret;
|
||||
}
|
||||
|
||||
Sys_FileRead(vcrFile, &net_message.cursize, sizeof(int));
|
||||
Sys_FileRead(vcrFile, net_message.data, net_message.cursize);
|
||||
Sys_FileRead(vcrFile, &net_message->message->cursize, sizeof(int));
|
||||
Sys_FileRead(vcrFile, net_message->message->data, net_message->message->cursize);
|
||||
|
||||
VCR_ReadNext ();
|
||||
|
||||
|
|
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
qendian.c
|
||||
|
||||
(description)
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||
Please see the file "AUTHORS" for a list of contributors
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <qtypes.h>
|
||||
|
||||
/*
|
||||
============================================================================
|
||||
|
||||
BYTE ORDER FUNCTIONS
|
||||
|
||||
============================================================================
|
||||
*/
|
||||
|
||||
qboolean bigendien;
|
||||
short (*BigShort) (short l);
|
||||
short (*LittleShort) (short l);
|
||||
int (*BigLong) (int l);
|
||||
int (*LittleLong) (int l);
|
||||
float (*BigFloat) (float l);
|
||||
float (*LittleFloat) (float l);
|
||||
|
||||
short ShortSwap (short l)
|
||||
{
|
||||
byte b1,b2;
|
||||
|
||||
b1 = l&255;
|
||||
b2 = (l>>8)&255;
|
||||
|
||||
return (b1<<8) + b2;
|
||||
}
|
||||
|
||||
short ShortNoSwap (short l)
|
||||
{
|
||||
return l;
|
||||
}
|
||||
|
||||
int LongSwap (int l)
|
||||
{
|
||||
byte b1,b2,b3,b4;
|
||||
|
||||
b1 = l&255;
|
||||
b2 = (l>>8)&255;
|
||||
b3 = (l>>16)&255;
|
||||
b4 = (l>>24)&255;
|
||||
|
||||
return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4;
|
||||
}
|
||||
|
||||
int LongNoSwap (int l)
|
||||
{
|
||||
return l;
|
||||
}
|
||||
|
||||
float FloatSwap (float f)
|
||||
{
|
||||
union
|
||||
{
|
||||
float f;
|
||||
byte b[4];
|
||||
} dat1, dat2;
|
||||
|
||||
|
||||
dat1.f = f;
|
||||
dat2.b[0] = dat1.b[3];
|
||||
dat2.b[1] = dat1.b[2];
|
||||
dat2.b[2] = dat1.b[1];
|
||||
dat2.b[3] = dat1.b[0];
|
||||
return dat2.f;
|
||||
}
|
||||
|
||||
float FloatNoSwap (float f)
|
||||
{
|
||||
return f;
|
||||
}
|
|
@ -273,11 +273,11 @@ void R_ParseParticleEffect (void)
|
|||
int i, count, msgcount, color;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
org[i] = MSG_ReadCoord ();
|
||||
org[i] = MSG_ReadCoord (net_message);
|
||||
for (i=0 ; i<3 ; i++)
|
||||
dir[i] = MSG_ReadChar () * (1.0/16);
|
||||
msgcount = MSG_ReadByte ();
|
||||
color = MSG_ReadByte ();
|
||||
dir[i] = MSG_ReadChar (net_message) * (1.0/16);
|
||||
msgcount = MSG_ReadByte (net_message);
|
||||
color = MSG_ReadByte (net_message);
|
||||
|
||||
if (msgcount == 255)
|
||||
count = 1024;
|
||||
|
|
|
@ -283,10 +283,10 @@ void V_ParseDamage (void)
|
|||
float side;
|
||||
float count;
|
||||
|
||||
armor = MSG_ReadByte ();
|
||||
blood = MSG_ReadByte ();
|
||||
armor = MSG_ReadByte (net_message);
|
||||
blood = MSG_ReadByte (net_message);
|
||||
for (i=0 ; i<3 ; i++)
|
||||
from[i] = MSG_ReadCoord ();
|
||||
from[i] = MSG_ReadCoord (net_message);
|
||||
|
||||
count = blood*0.5 + armor*0.5;
|
||||
if (count < 10)
|
||||
|
|
|
@ -460,32 +460,32 @@ void SV_ReadClientMove (usercmd_t *move)
|
|||
|
||||
// read ping time
|
||||
host_client->ping_times[host_client->num_pings%NUM_PING_TIMES]
|
||||
= sv.time - MSG_ReadFloat ();
|
||||
= sv.time - MSG_ReadFloat (net_message);
|
||||
host_client->num_pings++;
|
||||
|
||||
// read current angles
|
||||
for (i=0 ; i<3 ; i++)
|
||||
angle[i] = MSG_ReadAngle ();
|
||||
angle[i] = MSG_ReadAngle (net_message);
|
||||
|
||||
VectorCopy (angle, host_client->edict->v.v_angle);
|
||||
|
||||
// read movement
|
||||
move->forwardmove = MSG_ReadShort ();
|
||||
move->sidemove = MSG_ReadShort ();
|
||||
move->upmove = MSG_ReadShort ();
|
||||
move->forwardmove = MSG_ReadShort (net_message);
|
||||
move->sidemove = MSG_ReadShort (net_message);
|
||||
move->upmove = MSG_ReadShort (net_message);
|
||||
|
||||
// read buttons
|
||||
bits = MSG_ReadByte ();
|
||||
bits = MSG_ReadByte (net_message);
|
||||
host_client->edict->v.button0 = bits & 1;
|
||||
host_client->edict->v.button2 = (bits & 2)>>1;
|
||||
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i)
|
||||
host_client->edict->v.impulse = i;
|
||||
|
||||
#ifdef QUAKE2
|
||||
// read light level
|
||||
host_client->edict->v.light_level = MSG_ReadByte ();
|
||||
host_client->edict->v.light_level = MSG_ReadByte (net_message);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -514,20 +514,20 @@ nextmsg:
|
|||
if (!ret)
|
||||
return true;
|
||||
|
||||
MSG_BeginReading ();
|
||||
MSG_BeginReading (net_message);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (!host_client->active)
|
||||
return false; // a command caused an error
|
||||
|
||||
if (msg_badread)
|
||||
if (net_message->badread)
|
||||
{
|
||||
Sys_Printf ("SV_ReadClientMessage: badread\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
cmd = MSG_ReadChar ();
|
||||
cmd = MSG_ReadChar (net_message);
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
|
@ -543,7 +543,7 @@ nextmsg:
|
|||
break;
|
||||
|
||||
case clc_stringcmd:
|
||||
s = MSG_ReadString ();
|
||||
s = MSG_ReadString (net_message);
|
||||
if (host_client->privileged)
|
||||
ret = 2;
|
||||
else
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
link.h
|
||||
msg_ucmd.h
|
||||
|
||||
(description)
|
||||
|
||||
|
@ -25,23 +25,14 @@
|
|||
|
||||
$Id$
|
||||
*/
|
||||
#ifndef __msg_ucmd_h
|
||||
#define __msg_ucmd_h
|
||||
|
||||
#ifndef _LINK_H
|
||||
#define _LINK_H
|
||||
#include "sizebuf.h"
|
||||
|
||||
// (type *)STRUCT_FROM_LINK(link_t *link, type, member)
|
||||
// ent = STRUCT_FROM_LINK(link,entity_t,order)
|
||||
// FIXME: remove this mess!
|
||||
#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m)))
|
||||
extern struct usercmd_s nullcmd;
|
||||
|
||||
typedef struct link_s
|
||||
{
|
||||
struct link_s *prev, *next;
|
||||
} link_t;
|
||||
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 ClearLink (link_t *l);
|
||||
void RemoveLink (link_t *l);
|
||||
void InsertLinkBefore (link_t *l, link_t *before);
|
||||
void InsertLinkAfter (link_t *l, link_t *after);
|
||||
|
||||
#endif // _LINK_H
|
||||
#endif // __msg_ucmd_h
|
|
@ -48,7 +48,7 @@ typedef struct
|
|||
|
||||
extern netadr_t net_local_adr;
|
||||
extern netadr_t net_from; // address of who sent the packet
|
||||
extern sizebuf_t net_message;
|
||||
extern struct msg_s *net_message;
|
||||
|
||||
extern cvar_t *hostname;
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ if ASM_ARCH
|
|||
math_ASM = math.S sys_x86.S
|
||||
endif
|
||||
common_SOURCES= buildnum.c com.c \
|
||||
info.c link.c mathlib.c model.c model_brush.c \
|
||||
msg.c pmove.c pmovetst.c qargs.c qendian.c quakefs.c quakeio.c \
|
||||
mathlib.c model.c model_brush.c msg_ucmd.c \
|
||||
pmove.c pmovetst.c quakefs.c quakeio.c \
|
||||
$(math_ASM) $(packetlogger)
|
||||
|
||||
#
|
||||
|
|
|
@ -246,14 +246,14 @@ CL_GetDemoMessage (void)
|
|||
|
||||
case dem_read:
|
||||
// get the next message
|
||||
Qread (cls.demofile, &net_message.cursize, 4);
|
||||
net_message.cursize = LittleLong (net_message.cursize);
|
||||
// Con_Printf("read: %ld bytes\n", net_message.cursize);
|
||||
if (net_message.cursize > MAX_MSGLEN)
|
||||
Qread (cls.demofile, &net_message->message->cursize, 4);
|
||||
net_message->message->cursize = LittleLong (net_message->message->cursize);
|
||||
// Con_Printf("read: %ld bytes\n", net_message->message->cursize);
|
||||
if (net_message->message->cursize > MAX_MSGLEN)
|
||||
// Sys_Error ("Demo message > MAX_MSGLEN");
|
||||
Host_EndGame ("Demo message > MAX_MSGLEN");
|
||||
r = Qread (cls.demofile, net_message.data, net_message.cursize);
|
||||
if (r != net_message.cursize) {
|
||||
r = Qread (cls.demofile, net_message->message->data, net_message->message->cursize);
|
||||
if (r != net_message->message->cursize) {
|
||||
CL_StopPlayback ();
|
||||
return 0;
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ CL_GetMessage (void)
|
|||
if (!NET_GetPacket ())
|
||||
return false;
|
||||
|
||||
CL_WriteDemoMessage (&net_message);
|
||||
CL_WriteDemoMessage (net_message->message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -308,11 +308,11 @@ CL_Stop_f (void)
|
|||
return;
|
||||
}
|
||||
// write a disconnect message to the demo file
|
||||
SZ_Clear (&net_message);
|
||||
MSG_WriteLong (&net_message, -1); // -1 sequence means out of band
|
||||
MSG_WriteByte (&net_message, svc_disconnect);
|
||||
MSG_WriteString (&net_message, "EndOfDemo");
|
||||
CL_WriteDemoMessage (&net_message);
|
||||
SZ_Clear (net_message->message);
|
||||
MSG_WriteLong (net_message->message, -1); // -1 sequence means out of band
|
||||
MSG_WriteByte (net_message->message, svc_disconnect);
|
||||
MSG_WriteString (net_message->message, "EndOfDemo");
|
||||
CL_WriteDemoMessage (net_message->message);
|
||||
|
||||
// finish up
|
||||
Qclose (cls.demofile);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "d_iface.h"
|
||||
#include "host.h"
|
||||
#include "msg.h"
|
||||
#include "msg_ucmd.h"
|
||||
#include "pmove.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "view.h"
|
||||
|
@ -209,7 +210,7 @@ CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits)
|
|||
bits &= ~511;
|
||||
|
||||
if (bits & U_MOREBITS) { // read in the low order bits
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
bits |= i;
|
||||
}
|
||||
// count the bits for net profiling
|
||||
|
@ -220,64 +221,64 @@ CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits)
|
|||
// LordHavoc: Endy neglected to mark this as being part of the QSG
|
||||
// version 2 stuff...
|
||||
if (bits & U_EXTEND1) {
|
||||
bits |= MSG_ReadByte () << 16;
|
||||
bits |= MSG_ReadByte (net_message) << 16;
|
||||
if (bits & U_EXTEND2)
|
||||
bits |= MSG_ReadByte () << 24;
|
||||
bits |= MSG_ReadByte (net_message) << 24;
|
||||
}
|
||||
|
||||
to->flags = bits;
|
||||
|
||||
if (bits & U_MODEL)
|
||||
to->modelindex = MSG_ReadByte ();
|
||||
to->modelindex = MSG_ReadByte (net_message);
|
||||
|
||||
if (bits & U_FRAME)
|
||||
to->frame = MSG_ReadByte ();
|
||||
to->frame = MSG_ReadByte (net_message);
|
||||
|
||||
if (bits & U_COLORMAP)
|
||||
to->colormap = MSG_ReadByte ();
|
||||
to->colormap = MSG_ReadByte (net_message);
|
||||
|
||||
if (bits & U_SKIN)
|
||||
to->skinnum = MSG_ReadByte ();
|
||||
to->skinnum = MSG_ReadByte (net_message);
|
||||
|
||||
if (bits & U_EFFECTS)
|
||||
to->effects = MSG_ReadByte ();
|
||||
to->effects = MSG_ReadByte (net_message);
|
||||
|
||||
if (bits & U_ORIGIN1)
|
||||
to->origin[0] = MSG_ReadCoord ();
|
||||
to->origin[0] = MSG_ReadCoord (net_message);
|
||||
|
||||
if (bits & U_ANGLE1)
|
||||
to->angles[0] = MSG_ReadAngle ();
|
||||
to->angles[0] = MSG_ReadAngle (net_message);
|
||||
|
||||
if (bits & U_ORIGIN2)
|
||||
to->origin[1] = MSG_ReadCoord ();
|
||||
to->origin[1] = MSG_ReadCoord (net_message);
|
||||
|
||||
if (bits & U_ANGLE2)
|
||||
to->angles[1] = MSG_ReadAngle ();
|
||||
to->angles[1] = MSG_ReadAngle (net_message);
|
||||
|
||||
if (bits & U_ORIGIN3)
|
||||
to->origin[2] = MSG_ReadCoord ();
|
||||
to->origin[2] = MSG_ReadCoord (net_message);
|
||||
|
||||
if (bits & U_ANGLE3)
|
||||
to->angles[2] = MSG_ReadAngle ();
|
||||
to->angles[2] = MSG_ReadAngle (net_message);
|
||||
|
||||
// LordHavoc: Endy neglected to mark this as being part of the QSG
|
||||
// version 2 stuff...
|
||||
// rearranged it and implemented missing effects
|
||||
// Ender (QSG - Begin)
|
||||
if (bits & U_ALPHA)
|
||||
to->alpha = MSG_ReadByte ();
|
||||
to->alpha = MSG_ReadByte (net_message);
|
||||
if (bits & U_SCALE)
|
||||
to->scale = MSG_ReadByte ();
|
||||
to->scale = MSG_ReadByte (net_message);
|
||||
if (bits & U_EFFECTS2)
|
||||
to->effects = (to->effects & 0xFF) | (MSG_ReadByte () << 8);
|
||||
to->effects = (to->effects & 0xFF) | (MSG_ReadByte (net_message) << 8);
|
||||
if (bits & U_GLOWSIZE)
|
||||
to->glowsize = MSG_ReadByte ();
|
||||
to->glowsize = MSG_ReadByte (net_message);
|
||||
if (bits & U_GLOWCOLOR)
|
||||
to->glowcolor = MSG_ReadByte ();
|
||||
to->glowcolor = MSG_ReadByte (net_message);
|
||||
if (bits & U_COLORMOD)
|
||||
to->colormod = MSG_ReadByte ();
|
||||
to->colormod = MSG_ReadByte (net_message);
|
||||
if (bits & U_FRAME2)
|
||||
to->frame = (to->frame & 0xFF) | (MSG_ReadByte () << 8);
|
||||
to->frame = (to->frame & 0xFF) | (MSG_ReadByte (net_message) << 8);
|
||||
// Ender (QSG - End)
|
||||
|
||||
if (bits & U_SOLID) {
|
||||
|
@ -312,8 +313,8 @@ FlushEntityPacket (void)
|
|||
|
||||
// read it all, but ignore it
|
||||
while (1) {
|
||||
word = (unsigned short) MSG_ReadShort ();
|
||||
if (msg_badread) { // something didn't parse right...
|
||||
word = (unsigned short) MSG_ReadShort (net_message);
|
||||
if (net_message->badread) { // something didn't parse right...
|
||||
Host_EndGame ("msg_badread in packetentities");
|
||||
return;
|
||||
}
|
||||
|
@ -346,7 +347,7 @@ CL_ParsePacketEntities (qboolean delta)
|
|||
cl.frames[newpacket].invalid = false;
|
||||
|
||||
if (delta) {
|
||||
from = MSG_ReadByte ();
|
||||
from = MSG_ReadByte (net_message);
|
||||
|
||||
oldpacket = cl.frames[newpacket].delta_sequence;
|
||||
|
||||
|
@ -376,8 +377,8 @@ CL_ParsePacketEntities (qboolean delta)
|
|||
newp->num_entities = 0;
|
||||
|
||||
while (1) {
|
||||
word = (unsigned short) MSG_ReadShort ();
|
||||
if (msg_badread) { // something didn't parse right...
|
||||
word = (unsigned short) MSG_ReadShort (net_message);
|
||||
if (net_message->badread) { // something didn't parse right...
|
||||
Host_EndGame ("msg_badread in packetentities");
|
||||
return;
|
||||
}
|
||||
|
@ -618,10 +619,10 @@ CL_ParseProjectiles (void)
|
|||
byte bits[6];
|
||||
projectile_t *pr;
|
||||
|
||||
c = MSG_ReadByte ();
|
||||
c = MSG_ReadByte (net_message);
|
||||
for (i = 0; i < c; i++) {
|
||||
for (j = 0; j < 6; j++)
|
||||
bits[j] = MSG_ReadByte ();
|
||||
bits[j] = MSG_ReadByte (net_message);
|
||||
|
||||
if (cl_num_projectiles == MAX_PROJECTILES)
|
||||
continue;
|
||||
|
@ -690,7 +691,7 @@ CL_ParsePlayerinfo (void)
|
|||
int num;
|
||||
int i;
|
||||
|
||||
num = MSG_ReadByte ();
|
||||
num = MSG_ReadByte (net_message);
|
||||
if (num > MAX_CLIENTS)
|
||||
// Sys_Error ("CL_ParsePlayerinfo: bad num");
|
||||
Host_EndGame ("CL_ParsePlayerinfo: bad num");
|
||||
|
@ -698,20 +699,20 @@ CL_ParsePlayerinfo (void)
|
|||
state = &cl.frames[parsecountmod].playerstate[num];
|
||||
|
||||
state->number = num;
|
||||
flags = state->flags = MSG_ReadShort ();
|
||||
flags = state->flags = MSG_ReadShort (net_message);
|
||||
|
||||
state->messagenum = cl.parsecount;
|
||||
state->origin[0] = MSG_ReadCoord ();
|
||||
state->origin[1] = MSG_ReadCoord ();
|
||||
state->origin[2] = MSG_ReadCoord ();
|
||||
state->origin[0] = MSG_ReadCoord (net_message);
|
||||
state->origin[1] = MSG_ReadCoord (net_message);
|
||||
state->origin[2] = MSG_ReadCoord (net_message);
|
||||
|
||||
state->frame = MSG_ReadByte ();
|
||||
state->frame = MSG_ReadByte (net_message);
|
||||
|
||||
// the other player's last move was likely some time
|
||||
// before the packet was sent out, so accurately track
|
||||
// the exact time it was valid at
|
||||
if (flags & PF_MSEC) {
|
||||
msec = MSG_ReadByte ();
|
||||
msec = MSG_ReadByte (net_message);
|
||||
state->state_time = parsecounttime - msec * 0.001;
|
||||
} else
|
||||
state->state_time = parsecounttime;
|
||||
|
@ -721,27 +722,27 @@ CL_ParsePlayerinfo (void)
|
|||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (flags & (PF_VELOCITY1 << i))
|
||||
state->velocity[i] = MSG_ReadShort ();
|
||||
state->velocity[i] = MSG_ReadShort (net_message);
|
||||
else
|
||||
state->velocity[i] = 0;
|
||||
}
|
||||
if (flags & PF_MODEL)
|
||||
state->modelindex = MSG_ReadByte ();
|
||||
state->modelindex = MSG_ReadByte (net_message);
|
||||
else
|
||||
state->modelindex = cl_playerindex;
|
||||
|
||||
if (flags & PF_SKINNUM)
|
||||
state->skinnum = MSG_ReadByte ();
|
||||
state->skinnum = MSG_ReadByte (net_message);
|
||||
else
|
||||
state->skinnum = 0;
|
||||
|
||||
if (flags & PF_EFFECTS)
|
||||
state->effects = MSG_ReadByte ();
|
||||
state->effects = MSG_ReadByte (net_message);
|
||||
else
|
||||
state->effects = 0;
|
||||
|
||||
if (flags & PF_WEAPONFRAME)
|
||||
state->weaponframe = MSG_ReadByte ();
|
||||
state->weaponframe = MSG_ReadByte (net_message);
|
||||
else
|
||||
state->weaponframe = 0;
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "input.h"
|
||||
#include "keys.h"
|
||||
#include "msg.h"
|
||||
#include "msg_ucmd.h"
|
||||
#include "teamplay.h"
|
||||
#include "view.h"
|
||||
|
||||
|
|
|
@ -854,10 +854,10 @@ CL_ConnectionlessPacket (void)
|
|||
char *s;
|
||||
int c;
|
||||
|
||||
MSG_BeginReading ();
|
||||
MSG_ReadLong (); // skip the -1
|
||||
MSG_BeginReading (net_message);
|
||||
MSG_ReadLong (net_message); // skip the -1
|
||||
|
||||
c = MSG_ReadByte ();
|
||||
c = MSG_ReadByte (net_message);
|
||||
if (!cls.demoplayback)
|
||||
Con_Printf ("%s: ", NET_AdrToString (net_from));
|
||||
// Con_DPrintf ("%s", net_message.data + 5);
|
||||
|
@ -889,12 +889,12 @@ CL_ConnectionlessPacket (void)
|
|||
Con_Printf ("Command packet from remote host. Ignored.\n");
|
||||
return;
|
||||
}
|
||||
s = MSG_ReadString ();
|
||||
s = MSG_ReadString (net_message);
|
||||
|
||||
strncpy (cmdtext, s, sizeof (cmdtext) - 1);
|
||||
cmdtext[sizeof (cmdtext) - 1] = 0;
|
||||
|
||||
s = MSG_ReadString ();
|
||||
s = MSG_ReadString (net_message);
|
||||
|
||||
while (*s && isspace ((int) *s))
|
||||
s++;
|
||||
|
@ -931,7 +931,7 @@ CL_ConnectionlessPacket (void)
|
|||
if (c == A2C_PRINT) {
|
||||
netadr_t addy;
|
||||
server_entry_t *temp;
|
||||
s = MSG_ReadString ();
|
||||
s = MSG_ReadString (net_message);
|
||||
for (temp = slist; temp; temp = temp->next)
|
||||
if (temp->waitstatus)
|
||||
{
|
||||
|
@ -976,7 +976,7 @@ CL_ConnectionlessPacket (void)
|
|||
if (c == S2C_CHALLENGE) {
|
||||
Con_Printf ("challenge\n");
|
||||
|
||||
s = MSG_ReadString ();
|
||||
s = MSG_ReadString (net_message);
|
||||
cls.challenge = atoi (s);
|
||||
if (strstr (s, "QF"))
|
||||
CL_AddQFInfoKeys ();
|
||||
|
@ -1001,7 +1001,7 @@ CL_PingPacket (void)
|
|||
{
|
||||
server_entry_t *temp;
|
||||
netadr_t addy;
|
||||
MSG_ReadByte ();;
|
||||
MSG_ReadByte (net_message);;
|
||||
for (temp = slist; temp; temp = temp->next)
|
||||
if (temp->pingsent && !temp->pongback) {
|
||||
NET_StringToAdr (temp->server, &addy);
|
||||
|
@ -1027,16 +1027,16 @@ CL_ReadPackets (void)
|
|||
//
|
||||
// remote command packet
|
||||
//
|
||||
if (*(int *) net_message.data == -1) {
|
||||
if (*(int *) net_message->message->data == -1) {
|
||||
CL_ConnectionlessPacket ();
|
||||
continue;
|
||||
}
|
||||
if (*(char *) net_message.data == A2A_ACK)
|
||||
if (*(char *) net_message->message->data == A2A_ACK)
|
||||
{
|
||||
CL_PingPacket ();
|
||||
continue;
|
||||
}
|
||||
if (net_message.cursize < 8) {
|
||||
if (net_message->message->cursize < 8) {
|
||||
Con_Printf ("%s: Runt packet\n", NET_AdrToString (net_from));
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -391,12 +391,12 @@ CL_ParseDownload (void)
|
|||
|
||||
|
||||
// read the data
|
||||
size = MSG_ReadShort ();
|
||||
percent = MSG_ReadByte ();
|
||||
size = MSG_ReadShort (net_message);
|
||||
percent = MSG_ReadByte (net_message);
|
||||
|
||||
if (cls.demoplayback) {
|
||||
if (size > 0)
|
||||
msg_readcount += size;
|
||||
net_message->readcount += size;
|
||||
return; // not in demo playback
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,7 @@ CL_ParseDownload (void)
|
|||
}
|
||||
|
||||
if (size == -2) {
|
||||
char *newname = MSG_ReadString ();
|
||||
char *newname = MSG_ReadString (net_message);
|
||||
|
||||
if (strncmp (newname, cls.downloadname, strlen (cls.downloadname))
|
||||
|| strstr (newname + strlen (cls.downloadname), "/")) {
|
||||
|
@ -443,15 +443,15 @@ CL_ParseDownload (void)
|
|||
|
||||
cls.download = Qopen (name, "wb");
|
||||
if (!cls.download) {
|
||||
msg_readcount += size;
|
||||
net_message->readcount += size;
|
||||
Con_Printf ("Failed to open %s\n", cls.downloadtempname);
|
||||
CL_RequestNextDownload ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Qwrite (cls.download, net_message.data + msg_readcount, size);
|
||||
msg_readcount += size;
|
||||
Qwrite (cls.download, net_message->message->data + net_message->readcount, size);
|
||||
net_message->readcount += size;
|
||||
|
||||
if (percent != 100) {
|
||||
// change display routines by zoid
|
||||
|
@ -614,7 +614,7 @@ CL_ParseServerData (void)
|
|||
|
||||
// parse protocol version number
|
||||
// allow 2.2 and 2.29 demos to play
|
||||
protover = MSG_ReadLong ();
|
||||
protover = MSG_ReadLong (net_message);
|
||||
if (protover != PROTOCOL_VERSION &&
|
||||
!(cls.demoplayback
|
||||
&& (protover <= 26 && protover >= 28)))
|
||||
|
@ -622,10 +622,10 @@ CL_ParseServerData (void)
|
|||
("Server returned version %i, not %i\nYou probably need to upgrade.\nCheck http://www.quakeworld.net/",
|
||||
protover, PROTOCOL_VERSION);
|
||||
|
||||
cl.servercount = MSG_ReadLong ();
|
||||
cl.servercount = MSG_ReadLong (net_message);
|
||||
|
||||
// game directory
|
||||
str = MSG_ReadString ();
|
||||
str = MSG_ReadString (net_message);
|
||||
|
||||
if (!strequal (gamedirfile, str)) {
|
||||
// save current config
|
||||
|
@ -651,26 +651,26 @@ CL_ParseServerData (void)
|
|||
Cbuf_AddText (fn);
|
||||
}
|
||||
// parse player slot, high bit means spectator
|
||||
cl.playernum = MSG_ReadByte ();
|
||||
cl.playernum = MSG_ReadByte (net_message);
|
||||
if (cl.playernum & 128) {
|
||||
cl.spectator = true;
|
||||
cl.playernum &= ~128;
|
||||
}
|
||||
// get the full level name
|
||||
str = MSG_ReadString ();
|
||||
str = MSG_ReadString (net_message);
|
||||
strncpy (cl.levelname, str, sizeof (cl.levelname) - 1);
|
||||
|
||||
// get the movevars
|
||||
movevars.gravity = MSG_ReadFloat ();
|
||||
movevars.stopspeed = MSG_ReadFloat ();
|
||||
movevars.maxspeed = MSG_ReadFloat ();
|
||||
movevars.spectatormaxspeed = MSG_ReadFloat ();
|
||||
movevars.accelerate = MSG_ReadFloat ();
|
||||
movevars.airaccelerate = MSG_ReadFloat ();
|
||||
movevars.wateraccelerate = MSG_ReadFloat ();
|
||||
movevars.friction = MSG_ReadFloat ();
|
||||
movevars.waterfriction = MSG_ReadFloat ();
|
||||
movevars.entgravity = MSG_ReadFloat ();
|
||||
movevars.gravity = MSG_ReadFloat (net_message);
|
||||
movevars.stopspeed = MSG_ReadFloat (net_message);
|
||||
movevars.maxspeed = MSG_ReadFloat (net_message);
|
||||
movevars.spectatormaxspeed = MSG_ReadFloat (net_message);
|
||||
movevars.accelerate = MSG_ReadFloat (net_message);
|
||||
movevars.airaccelerate = MSG_ReadFloat (net_message);
|
||||
movevars.wateraccelerate = MSG_ReadFloat (net_message);
|
||||
movevars.friction = MSG_ReadFloat (net_message);
|
||||
movevars.waterfriction = MSG_ReadFloat (net_message);
|
||||
movevars.entgravity = MSG_ReadFloat (net_message);
|
||||
|
||||
// seperate the printfs so the server message can have a color
|
||||
Con_Printf
|
||||
|
@ -718,10 +718,10 @@ CL_ParseSoundlist (void)
|
|||
// precache sounds
|
||||
// memset (cl.sound_precache, 0, sizeof(cl.sound_precache));
|
||||
|
||||
numsounds = MSG_ReadByte ();
|
||||
numsounds = MSG_ReadByte (net_message);
|
||||
|
||||
for (;;) {
|
||||
str = MSG_ReadString ();
|
||||
str = MSG_ReadString (net_message);
|
||||
if (!str[0])
|
||||
break;
|
||||
numsounds++;
|
||||
|
@ -730,7 +730,7 @@ CL_ParseSoundlist (void)
|
|||
strcpy (cl.sound_name[numsounds], str);
|
||||
}
|
||||
|
||||
n = MSG_ReadByte ();
|
||||
n = MSG_ReadByte (net_message);
|
||||
|
||||
if (n) {
|
||||
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
||||
|
@ -755,10 +755,10 @@ CL_ParseModellist (void)
|
|||
int n;
|
||||
|
||||
// precache models and note certain default indexes
|
||||
nummodels = MSG_ReadByte ();
|
||||
nummodels = MSG_ReadByte (net_message);
|
||||
|
||||
for (;;) {
|
||||
str = MSG_ReadString ();
|
||||
str = MSG_ReadString (net_message);
|
||||
if (!str[0])
|
||||
break;
|
||||
nummodels++;
|
||||
|
@ -783,7 +783,7 @@ CL_ParseModellist (void)
|
|||
cl_gib3index = nummodels;
|
||||
}
|
||||
|
||||
n = MSG_ReadByte ();
|
||||
n = MSG_ReadByte (net_message);
|
||||
|
||||
if (n) {
|
||||
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
||||
|
@ -805,13 +805,13 @@ CL_ParseBaseline (entity_state_t *es)
|
|||
{
|
||||
int i;
|
||||
|
||||
es->modelindex = MSG_ReadByte ();
|
||||
es->frame = MSG_ReadByte ();
|
||||
es->colormap = MSG_ReadByte ();
|
||||
es->skinnum = MSG_ReadByte ();
|
||||
es->modelindex = MSG_ReadByte (net_message);
|
||||
es->frame = MSG_ReadByte (net_message);
|
||||
es->colormap = MSG_ReadByte (net_message);
|
||||
es->skinnum = MSG_ReadByte (net_message);
|
||||
for (i = 0; i < 3; i++) {
|
||||
es->origin[i] = MSG_ReadCoord ();
|
||||
es->angles[i] = MSG_ReadAngle ();
|
||||
es->origin[i] = MSG_ReadCoord (net_message);
|
||||
es->angles[i] = MSG_ReadAngle (net_message);
|
||||
}
|
||||
// LordHavoc: set up the baseline to account for new effects (alpha,
|
||||
// colormod, etc)
|
||||
|
@ -865,10 +865,10 @@ CL_ParseStaticSound (void)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
org[i] = MSG_ReadCoord ();
|
||||
sound_num = MSG_ReadByte ();
|
||||
vol = MSG_ReadByte ();
|
||||
atten = MSG_ReadByte ();
|
||||
org[i] = MSG_ReadCoord (net_message);
|
||||
sound_num = MSG_ReadByte (net_message);
|
||||
vol = MSG_ReadByte (net_message);
|
||||
atten = MSG_ReadByte (net_message);
|
||||
|
||||
S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
|
||||
}
|
||||
|
@ -892,22 +892,22 @@ CL_ParseStartSoundPacket (void)
|
|||
float attenuation;
|
||||
int i;
|
||||
|
||||
channel = MSG_ReadShort ();
|
||||
channel = MSG_ReadShort (net_message);
|
||||
|
||||
if (channel & SND_VOLUME)
|
||||
volume = MSG_ReadByte ();
|
||||
volume = MSG_ReadByte (net_message);
|
||||
else
|
||||
volume = DEFAULT_SOUND_PACKET_VOLUME;
|
||||
|
||||
if (channel & SND_ATTENUATION)
|
||||
attenuation = MSG_ReadByte () / 64.0;
|
||||
attenuation = MSG_ReadByte (net_message) / 64.0;
|
||||
else
|
||||
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
|
||||
|
||||
sound_num = MSG_ReadByte ();
|
||||
sound_num = MSG_ReadByte (net_message);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
pos[i] = MSG_ReadCoord ();
|
||||
pos[i] = MSG_ReadCoord (net_message);
|
||||
|
||||
ent = (channel >> 3) & 1023;
|
||||
channel &= 7;
|
||||
|
@ -991,14 +991,14 @@ CL_UpdateUserinfo (void)
|
|||
int slot;
|
||||
player_info_t *player;
|
||||
|
||||
slot = MSG_ReadByte ();
|
||||
slot = MSG_ReadByte (net_message);
|
||||
if (slot >= MAX_CLIENTS)
|
||||
Host_EndGame
|
||||
("CL_ParseServerMessage: svc_updateuserinfo > MAX_SCOREBOARD");
|
||||
|
||||
player = &cl.players[slot];
|
||||
player->userid = MSG_ReadLong ();
|
||||
strncpy (player->userinfo, MSG_ReadString (),
|
||||
player->userid = MSG_ReadLong (net_message);
|
||||
strncpy (player->userinfo, MSG_ReadString (net_message),
|
||||
sizeof (player->userinfo) - 1);
|
||||
|
||||
CL_ProcessUserInfo (slot, player);
|
||||
|
@ -1015,15 +1015,15 @@ CL_SetInfo (void)
|
|||
char key[MAX_MSGLEN];
|
||||
char value[MAX_MSGLEN];
|
||||
|
||||
slot = MSG_ReadByte ();
|
||||
slot = MSG_ReadByte (net_message);
|
||||
if (slot >= MAX_CLIENTS)
|
||||
Host_EndGame ("CL_ParseServerMessage: svc_setinfo > MAX_SCOREBOARD");
|
||||
|
||||
player = &cl.players[slot];
|
||||
|
||||
strncpy (key, MSG_ReadString (), sizeof (key) - 1);
|
||||
strncpy (key, MSG_ReadString (net_message), sizeof (key) - 1);
|
||||
key[sizeof (key) - 1] = 0;
|
||||
strncpy (value, MSG_ReadString (), sizeof (value) - 1);
|
||||
strncpy (value, MSG_ReadString (net_message), sizeof (value) - 1);
|
||||
key[sizeof (value) - 1] = 0;
|
||||
|
||||
Con_DPrintf ("SETINFO %s: %s=%s\n", player->name, key, value);
|
||||
|
@ -1042,9 +1042,9 @@ CL_ServerInfo (void)
|
|||
char key[MAX_MSGLEN];
|
||||
char value[MAX_MSGLEN];
|
||||
|
||||
strncpy (key, MSG_ReadString (), sizeof (key) - 1);
|
||||
strncpy (key, MSG_ReadString (net_message), sizeof (key) - 1);
|
||||
key[sizeof (key) - 1] = 0;
|
||||
strncpy (value, MSG_ReadString (), sizeof (value) - 1);
|
||||
strncpy (value, MSG_ReadString (net_message), sizeof (value) - 1);
|
||||
key[sizeof (value) - 1] = 0;
|
||||
|
||||
Con_DPrintf ("SERVERINFO: %s=%s\n", key, value);
|
||||
|
@ -1093,7 +1093,7 @@ CL_MuzzleFlash (void)
|
|||
int i;
|
||||
player_state_t *pl;
|
||||
|
||||
i = MSG_ReadShort ();
|
||||
i = MSG_ReadShort (net_message);
|
||||
|
||||
if ((unsigned int) (i - 1) >= MAX_CLIENTS)
|
||||
return;
|
||||
|
@ -1114,7 +1114,7 @@ CL_MuzzleFlash (void)
|
|||
}
|
||||
|
||||
|
||||
#define SHOWNET(x) if (cl_shownet->int_val == 2) Con_Printf ("%3i:%s\n", msg_readcount-1, x);
|
||||
#define SHOWNET(x) if (cl_shownet->int_val == 2) Con_Printf ("%3i:%s\n", net_message->readcount-1, x);
|
||||
|
||||
/*
|
||||
CL_ParseServerMessage
|
||||
|
@ -1135,7 +1135,7 @@ CL_ParseServerMessage (void)
|
|||
// if recording demos, copy the message out
|
||||
//
|
||||
if (cl_shownet->int_val == 1)
|
||||
Con_Printf ("%i ", net_message.cursize);
|
||||
Con_Printf ("%i ", net_message->message->cursize);
|
||||
else if (cl_shownet->int_val == 2)
|
||||
Con_Printf ("------------------\n");
|
||||
|
||||
|
@ -1146,15 +1146,15 @@ CL_ParseServerMessage (void)
|
|||
// parse the message
|
||||
//
|
||||
while (1) {
|
||||
if (msg_badread) {
|
||||
if (net_message->badread) {
|
||||
Host_EndGame ("CL_ParseServerMessage: Bad server message");
|
||||
break;
|
||||
}
|
||||
|
||||
cmd = MSG_ReadByte ();
|
||||
cmd = MSG_ReadByte (net_message);
|
||||
|
||||
if (cmd == -1) {
|
||||
msg_readcount++; // so the EOM showner has the right
|
||||
net_message->readcount++; // so the EOM showner has the right
|
||||
// value
|
||||
SHOWNET ("END OF MESSAGE");
|
||||
break;
|
||||
|
@ -1182,8 +1182,8 @@ CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_print:
|
||||
i = MSG_ReadByte ();
|
||||
s = MSG_ReadString ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
s = MSG_ReadString (net_message);
|
||||
if (i == PRINT_CHAT) {
|
||||
// TODO: cl_nofake 2 -- accept fake messages from
|
||||
// teammates
|
||||
|
@ -1202,11 +1202,11 @@ CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_centerprint:
|
||||
SCR_CenterPrint (MSG_ReadString ());
|
||||
SCR_CenterPrint (MSG_ReadString (net_message));
|
||||
break;
|
||||
|
||||
case svc_stufftext:
|
||||
s = MSG_ReadString ();
|
||||
s = MSG_ReadString (net_message);
|
||||
Con_DPrintf ("stufftext: %s\n", s);
|
||||
Cbuf_AddText (s);
|
||||
break;
|
||||
|
@ -1224,16 +1224,16 @@ CL_ParseServerMessage (void)
|
|||
|
||||
case svc_setangle:
|
||||
for (i = 0; i < 3; i++)
|
||||
cl.viewangles[i] = MSG_ReadAngle ();
|
||||
cl.viewangles[i] = MSG_ReadAngle (net_message);
|
||||
// cl.viewangles[PITCH] = cl.viewangles[ROLL] = 0;
|
||||
break;
|
||||
|
||||
case svc_lightstyle:
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= MAX_LIGHTSTYLES)
|
||||
// Sys_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
|
||||
Host_EndGame ("svc_lightstyle > MAX_LIGHTSTYLES");
|
||||
strcpy (cl_lightstyle[i].map, MSG_ReadString ());
|
||||
strcpy (cl_lightstyle[i].map, MSG_ReadString (net_message));
|
||||
cl_lightstyle[i].length = strlen (cl_lightstyle[i].map);
|
||||
break;
|
||||
|
||||
|
@ -1242,46 +1242,46 @@ CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_stopsound:
|
||||
i = MSG_ReadShort ();
|
||||
i = MSG_ReadShort (net_message);
|
||||
S_StopSound (i >> 3, i & 7);
|
||||
break;
|
||||
|
||||
case svc_updatefrags:
|
||||
Sbar_Changed ();
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= MAX_CLIENTS)
|
||||
Host_EndGame
|
||||
("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD");
|
||||
cl.players[i].frags = MSG_ReadShort ();
|
||||
cl.players[i].frags = MSG_ReadShort (net_message);
|
||||
break;
|
||||
|
||||
case svc_updateping:
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= MAX_CLIENTS)
|
||||
Host_EndGame
|
||||
("CL_ParseServerMessage: svc_updateping > MAX_SCOREBOARD");
|
||||
cl.players[i].ping = MSG_ReadShort ();
|
||||
cl.players[i].ping = MSG_ReadShort (net_message);
|
||||
break;
|
||||
|
||||
case svc_updatepl:
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= MAX_CLIENTS)
|
||||
Host_EndGame
|
||||
("CL_ParseServerMessage: svc_updatepl > MAX_SCOREBOARD");
|
||||
cl.players[i].pl = MSG_ReadByte ();
|
||||
cl.players[i].pl = MSG_ReadByte (net_message);
|
||||
break;
|
||||
|
||||
case svc_updateentertime:
|
||||
// time is sent over as seconds ago
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
if (i >= MAX_CLIENTS)
|
||||
Host_EndGame
|
||||
("CL_ParseServerMessage: svc_updateentertime > MAX_SCOREBOARD");
|
||||
cl.players[i].entertime = realtime - MSG_ReadFloat ();
|
||||
cl.players[i].entertime = realtime - MSG_ReadFloat (net_message);
|
||||
break;
|
||||
|
||||
case svc_spawnbaseline:
|
||||
i = MSG_ReadShort ();
|
||||
i = MSG_ReadShort (net_message);
|
||||
CL_ParseBaseline (&cl_baselines[i]);
|
||||
break;
|
||||
case svc_spawnstatic:
|
||||
|
@ -1300,13 +1300,13 @@ CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_updatestat:
|
||||
i = MSG_ReadByte ();
|
||||
j = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
j = MSG_ReadByte (net_message);
|
||||
CL_SetStat (i, j);
|
||||
break;
|
||||
case svc_updatestatlong:
|
||||
i = MSG_ReadByte ();
|
||||
j = MSG_ReadLong ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
j = MSG_ReadLong (net_message);
|
||||
CL_SetStat (i, j);
|
||||
break;
|
||||
|
||||
|
@ -1315,7 +1315,7 @@ CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_cdtrack:
|
||||
cl.cdtrack = MSG_ReadByte ();
|
||||
cl.cdtrack = MSG_ReadByte (net_message);
|
||||
CDAudio_Play ((byte) cl.cdtrack, true);
|
||||
break;
|
||||
|
||||
|
@ -1326,12 +1326,12 @@ CL_ParseServerMessage (void)
|
|||
vid.recalc_refdef = true; // go to full screen
|
||||
Con_DPrintf ("intermission simorg: ");
|
||||
for (i = 0; i < 3; i++) {
|
||||
cl.simorg[i] = MSG_ReadCoord ();
|
||||
cl.simorg[i] = MSG_ReadCoord (net_message);
|
||||
Con_DPrintf ("%f ", cl.simorg[i]);
|
||||
}
|
||||
Con_DPrintf ("\nintermission simangles: ");
|
||||
for (i = 0; i < 3; i++) {
|
||||
cl.simangles[i] = MSG_ReadAngle ();
|
||||
cl.simangles[i] = MSG_ReadAngle (net_message);
|
||||
Con_DPrintf ("%f ", cl.simangles[i]);
|
||||
}
|
||||
Con_DPrintf ("\n");
|
||||
|
@ -1342,7 +1342,7 @@ CL_ParseServerMessage (void)
|
|||
cl.intermission = 2;
|
||||
cl.completed_time = realtime;
|
||||
vid.recalc_refdef = true; // go to full screen
|
||||
SCR_CenterPrint (MSG_ReadString ());
|
||||
SCR_CenterPrint (MSG_ReadString (net_message));
|
||||
break;
|
||||
|
||||
case svc_sellscreen:
|
||||
|
@ -1385,7 +1385,7 @@ CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_chokecount: // some preceding packets were choked
|
||||
i = MSG_ReadByte ();
|
||||
i = MSG_ReadByte (net_message);
|
||||
for (j = 0; j < i; j++)
|
||||
cl.
|
||||
frames[(cls.netchan.incoming_acknowledged - 1 - j) &
|
||||
|
@ -1409,15 +1409,15 @@ CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_maxspeed:
|
||||
movevars.maxspeed = MSG_ReadFloat ();
|
||||
movevars.maxspeed = MSG_ReadFloat (net_message);
|
||||
break;
|
||||
|
||||
case svc_entgravity:
|
||||
movevars.entgravity = MSG_ReadFloat ();
|
||||
movevars.entgravity = MSG_ReadFloat (net_message);
|
||||
break;
|
||||
|
||||
case svc_setpause:
|
||||
cl.paused = MSG_ReadByte ();
|
||||
cl.paused = MSG_ReadByte (net_message);
|
||||
if (cl.paused)
|
||||
CDAudio_Pause ();
|
||||
else
|
||||
|
|
|
@ -172,15 +172,15 @@ CL_ParseBeam (model_t *m)
|
|||
beam_t *b;
|
||||
int i;
|
||||
|
||||
ent = MSG_ReadShort ();
|
||||
ent = MSG_ReadShort (net_message);
|
||||
|
||||
start[0] = MSG_ReadCoord ();
|
||||
start[1] = MSG_ReadCoord ();
|
||||
start[2] = MSG_ReadCoord ();
|
||||
start[0] = MSG_ReadCoord (net_message);
|
||||
start[1] = MSG_ReadCoord (net_message);
|
||||
start[2] = MSG_ReadCoord (net_message);
|
||||
|
||||
end[0] = MSG_ReadCoord ();
|
||||
end[1] = MSG_ReadCoord ();
|
||||
end[2] = MSG_ReadCoord ();
|
||||
end[0] = MSG_ReadCoord (net_message);
|
||||
end[1] = MSG_ReadCoord (net_message);
|
||||
end[2] = MSG_ReadCoord (net_message);
|
||||
|
||||
// override any beam with the same entity
|
||||
for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++)
|
||||
|
@ -219,30 +219,30 @@ CL_ParseTEnt (void)
|
|||
explosion_t *ex;
|
||||
int cnt = -1;
|
||||
|
||||
type = MSG_ReadByte ();
|
||||
type = MSG_ReadByte (net_message);
|
||||
switch (type) {
|
||||
case TE_WIZSPIKE: // spike hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunSpikeEffect (pos, type);
|
||||
// R_RunParticleEffect (pos, 20, 30);
|
||||
S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1);
|
||||
break;
|
||||
|
||||
case TE_KNIGHTSPIKE: // spike hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunSpikeEffect (pos, type);
|
||||
// R_RunParticleEffect (pos, 226, 20);
|
||||
S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1);
|
||||
break;
|
||||
|
||||
case TE_SPIKE: // spike hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunSpikeEffect (pos, type);
|
||||
// R_RunParticleEffect (pos, 0, 10);
|
||||
|
||||
|
@ -259,9 +259,9 @@ CL_ParseTEnt (void)
|
|||
}
|
||||
break;
|
||||
case TE_SUPERSPIKE: // super spike hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunSpikeEffect (pos, type);
|
||||
// R_RunParticleEffect (pos, 0, 20);
|
||||
|
||||
|
@ -280,9 +280,9 @@ CL_ParseTEnt (void)
|
|||
|
||||
case TE_EXPLOSION: // rocket explosion
|
||||
// particles
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_ParticleExplosion (pos);
|
||||
|
||||
// light
|
||||
|
@ -306,9 +306,9 @@ CL_ParseTEnt (void)
|
|||
break;
|
||||
|
||||
case TE_TAREXPLOSION: // tarbaby explosion
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_BlobExplosion (pos);
|
||||
|
||||
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
|
||||
|
@ -327,26 +327,26 @@ CL_ParseTEnt (void)
|
|||
break;
|
||||
|
||||
case TE_LAVASPLASH:
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_LavaSplash (pos);
|
||||
break;
|
||||
|
||||
case TE_TELEPORT:
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_TeleportSplash (pos);
|
||||
break;
|
||||
|
||||
case TE_GUNSHOT: // bullet hitting wall
|
||||
case TE_BLOOD: // bullets hitting body
|
||||
cnt = MSG_ReadByte ();
|
||||
cnt = MSG_ReadByte (net_message);
|
||||
case TE_LIGHTNINGBLOOD: // lightning hitting body
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunPuffEffect (pos, type, cnt);
|
||||
// R_RunParticleEffect (pos, 0, 20*cnt);
|
||||
break;
|
||||
|
|
404
qw/source/msg.c
404
qw/source/msg.c
|
@ -1,404 +0,0 @@
|
|||
/*
|
||||
msg.c
|
||||
|
||||
(description)
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "msg.h"
|
||||
#include "net.h"
|
||||
#include "protocol.h"
|
||||
#include "qendian.h"
|
||||
#include "sys.h"
|
||||
|
||||
/*
|
||||
MESSAGE IO FUNCTIONS
|
||||
|
||||
Handles byte ordering and avoids alignment errors
|
||||
*/
|
||||
|
||||
//
|
||||
// writing functions
|
||||
//
|
||||
|
||||
void
|
||||
MSG_WriteChar (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
#ifdef PARANOID
|
||||
if (c < -128 || c > 127)
|
||||
Sys_Error ("MSG_WriteChar: range error");
|
||||
#endif
|
||||
|
||||
buf = SZ_GetSpace (sb, 1);
|
||||
buf[0] = c;
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteByte (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
#ifdef PARANOID
|
||||
if (c < 0 || c > 255)
|
||||
Sys_Error ("MSG_WriteByte: range error");
|
||||
#endif
|
||||
|
||||
buf = SZ_GetSpace (sb, 1);
|
||||
buf[0] = c;
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteShort (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
#ifdef PARANOID
|
||||
if (c < ((short) 0x8000) || c > (short) 0x7fff)
|
||||
Sys_Error ("MSG_WriteShort: range error");
|
||||
#endif
|
||||
|
||||
buf = SZ_GetSpace (sb, 2);
|
||||
buf[0] = c & 0xff;
|
||||
buf[1] = c >> 8;
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteLong (sizebuf_t *sb, int c)
|
||||
{
|
||||
byte *buf;
|
||||
|
||||
buf = SZ_GetSpace (sb, 4);
|
||||
buf[0] = c & 0xff;
|
||||
buf[1] = (c >> 8) & 0xff;
|
||||
buf[2] = (c >> 16) & 0xff;
|
||||
buf[3] = c >> 24;
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteFloat (sizebuf_t *sb, float f)
|
||||
{
|
||||
union {
|
||||
float f;
|
||||
int l;
|
||||
} dat;
|
||||
|
||||
|
||||
dat.f = f;
|
||||
dat.l = LittleLong (dat.l);
|
||||
|
||||
SZ_Write (sb, &dat.l, 4);
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteString (sizebuf_t *sb, char *s)
|
||||
{
|
||||
if (!s)
|
||||
SZ_Write (sb, "", 1);
|
||||
else
|
||||
SZ_Write (sb, s, strlen (s) + 1);
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteCoord (sizebuf_t *sb, float f)
|
||||
{
|
||||
MSG_WriteShort (sb, (int) (f * 8));
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteAngle (sizebuf_t *sb, float f)
|
||||
{
|
||||
MSG_WriteByte (sb, (int) (f * 256 / 360) & 255);
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteAngle16 (sizebuf_t *sb, float f)
|
||||
{
|
||||
MSG_WriteShort (sb, (int) (f * 65536 / 360) & 65535);
|
||||
}
|
||||
|
||||
void
|
||||
MSG_WriteDeltaUsercmd (sizebuf_t *buf, usercmd_t *from, usercmd_t *cmd)
|
||||
{
|
||||
int bits;
|
||||
|
||||
//
|
||||
// send the movement message
|
||||
//
|
||||
bits = 0;
|
||||
if (cmd->angles[0] != from->angles[0])
|
||||
bits |= CM_ANGLE1;
|
||||
if (cmd->angles[1] != from->angles[1])
|
||||
bits |= CM_ANGLE2;
|
||||
if (cmd->angles[2] != from->angles[2])
|
||||
bits |= CM_ANGLE3;
|
||||
if (cmd->forwardmove != from->forwardmove)
|
||||
bits |= CM_FORWARD;
|
||||
if (cmd->sidemove != from->sidemove)
|
||||
bits |= CM_SIDE;
|
||||
if (cmd->upmove != from->upmove)
|
||||
bits |= CM_UP;
|
||||
if (cmd->buttons != from->buttons)
|
||||
bits |= CM_BUTTONS;
|
||||
if (cmd->impulse != from->impulse)
|
||||
bits |= CM_IMPULSE;
|
||||
|
||||
MSG_WriteByte (buf, bits);
|
||||
|
||||
if (bits & CM_ANGLE1)
|
||||
MSG_WriteAngle16 (buf, cmd->angles[0]);
|
||||
if (bits & CM_ANGLE2)
|
||||
MSG_WriteAngle16 (buf, cmd->angles[1]);
|
||||
if (bits & CM_ANGLE3)
|
||||
MSG_WriteAngle16 (buf, cmd->angles[2]);
|
||||
|
||||
if (bits & CM_FORWARD)
|
||||
MSG_WriteShort (buf, cmd->forwardmove);
|
||||
if (bits & CM_SIDE)
|
||||
MSG_WriteShort (buf, cmd->sidemove);
|
||||
if (bits & CM_UP)
|
||||
MSG_WriteShort (buf, cmd->upmove);
|
||||
|
||||
if (bits & CM_BUTTONS)
|
||||
MSG_WriteByte (buf, cmd->buttons);
|
||||
if (bits & CM_IMPULSE)
|
||||
MSG_WriteByte (buf, cmd->impulse);
|
||||
MSG_WriteByte (buf, cmd->msec);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// reading functions
|
||||
//
|
||||
int msg_readcount;
|
||||
qboolean msg_badread;
|
||||
|
||||
void
|
||||
MSG_BeginReading (void)
|
||||
{
|
||||
msg_readcount = 0;
|
||||
msg_badread = false;
|
||||
}
|
||||
|
||||
int
|
||||
MSG_GetReadCount (void)
|
||||
{
|
||||
return msg_readcount;
|
||||
}
|
||||
|
||||
// returns -1 and sets msg_badread if no more characters are available
|
||||
int
|
||||
MSG_ReadChar (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (msg_readcount + 1 > net_message.cursize) {
|
||||
msg_badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = (signed char) net_message.data[msg_readcount];
|
||||
msg_readcount++;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int
|
||||
MSG_ReadByte (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (msg_readcount + 1 > net_message.cursize) {
|
||||
msg_badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = (unsigned char) net_message.data[msg_readcount];
|
||||
msg_readcount++;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int
|
||||
MSG_ReadShort (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (msg_readcount + 2 > net_message.cursize) {
|
||||
msg_badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = (short) (net_message.data[msg_readcount]
|
||||
+ (net_message.data[msg_readcount + 1] << 8));
|
||||
|
||||
msg_readcount += 2;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int
|
||||
MSG_ReadLong (void)
|
||||
{
|
||||
int c;
|
||||
|
||||
if (msg_readcount + 4 > net_message.cursize) {
|
||||
msg_badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = net_message.data[msg_readcount]
|
||||
+ (net_message.data[msg_readcount + 1] << 8)
|
||||
+ (net_message.data[msg_readcount + 2] << 16)
|
||||
+ (net_message.data[msg_readcount + 3] << 24);
|
||||
|
||||
msg_readcount += 4;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float
|
||||
MSG_ReadFloat (void)
|
||||
{
|
||||
union {
|
||||
byte b[4];
|
||||
float f;
|
||||
int l;
|
||||
} dat;
|
||||
|
||||
dat.b[0] = net_message.data[msg_readcount];
|
||||
dat.b[1] = net_message.data[msg_readcount + 1];
|
||||
dat.b[2] = net_message.data[msg_readcount + 2];
|
||||
dat.b[3] = net_message.data[msg_readcount + 3];
|
||||
msg_readcount += 4;
|
||||
|
||||
dat.l = LittleLong (dat.l);
|
||||
|
||||
return dat.f;
|
||||
}
|
||||
|
||||
char *
|
||||
MSG_ReadString (void)
|
||||
{
|
||||
static char string[2048];
|
||||
int l, c;
|
||||
|
||||
l = 0;
|
||||
do {
|
||||
c = MSG_ReadChar ();
|
||||
if (c == -1 || c == 0)
|
||||
break;
|
||||
string[l] = c;
|
||||
l++;
|
||||
} while (l < sizeof (string) - 1);
|
||||
|
||||
string[l] = 0;
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
char *
|
||||
MSG_ReadStringLine (void)
|
||||
{
|
||||
static char string[2048];
|
||||
int l, c;
|
||||
|
||||
l = 0;
|
||||
do {
|
||||
c = MSG_ReadChar ();
|
||||
if (c == -1 || c == 0 || c == '\n')
|
||||
break;
|
||||
string[l] = c;
|
||||
l++;
|
||||
} while (l < sizeof (string) - 1);
|
||||
|
||||
string[l] = 0;
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
float
|
||||
MSG_ReadCoord (void)
|
||||
{
|
||||
return MSG_ReadShort () * (1.0 / 8);
|
||||
}
|
||||
|
||||
float
|
||||
MSG_ReadAngle (void)
|
||||
{
|
||||
return MSG_ReadChar () * (360.0 / 256);
|
||||
}
|
||||
|
||||
float
|
||||
MSG_ReadAngle16 (void)
|
||||
{
|
||||
return MSG_ReadShort () * (360.0 / 65536);
|
||||
}
|
||||
|
||||
void
|
||||
MSG_ReadDeltaUsercmd (usercmd_t *from, usercmd_t *move)
|
||||
{
|
||||
int bits;
|
||||
|
||||
memcpy (move, from, sizeof (*move));
|
||||
|
||||
bits = MSG_ReadByte ();
|
||||
|
||||
// read current angles
|
||||
if (bits & CM_ANGLE1)
|
||||
move->angles[0] = MSG_ReadAngle16 ();
|
||||
if (bits & CM_ANGLE2)
|
||||
move->angles[1] = MSG_ReadAngle16 ();
|
||||
if (bits & CM_ANGLE3)
|
||||
move->angles[2] = MSG_ReadAngle16 ();
|
||||
|
||||
// read movement
|
||||
if (bits & CM_FORWARD)
|
||||
move->forwardmove = MSG_ReadShort ();
|
||||
if (bits & CM_SIDE)
|
||||
move->sidemove = MSG_ReadShort ();
|
||||
if (bits & CM_UP)
|
||||
move->upmove = MSG_ReadShort ();
|
||||
|
||||
// read buttons
|
||||
if (bits & CM_BUTTONS)
|
||||
move->buttons = MSG_ReadByte ();
|
||||
|
||||
if (bits & CM_IMPULSE)
|
||||
move->impulse = MSG_ReadByte ();
|
||||
|
||||
// read time to run command
|
||||
move->msec = MSG_ReadByte ();
|
||||
}
|
130
qw/source/msg_ucmd.c
Normal file
130
qw/source/msg_ucmd.c
Normal file
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
msg.c
|
||||
|
||||
(description)
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "msg.h"
|
||||
#include "net.h"
|
||||
#include "protocol.h"
|
||||
#include "qendian.h"
|
||||
#include "sys.h"
|
||||
|
||||
struct usercmd_s nullcmd;
|
||||
|
||||
void
|
||||
MSG_WriteDeltaUsercmd (sizebuf_t *buf, usercmd_t *from, usercmd_t *cmd)
|
||||
{
|
||||
int bits;
|
||||
|
||||
//
|
||||
// send the movement message
|
||||
//
|
||||
bits = 0;
|
||||
if (cmd->angles[0] != from->angles[0])
|
||||
bits |= CM_ANGLE1;
|
||||
if (cmd->angles[1] != from->angles[1])
|
||||
bits |= CM_ANGLE2;
|
||||
if (cmd->angles[2] != from->angles[2])
|
||||
bits |= CM_ANGLE3;
|
||||
if (cmd->forwardmove != from->forwardmove)
|
||||
bits |= CM_FORWARD;
|
||||
if (cmd->sidemove != from->sidemove)
|
||||
bits |= CM_SIDE;
|
||||
if (cmd->upmove != from->upmove)
|
||||
bits |= CM_UP;
|
||||
if (cmd->buttons != from->buttons)
|
||||
bits |= CM_BUTTONS;
|
||||
if (cmd->impulse != from->impulse)
|
||||
bits |= CM_IMPULSE;
|
||||
|
||||
MSG_WriteByte (buf, bits);
|
||||
|
||||
if (bits & CM_ANGLE1)
|
||||
MSG_WriteAngle16 (buf, cmd->angles[0]);
|
||||
if (bits & CM_ANGLE2)
|
||||
MSG_WriteAngle16 (buf, cmd->angles[1]);
|
||||
if (bits & CM_ANGLE3)
|
||||
MSG_WriteAngle16 (buf, cmd->angles[2]);
|
||||
|
||||
if (bits & CM_FORWARD)
|
||||
MSG_WriteShort (buf, cmd->forwardmove);
|
||||
if (bits & CM_SIDE)
|
||||
MSG_WriteShort (buf, cmd->sidemove);
|
||||
if (bits & CM_UP)
|
||||
MSG_WriteShort (buf, cmd->upmove);
|
||||
|
||||
if (bits & CM_BUTTONS)
|
||||
MSG_WriteByte (buf, cmd->buttons);
|
||||
if (bits & CM_IMPULSE)
|
||||
MSG_WriteByte (buf, cmd->impulse);
|
||||
MSG_WriteByte (buf, cmd->msec);
|
||||
}
|
||||
|
||||
void
|
||||
MSG_ReadDeltaUsercmd (usercmd_t *from, usercmd_t *move)
|
||||
{
|
||||
int bits;
|
||||
|
||||
memcpy (move, from, sizeof (*move));
|
||||
|
||||
bits = MSG_ReadByte (net_message);
|
||||
|
||||
// read current angles
|
||||
if (bits & CM_ANGLE1)
|
||||
move->angles[0] = MSG_ReadAngle16 (net_message);
|
||||
if (bits & CM_ANGLE2)
|
||||
move->angles[1] = MSG_ReadAngle16 (net_message);
|
||||
if (bits & CM_ANGLE3)
|
||||
move->angles[2] = MSG_ReadAngle16 (net_message);
|
||||
|
||||
// read movement
|
||||
if (bits & CM_FORWARD)
|
||||
move->forwardmove = MSG_ReadShort (net_message);
|
||||
if (bits & CM_SIDE)
|
||||
move->sidemove = MSG_ReadShort (net_message);
|
||||
if (bits & CM_UP)
|
||||
move->upmove = MSG_ReadShort (net_message);
|
||||
|
||||
// read buttons
|
||||
if (bits & CM_BUTTONS)
|
||||
move->buttons = MSG_ReadByte (net_message);
|
||||
|
||||
if (bits & CM_IMPULSE)
|
||||
move->impulse = MSG_ReadByte (net_message);
|
||||
|
||||
// read time to run command
|
||||
move->msec = MSG_ReadByte (net_message);
|
||||
}
|
|
@ -350,13 +350,13 @@ Netchan_Process (netchan_t *chan)
|
|||
}
|
||||
|
||||
// get sequence numbers
|
||||
MSG_BeginReading ();
|
||||
sequence = MSG_ReadLong ();
|
||||
sequence_ack = MSG_ReadLong ();
|
||||
MSG_BeginReading (net_message);
|
||||
sequence = MSG_ReadLong (net_message);
|
||||
sequence_ack = MSG_ReadLong (net_message);
|
||||
|
||||
// read the qport if we are a server
|
||||
if (is_server)
|
||||
qport = MSG_ReadShort ();
|
||||
qport = MSG_ReadShort (net_message);
|
||||
|
||||
reliable_message = sequence >> 31;
|
||||
reliable_ack = sequence_ack >> 31;
|
||||
|
@ -366,7 +366,7 @@ Netchan_Process (netchan_t *chan)
|
|||
|
||||
if (showpackets->int_val)
|
||||
Con_Printf ("<-- s=%i(%i) a=%i(%i) %i\n", sequence, reliable_message,
|
||||
sequence_ack, reliable_ack, net_message.cursize);
|
||||
sequence_ack, reliable_ack, net_message->message->cursize);
|
||||
|
||||
// get a rate estimation
|
||||
#if 0
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#endif
|
||||
|
||||
#include "console.h"
|
||||
#include "msg.h"
|
||||
#include "net.h"
|
||||
#include "sys.h"
|
||||
#include "qargs.h"
|
||||
|
@ -94,9 +95,12 @@
|
|||
netadr_t net_local_adr;
|
||||
|
||||
netadr_t net_from;
|
||||
sizebuf_t net_message;
|
||||
int net_socket;
|
||||
|
||||
static sizebuf_t _net_message_message;
|
||||
static msg_t _net_message = {0, 0, &_net_message_message};
|
||||
msg_t *net_message = &_net_message;
|
||||
|
||||
extern qboolean is_server;
|
||||
|
||||
#define MAX_UDP_PACKET (MAX_MSGLEN*2)
|
||||
|
@ -296,14 +300,14 @@ NET_GetPacket (void)
|
|||
return false;
|
||||
}
|
||||
|
||||
net_message.cursize = ret;
|
||||
_net_message_message.cursize = ret;
|
||||
if (ret == sizeof (net_message_buffer)) {
|
||||
Con_Printf ("Oversize packet from %s\n", NET_AdrToString (net_from));
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef PACKET_LOGGING
|
||||
Log_Incoming_Packet(net_message_buffer,net_message.cursize);
|
||||
Log_Incoming_Packet(net_message_buffer,_net_message_message.cursize);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
@ -432,8 +436,8 @@ NET_Init (int port)
|
|||
//
|
||||
// init the message buffer
|
||||
//
|
||||
net_message.maxsize = sizeof (net_message_buffer);
|
||||
net_message.data = net_message_buffer;
|
||||
_net_message_message.maxsize = sizeof (net_message_buffer);
|
||||
_net_message_message.data = net_message_buffer;
|
||||
|
||||
//
|
||||
// determine my name & address
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
#endif
|
||||
|
||||
#include "console.h"
|
||||
#include "msg.h"
|
||||
#include "net.h"
|
||||
#include "qargs.h"
|
||||
#include "qtypes.h"
|
||||
|
@ -111,9 +112,12 @@
|
|||
netadr_t net_local_adr;
|
||||
|
||||
netadr_t net_from;
|
||||
sizebuf_t net_message;
|
||||
int net_socket;
|
||||
|
||||
static sizebuf_t _net_message_message;
|
||||
static msg_t _net_message = {0, 0, &_net_message_message};
|
||||
msg_t *net_message = &_net_message;
|
||||
|
||||
#define MAX_UDP_PACKET (MAX_MSGLEN*2)
|
||||
byte net_message_buffer[MAX_UDP_PACKET];
|
||||
|
||||
|
@ -378,7 +382,7 @@ NET_GetPacket (void)
|
|||
return false;
|
||||
}
|
||||
|
||||
net_message.cursize = ret;
|
||||
_net_message_message.cursize = ret;
|
||||
if (ret == sizeof (net_message_buffer)) {
|
||||
Con_Printf ("Oversize packet from %s\n", NET_AdrToString (net_from));
|
||||
return false;
|
||||
|
@ -547,8 +551,8 @@ NET_Init (int port)
|
|||
//
|
||||
// init the message buffer
|
||||
//
|
||||
net_message.maxsize = sizeof (net_message_buffer);
|
||||
net_message.data = net_message_buffer;
|
||||
_net_message_message.maxsize = sizeof (net_message_buffer);
|
||||
_net_message_message.data = net_message_buffer;
|
||||
|
||||
//
|
||||
// determine my name & address
|
||||
|
|
|
@ -299,10 +299,10 @@ V_ParseDamage (void)
|
|||
float side;
|
||||
float count;
|
||||
|
||||
armor = MSG_ReadByte ();
|
||||
blood = MSG_ReadByte ();
|
||||
armor = MSG_ReadByte (net_message);
|
||||
blood = MSG_ReadByte (net_message);
|
||||
for (i = 0; i < 3; i++)
|
||||
from[i] = MSG_ReadCoord ();
|
||||
from[i] = MSG_ReadCoord (net_message);
|
||||
|
||||
count = blood * 0.5 + armor * 0.5;
|
||||
if (count < 10)
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#endif
|
||||
|
||||
#include "msg.h"
|
||||
#include "msg_ucmd.h"
|
||||
#include "server.h"
|
||||
#include "sys.h"
|
||||
|
||||
|
|
|
@ -221,16 +221,16 @@ SV_FinalMessage (char *message)
|
|||
int i;
|
||||
client_t *cl;
|
||||
|
||||
SZ_Clear (&net_message);
|
||||
MSG_WriteByte (&net_message, svc_print);
|
||||
MSG_WriteByte (&net_message, PRINT_HIGH);
|
||||
MSG_WriteString (&net_message, message);
|
||||
MSG_WriteByte (&net_message, svc_disconnect);
|
||||
SZ_Clear (net_message->message);
|
||||
MSG_WriteByte (net_message->message, svc_print);
|
||||
MSG_WriteByte (net_message->message, PRINT_HIGH);
|
||||
MSG_WriteString (net_message->message, message);
|
||||
MSG_WriteByte (net_message->message, svc_disconnect);
|
||||
|
||||
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++)
|
||||
if (cl->state >= cs_spawned)
|
||||
Netchan_Transmit (&cl->netchan, net_message.cursize,
|
||||
net_message.data);
|
||||
Netchan_Transmit (&cl->netchan, net_message->message->cursize,
|
||||
net_message->message->data);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -889,7 +889,7 @@ SVC_RemoteCommand (void)
|
|||
|
||||
if (!Rcon_Validate ()) {
|
||||
Con_Printf ("Bad rcon from %s:\n%s\n", NET_AdrToString (net_from),
|
||||
net_message.data + 4);
|
||||
net_message->message->data + 4);
|
||||
|
||||
SV_BeginRedirect (RD_PACKET);
|
||||
|
||||
|
@ -932,10 +932,10 @@ SV_ConnectionlessPacket (void)
|
|||
char *s;
|
||||
char *c;
|
||||
|
||||
MSG_BeginReading ();
|
||||
MSG_ReadLong (); // skip the -1 marker
|
||||
MSG_BeginReading (net_message);
|
||||
MSG_ReadLong (net_message); // skip the -1 marker
|
||||
|
||||
s = MSG_ReadStringLine ();
|
||||
s = MSG_ReadStringLine (net_message);
|
||||
|
||||
Cmd_TokenizeString (s);
|
||||
|
||||
|
@ -1270,21 +1270,21 @@ SV_ReadPackets (void)
|
|||
continue;
|
||||
}
|
||||
// check for connectionless packet (0xffffffff) first
|
||||
if (*(int *) net_message.data == -1) {
|
||||
if (*(int *) net_message->message->data == -1) {
|
||||
SV_ConnectionlessPacket ();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (net_message.cursize < 11) {
|
||||
if (net_message->message->cursize < 11) {
|
||||
Con_Printf ("%s: Runt packet\n", NET_AdrToString (net_from));
|
||||
continue;
|
||||
}
|
||||
// read the qport out of the message so we can fix up
|
||||
// stupid address translating routers
|
||||
MSG_BeginReading ();
|
||||
MSG_ReadLong (); // sequence number
|
||||
MSG_ReadLong (); // sequence number
|
||||
qport = MSG_ReadShort () & 0xffff;
|
||||
MSG_BeginReading (net_message);
|
||||
MSG_ReadLong (net_message); // sequence number
|
||||
MSG_ReadLong (net_message); // sequence number
|
||||
qport = MSG_ReadShort (net_message) & 0xffff;
|
||||
|
||||
// check for packets from connected clients
|
||||
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "cmd.h"
|
||||
#include "cvar.h"
|
||||
#include "msg.h"
|
||||
#include "msg_ucmd.h"
|
||||
#include "pmove.h"
|
||||
#include "quakefs.h"
|
||||
#include "server.h"
|
||||
|
@ -600,14 +601,14 @@ SV_NextUpload (void)
|
|||
ClientReliableWrite_String (host_client, "stopul");
|
||||
|
||||
// suck out rest of packet
|
||||
size = MSG_ReadShort ();
|
||||
MSG_ReadByte ();
|
||||
msg_readcount += size;
|
||||
size = MSG_ReadShort (net_message);
|
||||
MSG_ReadByte (net_message);
|
||||
net_message->readcount += size;
|
||||
return;
|
||||
}
|
||||
|
||||
size = MSG_ReadShort ();
|
||||
percent = MSG_ReadByte ();
|
||||
size = MSG_ReadShort (net_message);
|
||||
percent = MSG_ReadByte (net_message);
|
||||
|
||||
if (!host_client->upload) {
|
||||
host_client->upload = Qopen (host_client->uploadfn, "wb");
|
||||
|
@ -626,8 +627,8 @@ SV_NextUpload (void)
|
|||
host_client->uploadfn, host_client->userid);
|
||||
}
|
||||
|
||||
Qwrite (host_client->upload, net_message.data + msg_readcount, size);
|
||||
msg_readcount += size;
|
||||
Qwrite (host_client->upload, net_message->message->data + net_message->readcount, size);
|
||||
net_message->readcount += size;
|
||||
|
||||
Con_DPrintf ("UPLOAD: %d received\n", size);
|
||||
|
||||
|
@ -1653,13 +1654,13 @@ SV_ExecuteClientMessage (client_t *cl)
|
|||
cl->localtime = sv.time;
|
||||
cl->delta_sequence = -1; // no delta unless requested
|
||||
while (1) {
|
||||
if (msg_badread) {
|
||||
if (net_message->badread) {
|
||||
Con_Printf ("SV_ReadClientMessage: badread\n");
|
||||
SV_DropClient (cl);
|
||||
return;
|
||||
}
|
||||
|
||||
c = MSG_ReadByte ();
|
||||
c = MSG_ReadByte (net_message);
|
||||
if (c == -1)
|
||||
return; // Ender: Patched :)
|
||||
|
||||
|
@ -1673,7 +1674,7 @@ SV_ExecuteClientMessage (client_t *cl)
|
|||
break;
|
||||
|
||||
case clc_delta:
|
||||
cl->delta_sequence = MSG_ReadByte ();
|
||||
cl->delta_sequence = MSG_ReadByte (net_message);
|
||||
break;
|
||||
|
||||
case clc_move:
|
||||
|
@ -1682,11 +1683,11 @@ SV_ExecuteClientMessage (client_t *cl)
|
|||
|
||||
move_issued = true;
|
||||
|
||||
checksumIndex = MSG_GetReadCount ();
|
||||
checksum = (byte) MSG_ReadByte ();
|
||||
checksumIndex = MSG_GetReadCount (net_message);
|
||||
checksum = (byte) MSG_ReadByte (net_message);
|
||||
|
||||
// read loss percentage
|
||||
cl->lossage = MSG_ReadByte ();
|
||||
cl->lossage = MSG_ReadByte (net_message);
|
||||
|
||||
MSG_ReadDeltaUsercmd (&nullcmd, &oldest);
|
||||
MSG_ReadDeltaUsercmd (&oldest, &oldcmd);
|
||||
|
@ -1697,9 +1698,9 @@ SV_ExecuteClientMessage (client_t *cl)
|
|||
|
||||
// if the checksum fails, ignore the rest of the packet
|
||||
calculatedChecksum =
|
||||
COM_BlockSequenceCRCByte (net_message.data + checksumIndex +
|
||||
COM_BlockSequenceCRCByte (net_message->message->data + checksumIndex +
|
||||
1,
|
||||
MSG_GetReadCount () -
|
||||
MSG_GetReadCount (net_message) -
|
||||
checksumIndex - 1, seq_hash);
|
||||
|
||||
if (calculatedChecksum != checksum) {
|
||||
|
@ -1734,14 +1735,14 @@ SV_ExecuteClientMessage (client_t *cl)
|
|||
|
||||
|
||||
case clc_stringcmd:
|
||||
s = MSG_ReadString ();
|
||||
s = MSG_ReadString (net_message);
|
||||
SV_ExecuteUserCommand (s);
|
||||
break;
|
||||
|
||||
case clc_tmove:
|
||||
o[0] = MSG_ReadCoord ();
|
||||
o[1] = MSG_ReadCoord ();
|
||||
o[2] = MSG_ReadCoord ();
|
||||
o[0] = MSG_ReadCoord (net_message);
|
||||
o[1] = MSG_ReadCoord (net_message);
|
||||
o[2] = MSG_ReadCoord (net_message);
|
||||
// only allowed by spectators
|
||||
if (host_client->spectator) {
|
||||
VectorCopy (o, sv_player->v.v.origin);
|
||||
|
|
Loading…
Reference in a new issue