diff --git a/stepmania/src/PercentageDisplay.cpp b/stepmania/src/PercentageDisplay.cpp index 16773b56ad..ab6a7222fe 100644 --- a/stepmania/src/PercentageDisplay.cpp +++ b/stepmania/src/PercentageDisplay.cpp @@ -22,6 +22,8 @@ PercentageDisplay::PercentageDisplay() m_Last = -1; m_LastMax = -1; + + m_Format.SetFromExpression( THEME->GetMetric("MultiplayerEvalScoreRow","NumberOnCommandFunction") ); } void PercentageDisplay::LoadFromNode( const RString& sDir, const XNode* pNode ) @@ -30,6 +32,9 @@ void PercentageDisplay::LoadFromNode( const RString& sDir, const XNode* pNode ) pNode->GetAttrValue( "PercentUseRemainder", m_bUseRemainder ); pNode->GetAttrValue( "ApplyScoreDisplayOptions", m_bApplyScoreDisplayOptions ); pNode->GetAttrValue( "AutoRefresh", m_bAutoRefresh ); + RString sStr = "FormatPercentScore"; + pNode->GetAttrValue( "Format", sStr ); + m_Format.SetFromExpression( sStr ); const XNode *pChild = pNode->GetChild( "Percent" ); if( pChild == NULL ) @@ -67,6 +72,7 @@ void PercentageDisplay::Load( const PlayerState *pPlayerState, const PlayerStage m_iDancePointsDigits = THEME->GetMetricI( sMetricsGroup, "DancePointsDigits" ); m_bUseRemainder = THEME->GetMetricB( sMetricsGroup, "PercentUseRemainder" ); m_bApplyScoreDisplayOptions = THEME->GetMetricB( sMetricsGroup, "ApplyScoreDisplayOptions" ); + m_Format.SetFromExpression( THEME->GetMetric(sMetricsGroup,"Format") ); if( PREFSMAN->m_bDancePointsForOni ) @@ -153,7 +159,14 @@ void PercentageDisplay::Refresh() } else { - sNumToDisplay = FormatPercentScore( fPercentDancePoints ); + Lua *L = LUA->Get(); + m_Format.PushSelf( L ); + ASSERT( !lua_isnil(L, -1) ); + LuaHelpers::Push( fPercentDancePoints, L ); + lua_call( L, 1, 1 ); // 1 args, 1 result + sNumToDisplay = lua_tostring( L, -1 ); + lua_pop( L, 1 ); + LUA->Release(L); // HACK: Use the last frame in the numbers texture as '-' sNumToDisplay.Replace('-','x'); diff --git a/stepmania/src/PercentageDisplay.h b/stepmania/src/PercentageDisplay.h index 4b36220019..3f4a22ee61 100644 --- a/stepmania/src/PercentageDisplay.h +++ b/stepmania/src/PercentageDisplay.h @@ -41,6 +41,8 @@ private: int m_LastMax; BitmapText m_textPercent; BitmapText m_textPercentRemainder; + + LuaExpression m_Format; }; #endif