From 02d863397a1dc361b26f316b16b7648af7585d85 Mon Sep 17 00:00:00 2001 From: MrThatKid Date: Tue, 29 Nov 2016 18:00:39 -0800 Subject: [PATCH] Don't use static temp state for actor effects because actors are nested --- src/Actor.cpp | 75 +++++++++++++++++++++++++-------------------------- src/Actor.h | 1 + 2 files changed, 37 insertions(+), 39 deletions(-) diff --git a/src/Actor.cpp b/src/Actor.cpp index 52dfa4507b..a2623b02f6 100644 --- a/src/Actor.cpp +++ b/src/Actor.cpp @@ -425,17 +425,14 @@ void Actor::PreDraw() // calculate actor properties // Somthing below may set m_pTempState to tempState m_pTempState = &m_current; - // set temporary drawing properties based on Effects - static TweenState tempState; - // todo: account for SSC_FUTURES -aj if( m_Effect == no_effect ) { } else { - m_pTempState = &tempState; - tempState = m_current; + m_pTempState= & m_current_with_effects; + m_current_with_effects= m_current; const float fTotalPeriod = GetEffectPeriod(); ASSERT( fTotalPeriod > 0 ); @@ -474,77 +471,77 @@ void Actor::PreDraw() // calculate actor properties float fPercentBetweenColors = RageFastSin( (fPercentThroughEffect + 0.25f) * 2 * PI ) / 2 + 0.5f; ASSERT_M( fPercentBetweenColors >= 0 && fPercentBetweenColors <= 1, ssprintf("PercentBetweenColors: %f, PercentThroughEffect: %f", fPercentBetweenColors, fPercentThroughEffect) ); - float fOriginalAlpha = tempState.diffuse[0].a; + float fOriginalAlpha = m_current_with_effects.diffuse[0].a; // todo: account for SSC_FUTURES -aj switch( m_Effect ) { case diffuse_blink: - /* XXX: Should diffuse_blink and diffuse_shift multiply the tempState color? + /* XXX: Should diffuse_blink and diffuse_shift multiply the m_current_with_effects color? * (That would have the same effect with 1,1,1,1, and allow tweening the diffuse * while blinking and shifting.) */ for(int i=0; i 0 ) { - if( m_pTempState != &tempState ) + if( m_pTempState != &m_current_with_effects ) { - m_pTempState = &tempState; - tempState = m_current; + m_pTempState = &m_current_with_effects; + m_current_with_effects = m_current; } // Blend using Screen mode - tempState.glow = tempState.glow + m_internalGlow - m_internalGlow * tempState.glow; + m_current_with_effects.glow = m_current_with_effects.glow + m_internalGlow - m_internalGlow * m_current_with_effects.glow; } } diff --git a/src/Actor.h b/src/Actor.h index 08bac90682..570ca59dc0 100644 --- a/src/Actor.h +++ b/src/Actor.h @@ -660,6 +660,7 @@ protected: RageVector2 m_size; TweenState m_current; TweenState m_start; + TweenState m_current_with_effects; struct TweenStateAndInfo { TweenState state;