Sources/CryGame C++/Solution1/CryGame/Game.cpp
//////////////////////////////////////////////////////////////////////
//! reset the game before a level reloading
//! this function allows the reloading of all scripts
//! and wipes out all textures from the 3dengine

reset the game before a level reloading
this function allows the reloading of all scripts
and wipes out all textures from the 3dengine
reset the game before a level reloading this function allows the reloading of all scripts and wipes out all textures from the 3dengine
void CXGame::Reset()
{
	m_pEntitySystem->Reset();
	if (m_pSystem->GetIMusicSystem())
		m_pSystem->GetIMusicSystem()->Unload();
	m_pScriptSystem->SetGlobalToNull("_localplayer");
	if(m_pScriptSystem)
		m_pScriptSystem->UnloadScripts();
	m_pWeaponSystemEx->Reset();
	m_XSurfaceMgr.Reset();
	m_XAreaMgr.Clear();
	ClearTagPoints();
#if !defined(LINUX)
	if (m_pSystem->GetIMovieSystem())
		m_pSystem->GetIMovieSystem()->Reset(false);
#endif
	m_pScriptObjectGame->Reset();
	m_pScriptSystem->ForceGarbageCollection();
	m_p3DEngine->ClearRenderResources();
	m_pScriptTimerMgr->Reset();
	if (m_pSystem->GetIInput())
	{
		m_pSystem->GetIInput()->Update(true);
		m_pSystem->GetIInput()->Update(true);
	}
	if (m_pIActionMapManager)
		m_pIActionMapManager->Reset();
	m_iLastCmdIdx = 0;
	if (m_pUISystem)
	{
		m_pUISystem->UnloadAllModels();
		m_pUISystem->StopAllVideo();
		m_p3DEngine->Enable(1);
	}
	if (m_pCurrentUI) 
		m_pCurrentUI->Reset();
	if (m_pUIHud)
		m_pUIHud->Reset();
	if (GetMyPlayer())
		GetMyPlayer()->SetNeedUpdate(true);
}
void CXGame :: Reset ( ) { m_pEntitySystem -> Reset ( ) ; if ( m_pSystem -> GetIMusicSystem ( ) ) m_pSystem -> GetIMusicSystem ( ) -> Unload ( ) ; m_pScriptSystem -> SetGlobalToNull ( " " ) ; if ( m_pScriptSystem ) m_pScriptSystem -> UnloadScripts ( ) ; m_pWeaponSystemEx -> Reset ( ) ; m_XSurfaceMgr . Reset ( ) ; m_XAreaMgr . Clear ( ) ; ClearTagPoints ( ) ; #if ! defined ( LINUX ) if ( m_pSystem -> GetIMovieSystem ( ) ) m_pSystem -> GetIMovieSystem ( ) -> Reset ( false ) ; #endif m_pScriptObjectGame -> Reset ( ) ; m_pScriptSystem -> ForceGarbageCollection ( ) ; m_p3DEngine -> ClearRenderResources ( ) ; m_pScriptTimerMgr -> Reset ( ) ; if ( m_pSystem -> GetIInput ( ) ) { m_pSystem -> GetIInput ( ) -> Update ( true ) ; m_pSystem -> GetIInput ( ) -> Update ( true ) ; } if ( m_pIActionMapManager ) m_pIActionMapManager -> Reset ( ) ; m_iLastCmdIdx = 0 ; if ( m_pUISystem ) { m_pUISystem -> UnloadAllModels ( ) ; m_pUISystem -> StopAllVideo ( ) ; m_p3DEngine -> Enable ( 1 ) ; } if ( m_pCurrentUI ) m_pCurrentUI -> Reset ( ) ; if ( m_pUIHud ) m_pUIHud -> Reset ( ) ; if ( GetMyPlayer ( ) ) GetMyPlayer ( ) -> SetNeedUpdate ( true ) ; }
reset the game before a level reloading
this function allows the reloading of all scripts
and wipes out all textures from the 3dengine
reset the game before a level reloading this function allows the reloading of all scripts and wipes out all textures from the 3dengine
// Unload all music.
 //allow to reload scripts with(LoadScript)
 // Must reset all timers.
 //clen up the input buffer
 //////////////////////////////////////////////////////////////////////////
 // Reset UI.
 //////////////////////////////////////////////////////////////////////////
 //m_pSystem->GetILog()->Log("UISystem: Enabled 3D Engine!");
