Files
itgmania212121/stepmania/src/DifficultyIcon.cpp
T

82 lines
2.1 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
2002-01-16 10:01:32 +00:00
/*
-----------------------------------------------------------------------------
2002-10-06 16:56:58 +00:00
Class: DifficultyIcon
2002-01-16 10:01:32 +00:00
2002-10-06 16:56:58 +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-10-06 16:56:58 +00:00
Chris Danford
2002-01-16 10:01:32 +00:00
-----------------------------------------------------------------------------
*/
2003-11-17 01:41:49 +00:00
/* Obsolete: use DifficultyClass. */
/* DifficultyClass was the old name for enum Difficulty, right? -Chris */
2004-03-08 02:43:11 +00:00
/* Maybe, but that wouldn't make sense. I might have meant DifficultyMeter, whose
* functionality is a superset of DifficultyIcon; this class can probably be phased
* out. -glenn */
2002-01-16 10:01:32 +00:00
#include "DifficultyIcon.h"
2002-10-06 16:56:58 +00:00
#include "RageUtil.h"
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "RageLog.h"
2003-08-03 00:13:55 +00:00
#include "Steps.h"
2002-10-06 16:56:58 +00:00
#include "GameState.h"
#include "RageDisplay.h"
#include "arch/ArchHooks/ArchHooks.h"
2002-01-16 10:01:32 +00:00
DifficultyIcon::DifficultyIcon()
{
m_bBlank = false;
}
2002-01-16 10:01:32 +00:00
2002-10-06 16:56:58 +00:00
bool DifficultyIcon::Load( CString sPath )
{
Sprite::Load( sPath );
2003-09-27 21:49:02 +00:00
int iStates = GetNumStates();
2004-02-08 01:05:53 +00:00
if( iStates != NUM_DIFFICULTIES && iStates != NUM_DIFFICULTIES*2 )
{
CString sError = ssprintf(
"The difficulty icon graphic '%s' must have %d or %d frames. It has %d states.",
sPath.c_str(),
NUM_DIFFICULTIES,
NUM_DIFFICULTIES*2,
iStates );
HOOKS->MessageBoxOK( sError );
}
2002-10-06 16:56:58 +00:00
StopAnimating();
return true;
}
2002-01-16 10:01:32 +00:00
2004-05-29 04:50:47 +00:00
void DifficultyIcon::SetFromSteps( PlayerNumber pn, Steps* pSteps )
2002-10-06 16:56:58 +00:00
{
2004-05-24 03:41:39 +00:00
if( pSteps == NULL )
m_bBlank = true;
2002-10-06 16:56:58 +00:00
else
2004-05-24 03:41:39 +00:00
SetFromDifficulty( pn, pSteps->GetDifficulty() );
}
2002-10-06 16:56:58 +00:00
void DifficultyIcon::SetFromDifficulty( PlayerNumber pn, Difficulty dc )
{
m_bBlank = false;
switch( GetNumStates() )
{
case NUM_DIFFICULTIES: SetState( dc ); break;
case NUM_DIFFICULTIES*2: SetState( dc*2+pn ); break;
default: m_bBlank = true; break;
}
}
2002-10-06 16:56:58 +00:00
void DifficultyIcon::SetFromCourseDifficulty( PlayerNumber pn, CourseDifficulty cd )
{
m_bBlank = false;
switch( cd )
{
2004-05-22 04:41:25 +00:00
case COURSE_DIFFICULTY_EASY: SetFromDifficulty(pn,DIFFICULTY_EASY); break;
case COURSE_DIFFICULTY_REGULAR: SetFromDifficulty(pn,DIFFICULTY_MEDIUM); break;
case COURSE_DIFFICULTY_DIFFICULT: SetFromDifficulty(pn,DIFFICULTY_HARD); break;
default: ASSERT(0);
2002-10-06 16:56:58 +00:00
}
}