本文整理汇总了C++中SHOWNET函数的典型用法代码示例。如果您正苦于以下问题:C++ SHOWNET函数的具体用法?C++ SHOWNET怎么用?C++ SHOWNET使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SHOWNET函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CL_ParseServerMessage
/*
=====================
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");
}
//
// 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 == -1 ) {
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\n");
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;
}
}
}
示例2: CL_ParseServerMessage
/*
* 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" );
}
// parse the message
while( 1 )
{
if( msg->readcount > msg->cursize )
{
Com_Error( ERR_DROP, "CL_ParseServerMessage: Bad server message" );
break;
}
cmd = MSG_ReadByte( msg );
if( cl_debug_serverCmd->integer & 4 )
{
if( cmd == -1 )
Com_Printf( "%3i:CMD %i %s\n", msg->readcount-1, cmd, "EOF" );
else
Com_Printf( "%3i:CMD %i %s\n", msg->readcount-1, cmd, !svc_strings[cmd] ? "bad" : svc_strings[cmd] );
}
if( cmd == -1 )
{
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" );
break;
case svc_nop:
// Com_Printf( "svc_nop\n" );
break;
case svc_servercmd:
if( !cls.reliable )
{
int cmdNum = MSG_ReadLong( msg );
if( cmdNum < 0 )
{
Com_Error( ERR_DROP, "CL_ParseServerMessage: Invalid cmdNum value received: %i\n",
cmdNum );
return;
}
if( cmdNum <= cls.lastExecutedServerCommand )
{
MSG_ReadString( msg ); // read but ignore
break;
}
cls.lastExecutedServerCommand = cmdNum;
}
// fall through
case svc_servercs: // configstrings from demo files. they don't have acknowledge
CL_ParseServerCommand( msg );
break;
case svc_serverdata:
if( cls.state == CA_HANDSHAKE )
{
Cbuf_Execute(); // make sure any stuffed commands are done
CL_ParseServerData( msg );
}
else
{
return; // ignore rest of the packet (serverdata is always sent alone)
}
break;
case svc_spawnbaseline:
CL_ParseBaseline( msg );
break;
case svc_download:
CL_ParseDownload( msg );
break;
//.........这里部分代码省略.........
示例3: CL_ParseSnapshot
/*
================
CL_ParseSnapshot
If the snapshot is parsed properly, it will be copied to
cl.frame and saved in cl.frames[]. If the snapshot is invalid
for any reason, no changes to the state will be made at all.
================
*/
void CL_ParseSnapshot( msg_t *msg ) {
int len;
clSnapshot_t *old;
clSnapshot_t newSnap;
int deltaNum;
int oldMessageNum;
int i, packetNum;
// get the reliable sequence acknowledge number
clc.reliableAcknowledge = MSG_ReadLong( msg );
// read in the new snapshot to a temporary buffer
// we will only copy to cl.frame if it is valid
memset (&newSnap, 0, sizeof(newSnap));
newSnap.serverCommandNum = clc.serverCommandSequence;
newSnap.serverTime = MSG_ReadLong( msg );
newSnap.messageNum = MSG_ReadLong( msg );
deltaNum = MSG_ReadByte( msg );
if ( !deltaNum ) {
newSnap.deltaNum = -1;
} else {
newSnap.deltaNum = newSnap.messageNum - deltaNum;
}
newSnap.cmdNum = MSG_ReadLong( msg );
newSnap.snapFlags = MSG_ReadByte( msg );
// If the frame is delta compressed from data that we
// no longer have available, we must suck up the rest of
// the frame, but not use it, then ask for a non-compressed
// message
if ( newSnap.deltaNum <= 0 ) {
newSnap.valid = qtrue; // uncompressed frame
old = NULL;
} else {
old = &cl.frames[newSnap.deltaNum & PACKET_MASK];
if ( !old->valid ) {
// should never happen
Com_Printf ("Delta from invalid frame (not supposed to happen!).\n");
} else if ( old->messageNum != newSnap.deltaNum ) {
// The frame that the server did the delta from
// is too old, so we can't reconstruct it properly.
Com_Printf ("Delta frame too old.\n");
} else if ( cl.parseEntitiesNum - old->parseEntitiesNum > MAX_PARSE_ENTITIES ) {
Com_Printf ("Delta parseEntitiesNum too old.\n");
} else {
newSnap.valid = qtrue; // valid delta parse
}
}
// read areamask
len = MSG_ReadByte( msg );
MSG_ReadData( msg, &newSnap.areamask, len);
// read playerinfo
SHOWNET( msg, "playerstate" );
if ( old ) {
MSG_ReadDeltaPlayerstate( msg, &old->ps, &newSnap.ps );
} else {
MSG_ReadDeltaPlayerstate( msg, NULL, &newSnap.ps );
}
// read packet entities
SHOWNET( msg, "packet entities" );
CL_ParsePacketEntities( msg, old, &newSnap );
// if not valid, dump the entire thing now that it has
// been properly read
if ( !newSnap.valid ) {
return;
}
// clear the valid flags of any snapshots between the last
// received and this one
oldMessageNum = cl.frame.messageNum + 1;
if ( cl.frame.messageNum - oldMessageNum >= PACKET_BACKUP ) {
oldMessageNum = cl.frame.messageNum - ( PACKET_BACKUP - 1 );
}
for ( ; oldMessageNum < newSnap.messageNum ; oldMessageNum++ ) {
cl.frames[oldMessageNum & PACKET_MASK].valid = qfalse;
}
// copy to the current good spot
cl.frame = newSnap;
// calculate ping time
for ( i = 0 ; i < PACKET_BACKUP ; i++ ) {
packetNum = ( clc.netchan.outgoingSequence - 1 - i ) & PACKET_MASK;
if ( cl.frame.cmdNum == cl.packetCmdNumber[ packetNum ] ) {
cl.frame.ping = cls.realtime - cl.packetTime[ packetNum ];
//.........这里部分代码省略.........
示例4: CL_ParseServerMessage
void CL_ParseServerMessage (void)
{
int cmd;
int i;
//
// if recording demos, copy the message out
//
if (cl_shownet.value == 1)
Con_Printf ("%i ",net_message.cursize);
else if (cl_shownet.value == 2)
Con_Printf ("------------------\n");
cl.onground = false; // unless the server says otherwise
//
// parse the message
//
MSG_BeginReading ();
while (1)
{
if (msg_badread)
Host_Error ("CL_ParseServerMessage: Bad server message");
cmd = MSG_ReadByte ();
if (cmd == -1)
{
SHOWNET("END OF MESSAGE");
return; // end of message
}
// if the high bit of the command byte is set, it is a fast update
if (cmd & 128)
{
SHOWNET("fast update");
CL_ParseUpdate (cmd&127);
continue;
}
SHOWNET(svc_strings[cmd]);
// other commands
switch (cmd)
{
default:
Host_Error ("CL_ParseServerMessage: Illegible server message\n");
break;
case svc_nop:
// Con_Printf ("svc_nop\n");
break;
case svc_time:
cl.mtime[1] = cl.mtime[0];
cl.mtime[0] = MSG_ReadFloat ();
break;
case svc_clientdata:
i = MSG_ReadShort ();
CL_ParseClientdata (i);
break;
case svc_version:
i = MSG_ReadLong ();
if (i != PROTOCOL_VERSION)
Host_Error ("CL_ParseServerMessage: Server is protocol %i instead of %i\n", i, PROTOCOL_VERSION);
break;
case svc_disconnect:
Host_EndGame ("Server disconnected\n");
case svc_print:
Con_Printf ("%s", MSG_ReadString ());
break;
case svc_centerprint:
SCR_CenterPrint (MSG_ReadString ());
break;
case svc_stufftext:
Cbuf_AddText (MSG_ReadString ());
break;
case svc_damage:
V_ParseDamage ();
break;
case svc_serverinfo:
CL_ParseServerInfo ();
vid.recalc_refdef = true; // leave intermission full screen
break;
case svc_setangle:
for (i=0 ; i<3 ; i++)
cl.viewangles[i] = MSG_ReadAngle ();
break;
case svc_setview:
cl.viewentity = MSG_ReadShort ();
//.........这里部分代码省略.........
示例5: CL_ParseServerMessage
/*
=====================
CL_ParseServerMessage
=====================
*/
void CL_ParseServerMessage( msg_t *msg )
{
int cmd;
// msg_t msgback;
// msgback = *msg;
if ( cl_shownet->integer == 1 )
{
Log::Notice("%i ", msg->cursize );
}
else if ( cl_shownet->integer >= 2 )
{
Log::Notice( "------------------\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( errorParm_t::ERR_DROP, "CL_ParseServerMessage: read past end of server message" );
}
cmd = MSG_ReadByte( msg );
if ( cmd < 0 || cmd == svc_EOF )
{
SHOWNET( msg, "END OF MESSAGE" );
break;
}
if ( cl_shownet->integer >= 2 )
{
if ( !svc_strings[ cmd ] )
{
Log::Notice( "%3i:BAD CMD %i\n", msg->readcount - 1, cmd );
}
else
{
SHOWNET( msg, svc_strings[ cmd ] );
}
}
// other commands
switch ( cmd )
{
default:
Com_Error( errorParm_t::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;
}
}
}
示例6: CLQ2_ParseFrame
void CLQ2_ParseFrame( QMsg& message ) {
Com_Memset( &cl.q2_frame, 0, sizeof ( cl.q2_frame ) );
cl.q2_frame.serverframe = message.ReadLong();
cl.q2_frame.deltaframe = message.ReadLong();
cl.q2_frame.servertime = cl.q2_frame.serverframe * 100;
// BIG HACK to let old demos continue to work
if ( cls.q2_serverProtocol != 26 ) {
cl.q2_surpressCount = message.ReadByte();
}
if ( cl_shownet->value == 3 ) {
common->Printf( " frame:%i delta:%i\n", cl.q2_frame.serverframe,
cl.q2_frame.deltaframe );
}
// If the frame is delta compressed from data that we
// no longer have available, we must suck up the rest of
// the frame, but not use it, then ask for a non-compressed
// message
q2frame_t* old;
if ( cl.q2_frame.deltaframe <= 0 ) {
cl.q2_frame.valid = true; // uncompressed frame
old = NULL;
cls.q2_demowaiting = false; // we can start recording now
} else {
old = &cl.q2_frames[ cl.q2_frame.deltaframe & UPDATE_MASK_Q2 ];
if ( !old->valid ) {// should never happen
common->Printf( "Delta from invalid frame (not supposed to happen!).\n" );
}
if ( old->serverframe != cl.q2_frame.deltaframe ) { // The frame that the server did the delta from
// is too old, so we can't reconstruct it properly.
common->Printf( "Delta frame too old.\n" );
} else if ( cl.parseEntitiesNum - old->parse_entities > MAX_PARSE_ENTITIES_Q2 - 128 ) {
common->Printf( "Delta parse_entities too old.\n" );
} else {
cl.q2_frame.valid = true; // valid delta parse
}
}
// clamp time
if ( cl.serverTime > cl.q2_frame.servertime ) {
cl.serverTime = cl.q2_frame.servertime;
} else if ( cl.serverTime < cl.q2_frame.servertime - 100 ) {
cl.serverTime = cl.q2_frame.servertime - 100;
}
// read areabits
int len = message.ReadByte();
message.ReadData( &cl.q2_frame.areabits, len );
// read playerinfo
int cmd = message.ReadByte();
SHOWNET( message, svcq2_strings[ cmd ] );
if ( cmd != q2svc_playerinfo ) {
common->Error( "CLQ2_ParseFrame: not playerinfo" );
}
CLQ2_ParsePlayerstate( message, old, &cl.q2_frame );
// read packet entities
cmd = message.ReadByte();
SHOWNET( message, svcq2_strings[ cmd ] );
if ( cmd != q2svc_packetentities ) {
common->Error( "CLQ2_ParseFrame: not packetentities" );
}
CLQ2_ParsePacketEntities( message, old, &cl.q2_frame );
// save the frame off in the backup array for later delta comparisons
cl.q2_frames[ cl.q2_frame.serverframe & UPDATE_MASK_Q2 ] = cl.q2_frame;
if ( cl.q2_frame.valid ) {
// getting a valid frame message ends the connection process
if ( cls.state != CA_ACTIVE ) {
cls.state = CA_ACTIVE;
cl.q2_predicted_origin[ 0 ] = cl.q2_frame.playerstate.pmove.origin[ 0 ] * 0.125;
cl.q2_predicted_origin[ 1 ] = cl.q2_frame.playerstate.pmove.origin[ 1 ] * 0.125;
cl.q2_predicted_origin[ 2 ] = cl.q2_frame.playerstate.pmove.origin[ 2 ] * 0.125;
VectorCopy( cl.q2_frame.playerstate.viewangles, cl.q2_predicted_angles );
if ( cls.q2_disable_servercount != cl.servercount &&
cl.q2_refresh_prepped ) {
SCR_EndLoadingPlaque(); // get rid of loading plaque
}
}
cl.q2_sound_prepped = true; // can start mixing ambient sounds
// fire entity events
CLQ2_FireEntityEvents( &cl.q2_frame );
CLQ2_CheckPredictionError();
}
}
示例7: CL_ParseServerMessage
/*
=====================
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:
//.........这里部分代码省略.........
示例8: CL_ParseServerMessage
/*
=====================
CL_ParseServerMessage
=====================
*/
void CL_ParseServerMessage (void)
{
int cmd;
int i, j, k;
int EntityCount = 0;
int EntitySize = 0;
int before;
static double lasttime;
static qboolean packet_loss = false;
entity_t *ent;
short RemovePlace, OrigPlace, NewPlace, AddedIndex;
int sc1, sc2;
byte test;
float compangles[2][3];
vec3_t deltaangles;
//
// if recording demos, copy the message out
//
if (net_message.cursize > LastServerMessageSize)
{
LastServerMessageSize = net_message.cursize;
}
if (cl_shownet.integer == 1)
{
Con_Printf ("Time: %2.2f Pck: %i ", realtime - lasttime, net_message.cursize);
lasttime = realtime;
}
else if (cl_shownet.integer == 2)
Con_Printf ("------------------\n");
cl.onground = false; // unless the server says otherwise
//
// parse the message
//
MSG_BeginReading ();
while (1)
{
if (msg_badread)
Host_Error ("%s: Bad server message", __thisfunc__);
cmd = MSG_ReadByte ();
if (cmd == -1)
{
if (cl_shownet.integer == 1)
Con_Printf ("Ent: %i (%i bytes)",EntityCount,EntitySize);
SHOWNET("END OF MESSAGE");
return; // end of message
}
// if the high bit of the command byte is set, it is a fast update
if (cmd & 128)
{
before = msg_readcount;
SHOWNET("fast update");
if (packet_loss)
CL_ParseUpdate2 (cmd&127);
else
CL_ParseUpdate (cmd&127);
EntityCount++;
EntitySize += msg_readcount - before + 1;
continue;
}
if (cmd < NUM_SVC_STRINGS) // else, it'll hit the illegible message below
{
SHOWNET(svc_strings[cmd]);
}
// other commands
switch (cmd)
{
default:
// CL_DumpPacket ();
Host_Error ("%s: Illegible server message %d", __thisfunc__, cmd);
break;
case svc_nop:
// Con_Printf ("svc_nop\n");
break;
case svc_time:
cl.mtime[1] = cl.mtime[0];
cl.mtime[0] = MSG_ReadFloat ();
break;
case svc_clientdata:
i = MSG_ReadShort ();
CL_ParseClientdata (i);
break;
//.........这里部分代码省略.........
示例9: CL_ParseFrame
void
CL_ParseFrame(void)
{
int cmd;
int len;
frame_t *old;
memset(&cl.frame, 0, sizeof(cl.frame));
cl.frame.serverframe = MSG_ReadLong(&net_message);
cl.frame.deltaframe = MSG_ReadLong(&net_message);
cl.frame.servertime = cl.frame.serverframe * 100;
/* BIG HACK to let old demos continue to work */
if (cls.serverProtocol != 26)
{
cl.surpressCount = MSG_ReadByte(&net_message);
}
if (cl_shownet->value == 3)
{
Com_Printf(" frame:%i delta:%i\n", cl.frame.serverframe,
cl.frame.deltaframe);
}
/* If the frame is delta compressed from data that we
no longer have available, we must suck up the rest of
the frame, but not use it, then ask for a non-compressed
message */
if (cl.frame.deltaframe <= 0)
{
cl.frame.valid = true; /* uncompressed frame */
old = NULL;
cls.demowaiting = false; /* we can start recording now */
}
else
{
old = &cl.frames[cl.frame.deltaframe & UPDATE_MASK];
if (!old->valid)
{
/* should never happen */
Com_Printf("Delta from invalid frame (not supposed to happen!).\n");
}
if (old->serverframe != cl.frame.deltaframe)
{
/* The frame that the server did the delta from
is too old, so we can't reconstruct it properly. */
Com_Printf("Delta frame too old.\n");
}
else if (cl.parse_entities - old->parse_entities > MAX_PARSE_ENTITIES -
128)
{
Com_Printf("Delta parse_entities too old.\n");
}
else
{
cl.frame.valid = true; /* valid delta parse */
}
}
/* clamp time */
if (cl.time > cl.frame.servertime)
{
cl.time = cl.frame.servertime;
}
else if (cl.time < cl.frame.servertime - 100)
{
cl.time = cl.frame.servertime - 100;
}
/* read areabits */
len = MSG_ReadByte(&net_message);
MSG_ReadData(&net_message, &cl.frame.areabits, len);
/* read playerinfo */
cmd = MSG_ReadByte(&net_message);
SHOWNET(svc_strings[cmd]);
if (cmd != svc_playerinfo)
{
Com_Error(ERR_DROP, "CL_ParseFrame: 0x%X not playerinfo", cmd);
}
CL_ParsePlayerstate(old, &cl.frame);
/* read packet entities */
cmd = MSG_ReadByte(&net_message);
SHOWNET(svc_strings[cmd]);
if (cmd != svc_packetentities)
{
Com_Error(ERR_DROP, "CL_ParseFrame: 0x%X not packetentities", cmd);
}
CL_ParsePacketEntities(old, &cl.frame);
/* save the frame off in the backup array for later delta comparisons */
//.........这里部分代码省略.........
示例10: CLQW_ParseServerMessage
void CLQW_ParseServerMessage( QMsg& message ) {
CLQ1_ClearProjectiles();
//
// if recording demos, copy the message out
//
if ( cl_shownet->value == 1 ) {
common->Printf( "%i ",message.cursize );
} else if ( cl_shownet->value == 2 ) {
common->Printf( "------------------\n" );
}
CLQW_ParseClientdata();
//
// parse the message
//
while ( 1 ) {
if ( message.badread ) {
common->Error( "CLQW_ParseServerMessage: Bad server message" );
break;
}
int cmd = message.ReadByte();
if ( cmd == -1 ) {
message.readcount++; // so the EOM showner has the right value
SHOWNET( message, "END OF MESSAGE" );
break;
}
SHOWNET( message, svcqw_strings[ cmd ] );
// other commands
switch ( cmd ) {
default:
common->Error( "CLQW_ParseServerMessage: Illegible server message" );
break;
case q1svc_nop:
break;
case q1svc_disconnect:
CLQW_ParseDisconnect();
break;
case q1svc_print:
CLQW_ParsePrint( message );
break;
case q1svc_centerprint:
CL_ParseCenterPrint( message );
break;
case q1svc_stufftext:
CL_ParseStuffText( message );
break;
case q1svc_damage:
VQH_ParseDamage( message );
break;
case qwsvc_serverdata:
CLQW_ParseServerData( message );
break;
case q1svc_setangle:
CLQH_ParseSetAngle( message );
break;
case q1svc_lightstyle:
CLQH_ParseLightStyle( message );
break;
case q1svc_sound:
CLQW_ParseStartSoundPacket( message );
break;
case q1svc_stopsound:
CLQH_ParseStopSound( message );
break;
case q1svc_updatefrags:
CLQW_ParseUpdateFrags( message );
break;
case qwsvc_updateping:
CLQW_ParseUpdatePing( message );
break;
case qwsvc_updatepl:
CLQW_ParseUpdatePacketLossage( message );
break;
case qwsvc_updateentertime:
CLQW_ParseUpdateEnterTime( message );
break;
case q1svc_spawnbaseline:
CLQ1_ParseSpawnBaseline( message );
break;
case q1svc_spawnstatic:
CLQ1_ParseSpawnStatic( message );
break;
case q1svc_temp_entity:
CLQW_ParseTEnt( message );
break;
case q1svc_killedmonster:
CLQH_ParseKilledMonster();
break;
case q1svc_foundsecret:
CLQH_ParseFoundSecret();
break;
case q1svc_updatestat:
CLQW_ParseUpdateStat( message );
break;
//.........这里部分代码省略.........
示例11: CLQ1_ParseServerMessage
void CLQ1_ParseServerMessage( QMsg& message ) {
if ( cl_shownet->value == 1 ) {
common->Printf( "%i ", message.cursize );
} else if ( cl_shownet->value == 2 ) {
common->Printf( "------------------\n" );
}
cl.qh_onground = false; // unless the server says otherwise
//
// parse the message
//
message.BeginReadingOOB();
while ( 1 ) {
if ( message.badread ) {
common->Error( "CLQ1_ParseServerMessage: Bad server message" );
}
int cmd = message.ReadByte();
if ( cmd == -1 ) {
SHOWNET( message, "END OF MESSAGE" );
return; // end of message
}
// if the high bit of the command byte is set, it is a fast update
if ( cmd & Q1U_SIGNAL ) {
SHOWNET( message, "fast update" );
CLQ1_ParseUpdate( message, cmd & 127 );
continue;
}
SHOWNET( message, svcq1_strings[ cmd ] );
// other commands
switch ( cmd ) {
default:
common->Error( "CLQ1_ParseServerMessage: Illegible server message\n" );
break;
case q1svc_nop:
break;
case q1svc_time:
CLQH_ParseTime( message );
break;
case q1svc_clientdata:
CLQ1_ParseClientdata( message );
break;
case q1svc_version:
CLQ1_ParseVersion( message );
break;
case q1svc_disconnect:
CLQH_ParseDisconnect();
break;
case q1svc_print:
CLQ1_ParsePrint( message );
break;
case q1svc_centerprint:
CL_ParseCenterPrint( message );
break;
case q1svc_stufftext:
CL_ParseStuffText( message );
break;
case q1svc_damage:
VQH_ParseDamage( message );
break;
case q1svc_serverinfo:
CLQ1_ParseServerInfo( message );
break;
case q1svc_setangle:
CLQH_ParseSetAngle( message );
break;
case q1svc_setview:
CLQH_ParseSetView( message );
break;
case q1svc_lightstyle:
CLQH_ParseLightStyle( message );
break;
case q1svc_sound:
CLQ1_ParseStartSoundPacket( message );
break;
case q1svc_stopsound:
CLQH_ParseStopSound( message );
break;
case q1svc_updatename:
CLQ1_UpdateName( message );
break;
case q1svc_updatefrags:
CLQ1_ParseUpdateFrags( message );
break;
case q1svc_updatecolors:
CLQ1_ParseUpdateColours( message );
break;
case q1svc_particle:
CLQ1_ParseParticleEffect( message );
break;
case q1svc_spawnbaseline:
CLQ1_ParseSpawnBaseline( message );
break;
case q1svc_spawnstatic:
CLQ1_ParseSpawnStatic( message );
//.........这里部分代码省略.........
示例12: CL_ParseServerMessage
/*
=====================
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 ( !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\n");
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_lua:
//Make Lua VMCall Here. -Hxrmn
CL_SetLuaMessage(msg);
VM_Call (cgvm, CG_LUA_MSG);
break;
}
}
}
示例13: CL_ParseServerMessage
/*
=====================
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;
}
}
}
示例14: CL_ParseServerMessage
/*
=====================
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 || cmd > svc_EOF) // MSG_ReadByte might return -1 and we can't access our svc_strings array ...
{
Com_Printf("%3i:BAD BYTE %i\n", msg->readcount - 1, cmd); // -> ERR_DROP
}
else
{
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);
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;
}
}
CL_ParseBinaryMessage(msg);
}
示例15: CLNQ_ParseServerMessage
void CLNQ_ParseServerMessage (void)
{
int cmd;
int i;
qbool message_with_datagram; // hack to fix glitches when receiving a packet
// without a datagram
nq_player_teleported = false; // OMG, it's a hack!
message_with_datagram = false;
cl_entframecount++;
if (cl_shownet.value == 1)
Com_Printf ("%i ", net_message.cursize);
else if (cl_shownet.value == 2)
Com_Printf ("------------------\n");
cl.onground = false; // unless the server says otherwise
//
// parse the message
//
//MSG_BeginReading ();
while (1)
{
if (msg_badread)
Host_Error ("CL_ParseServerMessage: Bad server message");
cmd = MSG_ReadByte ();
if (cmd == -1)
{
SHOWNET("END OF MESSAGE");
if (!message_with_datagram) {
cl_entframecount--;
}
else
{
VectorCopy (nq_mviewangles[0], nq_mviewangles[1]);
VectorCopy (nq_mviewangles_temp, nq_mviewangles[0]);
}
return; // end of message
}
// if the high bit of the command byte is set, it is a fast update
if (cmd & 128)
{
SHOWNET("fast update");
NQD_ParseUpdate (cmd&127);
continue;
}
if (cmd < num_svc_strings)
SHOWNET(svc_strings[cmd]);
// other commands
switch (cmd)
{
default:
Host_Error ("CL_ParseServerMessage: Illegible server message");
break;
case svc_nop:
break;
case nq_svc_time:
nq_mtime[1] = nq_mtime[0];
nq_mtime[0] = MSG_ReadFloat ();
cl.servertime = nq_mtime[0];
message_with_datagram = true;
break;
case nq_svc_clientdata:
i = MSG_ReadShort ();
NQD_ParseClientdata (i);
break;
case nq_svc_version:
i = MSG_ReadLong ();
if (i != NQ_PROTOCOL_VERSION)
Host_Error ("CL_ParseServerMessage: Server is protocol %i instead of %i\n", i, NQ_PROTOCOL_VERSION);
break;
case svc_disconnect:
Com_Printf ("\n======== End of demo ========\n\n");
CL_NextDemo ();
Host_EndGame ();
Host_Abort ();
break;
case svc_print:
NQD_ParsePrint ();
break;
case svc_centerprint:
SCR_CenterPrint (MSG_ReadString ());
break;
case svc_stufftext:
NQD_ParseStufftext ();
//.........这里部分代码省略.........