From 4e4ff9185a330429042be368d65490479018a003 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 23 May 2004 20:41:39 +0000 Subject: [PATCH] fix notefield crashes when playing at a very high beat: fTrailingBeat was eg. 500, fSongBeat was 0, and the "trail faster" logic overshot, setting fTrailingBeat to negative values (eg. -1200) --- stepmania/src/ScreenEdit.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 0bc436536d..1bca1694ae 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -537,7 +537,14 @@ void ScreenEdit::Update( float fDeltaTime ) m_fTrailingBeat += fMoveDelta; if( fabsf(fDelta) > 10 ) - m_fTrailingBeat += fDelta * fDeltaTime*5; + { + /* We're far off; move faster. Be sure to not overshoot. */ + fMoveDelta = fDelta * fDeltaTime*5; + float fNewDelta = GAMESTATE->m_fSongBeat - m_fTrailingBeat; + if( fabsf(fMoveDelta) > fabsf(fNewDelta) ) + fMoveDelta = fNewDelta; + m_fTrailingBeat += fMoveDelta; + } } m_NoteFieldEdit.Update( fDeltaTime );