add course meter

This commit is contained in:
Glenn Maynard
2003-07-21 22:38:41 +00:00
parent 5618c2b3d1
commit 00d42525bb
3 changed files with 60 additions and 16 deletions
+51 -12
View File
@@ -13,9 +13,11 @@
#include "DifficultyMeter.h" #include "DifficultyMeter.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "GameState.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "Notes.h" #include "Notes.h"
#include "Course.h"
#include "SongManager.h" #include "SongManager.h"
@@ -28,28 +30,60 @@ DifficultyMeter::DifficultyMeter()
{ {
BitmapText::LoadFromTextureAndChars( THEME->GetPathToG("DifficultyMeter bar 2x1"), "10" ); BitmapText::LoadFromTextureAndChars( THEME->GetPathToG("DifficultyMeter bar 2x1"), "10" );
SetFromNotes( NULL ); Unset();
} }
void DifficultyMeter::SetFromNotes( Notes* pNotes ) void DifficultyMeter::SetFromNotes( Notes* pNotes )
{ {
if( pNotes != NULL ) if( pNotes == NULL )
{ {
SetDiffuse( RageColor(1,1,1,1) ); Unset();
SetMeter( pNotes->GetMeter() ); return;
if( pNotes->GetMeter() > GLOW_IF_METER_GREATER_THAN )
this->SetEffectGlowShift();
else
this->SetEffectNone();
SetDiffuse( SONGMAN->GetDifficultyColor(pNotes->GetDifficulty()) );
} }
else
SetMeter( pNotes->GetMeter() );
SetDiffuse( SONGMAN->GetDifficultyColor(pNotes->GetDifficulty()) );
}
void DifficultyMeter::SetFromCourse( Course* pCourse )
{
if( pCourse == NULL )
{ {
Unset();
return;
}
int meter = pCourse->GetMeter();
SetMeter( meter );
// XXX
if(meter <= 1 )
SetDiffuse( SONGMAN->GetDifficultyColor(DIFFICULTY_BEGINNER) );
else if(meter <= 2 )
SetDiffuse( SONGMAN->GetDifficultyColor(DIFFICULTY_EASY) );
else if(meter <= 5 )
SetDiffuse( SONGMAN->GetDifficultyColor(DIFFICULTY_MEDIUM) );
else if(meter <= 7 )
SetDiffuse( SONGMAN->GetDifficultyColor(DIFFICULTY_HARD) );
else
SetDiffuse( SONGMAN->GetDifficultyColor(DIFFICULTY_CHALLENGE) );
}
void DifficultyMeter::Unset()
{
this->SetEffectNone(); this->SetEffectNone();
SetDiffuse( RageColor(0.8f,0.8f,0.8f,1) ); SetDiffuse( RageColor(0.8f,0.8f,0.8f,1) );
SetMeter( 0 ); SetMeter( 0 );
} }
void DifficultyMeter::SetFromGameState( PlayerNumber pn )
{
if( GAMESTATE->m_pCurNotes[pn] )
SetFromNotes( GAMESTATE->m_pCurNotes[pn] );
else if( GAMESTATE->m_pCurCourse )
SetFromCourse( GAMESTATE->m_pCurCourse );
else
Unset();
} }
void DifficultyMeter::SetMeter( int iMeter ) void DifficultyMeter::SetMeter( int iMeter )
@@ -63,4 +97,9 @@ void DifficultyMeter::SetMeter( int iMeter )
sNewText += "1"; sNewText += "1";
SetText( sNewText ); SetText( sNewText );
if( iMeter > GLOW_IF_METER_GREATER_THAN )
this->SetEffectGlowShift();
else
this->SetEffectNone();
} }
+6 -1
View File
@@ -12,7 +12,9 @@
*/ */
#include "BitmapText.h" #include "BitmapText.h"
#include "PlayerNumber.h"
class Notes; class Notes;
class Course;
class DifficultyMeter : public BitmapText class DifficultyMeter : public BitmapText
@@ -20,10 +22,13 @@ class DifficultyMeter : public BitmapText
public: public:
DifficultyMeter(); DifficultyMeter();
void SetFromGameState( PlayerNumber pn );
void SetFromNotes( Notes* pNotes ); void SetFromNotes( Notes* pNotes );
void SetMeter( int iMeter ); void SetFromCourse( Course* pCourse );
void Unset();
private: private:
void SetMeter( int iMeter );
}; };
#endif #endif
+1 -1
View File
@@ -908,7 +908,7 @@ void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn )
m_AutoGenIcon[pn].SetEffectNone(); m_AutoGenIcon[pn].SetEffectNone();
m_AutoGenIcon[pn].SetDiffuse( RageColor(1,1,1,0) ); m_AutoGenIcon[pn].SetDiffuse( RageColor(1,1,1,0) );
} }
m_DifficultyMeter[pn].SetFromNotes( pNotes ); m_DifficultyMeter[pn].SetFromGameState( pn );
m_GrooveRadar.SetFromNotes( pn, pNotes ); m_GrooveRadar.SetFromNotes( pn, pNotes );
m_MusicWheel.NotesChanged( pn ); m_MusicWheel.NotesChanged( pn );
} }