From 80447c36541ed18d9635d94328258552a6ad0240 Mon Sep 17 00:00:00 2001 From: sigatrev Date: Sat, 16 Aug 2014 10:55:14 -0500 Subject: [PATCH 1/2] Allow Update and Draw functions to be turned off allow nil to be passed as an argument to SetUpdateFunction and SetDrawFunction to turn off said functions. --- src/ActorFrame.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/ActorFrame.cpp b/src/ActorFrame.cpp index 845acd41eb..0660ff79d3 100644 --- a/src/ActorFrame.cpp +++ b/src/ActorFrame.cpp @@ -632,6 +632,15 @@ public: static int SetDrawByZPosition( T* p, lua_State *L ) { p->SetDrawByZPosition( BArg(1) ); return 1; } static int SetDrawFunction( T* p, lua_State *L ) { + if(lua_isnil(L,1)) + { + LuaReference ref; + lua_pushnil( L ); + ref.SetFromStack( L ); + p->SetDrawFunction( ref ); + return 0; + } + luaL_checktype( L, 1, LUA_TFUNCTION ); LuaReference ref; @@ -647,6 +656,15 @@ public: } static int SetUpdateFunction( T* p, lua_State *L ) { + if(lua_isnil(L,1)) + { + LuaReference ref; + lua_pushnil( L ); + ref.SetFromStack( L ); + p->SetUpdateFunction( ref ); + return 0; + } + luaL_checktype( L, 1, LUA_TFUNCTION ); LuaReference ref; From 02922aa5c026d74b5a33c22faf26be6a2c73af78 Mon Sep 17 00:00:00 2001 From: sigatrev Date: Sat, 16 Aug 2014 22:51:34 -0500 Subject: [PATCH 2/2] fix ActorFrame diffusing and glowing children When an ActorFrame's parent has a diffuse or glow, the ActorFrame uses the static tempState in Actor::PreDraw(); When the ActorFrame draw's it's children, those children also use tempState because their parent has a diffuse( making their internalDiffuse not 1,1,1,1 ). If any child is diffused it'll will change tempState, which will affect the internalDiffuse given to the next child, and so on. By determining the diffuse and glow to be passed to the children before drawing any of them, any changes to tempState will not affect the diffuse of subsequent children. --- src/ActorFrame.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ActorFrame.cpp b/src/ActorFrame.cpp index 0660ff79d3..a747ef73e4 100644 --- a/src/ActorFrame.cpp +++ b/src/ActorFrame.cpp @@ -248,6 +248,9 @@ void ActorFrame::DrawPrimitives() return; } + RageColor diffuse = m_pTempState->diffuse[0]; + RageColor glow = m_pTempState->glow; + // draw all sub-ActorFrames while we're in the ActorFrame's local coordinate space if( m_bDrawByZPosition ) { @@ -255,8 +258,8 @@ void ActorFrame::DrawPrimitives() ActorUtil::SortByZPosition( subs ); for( unsigned i=0; iSetInternalDiffuse(m_pTempState->diffuse[0]); - subs[i]->SetInternalGlow(m_pTempState->glow); + subs[i]->SetInternalDiffuse( diffuse ); + subs[i]->SetInternalGlow( glow ); subs[i]->Draw(); } } @@ -264,8 +267,8 @@ void ActorFrame::DrawPrimitives() { for( unsigned i=0; iSetInternalDiffuse(m_pTempState->diffuse[0]); - m_SubActors[i]->SetInternalGlow(m_pTempState->glow); + m_SubActors[i]->SetInternalDiffuse( diffuse ); + m_SubActors[i]->SetInternalGlow( glow ); m_SubActors[i]->Draw(); } }