From c8ed60a6467c457f7e0ff5639f8674127bd32f40 Mon Sep 17 00:00:00 2001 From: Ben Anderson Date: Fri, 22 Oct 2004 02:28:24 +0000 Subject: [PATCH] Fudging by 5 seconds is more of a wild guess than anything useful. Going by the "last beat" makes more sense. --- stepmania/src/ScreenGameplay.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 5b98130daf..9ee7a2da3d 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -1592,10 +1592,18 @@ void ScreenGameplay::Update( float fDeltaTime ) // // update song position meter // - float fMusicLengthSeconds = GAMESTATE->m_pCurSong->m_fMusicLengthSeconds; - // HACK: most songs have a lead out, so the meter never makes - // it all the way to the right. Fudge by guessing that there's 5 seconds of lead out - fMusicLengthSeconds -= 5; + // Because most songs have a leadout, consider the last beat to be the + // end of the song as far as the meter is concerned. So, get the time of + // the last beat of the song. + // + // XXX My hunch tells me doing this every update will slow things down, + // but at least it's somewhat accurate. We probably should do this + // when the meter inits, shove it in a variable somewhere, and go by + // that. At least it's better than blind fudging... + float fMusicLengthSeconds = + GAMESTATE->m_pCurSong->m_Timing.GetElapsedTimeFromBeat( + GAMESTATE->m_pCurSong->m_fLastBeat ); + float fPercentPositionSong = GAMESTATE->m_fMusicSeconds / fMusicLengthSeconds; CLAMP( fPercentPositionSong, 0, 1 ); m_meterSongPosition.SetPercent( fPercentPositionSong );