From d46b0230903976f1878a20408b6e569373dd8406 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 11 Jul 2006 17:10:16 +0000 Subject: [PATCH] somewhat more complete xml binding --- stepmania/src/Judgment.cpp | 30 ++++++++++++++++++++++++++++-- stepmania/src/Judgment.h | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/stepmania/src/Judgment.cpp b/stepmania/src/Judgment.cpp index db87373847..04c0dff21c 100644 --- a/stepmania/src/Judgment.cpp +++ b/stepmania/src/Judgment.cpp @@ -7,6 +7,7 @@ #include "ThemeMetric.h" #include "ActorUtil.h" #include "StatsManager.h" +#include "XmlFile.h" static ThemeMetric W1_COMMAND ("Judgment","W1Command"); static ThemeMetric W2_COMMAND ("Judgment","W2Command"); @@ -22,9 +23,35 @@ Judgment::Judgment() m_mpToTrack = MultiPlayer_INVALID; } +void Judgment::LoadFromNode( const RString& sDir, const XNode* pNode ) +{ + RString sFile; + if( pNode->GetAttrValue("File", sFile) ) + { + LuaHelpers::RunAtExpressionS( sFile ); + + if( sFile.Left(1) != "/" ) + sFile = sDir+sFile; + + CollapsePath( sFile ); + LoadNormal( sFile ); + } + else + { + LoadNormal(); + } + + ActorFrame::LoadFromNode( sDir, pNode ); +} + void Judgment::LoadNormal() { - m_sprJudgment.Load( THEME->GetPathG("Judgment","label") ); + LoadNormal( THEME->GetPathG("Judgment","label") ); +} + +void Judgment::LoadNormal( const RString &sPath ) +{ + m_sprJudgment.Load( sPath ); ASSERT( m_sprJudgment.GetNumStates() == 6 || m_sprJudgment.GetNumStates() == 12 ); m_sprJudgment.StopAnimating(); Reset(); @@ -83,7 +110,6 @@ void Judgment::SetJudgment( TapNoteScore score, bool bEarly ) void Judgment::LoadFromMultiPlayer( MultiPlayer mp ) { - LoadNormal(); ASSERT( m_mpToTrack == MultiPlayer_INVALID ); // assert only load once m_mpToTrack = mp; this->SubscribeToMessage( enum_add2(Message_ShowJudgmentMuliPlayerP1,m_mpToTrack) ); diff --git a/stepmania/src/Judgment.h b/stepmania/src/Judgment.h index 426f3dc70e..30e6091fc5 100644 --- a/stepmania/src/Judgment.h +++ b/stepmania/src/Judgment.h @@ -14,7 +14,9 @@ public: Judgment(); virtual Actor *Copy() const; void LoadNormal(); + void LoadNormal( const RString &sPath ); void LoadFromMultiPlayer( MultiPlayer mp ); + void LoadFromNode( const RString& sDir, const XNode* pNode ); void Reset(); void SetJudgment( TapNoteScore score, bool bEarly ); void HandleMessage( const RString &sMessage );