diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 6ac87fde1f..2a69cd6bb5 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -240,6 +240,12 @@ void GameState::UpdateSongPosition(float fPositionSeconds) // LOG->Trace( "m_fMusicSeconds = %f, m_fSongBeat = %f, m_fCurBPS = %f, m_bFreeze = %f", m_fMusicSeconds, m_fSongBeat, m_fCurBPS, m_bFreeze ); } +float GameState::GetSongPercent( float beat ) const +{ + /* 0 = first step; 1 = last step */ + return (beat - m_pCurSong->m_fFirstBeat) / m_pCurSong->m_fLastBeat; +} + int GameState::GetStageIndex() { return m_iCurrentStageIndex; diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 70cfd8dd62..dcedfcf32f 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -157,6 +157,7 @@ public: void ResetMusicStatistics(); // Call this when it's time to play a new song. Clears the values above. void UpdateSongPosition(float fPositionSeconds); + float GetSongPercent( float beat ) const; // // Stage Statistics: