diff --git a/src/Actor.cpp b/src/Actor.cpp index 0b37e4f973..92b06eb79b 100644 --- a/src/Actor.cpp +++ b/src/Actor.cpp @@ -13,6 +13,7 @@ #include "LightsManager.h" // for NUM_CabinetLight #include "ActorUtil.h" #include "Preference.h" +#include "GameLoop.h" #include #include @@ -166,9 +167,10 @@ Actor::Actor() m_size = RageVector2( 1, 1 ); InitState(); m_pParent = nullptr; - m_FakeParent= nullptr; + m_FakeParent = nullptr; m_bFirstUpdate = true; - m_tween_uses_effect_delta= false; + m_tween_uses_effect_delta = false; + tab_tilde_scaling_enabled_ = true; } Actor::~Actor() @@ -872,6 +874,14 @@ bool Actor::IsFirstUpdate() const void Actor::Update( float fDeltaTime ) { // LOG->Trace( "Actor::Update( %f )", fDeltaTime ); + + float rate = GameLoop::GetUpdateRate(); + if (rate != 1 && !tab_tilde_scaling_enabled_) { + if (rate != 0) { + fDeltaTime *= (1 / rate); + } + } + ASSERT_M( fDeltaTime >= 0, ssprintf("DeltaTime: %f",fDeltaTime) ); if( m_fHibernateSecondsLeft > 0 ) diff --git a/src/Actor.h b/src/Actor.h index bf927fe551..68d397257e 100644 --- a/src/Actor.h +++ b/src/Actor.h @@ -714,6 +714,9 @@ protected: * follow the effect clock. Actor::Update must be called first. */ float GetEffectDeltaTime() const { return m_fEffectDelta; } + // Use this to disable scaling an actor's rate with tab or tilde. + void DisableTabTildeScaling() { tab_tilde_scaling_enabled_ = false; } + // todo: account for SSC_FUTURES by having these be vectors too -aj RageColor m_effectColor1; RageColor m_effectColor2; @@ -753,6 +756,10 @@ protected: static std::vector g_vfCurrentBGMBeatPlayerNoOffset; private: + // Some actors shouldn't be scaled with tab or tilde. This bool does not + // guard against holding both at the same time (setting the rate to zero). + bool tab_tilde_scaling_enabled_; + // commands std::map m_mapNameToCommands; }; diff --git a/src/Banner.cpp b/src/Banner.cpp index 5b185b73b1..eebd299137 100644 --- a/src/Banner.cpp +++ b/src/Banner.cpp @@ -25,6 +25,7 @@ Banner::Banner() { m_bScrolling = false; m_fPercentScrolling = 0; + Actor::DisableTabTildeScaling(); } // Ugly: if sIsBanner is false, we're actually loading something other than a banner. diff --git a/src/GameLoop.cpp b/src/GameLoop.cpp index 18ef8f81d2..d288c6d065 100644 --- a/src/GameLoop.cpp +++ b/src/GameLoop.cpp @@ -40,6 +40,10 @@ void GameLoop::SetUpdateRate( float fUpdateRate ) g_fUpdateRate = fUpdateRate; } +float GameLoop::GetUpdateRate() { + return g_fUpdateRate; +} + static void CheckGameLoopTimerSkips( float fDeltaTime ) { static int iLastFPS = 0; diff --git a/src/GameLoop.h b/src/GameLoop.h index 97f9d1f6d4..34653765dc 100644 --- a/src/GameLoop.h +++ b/src/GameLoop.h @@ -5,7 +5,8 @@ namespace GameLoop { void RunGameLoop(); void UpdateAllButDraw( bool bRunningFromVBLANK); - void SetUpdateRate( float fUpdateRate ); + void SetUpdateRate(float fUpdateRate); + float GetUpdateRate(); void ChangeTheme(const RString &sNewTheme); void ChangeGame(const RString& new_game, const RString& new_theme= ""); void StartConcurrentRendering();