evaluate enums directly
This commit is contained in:
@@ -83,12 +83,8 @@ void ActorFrame::LoadFromNode( const RString& sDir, const XNode* pNode )
|
|||||||
|
|
||||||
pNode->GetAttrValue( "UpdateRate", m_fUpdateRate );
|
pNode->GetAttrValue( "UpdateRate", m_fUpdateRate );
|
||||||
pNode->GetAttrValue( "FOV", m_fFOV );
|
pNode->GetAttrValue( "FOV", m_fFOV );
|
||||||
|
pNode->GetAttrValue( "VanishX", m_fVanishX );
|
||||||
RString s;
|
pNode->GetAttrValue( "VanishY", m_fVanishY );
|
||||||
if( pNode->GetAttrValue( "VanishX", s ) )
|
|
||||||
m_fVanishX = LuaHelpers::RunExpressionF( s );
|
|
||||||
if( pNode->GetAttrValue( "VanishY", s ) )
|
|
||||||
m_fVanishY = LuaHelpers::RunExpressionF( s );
|
|
||||||
m_bOverrideLighting = pNode->GetAttrValue( "Lighting", m_bLighting );
|
m_bOverrideLighting = pNode->GetAttrValue( "Lighting", m_bLighting );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -180,12 +180,9 @@ Actor* ActorUtil::LoadFromNode( const RString& sDir, const XNode* pNode, Actor *
|
|||||||
ASSERT( pNode );
|
ASSERT( pNode );
|
||||||
|
|
||||||
{
|
{
|
||||||
RString expr;
|
bool bCond;
|
||||||
if( pNode->GetAttrValue("Condition",expr) )
|
if( pNode->GetAttrValue("Condition", bCond) && !bCond )
|
||||||
{
|
return NULL;
|
||||||
if( !LuaHelpers::RunExpressionB(expr) )
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load Params
|
// Load Params
|
||||||
|
|||||||
@@ -52,12 +52,9 @@ void BGAnimation::AddLayersFromAniDir( const RString &_sAniDir, const XNode *pNo
|
|||||||
RString sImportDir;
|
RString sImportDir;
|
||||||
if( pKey->GetAttrValue("Import", sImportDir) )
|
if( pKey->GetAttrValue("Import", sImportDir) )
|
||||||
{
|
{
|
||||||
RString expr;
|
bool bCond;
|
||||||
if( pKey->GetAttrValue("Condition",expr) )
|
if( pKey->GetAttrValue("Condition",bCond) && !bCond )
|
||||||
{
|
continue;
|
||||||
if( !LuaHelpers::RunExpressionB( expr ) )
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// import a whole BGAnimation
|
// import a whole BGAnimation
|
||||||
sImportDir = sAniDir + sImportDir;
|
sImportDir = sAniDir + sImportDir;
|
||||||
|
|||||||
@@ -370,12 +370,9 @@ void BGAnimationLayer::LoadFromNode( const RString& sDir, const XNode* pNode )
|
|||||||
CHECKPOINT_M( ssprintf( "BGAnimationLayer::LoadFromIni \"%s\"", sAniDir.c_str() ) );
|
CHECKPOINT_M( ssprintf( "BGAnimationLayer::LoadFromIni \"%s\"", sAniDir.c_str() ) );
|
||||||
|
|
||||||
{
|
{
|
||||||
RString expr;
|
bool bCond;
|
||||||
if( pNode->GetAttrValue("Condition", expr) )
|
if( pNode->GetAttrValue("Condition", bCond) && !bCond )
|
||||||
{
|
return;
|
||||||
if( !LuaHelpers::RunExpressionB(expr) )
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bStretch = false;
|
bool bStretch = false;
|
||||||
|
|||||||
@@ -544,11 +544,6 @@ float LuaHelpers::RunExpressionF( const RString &str )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LuaHelpers::RunExpressionI( const RString &str )
|
|
||||||
{
|
|
||||||
return (int) LuaHelpers::RunExpressionF(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LuaHelpers::RunExpressionS( const RString &str, RString &sOut )
|
void LuaHelpers::RunExpressionS( const RString &str, RString &sOut )
|
||||||
{
|
{
|
||||||
Lua *L = LUA->Get();
|
Lua *L = LUA->Get();
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ namespace LuaHelpers
|
|||||||
/* Run an expression in the global environment, returning the given type. */
|
/* Run an expression in the global environment, returning the given type. */
|
||||||
bool RunExpressionB( const RString &str );
|
bool RunExpressionB( const RString &str );
|
||||||
float RunExpressionF( const RString &str );
|
float RunExpressionF( const RString &str );
|
||||||
int RunExpressionI( const RString &str );
|
|
||||||
void RunExpressionS( const RString &str, RString &sOut );
|
void RunExpressionS( const RString &str, RString &sOut );
|
||||||
|
|
||||||
/* If sStr begins with @, evaluate the rest as an expression and store the result over sStr. */
|
/* If sStr begins with @, evaluate the rest as an expression and store the result over sStr. */
|
||||||
|
|||||||
@@ -110,10 +110,12 @@ void PaneDisplay::LoadFromNode( const RString &sDir, const XNode *pNode )
|
|||||||
b = pNode->GetAttrValue( "MetricsGroup", sMetricsGroup );
|
b = pNode->GetAttrValue( "MetricsGroup", sMetricsGroup );
|
||||||
ASSERT( b );
|
ASSERT( b );
|
||||||
|
|
||||||
RString sPlayerNumber;
|
Lua *L = LUA->Get();
|
||||||
b = pNode->GetAttrValue( "PlayerNumber", sPlayerNumber );
|
b = pNode->PushAttrValue( L, "PlayerNumber" );
|
||||||
ASSERT( b );
|
ASSERT( b );
|
||||||
PlayerNumber pn = (PlayerNumber) LuaHelpers::RunExpressionI(sPlayerNumber);
|
PlayerNumber pn;
|
||||||
|
LuaHelpers::Pop( L, pn );
|
||||||
|
LUA->Release( L );
|
||||||
|
|
||||||
Load( sMetricsGroup, pn );
|
Load( sMetricsGroup, pn );
|
||||||
|
|
||||||
|
|||||||
@@ -25,12 +25,9 @@ void RollingNumbers::LoadFromNode( const RString& sDir, const XNode* pNode )
|
|||||||
ThemeManager::EvaluateString( m_sFormat );
|
ThemeManager::EvaluateString( m_sFormat );
|
||||||
pNode->GetAttrValue( "ApproachSeconds", m_fApproachSeconds );
|
pNode->GetAttrValue( "ApproachSeconds", m_fApproachSeconds );
|
||||||
|
|
||||||
RString sTargetNumber;
|
float fTargetNumber;
|
||||||
if( pNode->GetAttrValue( "TargetNumber", sTargetNumber ) )
|
if( pNode->GetAttrValue( "TargetNumber", fTargetNumber ) )
|
||||||
{
|
|
||||||
float fTargetNumber = LuaHelpers::RunExpressionF(sTargetNumber);
|
|
||||||
SetTargetNumber( fTargetNumber );
|
SetTargetNumber( fTargetNumber );
|
||||||
}
|
|
||||||
|
|
||||||
UpdateText();
|
UpdateText();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,11 @@ void ScoreDisplayAliveTime::LoadFromNode( const RString& sDir, const XNode* pNod
|
|||||||
BitmapText::LoadFromNode( sDir, pNode );
|
BitmapText::LoadFromNode( sDir, pNode );
|
||||||
|
|
||||||
{
|
{
|
||||||
RString sPlayerNumber;
|
Lua *L = LUA->Get();
|
||||||
bool b = pNode->GetAttrValue( "PlayerNumber", sPlayerNumber );
|
bool b = pNode->PushAttrValue( L, "PlayerNumber" );
|
||||||
ASSERT( b );
|
ASSERT( b );
|
||||||
m_PlayerNumber = (PlayerNumber) LuaHelpers::RunExpressionI(sPlayerNumber);
|
LuaHelpers::Pop( L, m_PlayerNumber );
|
||||||
|
LUA->Release( L );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,10 +27,11 @@ void ScoreDisplayCalories::LoadFromNode( const RString& sDir, const XNode* pNode
|
|||||||
RollingNumbers::LoadFromNode( sDir, pNode );
|
RollingNumbers::LoadFromNode( sDir, pNode );
|
||||||
|
|
||||||
{
|
{
|
||||||
RString sPlayerNumber;
|
Lua *L = LUA->Get();
|
||||||
bool b = pNode->GetAttrValue( "PlayerNumber", sPlayerNumber );
|
bool b = pNode->PushAttrValue( L, "PlayerNumber" );
|
||||||
ASSERT( b );
|
ASSERT( b );
|
||||||
m_PlayerNumber = (PlayerNumber) LuaHelpers::RunExpressionI(sPlayerNumber);
|
LuaHelpers::Pop( L, m_PlayerNumber );
|
||||||
|
LUA->Release( L );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sMessageOnStep = ssprintf("StepP%d",m_PlayerNumber+1);
|
m_sMessageOnStep = ssprintf("StepP%d",m_PlayerNumber+1);
|
||||||
|
|||||||
Reference in New Issue
Block a user