示例#1
0
bool CEditorGame::Init(ISystem *pSystem,IGameToEditorInterface *pGameToEditorInterface)
{
	assert(pSystem);

	SSystemInitParams startupParams;
	startupParams.bEditor = true;
	startupParams.pSystem = pSystem;
	startupParams.bExecuteCommandLine=false;		// in editor we do it later - after other things are initialized

	m_pGameStartup = CreateGameStartup();

	m_pGame = m_pGameStartup->Init(startupParams);

	if (!m_pGame)
	{
		return false;
	}

	IGameFramework* pGameFramework = m_pGame->GetIGameFramework();
	if ( pGameFramework != NULL )
	{
		pGameFramework->InitEditor( pGameToEditorInterface );
	}

	InitUIEnums(pGameToEditorInterface);

	gEnv->bServer = true;
	gEnv->bMultiplayer = false;

#if !defined(XENON) && !defined(PS3) && !defined(GRINGO)
	gEnv->SetIsClient(true);
#endif

	m_bUsingMultiplayerGameRules = false;

	s_pEditorGameMode = REGISTER_INT( "net_gamemode", 0, 0, "Should editor connect a new client?");
	s_pEditorGameMode->SetOnChangeCallback(&OnChangeEditorMode);

	SetGameMode(false);

	REGISTER_COMMAND( "net_reseteditorclient", ResetClient, 0, "Resets player and gamerules!" );

	ConfigureNetContext(true);
		
	return true;
}
示例#2
0
bool CEditorGame::Init(ISystem *pSystem,IGameToEditorInterface *pGameToEditorInterface)
{
	assert(pSystem);

	SSystemInitParams startupParams;
    FillSystemInitParams(startupParams, pSystem);

	m_pGameStartup = CreateGameStartup();

	m_pGame = m_pGameStartup->Init(startupParams);

	if (!m_pGame)
	{
		return false;
	}

	InitUIEnums(pGameToEditorInterface);

	m_pGame->GetIGameFramework()->InitEditor(pGameToEditorInterface);

	m_pEquipmentSystemInterface = new CEquipmentSystemInterface(this, pGameToEditorInterface);

	gEnv->bServer = true;
	gEnv->bMultiplayer = false;

#if !defined(CONSOLE)
	gEnv->SetIsClient(true);
#endif

	m_bUsingMultiplayerGameRules = (g_pGameCVars->g_multiplayerDefault != 0);

	if (IConsole* pConsole = gEnv->pConsole)
		s_pEditorGameMode = REGISTER_INT_CB("net_gamemode", 0, VF_NULL, "Should editor connect a new client?", &OnChangeEditorMode);

	SetGameMode(false);

	REGISTER_COMMAND( "net_reseteditorclient", ResetClient, VF_NULL, "Resets player and gamerules!" );

	ConfigureNetContext(true);

	g_pGame->OnEditorGameInitComplete();
		
	return true;
}