diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml
index 6a1fc1aab2..043fb60fac 100644
--- a/Docs/Luadoc/Lua.xml
+++ b/Docs/Luadoc/Lua.xml
@@ -489,6 +489,8 @@
+
+
diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml
index 8b8c1e89fc..ecfe7c7d8a 100644
--- a/Docs/Luadoc/LuaDocumentation.xml
+++ b/Docs/Luadoc/LuaDocumentation.xml
@@ -1641,6 +1641,12 @@ end
Sets z writing to true or false based on bWrite.
+
+ Sets whether or not the actor should be affected by the system's rate scaling (i.e. Tab/Tiled).
+
+
+ Returns whether or not the actor is affected by the system's rate scaling.
+
[02 Actor.lua] Plays the commands that follow using a bezier curve to determine the rate. The curve must have 4 or 8 elements. This is a convenience wrapper around calling Actor:tween with TweenType_Bezier.
diff --git a/src/Actor.cpp b/src/Actor.cpp
index 92b06eb79b..25df41bd1c 100644
--- a/src/Actor.cpp
+++ b/src/Actor.cpp
@@ -170,7 +170,7 @@ Actor::Actor()
m_FakeParent = nullptr;
m_bFirstUpdate = true;
m_tween_uses_effect_delta = false;
- tab_tilde_scaling_enabled_ = true;
+ rate_scaling_enabled_ = true;
}
Actor::~Actor()
@@ -876,7 +876,8 @@ void Actor::Update( float fDeltaTime )
// LOG->Trace( "Actor::Update( %f )", fDeltaTime );
float rate = GameLoop::GetUpdateRate();
- if (rate != 1 && !tab_tilde_scaling_enabled_) {
+ if (rate != 1 && !rate_scaling_enabled_) {
+ // Prevent divide by 0 when tab + tilde are both pressed.
if (rate != 0) {
fDeltaTime *= (1 / rate);
}
@@ -2010,10 +2011,13 @@ public:
COMMON_RETURN_SELF;
}
+ static int SetRateScalingEnabled( T* p, lua_State *L ) { p->SetRateScalingEnabled(BArg(1)); COMMON_RETURN_SELF; }
+ static int GetRateScalingEnabled( T* p, lua_State *L ) { lua_pushboolean( L, p->GetRateScalingEnabled() ); return 1; }
+
LunaActor()
{
- ADD_METHOD( name );
- ADD_METHOD( sleep );
+ ADD_METHOD( name );
+ ADD_METHOD( sleep );
ADD_METHOD( linear );
ADD_METHOD( accelerate );
ADD_METHOD( decelerate );
@@ -2182,6 +2186,9 @@ public:
ADD_METHOD( GetNumWrapperStates );
ADD_METHOD( GetWrapperState );
+ ADD_METHOD( SetRateScalingEnabled );
+ ADD_METHOD( GetRateScalingEnabled );
+
ADD_METHOD( Draw );
}
};
diff --git a/src/Actor.h b/src/Actor.h
index 68d397257e..76569ad0ef 100644
--- a/src/Actor.h
+++ b/src/Actor.h
@@ -622,6 +622,10 @@ public:
virtual void SetUpdateRate( float ) {}
virtual float GetUpdateRate() { return 1.0f; }
+ // Use this to enable/disable scaling an actor's rate with tab or tilde.
+ void SetRateScalingEnabled(bool b) { rate_scaling_enabled_ = b; }
+ bool GetRateScalingEnabled() { return rate_scaling_enabled_; }
+
HiddenPtr m_pLuaInstance;
protected:
@@ -714,9 +718,6 @@ 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;
@@ -756,9 +757,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_;
+ // Some actors shouldn't be scaled by the engine i.e. using with tab for
+ // speeding up or tilde for slowing down.
+ // In the case both are pressed (setting rate to 0), this bool does nothing.
+ bool rate_scaling_enabled_;
// commands
std::map m_mapNameToCommands;
diff --git a/src/Banner.cpp b/src/Banner.cpp
index eebd299137..ced12ba5c0 100644
--- a/src/Banner.cpp
+++ b/src/Banner.cpp
@@ -25,7 +25,10 @@ Banner::Banner()
{
m_bScrolling = false;
m_fPercentScrolling = 0;
- Actor::DisableTabTildeScaling();
+
+ // By default, don't let banners scale their rate with tab/tilde.
+ // This helps with animated/video banners.
+ Actor::SetRateScalingEnabled(false);
}
// Ugly: if sIsBanner is false, we're actually loading something other than a banner.