Example #1
0
/*
================
idSaveGame::Close
================
*/
void idSaveGame::Close()
{
	WriteSoundCommands();
	
	// read trace models
	idClipModel::SaveTraceModels( this );
	
	for( int i = 1; i < objects.Num(); i++ )
	{
		CallSave_r( objects[ i ]->GetType(), objects[ i ] );
	}
	
	objects.Clear();
	
	// Save out the string table at the end of the file
	for( int i = 0; i < stringTable.Num(); ++i )
	{
		stringFile->WriteString( stringTable[i].string );
	}
	
	stringHash.Free();
	stringTable.Clear();
	
	if( file->Length() > MIN_SAVEGAME_SIZE_BYTES || stringFile->Length() > MAX_SAVEGAME_STRING_TABLE_SIZE )
	{
		idLib::FatalError( "OVERFLOWED SAVE GAME FILE BUFFER" );
	}
	
#ifdef ID_DEBUG_MEMORY
	idStr gameState = file->GetName();
	gameState.StripFileExtension();
	WriteGameState_f( idCmdArgs( va( "test %s_save", gameState.c_str() ), false ) );
#endif
}
Example #2
0
/*
================
void idRestoreGame::RestoreObjects
================
*/
void idRestoreGame::RestoreObjects( void ) {
	int i;

	ReadSoundCommands();

	// read trace models
	idClipModel::RestoreTraceModels( this );

	// restore all the objects
	for( i = 1; i < objects.Num(); i++ ) {
		CallRestore_r( objects[ i ]->GetType(), objects[ i ] );
	}

	// regenerate render entities and render lights because are not saved
	for( i = 1; i < objects.Num(); i++ ) {
		if ( objects[ i ]->IsType( idEntity::Type ) ) {
			idEntity *ent = static_cast<idEntity *>( objects[ i ] );
			ent->UpdateVisuals();
			ent->Present();
		}
	}

#ifdef ID_DEBUG_MEMORY
	idStr gameState = file->GetName();
	gameState.StripFileExtension();
	WriteGameState_f( idCmdArgs( va( "test %s_restore", gameState.c_str() ), false ) );
	//CompareGameState_f( idCmdArgs( va( "test %s_save", gameState.c_str() ) ) );
	gameLocal.Error( "dumped game states" );
#endif
}
Example #3
0
/*
================
idSaveGame::Close
================
*/
void idSaveGame::Close( void ) {
	int i;
	WriteSoundCommands();
	// read trace models
	idClipModel::SaveTraceModels( this );
	for( i = 1; i < objects.Num(); i++ ) {
		CallSave_r( objects[ i ]->GetType(), objects[ i ] );
	}
	objects.Clear();
#ifdef ID_DEBUG_MEMORY
	idStr gameState = file->GetName();
	gameState.StripFileExtension();
	WriteGameState_f( idCmdArgs( va( "test %s_save", gameState.c_str() ), false ) );
#endif
}
Example #4
0
/*
============
idCmdSystemLocal::ExecuteCommandText

Tokenizes, then executes.
============
*/
void idCmdSystemLocal::ExecuteCommandText( const char *text ) {	
	ExecuteTokenizedString( idCmdArgs( text, false ) );
}