#include "quakedef.h"
-char *svc_strings[] =
+char *svc_strings[128] =
{
"svc_bad",
"svc_nop",
void CL_ParseEntityLump(char *entdata)
{
char *data;
- char key[128], value[1024];
+ char key[128], value[4096];
char wadname[128];
int i, j, k;
FOG_clear(); // LordHavoc: no fog until set
else if (!strcmp("wad", key)) // for HalfLife maps
{
j = 0;
- for (i = 0;i < 128;i++)
+ for (i = 0;i < 4096;i++)
if (value[i] != ';' && value[i] != '\\' && value[i] != '/' && value[i] != ':')
break;
if (value[i])
{
- for (;i < 128;i++)
+ for (;i < 4096;i++)
{
// ignore path - the \\ check is for HalfLife... stupid windoze 'programmers'...
if (value[i] == '\\' || value[i] == '/' || value[i] == ':')
value[i] = 0;
strcpy(wadname, "textures/");
strcat(wadname, &value[j]);
- W_LoadTextureWadFile (wadname, FALSE);
+ W_LoadTextureWadFile (wadname, false);
j = i+1;
if (!k)
break;
// 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;
{
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:
case svc_version:
i = MSG_ReadLong ();
- if (i != PROTOCOL_VERSION && i != 250)
- Host_Error ("CL_ParseServerMessage: Server is protocol %i instead of %i\n", i, PROTOCOL_VERSION);
- Nehahrademcompatibility = i == 250;
+ if (i != PROTOCOL_VERSION && i != DPPROTOCOL_VERSION && i != 250)
+ {
+ Host_Error ("CL_ParseServerMessage: Server is protocol %i, not %i or %i", i, DPPROTOCOL_VERSION, PROTOCOL_VERSION);
+ return;
+ }
+ Nehahrademcompatibility = false;
+ if (i == 250)
+ Nehahrademcompatibility = true;
+ if (cls.demoplayback && demo_nehahra.value)
+ Nehahrademcompatibility = true;
+ dpprotocol = i == DPPROTOCOL_VERSION;
break;
case svc_disconnect:
i = MSG_ReadByte ();
if (i >= MAX_LIGHTSTYLES)
Host_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
- strcpy (cl_lightstyle[i].map, MSG_ReadString());
+ strncpy (cl_lightstyle[i].map, MSG_ReadString(), MAX_STYLESTRING - 1);
+ cl_lightstyle[i].map[MAX_STYLESTRING - 1] = 0;
cl_lightstyle[i].length = strlen(cl_lightstyle[i].map);
break;
case svc_updatename:
i = MSG_ReadByte ();
if (i >= cl.maxclients)
- Host_Error ("CL_ParseServerMessage: svc_updatename > MAX_SCOREBOARD");
+ Host_Error ("CL_ParseServerMessage: svc_updatename >= MAX_SCOREBOARD");
strcpy (cl.scores[i].name, MSG_ReadString ());
break;
case svc_updatefrags:
i = MSG_ReadByte ();
if (i >= cl.maxclients)
- Host_Error ("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD");
+ Host_Error ("CL_ParseServerMessage: svc_updatefrags >= MAX_SCOREBOARD");
cl.scores[i].frags = MSG_ReadShort ();
break;
case svc_updatecolors:
i = MSG_ReadByte ();
if (i >= cl.maxclients)
- Host_Error ("CL_ParseServerMessage: svc_updatecolors > MAX_SCOREBOARD");
+ Host_Error ("CL_ParseServerMessage: svc_updatecolors >= MAX_SCOREBOARD");
cl.scores[i].colors = MSG_ReadByte ();
break;
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:
i = MSG_ReadByte ();
if (i < 0 || i >= MAX_CL_STATS)
Host_Error ("svc_updatestat: %i is invalid", i);
- cl.stats[i] = MSG_ReadLong ();;
+ cl.stats[i] = MSG_ReadLong ();
break;
case svc_spawnstaticsound: