rename difficulty -> frame since it's treated as a generic Actor

Add pSteps and pTrail parameters to DifficultyMeter::Set*
This commit is contained in:
Chris Danford
2007-02-22 06:34:42 +00:00
parent 74e550d75a
commit 93e93a0fa6
3 changed files with 20 additions and 34 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ private:
ThemeMetric<apActorCommands> MOVE_COMMAND;
AutoActor m_Cursors[NUM_PLAYERS];
ActorFrame m_CursorFrames[NUM_PLAYERS];
ActorFrame m_CursorFrames[NUM_PLAYERS]; // contains Cursor so that color can fade independent of other tweens
struct Line
{
+16 -19
View File
@@ -48,11 +48,16 @@ void DifficultyMeter::Load( const RString &sType )
m_iNumTicks.Load(sType,"NumTicks");
m_iMaxTicks.Load(sType,"MaxTicks");
m_bShowTicks.Load(sType,"ShowTicks");
m_bShowDifficulty.Load(sType,"ShowDifficulty");
m_bShowMeter.Load(sType,"ShowMeter");
m_bShowEditDescription.Load(sType,"ShowEditDescription");
m_sZeroMeterString.Load(sType,"ZeroMeterString");
m_sprFrame.Load( THEME->GetPathG(sType,"frame") );
m_sprFrame->SetName( "Frame" );
ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( m_sprFrame, sType );
this->AddChild( m_sprFrame );
if( m_bShowTicks )
{
m_textTicks.SetName( "Ticks" );
@@ -65,17 +70,6 @@ void DifficultyMeter::Load( const RString &sType )
this->AddChild( &m_textTicks );
}
if( m_bShowDifficulty )
{
m_Difficulty.Load( THEME->GetPathG(sType,"difficulty") );
m_Difficulty->SetName( "Difficulty" );
ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( m_Difficulty, sType );
this->AddChild( m_Difficulty );
// These commands should have been loaded by SetXYAndOnCommand above.
ASSERT( m_Difficulty->HasCommand("Set") );
}
if( m_bShowMeter )
{
m_textMeter.SetName( "Meter" );
@@ -136,7 +130,7 @@ void DifficultyMeter::SetFromSteps( const Steps* pSteps )
return;
}
SetParams params = { pSteps->GetMeter(), pSteps->m_StepsType, pSteps->GetDifficulty(), false, pSteps->GetDescription() };
SetParams params = { pSteps, NULL, pSteps->GetMeter(), pSteps->m_StepsType, pSteps->GetDifficulty(), false, pSteps->GetDescription() };
SetInternal( params );
}
@@ -148,37 +142,42 @@ void DifficultyMeter::SetFromTrail( const Trail* pTrail )
return;
}
SetParams params = { pTrail->GetMeter(), pTrail->m_StepsType, pTrail->m_CourseDifficulty, true, RString() };
SetParams params = { NULL, pTrail, pTrail->GetMeter(), pTrail->m_StepsType, pTrail->m_CourseDifficulty, true, RString() };
SetInternal( params );
}
void DifficultyMeter::Unset()
{
SetParams params = { 0, StepsType_Invalid, Difficulty_Invalid, false, RString() };
SetParams params = { NULL, NULL, 0, StepsType_Invalid, Difficulty_Invalid, false, RString() };
SetInternal( params );
}
void DifficultyMeter::SetFromStepsTypeAndMeterAndDifficulty( StepsType st, int iMeter, Difficulty dc )
{
SetParams params = { iMeter, st, dc, false, RString() };
SetParams params = { NULL, NULL, iMeter, st, dc, false, RString() };
SetInternal( params );
}
void DifficultyMeter::SetFromStepsTypeAndMeterAndCourseDifficulty( StepsType st, int iMeter, CourseDifficulty cd )
{
SetParams params = { 0, st, cd, true, RString() };
SetParams params = { NULL, NULL, 0, st, cd, true, RString() };
SetInternal( params );
}
void DifficultyMeter::SetInternal( const SetParams &params )
{
Message msg( "Set" );
if( params.pSteps )
msg.SetParam( "Steps", LuaReference::CreateFromPush(*(Steps*)params.pSteps) );
if( params.pTrail )
msg.SetParam( "Trail", LuaReference::CreateFromPush(*(Trail*)params.pTrail) );
msg.SetParam( "Meter", params.iMeter );
msg.SetParam( "StepsType", params.st );
msg.SetParam( "Difficulty", params.dc );
msg.SetParam( "IsCourseDifficulty", params.bIsCourseDifficulty );
msg.SetParam( "EditDescription", params.sEditDescription );
m_sprFrame->HandleMessage( msg );
if( m_bShowTicks )
{
@@ -223,8 +222,6 @@ void DifficultyMeter::SetInternal( const SetParams &params )
m_textEditDescription.HandleMessage( msg );
}
if( m_bShowDifficulty )
m_Difficulty->HandleMessage( msg );
if( m_bShowMeter )
m_textMeter.HandleMessage( msg );
}
+3 -14
View File
@@ -38,35 +38,24 @@ public:
private:
struct SetParams
{
const Steps *pSteps;
const Trail *pTrail;
int iMeter;
StepsType st;
Difficulty dc;
bool bIsCourseDifficulty;
RString sEditDescription;
bool operator==( const SetParams &other )
{
#define COMPARE( x ) if( x != other.x ) return false;
COMPARE( iMeter );
COMPARE( st );
COMPARE( dc );
COMPARE( bIsCourseDifficulty );
COMPARE( sEditDescription );
#undef COMPARE
return true;
}
};
void SetInternal( const SetParams &params );
AutoActor m_sprFrame;
BitmapText m_textTicks; /* XXXX000000 */
AutoActor m_Difficulty; /* "easy", "hard" */
BitmapText m_textMeter; /* 3, 9 */
BitmapText m_textEditDescription;
ThemeMetric<int> m_iNumTicks;
ThemeMetric<int> m_iMaxTicks;
ThemeMetric<bool> m_bShowTicks;
ThemeMetric<bool> m_bShowDifficulty;
ThemeMetric<bool> m_bShowMeter;
ThemeMetric<bool> m_bShowEditDescription;
ThemeMetric<RString> m_sZeroMeterString;