diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 469de4bdcf..b8a328519c 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -25,6 +25,19 @@ LUA_REGISTER_CLASS( Actor ) float Actor::g_fCurrentBGMTime = 0, Actor::g_fCurrentBGMBeat; +static float g_bCabinetLights[NUM_CABINET_LIGHTS]; + +void Actor::SetBGMTime( float fTime, float fBeat ) +{ + g_fCurrentBGMTime = fTime; + g_fCurrentBGMBeat = fBeat; +} + +void Actor::SetBGMLights( const float *bCabinetLights ) +{ + memcpy( g_bCabinetLights, bCabinetLights, sizeof(float) * NUM_CABINET_LIGHTS ); +} + /* This is Reset instead of Init since many derived classes have Init() functions * that shouldn't change the position of the actor. */ void Actor::Reset() @@ -476,6 +489,14 @@ void Actor::Update( float fDeltaTime ) m_fEffectDelta = g_fCurrentBGMTime - m_fSecsIntoEffect; m_fSecsIntoEffect = g_fCurrentBGMTime; break; + default: + if( m_EffectClock >= CLOCK_LIGHT_1 && m_EffectClock <= CLOCK_LIGHT_LAST ) + { + int i = m_EffectClock - CLOCK_LIGHT_1; + m_fEffectDelta = g_bCabinetLights[i] - m_fSecsIntoEffect; + m_fSecsIntoEffect = g_bCabinetLights[i]; + } + break; } // update effect @@ -609,7 +630,17 @@ void Actor::SetEffectClockString( const CString &s ) else if(s.CompareNoCase("beat")==0) this->SetEffectClock( CLOCK_BGM_BEAT ); else if(s.CompareNoCase("music")==0) this->SetEffectClock( CLOCK_BGM_TIME ); else if(s.CompareNoCase("bgm")==0) this->SetEffectClock( CLOCK_BGM_BEAT ); // compat, deprecated - else ASSERT(0); + else + { + CabinetLight cl = StringToCabinetLight( s ); + if( cl != LIGHT_INVALID ) + { + this->SetEffectClock( (EffectClock) (cl + CLOCK_LIGHT_1) ); + return; + } + else + ASSERT(0); + } } void Actor::StretchTo( const RectF &r ) diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 0c83afeeb3..f79a05f30f 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -31,7 +31,8 @@ public: virtual void Reset(); void LoadFromNode( const CString& sDir, const XNode* pNode ); - static void SetBGMTime( float fTime, float fBeat ) { g_fCurrentBGMTime = fTime; g_fCurrentBGMBeat = fBeat; } + static void SetBGMTime( float fTime, float fBeat ); + static void SetBGMLights( const float *abCabinetLights ); enum TweenType { TWEEN_LINEAR, @@ -66,7 +67,15 @@ public: static void MakeWeightedAverage( TweenState& average_out, const TweenState& ts1, const TweenState& ts2, float fPercentBetween ); }; - enum EffectClock { CLOCK_TIMER, CLOCK_BGM_TIME, CLOCK_BGM_BEAT, NUM_CLOCKS }; + enum EffectClock + { + CLOCK_TIMER, + CLOCK_BGM_TIME, + CLOCK_BGM_BEAT, + CLOCK_LIGHT_1 = 1000, + CLOCK_LIGHT_LAST = 1100, + NUM_CLOCKS + }; void Draw(); // calls, NeedsDraw, BeginDraw, DrawPrimitives, EndDraw virtual bool EarlyAbortDraw() { return false; } // return true to early abort drawing of this Actor @@ -448,6 +457,7 @@ protected: // static float g_fCurrentBGMTime, g_fCurrentBGMBeat; +private: // // commands //