Files
itgmania212121/stepmania/src/DifficultyIcon.cpp
T

56 lines
1.3 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
-----------------------------------------------------------------------------
*/
#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
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();
if( iStates != 5 && iStates != 10 )
if( DISPLAY->IsWindowed() )
2003-09-27 21:49:02 +00:00
HOOKS->MessageBoxOK( ssprintf("The difficulty icon graphic '%s' must have 5 or 10 frames. It has %d states.", sPath.c_str(), iStates) );
2002-10-06 16:56:58 +00:00
StopAnimating();
return true;
}
2002-01-16 10:01:32 +00:00
2003-08-03 00:13:55 +00:00
void DifficultyIcon::SetFromNotes( PlayerNumber pn, Steps* pNotes )
2002-10-06 16:56:58 +00:00
{
if( pNotes == NULL )
{
SetDiffuse( RageColor(1,1,1,0) );
2002-10-06 16:56:58 +00:00
return;
}
else
{
SetDiffuse( RageColor(1,1,1,1) );
2002-10-06 16:56:58 +00:00
int iStateNo = pNotes->GetDifficulty();
2002-10-06 16:56:58 +00:00
switch( GetNumStates() )
{
case 5: SetState( iStateNo ); break;
2003-09-25 05:41:01 +00:00
case 10: SetState( iStateNo*2+pn ); break;
default: SetState( 0 ); break;
2002-10-06 16:56:58 +00:00
}
}
}