From c3daaf9ae227bd2b1e1b82d1f6f416891e63854b Mon Sep 17 00:00:00 2001 From: "Ben \"root\" Anderson" Date: Tue, 14 Jan 2014 16:19:46 -0600 Subject: [PATCH] Hack around ScreenGameplaySyncMachine trying to do a network game --- src/ScreenGameplay.cpp | 17 ++++++++--------- src/ScreenGameplay.h | 6 ++++++ src/ScreenGameplaySyncMachine.cpp | 2 ++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/ScreenGameplay.cpp b/src/ScreenGameplay.cpp index 13a186c11d..454617b09d 100644 --- a/src/ScreenGameplay.cpp +++ b/src/ScreenGameplay.cpp @@ -323,6 +323,7 @@ ScreenGameplay::ScreenGameplay() { m_pSongBackground = NULL; m_pSongForeground = NULL; + m_bForceNoNetwork = false; } void ScreenGameplay::Init() @@ -540,7 +541,8 @@ void ScreenGameplay::Init() // we need to wait, so that there is no Dead On Start issues. // if you wait too long at the second checkpoint, you will // appear dead when you begin your game. - NSMAN->StartRequest(0); + if( !m_bForceNoNetwork ) + NSMAN->StartRequest(0); // Add individual life meter @@ -582,7 +584,7 @@ void ScreenGameplay::Init() #if !defined(WITHOUT_NETWORKING) // Only used in SMLAN/SMOnline: - if( NSMAN->useSMserver && GAMESTATE->GetCurrentStyle()->m_StyleType != StyleType_OnePlayerTwoSides ) + if( !m_bForceNoNetwork && NSMAN->useSMserver && GAMESTATE->GetCurrentStyle()->m_StyleType != StyleType_OnePlayerTwoSides ) { m_bShowScoreboard = PREFSMAN->m_bEnableScoreboard.Get(); PlayerNumber pn = GAMESTATE->GetFirstDisabledPlayer(); @@ -931,7 +933,8 @@ ScreenGameplay::~ScreenGameplay() m_GameplayAssist.StopPlaying(); - NSMAN->ReportSongOver(); + if( !m_bForceNoNetwork ) + NSMAN->ReportSongOver(); } bool ScreenGameplay::IsLastSong() @@ -1462,11 +1465,7 @@ void ScreenGameplay::BeginScreen() SOUND->PlayOnceFromAnnouncer( "gameplay intro" ); // crowd cheer // Get the transitions rolling - if( GAMESTATE->m_bDemonstrationOrJukebox ) - { - StartPlayingSong( MIN_SECONDS_TO_STEP, MIN_SECONDS_TO_MUSIC ); - } - else if( NSMAN->useSMserver ) + if( !m_bForceNoNetwork && NSMAN->useSMserver ) { // If we're using networking, we must not have any delay. If we do, // this can cause inconsistency on different computers and @@ -1880,7 +1879,7 @@ void ScreenGameplay::Update( float fDeltaTime ) SendCrossedMessages(); - if( NSMAN->useSMserver ) + if( !m_bForceNoNetwork && NSMAN->useSMserver ) { FOREACH_EnabledPlayerNumberInfo( m_vPlayerInfo, pi ) if( pi->m_pLifeMeter ) diff --git a/src/ScreenGameplay.h b/src/ScreenGameplay.h index df3ee5efe8..3077c2517d 100644 --- a/src/ScreenGameplay.h +++ b/src/ScreenGameplay.h @@ -300,6 +300,12 @@ protected: virtual PlayerInfo &GetPlayerInfoForInput( const InputEventPlus& iep ) { return m_vPlayerInfo[iep.pn]; } RageTimer m_timerGameplaySeconds; + + // HACK: We have no idea whether we're actually using SMOnline or not. + // No, seriously, NOWHERE is it stored what room we're in or whether we're in a room at all. + // Apparently we just hope the server is keeping track. + // All we can do is guess based on what subclass we are. + bool m_bForceNoNetwork; }; vector::iterator GetNextEnabledPlayerInfo ( vector::iterator iter, vector &v ); diff --git a/src/ScreenGameplaySyncMachine.cpp b/src/ScreenGameplaySyncMachine.cpp index 75679087a4..037ced9f97 100644 --- a/src/ScreenGameplaySyncMachine.cpp +++ b/src/ScreenGameplaySyncMachine.cpp @@ -15,6 +15,8 @@ REGISTER_SCREEN_CLASS( ScreenGameplaySyncMachine ); void ScreenGameplaySyncMachine::Init() { + m_bForceNoNetwork = true; + GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR ); GAMESTATE->SetCurrentStyle( GAMEMAN->GetHowToPlayStyleForGame(GAMESTATE->m_pCurGame) ); AdjustSync::ResetOriginalSyncData();