diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index cbeea90896..a4ad8880e5 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -83,12 +83,8 @@ void ActorFrame::LoadFromNode( const RString& sDir, const XNode* pNode ) pNode->GetAttrValue( "UpdateRate", m_fUpdateRate ); pNode->GetAttrValue( "FOV", m_fFOV ); - - RString s; - if( pNode->GetAttrValue( "VanishX", s ) ) - m_fVanishX = LuaHelpers::RunExpressionF( s ); - if( pNode->GetAttrValue( "VanishY", s ) ) - m_fVanishY = LuaHelpers::RunExpressionF( s ); + pNode->GetAttrValue( "VanishX", m_fVanishX ); + pNode->GetAttrValue( "VanishY", m_fVanishY ); m_bOverrideLighting = pNode->GetAttrValue( "Lighting", m_bLighting ); } diff --git a/stepmania/src/ActorUtil.cpp b/stepmania/src/ActorUtil.cpp index 82cfcfa6cc..a90e4875dd 100644 --- a/stepmania/src/ActorUtil.cpp +++ b/stepmania/src/ActorUtil.cpp @@ -180,12 +180,9 @@ Actor* ActorUtil::LoadFromNode( const RString& sDir, const XNode* pNode, Actor * ASSERT( pNode ); { - RString expr; - if( pNode->GetAttrValue("Condition",expr) ) - { - if( !LuaHelpers::RunExpressionB(expr) ) - return NULL; - } + bool bCond; + if( pNode->GetAttrValue("Condition", bCond) && !bCond ) + return NULL; } // Load Params diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index e4c1724ef5..bd54b69772 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -52,12 +52,9 @@ void BGAnimation::AddLayersFromAniDir( const RString &_sAniDir, const XNode *pNo RString sImportDir; if( pKey->GetAttrValue("Import", sImportDir) ) { - RString expr; - if( pKey->GetAttrValue("Condition",expr) ) - { - if( !LuaHelpers::RunExpressionB( expr ) ) - continue; - } + bool bCond; + if( pKey->GetAttrValue("Condition",bCond) && !bCond ) + continue; // import a whole BGAnimation sImportDir = sAniDir + sImportDir; diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index 6c7a9b747e..bfc2722470 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -370,12 +370,9 @@ void BGAnimationLayer::LoadFromNode( const RString& sDir, const XNode* pNode ) CHECKPOINT_M( ssprintf( "BGAnimationLayer::LoadFromIni \"%s\"", sAniDir.c_str() ) ); { - RString expr; - if( pNode->GetAttrValue("Condition", expr) ) - { - if( !LuaHelpers::RunExpressionB(expr) ) - return; - } + bool bCond; + if( pNode->GetAttrValue("Condition", bCond) && !bCond ) + return; } bool bStretch = false; diff --git a/stepmania/src/LuaManager.cpp b/stepmania/src/LuaManager.cpp index 8242ed5111..48acb66f00 100644 --- a/stepmania/src/LuaManager.cpp +++ b/stepmania/src/LuaManager.cpp @@ -544,11 +544,6 @@ float LuaHelpers::RunExpressionF( const RString &str ) return result; } -int LuaHelpers::RunExpressionI( const RString &str ) -{ - return (int) LuaHelpers::RunExpressionF(str); -} - void LuaHelpers::RunExpressionS( const RString &str, RString &sOut ) { Lua *L = LUA->Get(); diff --git a/stepmania/src/LuaManager.h b/stepmania/src/LuaManager.h index 7725e82be2..f1d8b102d7 100644 --- a/stepmania/src/LuaManager.h +++ b/stepmania/src/LuaManager.h @@ -70,7 +70,6 @@ namespace LuaHelpers /* Run an expression in the global environment, returning the given type. */ bool RunExpressionB( const RString &str ); float RunExpressionF( const RString &str ); - int RunExpressionI( const RString &str ); void RunExpressionS( const RString &str, RString &sOut ); /* If sStr begins with @, evaluate the rest as an expression and store the result over sStr. */ diff --git a/stepmania/src/PaneDisplay.cpp b/stepmania/src/PaneDisplay.cpp index 9a9744deca..a5a5069232 100644 --- a/stepmania/src/PaneDisplay.cpp +++ b/stepmania/src/PaneDisplay.cpp @@ -110,10 +110,12 @@ void PaneDisplay::LoadFromNode( const RString &sDir, const XNode *pNode ) b = pNode->GetAttrValue( "MetricsGroup", sMetricsGroup ); ASSERT( b ); - RString sPlayerNumber; - b = pNode->GetAttrValue( "PlayerNumber", sPlayerNumber ); + Lua *L = LUA->Get(); + b = pNode->PushAttrValue( L, "PlayerNumber" ); ASSERT( b ); - PlayerNumber pn = (PlayerNumber) LuaHelpers::RunExpressionI(sPlayerNumber); + PlayerNumber pn; + LuaHelpers::Pop( L, pn ); + LUA->Release( L ); Load( sMetricsGroup, pn ); diff --git a/stepmania/src/RollingNumbers.cpp b/stepmania/src/RollingNumbers.cpp index 11cd4f0fc7..0c6807cc32 100644 --- a/stepmania/src/RollingNumbers.cpp +++ b/stepmania/src/RollingNumbers.cpp @@ -25,12 +25,9 @@ void RollingNumbers::LoadFromNode( const RString& sDir, const XNode* pNode ) ThemeManager::EvaluateString( m_sFormat ); pNode->GetAttrValue( "ApproachSeconds", m_fApproachSeconds ); - RString sTargetNumber; - if( pNode->GetAttrValue( "TargetNumber", sTargetNumber ) ) - { - float fTargetNumber = LuaHelpers::RunExpressionF(sTargetNumber); + float fTargetNumber; + if( pNode->GetAttrValue( "TargetNumber", fTargetNumber ) ) SetTargetNumber( fTargetNumber ); - } UpdateText(); } diff --git a/stepmania/src/ScoreDisplayAliveTime.cpp b/stepmania/src/ScoreDisplayAliveTime.cpp index 307cfe4c1c..26dbc1ab5d 100644 --- a/stepmania/src/ScoreDisplayAliveTime.cpp +++ b/stepmania/src/ScoreDisplayAliveTime.cpp @@ -25,10 +25,11 @@ void ScoreDisplayAliveTime::LoadFromNode( const RString& sDir, const XNode* pNod BitmapText::LoadFromNode( sDir, pNode ); { - RString sPlayerNumber; - bool b = pNode->GetAttrValue( "PlayerNumber", sPlayerNumber ); + Lua *L = LUA->Get(); + bool b = pNode->PushAttrValue( L, "PlayerNumber" ); ASSERT( b ); - m_PlayerNumber = (PlayerNumber) LuaHelpers::RunExpressionI(sPlayerNumber); + LuaHelpers::Pop( L, m_PlayerNumber ); + LUA->Release( L ); } } diff --git a/stepmania/src/ScoreDisplayCalories.cpp b/stepmania/src/ScoreDisplayCalories.cpp index 61be18cea1..424531eae0 100644 --- a/stepmania/src/ScoreDisplayCalories.cpp +++ b/stepmania/src/ScoreDisplayCalories.cpp @@ -27,10 +27,11 @@ void ScoreDisplayCalories::LoadFromNode( const RString& sDir, const XNode* pNode RollingNumbers::LoadFromNode( sDir, pNode ); { - RString sPlayerNumber; - bool b = pNode->GetAttrValue( "PlayerNumber", sPlayerNumber ); + Lua *L = LUA->Get(); + bool b = pNode->PushAttrValue( L, "PlayerNumber" ); ASSERT( b ); - m_PlayerNumber = (PlayerNumber) LuaHelpers::RunExpressionI(sPlayerNumber); + LuaHelpers::Pop( L, m_PlayerNumber ); + LUA->Release( L ); } m_sMessageOnStep = ssprintf("StepP%d",m_PlayerNumber+1);