From 5f2d10f620bd4642065aa8fd2eea4ecdb2838dca Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 20 Mar 2007 07:43:47 +0000 Subject: [PATCH] EffectMode --- stepmania/src/Sprite.cpp | 10 ++++++++++ stepmania/src/Sprite.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index ce9b3b6cd8..bfa27dcf66 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -24,6 +24,7 @@ Sprite::Sprite() m_fSecsIntoState = 0.0f; m_bUsingCustomTexCoords = false; m_bSkipNextUpdate = false; + m_EffectMode = EffectMode_Normal; m_fRememberedClipWidth = -1; m_fRememberedClipHeight = -1; @@ -465,6 +466,7 @@ void Sprite::DrawTexture( const TweenState *state ) // Must call this after setting the texture or else texture // parameters have no effect. Actor::SetTextureRenderStates(); // set Actor-specified render states + DISPLAY->SetEffectMode( m_EffectMode ); if( m_pTexture ) { @@ -547,6 +549,7 @@ void Sprite::DrawTexture( const TweenState *state ) v[0].c = v[1].c = v[2].c = v[3].c = state->glow; DISPLAY->DrawQuad( v ); } + DISPLAY->SetEffectMode( EffectMode_Normal ); } bool Sprite::EarlyAbortDraw() const @@ -1003,6 +1006,12 @@ public: lua_pushnil( L ); return 1; } + static int SetEffectMode( T* p, lua_State *L ) + { + EffectMode em = Enum::Check(L, 1); + p->SetEffectMode( em ); + return 0; + } LunaSprite() { @@ -1019,6 +1028,7 @@ public: ADD_METHOD( GetAnimationLengthSeconds ); ADD_METHOD( SetTexture ); ADD_METHOD( GetTexture ); + ADD_METHOD( SetEffectMode ); } }; diff --git a/stepmania/src/Sprite.h b/stepmania/src/Sprite.h index 130c9995ec..eaffdc321a 100644 --- a/stepmania/src/Sprite.h +++ b/stepmania/src/Sprite.h @@ -55,6 +55,7 @@ public: void GetActiveTextureCoords(float fTexCoordsOut[8]) const; void StretchTexCoords( float fX, float fY ); void AddImageCoords( float fX, float fY ); // in image pixel space + void SetEffectMode( EffectMode em ) { m_EffectMode = em; } void SetTexCoordVelocity(float fVelX, float fVelY); // Scale the Sprite maintaining the aspect ratio so that it fits @@ -86,6 +87,7 @@ private: int m_iCurState; float m_fSecsIntoState; // number of seconds that have elapsed since we switched to this frame + EffectMode m_EffectMode; bool m_bUsingCustomTexCoords; bool m_bSkipNextUpdate; float m_CustomTexCoords[8]; // (x,y) * 4: top left, bottom left, bottom right, top right