From d1b2a88a4e428506ab1b42d05c019e332e8cc05e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 1 Jan 2003 09:05:21 +0000 Subject: [PATCH] add TweenTime() --- stepmania/src/Actor.cpp | 10 +++++++++- stepmania/src/Actor.h | 5 ++--- stepmania/src/ActorFrame.cpp | 12 ++++++++++++ stepmania/src/ActorFrame.h | 3 +++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 35f3996c29..ae5857c329 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -48,7 +48,6 @@ Actor::Actor() } - void Actor::Draw() { // call the most-derived versions @@ -522,3 +521,12 @@ void Actor::Fade( float fSleepSeconds, CString sFadeString, float fFadeSeconds, LatestTween() = bOnToScreenOrOffOfScreen ? mod : original; } +float Actor::TweenTime() const +{ + float tot = 0; + + for(int i = 0; i < m_iNumTweenStates; ++i) + tot += m_TweenInfo[i].m_fTimeLeftInTween; + + return tot; +} diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index c946fc90f3..6128dfcda3 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -104,9 +104,9 @@ public: virtual void BeginTweening( float time, TweenType tt = TWEEN_LINEAR ); - // Tweening is now queued by default - // virtual void BeginTweening( float time, TweenType tt = TWEEN_LINEAR ); virtual void StopTweening(); + /* Amount of time until all tweens have stopped: */ + virtual float TweenTime() const; virtual void SetTweenX( float x ); virtual void SetTweenY( float y ); virtual void SetTweenZ( float z ); @@ -237,7 +237,6 @@ protected: int m_iNumTweenStates; TweenState& LatestTween() { ASSERT(m_iNumTweenStates>0 && m_iNumTweenStatesSetDiffuse(c ); } + +float ActorFrame::TweenTime() const +{ + float m = Actor::TweenTime(); + + for( unsigned i=0; iTweenTime()); + + return m; + +} + diff --git a/stepmania/src/ActorFrame.h b/stepmania/src/ActorFrame.h index 4f062cd88c..58003f5203 100644 --- a/stepmania/src/ActorFrame.h +++ b/stepmania/src/ActorFrame.h @@ -24,6 +24,9 @@ public: virtual void SetDiffuse( RageColor c ); + /* Amount of time until all tweens (and all children's tweens) have stopped: */ + virtual float TweenTime() const; + protected: CArray m_SubActors; };