fix attract sound frequency if initial screen not in attract loop

This commit is contained in:
Chris Danford
2005-06-11 11:25:34 +00:00
parent 386de4e74c
commit f7c6023412
3 changed files with 19 additions and 5 deletions
+15 -1
View File
@@ -34,6 +34,8 @@
#include "Foreach.h"
#include "LuaReference.h"
#include "CommonMetrics.h"
#include "ScreenManager.h"
#include "Screen.h"
#include <ctime>
#include <set>
@@ -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 )
+3 -1
View File
@@ -272,8 +272,10 @@ public:
//
// Attract stuff
//
set<CString> m_vScreensSeenSoFarInThisAttractLoop;
int m_iNumTimesThroughAttract; // negative means play regardless of m_iAttractSoundFrequency setting
bool IsTimeToPlayAttractSounds();
bool IsTimeToPlayAttractSounds() const;
void VisitAttractScreen( const CString sScreenName );
//
// PlayerState
+1 -3
View File
@@ -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()