2003-02-17 02:45:30 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: CourseEntryDisplay
|
|
|
|
|
|
|
|
|
|
Desc: See header.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "CourseEntryDisplay.h"
|
|
|
|
|
#include "RageUtil.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "Course.h"
|
|
|
|
|
#include "SongManager.h"
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include "ThemeManager.h"
|
2003-08-03 00:13:55 +00:00
|
|
|
#include "Steps.h"
|
2003-02-17 02:45:30 +00:00
|
|
|
#include "GameState.h"
|
|
|
|
|
#include "StyleDef.h"
|
2003-11-16 21:44:42 +00:00
|
|
|
#include "ActorUtil.h"
|
2003-02-17 02:45:30 +00:00
|
|
|
|
|
|
|
|
|
2003-11-16 21:44:42 +00:00
|
|
|
void CourseEntryDisplay::Load()
|
2003-02-17 02:45:30 +00:00
|
|
|
{
|
2003-11-16 21:44:42 +00:00
|
|
|
m_sprFrame.SetName( "Bar" );
|
2003-04-12 17:39:27 +00:00
|
|
|
m_sprFrame.Load( THEME->GetPathToG("CourseEntryDisplay bar") );
|
2003-11-16 21:44:42 +00:00
|
|
|
SET_XY_AND_ON_COMMAND( &m_sprFrame );
|
2003-02-17 02:45:30 +00:00
|
|
|
this->AddChild( &m_sprFrame );
|
|
|
|
|
|
2003-11-16 21:44:42 +00:00
|
|
|
this->m_size.x = (float) m_sprFrame.GetTexture()->GetSourceFrameWidth();
|
|
|
|
|
this->m_size.y = (float) m_sprFrame.GetTexture()->GetSourceFrameHeight();
|
|
|
|
|
|
|
|
|
|
m_textNumber.SetName( "Number" );
|
2003-04-12 17:39:27 +00:00
|
|
|
m_textNumber.LoadFromFont( THEME->GetPathToF("CourseEntryDisplay number") );
|
2003-11-16 21:44:42 +00:00
|
|
|
SET_XY_AND_ON_COMMAND( &m_textNumber );
|
2003-02-17 02:45:30 +00:00
|
|
|
this->AddChild( &m_textNumber );
|
|
|
|
|
|
2003-11-16 21:44:42 +00:00
|
|
|
m_TextBanner.SetName( "TextBanner" );
|
|
|
|
|
SET_XY_AND_ON_COMMAND( &m_TextBanner );
|
2003-02-17 02:45:30 +00:00
|
|
|
this->AddChild( &m_TextBanner );
|
|
|
|
|
|
2003-11-16 21:44:42 +00:00
|
|
|
m_textFoot.SetName( "Foot" );
|
2003-04-12 17:39:27 +00:00
|
|
|
m_textFoot.LoadFromTextureAndChars( THEME->GetPathToG("CourseEntryDisplay difficulty 2x1"),"10" );
|
2003-11-16 21:44:42 +00:00
|
|
|
SET_XY_AND_ON_COMMAND( &m_textFoot );
|
2003-02-17 02:45:30 +00:00
|
|
|
this->AddChild( &m_textFoot );
|
|
|
|
|
|
2003-11-16 21:44:42 +00:00
|
|
|
m_textDifficultyNumber.SetName( "Difficulty" );
|
2003-04-12 17:39:27 +00:00
|
|
|
m_textDifficultyNumber.LoadFromFont( THEME->GetPathToF("Common normal") );
|
2003-11-16 21:44:42 +00:00
|
|
|
SET_XY_AND_ON_COMMAND( &m_textDifficultyNumber );
|
2003-02-17 02:45:30 +00:00
|
|
|
this->AddChild( &m_textDifficultyNumber );
|
|
|
|
|
|
2003-11-16 21:44:42 +00:00
|
|
|
m_textModifiers.SetName( "Modifiers" );
|
2003-04-12 17:39:27 +00:00
|
|
|
m_textModifiers.LoadFromFont( THEME->GetPathToF("Common normal") );
|
2003-11-16 21:44:42 +00:00
|
|
|
SET_XY_AND_ON_COMMAND( &m_textModifiers );
|
2003-02-17 02:45:30 +00:00
|
|
|
this->AddChild( &m_textModifiers );
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-21 06:58:01 +00:00
|
|
|
void CourseEntryDisplay::LoadFromCourseInfo( int iNum, const Course *pCourse, const Course::Info &ci )
|
2003-02-17 02:45:30 +00:00
|
|
|
{
|
2004-01-21 06:58:01 +00:00
|
|
|
RageColor colorNotes;
|
|
|
|
|
if( ci.Mystery )
|
|
|
|
|
{
|
|
|
|
|
Difficulty dc = pCourse->GetDifficulty( ci );
|
|
|
|
|
|
|
|
|
|
if( dc == DIFFICULTY_INVALID )
|
|
|
|
|
{
|
|
|
|
|
int iLow, iHigh;
|
|
|
|
|
pCourse->GetMeterRange(ci, iLow, iHigh);
|
|
|
|
|
|
|
|
|
|
colorNotes = RageColor(1,1,1,1);
|
|
|
|
|
m_textDifficultyNumber.SetText( ssprintf(iLow==iHigh?"%d":"%d-%d", iLow, iHigh) );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
colorNotes = SONGMAN->GetDifficultyColor( dc );
|
|
|
|
|
m_textDifficultyNumber.SetText( "?" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_TextBanner.LoadFromString( "??????????", "??????????", "", "", "", "" );
|
|
|
|
|
m_TextBanner.SetDiffuse( RageColor(1,1,1,1) ); // TODO: What should this be?
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
colorNotes = SONGMAN->GetDifficultyColor( ci.pNotes->GetDifficulty() );
|
|
|
|
|
m_textDifficultyNumber.SetText( ssprintf("%d", ci.pNotes->GetMeter()) );
|
|
|
|
|
|
|
|
|
|
m_TextBanner.LoadFromSong( ci.pSong );
|
|
|
|
|
m_TextBanner.SetDiffuse( SONGMAN->GetSongColor( ci.pSong ) );
|
|
|
|
|
}
|
2003-02-17 02:45:30 +00:00
|
|
|
|
|
|
|
|
m_textNumber.SetText( ssprintf("%d", iNum) );
|
|
|
|
|
|
|
|
|
|
m_textFoot.SetText( "1" );
|
|
|
|
|
m_textFoot.SetDiffuse( colorNotes );
|
|
|
|
|
|
2004-01-21 06:58:01 +00:00
|
|
|
m_textModifiers.SetText( ci.Modifiers );
|
2003-02-17 02:45:30 +00:00
|
|
|
|
|
|
|
|
m_textDifficultyNumber.SetDiffuse( colorNotes );
|
|
|
|
|
}
|