void CL_KeepaliveMessage (void)
{
float time;
- static float lastmsg;
+ static double nextmsg = -1;
int oldreadcount;
qboolean oldbadread;
sizebuf_t old;
// no need if server is local and definitely not if this is a demo
- if (sv.active || cls.demoplayback)
+ if (sv.active || !cls.netcon)
return;
// read messages from server, should just be nops
net_message = old;
memcpy(net_message.data, olddata, net_message.cursize);
- if (cls.netcon && NetConn_CanSendMessage(cls.netcon) && (time = Sys_DoubleTime()) - lastmsg >= 5)
+ if (cls.netcon && (time = Sys_DoubleTime()) >= nextmsg)
{
sizebuf_t msg;
unsigned char buf[4];
- lastmsg = time;
+ nextmsg = time + 5;
// write out a nop
// LordHavoc: must use unreliable because reliable could kill the sigon message!
Con_Print("--> client to server keepalive\n");
+ memset(&msg, 0, sizeof(msg));
msg.data = buf;
msg.maxsize = sizeof(buf);
- msg.cursize = 0;
MSG_WriteChar(&msg, svc_nop);
NetConn_SendUnreliableMessage(cls.netcon, &msg);
}
*/
static void CL_SignonReply (void)
{
- //char str[8192];
-
-Con_DPrintf("CL_SignonReply: %i\n", cls.signon);
+ Con_DPrintf("CL_SignonReply: %i\n", cls.signon);
switch (cls.signon)
{
case 1:
- MSG_WriteByte (&cls.message, clc_stringcmd);
- MSG_WriteString (&cls.message, "prespawn");
+ if (cls.netcon)
+ {
+ MSG_WriteByte (&cls.netcon->message, clc_stringcmd);
+ MSG_WriteString (&cls.netcon->message, "prespawn");
+ }
break;
case 2:
- MSG_WriteByte (&cls.message, clc_stringcmd);
- MSG_WriteString (&cls.message, va("name \"%s\"", cl_name.string));
+ if (cls.netcon)
+ {
+ MSG_WriteByte (&cls.netcon->message, clc_stringcmd);
+ MSG_WriteString (&cls.netcon->message, va("name \"%s\"", cl_name.string));
- MSG_WriteByte (&cls.message, clc_stringcmd);
- MSG_WriteString (&cls.message, va("color %i %i", cl_color.integer >> 4, cl_color.integer & 15));
+ MSG_WriteByte (&cls.netcon->message, clc_stringcmd);
+ MSG_WriteString (&cls.netcon->message, va("color %i %i", cl_color.integer >> 4, cl_color.integer & 15));
- if (cl_pmodel.integer)
- {
- MSG_WriteByte (&cls.message, clc_stringcmd);
- MSG_WriteString (&cls.message, va("pmodel %i", cl_pmodel.integer));
- }
- if (*cl_playermodel.string)
- {
- MSG_WriteByte (&cls.message, clc_stringcmd);
- MSG_WriteString (&cls.message, va("playermodel %s", cl_playermodel.string));
- }
- if (*cl_playerskin.string)
- {
- MSG_WriteByte (&cls.message, clc_stringcmd);
- MSG_WriteString (&cls.message, va("playerskin %s", cl_playerskin.string));
- }
+ if (cl_pmodel.integer)
+ {
+ MSG_WriteByte (&cls.netcon->message, clc_stringcmd);
+ MSG_WriteString (&cls.netcon->message, va("pmodel %i", cl_pmodel.integer));
+ }
+ if (*cl_playermodel.string)
+ {
+ MSG_WriteByte (&cls.netcon->message, clc_stringcmd);
+ MSG_WriteString (&cls.netcon->message, va("playermodel %s", cl_playermodel.string));
+ }
+ if (*cl_playerskin.string)
+ {
+ MSG_WriteByte (&cls.netcon->message, clc_stringcmd);
+ MSG_WriteString (&cls.netcon->message, va("playerskin %s", cl_playerskin.string));
+ }
- MSG_WriteByte (&cls.message, clc_stringcmd);
- MSG_WriteString (&cls.message, va("rate %i", cl_rate.integer));
+ MSG_WriteByte (&cls.netcon->message, clc_stringcmd);
+ MSG_WriteString (&cls.netcon->message, va("rate %i", cl_rate.integer));
- MSG_WriteByte (&cls.message, clc_stringcmd);
- MSG_WriteString (&cls.message, "spawn");
+ MSG_WriteByte (&cls.netcon->message, clc_stringcmd);
+ MSG_WriteString (&cls.netcon->message, "spawn");
+ }
break;
case 3:
- MSG_WriteByte (&cls.message, clc_stringcmd);
- MSG_WriteString (&cls.message, "begin");
+ if (cls.netcon)
+ {
+ MSG_WriteByte (&cls.netcon->message, clc_stringcmd);
+ MSG_WriteString (&cls.netcon->message, "begin");
+ }
break;
case 4:
unsigned char cmdlog[32];
char *cmdlogname[32], *temp;
int cmdindex, cmdcount = 0;
- qboolean sendmove = false;
if (cls.demorecording)
CL_WriteDemoMessage ();
case svc_time:
cl.mtime[1] = cl.mtime[0];
cl.mtime[0] = MSG_ReadFloat ();
- sendmove = true;
+ cl.movement_needupdate = true;
break;
case svc_clientdata:
EntityFrameQuake_ISeeDeadEntities();
- if (sendmove)
- {
- // send one move per server frame
- CL_SendMove();
- }
-
parsingerror = false;
}