Rename to rate_scaling_enable_ + Expose functions to lua
This commit is contained in:
@@ -489,6 +489,8 @@
|
|||||||
<Function name='ztest'/>
|
<Function name='ztest'/>
|
||||||
<Function name='ztestmode'/>
|
<Function name='ztestmode'/>
|
||||||
<Function name='zwrite'/>
|
<Function name='zwrite'/>
|
||||||
|
<Function name='SetRateScalingEnabled'/>
|
||||||
|
<Function name='GetRateScalingEnabled'/>
|
||||||
</Class>
|
</Class>
|
||||||
<Class base='Actor' name='ActorFrame'>
|
<Class base='Actor' name='ActorFrame'>
|
||||||
<Function name='AddChildFromPath'/>
|
<Function name='AddChildFromPath'/>
|
||||||
|
|||||||
@@ -1641,6 +1641,12 @@ end
|
|||||||
<Function name='zwrite' return='void' arguments='bool bWrite'>
|
<Function name='zwrite' return='void' arguments='bool bWrite'>
|
||||||
Sets z writing to <code>true</code> or <code>false</code> based on <code>bWrite</code>.
|
Sets z writing to <code>true</code> or <code>false</code> based on <code>bWrite</code>.
|
||||||
</Function>
|
</Function>
|
||||||
|
<Function name='SetRateScalingEnabled' return='void' arguments='bool b' since='ITGmania 1.0.0'>
|
||||||
|
Sets whether or not the actor should be affected by the system's rate scaling (i.e. Tab/Tiled).
|
||||||
|
</Function>
|
||||||
|
<Function name='GetRateScalingEnabled' return='bool' arguments='' since='ITGmania 1.0.0'>
|
||||||
|
Returns whether or not the actor is affected by the system's rate scaling.
|
||||||
|
</Function>
|
||||||
<!-- addons from scripts that come with sm-ssc (non-compat) -->
|
<!-- addons from scripts that come with sm-ssc (non-compat) -->
|
||||||
<Function name='bezier' theme='_fallback' return='' arguments='float time, table curve'>
|
<Function name='bezier' theme='_fallback' return='' arguments='float time, table curve'>
|
||||||
[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.
|
[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.
|
||||||
|
|||||||
+11
-4
@@ -170,7 +170,7 @@ Actor::Actor()
|
|||||||
m_FakeParent = nullptr;
|
m_FakeParent = nullptr;
|
||||||
m_bFirstUpdate = true;
|
m_bFirstUpdate = true;
|
||||||
m_tween_uses_effect_delta = false;
|
m_tween_uses_effect_delta = false;
|
||||||
tab_tilde_scaling_enabled_ = true;
|
rate_scaling_enabled_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Actor::~Actor()
|
Actor::~Actor()
|
||||||
@@ -876,7 +876,8 @@ void Actor::Update( float fDeltaTime )
|
|||||||
// LOG->Trace( "Actor::Update( %f )", fDeltaTime );
|
// LOG->Trace( "Actor::Update( %f )", fDeltaTime );
|
||||||
|
|
||||||
float rate = GameLoop::GetUpdateRate();
|
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) {
|
if (rate != 0) {
|
||||||
fDeltaTime *= (1 / rate);
|
fDeltaTime *= (1 / rate);
|
||||||
}
|
}
|
||||||
@@ -2010,10 +2011,13 @@ public:
|
|||||||
COMMON_RETURN_SELF;
|
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()
|
LunaActor()
|
||||||
{
|
{
|
||||||
ADD_METHOD( name );
|
ADD_METHOD( name );
|
||||||
ADD_METHOD( sleep );
|
ADD_METHOD( sleep );
|
||||||
ADD_METHOD( linear );
|
ADD_METHOD( linear );
|
||||||
ADD_METHOD( accelerate );
|
ADD_METHOD( accelerate );
|
||||||
ADD_METHOD( decelerate );
|
ADD_METHOD( decelerate );
|
||||||
@@ -2182,6 +2186,9 @@ public:
|
|||||||
ADD_METHOD( GetNumWrapperStates );
|
ADD_METHOD( GetNumWrapperStates );
|
||||||
ADD_METHOD( GetWrapperState );
|
ADD_METHOD( GetWrapperState );
|
||||||
|
|
||||||
|
ADD_METHOD( SetRateScalingEnabled );
|
||||||
|
ADD_METHOD( GetRateScalingEnabled );
|
||||||
|
|
||||||
ADD_METHOD( Draw );
|
ADD_METHOD( Draw );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+8
-6
@@ -622,6 +622,10 @@ public:
|
|||||||
virtual void SetUpdateRate( float ) {}
|
virtual void SetUpdateRate( float ) {}
|
||||||
virtual float GetUpdateRate() { return 1.0f; }
|
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<LuaClass> m_pLuaInstance;
|
HiddenPtr<LuaClass> m_pLuaInstance;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -714,9 +718,6 @@ protected:
|
|||||||
* follow the effect clock. Actor::Update must be called first. */
|
* follow the effect clock. Actor::Update must be called first. */
|
||||||
float GetEffectDeltaTime() const { return m_fEffectDelta; }
|
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
|
// todo: account for SSC_FUTURES by having these be vectors too -aj
|
||||||
RageColor m_effectColor1;
|
RageColor m_effectColor1;
|
||||||
RageColor m_effectColor2;
|
RageColor m_effectColor2;
|
||||||
@@ -756,9 +757,10 @@ protected:
|
|||||||
static std::vector<float> g_vfCurrentBGMBeatPlayerNoOffset;
|
static std::vector<float> g_vfCurrentBGMBeatPlayerNoOffset;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Some actors shouldn't be scaled with tab or tilde. This bool does not
|
// Some actors shouldn't be scaled by the engine i.e. using with tab for
|
||||||
// guard against holding both at the same time (setting the rate to zero).
|
// speeding up or tilde for slowing down.
|
||||||
bool tab_tilde_scaling_enabled_;
|
// In the case both are pressed (setting rate to 0), this bool does nothing.
|
||||||
|
bool rate_scaling_enabled_;
|
||||||
|
|
||||||
// commands
|
// commands
|
||||||
std::map<RString, apActorCommands> m_mapNameToCommands;
|
std::map<RString, apActorCommands> m_mapNameToCommands;
|
||||||
|
|||||||
+4
-1
@@ -25,7 +25,10 @@ Banner::Banner()
|
|||||||
{
|
{
|
||||||
m_bScrolling = false;
|
m_bScrolling = false;
|
||||||
m_fPercentScrolling = 0;
|
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.
|
// Ugly: if sIsBanner is false, we're actually loading something other than a banner.
|
||||||
|
|||||||
Reference in New Issue
Block a user