コード例 #1
0
void NetworkManager::HandleReadyPacket( InputMemoryBitStream& inInputStream, uint64_t inFromPlayer )
{
	//if this is my first ready packet, I need to let everyone else know I'm ready
	if( mReadyCount == 0 )
	{
		SendReadyPacketsToPeers();
		//I'm ready now also, so an extra increment here
		mReadyCount++;
		mState = NMS_Ready;
	}

	mReadyCount++;

	TryStartGame();
}
コード例 #2
0
ファイル: restart.c プロジェクト: smaass/UQM-MegaMod
BOOLEAN
StartGame (void)
{
	do
	{
		while (!TryStartGame ())
		{
			if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
			{	// timed out
				GLOBAL (CurrentActivity) = 0;
				SplashScreen (0);
				if(optWhichIntro == OPT_3DO){
					Drumall ();
				}
				Credits (FALSE);
			}

			if (GLOBAL (CurrentActivity) & CHECK_ABORT)
				return (FALSE); // quit
		}

		if (LastActivity & CHECK_RESTART)
		{	// starting a new game
			FadeMusic (NORMAL_VOLUME, 0);
			if(!optSkipIntro){
				Introduction ();
			}
		}
	
	} while (GLOBAL (CurrentActivity) & CHECK_ABORT);

	{
		extern STAR_DESC starmap_array[];
		extern const BYTE element_array[];
		extern const PlanetFrame planet_array[];

		star_array = starmap_array;
		Elements = element_array;
		PlanData = planet_array;
	}

	PlayerControl[0] = HUMAN_CONTROL | STANDARD_RATING;
	PlayerControl[1] = COMPUTER_CONTROL | AWESOME_RATING;

	return (TRUE);
}
コード例 #3
0
void NetworkManager::TryReadyGame()
{
	if( mState == NMS_Lobby && IsMasterPeer() )
	{
		LOG( "Master peer readying up!" );
		//let the gamer services know we're readying up
		GamerServices::sInstance->SetLobbyReady( mLobbyId );

		SendReadyPacketsToPeers();

		mReadyCount = 1;
		mState = NMS_Ready;

		//we might be ready to start
		TryStartGame();
	}
}
コード例 #4
0
void NetworkManager::UpdateLobbyPlayers()
{
	//we only want to update player counts in lobby before we're starting
	if( mState < NMS_Starting )
	{
		mPlayerCount = GamerServices::sInstance->GetLobbyNumPlayers( mLobbyId );
		mMasterPeerId = GamerServices::sInstance->GetMasterPeerId( mLobbyId );
		//am I the master peer now?
		if( mMasterPeerId == mPlayerId )
		{
			mIsMasterPeer = true;
		}

		GamerServices::sInstance->GetLobbyPlayerMap( mLobbyId, mPlayerNameMap );

		//this might allow us to start
		TryStartGame();
	}
}
コード例 #5
0
BOOLEAN
StartGame (void)
{
	do
	{
		while (!TryStartGame ())
		{
			if (GLOBAL (CurrentActivity) == (ACTIVITY)~0)
			{	// timed out
				GLOBAL (CurrentActivity) = 0;
				SplashScreen (0);
				Credits (FALSE);
			}

			if (GLOBAL (CurrentActivity) & CHECK_ABORT)
				return (FALSE); // quit
		}

		if (LastActivity & CHECK_RESTART)
		{	// starting a new game
			Introduction ();
		}
	
	} while (GLOBAL (CurrentActivity) & CHECK_ABORT);

	{
		extern STAR_DESC starmap_array[];
		extern const BYTE element_array[];
		extern const PlanetFrame planet_array[];

		star_array = starmap_array;
		Elements = element_array;
		PlanData = planet_array;
	}

	PlayerControl[0] = HUMAN_CONTROL | STANDARD_RATING;
	PlayerControl[1] =  COMPUTER_CONTROL | AWESOME_RATING;
	SetPlayerInput ();

	return (TRUE);
}