add difficulty and meter displays

This commit is contained in:
Glenn Maynard
2003-11-15 00:26:30 +00:00
parent 5dcf0b5c6e
commit 6828c3bd07
2 changed files with 85 additions and 23 deletions
+61 -7
View File
@@ -25,11 +25,15 @@
#define NUM_FEET_IN_METER THEME->GetMetricI(m_sName,"NumFeetInMeter") #define NUM_FEET_IN_METER THEME->GetMetricI(m_sName,"NumFeetInMeter")
#define MAX_FEET_IN_METER THEME->GetMetricI(m_sName,"MaxFeetInMeter") #define MAX_FEET_IN_METER THEME->GetMetricI(m_sName,"MaxFeetInMeter")
#define GLOW_IF_METER_GREATER_THAN THEME->GetMetricI(m_sName,"GlowIfMeterGreaterThan") #define GLOW_IF_METER_GREATER_THAN THEME->GetMetricI(m_sName,"GlowIfMeterGreaterThan")
#define SHOW_FEET THEME->GetMetricB(m_sName,"ShowFeet")
/* "easy", "hard" */
#define SHOW_DIFFICULTY THEME->GetMetricB(m_sName,"ShowDifficulty")
/* 3, 9 */
#define SHOW_METER THEME->GetMetricB(m_sName,"ShowMeter")
DifficultyMeter::DifficultyMeter() DifficultyMeter::DifficultyMeter()
{ {
this->AddChild( &m_textFeet );
} }
/* sID experiment: /* sID experiment:
@@ -56,9 +60,30 @@ DifficultyMeter::DifficultyMeter()
void DifficultyMeter::Load() void DifficultyMeter::Load()
{ {
if( SHOW_FEET )
{
m_textFeet.SetName( "Feet" ); m_textFeet.SetName( "Feet" );
m_textFeet.LoadFromTextureAndChars( THEME->GetPathToG( ssprintf("%s bar 2x1", m_sName.c_str())), "10" ); m_textFeet.LoadFromTextureAndChars( THEME->GetPathToG( ssprintf("%s bar 2x1", m_sName.c_str())), "10" );
SET_XY_AND_ON_COMMAND( &m_textFeet ); SET_XY_AND_ON_COMMAND( &m_textFeet );
this->AddChild( &m_textFeet );
}
if( SHOW_DIFFICULTY )
{
m_Difficulty.Load( THEME->GetPathToG( ssprintf("%s difficulty", m_sName.c_str())) );
m_Difficulty->SetName( "Difficulty" );
SET_XY_AND_ON_COMMAND( m_Difficulty );
this->AddChild( m_Difficulty );
}
if( SHOW_METER )
{
m_textMeter.SetName( "Meter" );
m_textMeter.LoadFromNumbers( THEME->GetPathToN( ssprintf("%s meter", m_sName.c_str())) );
SET_XY_AND_ON_COMMAND( m_textMeter );
this->AddChild( &m_textMeter );
}
Unset(); Unset();
} }
@@ -72,6 +97,8 @@ void DifficultyMeter::SetFromNotes( const Steps* pNotes )
SetMeter( pNotes->GetMeter() ); SetMeter( pNotes->GetMeter() );
m_textFeet.SetDiffuse( SONGMAN->GetDifficultyColor(pNotes->GetDifficulty()) ); m_textFeet.SetDiffuse( SONGMAN->GetDifficultyColor(pNotes->GetDifficulty()) );
SetDifficulty( DifficultyToString( pNotes->GetDifficulty() ) );
} }
void DifficultyMeter::SetFromCourse( const Course* pCourse ) void DifficultyMeter::SetFromCourse( const Course* pCourse )
@@ -86,18 +113,22 @@ void DifficultyMeter::SetFromCourse( const Course* pCourse )
SetMeter( meter ); SetMeter( meter );
// XXX // XXX
RageColor c; Difficulty FakeDifficulty;
if( meter <= 1 ) if( meter <= 1 )
c = SONGMAN->GetDifficultyColor( DIFFICULTY_BEGINNER ); FakeDifficulty = DIFFICULTY_BEGINNER;
else if( meter <= 2 ) else if( meter <= 2 )
c = SONGMAN->GetDifficultyColor( DIFFICULTY_EASY ); FakeDifficulty = DIFFICULTY_EASY;
else if( meter <= 5 ) else if( meter <= 5 )
c = SONGMAN->GetDifficultyColor( DIFFICULTY_MEDIUM ); FakeDifficulty = DIFFICULTY_MEDIUM;
else if( meter <= 7 ) else if( meter <= 7 )
c = SONGMAN->GetDifficultyColor( DIFFICULTY_HARD ); FakeDifficulty = DIFFICULTY_HARD;
else else
c = SONGMAN->GetDifficultyColor( DIFFICULTY_CHALLENGE ); FakeDifficulty = DIFFICULTY_CHALLENGE;
RageColor c = SONGMAN->GetDifficultyColor( FakeDifficulty );
m_textFeet.SetDiffuse( c ); m_textFeet.SetDiffuse( c );
SetDifficulty( DifficultyToString(FakeDifficulty) + "Course" );
} }
void DifficultyMeter::Unset() void DifficultyMeter::Unset()
@@ -105,6 +136,7 @@ void DifficultyMeter::Unset()
m_textFeet.SetEffectNone(); m_textFeet.SetEffectNone();
m_textFeet.SetDiffuse( RageColor(0.8f,0.8f,0.8f,1) ); m_textFeet.SetDiffuse( RageColor(0.8f,0.8f,0.8f,1) );
SetMeter( 0 ); SetMeter( 0 );
SetDifficulty( "None" );
} }
void DifficultyMeter::SetFromGameState( PlayerNumber pn ) void DifficultyMeter::SetFromGameState( PlayerNumber pn )
@@ -119,6 +151,8 @@ void DifficultyMeter::SetFromGameState( PlayerNumber pn )
void DifficultyMeter::SetMeter( int iMeter ) void DifficultyMeter::SetMeter( int iMeter )
{ {
if( SHOW_FEET )
{
CString sNewText; CString sNewText;
int f; int f;
for( f=0; f<NUM_FEET_IN_METER; f++ ) for( f=0; f<NUM_FEET_IN_METER; f++ )
@@ -133,4 +167,24 @@ void DifficultyMeter::SetMeter( int iMeter )
m_textFeet.SetEffectGlowShift(); m_textFeet.SetEffectGlowShift();
else else
m_textFeet.SetEffectNone(); m_textFeet.SetEffectNone();
}
if( SHOW_METER )
{
const CString sMeter = ssprintf( "%i", iMeter );
if( sMeter != m_textMeter.GetText() )
m_textMeter.SetText( sMeter );
}
}
void DifficultyMeter::SetDifficulty( CString diff )
{
if( m_CurDifficulty == diff )
return;
m_CurDifficulty = diff;
if( SHOW_DIFFICULTY )
COMMAND( m_Difficulty, "Set" + Capitalize(diff) );
if( SHOW_METER )
COMMAND( m_textMeter, "Set" + Capitalize(diff) );
} }
+8
View File
@@ -14,6 +14,8 @@
#include "BitmapText.h" #include "BitmapText.h"
#include "PlayerNumber.h" #include "PlayerNumber.h"
#include "ActorFrame.h" #include "ActorFrame.h"
#include "GameConstantsAndTypes.h"
#include "ActorUtil.h"
class Steps; class Steps;
class Course; class Course;
@@ -32,7 +34,13 @@ public:
private: private:
void SetMeter( int iMeter ); void SetMeter( int iMeter );
void SetDifficulty( CString diff );
BitmapText m_textFeet; BitmapText m_textFeet;
CString m_CurDifficulty;
AutoActor m_Difficulty;
BitmapText m_textMeter;
}; };
#endif #endif