From f94d3affc28b5cdb173734a6cec7de007a549f85 Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Tue, 28 May 2013 21:46:15 -0400 Subject: [PATCH] Propagate diffuse to ActorFrames' children --- src/Actor.cpp | 10 +++++++++- src/Actor.h | 2 ++ src/ActorFrame.cpp | 2 ++ src/OptionRow.cpp | 8 -------- src/OptionRow.h | 1 - src/ReceptorArrowRow.cpp | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/Actor.cpp b/src/Actor.cpp index 44c531ba2b..781fe776ae 100644 --- a/src/Actor.cpp +++ b/src/Actor.cpp @@ -91,6 +91,7 @@ void Actor::InitState() m_baseRotation = RageVector3( 0, 0, 0 ); m_baseScale = RageVector3( 1, 1, 1 ); m_fBaseAlpha = 1; + m_internalDiffuse = RageColor( 1, 1, 1, 1 ); m_internalGlow = RageColor( 0, 0, 0, 0 ); m_start.Init(); @@ -187,6 +188,7 @@ Actor::Actor( const Actor &cpy ): CPY( m_baseRotation ); CPY( m_baseScale ); CPY( m_fBaseAlpha ); + CPY( m_internalDiffuse ); CPY( m_internalGlow ); @@ -449,6 +451,9 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties } if( m_fBaseAlpha != 1 ) + m_internalDiffuse.a *= m_fBaseAlpha; + + if( m_internalDiffuse != RageColor(1, 1, 1, 1) ) { if( m_pTempState != &tempState ) { @@ -457,7 +462,10 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties } for( int i=0; i<4; i++ ) - tempState.diffuse[i].a *= m_fBaseAlpha; + { + tempState.diffuse[i] *= m_internalDiffuse; + } + m_internalDiffuse = RageColor(1, 1, 1, 1); } if( m_internalGlow.a > 0 ) diff --git a/src/Actor.h b/src/Actor.h index 629a8ba2d4..327c161efc 100644 --- a/src/Actor.h +++ b/src/Actor.h @@ -343,6 +343,7 @@ public: void SetBaseRotationZ( float rot ) { m_baseRotation.z = rot; } void SetBaseRotation( const RageVector3 &rot ) { m_baseRotation = rot; } virtual void SetBaseAlpha( float fAlpha ) { m_fBaseAlpha = fAlpha; } + void SetInternalDiffuse( const RageColor &c ) { m_internalDiffuse = c; } void SetInternalGlow( const RageColor &c ) { m_internalGlow = c; } /** @@ -637,6 +638,7 @@ protected: RageVector3 m_baseRotation; RageVector3 m_baseScale; float m_fBaseAlpha; + RageColor m_internalDiffuse; RageColor m_internalGlow; RageVector2 m_size; diff --git a/src/ActorFrame.cpp b/src/ActorFrame.cpp index 2c85749365..01340837f2 100644 --- a/src/ActorFrame.cpp +++ b/src/ActorFrame.cpp @@ -248,6 +248,7 @@ void ActorFrame::DrawPrimitives() ActorUtil::SortByZPosition( subs ); for( unsigned i=0; iSetInternalDiffuse(m_pTempState->diffuse[0]); subs[i]->SetInternalGlow(m_pTempState->glow); subs[i]->Draw(); } @@ -256,6 +257,7 @@ void ActorFrame::DrawPrimitives() { for( unsigned i=0; iSetInternalDiffuse(m_pTempState->diffuse[0]); m_SubActors[i]->SetInternalGlow(m_pTempState->glow); m_SubActors[i]->Draw(); } diff --git a/src/OptionRow.cpp b/src/OptionRow.cpp index f97c249206..7bc94053b9 100644 --- a/src/OptionRow.cpp +++ b/src/OptionRow.cpp @@ -636,14 +636,6 @@ void OptionRow::UpdateEnabledDisabled() } } -void OptionRow::Update( float fDeltaTime ) -{ - ActorFrame::Update( fDeltaTime ); - - float fAlpha = m_Frame.GetCurrentDiffuseAlpha(); - m_Frame.SetBaseAlpha( fAlpha ); -} - void OptionRow::SetModIcon( PlayerNumber pn, const RString &sText, GameCommand &gc ) { // update row frame diff --git a/src/OptionRow.h b/src/OptionRow.h index 6ca653f88e..c7e2817c95 100644 --- a/src/OptionRow.h +++ b/src/OptionRow.h @@ -55,7 +55,6 @@ class OptionRow : public ActorFrame public: OptionRow( const OptionRowType *pType ); ~OptionRow(); - void Update( float fDeltaTime ); void Clear(); void LoadNormal( OptionRowHandler *pHand, bool bFirstItemGoesDown ); diff --git a/src/ReceptorArrowRow.cpp b/src/ReceptorArrowRow.cpp index 276c63eb90..e903cd7dfa 100644 --- a/src/ReceptorArrowRow.cpp +++ b/src/ReceptorArrowRow.cpp @@ -46,7 +46,7 @@ void ReceptorArrowRow::Update( float fDeltaTime ) // m_fDark==1 or m_fFadeToFailPercent==1 should make fBaseAlpha==0 float fBaseAlpha = (1 - m_pPlayerState->m_PlayerOptions.GetCurrent().m_fDark) * (1 - m_fFadeToFailPercent); CLAMP( fBaseAlpha, 0.0f, 1.0f ); - m_ReceptorArrow[c]->SetBaseAlpha( fBaseAlpha ); + SetBaseAlpha( fBaseAlpha ); // set arrow XYZ float fX = ArrowEffects::GetXPos( m_pPlayerState, c, 0 );