Move the reset code to SongPosition.

This commit is contained in:
Thai Pangsakulyanont
2011-05-10 21:22:01 +07:00
parent 722d22dffc
commit b8a4521f9c
4 changed files with 23 additions and 11 deletions
+5 -10
View File
@@ -893,22 +893,17 @@ const float GameState::MUSIC_SECONDS_INVALID = -5000.0f;
void GameState::ResetMusicStatistics()
{
m_fMusicSeconds = 0; // MUSIC_SECONDS_INVALID;
// todo: move me to FOREACH_EnabledPlayer( p ) after [NUM_PLAYERS]ing
m_fSongBeat = 0;
m_fSongBeatNoOffset = 0;
m_fCurBPS = 10;
//m_bStop = false;
m_bFreeze = false;
m_bDelay = false;
m_iWarpBeginRow = -1; // Set to -1 because some song may want to warp to row 0. -aj
m_fWarpDestination = -1; // Set when a warp is encountered. also see above. -aj
m_Position.Reset();
m_fMusicSecondsVisible = 0;
m_fSongBeatVisible = 0;
Actor::SetBGMTime( 0, 0, 0, 0 );
FOREACH_PlayerNumber( p )
{
m_pPlayerState[p]->ClearHopoState();
m_pPlayerState[p]->m_Position.Reset();
}
}
void GameState::ResetStageStatistics()
+1 -1
View File
@@ -618,7 +618,7 @@ float FindFirstDisplayedBeat( const PlayerState* pPlayerState, int iDrawDistance
bBoomerang = (fAccels[PlayerOptions::ACCEL_BOOMERANG] != 0);
}
while( fFirstBeatToDraw < m_pPlayerState->m_Position.m_fSongBeat )
while( fFirstBeatToDraw < pPlayerState->m_Position.m_fSongBeat )
{
bool bIsPastPeakYOffset;
float fPeakYOffset;
+16
View File
@@ -46,6 +46,22 @@ void SongPosition::UpdateSongPosition( float fPositionSeconds, const TimingData
}
void SongPosition::Reset()
{
m_fMusicSeconds = 0; // MUSIC_SECONDS_INVALID;
// todo: move me to FOREACH_EnabledPlayer( p ) after [NUM_PLAYERS]ing
m_fSongBeat = 0;
m_fSongBeatNoOffset = 0;
m_fCurBPS = 10;
//m_bStop = false;
m_bFreeze = false;
m_bDelay = false;
m_iWarpBeginRow = -1; // Set to -1 because some song may want to warp to row 0. -aj
m_fWarpDestination = -1; // Set when a warp is encountered. also see above. -aj
}
/**
* @file
* @author Thai Pangsakulyanont (c) 2011
+1
View File
@@ -32,6 +32,7 @@ class SongPosition
float m_fWarpDestination;
RageTimer m_LastBeatUpdate; // time of last m_fSongBeat, etc. update
void Reset();
void UpdateSongPosition( float fPositionSeconds, const TimingData &timing, const RageTimer &timestamp = RageZeroTimer );
};