diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 1d1b18c78d..ef74678c88 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -34,6 +34,8 @@ #include "Foreach.h" #include "LuaReference.h" #include "CommonMetrics.h" +#include "ScreenManager.h" +#include "Screen.h" #include #include @@ -1718,7 +1720,7 @@ bool GameState::OneIsHot() const return false; } -bool GameState::IsTimeToPlayAttractSounds() +bool GameState::IsTimeToPlayAttractSounds() const { if( PREFSMAN->m_AttractSoundFrequency == PrefsManager::ASF_NEVER ) return false; @@ -1730,6 +1732,18 @@ bool GameState::IsTimeToPlayAttractSounds() return false; } +void GameState::VisitAttractScreen( const CString sScreenName ) +{ + bool bSeenThisScreenInThisLoop = m_vScreensSeenSoFarInThisAttractLoop.find( sScreenName ) != m_vScreensSeenSoFarInThisAttractLoop.end(); + if( bSeenThisScreenInThisLoop ) + { + m_vScreensSeenSoFarInThisAttractLoop.clear(); + GAMESTATE->m_iNumTimesThroughAttract++; + } + + m_vScreensSeenSoFarInThisAttractLoop.insert( sScreenName ); +} + bool GameState::DifficultiesLocked() { if( GAMESTATE->m_PlayMode == PLAY_MODE_RAVE ) diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index c0efd6edb1..39937ee475 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -272,8 +272,10 @@ public: // // Attract stuff // + set m_vScreensSeenSoFarInThisAttractLoop; int m_iNumTimesThroughAttract; // negative means play regardless of m_iAttractSoundFrequency setting - bool IsTimeToPlayAttractSounds(); + bool IsTimeToPlayAttractSounds() const; + void VisitAttractScreen( const CString sScreenName ); // // PlayerState diff --git a/stepmania/src/ScreenAttract.cpp b/stepmania/src/ScreenAttract.cpp index 303eee0d32..9a7b23e4e0 100644 --- a/stepmania/src/ScreenAttract.cpp +++ b/stepmania/src/ScreenAttract.cpp @@ -27,9 +27,7 @@ ScreenAttract::ScreenAttract( CString sName, bool bResetGameState ) : ScreenWith if( bResetGameState ) GAMESTATE->Reset(); - // increment times through attract count - if( INITIAL_SCREEN == m_sName ) - GAMESTATE->m_iNumTimesThroughAttract++; + GAMESTATE->VisitAttractScreen( sName ); } void ScreenAttract::Init()