// loads the second set of decls from the file which will contain
// modles, cameras
declManager->LoadDeclsFromFile();
declManager->FinishLoadingDecls();
}
#endif
#endif // RV_BINARYDECLS
// RAVEN END
cmdSystem->AddCommand( "listModelDefs", idListDecls_f<DECL_MODELDEF>, CMD_FL_SYSTEM|CMD_FL_GAME, "lists model defs" );
cmdSystem->AddCommand( "printModelDefs", idPrintDecls_f<DECL_MODELDEF>, CMD_FL_SYSTEM|CMD_FL_GAME, "prints a model def", idCmdSystem::ArgCompletion_Decl<DECL_MODELDEF> );
Clear();
idEvent::Init();
// RAVEN BEGIN
// jnewquist: Register subclasses explicitly so they aren't dead-stripped
idClass::RegisterClasses();
// RAVEN END
idClass::Init();
InitConsoleCommands();
// load default scripts
program.Startup( SCRIPT_DEFAULT );
// RAVEN BEGIN
// bdube: disable id particles
/*
smokeParticles = new idSmokeParticles;
*/
// RAVEN END
// set up the aas
// RAVEN BEGIN
// ddynerman: added false as 2nd parameter, otherwise def will be created
dict = FindEntityDefDict( "aas_types", false );
// RAVEN END
if ( !dict ) {
Error( "Unable to find entityDef for 'aas_types'" );
clientEntities[ i ] && clientEntities[ i ]->GetBindMaster() &&
clientEntities[ i ]->GetBindMaster()->GetInstance() == gameLocal.GetLocalPlayer()->GetInstance() ) {
continue;
}
delete clientEntities[ i ];
clientEntities[ i ] = NULL;
clientSpawnIds[ i ] = -1;
}
// RAVEN END
for( i = ( clearClients ? 0 : MAX_CLIENTS ); i < MAX_GENTITIES; i++ ) {
if( instance >= 0 && entities[ i ] && entities[ i ]->GetInstance() != instance ) {
continue;
}
delete entities[ i ];
// ~idEntity is in charge of setting the pointer to NULL
// it will also clear pending events for this entity
assert( !entities[ i ] );
// RAVEN BEGIN
// see FIXME in idRestoreGame::Error
entities[ i ] = NULL;
// RAVEN END
spawnIds[ i ] = -1;
}
entityHash.Clear( 1024, MAX_GENTITIES );
if ( !clearClients ) {
// add back the hashes of the clients/stuff in other instances
for ( i = 0; i < MAX_GENTITIES; i++ ) {
if ( !entities[ i ] ) {
continue;
}
entityHash.Add( entityHash.GenerateKey( entities[ i ]->name.c_str(), true ), i );
}
}
// RAVEN BEGIN
// jscott: clear out portal skies
portalSky = NULL;
// abahr:
gravityInfo.Clear();
scriptObjectProxies.Clear();
// RAVEN END
delete frameCommandThread;
frameCommandThread = NULL;
if ( editEntities ) {
delete editEntities;
editEntities = NULL;
}
delete[] locationEntities;
locationEntities = NULL;
// RAVEN BEGIN
// ddynerman: mp clear
if( gameLocal.isMultiplayer ) {
ClearForwardSpawns();
for( i = 0; i < TEAM_MAX; i++ ) {
teamSpawnSpots[ i ].Clear();
}
mpGame.ClearMap();
}
ambientLights.Clear();
// RAVEN END
}
// RAVEN BEGIN
// ddynerman: instance-specific clear
void idGameLocal::InstanceClear( int instance ) {
// note: clears all ents EXCEPT those in the instance
int i;
for( i = 0; i < MAX_CENTITIES; i++ ) {
delete clientEntities[ i ];
assert( !clientEntities[ i ] );
clientSpawnIds[ i ] = -1;
}
for( i = MAX_CLIENTS; i < MAX_GENTITIES; i++ ) {
if( i == ENTITYNUM_CLIENT || i == ENTITYNUM_WORLD ) {
continue;
}
if( entities[ i ] && entities[ i ]->fl.persistAcrossInstances ) {
//common->DPrintf( "Instance %d: persistant: excluding ent from clear: %s (%s)\n", instance, entities[ i ]->name.c_str(), entities[ i ]->GetClassname() );
continue;
}
//if( entities[ i ] ) {
//Printf( "Instance %d: CLEARING ent from clear: %s (%s)\n", instance, entities[ i ]->name.c_str(), entities[ i ]->GetClassname() );
//}
delete entities[ i ];
// ~idEntity is in charge of setting the pointer to NULL
// it will also clear pending events for this entity
assert( !entities[ i ] );
// RAVEN BEGIN
// see FIXME in idRestoreGame::Error
entities[ i ] = NULL;
// RAVEN END
spawnIds[ i ] = -1;
}
entityHash.Clear( 1024, MAX_GENTITIES );
for ( i = 0; i < MAX_CLIENTS; i++ ) {
if ( !entities[ i ] ) {
continue;
}
entityHash.Add( entityHash.GenerateKey( entities[ i ]->name.c_str(), true ), i );
}
// RAVEN BEGIN
// jscott: clear out portal skies
portalSky = NULL;
// abahr:
gravityInfo.Clear();
scriptObjectProxies.Clear();
// RAVEN END
delete frameCommandThread;
frameCommandThread = NULL;
if ( editEntities ) {
delete editEntities;
editEntities = NULL;
}
delete[] locationEntities;
locationEntities = NULL;
// RAVEN BEGIN
// ddynerman: mp clear
if( gameLocal.isMultiplayer ) {
ClearForwardSpawns();
for( i = 0; i < TEAM_MAX; i++ ) {
teamSpawnSpots[ i ].Clear();
}
mpGame.ClearMap();
}
ambientLights.Clear();
}
// RAVEN END
/*
===========
idGameLocal::MapShutdown
============
*/
void idGameLocal::MapShutdown( void ) {
Printf( "------------ Game Map Shutdown --------------\n" );
gamestate = GAMESTATE_SHUTDOWN;
soundSystem->ResetListener();
// RAVEN BEGIN
// rjohnson: new blur special effect
renderSystem->ShutdownSpecialEffects();
// RAVEN END
// clear out camera if we're in a cinematic
if ( inCinematic ) {
camera = NULL;
inCinematic = false;
}
// RAVEN BEGIN
// jscott: cleanup playbacks
gameEdit->ShutdownPlaybacks();
// RAVEN END
MapClear( true );
// RAVEN BEGIN
// jscott: make sure any spurious events are killed
idEvent::ClearEventList();
// reset the script to the state it was before the map was started