/* ===================== CL_ParseServerMessage ===================== */ void CL_ParseServerMessage( msg_t *msg ) { int cmd; // msg_t msgback; // msgback = *msg; if ( cl_shownet->integer == 1 ) { Com_Printf("%i ", msg->cursize ); } else if ( cl_shownet->integer >= 2 ) { Com_Printf( "------------------\n" ); } MSG_Bitstream( msg ); // get the reliable sequence acknowledge number clc.reliableAcknowledge = MSG_ReadLong( msg ); // if ( clc.reliableAcknowledge < clc.reliableSequence - MAX_RELIABLE_COMMANDS ) { clc.reliableAcknowledge = clc.reliableSequence; } // // parse the message // while ( 1 ) { if ( msg->readcount > msg->cursize ) { Com_Error( ERR_DROP, "CL_ParseServerMessage: read past end of server message" ); } cmd = MSG_ReadByte( msg ); // See if this is an extension command after the EOF, which means we // got data that a legacy client should ignore. if ( ( cmd == svc_EOF ) && ( MSG_LookaheadByte( msg ) == svc_extension ) ) { SHOWNET( msg, "EXTENSION" ); MSG_ReadByte( msg ); // throw the svc_extension byte away. cmd = MSG_ReadByte( msg ); // something legacy clients can't do! // sometimes you get a svc_extension at end of stream...dangling // bits in the huffman decoder giving a bogus value? if ( cmd == -1 ) { cmd = svc_EOF; } } if ( cmd == svc_EOF ) { SHOWNET( msg, "END OF MESSAGE" ); break; } if ( cl_shownet->integer >= 2 ) { if ( !svc_strings[ cmd ] ) { Com_Printf( "%3i:BAD CMD %i\n", msg->readcount - 1, cmd ); } else { SHOWNET( msg, svc_strings[ cmd ] ); } } // other commands switch ( cmd ) { default: Com_Error( ERR_DROP, "CL_ParseServerMessage: Illegible server message %d", cmd ); case svc_nop: break; case svc_serverCommand: CL_ParseCommandString( msg ); break; case svc_gamestate: CL_ParseGamestate( msg ); break; case svc_snapshot: CL_ParseSnapshot( msg ); break; case svc_download: CL_ParseDownload( msg ); break; case svc_voip: #ifdef USE_VOIP CL_ParseVoip( msg ); #endif break; } } }
/* ===================== CL_ParseServerMessage ===================== */ void CL_ParseServerMessage( msg_t *msg ) { int cmd; if ( cl_shownet->integer == 1 ) { Com_Printf ("%i ",msg->cursize); } else if ( cl_shownet->integer >= 2 ) { Com_Printf ("------------------\n"); } MSG_Bitstream(msg); // get the reliable sequence acknowledge number clc.reliableAcknowledge = MSG_ReadLong( msg ); // if ( clc.reliableAcknowledge < clc.reliableSequence - MAX_RELIABLE_COMMANDS ) { clc.reliableAcknowledge = clc.reliableSequence; } // // parse the message // while ( 1 ) { if ( msg->readcount > msg->cursize ) { Com_Error (ERR_DROP,"CL_ParseServerMessage: read past end of server message"); break; } cmd = MSG_ReadByte( msg ); if (cmd == svc_EOF) { SHOWNET( msg, "END OF MESSAGE" ); break; } if ( cl_shownet->integer >= 2 ) { if ( (cmd < 0) || (!svc_strings[cmd]) ) { Com_Printf( "%3i:BAD CMD %i\n", msg->readcount-1, cmd ); } else { SHOWNET( msg, svc_strings[cmd] ); } } // other commands switch ( cmd ) { default: Com_Error (ERR_DROP,"CL_ParseServerMessage: Illegible server message"); break; case svc_nop: break; case svc_serverCommand: CL_ParseCommandString( msg ); break; case svc_gamestate: CL_ParseGamestate( msg ); break; case svc_snapshot: CL_ParseSnapshot( msg ); break; case svc_download: CL_ParseDownload( msg ); break; case svc_voipSpeex: #ifdef USE_VOIP CL_ParseVoip( msg, qtrue ); #endif break; case svc_voipOpus: #ifdef USE_VOIP CL_ParseVoip( msg, !clc.voipEnabled ); #endif break; } } }