From 0244701281d8ca118f0ae0cd55e04c3a3dc7762d Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 11 Jan 2008 21:54:17 +0000 Subject: [PATCH] add control over ShadowLength X/Y and ShadowColor --- stepmania/src/Actor.cpp | 13 +++++++++++-- stepmania/src/Actor.h | 9 +++++++-- stepmania/src/BitmapText.cpp | 10 +++++----- stepmania/src/ScreenNetSelectBase.cpp | 11 +++++------ stepmania/src/Sprite.cpp | 8 +++++--- 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 177a518b03..414c09f266 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -100,7 +100,9 @@ void Actor::InitState() m_effectColor2 = RageColor(1,1,1,1); m_bVisible = true; - m_fShadowLength = 0; + m_fShadowLengthX = 0; + m_fShadowLengthY = 0; + m_ShadowColor = RageColor(0,0,0,0.5); m_bIsAnimating = true; m_fHibernateSecondsLeft = 0; m_iDrawOrder = 0; @@ -198,7 +200,8 @@ Actor::Actor( const Actor &cpy ): CPY( m_bVisible ); CPY( m_fHibernateSecondsLeft ); - CPY( m_fShadowLength ); + CPY( m_fShadowLengthX ); + CPY( m_fShadowLengthY ); CPY( m_bIsAnimating ); CPY( m_iDrawOrder ); @@ -1318,6 +1321,9 @@ public: static int pitch( T* p, lua_State *L ) { p->AddRotationP(FArg(1)); return 0; } static int roll( T* p, lua_State *L ) { p->AddRotationR(FArg(1)); return 0; } static int shadowlength( T* p, lua_State *L ) { p->SetShadowLength(FArg(1)); return 0; } + static int shadowlengthx( T* p, lua_State *L ) { p->SetShadowLengthX(FArg(1)); return 0; } + static int shadowlengthy( T* p, lua_State *L ) { p->SetShadowLengthY(FArg(1)); return 0; } + static int shadowcolor( T* p, lua_State *L ) { RageColor c; c.FromStackCompat( L, 1 ); p->SetShadowColor( c ); return 0; } static int horizalign( T* p, lua_State *L ) { p->SetHorizAlign(Enum::Check(L, 1)); return 0; } static int vertalign( T* p, lua_State *L ) { p->SetVertAlign(Enum::Check(L, 1)); return 0; } static int halign( T* p, lua_State *L ) { p->SetHorizAlign(FArg(1)); return 0; } @@ -1519,6 +1525,9 @@ public: ADD_METHOD( pitch ); ADD_METHOD( roll ); ADD_METHOD( shadowlength ); + ADD_METHOD( shadowlengthx ); + ADD_METHOD( shadowlengthy ); + ADD_METHOD( shadowcolor ); ADD_METHOD( horizalign ); ADD_METHOD( vertalign ); ADD_METHOD( halign ); diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index e69517d012..3f11b5231c 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -321,7 +321,10 @@ public: // bool GetVisible() const { return m_bVisible; } void SetVisible( bool b ) { m_bVisible = b; } - void SetShadowLength( float fLength ) { m_fShadowLength = fLength; } + void SetShadowLength( float fLength ) { m_fShadowLengthX = fLength; m_fShadowLengthY = fLength; } + void SetShadowLengthX( float fLengthX ) { m_fShadowLengthX = fLengthX; } + void SetShadowLengthY( float fLengthY ) { m_fShadowLengthY = fLengthY; } + void SetShadowColor( RageColor c ) { m_ShadowColor = c; } // TODO: Implement hibernate as a tween type? void SetHibernate( float fSecs ) { m_fHibernateSecondsLeft = fSecs; } void SetDrawOrder( int iOrder ) { m_iDrawOrder = iOrder; } @@ -463,7 +466,9 @@ protected: bool m_bVisible; bool m_bIsAnimating; float m_fHibernateSecondsLeft; - float m_fShadowLength; // 0 == no shadow + float m_fShadowLengthX; + float m_fShadowLengthY; + RageColor m_ShadowColor; int m_iDrawOrder; // lower first // diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index dde97e9b61..17c9ec7ccf 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -528,15 +528,15 @@ void BitmapText::DrawPrimitives() // // render the shadow // - if( m_fShadowLength != 0 ) + if( m_fShadowLengthX != 0 || m_fShadowLengthY != 0 ) { DISPLAY->PushMatrix(); - DISPLAY->TranslateWorld( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units - - RageColor dim(0,0,0,0.5f*m_pTempState->diffuse[0].a); // semi-transparent black + DISPLAY->TranslateWorld( m_fShadowLengthX, m_fShadowLengthY, 0 ); // shift by 5 units + RageColor c = m_ShadowColor; + c.a *= m_pTempState->diffuse[0].a; for( unsigned i=0; iPopMatrix(); diff --git a/stepmania/src/ScreenNetSelectBase.cpp b/stepmania/src/ScreenNetSelectBase.cpp index b3a4af5208..809d6fd5d1 100644 --- a/stepmania/src/ScreenNetSelectBase.cpp +++ b/stepmania/src/ScreenNetSelectBase.cpp @@ -357,15 +357,14 @@ void ColorBitmapText::DrawPrimitives( ) // // render the shadow // - if( m_fShadowLength != 0 ) + if( m_fShadowLengthX != 0 || m_fShadowLengthY != 0 ) { DISPLAY->PushMatrix(); - DISPLAY->TranslateWorld( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units - - RageColor dim(0,0,0,0.5f*m_pTempState->diffuse[0].a); // semi-transparent black - + DISPLAY->TranslateWorld( m_fShadowLengthX, m_fShadowLengthY, 0 ); // shift by 5 units + RageColor c = m_ShadowColor; + c.a *= m_pTempState->diffuse[0].a; for( unsigned i=0; iPopMatrix(); diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index c11ca60ec6..836fa60683 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -529,11 +529,13 @@ void Sprite::DrawTexture( const TweenState *state ) ////////////////////// // render the shadow ////////////////////// - if( m_fShadowLength != 0 ) + if( m_fShadowLengthX != 0 || m_fShadowLengthY != 0 ) { DISPLAY->PushMatrix(); - DISPLAY->TranslateWorld( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units - v[0].c = v[1].c = v[2].c = v[3].c = RageColor( 0, 0, 0, 0.5f*state->diffuse[0].a ); // semi-transparent black + DISPLAY->TranslateWorld( m_fShadowLengthX, m_fShadowLengthY, 0 ); // shift by 5 units + RageColor c = m_ShadowColor; + c.a *= state->diffuse[0].a; + v[0].c = v[1].c = v[2].c = v[3].c = c; // semi-transparent black DISPLAY->DrawQuad( v ); DISPLAY->PopMatrix(); }