From 671af1903c90ce0bb2b11c1e19dab9b017e4318c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 22 Oct 2005 04:17:00 +0000 Subject: [PATCH] performance fix: don't call GetDeltaTime from ArrowEffects --- stepmania/src/ArrowEffects.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/stepmania/src/ArrowEffects.cpp b/stepmania/src/ArrowEffects.cpp index fbdbc10da4..880fa947c8 100644 --- a/stepmania/src/ArrowEffects.cpp +++ b/stepmania/src/ArrowEffects.cpp @@ -16,8 +16,6 @@ const float ARROW_SPACING = ARROW_SIZE;// + 2; -float g_fExpandSeconds = 0; - static float GetNoteFieldHeight( const PlayerState* pPlayerState ) { return SCREEN_HEIGHT + fabsf(pPlayerState->m_CurrentPlayerOptions.m_fPerspectiveTilt)*200; @@ -126,12 +124,13 @@ float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float if( fAccels[PlayerOptions::ACCEL_EXPAND] != 0 ) { - /* Timers can't be global, since they'll be initialized before SDL. */ - static RageTimer timerExpand; + static float g_fExpandSeconds = 0; + static float fLastTime = 0; + float fTime = RageTimer::GetTimeSinceStartFast(); if( !GAMESTATE->m_bFreeze ) - g_fExpandSeconds += timerExpand.GetDeltaTime(); - else - timerExpand.GetDeltaTime(); // throw away + g_fExpandSeconds += fTime - fLastTime; + fLastTime = fTime; + float fExpandMultiplier = SCALE( RageFastCos(g_fExpandSeconds*3), -1, 1, 0.75f, 1.75f ); fScrollSpeed *= SCALE( fAccels[PlayerOptions::ACCEL_EXPAND], 0.f, 1.f, 1.f, fExpandMultiplier ); }