/* =============== CG_TransitionEntity cent->nextState is moved to cent->currentState and events are fired =============== */ static void CG_TransitionEntity( centity_t *cent ) { cent->currentState = cent->nextState; cent->currentValid = qtrue; // reset if the entity wasn't in the last frame or was teleported if ( !cent->interpolate ) { CG_ResetEntity( cent ); } else { //mme int newHeight; int maxs = ((cent->currentState.solid >> 16) & 255) - 32; if ( maxs > 16 ) newHeight = DEFAULT_VIEWHEIGHT; else newHeight = CROUCH_VIEWHEIGHT; if ( newHeight != cent->pe.viewHeight ) { cent->pe.duckTime = cg.snap->serverTime; cent->pe.duckChange = newHeight - cent->pe.viewHeight; cent->pe.viewHeight = newHeight; } } // clear the next state. if will be set by the next CG_SetNextSnap cent->interpolate = qfalse; // check for events CG_CheckEvents( cent ); }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; cg.snap = snap; BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0; i < cg.snap->numEntities; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy( ¢->currentState, state, sizeof( entityState_t ) ); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } }
// This will only happen on the very first snapshot, or on tourney restarts. // All other times will use CG_TransitionSnapshot instead. // FIXME: Also called by map_restart? void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; cg.snap = snap; if ( !cg_entities[snap->ps.clientNum].ghoul2 && trap->G2_HaveWeGhoul2Models( cgs.clientinfo[snap->ps.clientNum].ghoul2Model ) ) { trap->G2API_DuplicateGhoul2Instance( cgs.clientinfo[snap->ps.clientNum].ghoul2Model, &cg_entities[snap->ps.clientNum].ghoul2 ); CG_CopyG2WeaponInstance( &cg_entities[snap->ps.clientNum], FIRST_WEAPON, cg_entities[snap->ps.clientNum].ghoul2 ); // check now to see if we have this bone for setting anims and such if ( trap->G2API_AddBolt( cg_entities[snap->ps.clientNum].ghoul2, 0, "face" ) == -1 ) cg_entities[snap->ps.clientNum].noFace = qtrue; } BG_PlayerStateToEntityState( &snap->ps, &cg_entities[snap->ps.clientNum].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0; i < cg.snap->numEntities; i++ ) { state = &cg.snap->entities[i]; cent = &cg_entities[state->number]; memcpy( ¢->currentState, state, sizeof(entityState_t) ); // cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } // auto record demo if ( cg_autoRecordDemo.integer & (1 << cgs.gametype) && cg.warmup <= 0 && !cg.demoPlayback ) { time_t rawtime; char buf[256] = { 0 }, timeStr[64] = { 0 }, mapName[MAX_QPATH] = { 0 }; time( &rawtime ); strftime( timeStr, sizeof(timeStr), "%Y-%m-%d_%H-%M-%S", localtime( &rawtime ) ); Q_strncpyz( mapName, cgs.mapname + 5, sizeof(mapName) ); Q_strstrip( mapName, "/", "-" ); COM_StripExtension( mapName, mapName, sizeof(mapName) ); Com_sprintf( buf, sizeof(buf), "%s_%s_%s_%s", timeStr, gametypeStringShort[cgs.gametype], mapName, cgs.clientinfo[cg.clientNum].name ); Q_strstrip( buf, "\n\r;?*<>|\\/\"", NULL ); Q_strstrip( buf, " ", "_" ); Q_CleanString( buf, STRIP_COLOUR | STRIP_EXTASCII ); trap->SendConsoleCommand( va( "stoprecord; record %s\n", buf ) ); } }
// cent->nextState is moved to cent->currentState and events are fired static void CG_TransitionEntity( centity_t *cent ) { cent->currentState = cent->nextState; cent->currentValid = qtrue; // reset if the entity wasn't in the last frame or was teleported if ( !cent->interpolate ) CG_ResetEntity( cent ); // clear the next state. if will be set by the next CG_SetNextSnap cent->interpolate = qfalse; // check for events CG_CheckEvents( cent ); }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; lua_State *L = GetClientLuaState(); cg.snap = snap; BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy(¢->currentState, state, sizeof(entityState_t)); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); if(L != NULL && cent->linked == qfalse && cent->currentState.eType <= ET_LUA && cent->currentState.eType != ET_GENERAL) { qlua_gethook(L,"EntityLinked"); lua_pushentity(L,cent); qlua_pcall(L,1,0,qtrue); cent->linked = qtrue; } } if(L != NULL && !playBack) { qlua_gethook(L,"InitialSnapshot"); qlua_pcall(L,0,0,qtrue); } }
/* =============== CG_TransitionEntity cent->nextState is moved to cent->currentState and events are fired =============== */ static void CG_TransitionEntity( centity_t *cent ) { // Ridah, update the fireDir if it's on fire if ( CG_EntOnFire( cent ) ) { vec3_t newDir, newPos, oldPos; float adjust; // BG_EvaluateTrajectory( ¢->nextState.pos, cg.snap->serverTime, newPos ); BG_EvaluateTrajectory( ¢->currentState.pos, cg.snap->serverTime, oldPos ); // update the fireRiseDir VectorSubtract( oldPos, newPos, newDir ); // fire should go upwards if travelling slow newDir[2] += 2; if ( VectorNormalize( newDir ) < 1 ) { VectorClear( newDir ); newDir[2] = 1; } // now move towards the newDir adjust = 0.3; VectorMA( cent->fireRiseDir, adjust, newDir, cent->fireRiseDir ); if ( VectorNormalize( cent->fireRiseDir ) <= 0.1 ) { VectorCopy( newDir, cent->fireRiseDir ); } } //----(SA) the ent lost or gained some part(s), do any necessary effects //TODO: check for ai first if ( cent->currentState.dmgFlags != cent->nextState.dmgFlags ) { CG_AttachedPartChange( cent ); } cent->currentState = cent->nextState; cent->currentValid = qtrue; // reset if the entity wasn't in the last frame or was teleported if ( !cent->interpolate ) { CG_ResetEntity( cent ); } // clear the next state. if will be set by the next CG_SetNextSnap cent->interpolate = qfalse; // check for events CG_CheckEvents( cent ); }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot. At all other times, CG_TransitionSnapshot is used instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; cg.snap = snap; BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0; i < cg.snap->numEntities; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy( ¢->currentState, state, sizeof( entityState_t ) ); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } // Need this check because the initial weapon for spec isn't always WP_NONE if ( snap->ps.persistant[ PERS_TEAM ] == TEAM_NONE ) { trap_Rocket_ShowHud( WP_NONE ); } else { trap_Rocket_ShowHud( BG_GetPlayerWeapon( &snap->ps ) ); } }
void NewFrameParsed( void ) { int i; entityState_t *es; char *serverCommand; char *args; for( i=ds.currentServerCommandNum+1 ; i<=ds.lastServerCommandNum ; i++ ) { serverCommand = ds.serverCommands[i & SERVERCMD_MASK]; Cmd_TokenizeString( serverCommand ); if( !Q_stricmp( Cmd_Argv( 0 ), "print" ) || !Q_stricmp( Cmd_Argv( 0 ), "cp" ) ) { args = Cmd_Args(); args[strlen(args)-2] = 0; args++; append_result(" - \"%s\"\n", args); } else if( !Q_stricmp( Cmd_Argv( 0 ), "cs" ) ) { UpdateConfigString( atoi( Cmd_Argv( 1 ) ), Cmd_Argv( 2 ) ); } // Com_Printf( "serverCommand: %i \"%s\"\n", i, Com_TranslateLinefeeds( ) ); } ds.currentServerCommandNum = ds.lastServerCommandNum; if( !ds.snap || !ds.snap->valid ) { return; } for( i=0 ; i<MAX_GENTITIES ; i++ ) { centities[i].currentValid = qfalse; } for( i=0 ; i<ds.snap->numEntities ; i++ ) { es = &ds.parseEntities[(ds.snap->firstEntity+i) & PARSE_ENTITIES_MASK]; memcpy( ¢ities[es->number].currentState, es, sizeof( entityState_t ) ); centities[es->number].currentValid = qtrue; CG_CheckEvents( ¢ities[es->number] ); } for( i=0 ; i<MAX_GENTITIES ; i++ ) { if( !centities[i].currentValid ) { centities[i].previousEvent = 0; } } }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; cg.snap = snap; if ((cg_entities[snap->ps.clientNum].ghoul2 == NULL) && trap_G2_HaveWeGhoul2Models(cgs.clientinfo[snap->ps.clientNum].ghoul2Model)) { trap_G2API_DuplicateGhoul2Instance(cgs.clientinfo[snap->ps.clientNum].ghoul2Model, &cg_entities[snap->ps.clientNum].ghoul2); CG_CopyG2WeaponInstance(FIRST_WEAPON, cg_entities[snap->ps.clientNum].ghoul2); } BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy(¢->currentState, state, sizeof(entityState_t)); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; if ( jk2startversion == VERSION_1_02 ) { // MVSDK: Version Magic! cent->currentState.torsoAnim = MV_MapAnimation104( cent->currentState.torsoAnim ); cent->currentState.legsAnim = MV_MapAnimation104( cent->currentState.legsAnim ); } CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; cg.snap = snap; if ((cg_entities[snap->ps.clientNum].ghoul2 == NULL) && trap->G2_HaveWeGhoul2Models(cgs.clientinfo[snap->ps.clientNum].ghoul2Model)) { trap->G2API_DuplicateGhoul2Instance(cgs.clientinfo[snap->ps.clientNum].ghoul2Model, &cg_entities[snap->ps.clientNum].ghoul2); CG_CopyG2WeaponInstance(&cg_entities[snap->ps.clientNum], FIRST_WEAPON, 0, cg_entities[snap->ps.clientNum].ghoul2); if (trap->G2API_AddBolt(cg_entities[snap->ps.clientNum].ghoul2, 0, "face") == -1) { //check now to see if we have this bone for setting anims and such cg_entities[snap->ps.clientNum].noFace = qtrue; } } BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy(¢->currentState, state, sizeof(entityState_t)); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } }
void firstReplayFrame() { int i; snapshot_t *snap; centity_t *cent; entityState_t *state; lua_State *L = GetClientLuaState(); snap = &replaySnaps[0]; cg.snap = snap; cg.snap->serverTime += cg.time; BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); CG_Respawn(); for ( i = 0 ; i < sizeof(cg_entities) / sizeof(cg_entities[0]); i++ ) { CG_ResetEntity(&cg_entities[i]); } for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; if(state->time != 0) state->time += cg.time; if(state->time2 != 0) state->time2 += cg.time; state->pos.trTime += cg.time; state->apos.trTime += cg.time; memcpy(¢->currentState, state, sizeof(entityState_t)); cent->interpolate = qtrue; cent->currentValid = qtrue; CG_ResetEntity( cent ); CG_CheckEvents( cent ); cent->previousEvent = 0; } //cg.time = snap->serverTime; }
/* =============== CG_TransitionEntity cent->nextState is moved to cent->currentState and events are fired =============== */ static void CG_TransitionEntity( centity_t *cent ) { cent->currentState = cent->nextState; cent->currentValid = qtrue; if ( jk2startversion == VERSION_1_02 ) { // MVSDK: Version Magic! cent->currentState.torsoAnim = MV_MapAnimation104( cent->currentState.torsoAnim ); cent->currentState.legsAnim = MV_MapAnimation104( cent->currentState.legsAnim ); } // reset if the entity wasn't in the last frame or was teleported if ( !cent->interpolate ) { CG_ResetEntity( cent ); } // clear the next state. if will be set by the next CG_SetNextSnap cent->interpolate = qfalse; // check for events CG_CheckEvents( cent ); }
/* =============== CG_TransitionEntity cent->nextState is moved to cent->currentState and events are fired =============== */ static void CG_TransitionEntity( centity_t *cent ) { lua_State *L = GetClientLuaState(); cent->currentState = cent->nextState; cent->currentValid = qtrue; // reset if the entity wasn't in the last frame or was teleported if ( !cent->interpolate ) { CG_ResetEntity( cent ); if(L != NULL && cent->linked == qfalse && cent->currentState.eType <= ET_LUA && cent->currentState.eType != ET_GENERAL) { qlua_gethook(L,"EntityLinked"); lua_pushentity(L,cent); qlua_pcall(L,1,0,qtrue); cent->linked = qtrue; } } // clear the next state. if will be set by the next CG_SetNextSnap cent->interpolate = qfalse; // check for events CG_CheckEvents( cent ); }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { int i; centity_t *cent; entityState_t *state; char buff[16]; cg.snap = snap; // trap_S_ClearSounds( qtrue ); BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn( qfalse ); for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy(¢->currentState, state, sizeof(entityState_t)); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } cg_fxflags = 0; trap_Cvar_VariableStringBuffer( "r_oldMode", buff, sizeof(buff) ); if( atoi(buff) ) { // Arnout: confirmation screen trap_UI_Popup( UIMENU_INGAME ); } else if(cg.demoPlayback) { ccInitial = qtrue; } else { static char prevmap[64] = { 0 }; char curmap[64]; trap_Cvar_VariableStringBuffer( "mapname", curmap, 64 ); if ( Q_stricmp( curmap, prevmap ) ) { strcpy( prevmap, curmap ); if(cgs.campaignInfoLoaded) { if( !cg.showGameView ) { CG_LimboMenu_f(); } /* } else { ccInitial = qtrue; // Start the Initial Camera if specified CG_StartInitialCamera(); */ } } } // OSP - remove motd window if(cg.motdWindow != NULL) { CG_windowFree(cg.motdWindow); cg.motdWindow = NULL; } // Activate alternate input handler during demo playback if(cg.demoPlayback) { CG_keyOn_f(); if(demo_infoWindow.integer > 0) { CG_ShowHelp_On(&cg.demohelpWindow); } } // OSP #if __MACOS__ #ifdef GAMERANGER // LBO 12/13/04. Add support for GameRanger team voice IDs GRSetMyTeamID(cg.snap->ps.persistant[PERS_TEAM]); #endif #endif }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot(snapshot_t *snap) { int i; centity_t *cent; entityState_t *state; char buff[16]; cg.snap = snap; // trap_S_ClearSounds( qtrue ); BG_PlayerStateToEntityState(&snap->ps, &cg_entities[snap->ps.clientNum].currentState, cg.time, qfalse); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands(snap->serverCommandSequence); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(qfalse); for (i = 0 ; i < cg.snap->numEntities ; i++) { state = &cg.snap->entities[i]; cent = &cg_entities[state->number]; memcpy(¢->currentState, state, sizeof(entityState_t)); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity(cent); // check for events CG_CheckEvents(cent); } trap_Cvar_VariableStringBuffer("r_oldMode", buff, sizeof(buff)); if (atoi(buff)) { // confirmation screen trap_UI_Popup(UIMENU_INGAME); } else if (cg.demoPlayback) { ccInitial = qtrue; } else { static char prevmap[64] = { 0 }; char curmap[64]; trap_Cvar_VariableStringBuffer("mapname", curmap, 64); if (Q_stricmp(curmap, prevmap)) { strcpy(prevmap, curmap); if (cgs.campaignInfoLoaded) { if (!cg.showGameView) { CG_LimboMenu_f(); } /* } else { ccInitial = qtrue; // Start the Initial Camera if specified CG_StartInitialCamera(); */ } } } // remove motd window if (cg.motdWindow != NULL) { CG_windowFree(cg.motdWindow); cg.motdWindow = NULL; } // Activate alternate input handler during demo playback if (cg.demoPlayback) { CG_keyOn_f(); if (demo_infoWindow.integer > 0) { CG_ShowHelp_On(&cg.demohelpWindow); } } // update client XP for spectator frames if (cg.snap->ps.clientNum == cg.clientNum) // sanity check { int cXP = (32768 * cg.snap->ps.stats[STAT_XP_OVERFLOW]) + cg.snap->ps.stats[STAT_XP]; if (cg.xp < cXP) { cg.xpChangeTime = cg.time; } cg.xp = cXP; } }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. ================== */ void CG_SetInitialSnapshot(snapshot_t *snap) { int i; centity_t *cent; char buff[16]; cg.snap = snap; BG_PlayerStateToEntityState(&snap->ps, &cg_entities[snap->ps.clientNum].currentState, qfalse); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands(snap->serverCommandSequence); // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for (i = 0 ; i < cg.snap->numEntities ; ++i) { entityState_t *state = &cg.snap->entities[i]; cent = &cg_entities[state->number]; memcpy(¢->currentState, state, sizeof (entityState_t)); cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity(cent); // check for events CG_CheckEvents(cent); } cg_fxflags = 0; trap_Cvar_VariableStringBuffer("r_oldMode", buff, sizeof (buff)); if (atoi(buff)) { // Arnout: confirmation screen trap_UI_Popup(UIMENU_INGAME); } else if (!cg.demoPlayback) { static char prevmap[64] = { 0 }; char curmap[64]; trap_Cvar_VariableStringBuffer("mapname", curmap, 64); if (Q_stricmp(curmap, prevmap)) { strcpy(prevmap, curmap); if (cgs.campaignInfoLoaded) { if (!cg.showGameView) { CG_LimboMenu_f(); } } } } // OSP - remove motd window if (cg.motdWindow != NULL) { CG_windowFree(cg.motdWindow); cg.motdWindow = NULL; } // Activate alternate input handler during demo playback if (cg.demoPlayback) { CG_keyOn_f(); if (demo_infoWindow.integer > 0) { CG_ShowHelp_On(&cg.demohelpWindow); } } }
/* ================== CG_SetInitialSnapshot This will only happen on the very first snapshot, or on tourney restarts. All other times will use CG_TransitionSnapshot instead. FIXME: Also called by map_restart? ================== */ void CG_SetInitialSnapshot( snapshot_t *snap ) { char buf[64]; int i; centity_t *cent; entityState_t *state; cg.snap = snap; BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse ); // sort out solid entities CG_BuildSolidList(); CG_ExecuteNewServerCommands( snap->serverCommandSequence ); trap_SendClientCommand( "fogswitch 0" ); // clear it out so the set below will take trap_Cvar_VariableStringBuffer( "r_savegameFogColor", buf, sizeof( buf ) ); trap_Cvar_Set( "r_savegameFogColor", "0" ); if ( strlen( buf ) > 1 ) { if ( !Q_stricmp( buf, "none" ) ) { trap_SendClientCommand( "fogswitch 0" ); // 'off' } else { trap_SendClientCommand( va( "fogswitch %s", buf ) ); } } else { trap_Cvar_VariableStringBuffer( "r_mapFogColor", buf, sizeof( buf ) ); trap_SendClientCommand( va( "fogswitch %s", buf ) ); } // set our local weapon selection pointer to // what the server has indicated the current weapon is CG_Respawn(); for ( i = 0 ; i < cg.snap->numEntities ; i++ ) { state = &cg.snap->entities[ i ]; cent = &cg_entities[ state->number ]; memcpy( ¢->currentState, state, sizeof( entityState_t ) ); //cent->currentState = *state; cent->interpolate = qfalse; cent->currentValid = qtrue; CG_ResetEntity( cent ); // check for events CG_CheckEvents( cent ); } // DHM - Nerve :: Set cg.clientNum so that it may be used elsewhere cg.clientNum = snap->ps.clientNum; // NERVE - SMF { static char prevmap[64] = { 0 }; char curmap[64]; trap_Cvar_VariableStringBuffer( "mapname", curmap, 64 ); if ( cgs.gametype == GT_WOLF && Q_stricmp( curmap, prevmap ) ) { strcpy( prevmap, curmap ); trap_SendConsoleCommand( "openLimboMenu\n" ); } } // -NERVE - SMF }