#include "quakedef.h"
-char *svc_strings[] =
+char *svc_strings[128] =
{
"svc_bad",
"svc_nop",
"?", // 48
"?", // 49
"svc_farclip", // [coord] size
- "svc_fog", // [byte] enable <optional past this point, only included if enable is true> [short * 4096] density [byte] red [byte] green [byte] blue
+ "svc_fog", // [byte] enable <optional past this point, only included if enable is true> [short] density*4096 [byte] red [byte] green [byte] blue
"svc_playerposition" // [float] x [float] y [float] z
};
// parse protocol version number
i = MSG_ReadLong ();
- if (i != PROTOCOL_VERSION && i != 250)
+ if (i != PROTOCOL_VERSION && i != DPPROTOCOL_VERSION && i != 250)
{
- Con_Printf ("Server returned version %i, not %i", i, PROTOCOL_VERSION);
+ Con_Printf ("Server returned version %i, not %i or %i", i, DPPROTOCOL_VERSION, PROTOCOL_VERSION);
return;
}
Nehahrademcompatibility = false;
Con_Printf ("Server sent too many model precaches\n");
return;
}
+ if (strlen(str) >= MAX_QPATH)
+ Host_Error ("Server sent a precache name of %i characters (max %i)", strlen(str), MAX_QPATH - 1);
strcpy (model_precache[nummodels], str);
Mod_TouchModel (str);
}
Con_Printf ("Server sent too many sound precaches\n");
return;
}
+ if (strlen(str) >= MAX_QPATH)
+ Host_Error ("Server sent a precache name of %i characters (max %i)", strlen(str), MAX_QPATH - 1);
strcpy (sound_precache[numsounds], str);
S_TouchSound (str);
}
{
int cmd;
int i;
+ byte cmdlog[32];
+ char *cmdlogname[32], *temp;
+ int cmdindex, cmdcount = 0;
//
// if recording demos, copy the message out
return; // end of message
}
- // if the high bit of the command byte is set, it is a fast update
+ cmdindex = cmdcount & 31;
+ cmdcount++;
+ cmdlog[cmdindex] = cmd;
+
+ // if the high bit of the command byte is set, it is a fast update
if (cmd & 128)
{
+ // LordHavoc: fix for bizarre problem in MSVC that I do not understand (if I assign the string pointer directly it ends up storing a NULL pointer)
+ temp = "svc_entity";
+ cmdlogname[cmdindex] = temp;
SHOWNET("fast update");
CL_ParseUpdate (cmd&127);
continue;
}
SHOWNET(svc_strings[cmd]);
+ cmdlogname[cmdindex] = svc_strings[cmd];
+ if (!cmdlogname[cmdindex])
+ {
+ // LordHavoc: fix for bizarre problem in MSVC that I do not understand (if I assign the string pointer directly it ends up storing a NULL pointer)
+ temp = "<unknown>";
+ cmdlogname[cmdindex] = temp;
+ }
- // other commands
+ // other commands
switch (cmd)
{
default:
- Host_Error ("CL_ParseServerMessage: Illegible server message\n");
+ {
+ char description[32*64], temp[64];
+ int count;
+ strcpy(description, "packet dump: ");
+ i = cmdcount - 32;
+ if (i < 0)
+ i = 0;
+ count = cmdcount - i;
+ i &= 31;
+ while(count > 0)
+ {
+ sprintf(temp, "%3i:%s ", cmdlog[i], cmdlogname[i]);
+ strcat(description, temp);
+ count--;
+ i++;
+ i &= 31;
+ }
+ description[strlen(description)-1] = '\n'; // replace the last space with a newline
+ Con_Printf(description);
+ Host_Error ("CL_ParseServerMessage: Illegible server message\n");
+ }
break;
case svc_nop:
break;
case svc_setpause:
- {
- cl.paused = MSG_ReadByte ();
-
- if (cl.paused)
- CDAudio_Pause ();
- else
- CDAudio_Resume ();
- }
+ cl.paused = MSG_ReadByte ();
+ if (cl.paused)
+ CDAudio_Pause ();
+ else
+ CDAudio_Resume ();
break;
case svc_signonnum: