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(); }
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); }
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(); } }
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(); } }
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); }