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 "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
|
|
|
|
2004-01-21 08:39:11 +00:00
|
|
|
#define SEPARATE_COURSE_METERS THEME->GetMetricB(m_sName,"SeparateCourseMeters")
|
2004-01-21 09:37:56 +00:00
|
|
|
#define TEXT_BANNER_NAME THEME->GetMetric (m_sName,"TextBannerName")
|
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 );
|
|
|
|
|
|
2004-01-21 09:37:56 +00:00
|
|
|
m_TextBanner.SetName( TEXT_BANNER_NAME, "TextBanner" );
|
2003-11-16 21:44:42 +00:00
|
|
|
SET_XY_AND_ON_COMMAND( &m_TextBanner );
|
2004-02-24 23:07:03 +00:00
|
|
|
/* Load the m_TextBanner now, so any actor commands sent to us will propagate correctly. */
|
|
|
|
|
m_TextBanner.LoadFromString( "", "", "", "", "", "" );
|
2003-02-17 02:45:30 +00:00
|
|
|
this->AddChild( &m_TextBanner );
|
|
|
|
|
|
2004-06-06 20:57:13 +00:00
|
|
|
FOREACH_HumanPlayer( pn )
|
2004-01-21 08:38:06 +00:00
|
|
|
{
|
|
|
|
|
if( !SEPARATE_COURSE_METERS && pn != GAMESTATE->m_MasterPlayerNumber )
|
|
|
|
|
continue; // skip
|
|
|
|
|
|
|
|
|
|
m_textFoot[pn].SetName( SEPARATE_COURSE_METERS? ssprintf("FootP%i", pn+1):"Foot" );
|
|
|
|
|
m_textFoot[pn].LoadFromTextureAndChars( THEME->GetPathToG("CourseEntryDisplay difficulty 2x1"),"10" );
|
|
|
|
|
SET_XY_AND_ON_COMMAND( &m_textFoot[pn] );
|
|
|
|
|
this->AddChild( &m_textFoot[pn] );
|
2003-02-17 02:45:30 +00:00
|
|
|
|
2004-01-21 08:38:06 +00:00
|
|
|
m_textDifficultyNumber[pn].SetName( SEPARATE_COURSE_METERS? ssprintf("DifficultyP%i", pn+1):"Difficulty" );
|
|
|
|
|
m_textDifficultyNumber[pn].LoadFromFont( THEME->GetPathToF("Common normal") );
|
|
|
|
|
SET_XY_AND_ON_COMMAND( &m_textDifficultyNumber[pn] );
|
|
|
|
|
this->AddChild( &m_textDifficultyNumber[pn] );
|
|
|
|
|
}
|
2003-02-17 02:45:30 +00:00
|
|
|
|
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 08:38:06 +00:00
|
|
|
void CourseEntryDisplay::SetDifficulty( PlayerNumber pn, const CString &text, RageColor c )
|
2003-02-17 02:45:30 +00:00
|
|
|
{
|
2004-01-21 08:38:06 +00:00
|
|
|
if( !GAMESTATE->IsHumanPlayer(pn) )
|
|
|
|
|
return; // skip
|
|
|
|
|
if( !SEPARATE_COURSE_METERS && pn != GAMESTATE->m_MasterPlayerNumber )
|
|
|
|
|
return;
|
2004-01-21 06:58:01 +00:00
|
|
|
|
2004-01-21 08:38:06 +00:00
|
|
|
m_textDifficultyNumber[pn].SetText( text );
|
|
|
|
|
m_textDifficultyNumber[pn].SetDiffuse( c );
|
2004-01-21 06:58:01 +00:00
|
|
|
|
2004-01-21 08:38:06 +00:00
|
|
|
m_textFoot[pn].SetText( "1" );
|
|
|
|
|
m_textFoot[pn].SetDiffuse( c );
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-03 20:49:10 +00:00
|
|
|
void CourseEntryDisplay::LoadFromTrailEntry( int iNum, const TrailEntry *tes[NUM_PLAYERS] )
|
2004-01-21 08:38:06 +00:00
|
|
|
{
|
2004-06-03 20:49:10 +00:00
|
|
|
const TrailEntry *te = tes[GAMESTATE->m_MasterPlayerNumber];
|
2004-06-06 20:18:50 +00:00
|
|
|
if( te == NULL )
|
|
|
|
|
return;
|
2004-05-23 00:53:20 +00:00
|
|
|
bool bMystery = te->bMystery;
|
|
|
|
|
if( bMystery )
|
2004-01-21 08:38:06 +00:00
|
|
|
{
|
2004-05-23 00:53:20 +00:00
|
|
|
FOREACH_EnabledPlayer(pn)
|
2004-01-21 06:58:01 +00:00
|
|
|
{
|
2004-06-03 20:49:10 +00:00
|
|
|
const TrailEntry *te = tes[pn];
|
2004-05-25 20:33:17 +00:00
|
|
|
Difficulty dc = te->dc;
|
2004-01-21 08:38:06 +00:00
|
|
|
if( dc == DIFFICULTY_INVALID )
|
|
|
|
|
{
|
2004-05-23 00:53:20 +00:00
|
|
|
int iLow = te->iLowMeter;
|
|
|
|
|
int iHigh = te->iHighMeter;
|
|
|
|
|
SetDifficulty( pn, ssprintf(iLow==iHigh?"%d":"%d-%d", iLow, iHigh), RageColor(1,1,1,1) );
|
2004-01-21 08:38:06 +00:00
|
|
|
}
|
|
|
|
|
else
|
2004-05-23 00:53:20 +00:00
|
|
|
SetDifficulty( pn, "?", SONGMAN->GetDifficultyColor( dc ) );
|
2004-01-21 06:58:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_TextBanner.LoadFromString( "??????????", "??????????", "", "", "", "" );
|
|
|
|
|
m_TextBanner.SetDiffuse( RageColor(1,1,1,1) ); // TODO: What should this be?
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2004-05-23 00:53:20 +00:00
|
|
|
FOREACH_EnabledPlayer(pn)
|
2004-01-21 08:38:06 +00:00
|
|
|
{
|
2004-06-03 20:49:10 +00:00
|
|
|
const TrailEntry *te = tes[pn];
|
2004-06-06 20:18:50 +00:00
|
|
|
if( te == NULL )
|
|
|
|
|
continue;
|
2004-05-24 03:41:39 +00:00
|
|
|
RageColor colorNotes = SONGMAN->GetDifficultyColor( te->pSteps->GetDifficulty() );
|
|
|
|
|
SetDifficulty( pn, ssprintf("%d", te->pSteps->GetMeter()), colorNotes );
|
2004-01-21 08:38:06 +00:00
|
|
|
}
|
2004-01-21 06:58:01 +00:00
|
|
|
|
2004-05-23 00:53:20 +00:00
|
|
|
m_TextBanner.LoadFromSong( te->pSong );
|
|
|
|
|
m_TextBanner.SetDiffuse( SONGMAN->GetSongColor( te->pSong ) );
|
2004-01-21 06:58:01 +00:00
|
|
|
}
|
2003-02-17 02:45:30 +00:00
|
|
|
|
|
|
|
|
m_textNumber.SetText( ssprintf("%d", iNum) );
|
|
|
|
|
|
2004-05-23 00:53:20 +00:00
|
|
|
m_textModifiers.SetText( te->Modifiers );
|
2003-02-17 02:45:30 +00:00
|
|
|
}
|