fix a bunch more potential message writes while playing demos

This commit is contained in:
Bill Currie 2002-10-07 03:58:08 +00:00
parent 9c4f2d32ca
commit fb8a5afda5
5 changed files with 21 additions and 11 deletions

View file

@ -172,8 +172,10 @@ void
Cam_Unlock (void)
{
if (autocam) {
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, "ptrack");
if (!cls.demoplayback) {
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, "ptrack");
}
autocam = CAM_NONE;
locked = false;
Sbar_Changed ();
@ -469,8 +471,10 @@ Cam_Track (usercmd_t *cmd)
len = VectorLength (vec);
cmd->forwardmove = cmd->sidemove = cmd->upmove = 0;
if (len > 16) { // close enough?
MSG_WriteByte (&cls.netchan.message, clc_tmove);
MSG_WriteCoordV (&cls.netchan.message, desired_position);
if (!cls.demoplayback) {
MSG_WriteByte (&cls.netchan.message, clc_tmove);
MSG_WriteCoordV (&cls.netchan.message, desired_position);
}
}
// move there locally immediately
VectorCopy (desired_position, self->origin);

View file

@ -51,7 +51,7 @@ Cvar_Info (cvar_t *var)
Info_SetValueForKey (cls.userinfo, var->name, var->string,
((!strequal(var->name, "name"))
|(strequal(var->name, "team") << 1)));
if (cls.state >= ca_connected) {
if (cls.state >= ca_connected && !cls.demoplayback) {
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message,
va ("setinfo \"%s\" \"%s\"\n", var->name,

View file

@ -853,6 +853,8 @@ CL_Reconnect_f (void)
{
if (cls.download) // don't change when downloading
return;
if (cls.demoplayback)
return;
S_StopAllSounds (true);
@ -1091,7 +1093,7 @@ CL_ReadPackets (void)
void
CL_Download_f (void)
{
if (cls.state == ca_disconnected) {
if (cls.state == ca_disconnected || cls.demoplayback) {
Con_Printf ("Must be connected.\n");
return;
}

View file

@ -807,9 +807,11 @@ CL_ParseModellist (void)
n = MSG_ReadByte (net_message);
if (n) {
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message,
va (modellist_name, cl.servercount, n));
if (!cls.demoplayback) {
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message,
va (modellist_name, cl.servercount, n));
}
return;
}

View file

@ -1588,8 +1588,10 @@ Sbar_DeathmatchOverlay (int start)
// request new ping times every two second
if (realtime - cl.last_ping_request > 2.0) {
cl.last_ping_request = realtime;
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
SZ_Print (&cls.netchan.message, "pings");
if (!cls.demoplayback) {
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
SZ_Print (&cls.netchan.message, "pings");
}
}
scr_copyeverything = 1;