コード例 #1
0
bool CDeathMatchMissionMgr::EndGame( )
{
	// Call base.
	if( !CServerMissionMgr::EndGame( ))
		return false;

	// Can't have custom level or no campaign in deathmatch.
	if( m_bCustomLevel || m_Campaign.size( ) == 0 )
	{
		ASSERT( !"CDeathMatchMissionMgr::EndGame:  Can't have custom level or no campaign in deathmatch." );
		return false;
	}

	// Start from the beginning.
	m_nCurrentLevel = 0;
	m_nCurCampaignIndex = 0;
	m_nCurrentMission = m_Campaign[m_nCurCampaignIndex];
	m_bNewMission = true;

	// Get the worldname from the mission/level indices.
	char const* pszFilename = GetLevelFromMission( m_nCurrentMission, m_nCurrentLevel );
	if( !pszFilename )
		return false;

	// Exit to the level.
	if( !ExitLevel( pszFilename, false ))
		return false;

	return true;
}
コード例 #2
0
ファイル: MissionMgr.cpp プロジェクト: rickyharis39/nolf2
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	CMissionMgr::StartGameNew
//
//	PURPOSE:	Start the game from the beginning.
//
// ----------------------------------------------------------------------- //
bool CMissionMgr::StartGameNew( )
{
	// Default to use the first mission.
	int nFirstMission = 0;

	// Starting new game.
	g_pInterfaceMgr->StartingNewGame( );

	// If this is a multiplayer game, then get use the campaign file to determine
	// the first mission.
	if( IsMultiplayerGame( ))
	{
		// Get the first mission to play from the missions file.
		char szMission[4];
		CUserProfile* pUserProfile = g_pProfileMgr->GetCurrentProfile( );
		char const* pszCampaignFile = GetCampaignFile( pUserProfile->m_ServerGameOptions );
		if (!CWinUtil::FileExist( pszCampaignFile ))
			return false;

		CWinUtil::WinGetPrivateProfileString( "MissionList", "Mission0", "0", szMission, 
			ARRAY_LEN( szMission ), pszCampaignFile );
		nFirstMission = atoi( szMission );
	}

	// Get the level name for the first mission/level.
	char const* pszLevelFilename = GetLevelFromMission( nFirstMission, 0 );
	if( !pszLevelFilename )
		return false;

	// Start from the first level.
	if( !StartGameFromLevel( pszLevelFilename ))
		return false;

	return true;
}
コード例 #3
0
bool CServerMissionMgr::NextMission( )
{
	TRACE( "CServerMissionMgr::NextMission\n" );

	// Check if we're already exiting a level.
	if( m_bExitingLevel )
		return true;

	// If this was a custom level, then the game is over.
	if( m_bCustomLevel )
	{
		// Let the endgame code figure out what we should do.
		if( !EndGame( ))
			return false;

		return true;
	}

	// Get the mission.
	MISSION* pMission = g_pMissionButeMgr->GetMission(m_nCurrentMission);
	if( !pMission )
	{
        ASSERT( !"CServerMissionMgr::NextMission:  Invalid mission." );
		return false;
	}

	// Start level index over and advance the mission index.
	m_nCurrentLevel = 0;
	m_nCurrentRound = 0;
	m_nCurCampaignIndex++;

	// See if we reached the end of our campaign.
	if( m_nCurCampaignIndex >= ( int )m_Campaign.size( ))
	{
		// Let the endgame code figure out what we should do.
		if( !EndGame( ))
			return false;

		return true;
	}

	// Get the missionid from the campaign.
	m_nCurrentMission = m_Campaign[m_nCurCampaignIndex];

	// Flag that this is a new mission so we can tell everyone else.
	m_bNewMission = true;

	// Get the worldname from the mission/level indices.
	char const* pszFilename = GetLevelFromMission( m_nCurrentMission, m_nCurrentLevel );
	if( !pszFilename )
		return false;

	// Do the exit level.
	if( !ExitLevel( pszFilename, false ))
		return false;

	return true;
}
コード例 #4
0
bool CServerMissionMgr::ExitLevelTransition( int nNewLevel )
{
	TRACE( "CServerMissionMgr::ExitLevelTransition\n" );

	// Check if we're already exiting a level.
	if( m_bExitingLevel )
		return true;
	
	// Default to this not being a mission change.
	m_bNewMission = false;

	// Get the next level name.
	char const* pszFilename = GetLevelFromMission( m_nCurrentMission, nNewLevel );
	if( !pszFilename )
		return false;

	// Do the exit level.
	if( !ExitLevel( pszFilename, true ))
		return false;

	return true;
}