Added flag for making an actor use the effect delta for tweening. Updated changelog.

This commit is contained in:
Kyzentun Keeslala
2016-03-17 19:37:27 -06:00
parent 89738c68c9
commit a4ecf15ce3
5 changed files with 56 additions and 8 deletions
+24 -6
View File
@@ -723,8 +723,25 @@ void Actor::EndDraw()
}
void Actor::CalcPercentThroughTween()
{
TweenState &TS = m_Tweens[0]->state;
TweenInfo &TI = m_Tweens[0]->info;
const float percent_through = 1-(TI.m_fTimeLeftInTween / TI.m_fTweenTime);
// distort the percentage if appropriate
float percent_along = TI.m_pTween->Tween(percent_through);
TweenState::MakeWeightedAverage(m_current, m_start, TS, percent_along);
UpdatePercentThroughTween(percent_along);
}
void Actor::UpdateTweening( float fDeltaTime )
{
if(fDeltaTime < 0.0 && !m_Tweens.empty())
{
m_Tweens[0]->info.m_fTimeLeftInTween-= fDeltaTime;
CalcPercentThroughTween();
return;
}
while( !m_Tweens.empty() // something to do
&& fDeltaTime > 0 ) // something will change
{
@@ -757,12 +774,7 @@ void Actor::UpdateTweening( float fDeltaTime )
}
else // in the middle of tweening. Recalcute the current position.
{
const float fPercentThroughTween = 1-(TI.m_fTimeLeftInTween / TI.m_fTweenTime);
// distort the percentage if appropriate
float fPercentAlongPath = TI.m_pTween->Tween( fPercentThroughTween );
TweenState::MakeWeightedAverage( m_current, m_start, TS, fPercentAlongPath );
UpdatePercentThroughTween(fPercentAlongPath);
CalcPercentThroughTween();
}
if( bBeginning )
@@ -884,6 +896,10 @@ void Actor::UpdateInternal(float delta_time)
default: break;
}
if(m_tween_uses_effect_delta)
{
delta_time= m_fEffectDelta;
}
this->UpdateTweening(delta_time);
}
@@ -1739,6 +1755,7 @@ public:
static int effectclock( T* p, lua_State *L ) { p->SetEffectClockString(SArg(1)); COMMON_RETURN_SELF; }
static int effectmagnitude( T* p, lua_State *L ) { p->SetEffectMagnitude( RageVector3(FArg(1),FArg(2),FArg(3)) ); COMMON_RETURN_SELF; }
static int geteffectmagnitude( T* p, lua_State *L ) { RageVector3 v = p->GetEffectMagnitude(); lua_pushnumber(L, v[0]); lua_pushnumber(L, v[1]); lua_pushnumber(L, v[2]); return 3; }
GETTER_SETTER_BOOL_METHOD(tween_uses_effect_delta);
static int scaletocover( T* p, lua_State *L ) { p->ScaleToCover( RectF(FArg(1), FArg(2), FArg(3), FArg(4)) ); COMMON_RETURN_SELF; }
static int scaletofit( T* p, lua_State *L ) { p->ScaleToFitInside( RectF(FArg(1), FArg(2), FArg(3), FArg(4)) ); COMMON_RETURN_SELF; }
static int animate( T* p, lua_State *L ) { p->EnableAnimation(BIArg(1)); COMMON_RETURN_SELF; }
@@ -2023,6 +2040,7 @@ public:
ADD_METHOD( effectclock );
ADD_METHOD( effectmagnitude );
ADD_METHOD( geteffectmagnitude );
ADD_GET_SET_METHODS(tween_uses_effect_delta);
ADD_METHOD( scaletocover );
ADD_METHOD( scaletofit );
ADD_METHOD( animate );