From 01d59d97cef069943c9e9fe84bedbd66fa9ab01a Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 30 Apr 2005 07:48:10 +0000 Subject: [PATCH] add base alpha --- stepmania/src/Actor.cpp | 18 +++++++++++++++++- stepmania/src/Actor.h | 4 ++++ stepmania/src/ActorFrame.cpp | 11 +++++++++-- stepmania/src/ActorFrame.h | 1 + 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index e072f7d0d0..5e718058bb 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -49,6 +49,7 @@ void Actor::Reset() m_baseRotation = RageVector3( 0, 0, 0 ); m_baseScale = RageVector3( 1, 1, 1 ); + m_fBaseAlpha = 1; m_start.Init(); m_current.Init(); @@ -177,6 +178,8 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties { DISPLAY->PushMatrix(); // we're actually going to do some drawing in this function + // Somthing below may set m_pTempState to m_tempState + m_pTempState = &m_current; // @@ -184,7 +187,6 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties // if( m_Effect == no_effect ) { - m_pTempState = &m_current; } else if( m_Effect == effect_lua ) { @@ -318,6 +320,20 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties } } + + if( m_fBaseAlpha != 1 ) + { + if( m_pTempState != &m_tempState ) + { + m_pTempState = &m_tempState; + m_tempState = m_current; + } + + for( int i=0; i<4; i++ ) + m_tempState.diffuse[i].a *= m_fBaseAlpha; + } + + { RageMatrix m; RageMatrixTranslateAndScale( &m, diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 8c43b67c24..60947c5f69 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -136,6 +136,7 @@ public: void SetWidth( float width ) { m_size.x = width; } void SetHeight( float height ) { m_size.y = height; } + // Base float GetBaseZoomX() { return m_baseScale.x; } void SetBaseZoomX( float zoom ) { m_baseScale.x = zoom; } void SetBaseZoomY( float zoom ) { m_baseScale.y = zoom; } @@ -145,6 +146,8 @@ public: void SetBaseRotationY( float rot ) { m_baseRotation.y = rot; } void SetBaseRotationZ( float rot ) { m_baseRotation.z = rot; } void SetBaseRotation( const RageVector3 &rot ) { m_baseRotation = rot; } + virtual void SetBaseAlpha( float fAlpha ) { m_fBaseAlpha = fAlpha; } + float GetZoom() { return DestTweenState().scale.x; } // not accurate in some cases float GetZoomX() { return DestTweenState().scale.x; } @@ -384,6 +387,7 @@ protected: RageVector3 m_baseRotation; RageVector3 m_baseScale; + float m_fBaseAlpha; RageVector2 m_size; diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index 040925d3c9..f8ac72416a 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -222,12 +222,19 @@ PropagateActorFrameCommand( HurryTweening, float ) void ActorFrame::SetDiffuseAlpha( float f ) { Actor::SetDiffuseAlpha( f ); - - /* set all sub-Actors */ + for( unsigned i=0; iSetDiffuseAlpha( f ); } +void ActorFrame::SetBaseAlpha( float f ) +{ + Actor::SetBaseAlpha( f ); + + for( unsigned i=0; iSetBaseAlpha( f ); +} + void ActorFrame::FinishTweening() { Actor::FinishTweening(); diff --git a/stepmania/src/ActorFrame.h b/stepmania/src/ActorFrame.h index 219643e32e..d2602fbb20 100644 --- a/stepmania/src/ActorFrame.h +++ b/stepmania/src/ActorFrame.h @@ -72,6 +72,7 @@ public: virtual void SetDiffuse( RageColor c ); virtual void SetDiffuseAlpha( float f ); + virtual void SetBaseAlpha( float f ); virtual void SetZTestMode( ZTestMode mode ); virtual void SetZWrite( bool b );