2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-01-16 10:01:32 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
2003-03-09 00:55:49 +00:00
|
|
|
Class: DifficultyMeter
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-05-27 08:23:27 +00:00
|
|
|
Desc: See header.
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-05-27 08:23:27 +00:00
|
|
|
Chris Danford
|
2002-01-16 10:01:32 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
2003-03-09 00:55:49 +00:00
|
|
|
#include "DifficultyMeter.h"
|
2002-01-16 10:01:32 +00:00
|
|
|
#include "RageUtil.h"
|
2002-05-01 19:14:55 +00:00
|
|
|
#include "GameConstantsAndTypes.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "PrefsManager.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
|
|
|
|
#include "Notes.h"
|
2003-02-16 10:12:03 +00:00
|
|
|
#include "SongManager.h"
|
2002-01-16 10:01:32 +00:00
|
|
|
|
|
|
|
|
|
2002-10-06 16:56:58 +00:00
|
|
|
const int NUM_FEET_IN_METER = 10;
|
|
|
|
|
const int GLOW_IF_METER_GREATER_THAN = 9;
|
|
|
|
|
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-03-09 00:55:49 +00:00
|
|
|
DifficultyMeter::DifficultyMeter()
|
2002-05-19 01:59:48 +00:00
|
|
|
{
|
2003-03-09 00:55:49 +00:00
|
|
|
BitmapText::LoadFromTextureAndChars( THEME->GetPathTo("Graphics","DifficultyMeter bar 2x1"), "10" );
|
2002-05-19 01:59:48 +00:00
|
|
|
|
2002-06-27 17:49:10 +00:00
|
|
|
SetFromNotes( NULL );
|
2002-05-19 01:59:48 +00:00
|
|
|
}
|
|
|
|
|
|
2003-03-09 00:55:49 +00:00
|
|
|
void DifficultyMeter::SetFromNotes( Notes* pNotes )
|
2002-05-19 01:59:48 +00:00
|
|
|
{
|
|
|
|
|
if( pNotes != NULL )
|
|
|
|
|
{
|
2002-10-28 05:30:45 +00:00
|
|
|
SetDiffuse( RageColor(1,1,1,1) );
|
2003-03-09 00:55:49 +00:00
|
|
|
SetMeter( pNotes->GetMeter() );
|
2003-01-02 22:10:51 +00:00
|
|
|
if( pNotes->GetMeter() > GLOW_IF_METER_GREATER_THAN )
|
2003-02-18 23:15:38 +00:00
|
|
|
this->SetEffectGlowShift();
|
2002-05-19 01:59:48 +00:00
|
|
|
else
|
|
|
|
|
this->SetEffectNone();
|
2002-06-23 11:43:53 +00:00
|
|
|
|
2003-02-16 10:12:03 +00:00
|
|
|
SetDiffuse( SONGMAN->GetDifficultyColor(pNotes->GetDifficulty()) );
|
2002-05-19 01:59:48 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2002-06-14 22:25:22 +00:00
|
|
|
this->SetEffectNone();
|
2002-10-28 05:30:45 +00:00
|
|
|
SetDiffuse( RageColor(0.8f,0.8f,0.8f,1) );
|
2003-03-09 00:55:49 +00:00
|
|
|
SetMeter( 0 );
|
2002-05-19 01:59:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-09 00:55:49 +00:00
|
|
|
void DifficultyMeter::SetMeter( int iMeter )
|
2002-05-19 01:59:48 +00:00
|
|
|
{
|
|
|
|
|
CString sNewText;
|
2002-11-16 08:54:15 +00:00
|
|
|
int f;
|
|
|
|
|
for( f=0; f<NUM_FEET_IN_METER; f++ )
|
2003-03-09 00:55:49 +00:00
|
|
|
sNewText += (f<iMeter) ? "1" : "0";
|
2002-10-06 16:56:58 +00:00
|
|
|
for( f=NUM_FEET_IN_METER; f<=13; f++ )
|
2003-03-09 00:55:49 +00:00
|
|
|
if( f<iMeter )
|
2002-05-19 01:59:48 +00:00
|
|
|
sNewText += "1";
|
|
|
|
|
|
|
|
|
|
SetText( sNewText );
|
2002-11-16 08:54:15 +00:00
|
|
|
}
|