clean up attract sound counting

This commit is contained in:
Chris Danford
2004-03-20 19:15:06 +00:00
parent 040e76cecf
commit b9cb773195
2 changed files with 12 additions and 14 deletions
+11 -13
View File
@@ -57,7 +57,7 @@ GameState::GameState()
ReloadCharacters(); ReloadCharacters();
m_iNumTimesThroughAttract = 0; m_iNumTimesThroughAttract = -1; // initial screen will bump this up to 0
/* Don't reset yet; let the first screen do it, so we can /* Don't reset yet; let the first screen do it, so we can
* use PREFSMAN and THEME. */ * use PREFSMAN and THEME. */
@@ -174,7 +174,9 @@ void GameState::BeginGame()
m_vpsNamesThatWereFilled.clear(); m_vpsNamesThatWereFilled.clear();
m_iNumTimesThroughAttract = 0; // play attract on the ending screen, then in one more whole attract
// sequence after the game is over (even if attract sounds are set to off)
m_iNumTimesThroughAttract = -2;
} }
void CheckStageStats( const StageStats &ss, int p ) void CheckStageStats( const StageStats &ss, int p )
@@ -266,15 +268,11 @@ void GameState::EndGame()
pMachineProfile->m_iCurrentCombo = 0; pMachineProfile->m_iCurrentCombo = 0;
CHECKPOINT; CHECKPOINT;
int p; FOREACH_HumanPlayer( p )
for( p=0; p<NUM_PLAYERS; p++ )
{ {
if( !IsHumanPlayer(p) )
continue;
CHECKPOINT; CHECKPOINT;
Profile* pPlayerProfile = PROFILEMAN->GetProfile( (PlayerNumber)p ); Profile* pPlayerProfile = PROFILEMAN->GetProfile( p );
if( pPlayerProfile ) if( pPlayerProfile )
{ {
pPlayerProfile->m_iTotalPlaySeconds += iPlaySeconds; pPlayerProfile->m_iTotalPlaySeconds += iPlaySeconds;
@@ -289,10 +287,10 @@ void GameState::EndGame()
for( unsigned i=0; i<g_vPlayedStageStats.size(); i++ ) for( unsigned i=0; i<g_vPlayedStageStats.size(); i++ )
{ {
const StageStats& ss = g_vPlayedStageStats[i]; const StageStats& ss = g_vPlayedStageStats[i];
AddPlayerStatsToProfile( pMachineProfile, ss, (PlayerNumber) p ); AddPlayerStatsToProfile( pMachineProfile, ss, p );
if( pPlayerProfile ) if( pPlayerProfile )
AddPlayerStatsToProfile( pPlayerProfile, ss, (PlayerNumber) p ); AddPlayerStatsToProfile( pPlayerProfile, ss, p );
} }
CHECKPOINT; CHECKPOINT;
@@ -1454,9 +1452,9 @@ bool GameState::OneIsHot() const
bool GameState::IsTimeToPlayAttractSounds() bool GameState::IsTimeToPlayAttractSounds()
{ {
// always play attract sounds the first time through after a game over - // if m_iNumTimesThroughAttract is negative, play attract sounds regardless
// even if attract sounds are set to "never". // of m_iAttractSoundFrequency.
if( m_iNumTimesThroughAttract==0 ) if( m_iNumTimesThroughAttract<0 )
return true; return true;
// 0 means "never play sound". Avoid a divide by 0 below. // 0 means "never play sound". Avoid a divide by 0 below.
+1 -1
View File
@@ -271,7 +271,7 @@ public:
// //
// Attract stuff // Attract stuff
// //
int m_iNumTimesThroughAttract; int m_iNumTimesThroughAttract; // negative means play regardless of m_iAttractSoundFrequency setting
bool IsTimeToPlayAttractSounds(); bool IsTimeToPlayAttractSounds();
}; };