本文整理汇总了C++中MSG_ReadDeltaEntity函数的典型用法代码示例。如果您正苦于以下问题:C++ MSG_ReadDeltaEntity函数的具体用法?C++ MSG_ReadDeltaEntity怎么用?C++ MSG_ReadDeltaEntity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MSG_ReadDeltaEntity函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CL_DeltaEntity
/*
==================
CL_DeltaEntity
Parses deltas from the given base and adds the resulting entity
to the current frame
==================
*/
void CL_DeltaEntity( msg_t *msg, clSnapshot_t *frame, int newnum, entityState_t *old, qboolean unchanged )
{
entityState_t *state;
// save the parsed entity state into the big circular buffer so
// it can be used as the source for a later delta
state = &cl.parseEntities[ cl.parseEntitiesNum & ( MAX_PARSE_ENTITIES - 1 ) ];
if ( unchanged )
{
*state = *old;
}
else
{
MSG_ReadDeltaEntity( msg, old, state, newnum );
}
if ( state->number == ( MAX_GENTITIES - 1 ) )
{
return; // entity was delta removed
}
cl.parseEntitiesNum++;
frame->numEntities++;
}
开发者ID:justhacking,项目名称:Unvanquished,代码行数:33,代码来源:cl_parse.c
示例2: CL_ParseBaseline
/*
==================
CL_ParseBaseline
==================
*/
void CL_ParseBaseline( sizebuf_t *msg )
{
int newnum;
float timebase;
cl_entity_t *ent;
Delta_InitClient (); // finalize client delta's
newnum = BF_ReadWord( msg );
if( newnum < 0 ) Host_Error( "CL_SpawnEdict: invalid number %i\n", newnum );
if( newnum >= clgame.maxEntities ) Host_Error( "CL_AllocEdict: no free edicts\n" );
ent = CL_EDICT_NUM( newnum );
if( !ent )
Host_Error( "CL_ParseBaseline: got invalid entity");
Q_memset( &ent->prevstate, 0, sizeof( ent->prevstate ));
ent->index = newnum;
if( cls.state == ca_active )
timebase = cl.mtime[0];
else timebase = 1.0f; // sv.state == ss_loading
MSG_ReadDeltaEntity( msg, &ent->prevstate, &ent->baseline, newnum, CL_IsPlayerIndex( newnum ), timebase );
}
开发者ID:Reedych,项目名称:xash3d,代码行数:30,代码来源:cl_parse.c
示例3: CL_DeltaEntity
// TODO(kangz) if we can make sure that the baseline entities have the correct entity
// number, then we could grab the entity number from old directly, simplifying code a bit.
void CL_DeltaEntity( msg_t *msg, clSnapshot_t *snapshot, int entityNum, const entityState_t &oldEntity)
{
entityState_t entity;
MSG_ReadDeltaEntity(msg, &oldEntity, &entity, entityNum);
if (entity.number != MAX_GENTITIES - 1) {
snapshot->entities.push_back(entity);
}
}
开发者ID:ffpwserver,项目名称:Unvanquished,代码行数:11,代码来源:cl_parse.cpp
示例4: demoCutParseGamestate
qboolean demoCutParseGamestate(msg_t *msg, clientConnection_t *clcCut, clientActive_t *clCut) {
int i;
entityState_t *es;
int newnum;
entityState_t nullstate;
int cmd;
char *s;
clcCut->connectPacketCount = 0;
Com_Memset(clCut, 0, sizeof(*clCut));
clcCut->serverCommandSequence = MSG_ReadLong(msg);
clCut->gameState.dataCount = 1;
while (1) {
cmd = MSG_ReadByte(msg);
if (cmd == svc_EOF) {
break;
}
if (cmd == svc_configstring) {
int len, start;
start = msg->readcount;
i = MSG_ReadShort(msg);
if (i < 0 || i >= MAX_CONFIGSTRINGS) {
Com_Printf("configstring > MAX_CONFIGSTRINGS");
return qfalse;
}
s = MSG_ReadBigString(msg);
len = strlen(s);
if (len + 1 + clCut->gameState.dataCount > MAX_GAMESTATE_CHARS) {
Com_Printf("MAX_GAMESTATE_CHARS exceeded");
return qfalse;
}
// append it to the gameState string buffer
clCut->gameState.stringOffsets[i] = clCut->gameState.dataCount;
Com_Memcpy(clCut->gameState.stringData + clCut->gameState.dataCount, s, len + 1);
clCut->gameState.dataCount += len + 1;
} else if (cmd == svc_baseline) {
newnum = MSG_ReadBits(msg, GENTITYNUM_BITS);
if (newnum < 0 || newnum >= MAX_GENTITIES) {
Com_Printf("Baseline number out of range: %i", newnum);
return qfalse;
}
Com_Memset(&nullstate, 0, sizeof(nullstate));
es = &clCut->entityBaselines[newnum];
MSG_ReadDeltaEntity(msg, &nullstate, es, newnum);
} else {
Com_Printf("demoCutParseGameState: bad command byte");
return qfalse;
}
}
clcCut->clientNum = MSG_ReadLong(msg);
clcCut->checksumFeed = MSG_ReadLong(msg);
// RMG stuff
demoCutParseRMG(msg, clcCut, clCut);
return qtrue;
}
开发者ID:deathsythe47,项目名称:jaMME,代码行数:54,代码来源:cl_demos_cut.cpp
示例5: demoCutParsePacketEntities
void demoCutParsePacketEntities(msg_t *msg, clSnapshot_t *oldSnap, clSnapshot_t *newSnap, clientActive_t *clCut) {
/* The beast that is entity parsing */
int newnum;
entityState_t *oldstate, *newstate;
int oldindex = 0;
int oldnum;
newSnap->parseEntitiesNum = clCut->parseEntitiesNum;
newSnap->numEntities = 0;
newnum = MSG_ReadBits(msg, GENTITYNUM_BITS);
while (1) {
// read the entity index number
if (oldSnap && oldindex < oldSnap->numEntities) {
oldstate = &clCut->parseEntities[(oldSnap->parseEntitiesNum + oldindex) & (MAX_PARSE_ENTITIES-1)];
oldnum = oldstate->number;
} else {
oldstate = 0;
oldnum = 99999;
}
newstate = &clCut->parseEntities[clCut->parseEntitiesNum];
if (!oldstate && (newnum == (MAX_GENTITIES-1))) {
break;
} else if (oldnum < newnum) {
*newstate = *oldstate;
oldindex++;
} else if (oldnum == newnum) {
oldindex++;
MSG_ReadDeltaEntity(msg, oldstate, newstate, newnum);
newnum = MSG_ReadBits(msg, GENTITYNUM_BITS);
} else if (oldnum > newnum) {
MSG_ReadDeltaEntity(msg, &clCut->entityBaselines[newnum], newstate, newnum);
newnum = MSG_ReadBits(msg, GENTITYNUM_BITS);
}
if (newstate->number == MAX_GENTITIES-1)
continue;
clCut->parseEntitiesNum++;
clCut->parseEntitiesNum &= (MAX_PARSE_ENTITIES-1);
newSnap->numEntities++;
}
}
开发者ID:deathsythe47,项目名称:jaMME,代码行数:39,代码来源:cl_demos_cut.cpp
示例6: CL_DeltaEntity
/*
==================
CL_DeltaEntity
Parses deltas from the given base and adds the resulting entity
to the current frame
==================
*/
void CL_DeltaEntity(msg_t *msg, clSnapshot_t *frame, int newnum, entityState_t *old,
qboolean unchanged)
{
entityState_t *state;
// save the parsed entity state into the big circular buffer so
// it can be used as the source for a later delta
state = &cl.parseEntities[cl.parseEntitiesNum & (MAX_PARSE_ENTITIES - 1)];
if (unchanged)
{
*state = *old;
}
else
{
MSG_ReadDeltaEntity(msg, old, state, newnum);
}
if (state->number == (MAX_GENTITIES - 1))
{
return; // entity was delta removed
}
#if 1
// DHM - Nerve :: Only draw clients if visible
if (clc.onlyVisibleClients)
{
if (state->number < MAX_CLIENTS)
{
if (isEntVisible(state))
{
entLastVisible[state->number] = frame->serverTime;
state->eFlags &= ~EF_NODRAW;
}
else
{
if (entLastVisible[state->number] < (frame->serverTime - 600))
{
state->eFlags |= EF_NODRAW;
}
}
}
}
#endif
cl.parseEntitiesNum++;
frame->numEntities++;
}
开发者ID:morsik,项目名称:war-territory,代码行数:56,代码来源:cl_parse.c
示例7: CL_FlushEntityPacket
/*
=================
CL_FlushEntityPacket
=================
*/
void CL_FlushEntityPacket( sizebuf_t *msg )
{
int newnum;
entity_state_t from, to;
MsgDev( D_INFO, "FlushEntityPacket()\n" );
Q_memset( &from, 0, sizeof( from ));
cl.frames[cl.parsecountmod].valid = false;
cl.validsequence = 0; // can't render a frame
// read it all, but ignore it
while( 1 )
{
newnum = BF_ReadWord( msg );
if( !newnum ) break; // done
if( BF_CheckOverflow( msg ))
Host_Error( "CL_FlushEntityPacket: read overflow\n" );
MSG_ReadDeltaEntity( msg, &from, &to, newnum, CL_IsPlayerIndex( newnum ), cl.mtime[0] );
}
}
开发者ID:UCyborg,项目名称:xash3d,代码行数:28,代码来源:cl_frame.c
示例8: CL_DeltaEntity
void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t *old, qboolean unchanged )
{
cl_entity_t *ent;
entity_state_t *state;
qboolean newent = (old) ? false : true;
qboolean result = true;
ent = CL_EDICT_NUM( newnum );
state = &cls.packet_entities[cls.next_client_entities % cls.num_client_entities];
ent->index = newnum;
if( newent ) old = &ent->baseline;
if( unchanged ) *state = *old;
else result = MSG_ReadDeltaEntity( msg, old, state, newnum, CL_IsPlayerIndex( newnum ), cl.mtime[0] );
if( !result )
{
if( newent ) Host_Error( "Cl_DeltaEntity: tried to release new entity\n" );
CL_KillDeadBeams( ent ); // release dead beams
#if 0
// this is for reference
if( state->number == -1 )
Msg( "Entity %i was removed from server\n", newnum );
else Msg( "Entity %i was removed from delta-message\n", newnum );
#endif
if( state->number == -1 )
{
ent->curstate.messagenum = 0;
ent->baseline.number = 0;
}
// entity was delta removed
return;
}
// entity is present in newframe
state->messagenum = cl.parsecount;
state->msg_time = cl.mtime[0];
cls.next_client_entities++;
frame->num_entities++;
// set player state
ent->player = CL_IsPlayerIndex( ent->index );
if( state->effects & EF_NOINTERP || newent )
{
// duplicate the current state so lerping doesn't hurt anything
ent->prevstate = *state;
}
else
{
// shuffle the last state to previous
ent->prevstate = ent->curstate;
}
// NOTE: always check modelindex for new state not current
if( Mod_GetType( state->modelindex ) == mod_studio )
{
CL_UpdateStudioVars( ent, state, newent );
}
else if( Mod_GetType( state->modelindex ) == mod_brush )
{
CL_UpdateBmodelVars( ent, state, newent );
}
// set right current state
ent->curstate = *state;
CL_UpdatePositions( ent );
}
开发者ID:UCyborg,项目名称:xash3d,代码行数:73,代码来源:cl_frame.c
示例9: demoFrameUnpack
static void demoFrameUnpack( msg_t *msg, demoFrame_t *oldFrame, demoFrame_t *newFrame ) {
int last;
qboolean isDelta = MSG_ReadBits( msg, 1 ) ? qfalse : qtrue;
if (!isDelta)
oldFrame = 0;
newFrame->serverTime = MSG_ReadLong( msg );
/* Read config strings */
newFrame->string.data[0] = 0;
newFrame->string.used = 1;
last = 0;
/* Extract config strings */
while ( 1 ) {
int i, num = MSG_ReadShort( msg );
if (!isDelta ) {
for (i = last;i<num;i++)
newFrame->string.offsets[i] = 0;
} else {
for (i = last;i<num;i++)
demoFrameAddString( &newFrame->string, i, oldFrame->string.data + oldFrame->string.offsets[i] );
}
if (num < MAX_CONFIGSTRINGS) {
demoFrameAddString( &newFrame->string, num, MSG_ReadBigString( msg ) );
} else {
break;
}
last = num + 1;
}
/* Extract player states */
Com_Memset( newFrame->clientData, 0, sizeof( newFrame->clientData ));
last = MSG_ReadByte( msg );
while (last < MAX_CLIENTS) {
playerState_t *oldPlayer, *newPlayer;
newFrame->clientData[last] = 1;
oldPlayer = isDelta && oldFrame->clientData[last] ? &oldFrame->clients[last] : &demoNullPlayerState;
newPlayer = &newFrame->clients[last];
MSG_ReadDeltaPlayerstate( msg, oldPlayer, newPlayer );
last = MSG_ReadByte( msg );
}
/* Extract entity states */
last = 0;
while ( 1 ) {
int i, num = MSG_ReadBits( msg, GENTITYNUM_BITS );
entityState_t *oldEntity, *newEntity;
if ( isDelta ) {
for (i = last;i<num;i++)
if (oldFrame->entities[i].number == i)
newFrame->entities[i] = oldFrame->entities[i];
else
newFrame->entities[i].number = MAX_GENTITIES - 1;
} else {
for (i = last;i<num;i++)
newFrame->entities[i].number = MAX_GENTITIES - 1;
}
if (num < MAX_GENTITIES - 1) {
if (isDelta) {
oldEntity = &oldFrame->entities[num];
if (oldEntity->number != num)
oldEntity = &demoNullEntityState;
} else {
oldEntity = &demoNullEntityState;
}
newEntity = &newFrame->entities[i];
MSG_ReadDeltaEntity( msg, oldEntity, newEntity, num );
} else
break;
last = num + 1;
}
/* Read the area mask */
newFrame->areaUsed = MSG_ReadByte( msg );
MSG_ReadData( msg, newFrame->areamask, newFrame->areaUsed );
/* Read the command string data */
newFrame->commandUsed = MSG_ReadLong( msg );
MSG_ReadData( msg, newFrame->commandData, newFrame->commandUsed );
}
开发者ID:mightycow,项目名称:q3mme,代码行数:75,代码来源:cl_demos.c
示例10: demoConvert
//.........这里部分代码省略.........
fullTime = -1;
clientNum = -1;
oldTime = -1;
Com_Memset( convert, 0, sizeof( *convert ));
convert->frames[0].string.used = 1;
levelCount++;
newHandle = FS_FOpenFileWrite( newName );
if (!newHandle) {
Com_Printf("Failed to open %s for target conversion target.\n", newName);
goto conversionerror;
return;
} else {
FS_Write ( demoHeader, strlen( demoHeader ), newHandle );
}
Com_sprintf( newName, sizeof( newName ), "%s.txt", newBaseName );
workFrame = &convert->frames[ convert->frameIndex % DEMOCONVERTFRAMES ];
msgSequence = MSG_ReadLong( &oldMsg );
while( 1 ) {
cmd = MSG_ReadByte( &oldMsg );
if (cmd == svc_EOF)
break;
if ( cmd == svc_configstring) {
int num;
const char *s;
num = MSG_ReadShort( &oldMsg );
s = MSG_ReadBigString( &oldMsg );
demoFrameAddString( &workFrame->string, num, s );
} else if ( cmd == svc_baseline ) {
int num = MSG_ReadBits( &oldMsg, GENTITYNUM_BITS );
if ( num < 0 || num >= MAX_GENTITIES ) {
Com_Printf( "Baseline number out of range: %i.\n", num );
goto conversionerror;
}
MSG_ReadDeltaEntity( &oldMsg, &demoNullEntityState, &convert->entityBaselines[num], num );
} else {
Com_Printf( "Unknown block while converting demo gamestate.\n" );
goto conversionerror;
}
}
clientNum = MSG_ReadLong( &oldMsg );
/* Skip the checksum feed */
MSG_ReadLong( &oldMsg );
break;
case svc_snapshot:
nextTime = MSG_ReadLong( &oldMsg );
/* Delta number, not needed */
newSnap = &convert->snapshots[convert->messageNum & PACKET_MASK];
Com_Memset (newSnap, 0, sizeof(*newSnap));
newSnap->deltaNum = MSG_ReadByte( &oldMsg );
newSnap->messageNum = convert->messageNum;
if (!newSnap->deltaNum) {
newSnap->deltaNum = -1;
newSnap->valid = qtrue; // uncompressed frame
oldSnap = NULL;
} else {
newSnap->deltaNum = newSnap->messageNum - newSnap->deltaNum;
oldSnap = &convert->snapshots[newSnap->deltaNum & PACKET_MASK];
if (!oldSnap->valid) {
Com_Printf( "Delta snapshot without base.\n" );
goto conversionerror;
} else if (oldSnap->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 ( parseEntitiesNum - oldSnap->parseEntitiesNum > MAX_PARSE_ENTITIES-128 ) {
Com_Printf ("Delta parseEntitiesNum too old.\n");
开发者ID:mightycow,项目名称:q3mme,代码行数:67,代码来源:cl_demos.c
示例11: CL_ParseGamestate
/*
==================
CL_ParseGamestate
==================
*/
void CL_ParseGamestate( msg_t *msg )
{
int i;
entityState_t *es;
int newnum;
entityState_t nullstate;
int cmd;
char *s;
Con_Close();
clc.connectPacketCount = 0;
// wipe local client state
CL_ClearState();
// a gamestate always marks a server command sequence
clc.serverCommandSequence = MSG_ReadLong( msg );
// parse all the configstrings and baselines
cl.gameState.dataCount = 1; // leave a 0 at the beginning for uninitialized configstrings
while ( 1 )
{
cmd = MSG_ReadByte( msg );
if ( cmd == svc_EOF )
{
break;
}
if ( cmd == svc_configstring )
{
int len;
i = MSG_ReadShort( msg );
if ( i < 0 || i >= MAX_CONFIGSTRINGS )
{
Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );
}
s = MSG_ReadBigString( msg );
len = strlen( s );
if ( len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS )
{
Com_Error( ERR_DROP, "MAX_GAMESTATE_CHARS exceeded" );
}
// append it to the gameState string buffer
cl.gameState.stringOffsets[ i ] = cl.gameState.dataCount;
memcpy( cl.gameState.stringData + cl.gameState.dataCount, s, len + 1 );
cl.gameState.dataCount += len + 1;
}
else if ( cmd == svc_baseline )
{
newnum = MSG_ReadBits( msg, GENTITYNUM_BITS );
if ( newnum < 0 || newnum >= MAX_GENTITIES )
{
Com_Error( ERR_DROP, "Baseline number out of range: %i", newnum );
}
memset( &nullstate, 0, sizeof( nullstate ) );
es = &cl.entityBaselines[ newnum ];
MSG_ReadDeltaEntity( msg, &nullstate, es, newnum );
}
else
{
Com_Error( ERR_DROP, "CL_ParseGamestate: bad command byte" );
}
}
clc.clientNum = MSG_ReadLong( msg );
// read the checksum feed
clc.checksumFeed = MSG_ReadLong( msg );
// parse serverId and other cvars
CL_SystemInfoChanged();
// reinitialize the filesystem if the game directory has changed
FS_ConditionalRestart( clc.checksumFeed );
// This used to call CL_StartHunkUsers, but now we enter the download state before loading the
// cgame
CL_InitDownloads();
// make sure the game starts
Cvar_Set( "cl_paused", "0" );
}
开发者ID:justhacking,项目名称:Unvanquished,代码行数:96,代码来源:cl_parse.c
示例12: CL_ParseGamestate
/*
==================
CL_ParseGamestate
==================
*/
void CL_ParseGamestate( msg_t *msg ) {
int i;
entityState_t *es;
int newnum;
entityState_t nullstate;
int cmd;
char *s;
char oldGame[MAX_QPATH];
Con_Close();
clc.connectPacketCount = 0;
// wipe local client state
CL_ClearState();
// a gamestate always marks a server command sequence
clc.serverCommandSequence = MSG_ReadLong( msg );
// parse all the configstrings and baselines
cl.gameState.dataCount = 1; // leave a 0 at the beginning for uninitialized configstrings
while ( 1 ) {
cmd = MSG_ReadByte( msg );
if ( cmd == svc_EOF ) {
break;
}
if ( cmd == svc_configstring ) {
int len;
i = MSG_ReadShort( msg );
if ( i < 0 || i >= MAX_CONFIGSTRINGS ) {
Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );
}
s = MSG_ReadBigString( msg );
len = strlen( s );
if ( len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS ) {
Com_Error( ERR_DROP, "MAX_GAMESTATE_CHARS exceeded" );
}
// append it to the gameState string buffer
cl.gameState.stringOffsets[ i ] = cl.gameState.dataCount;
Com_Memcpy( cl.gameState.stringData + cl.gameState.dataCount, s, len + 1 );
cl.gameState.dataCount += len + 1;
} else if ( cmd == svc_baseline ) {
newnum = MSG_ReadBits( msg, GENTITYNUM_BITS );
if ( newnum < 0 || newnum >= MAX_GENTITIES ) {
Com_Error( ERR_DROP, "Baseline number out of range: %i", newnum );
}
Com_Memset (&nullstate, 0, sizeof(nullstate));
es = &cl.entityBaselines[ newnum ];
MSG_ReadDeltaEntity( msg, &nullstate, es, newnum );
} else {
Com_Error( ERR_DROP, "CL_ParseGamestate: bad command byte" );
}
}
clc.clientNum = MSG_ReadLong(msg);
// read the checksum feed
clc.checksumFeed = MSG_ReadLong( msg );
// save old gamedir
Cvar_VariableStringBuffer("fs_game", oldGame, sizeof(oldGame));
// parse useful values out of CS_SERVERINFO
CL_ParseServerInfo();
// parse serverId and other cvars
CL_SystemInfoChanged();
// stop recording now so the demo won't have an unnecessary level load at the end.
if(cl_autoRecordDemo->integer && clc.demorecording)
CL_StopRecord_f();
// reinitialize the filesystem if the game directory has changed
if(!cl_oldGameSet && (Cvar_Flags("fs_game") & CVAR_MODIFIED))
{
cl_oldGameSet = qtrue;
Q_strncpyz(cl_oldGame, oldGame, sizeof(cl_oldGame));
}
FS_ConditionalRestart(clc.checksumFeed, qfalse);
// This used to call CL_StartHunkUsers, but now we enter the download state before loading the
// cgame
CL_InitDownloads();
// make sure the game starts
Cvar_Set( "cl_paused", "0" );
}
开发者ID:darklegion,项目名称:tremulous,代码行数:97,代码来源:cl_parse.c
示例13: CL_ParseDemo
//.........这里部分代码省略.........
// other commands
switch (cmd)
{
default:
Com_FuncDrop("Illegible server message %d", cmd);
return;
case svc_nop:
break;
case svc_serverCommand:
MSG_ReadLong(msg);
MSG_ReadString(msg);
break;
case svc_gamestate:
clc.serverCommandSequence = MSG_ReadLong(msg);
cl.gameState.dataCount = 1;
while (qtrue)
{
int cmd2 = MSG_ReadByte(msg);
if (cmd2 == svc_EOF)
{
break;
}
if (cmd2 == svc_configstring)
{
MSG_ReadShort(msg);
MSG_ReadBigString(msg);
}
else if (cmd2 == svc_baseline)
{
entityState_t s1, s2;
memset(&s1, 0, sizeof(s1));
memset(&s2, 0, sizeof(s2));
MSG_ReadBits(msg, GENTITYNUM_BITS);
MSG_ReadDeltaEntity(msg, &s1, &s2, 0);
}
else
{
Com_FuncDrop("bad command byte");
return;
}
}
MSG_ReadLong(msg);
MSG_ReadLong(msg);
break;
case svc_snapshot:
CL_ParseDemoSnapShotSimple(msg);
break;
case svc_download:
MSG_ReadShort(msg);
break;
}
}
if (!cl.snap.valid)
{
Com_FuncPrinf("!cl.snap.valid\n");
continue;
}
if (cl.snap.serverTime < cl.oldFrameServerTime)
{
// ignore snapshots that don't have entities
if (cl.snap.snapFlags & SNAPFLAG_NOT_ACTIVE)
{
continue;
开发者ID:dstaesse,项目名称:etlegacy,代码行数:67,代码来源:cl_demo.c
示例14: CL_ParseGamestate
/*
==================
CL_ParseGamestate
==================
*/
void CL_ParseGamestate( msg_t *msg ) {
int i;
entityState_t *es;
int newnum;
entityState_t nullstate;
int cmd;
char *s;
Con_Close();
UI_UpdateConnectionString( "" );
// wipe local client state
CL_ClearState();
// a gamestate always marks a server command sequence
clc.serverCommandSequence = MSG_ReadLong( msg );
// parse all the configstrings and baselines
cl.gameState.dataCount = 1; // leave a 0 at the beginning for uninitialized configstrings
while ( 1 ) {
cmd = MSG_ReadByte( msg );
if ( cmd <= 0 ) {
break;
}
if ( cmd == svc_configstring ) {
int len;
i = MSG_ReadShort( msg );
if ( i < 0 || i >= MAX_CONFIGSTRINGS ) {
Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );
}
s = MSG_ReadString( msg );
len = strlen( s );
if ( len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS ) {
Com_Error( ERR_DROP, "MAX_GAMESTATE_CHARS exceeded" );
}
// append it to the gameState string buffer
cl.gameState.stringOffsets[ i ] = cl.gameState.dataCount;
memcpy( cl.gameState.stringData + cl.gameState.dataCount, s, len + 1 );
cl.gameState.dataCount += len + 1;
if ( cl_shownet->integer == 3 ) {
Com_Printf ("%3i: CS# %d %s (%d)\n",msg->readcount, i,s,len);
}
} else if ( cmd == svc_baseline ) {
newnum = MSG_ReadBits( msg, GENTITYNUM_BITS );
if ( newnum < 0 || newnum >= MAX_GENTITIES ) {
Com_Error( ERR_DROP, "Baseline number out of range: %i", newnum );
}
memset (&nullstate, 0, sizeof(nullstate));
es = &cl.entityBaselines[ newnum ];
MSG_ReadDeltaEntity( msg, &nullstate, es, newnum );
} else {
Com_Error( ERR_DROP, "CL_ParseGamestate: bad command byte" );
}
}
// parse serverId and other cvars
CL_SystemInfoChanged();
// reinitialize the filesystem if the game directory has changed
#if 0
if ( fs_game->modified ) {
}
#endif
// let the client game init and load data
cls.state = CA_LOADING;
CL_StartHunkUsers();
// make sure the game starts
Cvar_Set( "cl_paused", "0" );
}
开发者ID:BishopExile,项目名称:OpenJK,代码行数:83,代码来源:cl_parse.cpp
示例15: CL_ParseGamestate
/*
==================
CL_ParseGamestate
==================
*/
void CL_ParseGamestate( msg_t *msg )
{
int i;
entityState_t *es;
int newnum;
entityState_t nullstate;
int cmd;
Con_Close();
clc.connectPacketCount = 0;
// wipe local client state
CL_ClearState();
// a gamestate always marks a server command sequence
clc.serverCommandSequence = MSG_ReadLong( msg );
// parse all the configstrings and baselines
while ( 1 )
{
cmd = MSG_ReadByte( msg );
if ( cmd == svc_EOF )
{
break;
}
if ( cmd == svc_configstring )
{
i = MSG_ReadShort( msg );
if ( i < 0 || i >= MAX_CONFIGSTRINGS )
{
Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );
}
const char* str = MSG_ReadBigString( msg );
std::string s = str;
cl.gameState[i] = str;
}
else if ( cmd == svc_baseline )
{
newnum = MSG_ReadBits( msg, GENTITYNUM_BITS );
if ( newnum < 0 || newnum >= MAX_GENTITIES )
{
Com_Error( ERR_DROP, "Baseline number out of range: %i", newnum );
}
memset( &nullstate, 0, sizeof( nullstate ) );
es = &cl.entityBaselines[ newnum ];
MSG_ReadDeltaEntity( msg, &nullstate, es, newnum );
}
else
{
Com_Error( ERR_DROP, "CL_ParseGamestate: bad command byte" );
}
}
clc.clientNum = MSG_ReadLong( msg );
// read the checksum feed
clc.checksumFeed = MSG_ReadLong( msg );
// parse serverId and other cvars
CL_SystemInfoChanged();
// This used to call CL_StartHunkUsers, but now we enter the download state before loading the
// cgame
CL_InitDownloads();
// make sure the game starts
Cvar_Set( "cl_paused", "0" );
}
开发者ID:ffpwserver,项目名称:Unvanquished,代码行数:79,代码来源:cl_parse.cpp
注:本文中的MSG_ReadDeltaEntity函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论