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
+20 -2
View File
@@ -4,6 +4,24 @@ The StepMania 5 Changelog covers all post-sm-ssc changes. For a list of changes
from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt.
________________________________________________________________________________
2016/03/17
----------
* [Actor] Added get and set_tween_uses_effect_delta lua functions to make an
Actor use the effect clock for tweening. [kyzentun]
2016/03/15
----------
* [ProfileManager] Added GetStatsPrefix and SetStatsPrefix lua functions for
separating scores into different stats files. [kyzentun]
(this is kind of a stop gap, I'd really like to rewrite scoring to save
more data so that a score earned with one set of timing windows and weights
can be converted to the equivalent score with different timing windows)
2016/03/14
----------
* [Online] Stepmania will force disconnection from the SMO server when
entering the jukebox or sync calibration screens to avoid crash. [kyzentun]
2016/03/05
----------
* [global] get_sound_driver_list lua function added. [kyzentun]
@@ -31,8 +49,8 @@ ________________________________________________________________________________
the Windows minimaid driver that pkgingo wrote.
* [Gameplay] When checking for the first second in a song, AutoKeysound notes
are now ignored, being treated as if they were background music. This
allows the intro of BMS files to play as soon as ScreenGameplay is loaded,
while still having a delay before the real notes come in. [nixtrix]
allows the intro of BMS files to play as soon as ScreenGameplay is loaded,
while still having a delay before the real notes come in. [nixtrix]
2016/02/04
----------
+2
View File
@@ -386,6 +386,7 @@
<Function name='getaux'/>
<Function name='geteffectmagnitude'/>
<Function name='getrotation'/>
<Function name='get_tween_uses_effect_delta'/>
<Function name='glow'/>
<Function name='glowblink'/>
<Function name='glowramp'/>
@@ -418,6 +419,7 @@
<Function name='scaletofit'/>
<Function name='setsize'/>
<Function name='setstate'/>
<Function name='set_tween_uses_effect_delta'/>
<Function name='shadowcolor'/>
<Function name='shadowlength'/>
<Function name='shadowlengthx'/>
+6
View File
@@ -1225,6 +1225,9 @@ save yourself some time, copy this for undocumented things:
<Function name='GetZoomedWidth' return='float' arguments=''>
Returns the zoomed width of an Actor.
</Function>
<Function name='get_tween_uses_effect_delta' return='bool' arguments=''>
Returns true if this actor is currently set to use the effect delta for tweening.
</Function>
<Function name='glow' return='void' arguments='color c'>
Sets the Actor's glow color.
</Function>
@@ -1334,6 +1337,9 @@ save yourself some time, copy this for undocumented things:
<Function name='SetWidth' return='void' arguments='float width'>
Sets the width of the Actor.
</Function>
<Function name='set_tween_uses_effect_delta' return='' arguments='bool'>
Use this to make the actor use the effect clock to tween instead of using the global frame delta.
</Function>
<Function name='shadowcolor' return='void' arguments='color c'>
Sets the shadow's color to <code>c</code>.
</Function>
+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 );
+4
View File
@@ -281,10 +281,13 @@ public:
virtual void Update( float fDeltaTime ); // this can short circuit UpdateInternal
virtual void UpdateInternal( float fDeltaTime ); // override this
void UpdateTweening( float fDeltaTime );
void CalcPercentThroughTween();
// These next functions should all be overridden by a derived class that has its own tweening states to handle.
virtual void SetCurrentTweenStart() {}
virtual void EraseHeadTween() {}
virtual void UpdatePercentThroughTween( float PercentThroughTween ) {}
bool get_tween_uses_effect_delta() { return m_tween_uses_effect_delta; }
void set_tween_uses_effect_delta(bool t) { m_tween_uses_effect_delta= t; }
/**
* @brief Retrieve the Actor's name.
@@ -700,6 +703,7 @@ protected:
// -Kyz
float m_effect_period;
EffectClock m_EffectClock;
bool m_tween_uses_effect_delta;
/* This can be used in lieu of the fDeltaTime parameter to Update() to
* follow the effect clock. Actor::Update must be called first. */