From 8814a37d19d599af2da1a45efcbbec018dabca9a Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 20 Aug 2002 07:20:59 +0000 Subject: [PATCH] Vain, hopeless attempt to simplify GetBeatAndBPSFromElapsedTime. :) --- stepmania/src/Song.cpp | 58 ++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index cb93f1ab38..f3fb194c67 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -163,7 +163,8 @@ void Song::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, fl // calculate the number of seconds in this segment float fSecondsInThisSegment = fBeatsInThisSegment / fBPS; - for( int j=0; j m_StopSegments[j].m_fStartBeat || + m_StopSegments[j].m_fStartBeat > fStartBeatNextSegment ) + continue; - float fBeatEstimate = fStartBeatThisSegment + fElapsedTime*fBPS; + // this freeze lies within this BPMSegment - for( int j=0; j fBeatEstimate ) + break; + + fElapsedTime -= m_StopSegments[j].m_fStopSeconds; + // re-estimate + fBeatEstimate = fStartBeatThisSegment + fElapsedTime*fBPS; + if( fBeatEstimate < m_StopSegments[j].m_fStartBeat ) { - if( fStartBeatThisSegment <= m_StopSegments[j].m_fStartBeat && m_StopSegments[j].m_fStartBeat <= fStartBeatNextSegment ) - { - // this freeze lies within this BPMSegment - - if( m_StopSegments[j].m_fStartBeat <= fBeatEstimate ) - { - fElapsedTime -= m_StopSegments[j].m_fStopSeconds; - // re-estimate - fBeatEstimate = fStartBeatThisSegment + fElapsedTime*fBPS; - if( fBeatEstimate < m_StopSegments[j].m_fStartBeat ) - { - fBeatOut = m_StopSegments[j].m_fStartBeat; - fBPSOut = fBPS; - bFreezeOut = true; - return; - } - } - else - break; - } + fBeatOut = m_StopSegments[j].m_fStartBeat; + fBPSOut = fBPS; + bFreezeOut = true; + return; } - - fBeatOut = fBeatEstimate; - fBPSOut = fBPS; - bFreezeOut = false; - return; } + fBeatOut = fBeatEstimate; + fBPSOut = fBPS; + bFreezeOut = false; + return; } }