void FrameUpdatePostEntityThink() { g_TouchManager.FrameUpdatePostEntityThink(); if ( m_bRespawnAllEntities ) { m_bRespawnAllEntities = false; // Don't change globalstate owing to deletion here GlobalEntity_EnableStateUpdates( false ); // Remove all entities int nPlayerIndex = -1; CBaseEntity *pEnt = gEntList.FirstEnt(); while ( pEnt ) { CBaseEntity *pNextEnt = gEntList.NextEnt( pEnt ); if ( pEnt->IsPlayer() ) { nPlayerIndex = pEnt->entindex(); } if ( !pEnt->IsEFlagSet( EFL_KEEP_ON_RECREATE_ENTITIES ) ) { UTIL_Remove( pEnt ); } pEnt = pNextEnt; } gEntList.CleanupDeleteList(); GlobalEntity_EnableStateUpdates( true ); // Allows us to immediately re-use the edict indices we just freed to avoid edict overflow engine->AllowImmediateEdictReuse(); // Reset node counter used during load CNodeEnt::m_nNodeCount = 0; CRespawnEntitiesFilter filter; MapEntity_ParseAllEntities( engine->GetMapEntitiesString(), &filter, true ); // Allocate a CBasePlayer for pev, and call spawn if ( nPlayerIndex >= 0 ) { edict_t *pEdict = engine->PEntityOfEntIndex( nPlayerIndex ); ClientPutInServer( pEdict, "unnamed" ); ClientActive( pEdict, false ); CBasePlayer *pPlayer = ( CBasePlayer * )CBaseEntity::Instance( pEdict ); SceneManager_ClientActive( pPlayer ); } } }
void ForceRepopulateList() { Clear(); CBaseEntity *pEnt = gEntList.FirstEnt(); while( pEnt ) { if( ShouldAddEntity(pEnt) ) AddEntity(pEnt); pEnt = gEntList.NextEnt( pEnt ); } }