diff --git a/stepmania/BackgroundEffects/Centered.xml b/stepmania/BackgroundEffects/Centered.xml index a45bd2ead0..e09bea83a7 100644 --- a/stepmania/BackgroundEffects/Centered.xml +++ b/stepmania/BackgroundEffects/Centered.xml @@ -1,6 +1,6 @@ diff --git a/stepmania/BackgroundEffects/Checkerboard1File2x2.xml b/stepmania/BackgroundEffects/Checkerboard1File2x2.xml index 5cd523c6c3..06a21844d3 100644 --- a/stepmania/BackgroundEffects/Checkerboard1File2x2.xml +++ b/stepmania/BackgroundEffects/Checkerboard1File2x2.xml @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/stepmania/BackgroundEffects/Checkerboard2File2x2.xml b/stepmania/BackgroundEffects/Checkerboard2File2x2.xml index cf5166736f..9c7a813ebe 100644 --- a/stepmania/BackgroundEffects/Checkerboard2File2x2.xml +++ b/stepmania/BackgroundEffects/Checkerboard2File2x2.xml @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/stepmania/BackgroundEffects/Kaleidoscope2x2.xml b/stepmania/BackgroundEffects/Kaleidoscope2x2.xml index 7ea1a448fa..816b892e3a 100644 --- a/stepmania/BackgroundEffects/Kaleidoscope2x2.xml +++ b/stepmania/BackgroundEffects/Kaleidoscope2x2.xml @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/stepmania/BackgroundEffects/SongBgWithMovieViz.xml b/stepmania/BackgroundEffects/SongBgWithMovieViz.xml index c97a8d56b0..9c6e73dc03 100644 --- a/stepmania/BackgroundEffects/SongBgWithMovieViz.xml +++ b/stepmania/BackgroundEffects/SongBgWithMovieViz.xml @@ -1,12 +1,12 @@ diff --git a/stepmania/BackgroundEffects/StretchNormal.xml b/stepmania/BackgroundEffects/StretchNormal.xml index 8d7c33e0bf..cba83ccb92 100644 --- a/stepmania/BackgroundEffects/StretchNormal.xml +++ b/stepmania/BackgroundEffects/StretchNormal.xml @@ -1,7 +1,7 @@ diff --git a/stepmania/BackgroundEffects/StretchRewind.xml b/stepmania/BackgroundEffects/StretchRewind.xml index de63c4916c..4efbc39dcd 100644 --- a/stepmania/BackgroundEffects/StretchRewind.xml +++ b/stepmania/BackgroundEffects/StretchRewind.xml @@ -1,6 +1,6 @@ diff --git a/stepmania/BackgroundEffects/UpperLeft.xml b/stepmania/BackgroundEffects/UpperLeft.xml index 8d722fd3b4..eff65f7fbd 100644 --- a/stepmania/BackgroundEffects/UpperLeft.xml +++ b/stepmania/BackgroundEffects/UpperLeft.xml @@ -1,4 +1,4 @@ - + diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index acb8ee91bd..388ec76965 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -295,12 +295,13 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun vector vsResolved; vsResolved.resize( vsToResolve.size() ); + vector vsResolvedRef; + vsResolvedRef.resize( vsToResolve.size() ); + for( unsigned i=0; iUnsetGlobal( ssprintf("File%d",i+1) ); // clear - if( sToResolve.empty() ) { if( i == 0 ) @@ -341,7 +342,7 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun ASSERT( !sResolved.empty() ); - LUA->SetGlobal( ssprintf("File%d",i+1), sResolved ); + vsResolvedRef[i] = new LuaThreadVariable( ssprintf("File%d",i+1), sResolved ); } RString sEffect = bd.m_sEffect; @@ -369,8 +370,8 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun // Set Lua color globals - LUA->SetGlobal( "Color1", bd.m_sColor1.empty() ? RString("1,1,1,1") : bd.m_sColor1 ); - LUA->SetGlobal( "Color2", bd.m_sColor2.empty() ? RString("1,1,1,1") : bd.m_sColor2 ); + LuaThreadVariable sColor1( "Color1", bd.m_sColor1.empty() ? RString("1,1,1,1") : bd.m_sColor1 ); + LuaThreadVariable sColor2( "Color2", bd.m_sColor2.empty() ? RString("1,1,1,1") : bd.m_sColor2 ); // Resolve the effect file. @@ -403,10 +404,8 @@ bool BackgroundImpl::Layer::CreateBackground( const Song *pSong, const Backgroun ASSERT( pActor ); m_BGAnimations[bd] = pActor; - for( unsigned i=0; iUnsetGlobal( ssprintf("File%d",i+1) ); - LUA->UnsetGlobal( "Color1" ); - LUA->UnsetGlobal( "Color2" ); + for( unsigned i=0; iSetUpdateRate( change.m_fRate ); - // Set Lua color globals before calling Init and On - LUA->SetGlobal( "Color1", change.m_def.m_sColor1.empty() ? RString("1,1,1,1") : change.m_def.m_sColor1 ); - LUA->SetGlobal( "Color2", change.m_def.m_sColor2.empty() ? RString("1,1,1,1") : change.m_def.m_sColor2 ); - m_pCurrentBGA->InitState(); m_pCurrentBGA->PlayCommand( "On" ); m_pCurrentBGA->PlayCommand( "GainFocus" ); - LUA->UnsetGlobal( "Color1" ); - LUA->UnsetGlobal( "Color2" ); - /* How much time of this BGA have we skipped? (This happens with SetSeconds.) */ const float fStartSecond = pSong->m_Timing.GetElapsedTimeFromBeat( change.m_fStartBeat ); diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index 7d4ec21fa3..f957ea0c10 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -124,9 +124,10 @@ namespace ScreenManagerUtil g_ScreenStack.push_back( ls ); /* Set the name of the loading screen. */ - LUA->SetGlobal( "LoadingScreen", ls.m_pScreen->GetName() ); - ls.m_pScreen->BeginScreen(); - LUA->UnsetGlobal( "LoadingScreen" ); + { + LuaThreadVariable var( "LoadingScreen", ls.m_pScreen->GetName() ); + ls.m_pScreen->BeginScreen(); + } SCREENMAN->RefreshCreditsMessages();