load metrics from m_sType, not m_sName

This commit is contained in:
Chris Danford
2005-02-23 22:14:31 +00:00
parent 5cdaec5edf
commit 480088576a
2 changed files with 29 additions and 18 deletions
+18 -16
View File
@@ -45,18 +45,20 @@ DifficultyMeter::DifficultyMeter()
void DifficultyMeter::Load( const CString &sType ) void DifficultyMeter::Load( const CString &sType )
{ {
m_sType = sType;
/* We can't use global ThemeMetric<CString>s, because we can have multiple /* We can't use global ThemeMetric<CString>s, because we can have multiple
* DifficultyMeters on screen at once, with different names. */ * DifficultyMeters on screen at once, with different names. */
m_iNumFeetInMeter = THEME->GetMetricI(sType,"NumFeetInMeter"); m_iNumFeetInMeter = THEME->GetMetricI(m_sType,"NumFeetInMeter");
m_iMaxFeetInMeter = THEME->GetMetricI(sType,"MaxFeetInMeter"); m_iMaxFeetInMeter = THEME->GetMetricI(m_sType,"MaxFeetInMeter");
m_iGlowIfMeterGreaterThan = THEME->GetMetricI(sType,"GlowIfMeterGreaterThan"); m_iGlowIfMeterGreaterThan = THEME->GetMetricI(m_sType,"GlowIfMeterGreaterThan");
m_bShowFeet = THEME->GetMetricB(sType,"ShowFeet"); m_bShowFeet = THEME->GetMetricB(m_sType,"ShowFeet");
/* "easy", "hard" */ /* "easy", "hard" */
m_bShowDifficulty = THEME->GetMetricB(sType,"ShowDifficulty"); m_bShowDifficulty = THEME->GetMetricB(m_sType,"ShowDifficulty");
/* 3, 9 */ /* 3, 9 */
m_bShowMeter = THEME->GetMetricB(sType,"ShowMeter"); m_bShowMeter = THEME->GetMetricB(m_sType,"ShowMeter");
m_bFeetIsDifficultyColor = THEME->GetMetricB(sType,"FeetIsDifficultyColor"); m_bFeetIsDifficultyColor = THEME->GetMetricB(m_sType,"FeetIsDifficultyColor");
m_bFeetPerDifficulty = THEME->GetMetricB(sType,"FeetPerDifficulty"); m_bFeetPerDifficulty = THEME->GetMetricB(m_sType,"FeetPerDifficulty");
if( m_bShowFeet ) if( m_bShowFeet )
{ {
@@ -70,24 +72,24 @@ void DifficultyMeter::Load( const CString &sType )
} }
else else
Feet = "0X"; Feet = "0X";
m_textFeet.LoadFromTextureAndChars( THEME->GetPathG(sType,"bar"), Feet ); m_textFeet.LoadFromTextureAndChars( THEME->GetPathG(m_sType,"bar"), Feet );
SET_XY_AND_ON_COMMAND( &m_textFeet ); ActorUtil::SetXYAndOnCommand( m_textFeet, m_sType );
this->AddChild( &m_textFeet ); this->AddChild( &m_textFeet );
} }
if( m_bShowDifficulty ) if( m_bShowDifficulty )
{ {
m_Difficulty.Load( THEME->GetPathG(sType,"difficulty") ); m_Difficulty.Load( THEME->GetPathG(m_sType,"difficulty") );
m_Difficulty->SetName( "Difficulty" ); m_Difficulty->SetName( "Difficulty" );
SET_XY_AND_ON_COMMAND( m_Difficulty ); ActorUtil::SetXYAndOnCommand( m_Difficulty, m_sType );
this->AddChild( m_Difficulty ); this->AddChild( m_Difficulty );
} }
if( m_bShowMeter ) if( m_bShowMeter )
{ {
m_textMeter.SetName( "Meter" ); m_textMeter.SetName( "Meter" );
m_textMeter.LoadFromFont( THEME->GetPathF(sType,"meter") ); m_textMeter.LoadFromFont( THEME->GetPathF(m_sType,"meter") );
SET_XY_AND_ON_COMMAND( m_textMeter ); ActorUtil::SetXYAndOnCommand( m_textMeter, m_sType );
this->AddChild( &m_textMeter ); this->AddChild( &m_textMeter );
} }
@@ -203,9 +205,9 @@ void DifficultyMeter::SetDifficulty( CString diff )
m_CurDifficulty = diff; m_CurDifficulty = diff;
if( m_bShowDifficulty ) if( m_bShowDifficulty )
COMMAND( m_Difficulty, "Set" + Capitalize(diff) ); ActorUtil::RunCommand( m_Difficulty, m_sType, "Set" + Capitalize(diff) );
if( m_bShowMeter ) if( m_bShowMeter )
COMMAND( m_textMeter, "Set" + Capitalize(diff) ); ActorUtil::RunCommand( m_textMeter, m_sType, "Set" + Capitalize(diff) );
} }
/* /*
+11 -2
View File
@@ -23,8 +23,15 @@ public:
static int Load( T* p, lua_State *L ) { p->Load( SArg(1) ); return 0; } static int Load( T* p, lua_State *L ) { p->Load( SArg(1) ); return 0; }
static int SetFromSteps( T* p, lua_State *L ) static int SetFromSteps( T* p, lua_State *L )
{ {
if( lua_isnil(L,1) ) { p->SetFromSteps( NULL ); } if( lua_isnil(L,1) )
else { Steps *pS = Luna<Steps>::check(L,1); p->SetFromSteps( pS ); } {
p->SetFromSteps( NULL );
}
else
{
Steps *pS = Luna<Steps>::check(L,1);
p->SetFromSteps( pS );
}
return 0; return 0;
} }
@@ -55,6 +62,8 @@ private:
void SetFromDifficulty( Difficulty dc ); void SetFromDifficulty( Difficulty dc );
void SetFromCourseDifficulty( CourseDifficulty cd ); void SetFromCourseDifficulty( CourseDifficulty cd );
CString m_sType;
void SetDifficulty( CString diff ); void SetDifficulty( CString diff );
BitmapText m_textFeet; BitmapText m_textFeet;