fix up packet logging for the new msg stuff

This commit is contained in:
Bill Currie 2001-03-01 20:41:20 +00:00
parent 4fcf7704d3
commit 68220d1fb0
2 changed files with 192 additions and 192 deletions

View file

@ -1022,7 +1022,7 @@ CL_ReadPackets (void)
while (CL_GetMessage ()) { while (CL_GetMessage ()) {
#ifdef PACKET_LOGGING #ifdef PACKET_LOGGING
if (cls.demoplayback) Log_Incoming_Packet(net_message.data,net_message.cursize); if (cls.demoplayback) Log_Incoming_Packet(net_message->message->data,net_message->message->cursize);
#endif #endif
// //
// remote command packet // remote command packet

View file

@ -319,72 +319,72 @@ Log_Delta(int bits)
bits &= ~511; bits &= ~511;
if (bits & U_MOREBITS) { // read in the low order bits if (bits & U_MOREBITS) { // read in the low order bits
i = MSG_ReadByte (); i = MSG_ReadByte (net_message);
bits |= i; bits |= i;
} }
// LordHavoc: Endy neglected to mark this as being part of the QSG // LordHavoc: Endy neglected to mark this as being part of the QSG
// version 2 stuff... // version 2 stuff...
if (bits & U_EXTEND1) { if (bits & U_EXTEND1) {
bits |= MSG_ReadByte () << 16; bits |= MSG_ReadByte (net_message) << 16;
if (bits & U_EXTEND2) if (bits & U_EXTEND2)
bits |= MSG_ReadByte () << 24; bits |= MSG_ReadByte (net_message) << 24;
} }
to.flags = bits; to.flags = bits;
if (bits & U_MODEL) if (bits & U_MODEL)
Net_LogPrintf (" MdlIdx: %d", MSG_ReadByte ()); Net_LogPrintf (" MdlIdx: %d", MSG_ReadByte (net_message));
if (bits & U_FRAME) { if (bits & U_FRAME) {
to.frame = MSG_ReadByte (); to.frame = MSG_ReadByte (net_message);
Net_LogPrintf (" Frame: %d", to.frame); Net_LogPrintf (" Frame: %d", to.frame);
} }
if (bits & U_COLORMAP) if (bits & U_COLORMAP)
Net_LogPrintf (" Colormap: %d", MSG_ReadByte ()); Net_LogPrintf (" Colormap: %d", MSG_ReadByte (net_message));
if (bits & U_SKIN) if (bits & U_SKIN)
Net_LogPrintf (" Skinnum: %d", MSG_ReadByte ()); Net_LogPrintf (" Skinnum: %d", MSG_ReadByte (net_message));
if (bits & U_EFFECTS) { if (bits & U_EFFECTS) {
to.effects = MSG_ReadByte (); to.effects = MSG_ReadByte (net_message);
Net_LogPrintf (" Effects: %d", to.effects); Net_LogPrintf (" Effects: %d", to.effects);
} }
if (bits & U_ORIGIN1) if (bits & U_ORIGIN1)
Net_LogPrintf (" X: %f", MSG_ReadCoord ()); Net_LogPrintf (" X: %f", MSG_ReadCoord (net_message));
if (bits & U_ANGLE1) if (bits & U_ANGLE1)
Net_LogPrintf (" Pitch: %d", MSG_ReadAngle ()); Net_LogPrintf (" Pitch: %d", MSG_ReadAngle (net_message));
if (bits & U_ORIGIN2) if (bits & U_ORIGIN2)
Net_LogPrintf (" Y: %f", MSG_ReadCoord ()); Net_LogPrintf (" Y: %f", MSG_ReadCoord (net_message));
if (bits & U_ANGLE2) if (bits & U_ANGLE2)
Net_LogPrintf (" Yaw: %d", MSG_ReadAngle ()); Net_LogPrintf (" Yaw: %d", MSG_ReadAngle (net_message));
if (bits & U_ORIGIN3) if (bits & U_ORIGIN3)
Net_LogPrintf (" Z: %f", MSG_ReadCoord ()); Net_LogPrintf (" Z: %f", MSG_ReadCoord (net_message));
if (bits & U_ANGLE3) if (bits & U_ANGLE3)
Net_LogPrintf (" Roll: %d", MSG_ReadAngle ()); Net_LogPrintf (" Roll: %d", MSG_ReadAngle (net_message));
// Ender (QSG - Begin) // Ender (QSG - Begin)
if (bits & U_ALPHA) if (bits & U_ALPHA)
Net_LogPrintf(" Alpha: %d", MSG_ReadByte ()); Net_LogPrintf(" Alpha: %d", MSG_ReadByte (net_message));
if (bits & U_SCALE) if (bits & U_SCALE)
Net_LogPrintf(" Scale: %d", MSG_ReadByte ()); Net_LogPrintf(" Scale: %d", MSG_ReadByte (net_message));
if (bits & U_EFFECTS2) if (bits & U_EFFECTS2)
Net_LogPrintf(" U_EFFECTS2: %d", (to.effects & 0xFF) | (MSG_ReadByte () << 8)); Net_LogPrintf(" U_EFFECTS2: %d", (to.effects & 0xFF) | (MSG_ReadByte (net_message) << 8));
if (bits & U_GLOWSIZE) if (bits & U_GLOWSIZE)
Net_LogPrintf(" GlowSize: %d", MSG_ReadByte ()); Net_LogPrintf(" GlowSize: %d", MSG_ReadByte (net_message));
if (bits & U_GLOWCOLOR) if (bits & U_GLOWCOLOR)
Net_LogPrintf(" ColorGlow: %d", MSG_ReadByte ()); Net_LogPrintf(" ColorGlow: %d", MSG_ReadByte (net_message));
if (bits & U_COLORMOD) if (bits & U_COLORMOD)
Net_LogPrintf(" Colormod: %d", MSG_ReadByte ()); Net_LogPrintf(" Colormod: %d", MSG_ReadByte (net_message));
if (bits & U_FRAME2) if (bits & U_FRAME2)
Net_LogPrintf(" Uframe2: %d", ((to.frame & 0xFF) | (MSG_ReadByte () << 8))); Net_LogPrintf(" Uframe2: %d", ((to.frame & 0xFF) | (MSG_ReadByte (net_message) << 8)));
// Ender (QSG - End) // Ender (QSG - End)
return; return;
@ -398,16 +398,16 @@ Analyze_Server_Packet (byte * data, int len)
byte *safe; byte *safe;
int slen; int slen;
// FIXME: quick-hack // FIXME: quick-hack
safe=net_message.data; safe=net_message->message->data;
slen=net_message.cursize; slen=net_message->message->cursize;
net_message.data = data; net_message->message->data = data;
net_message.cursize = len; net_message->message->cursize = len;
MSG_BeginReading (); MSG_BeginReading (net_message);
Parse_Server_Packet (); Parse_Server_Packet ();
// net_message.data = net_message_buffer; // net_message.data = net_message_buffer;
net_message.data = safe; net_message->message->data = safe;
net_message.cursize = slen; net_message->message->cursize = slen;
} }
@ -418,15 +418,15 @@ Parse_Server_Packet ()
int c, i, ii, iii, mask1, mask2; int c, i, ii, iii, mask1, mask2;
char *s; char *s;
seq1 = MSG_ReadLong (); seq1 = MSG_ReadLong (net_message);
if (msg_badread) if (net_message->badread)
return; return;
if (seq1 == -1) { if (seq1 == -1) {
Net_LogPrintf ("Special Packet"); Net_LogPrintf ("Special Packet");
} else { } else {
seq2 = MSG_ReadLong (); seq2 = MSG_ReadLong (net_message);
// FIXME: display seqs right when reliable // FIXME: display seqs right when reliable
Net_LogPrintf ("\nSeq: %ld Ack: %ld ", seq1 & 0x7FFFFFFF, Net_LogPrintf ("\nSeq: %ld Ack: %ld ", seq1 & 0x7FFFFFFF,
seq2 & 0x7FFFFFFF); seq2 & 0x7FFFFFFF);
@ -438,19 +438,19 @@ Parse_Server_Packet ()
Net_LogPrintf ("\n"); Net_LogPrintf ("\n");
while (1) { while (1) {
if (msg_badread) if (net_message->badread)
break; break;
c = MSG_ReadByte (); c = MSG_ReadByte (net_message);
if (c == -1) if (c == -1)
break; break;
// Net_LogPrintf("\n<%ld,%ld> ",seq1 & 0x7FFFFFFF,seq2 & 0x7FFFFFFF); // Net_LogPrintf("\n<%ld,%ld> ",seq1 & 0x7FFFFFFF,seq2 & 0x7FFFFFFF);
Net_LogPrintf ("<%06x> [0x%02x] ", MSG_GetReadCount (), c); Net_LogPrintf ("<%06x> [0x%02x] ", MSG_GetReadCount (net_message), c);
if (c < 53) if (c < 53)
Net_LogPrintf ("%s: ", svc_string[c]); Net_LogPrintf ("%s: ", svc_string[c]);
// else Net_LogPrintf("(UNK: %d): ",c); // else Net_LogPrintf("(UNK: %d): ",c);
if (MSG_GetReadCount () > net_message.cursize) if (MSG_GetReadCount (net_message) > net_message->message->cursize)
return; return;
switch (c) { switch (c) {
@ -463,8 +463,8 @@ Parse_Server_Packet ()
Net_LogPrintf (" <Quit>"); Net_LogPrintf (" <Quit>");
break; break;
case svc_updatestat: case svc_updatestat:
i = MSG_ReadByte (); i = MSG_ReadByte (net_message);
Net_LogPrintf (" index: %d value: %d", i, MSG_ReadByte ()); Net_LogPrintf (" index: %d value: %d", i, MSG_ReadByte (net_message));
break; break;
case svc_version: case svc_version:
#ifdef QUAKEWORLD #ifdef QUAKEWORLD
@ -475,25 +475,25 @@ Parse_Server_Packet ()
#ifdef QUAKEWORLD #ifdef QUAKEWORLD
Net_LogPrintf ("**QW OBSOLETE**"); Net_LogPrintf ("**QW OBSOLETE**");
#else #else
MSG_ReadShort (); MSG_ReadShort (net_message);
#endif #endif
break; break;
case svc_sound: case svc_sound:
i = MSG_ReadShort (); i = MSG_ReadShort (net_message);
Net_LogPrintf (": (%d) ", i); Net_LogPrintf (": (%d) ", i);
if (i & SND_VOLUME) if (i & SND_VOLUME)
Net_LogPrintf ("Volume %d ", MSG_ReadByte ()); Net_LogPrintf ("Volume %d ", MSG_ReadByte (net_message));
if (i & SND_ATTENUATION) if (i & SND_ATTENUATION)
Net_LogPrintf ("Ann: %f", Net_LogPrintf ("Ann: %f",
(float) MSG_ReadByte () / 64.0); (float) MSG_ReadByte (net_message) / 64.0);
ii = MSG_ReadByte (); ii = MSG_ReadByte (net_message);
// FIXME: well, cl. for client :-) // FIXME: well, cl. for client :-)
// Net_LogPrintf ("%d (%s) ", ii, sv.sound_precache[ii]); // Net_LogPrintf ("%d (%s) ", ii, sv.sound_precache[ii]);
Net_LogPrintf ("%d (%s) ", ii); Net_LogPrintf ("%d (%s) ", ii);
Net_LogPrintf ("Pos: "); Net_LogPrintf ("Pos: ");
for (ii = 0; ii < 3; ii++) for (ii = 0; ii < 3; ii++)
Net_LogPrintf ("%f ", MSG_ReadCoord ()); Net_LogPrintf ("%f ", MSG_ReadCoord (net_message));
Net_LogPrintf ("Ent: %d ", (i >> 3) & 1023); Net_LogPrintf ("Ent: %d ", (i >> 3) & 1023);
Net_LogPrintf ("Channel %d ", i & 7); Net_LogPrintf ("Channel %d ", i & 7);
break; break;
@ -501,49 +501,49 @@ Parse_Server_Packet ()
#ifdef QUAKEWORLD #ifdef QUAKEWORLD
Net_LogPrintf ("**QW OBSOLETE**\n"); Net_LogPrintf ("**QW OBSOLETE**\n");
#else #else
MSG_ReadFloat (); MSG_ReadFloat (net_message);
#endif #endif
break; break;
case svc_print: case svc_print:
// FIXME: i==PRINT_CHAT // FIXME: i==PRINT_CHAT
Net_LogPrintf (" [%d]", MSG_ReadByte ()); Net_LogPrintf (" [%d]", MSG_ReadByte (net_message));
Net_LogPrintf (" %s", MSG_ReadString ()); Net_LogPrintf (" %s", MSG_ReadString (net_message));
break; break;
case svc_stufftext: case svc_stufftext:
Net_LogPrintf ("%s", MSG_ReadString ()); Net_LogPrintf ("%s", MSG_ReadString (net_message));
break; break;
case svc_setangle: case svc_setangle:
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
Net_LogPrintf ("%f ", MSG_ReadAngle ()); Net_LogPrintf ("%f ", MSG_ReadAngle (net_message));
break; break;
#ifdef QUAKEWORLD #ifdef QUAKEWORLD
case svc_serverdata: case svc_serverdata:
Net_LogPrintf ("Ver: %ld", MSG_ReadLong ()); Net_LogPrintf ("Ver: %ld", MSG_ReadLong (net_message));
Net_LogPrintf (" Client ID: %ld", MSG_ReadLong ()); Net_LogPrintf (" Client ID: %ld", MSG_ReadLong (net_message));
Net_LogPrintf (" Dir: %s", MSG_ReadString ()); Net_LogPrintf (" Dir: %s", MSG_ReadString (net_message));
Net_LogPrintf (" User ID: %d", MSG_ReadByte ()); Net_LogPrintf (" User ID: %d", MSG_ReadByte (net_message));
Net_LogPrintf (" Map: %s", MSG_ReadString ()); Net_LogPrintf (" Map: %s", MSG_ReadString (net_message));
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
MSG_ReadFloat (); MSG_ReadFloat (net_message);
break; break;
#endif #endif
case svc_lightstyle: case svc_lightstyle:
i = MSG_ReadByte (); i = MSG_ReadByte (net_message);
if (i >= MAX_LIGHTSTYLES) if (i >= MAX_LIGHTSTYLES)
return; return;
Net_LogPrintf ("%d %s", i, MSG_ReadString ()); Net_LogPrintf ("%d %s", i, MSG_ReadString (net_message));
break; break;
case svc_updatename: case svc_updatename:
#ifdef QUAKEWORLD #ifdef QUAKEWORLD
Net_LogPrintf ("**QW OBSOLETE**"); Net_LogPrintf ("**QW OBSOLETE**");
#else #else
Net_LogPrintf ("%d %s", MSG_ReadByte (), MSG_ReadString ()); Net_LogPrintf ("%d %s", MSG_ReadByte (net_message), MSG_ReadString ());
#endif #endif
break; break;
case svc_updatefrags: case svc_updatefrags:
Net_LogPrintf ("player: %d frags: %d", MSG_ReadByte (), Net_LogPrintf ("player: %d frags: %d", MSG_ReadByte (net_message),
MSG_ReadShort ()); MSG_ReadShort (net_message));
break; break;
case svc_clientdata: case svc_clientdata:
#ifdef QUAKEWORLD #ifdef QUAKEWORLD
@ -551,14 +551,14 @@ Parse_Server_Packet ()
#endif #endif
break; break;
case svc_stopsound: case svc_stopsound:
Net_LogPrintf ("%d", MSG_ReadShort ()); Net_LogPrintf ("%d", MSG_ReadShort (net_message));
break; break;
case svc_updatecolors: case svc_updatecolors:
#ifdef QUAKEWORLD #ifdef QUAKEWORLD
Net_LogPrintf ("**QW OBSOLETE**"); Net_LogPrintf ("**QW OBSOLETE**");
#else #else
Net_LogPrintf ("%d %d", MSG_ReadByte (), MSG_ReadByte ()); Net_LogPrintf ("%d %d", MSG_ReadByte (net_message), MSG_ReadByte ());
#endif #endif
break; break;
case svc_particle: case svc_particle:
@ -566,46 +566,46 @@ Parse_Server_Packet ()
Net_LogPrintf ("**QW OBSOLETE**"); Net_LogPrintf ("**QW OBSOLETE**");
#else #else
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
Net_LogPrintf (" %f", MSG_ReadCoord ()); Net_LogPrintf (" %f", MSG_ReadCoord (net_message));
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
Net_LogPrintf (" %d", MSG_ReadChar ()); Net_LogPrintf (" %d", MSG_ReadChar (net_message));
Net_LogPrintf (" Count: %d", MSG_ReadByte ()); Net_LogPrintf (" Count: %d", MSG_ReadByte (net_message));
Net_LogPrintf (" Color: %d", MSG_ReadByte ()); Net_LogPrintf (" Color: %d", MSG_ReadByte (net_message));
#endif #endif
break; break;
case svc_damage: case svc_damage:
// FIXME: parse damage // FIXME: parse damage
Net_LogPrintf ("armor: %d health: %d", MSG_ReadByte (), Net_LogPrintf ("armor: %d health: %d", MSG_ReadByte (net_message),
MSG_ReadByte ()); MSG_ReadByte (net_message));
Net_LogPrintf (" from %f,%f,%f", MSG_ReadCoord (), Net_LogPrintf (" from %f,%f,%f", MSG_ReadCoord (net_message),
MSG_ReadCoord (), MSG_ReadCoord ()); MSG_ReadCoord (net_message), MSG_ReadCoord (net_message));
break; break;
case svc_spawnstatic: case svc_spawnstatic:
Net_LogPrintf ("%d", MSG_ReadByte ()); Net_LogPrintf ("Model: %d", MSG_ReadByte (net_message));
Net_LogPrintf (" Frame: %d Color: %d Skin: %", Net_LogPrintf (" Frame: %d Color: %d Skin: %",
MSG_ReadByte (), MSG_ReadByte (), MSG_ReadByte (net_message), MSG_ReadByte (net_message),
MSG_ReadByte ()); MSG_ReadByte (net_message));
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
Net_LogPrintf ("%d: %f %f", i + 1, MSG_ReadCoord (), Net_LogPrintf ("%d: %f %f", i + 1, MSG_ReadCoord (net_message),
MSG_ReadAngle ()); MSG_ReadAngle (net_message));
break; break;
case svc_spawnbinary: case svc_spawnbinary:
Net_LogPrintf ("**OBSOLETE**"); Net_LogPrintf ("**OBSOLETE**");
break; break;
case svc_spawnbaseline: case svc_spawnbaseline:
Net_LogPrintf ("%d", MSG_ReadShort ()); Net_LogPrintf ("%d", MSG_ReadShort (net_message));
Net_LogPrintf (" idx: %d", MSG_ReadByte ()); Net_LogPrintf (" idx: %d", MSG_ReadByte (net_message));
Net_LogPrintf (" Frame: %d", MSG_ReadByte ()); Net_LogPrintf (" Frame: %d", MSG_ReadByte (net_message));
Net_LogPrintf (" Colormap: %d", MSG_ReadByte ()); Net_LogPrintf (" Colormap: %d", MSG_ReadByte (net_message));
Net_LogPrintf (" Skin: %d", MSG_ReadByte ()); Net_LogPrintf (" Skin: %d", MSG_ReadByte (net_message));
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
Net_LogPrintf (" %f", MSG_ReadCoord ()); Net_LogPrintf (" %f", MSG_ReadCoord (net_message));
Net_LogPrintf (" %d", MSG_ReadAngle ()); Net_LogPrintf (" %d", MSG_ReadAngle (net_message));
}; };
break; break;
case svc_temp_entity: case svc_temp_entity:
i = MSG_ReadByte (); i = MSG_ReadByte (net_message);
switch (i) { switch (i) {
case 0: case 0:
case 1: case 1:
@ -616,25 +616,25 @@ Parse_Server_Packet ()
case 10: case 10:
case 11: case 11:
case 13: case 13:
Net_LogPrintf (" origin %f %f %f", MSG_ReadCoord (), Net_LogPrintf (" origin %f %f %f", MSG_ReadCoord (net_message),
MSG_ReadCoord (), MSG_ReadCoord ()); MSG_ReadCoord (net_message), MSG_ReadCoord (net_message));
break; break;
case 5: case 5:
case 6: case 6:
case 9: case 9:
Net_LogPrintf (" created by %d", MSG_ReadShort ()); Net_LogPrintf (" created by %d", MSG_ReadShort (net_message));
Net_LogPrintf (" origin: %f,%f,%f", Net_LogPrintf (" origin: %f,%f,%f",
MSG_ReadCoord (), MSG_ReadCoord (), MSG_ReadCoord (net_message), MSG_ReadCoord (net_message),
MSG_ReadCoord ()); MSG_ReadCoord (net_message));
Net_LogPrintf (" trace endpos: %f,%f,%f", Net_LogPrintf (" trace endpos: %f,%f,%f",
MSG_ReadCoord (), MSG_ReadCoord (), MSG_ReadCoord (net_message), MSG_ReadCoord (net_message),
MSG_ReadCoord ()); MSG_ReadCoord (net_message));
break; break;
case 2: case 2:
case 12: case 12:
Net_LogPrintf (" count: %d", MSG_ReadByte ()); Net_LogPrintf (" count: %d", MSG_ReadByte (net_message));
printf (" origin: %f,%f,%f", MSG_ReadCoord (), printf (" origin: %f,%f,%f", MSG_ReadCoord (net_message),
MSG_ReadCoord (), MSG_ReadCoord ()); MSG_ReadCoord (net_message), MSG_ReadCoord (net_message));
break; break;
default: default:
Net_LogPrintf (" unknown value %d for tempentity", Net_LogPrintf (" unknown value %d for tempentity",
@ -644,40 +644,40 @@ Parse_Server_Packet ()
break; break;
case svc_setpause: case svc_setpause:
Net_LogPrintf (" %d", MSG_ReadByte ()); Net_LogPrintf (" %d", MSG_ReadByte (net_message));
break; break;
case svc_signonnum: case svc_signonnum:
#ifdef QUAKEWORLD #ifdef QUAKEWORLD
Net_LogPrintf ("**QW OBSOLETE**"); Net_LogPrintf ("**QW OBSOLETE**");
#else #else
Net_LogPrintf ("%d", MSG_ReadByte ()); Net_LogPrintf ("%d", MSG_ReadByte (net_message));
#endif #endif
break; break;
case svc_centerprint: case svc_centerprint:
Net_LogPrintf (MSG_ReadString ()); Net_LogPrintf (MSG_ReadString (net_message));
break; break;
case svc_killedmonster: case svc_killedmonster:
break; break;
case svc_foundsecret: case svc_foundsecret:
break; break;
case svc_spawnstaticsound: case svc_spawnstaticsound:
Net_LogPrintf ("pos %f,%f,%f", MSG_ReadCoord (), Net_LogPrintf ("pos %f,%f,%f", MSG_ReadCoord (net_message),
MSG_ReadCoord (), MSG_ReadCoord ()); MSG_ReadCoord (net_message), MSG_ReadCoord (net_message));
Net_LogPrintf ("%d %d %d", MSG_ReadByte (), MSG_ReadByte (), Net_LogPrintf ("%d %d %d", MSG_ReadByte (net_message), MSG_ReadByte (net_message),
MSG_ReadByte ()); MSG_ReadByte (net_message));
break; break;
case svc_intermission: case svc_intermission:
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
Net_LogPrintf ("%f ", MSG_ReadCoord ()); Net_LogPrintf ("%f ", MSG_ReadCoord (net_message));
Net_LogPrintf ("\n"); Net_LogPrintf ("\n");
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
Net_LogPrintf ("%f ", MSG_ReadAngle ()); Net_LogPrintf ("%f ", MSG_ReadAngle (net_message));
break; break;
case svc_finale: case svc_finale:
Net_LogPrintf ("%s", MSG_ReadString ()); Net_LogPrintf ("%s", MSG_ReadString (net_message));
break; break;
case svc_cdtrack: case svc_cdtrack:
Net_LogPrintf ("%d", MSG_ReadByte ()); Net_LogPrintf ("%d", MSG_ReadByte (net_message));
break; break;
case svc_sellscreen: case svc_sellscreen:
break; break;
@ -686,98 +686,98 @@ Parse_Server_Packet ()
case svc_bigkick: case svc_bigkick:
break; break;
case svc_updateping: case svc_updateping:
Net_LogPrintf ("Player: %d ", MSG_ReadByte ()); Net_LogPrintf ("Player: %d ", MSG_ReadByte (net_message));
Net_LogPrintf ("Ping: %d", MSG_ReadShort ()); Net_LogPrintf ("Ping: %d", MSG_ReadShort (net_message));
break; break;
case svc_updateentertime: case svc_updateentertime:
Net_LogPrintf ("Player: %d ", MSG_ReadByte ()); Net_LogPrintf ("Player: %d ", MSG_ReadByte (net_message));
Net_LogPrintf ("Time: %f", MSG_ReadFloat ()); Net_LogPrintf ("Time: %f", MSG_ReadFloat (net_message));
break; break;
case svc_updatestatlong: case svc_updatestatlong:
i = MSG_ReadByte (); i = MSG_ReadByte (net_message);
Net_LogPrintf ("%d value: %ld", i, MSG_ReadLong ()); Net_LogPrintf ("%d value: %ld", i, MSG_ReadLong (net_message));
break; break;
case svc_muzzleflash: case svc_muzzleflash:
Net_LogPrintf ("%d", MSG_ReadShort ()); Net_LogPrintf ("%d", MSG_ReadShort (net_message));
break; break;
case svc_updateuserinfo: case svc_updateuserinfo:
Net_LogPrintf ("Player: %d ", MSG_ReadByte ()); Net_LogPrintf ("Player: %d ", MSG_ReadByte (net_message));
Net_LogPrintf ("ID: %ld ", MSG_ReadLong ()); Net_LogPrintf ("ID: %ld ", MSG_ReadLong (net_message));
Net_LogPrintf ("Info: %s", MSG_ReadString ()); Net_LogPrintf ("Info: %s", MSG_ReadString (net_message));
break; break;
case svc_download: case svc_download:
ii = MSG_ReadShort (); ii = MSG_ReadShort (net_message);
Net_LogPrintf ("%d bytes at %d", ii, MSG_ReadByte ()); Net_LogPrintf ("%d bytes at %d", ii, MSG_ReadByte (net_message));
for (i = 0; i < ii; i++) for (i = 0; i < ii; i++)
MSG_ReadByte (); MSG_ReadByte (net_message);
break; break;
case svc_playerinfo: case svc_playerinfo:
Net_LogPrintf ("\n\tPlayer: %d", MSG_ReadByte ()); Net_LogPrintf ("\n\tPlayer: %d", MSG_ReadByte (net_message));
mask1 = MSG_ReadShort (); mask1 = MSG_ReadShort (net_message);
Net_LogPrintf (" Mask1: %d", mask1); Net_LogPrintf (" Mask1: %d", mask1);
Net_LogPrintf (" Origin: %f,%f,%f", MSG_ReadCoord (), Net_LogPrintf (" Origin: %f,%f,%f", MSG_ReadCoord (net_message),
MSG_ReadCoord (), MSG_ReadCoord ()); MSG_ReadCoord (net_message), MSG_ReadCoord (net_message));
Net_LogPrintf (" Frame: %d", MSG_ReadByte ()); Net_LogPrintf (" Frame: %d", MSG_ReadByte (net_message));
if (mask1 & PF_MSEC) if (mask1 & PF_MSEC)
Net_LogPrintf (" Ping: %d", MSG_ReadByte ()); Net_LogPrintf (" Ping: %d", MSG_ReadByte (net_message));
if (mask1 & PF_COMMAND) { if (mask1 & PF_COMMAND) {
mask2 = MSG_ReadByte (); // command mask2 = MSG_ReadByte (net_message); // command
if (mask2 & 0x01) if (mask2 & 0x01)
Net_LogPrintf (" Pitch: %f", MSG_ReadAngle16 ()); Net_LogPrintf (" Pitch: %f", MSG_ReadAngle16 (net_message));
if (mask2 & 0x80) if (mask2 & 0x80)
Net_LogPrintf (" Yaw: %f", MSG_ReadAngle16 ()); Net_LogPrintf (" Yaw: %f", MSG_ReadAngle16 (net_message));
if (mask2 & 0x02) if (mask2 & 0x02)
Net_LogPrintf (" Roll: %f", MSG_ReadAngle16 ()); Net_LogPrintf (" Roll: %f", MSG_ReadAngle16 (net_message));
if (mask2 & 0x04) if (mask2 & 0x04)
Net_LogPrintf (" Speed1: %d", MSG_ReadShort ()); Net_LogPrintf (" Speed1: %d", MSG_ReadShort (net_message));
if (mask2 & 0x08) if (mask2 & 0x08)
Net_LogPrintf (" Speed2: %d", MSG_ReadShort ()); Net_LogPrintf (" Speed2: %d", MSG_ReadShort (net_message));
if (mask2 & 0x10) if (mask2 & 0x10)
Net_LogPrintf (" Speed3: %d", MSG_ReadShort ()); Net_LogPrintf (" Speed3: %d", MSG_ReadShort (net_message));
if (mask2 & 0x20) if (mask2 & 0x20)
Net_LogPrintf (" Flag: %d", MSG_ReadByte ()); Net_LogPrintf (" Flag: %d", MSG_ReadByte (net_message));
if (mask2 & 0x40) if (mask2 & 0x40)
Net_LogPrintf (" Impulse: %d", MSG_ReadByte ()); Net_LogPrintf (" Impulse: %d", MSG_ReadByte (net_message));
Net_LogPrintf (" Msec: %d", MSG_ReadByte ()); Net_LogPrintf (" Msec: %d", MSG_ReadByte (net_message));
} }
if (mask1 & PF_VELOCITY1) if (mask1 & PF_VELOCITY1)
Net_LogPrintf (" Xspd: %f", MSG_ReadCoord ()); Net_LogPrintf (" Xspd: %f", MSG_ReadCoord (net_message));
if (mask1 & PF_VELOCITY2) if (mask1 & PF_VELOCITY2)
Net_LogPrintf (" Yspd: %f", MSG_ReadCoord ()); Net_LogPrintf (" Yspd: %f", MSG_ReadCoord (net_message));
if (mask1 & PF_VELOCITY3) if (mask1 & PF_VELOCITY3)
Net_LogPrintf (" ZSpd: %f", MSG_ReadCoord ()); Net_LogPrintf (" ZSpd: %f", MSG_ReadCoord (net_message));
if (mask1 & PF_MODEL) if (mask1 & PF_MODEL)
Net_LogPrintf (" Model: %d", MSG_ReadByte ()); Net_LogPrintf (" Model: %d", MSG_ReadByte (net_message));
if (mask1 & PF_SKINNUM) if (mask1 & PF_SKINNUM)
Net_LogPrintf (" Skin: %d", MSG_ReadByte ()); Net_LogPrintf (" Skin: %d", MSG_ReadByte (net_message));
if (mask1 & PF_EFFECTS) if (mask1 & PF_EFFECTS)
Net_LogPrintf (" Effects: %d", MSG_ReadByte ()); Net_LogPrintf (" Effects: %d", MSG_ReadByte (net_message));
if (mask1 & PF_WEAPONFRAME) if (mask1 & PF_WEAPONFRAME)
Net_LogPrintf (" Weapon frame: %d", MSG_ReadByte ()); Net_LogPrintf (" Weapon frame: %d", MSG_ReadByte (net_message));
break; break;
case svc_nails: case svc_nails:
ii = MSG_ReadByte (); ii = MSG_ReadByte (net_message);
Net_LogPrintf (" %d (bits not parsed)", ii); Net_LogPrintf (" %d (bits not parsed)", ii);
for (i = 0; i < ii; i++) { for (i = 0; i < ii; i++) {
for (iii = 0; iii < 6; iii++) for (iii = 0; iii < 6; iii++)
MSG_ReadByte (); MSG_ReadByte (net_message);
} }
break; break;
case svc_chokecount: case svc_chokecount:
Net_LogPrintf ("%d", MSG_ReadByte ()); Net_LogPrintf ("%d", MSG_ReadByte (net_message));
break; break;
case svc_modellist: case svc_modellist:
ii = MSG_ReadByte (); ii = MSG_ReadByte (net_message);
Net_LogPrintf ("start %d", ii); Net_LogPrintf ("start %d", ii);
for (i = ii; i < 256; i++) { for (i = ii; i < 256; i++) {
s = MSG_ReadString (); s = MSG_ReadString (net_message);
if (msg_badread) if (net_message->badread)
break; break;
if (!s) if (!s)
break; break;
@ -785,18 +785,18 @@ Parse_Server_Packet ()
break; break;
Net_LogPrintf ("\n\tModel %d: %s", i, s); Net_LogPrintf ("\n\tModel %d: %s", i, s);
} }
i = MSG_ReadByte (); i = MSG_ReadByte (net_message);
if (i) if (i)
Net_LogPrintf ("\n\tnext at %d", i); Net_LogPrintf ("\n\tnext at %d", i);
else else
Net_LogPrintf ("\n\t*End of modellist*"); Net_LogPrintf ("\n\t*End of modellist*");
break; break;
case svc_soundlist: case svc_soundlist:
ii = MSG_ReadByte (); ii = MSG_ReadByte (net_message);
Net_LogPrintf ("start %d", ii); Net_LogPrintf ("start %d", ii);
for (i = ii; i < 256; i++) { for (i = ii; i < 256; i++) {
s = MSG_ReadString (); s = MSG_ReadString (net_message);
if (msg_badread) if (net_message->badread)
break; break;
if (!s) if (!s)
break; break;
@ -804,7 +804,7 @@ Parse_Server_Packet ()
break; break;
Net_LogPrintf ("\n\tSound %d: %s", i, s); Net_LogPrintf ("\n\tSound %d: %s", i, s);
} }
i = MSG_ReadByte (); i = MSG_ReadByte (net_message);
if (i) if (i)
Net_LogPrintf ("\n\tnext at %d", i); Net_LogPrintf ("\n\tnext at %d", i);
@ -814,8 +814,8 @@ Parse_Server_Packet ()
case svc_packetentities: case svc_packetentities:
while (1) { while (1) {
mask1 = (unsigned short) MSG_ReadShort(); mask1 = (unsigned short) MSG_ReadShort(net_message);
if (msg_badread) { if (net_message->badread) {
Net_LogPrintf ("Badread\n"); Net_LogPrintf ("Badread\n");
return; return;
} }
@ -825,27 +825,27 @@ Parse_Server_Packet ()
} }
break; break;
case svc_deltapacketentities: case svc_deltapacketentities:
Net_LogPrintf ("idx: %d", MSG_ReadByte ()); Net_LogPrintf ("idx: %d", MSG_ReadByte (net_message));
return; return;
break; break;
case svc_maxspeed: case svc_maxspeed:
Net_LogPrintf ("%f", MSG_ReadFloat ()); Net_LogPrintf ("%f", MSG_ReadFloat (net_message));
break; break;
case svc_entgravity: case svc_entgravity:
Net_LogPrintf ("%f", MSG_ReadFloat ()); Net_LogPrintf ("%f", MSG_ReadFloat (net_message));
break; break;
case svc_setinfo: case svc_setinfo:
Net_LogPrintf ("Player: %d ", MSG_ReadByte ()); Net_LogPrintf ("Player: %d ", MSG_ReadByte (net_message));
Net_LogPrintf ("Keyname: %s ", MSG_ReadString ()); Net_LogPrintf ("Keyname: %s ", MSG_ReadString (net_message));
Net_LogPrintf ("Value: %s", MSG_ReadString ()); Net_LogPrintf ("Value: %s", MSG_ReadString (net_message));
break; break;
case svc_serverinfo: case svc_serverinfo:
Net_LogPrintf ("Name: %s Value: %s", MSG_ReadString (), Net_LogPrintf ("Name: %s Value: %s", MSG_ReadString (net_message),
MSG_ReadString ()); MSG_ReadString (net_message));
break; break;
case svc_updatepl: case svc_updatepl:
Net_LogPrintf ("Player: %d Ploss: %d", MSG_ReadByte (), Net_LogPrintf ("Player: %d Ploss: %d", MSG_ReadByte (net_message),
MSG_ReadByte ()); MSG_ReadByte (net_message));
break; break;
default: default:
Net_LogPrintf ("**UNKNOWN**: [%d]", c); Net_LogPrintf ("**UNKNOWN**: [%d]", c);
@ -860,11 +860,11 @@ void
Analyze_Client_Packet (byte * data, int len) Analyze_Client_Packet (byte * data, int len)
{ {
// FIXME: quick-hack // FIXME: quick-hack
net_message.data = data; net_message->message->data = data;
net_message.cursize = len; net_message->message->cursize = len;
MSG_BeginReading (); MSG_BeginReading (net_message);
Parse_Client_Packet (); Parse_Client_Packet ();
net_message.data = net_message_buffer; net_message->message->data = net_message_buffer;
} }
void void
@ -874,13 +874,13 @@ Parse_Client_Packet (void)
long seq1, seq2; long seq1, seq2;
int mask; int mask;
seq1 = MSG_ReadLong (); seq1 = MSG_ReadLong (net_message);
if (seq1 == -1) { if (seq1 == -1) {
Net_LogPrintf ("Special: %s\n", MSG_ReadString ()); Net_LogPrintf ("Special: %s\n", MSG_ReadString (net_message));
return; return;
} else { } else {
// FIXME: display seqs right when reliable // FIXME: display seqs right when reliable
seq2 = MSG_ReadLong (); seq2 = MSG_ReadLong (net_message);
Net_LogPrintf ("\nSeq: %ld Ack: %ld ", seq1 & 0x7FFFFFFF, Net_LogPrintf ("\nSeq: %ld Ack: %ld ", seq1 & 0x7FFFFFFF,
seq2 & 0x7FFFFFFF); seq2 & 0x7FFFFFFF);
@ -889,16 +889,16 @@ Parse_Client_Packet (void)
if ((seq2 >>31) &0x01) Net_LogPrintf("CL_RELACK "); if ((seq2 >>31) &0x01) Net_LogPrintf("CL_RELACK ");
*/ */
Net_LogPrintf ("QP: %u\n", MSG_ReadShort ()); Net_LogPrintf ("QP: %u\n", MSG_ReadShort (net_message));
while (1) { while (1) {
if (msg_badread) if (net_message->badread)
break; break;
c = MSG_ReadByte (); c = MSG_ReadByte (net_message);
if (c == -1) if (c == -1)
break; break;
// Net_LogPrintf("<%ld,%ld> ",seq1 & 0x7FFFFFFF,seq2 & 0x7FFFFFFF); // Net_LogPrintf("<%ld,%ld> ",seq1 & 0x7FFFFFFF,seq2 & 0x7FFFFFFF);
Net_LogPrintf ("\n<%06x> [0x%02x] ", MSG_GetReadCount (), c); Net_LogPrintf ("\n<%06x> [0x%02x] ", MSG_GetReadCount (net_message), c);
if (c < 8) if (c < 8)
Net_LogPrintf ("%s: ", clc_string[c]); Net_LogPrintf ("%s: ", clc_string[c]);
@ -906,46 +906,46 @@ Parse_Client_Packet (void)
case clc_nop: case clc_nop:
break; break;
case clc_delta: case clc_delta:
Net_LogPrintf ("%d", MSG_ReadByte ()); Net_LogPrintf ("%d", MSG_ReadByte (net_message));
break; break;
case clc_move: case clc_move:
Net_LogPrintf ("checksum = %02x ", MSG_ReadByte ()); Net_LogPrintf ("checksum = %02x ", MSG_ReadByte (net_message));
Net_LogPrintf ("PacketLoss: %d", MSG_ReadByte ()); Net_LogPrintf ("PacketLoss: %d", MSG_ReadByte (net_message));
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
mask = MSG_ReadByte (); mask = MSG_ReadByte (net_message);
Net_LogPrintf ("\n\t(%d) mask = %02x", i, mask); Net_LogPrintf ("\n\t(%d) mask = %02x", i, mask);
if (mask & 0x01) if (mask & 0x01)
Net_LogPrintf (" Tilt: %f", MSG_ReadAngle16 ()); Net_LogPrintf (" Tilt: %f", MSG_ReadAngle16 (net_message));
if (mask & 0x80) if (mask & 0x80)
Net_LogPrintf (" Yaw: %f", MSG_ReadAngle16 ()); Net_LogPrintf (" Yaw: %f", MSG_ReadAngle16 (net_message));
if (mask & 0x02) if (mask & 0x02)
Net_LogPrintf (" Roll: %f", MSG_ReadAngle16 ()); Net_LogPrintf (" Roll: %f", MSG_ReadAngle16 (net_message));
if (mask & 0x04) if (mask & 0x04)
Net_LogPrintf (" Fwd: %d", MSG_ReadShort ()); Net_LogPrintf (" Fwd: %d", MSG_ReadShort (net_message));
if (mask & 0x08) if (mask & 0x08)
Net_LogPrintf (" Right: %d", MSG_ReadShort ()); Net_LogPrintf (" Right: %d", MSG_ReadShort (net_message));
if (mask & 0x10) if (mask & 0x10)
Net_LogPrintf (" Up: %d", MSG_ReadShort ()); Net_LogPrintf (" Up: %d", MSG_ReadShort (net_message));
if (mask & 0x20) if (mask & 0x20)
Net_LogPrintf (" Flags: %d", MSG_ReadByte ()); Net_LogPrintf (" Flags: %d", MSG_ReadByte (net_message));
if (mask & 0x40) if (mask & 0x40)
Net_LogPrintf (" Impulse: %d", MSG_ReadByte ()); Net_LogPrintf (" Impulse: %d", MSG_ReadByte (net_message));
Net_LogPrintf (" Msec: %d", MSG_ReadByte ()); Net_LogPrintf (" Msec: %d", MSG_ReadByte (net_message));
} }
break; break;
case clc_stringcmd: case clc_stringcmd:
Net_LogPrintf ("%s", MSG_ReadString ()); Net_LogPrintf ("%s", MSG_ReadString (net_message));
break; break;
case clc_tmove: case clc_tmove:
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
Net_LogPrintf ("%f ", MSG_ReadCoord ()); Net_LogPrintf ("%f ", MSG_ReadCoord (net_message));
break; break;
case clc_upload: case clc_upload:
ii = MSG_ReadShort (); ii = MSG_ReadShort (net_message);
Net_LogPrintf ("%d bytes at %d", ii, MSG_ReadByte ()); Net_LogPrintf ("%d bytes at %d", ii, MSG_ReadByte (net_message));
for (i = 0; i < ii; i++) for (i = 0; i < ii; i++)
MSG_ReadByte (); MSG_ReadByte (net_message);
break; break;
default: default:
Net_LogPrintf ("**UNKNOWN**: [%d]", c); Net_LogPrintf ("**UNKNOWN**: [%d]", c);