Пример #1
0
	void UpdateLevelInfo()
	{
		ILevel *pLevel = gEnv->pGame->GetIGameFramework()->GetILevelSystem()->GetCurrentLevel();

		if(pLevel != NULL && pLevel->GetLevelInfo() != NULL)
			m_minimapInfo = pLevel->GetLevelInfo()->GetMinimapInfo();
	}
Пример #2
0
void CFlowGraphModuleManager::RescanModuleNames(bool bGlobal)
{
	CryFixedStringT<512> path = "";

	if(bGlobal)
	{
		path = PathUtil::GetGameFolder().c_str();
		path += "\\Libs\\";
	}
	else
	{
		if(gEnv->IsEditor())
		{
			char *levelName;
			char *levelPath;
			gEnv->pGame->GetIGameFramework()->GetEditorLevel(&levelName, &levelPath);
			path = levelPath;
		}
		else
		{
			ILevel *pLevel = gEnv->pGame->GetIGameFramework()->GetILevelSystem()->GetCurrentLevel();
			if (pLevel)
			{
				path = pLevel->GetLevelInfo()->GetPath();
			}
		}
	}

	if(false == path.empty())
	{
		path += MODULE_FOLDER_NAME;
		ScanFolder(path, bGlobal);	
	}
}
Пример #3
0
void CUIManager::OnSystemEvent( ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam )
{

	switch (event)
	{
	case ESYSTEM_EVENT_LEVEL_POST_UNLOAD:
		InitSound();
		break;
	case ESYSTEM_EVENT_LEVEL_LOAD_PREPARE:
		ShutdownSound();
		break;
	case ESYSTEM_EVENT_LEVEL_GAMEPLAY_START:
	case ESYSTEM_EVENT_EDITOR_GAME_MODE_CHANGED:
		{
			if (event == ESYSTEM_EVENT_LEVEL_GAMEPLAY_START || wparam == 1)
			{
				ILevel *pLevel = gEnv->pGame->GetIGameFramework()->GetILevelSystem()->GetCurrentLevel();
				if(pLevel)
				{
					m_pMOSystem->LoadLevelObjectives(pLevel->GetLevelInfo()->GetPath(), true);
				}
			}
		}
		break;
	}
}
Пример #4
0
	virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo)
	{
		switch (event)
		{
		case eFE_Activate:
			{
				if(IsPortActive(pActInfo, EIP_LevelComplete))
				{
					// Send the level name to the persistant stats system.
					ILevelSystem* pLS = g_pGame->GetIGameFramework()->GetILevelSystem();
					ILevel* pLevel = pLS ? pLS->GetCurrentLevel() : NULL;
					ILevelInfo* pLevelInfo = pLevel ? pLevel->GetLevelInfo() : NULL;
					if(pLevelInfo)
					{
						// level name case differs (lowercase on ps3, initial caps on xbox) so force lower here
						stack_string levelName = pLevelInfo->GetName();
						levelName.MakeLower();
						if(AccountLevelForStats( levelName.c_str() ))
						{
							g_pGame->GetPersistantStats()->OnSPLevelComplete( levelName.c_str() );
						}
					}
				}

				if(IsPortActive(pActInfo, EIP_Trigger))
				{
					int achievementId = -1;
					int input = GetPortInt(pActInfo, EIP_Achievement);

				/*	COMPILE_TIME_ASSERT( 0 == eC3A_Tutorial );
					COMPILE_TIME_ASSERT( 7 == eC3A_Cave );
					
					COMPILE_TIME_ASSERT( 23 == eC3A_SPLevel_CanYouHearMe );
					COMPILE_TIME_ASSERT( 24 == eC3A_SPLevel_Jailbreak_Rockets );
					COMPILE_TIME_ASSERT( 25 == eC3A_SPLevel_Donut_Surf );
					COMPILE_TIME_ASSERT( 26 == eC3A_SPLevel_Roadkill );
					COMPILE_TIME_ASSERT( 30 == eC3A_SPSkill_Improviser );*/

					if((input >= 0 && input <= 7) || (input >= 24 && input <= 28) || (input == eC3A_SPSkill_Improviser) )
					{
						achievementId = input;
					}
					else
					{
						assert(false);
					}

					if(achievementId != -1)
					{
						g_pGame->GetGameAchievements()->GiveAchievement((ECrysis3Achievement)achievementId);
					}
				}
				break;
			}
		}
	}
Пример #5
0
void CEditorGame::OnSaveLevel()
{
	ILevel* pCurrentLevel = m_pGame->GetIGameFramework()->GetILevelSystem()->GetCurrentLevel();

	if (pCurrentLevel)
	{
		ILevelInfo* pLevelInfo = pCurrentLevel->GetLevelInfo();
		string levelPath = PathUtil::GetGameFolder() + "/" + pLevelInfo->GetPath();
		InitEntityArchetypeEnums(m_pGTE, levelPath, PathUtil::GetFile(pLevelInfo->GetName()));
	}
}
Пример #6
0
string CDevMode::TagFileName()
{
	ILevelSystem * pLevelSystem = CCryAction::GetCryAction()->GetILevelSystem();
	ILevel * pLevel = pLevelSystem->GetCurrentLevel();
	if (!pLevel)
		return "";

	string path = pLevel->GetLevelInfo()->GetPath();
	path = PathUtil::GetGameFolder()+ string("/") + path + "/tags.txt";

	return path;
}
Пример #7
0
void CUIGameEvents::OnLoadGame( bool shouldResume )
{
	if (gEnv->IsEditor()) return;

	ILevel* pLevel = m_pLevelSystem->GetCurrentLevel();
	if (pLevel)
	{
		m_pGameFramework->LoadGame(pLevel->GetLevelInfo()->GetPath(), true);
		if ( shouldResume && m_pGameFramework->IsGamePaused() )
			m_pGameFramework->PauseGame(false, true);
	}
}
Пример #8
0
void CUIGameEvents::OnReloadLevel()
{
	if (gEnv->IsEditor()) return;

	ILevel* pLevel = m_pLevelSystem->GetCurrentLevel();
	if (pLevel)
	{
		m_pGameFramework->ExecuteCommandNextFrame(string().Format("map %s", pLevel->GetLevelInfo()->GetName()));
		if ( m_pGameFramework->IsGamePaused() )
			m_pGameFramework->PauseGame(false, true);
	}
}
Пример #9
0
void CAntiCheatManager::InitSession()
{
	OpenLogFile();

	const char * pSessionName = NULL;
	char sessionID[CRYSESSIONID_STRINGLEN];
	sessionID[0] = 0;
	
	if(CGameLobby * pGameLobby = g_pGame->GetGameLobby())
	{
		pSessionName = pGameLobby->GetSessionName();
		if (pSessionName && pSessionName[0]==0)
			pSessionName=NULL;
		pGameLobby->GetSessionIDAsString(sessionID, CRYSESSIONID_STRINGLEN);
	} 

	//This can't be logged via the cleaner XML method as we need to open the tag now, and close it later on, without leaving everything in memory the whole time
	CryStackStringT<char, 512> sessionStartTag;

	const char * pTelemetrySessionName = NULL;

	if(ITelemetryCollector * pTelemetryCollector = g_pGame->GetITelemetryCollector())
	{
		pTelemetrySessionName = pTelemetryCollector->GetSessionId().c_str();
	}

	sessionStartTag.Format("<Session name=\"%s\" telemetry_name=\"%s\" id=\"%s\">\n", pSessionName ? pSessionName : "UNKNOWN", pTelemetrySessionName ? pTelemetrySessionName : "UNKNOWN", sessionID[0] ? sessionID : "UNKNOWN");

	if (m_pLogFile)
	{
		gEnv->pCryPak->FWrite(sessionStartTag.c_str(), 1, sessionStartTag.length(), m_pLogFile);
	}

	if(CGameRules * pGameRules = g_pGame->GetGameRules())
	{
		XmlNodeRef sessionGameInfo = GetISystem()->CreateXmlNode("GameInfo");

		ILevel * pLevel = g_pGame->GetIGameFramework()->GetILevelSystem()->GetCurrentLevel();

		sessionGameInfo->setAttr("map",				pLevel->GetLevelInfo()->GetName());
		sessionGameInfo->setAttr("gamemode",	CGameRules::S_GetGameModeNamesArray()[pGameRules->GetGameMode()]);

		CheatLogInternalXml(sessionGameInfo);
	}
}