less fragile attract sound logic

This commit is contained in:
Chris Danford
2005-06-12 04:22:16 +00:00
parent 40af26f4a0
commit 8f9951e38d
4 changed files with 12 additions and 9 deletions
+1
View File
@@ -10,6 +10,7 @@
CString PLAYER_COLOR_NAME( size_t p ) { return ssprintf("ColorP%d",int(p+1)); }
ThemeMetric<CString> INITIAL_SCREEN ("Common","InitialScreen");
ThemeMetric<CString> FIRST_ATTRACT_SCREEN ("Common","FirstAttractScreen");
ThemeMetric<CString> DEFAULT_MODIFIERS ("Common","DefaultModifiers" );
ThemeMetric<CString> DEFAULT_CPU_MODIFIERS ("Common","DefaultCpuModifiers" );
ThemeMetric1D<RageColor> PLAYER_COLOR ("Common",PLAYER_COLOR_NAME,NUM_PLAYERS);
+1
View File
@@ -53,6 +53,7 @@ public:
// Metrics
//
extern ThemeMetric<CString> INITIAL_SCREEN;
extern ThemeMetric<CString> FIRST_ATTRACT_SCREEN;
extern ThemeMetric<CString> DEFAULT_MODIFIERS;
extern ThemeMetric<CString> DEFAULT_CPU_MODIFIERS;
extern ThemeMetric1D<RageColor> PLAYER_COLOR;
+10 -8
View File
@@ -1736,6 +1736,14 @@ bool GameState::OneIsHot() const
bool GameState::IsTimeToPlayAttractSounds() const
{
// m_iNumTimesThroughAttract will be -1 from the first attract screen after
// the end of a game until the next time FIRST_ATTRACT_SCREEN is reached.
// Play attract sounds for this sort span of time regardless of
// m_AttractSoundFrequency because it's awkward to have the machine go
// silent immediately after the end of a game.
if( m_iNumTimesThroughAttract == -1 )
return true;
if( PREFSMAN->m_AttractSoundFrequency == PrefsManager::ASF_NEVER )
return false;
@@ -1748,14 +1756,8 @@ bool GameState::IsTimeToPlayAttractSounds() const
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 );
if( sScreenName == FIRST_ATTRACT_SCREEN.GetValue() )
m_iNumTimesThroughAttract++;
}
bool GameState::DifficultiesLocked()
-1
View File
@@ -272,7 +272,6 @@ public:
//
// Attract stuff
//
set<CString> m_vScreensSeenSoFarInThisAttractLoop;
int m_iNumTimesThroughAttract; // negative means play regardless of m_iAttractSoundFrequency setting
bool IsTimeToPlayAttractSounds() const;
void VisitAttractScreen( const CString sScreenName );