Files
itgmania212121/stepmania/src/ScreenRanking.cpp
T

991 lines
30 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
2003-01-26 07:33:03 +00:00
#include "ScreenRanking.h"
2005-07-20 09:48:19 +00:00
#include "ScreenManager.h"
2003-01-26 07:33:03 +00:00
#include "ThemeManager.h"
#include "SongManager.h"
#include "GameState.h"
#include "GameManager.h"
2003-07-17 20:10:07 +00:00
#include "Course.h"
2003-10-15 01:44:35 +00:00
#include "song.h"
2003-12-18 03:40:57 +00:00
#include "Steps.h"
2003-09-09 03:24:34 +00:00
#include "PrefsManager.h"
2003-11-02 16:32:45 +00:00
#include "ActorUtil.h"
#include "ProfileManager.h"
2005-07-01 05:07:22 +00:00
#include "Profile.h"
2004-01-29 01:46:08 +00:00
#include "RageLog.h"
2005-02-21 06:22:46 +00:00
#include "UnlockManager.h"
#include "ScreenDimensions.h"
#include "PercentageDisplay.h"
2003-01-26 07:33:03 +00:00
static const CString PageTypeNames[] = {
2004-05-02 03:01:27 +00:00
"Category",
"Course",
"AllSteps",
"NonstopCourses",
"OniCourses",
"SurvivalCourses",
2004-05-02 03:01:27 +00:00
};
2005-03-05 21:50:33 +00:00
XToString( PageType, NUM_PAGE_TYPES );
StringToX( PageType );
2004-05-02 03:01:27 +00:00
#define TYPE THEME->GetMetric(m_sName,"Type")
2003-12-28 08:20:48 +00:00
#define COURSES_TO_SHOW PREFSMAN->m_sCoursesToShowRanking
2005-02-28 17:18:01 +00:00
#define COURSES_TO_SHOW2 THEME->GetMetric(m_sName,"CoursesToShow")
2004-01-29 01:46:08 +00:00
2003-12-28 08:20:48 +00:00
#define BULLET_X(row) (BULLET_START_X+ROW_SPACING_X*row)
#define BULLET_Y(row) (BULLET_START_Y+ROW_SPACING_Y*row)
#define NAME_X(row) (NAME_START_X+ROW_SPACING_X*row)
#define NAME_Y(row) (NAME_START_Y+ROW_SPACING_Y*row)
#define SCORE_X(row) (SCORE_START_X+ROW_SPACING_X*row)
#define SCORE_Y(row) (SCORE_START_Y+ROW_SPACING_Y*row)
#define POINTS_X(row) (POINTS_START_X+ROW_SPACING_X*row)
#define POINTS_Y(row) (POINTS_START_Y+ROW_SPACING_Y*row)
#define TIME_X(row) (TIME_START_X+ROW_SPACING_X*row)
#define TIME_Y(row) (TIME_START_Y+ROW_SPACING_Y*row)
#define DIFFICULTY_X(col) (DIFFICULTY_START_X+COL_SPACING_X*col)
#define STEPS_SCORE_OFFSET_X(col) (STEPS_SCORE_OFFSET_START_X+COL_SPACING_X*col)
2003-01-26 07:33:03 +00:00
2004-01-29 01:46:08 +00:00
#define COURSE_DIFFICULTY_X(col) (COURSE_DIFFICULTY_START_X+COL_SPACING_X*col)
#define COURSE_SCORE_OFFSET_X(col) (COURSE_SCORE_OFFSET_START_X+COL_SPACING_X*col)
AutoScreenMessage( SM_ShowNextPage )
AutoScreenMessage( SM_HidePage )
2003-01-26 20:49:05 +00:00
2003-01-26 07:33:03 +00:00
2005-04-25 22:44:32 +00:00
static void GetAllSongsToShow( vector<Song*> &vpOut, bool bShowOnlyMostRecentScores, int iNumMostRecentScoresToShow )
{
vpOut.clear();
FOREACH_CONST( Song*, SONGMAN->GetAllSongs(), s )
{
if( UNLOCKMAN->SongIsLocked(*s) )
continue; // skip
if( !(*s)->ShowInDemonstrationAndRanking() )
continue; // skip
vpOut.push_back( *s );
}
2005-04-25 22:44:32 +00:00
if( bShowOnlyMostRecentScores )
{
SongUtil::SortSongPointerArrayByTitle( vpOut );
2005-04-25 22:44:32 +00:00
SongUtil::SortByMostRecentlyPlayedForMachine( vpOut );
2005-04-26 10:28:20 +00:00
if( (int) vpOut.size() > iNumMostRecentScoresToShow )
2005-04-25 22:44:32 +00:00
vpOut.erase( vpOut.begin()+iNumMostRecentScoresToShow, vpOut.end() );
}
}
static void GetAllCoursesToShow( vector<Course*> &vpOut, CourseType ct, bool bShowOnlyMostRecentScores, int iNumMostRecentScoresToShow )
{
vpOut.clear();
vector<Course*> vpCourses;
SONGMAN->GetCourses( ct, vpCourses, false );
FOREACH_CONST( Course*, vpCourses, c)
{
if( UNLOCKMAN->CourseIsLocked(*c) )
continue; // skip
if( !(*c)->ShowInDemonstrationAndRanking() )
continue; // skip
vpOut.push_back( *c );
}
2005-04-25 22:44:32 +00:00
if( bShowOnlyMostRecentScores )
{
CourseUtil::SortCoursePointerArrayByTitle( vpOut );
2005-04-25 22:44:32 +00:00
CourseUtil::SortByMostRecentlyPlayedForMachine( vpOut );
2005-04-26 10:28:20 +00:00
if( (int) vpOut.size() > iNumMostRecentScoresToShow )
2005-04-25 22:44:32 +00:00
vpOut.erase( vpOut.begin()+iNumMostRecentScoresToShow, vpOut.end() );
}
}
2005-03-23 21:04:40 +00:00
CString STEPS_TYPE_COLOR_NAME( size_t i ) { return ssprintf("StepsTypeColor%d",int(i+1)); }
2005-02-28 17:18:01 +00:00
2004-11-26 17:28:47 +00:00
REGISTER_SCREEN_CLASS( ScreenRanking );
2005-07-29 06:17:48 +00:00
ScreenRanking::ScreenRanking( CString sClassName ) : ScreenAttract( sClassName, false/*dont reset GAMESTATE*/ ),
STEPS_TYPES_TO_SHOW (m_sName,"StepsTypesToHide"),
DIFFICULTIES_TO_SHOW (m_sName,"DifficultiesToShow"),
COURSE_DIFFICULTIES_TO_SHOW (m_sName,"CourseDifficultiesToShow"),
2005-04-25 22:44:32 +00:00
SHOW_ONLY_MOST_RECENT_SCORES (m_sName,"ShowOnlyMostRecentScores"),
NUM_MOST_RECENT_SCORES_TO_SHOW (m_sName,"NumMostRecentScoresToShow"),
2005-02-28 17:18:01 +00:00
SECONDS_PER_PAGE (m_sName,"SecondsPerPage"),
PAGE_FADE_SECONDS (m_sName,"PageFadeSeconds"),
NO_SCORE_NAME (m_sName,"NoScoreName"),
ROW_SPACING_X (m_sName,"RowSpacingX"),
ROW_SPACING_Y (m_sName,"RowSpacingY"),
COL_SPACING_X (m_sName,"ColSpacingX"),
COL_SPACING_Y (m_sName,"ColSpacingY"),
STEPS_TYPE_COLOR (m_sName,STEPS_TYPE_COLOR_NAME,5),
SONG_SCORE_ROWS_TO_SHOW (m_sName,"SongScoreRowsToShow"),
SONG_SCORE_SECONDS_PER_ROW (m_sName,"SongScoreSecondsPerRow"),
2005-02-28 18:49:17 +00:00
MANUAL_SCROLLING (m_sName,"ManualScroling"),
SHOW_SURVIVAL_TIME (m_sName,"ShowSurvivalTime"),
2005-02-28 17:18:01 +00:00
BULLET_START_X (m_sName,"BulletStartX"),
BULLET_START_Y (m_sName,"BulletStartY"),
NAME_START_X (m_sName,"NameStartX"),
NAME_START_Y (m_sName,"NameStartY"),
SCORE_START_X (m_sName,"ScoreStartX"),
SCORE_START_Y (m_sName,"ScoreStartY"),
POINTS_START_X (m_sName,"PointsStartX"),
POINTS_START_Y (m_sName,"PointsStartY"),
TIME_START_X (m_sName,"TimeStartX"),
TIME_START_Y (m_sName,"TimeStartY"),
DIFFICULTY_START_X (m_sName,"DifficultyStartX"),
DIFFICULTY_Y (m_sName,"DifficultyY"),
COURSE_DIFFICULTY_START_X (m_sName,"CourseDifficultyStartX"),
COURSE_DIFFICULTY_Y (m_sName,"CourseDifficultyY"),
SONG_TITLE_OFFSET_X (m_sName,"SongTitleOffsetX"),
SONG_TITLE_OFFSET_Y (m_sName,"SongTitleOffsetY"),
SONG_FRAME_OFFSET_X (m_sName,"SongFrameOffsetX"),
SONG_FRAME_OFFSET_Y (m_sName,"SongFrameOffsetY"),
STEPS_SCORE_OFFSET_START_X (m_sName,"StepsScoreOffsetStartX"),
STEPS_SCORE_OFFSET_Y (m_sName,"StepsScoreOffsetY"),
COURSE_SCORE_OFFSET_START_X (m_sName,"CourseListScoreOffsetStartX"),
COURSE_SCORE_OFFSET_Y (m_sName,"CourseListScoreOffsetY")
2003-01-26 07:33:03 +00:00
{
}
void ScreenRanking::Init()
{
ScreenAttract::Init();
m_PageType = StringToPageType( TYPE );
2003-12-28 08:20:48 +00:00
// init Actors for category and course
{
m_Banner.SetName( "Banner" );
m_Banner.SetHidden( true );
this->AddChild( &m_Banner );
2003-01-26 07:33:03 +00:00
2003-12-28 08:20:48 +00:00
m_sprBannerFrame.SetName( "BannerFrame" );
m_sprBannerFrame.SetHidden( true );
this->AddChild( &m_sprBannerFrame );
2003-10-20 01:06:26 +00:00
2003-12-28 08:20:48 +00:00
m_textCategory.SetName( "Category" );
2005-02-28 16:48:13 +00:00
m_textCategory.LoadFromFont( THEME->GetPathF(m_sName,"category") );
m_textCategory.SetShadowLength( 0 );
2003-12-28 08:20:48 +00:00
m_textCategory.SetHidden( true );
this->AddChild( &m_textCategory );
2003-12-18 20:26:48 +00:00
m_textCourseTitle.SetName( "CourseTitle" );
2005-02-28 16:48:13 +00:00
m_textCourseTitle.LoadFromFont( THEME->GetPathF(m_sName,"course title") );
m_textCourseTitle.SetShadowLength( 0 );
m_textCourseTitle.SetHidden( true );
this->AddChild( &m_textCourseTitle );
2003-12-28 08:20:48 +00:00
m_textStepsType.SetName( "StepsType" );
2005-02-28 16:48:13 +00:00
m_textStepsType.LoadFromFont( THEME->GetPathF(m_sName,"steps type") );
m_textStepsType.SetShadowLength( 0 );
2003-12-28 08:20:48 +00:00
m_textStepsType.SetHidden( true );
this->AddChild( &m_textStepsType );
2003-01-26 07:33:03 +00:00
2003-12-28 08:20:48 +00:00
for( int l=0; l<NUM_RANKING_LINES; l++ )
{
m_sprBullets[l].SetName( ssprintf("Bullet%d",l+1) );
2005-02-28 16:48:13 +00:00
m_sprBullets[l].Load( THEME->GetPathG( m_sName, ssprintf("bullets 1x%d",NUM_RANKING_LINES) ) );
2003-12-28 08:20:48 +00:00
m_sprBullets[l].SetState( l );
m_sprBullets[l].StopAnimating();
m_sprBullets[l].SetHidden( true );
this->AddChild( &m_sprBullets[l] );
m_textNames[l].SetName( ssprintf("Name%d",l+1) );
2005-02-28 16:48:13 +00:00
m_textNames[l].LoadFromFont( THEME->GetPathF(m_sName,"name") );
2003-12-28 08:20:48 +00:00
m_textNames[l].SetHidden( true );
this->AddChild( &m_textNames[l] );
m_textScores[l].SetName( ssprintf("Score%d",l+1) );
2005-02-28 16:48:13 +00:00
m_textScores[l].LoadFromFont( THEME->GetPathF(m_sName,"score") );
2003-12-28 08:20:48 +00:00
m_textScores[l].SetHidden( true );
this->AddChild( &m_textScores[l] );
m_textPoints[l].SetName( ssprintf("Points%d",l+1) );
2005-02-28 16:48:13 +00:00
m_textPoints[l].LoadFromFont( THEME->GetPathF(m_sName,"points") );
2003-12-28 08:20:48 +00:00
m_textPoints[l].SetHidden( true );
this->AddChild( &m_textPoints[l] );
m_textTime[l].SetName( ssprintf("Time%d",l+1) );
2005-02-28 16:48:13 +00:00
m_textTime[l].LoadFromFont( THEME->GetPathF(m_sName,"time") );
2003-12-28 08:20:48 +00:00
m_textTime[l].SetHidden( true );
this->AddChild( &m_textTime[l] );
// TODO: Think of a better way to handle this
2005-05-16 09:36:32 +00:00
if( PREFSMAN->m_sCoursesToShowRanking.Get() == "" )
PREFSMAN->m_sCoursesToShowRanking.Set( COURSES_TO_SHOW2 );
2003-12-28 08:20:48 +00:00
}
}
2003-12-28 08:20:48 +00:00
//
2003-01-26 20:49:05 +00:00
// fill m_vPagesToShow
2003-12-28 08:20:48 +00:00
//
if( m_PageType == PAGE_TYPE_CATEGORY )
2003-01-26 07:33:03 +00:00
{
for( unsigned i=0; i<STEPS_TYPES_TO_SHOW.GetValue().size(); i++ )
2003-01-26 07:33:03 +00:00
{
2003-01-26 20:49:05 +00:00
for( int c=0; c<NUM_RANKING_CATEGORIES; c++ )
2003-01-26 07:33:03 +00:00
{
2003-01-26 20:49:05 +00:00
PageToShow pts;
2004-05-02 03:01:27 +00:00
pts.type = PAGE_TYPE_CATEGORY;
pts.colorIndex = i;
2003-01-26 20:49:05 +00:00
pts.category = (RankingCategory)c;
2005-04-25 22:44:32 +00:00
pts.st = STEPS_TYPES_TO_SHOW.GetValue()[i];
2003-01-26 20:49:05 +00:00
m_vPagesToShow.push_back( pts );
2003-01-26 07:33:03 +00:00
}
}
}
{
vector<CString> asCoursePaths;
split( COURSES_TO_SHOW, ",", asCoursePaths, true );
for( unsigned i=0; i<STEPS_TYPES_TO_SHOW.GetValue().size(); i++ )
2003-01-26 07:33:03 +00:00
{
for( unsigned c=0; c<asCoursePaths.size(); c++ )
{
PageToShow pts;
2004-06-03 20:47:37 +00:00
pts.type = PAGE_TYPE_TRAIL;
pts.colorIndex = i;
2005-04-25 22:44:32 +00:00
pts.st = STEPS_TYPES_TO_SHOW.GetValue()[i];
pts.pCourse = SONGMAN->GetCourseFromPath( asCoursePaths[c] );
2004-06-03 20:47:37 +00:00
if( pts.pCourse == NULL )
continue;
2005-04-25 22:44:32 +00:00
pts.pTrail = pts.pCourse->GetTrail( pts.st );
2004-06-03 20:47:37 +00:00
if( pts.pTrail == NULL )
continue;
m_vPagesToShow.push_back( pts );
}
2003-01-26 07:33:03 +00:00
}
}
FOREACH_CONST( Difficulty, DIFFICULTIES_TO_SHOW.GetValue(), d )
{
m_sprDifficulty[*d].Load( THEME->GetPathG(m_sName,"difficulty "+DifficultyToString(*d)) );
m_sprDifficulty[*d]->SetName( ssprintf("Difficulty%d",(*d)+1) );
m_sprDifficulty[*d]->SetHidden( true );
this->AddChild( m_sprDifficulty[*d] );
}
FOREACH_CONST( CourseDifficulty, COURSE_DIFFICULTIES_TO_SHOW.GetValue(), cd )
{
m_sprCourseDifficulty[*cd].Load( THEME->GetPathG(m_sName,"CourseDifficulty "+CourseDifficultyToString(*cd)) );
m_sprCourseDifficulty[*cd]->SetName( "CourseDifficulty"+CourseDifficultyToString(*cd) );
m_sprCourseDifficulty[*cd]->SetHidden( true );
this->AddChild( m_sprCourseDifficulty[*cd] );
}
if( m_PageType == PAGE_TYPE_ALL_STEPS )
{
m_vScoreRowItem.clear();
vector<Song*> vpSongs;
2005-04-25 22:44:32 +00:00
GetAllSongsToShow( vpSongs, SHOW_ONLY_MOST_RECENT_SCORES, NUM_MOST_RECENT_SCORES_TO_SHOW );
m_vScoreRowItem.resize( vpSongs.size() );
FOREACH_CONST( Song*, vpSongs, s )
{
int i = s - vpSongs.begin();
Song *pSong = *s;
ScoreRowItem &item = m_vScoreRowItem[i];
item.m_pSong = pSong;
item.m_sprFrame.Load( THEME->GetPathG(m_sName,"song frame") );
item.m_sprFrame->SetName( "SongFrame" );
item.m_sprFrame->SetHidden( true );
item.AddChild( item.m_sprFrame );
item.m_textTitle.SetName( "SongTitle" );
item.m_textTitle.SetHidden( true );
item.m_textTitle.LoadFromFont( THEME->GetPathF(m_sName,"song title") );
item.AddChild( &item.m_textTitle );
for( int d=0; d<NUM_DIFFICULTIES; d++ )
{
item.m_textScore[d].SetName( "StepsScore" );
item.m_textScore[d].LoadFromFont( THEME->GetPathF(m_sName,"steps score") );
item.m_textScore[d].SetHidden( true );
item.AddChild( &item.m_textScore[d] );
}
}
m_ListScoreRowItems.SetName( "ListScoreRowItems" );
this->AddChild( &m_ListScoreRowItems );
if( !vpSongs.empty() )
{
for( unsigned i=0; i<STEPS_TYPES_TO_SHOW.GetValue().size(); i++ )
{
2003-12-28 08:20:48 +00:00
PageToShow pts;
2004-05-02 03:01:27 +00:00
pts.type = PAGE_TYPE_ALL_STEPS;
2003-12-28 08:20:48 +00:00
pts.colorIndex = i;
2005-04-25 22:44:32 +00:00
pts.st = STEPS_TYPES_TO_SHOW.GetValue()[i];
2003-12-28 08:20:48 +00:00
m_vPagesToShow.push_back( pts );
}
}
}
if( m_PageType == PAGE_TYPE_NONSTOP_COURSES ||
m_PageType == PAGE_TYPE_ONI_COURSES ||
m_PageType == PAGE_TYPE_SURVIVAL_COURSES )
2004-01-29 01:46:08 +00:00
{
CourseType ct = m_PageType == PAGE_TYPE_NONSTOP_COURSES? COURSE_TYPE_NONSTOP :
m_PageType == PAGE_TYPE_ONI_COURSES? COURSE_TYPE_ONI :
COURSE_TYPE_SURVIVAL;
vector<Course*> vpCourses;
GetAllCoursesToShow( vpCourses, ct, SHOW_ONLY_MOST_RECENT_SCORES, NUM_MOST_RECENT_SCORES_TO_SHOW );
2005-04-28 17:04:11 +00:00
LOG->Trace("rankings: adding %u courses", unsigned(vpCourses.size()));
m_vScoreRowItem.resize( vpCourses.size() );
FOREACH_CONST( Course*, vpCourses, c )
{
Course* pCourse = *c;
int i = c - vpCourses.begin();
ScoreRowItem &item = m_vScoreRowItem[i];
item.m_pCourse = pCourse;
item.m_sprFrame.Load( THEME->GetPathG(m_sName,"course frame") );
item.m_sprFrame->SetName( "CourseListFrame" );
item.m_sprFrame->SetHidden( true );
item.AddChild( item.m_sprFrame );
item.m_textTitle.SetName( "CourseListTitle" );
item.m_textTitle.SetHidden( true );
item.m_textTitle.LoadFromFont( THEME->GetPathF(m_sName,"course list title") );
item.AddChild( &item.m_textTitle );
FOREACH_CONST( CourseDifficulty, COURSE_DIFFICULTIES_TO_SHOW.GetValue(), cd )
{
item.m_textScore[*cd].SetName( "CourseListScore" );
item.m_textScore[*cd].LoadFromFont( THEME->GetPathF(m_sName,"course list score") );
item.m_textScore[*cd].SetHidden( true );
item.AddChild( &item.m_textScore[*cd] );
}
}
m_ListScoreRowItems.SetName( "ListScoreRowItems" );
this->AddChild( &m_ListScoreRowItems );
m_ListScoreRowItems.SetXY( SCREEN_CENTER_X, SCREEN_CENTER_Y );
if( !vpCourses.empty() )
2004-01-29 01:46:08 +00:00
{
for( unsigned i=0; i<STEPS_TYPES_TO_SHOW.GetValue().size(); i++ )
2004-01-29 01:46:08 +00:00
{
PageToShow pts;
switch( ct )
{
case COURSE_TYPE_NONSTOP: pts.type = PAGE_TYPE_NONSTOP_COURSES; break;
case COURSE_TYPE_ONI: pts.type = PAGE_TYPE_ONI_COURSES; break;
case COURSE_TYPE_SURVIVAL: pts.type = PAGE_TYPE_SURVIVAL_COURSES; break;
default: ASSERT(0);
}
2004-01-29 01:46:08 +00:00
pts.colorIndex = i;
2005-04-25 22:44:32 +00:00
pts.st = STEPS_TYPES_TO_SHOW.GetValue()[i];
2004-01-29 01:46:08 +00:00
m_vPagesToShow.push_back( pts );
}
}
}
2003-03-25 21:17:29 +00:00
this->PostScreenMessage( SM_ShowNextPage, 0.5f );
2003-01-26 07:33:03 +00:00
}
2003-12-28 08:20:48 +00:00
ScreenRanking::~ScreenRanking()
{
}
void ScreenRanking::Input( const InputEventPlus &input )
2005-02-28 18:49:17 +00:00
{
LOG->Trace( "ScreenRanking::Input()" );
// If manually scrolling, then pass the input to Scree::Input so it will call Menu*
if( (bool)MANUAL_SCROLLING )
Screen::Input( input );
2005-02-28 18:49:17 +00:00
else
ScreenAttract::Input( input );
2005-02-28 18:49:17 +00:00
}
void ScreenRanking::Scroll( int iDir )
{
float fDest = m_ListScoreRowItems.GetDestinationItem();
float fOldDest = fDest;
fDest += iDir;
2005-04-10 23:42:47 +00:00
CLAMP( fDest, (SONG_SCORE_ROWS_TO_SHOW-1)/2.0f, m_vScoreRowItem.size()-(SONG_SCORE_ROWS_TO_SHOW-1)/2.0f-1 );
2005-02-28 18:49:17 +00:00
if( fOldDest != fDest )
{
// TODO: play sound
m_ListScoreRowItems.SetDestinationItem( fDest );
m_ListScoreRowItems.SetDestinationItem( fDest );
2005-02-28 18:49:17 +00:00
}
}
void ScreenRanking::MenuStart( PlayerNumber pn )
{
if( !IsTransitioning() )
StartTransitioning( SM_GoToNextScreen );
}
void ScreenRanking::MenuBack( PlayerNumber pn )
{
if( !IsTransitioning() )
StartTransitioning( SM_GoToNextScreen );
}
2003-01-26 07:33:03 +00:00
void ScreenRanking::HandleScreenMessage( const ScreenMessage SM )
{
if( SM == SM_ShowNextPage )
2003-01-26 07:33:03 +00:00
{
2003-01-26 20:49:05 +00:00
if( m_vPagesToShow.size() > 0 )
2003-01-26 07:33:03 +00:00
{
2003-12-28 08:20:48 +00:00
float fSecsToShow = SetPage( m_vPagesToShow[0] );
2004-05-02 03:01:27 +00:00
this->SortByDrawOrder();
2003-01-26 20:49:05 +00:00
m_vPagesToShow.erase( m_vPagesToShow.begin() );
2005-02-28 18:49:17 +00:00
// If manually scrolling, don't automatically change pages.
if( !(bool)MANUAL_SCROLLING )
this->PostScreenMessage( SM_HidePage, fSecsToShow-PAGE_FADE_SECONDS );
2003-01-26 07:33:03 +00:00
}
else
{
2005-02-28 18:49:17 +00:00
StartTransitioning(SM_GoToNextScreen);
2003-01-26 07:33:03 +00:00
}
}
else if( SM == SM_HidePage )
{
2003-01-26 20:49:05 +00:00
TweenPageOffScreen();
2003-10-22 10:49:21 +00:00
this->PostScreenMessage( SM_ShowNextPage, PAGE_FADE_SECONDS );
2003-01-26 07:33:03 +00:00
}
ScreenAttract::HandleScreenMessage( SM );
}
2003-12-28 08:20:48 +00:00
float ScreenRanking::SetPage( PageToShow pts )
2003-01-26 07:33:03 +00:00
{
2005-02-28 07:17:10 +00:00
// This is going to take a while to load. Possibly longer than one frame.
// So, zero the next update so we don't skip.
SCREENMAN->ZeroNextUpdate();
2003-12-28 08:20:48 +00:00
bool bBanner = false;
bool bBannerFrame = false;
bool bShowCategory = false;
bool bShowCourseTitle = false;
2003-12-28 08:20:48 +00:00
bool bShowStepsType = false;
bool bShowBullets = false;
bool bShowNames = false;
bool bShowScores = false;
bool bShowPoints = false;
bool bShowTime = false;
bool bShowDifficulty = false;
bool bShowStepsScore = false;
2004-01-29 01:46:08 +00:00
bool bShowCourseDifficulty = false;
bool bShowCourseScore = false;
2003-10-22 09:45:23 +00:00
switch( pts.type )
{
2004-05-02 03:01:27 +00:00
case PAGE_TYPE_CATEGORY:
2003-12-28 08:20:48 +00:00
bBanner = false;
bBannerFrame = false;
bShowCategory = true;
bShowCourseTitle = false;
2003-12-28 08:20:48 +00:00
bShowStepsType = true;
bShowBullets = true;
2003-10-22 09:45:23 +00:00
bShowNames = true;
bShowScores = true;
bShowPoints = false;
bShowTime = false;
bShowDifficulty = false;
2003-12-28 08:20:48 +00:00
bShowStepsScore = false;
2003-10-22 09:45:23 +00:00
break;
2004-06-03 20:47:37 +00:00
case PAGE_TYPE_TRAIL:
2003-12-28 08:20:48 +00:00
bBanner = true;
bBannerFrame = true;
bShowCategory = false;
bShowCourseTitle = true;
2003-12-28 08:20:48 +00:00
bShowStepsType = true;
bShowBullets = true;
2003-10-22 09:45:23 +00:00
bShowNames = true;
bShowScores = !pts.pCourse->IsOni();
bShowPoints = pts.pCourse->IsOni();
bShowTime = pts.pCourse->IsOni();
bShowDifficulty = false;
2003-12-28 08:20:48 +00:00
bShowStepsScore = false;
2003-10-22 09:45:23 +00:00
break;
2004-05-02 03:01:27 +00:00
case PAGE_TYPE_ALL_STEPS:
2003-12-28 08:20:48 +00:00
bBanner = false;
bBannerFrame = false;
bShowCategory = false;
bShowCourseTitle = false;
2003-12-28 08:20:48 +00:00
bShowStepsType = true;
bShowBullets = false;
2003-10-22 09:45:23 +00:00
bShowNames = false;
bShowScores = false;
bShowPoints = false;
bShowTime = false;
bShowDifficulty = true;
2003-12-28 08:20:48 +00:00
bShowStepsScore = true;
2003-10-22 09:45:23 +00:00
break;
case PAGE_TYPE_NONSTOP_COURSES:
case PAGE_TYPE_ONI_COURSES:
case PAGE_TYPE_SURVIVAL_COURSES:
2004-01-29 01:46:08 +00:00
bShowStepsType = true;
bShowCourseScore = true;
bShowCourseDifficulty = true;
break;
2003-10-22 09:45:23 +00:00
default:
ASSERT(0);
}
2003-10-22 09:45:23 +00:00
// Reset
2003-12-28 08:20:48 +00:00
m_Banner.SetHidden( !bBanner );
if( bBanner )
{
2003-12-28 08:20:48 +00:00
m_Banner.Reset();
SET_XY_AND_ON_COMMAND( m_Banner );
}
2003-10-22 09:45:23 +00:00
2003-12-28 08:20:48 +00:00
m_sprBannerFrame.SetHidden( !bBannerFrame );
if( bBannerFrame )
{
m_sprBannerFrame.Reset();
SET_XY_AND_ON_COMMAND( m_sprBannerFrame );
}
2003-10-22 09:45:23 +00:00
2003-12-28 08:20:48 +00:00
m_textCategory.SetHidden( !bShowCategory );
if( bShowCategory )
{
m_textCategory.Reset();
SET_XY_AND_ON_COMMAND( m_textCategory );
}
m_textCourseTitle.SetHidden( !bShowCourseTitle );
if( bShowCourseTitle )
{
m_textCourseTitle.Reset();
SET_XY_AND_ON_COMMAND( m_textCourseTitle );
}
2003-12-28 08:20:48 +00:00
m_textStepsType.SetHidden( !bShowStepsType );
if( bShowStepsType )
{
m_textStepsType.Reset();
SET_XY_AND_ON_COMMAND( m_textStepsType );
}
2003-10-22 09:45:23 +00:00
2004-05-02 03:01:27 +00:00
// UGLY: We have to call AddChild every time we re-load an AutoActor
// because the internal Actor* changes.
if( (Actor*)m_sprPageType )
this->RemoveChild( m_sprPageType );
m_sprPageType.Load( THEME->GetPathG(m_sName, "PageType "+PageTypeToString(pts.type)) );
m_sprPageType->SetName( "PageType" );
this->AddChild( m_sprPageType );
SET_XY_AND_ON_COMMAND( m_sprPageType );
for( int l=0; l<NUM_RANKING_LINES; l++ )
2003-12-28 08:20:48 +00:00
{
m_sprBullets[l].SetHidden( !bShowBullets );
if( bShowBullets )
2003-10-22 09:45:23 +00:00
{
m_sprBullets[l].Reset();
m_sprBullets[l].StopAnimating();
m_sprBullets[l].SetState( l );
m_sprBullets[l].SetXY( BULLET_X(l), BULLET_Y(l) );
ON_COMMAND( m_sprBullets[l] );
}
2003-12-28 08:20:48 +00:00
m_textNames[l].SetHidden( !bShowNames );
if( bShowNames )
{
m_textNames[l].Reset();
m_textNames[l].SetXY( NAME_X(l), NAME_Y(l) );
m_textNames[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
ON_COMMAND( m_textNames[l] );
}
2003-12-28 08:20:48 +00:00
m_textScores[l].SetHidden( !bShowScores );
if( bShowScores )
{
m_textScores[l].Reset();
m_textScores[l].SetXY( SCORE_X(l), SCORE_Y(l) );
m_textScores[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
ON_COMMAND( m_textScores[l] );
}
m_textPoints[l].SetHidden( !bShowPoints );
if( bShowPoints )
{
m_textPoints[l].Reset();
m_textPoints[l].SetXY( POINTS_X(l), POINTS_Y(l) );
m_textPoints[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
ON_COMMAND( m_textPoints[l] );
}
m_textTime[l].SetHidden( !bShowTime );
if( bShowTime )
{
m_textTime[l].Reset();
m_textTime[l].SetXY( TIME_X(l), TIME_Y(l) );
m_textTime[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
ON_COMMAND( m_textTime[l] );
2003-10-22 09:45:23 +00:00
}
}
FOREACH_CONST( Difficulty, DIFFICULTIES_TO_SHOW.GetValue(), iter )
2003-10-22 09:45:23 +00:00
{
m_sprDifficulty[*iter]->SetHidden( !bShowDifficulty );
if( bShowDifficulty )
2003-10-22 09:45:23 +00:00
{
m_sprDifficulty[*iter]->SetXY( DIFFICULTY_X(*iter), DIFFICULTY_Y );
ON_COMMAND( m_sprDifficulty[*iter] );
2003-10-22 09:45:23 +00:00
}
}
2003-10-22 09:45:23 +00:00
m_ListScoreRowItems.SetVisible( bShowCourseScore || bShowStepsScore );
if( bShowStepsScore )
{
m_ListScoreRowItems.Reset();
SET_XY_AND_ON_COMMAND( m_ListScoreRowItems );
2003-12-28 08:20:48 +00:00
m_ListScoreRowItems.RemoveAllChildren();
for( unsigned i=0; i<m_vScoreRowItem.size(); i++ )
2005-04-10 23:42:47 +00:00
m_ListScoreRowItems.AddChild( &m_vScoreRowItem[i] );
m_ListScoreRowItems.Load2( (float)SONG_SCORE_ROWS_TO_SHOW, SCREEN_WIDTH, ROW_SPACING_Y, false, SONG_SCORE_SECONDS_PER_ROW, 0 );
2003-12-28 08:20:48 +00:00
if( (bool)MANUAL_SCROLLING )
{
2005-04-10 23:42:47 +00:00
m_ListScoreRowItems.SetCurrentAndDestinationItem( (SONG_SCORE_ROWS_TO_SHOW-1)/2.0f );
}
2005-02-28 18:49:17 +00:00
for( unsigned s=0; s<m_vScoreRowItem.size(); s++ )
{
ScoreRowItem &item = m_vScoreRowItem[s];
item.m_sprFrame->Reset();
item.m_sprFrame->SetXY( SONG_FRAME_OFFSET_X, SONG_FRAME_OFFSET_Y );
item.m_sprFrame->SetZTestMode( ZTEST_WRITE_ON_PASS );
ON_COMMAND( item.m_sprFrame );
item.m_textTitle.Reset();
item.m_textTitle.SetXY( SONG_TITLE_OFFSET_X, SONG_TITLE_OFFSET_Y );
item.m_textTitle.SetZTestMode( ZTEST_WRITE_ON_PASS );
ON_COMMAND( item.m_textTitle );
FOREACH_CONST( Difficulty, DIFFICULTIES_TO_SHOW.GetValue(), iter )
2003-10-22 09:45:23 +00:00
{
item.m_textScore[*iter].Reset();
item.m_textScore[*iter].SetXY( STEPS_SCORE_OFFSET_X(*iter), STEPS_SCORE_OFFSET_Y );
item.m_textScore[*iter].SetZTestMode( ZTEST_WRITE_ON_PASS );
item.m_textScore[*iter].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
ON_COMMAND( item.m_textScore[*iter] );
2003-10-22 09:45:23 +00:00
}
}
}
FOREACH_CONST( CourseDifficulty, COURSE_DIFFICULTIES_TO_SHOW.GetValue(), cd )
2004-01-29 01:46:08 +00:00
{
m_sprCourseDifficulty[*cd]->SetHidden( !bShowCourseDifficulty );
if( bShowCourseDifficulty )
2004-01-29 01:46:08 +00:00
{
m_sprCourseDifficulty[*cd]->SetXY( COURSE_DIFFICULTY_X(*cd), COURSE_DIFFICULTY_Y );
ON_COMMAND( m_sprCourseDifficulty[*cd] );
2004-01-29 01:46:08 +00:00
}
}
if( bShowCourseScore )
{
m_ListScoreRowItems.Reset();
SET_XY_AND_ON_COMMAND( m_ListScoreRowItems );
m_ListScoreRowItems.RemoveAllChildren();
for( unsigned i=0; i<m_vScoreRowItem.size(); i++ )
2005-04-10 23:42:47 +00:00
m_ListScoreRowItems.AddChild( &m_vScoreRowItem[i] );
m_ListScoreRowItems.Load2( (float)SONG_SCORE_ROWS_TO_SHOW, SCREEN_WIDTH, ROW_SPACING_Y, false, SONG_SCORE_SECONDS_PER_ROW, 0 );
2004-01-29 01:46:08 +00:00
if( (bool)MANUAL_SCROLLING )
2004-01-29 01:46:08 +00:00
{
2005-04-10 23:42:47 +00:00
m_ListScoreRowItems.SetCurrentAndDestinationItem( (SONG_SCORE_ROWS_TO_SHOW-1)/2.0f );
}
2004-01-29 01:46:08 +00:00
for( unsigned s=0; s<m_vScoreRowItem.size(); s++ )
{
ScoreRowItem &item = m_vScoreRowItem[s];
item.m_sprFrame->Reset();
item.m_sprFrame->SetXY( SONG_FRAME_OFFSET_X, SONG_FRAME_OFFSET_Y );
item.m_sprFrame->SetZTestMode( ZTEST_WRITE_ON_PASS );
ON_COMMAND( item.m_sprFrame );
2004-01-29 01:46:08 +00:00
item.m_textTitle.Reset();
item.m_textTitle.SetXY( SONG_TITLE_OFFSET_X, SONG_TITLE_OFFSET_Y );
item.m_textTitle.SetZTestMode( ZTEST_WRITE_ON_PASS );
ON_COMMAND( item.m_textTitle );
2005-03-08 01:22:50 +00:00
FOREACH_CONST( CourseDifficulty, COURSE_DIFFICULTIES_TO_SHOW.GetValue(), cd )
2004-01-29 01:46:08 +00:00
{
item.m_textScore[*cd].Reset();
item.m_textScore[*cd].SetXY( COURSE_SCORE_OFFSET_X(*cd), COURSE_SCORE_OFFSET_Y );
item.m_textScore[*cd].SetZTestMode( ZTEST_WRITE_ON_PASS );
item.m_textScore[*cd].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
ON_COMMAND( item.m_textScore[*cd] );
2004-01-29 01:46:08 +00:00
}
}
}
2003-12-28 08:20:48 +00:00
// get ranking feat list
2003-10-22 09:45:23 +00:00
2003-12-28 08:20:48 +00:00
//
2003-10-22 09:45:23 +00:00
// init page
2003-12-28 08:20:48 +00:00
//
2003-01-26 20:49:05 +00:00
switch( pts.type )
2003-01-26 07:33:03 +00:00
{
2004-05-02 03:01:27 +00:00
case PAGE_TYPE_CATEGORY:
2003-01-26 07:33:03 +00:00
{
2003-12-28 08:20:48 +00:00
m_textCategory.SetText( ssprintf("Type %c", 'A'+pts.category) );
2005-04-25 22:44:32 +00:00
m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.st) );
2003-10-22 09:45:23 +00:00
2003-01-27 02:00:38 +00:00
for( int l=0; l<NUM_RANKING_LINES; l++ )
2003-01-26 07:33:03 +00:00
{
2005-04-25 22:44:32 +00:00
HighScoreList& hsl = PROFILEMAN->GetMachineProfile()->GetCategoryHighScoreList(pts.st,pts.category);
2004-02-09 06:26:13 +00:00
HighScore hs;
2003-12-28 08:20:48 +00:00
bool bRecentHighScore = false;
2004-02-09 06:26:13 +00:00
if( l < (int)hsl.vHighScores.size() )
2003-12-28 08:20:48 +00:00
{
2004-02-09 06:26:13 +00:00
hs = hsl.vHighScores[l];
2005-08-12 01:52:01 +00:00
CString *psName = hsl.vHighScores[l].GetNameMutable();
2003-12-28 08:20:48 +00:00
bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
}
2003-12-24 23:38:56 +00:00
else
2003-12-28 08:20:48 +00:00
{
2005-08-12 01:52:01 +00:00
hs.SetName( NO_SCORE_NAME );
2003-12-28 08:20:48 +00:00
}
2004-03-08 02:50:46 +00:00
m_textNames[l].SetText( hs.GetDisplayName() );
2005-08-12 02:37:04 +00:00
m_textScores[l].SetText( ssprintf("%09i",hs.GetScore()) );
2005-02-28 17:18:01 +00:00
m_textNames[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
m_textScores[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
if( bRecentHighScore )
{
2003-03-02 01:43:33 +00:00
m_textNames[l].SetEffectGlowBlink(0.1f);
m_textScores[l].SetEffectGlowBlink(0.1f);
}
else
{
2005-07-24 03:11:03 +00:00
m_textNames[l].StopEffect();
m_textScores[l].StopEffect();
2003-01-27 02:00:38 +00:00
}
2003-01-26 07:33:03 +00:00
}
}
2003-12-28 08:20:48 +00:00
return SECONDS_PER_PAGE;
2004-06-03 20:47:37 +00:00
case PAGE_TYPE_TRAIL:
2003-01-26 07:33:03 +00:00
{
2005-05-23 00:38:09 +00:00
m_textCourseTitle.SetText( pts.pCourse->GetDisplayFullTitle() );
2003-12-28 08:20:48 +00:00
m_Banner.LoadFromCourse( pts.pCourse );
2005-04-25 22:44:32 +00:00
m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.st) );
2004-06-03 20:47:37 +00:00
const HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList( pts.pCourse, pts.pTrail );
2003-01-27 02:00:38 +00:00
for( int l=0; l<NUM_RANKING_LINES; l++ )
2003-01-26 07:33:03 +00:00
{
2004-02-09 06:26:13 +00:00
HighScore hs;
2003-12-28 08:20:48 +00:00
bool bRecentHighScore = false;
2004-02-09 06:26:13 +00:00
if( l < (int)hsl.vHighScores.size() )
2003-12-28 08:20:48 +00:00
{
2004-02-09 06:26:13 +00:00
hs = hsl.vHighScores[l];
2005-08-12 01:52:01 +00:00
const CString *psName = hsl.vHighScores[l].GetNameMutable();
2003-12-28 08:20:48 +00:00
bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
}
2003-12-24 23:38:56 +00:00
else
2003-12-28 08:20:48 +00:00
{
2005-08-12 01:52:01 +00:00
hs.SetName( NO_SCORE_NAME );
2003-12-28 08:20:48 +00:00
}
2004-02-09 06:26:13 +00:00
2004-03-08 02:50:46 +00:00
m_textNames[l].SetText( hs.GetDisplayName() );
2003-06-30 08:06:47 +00:00
if( pts.pCourse->IsOni() )
{
2005-08-12 02:37:04 +00:00
m_textPoints[l].SetText( ssprintf("%04d",hs.GetScore()) );
2005-08-12 02:46:58 +00:00
m_textTime[l].SetText( SecondsToMMSSMsMs(hs.GetSurviveSeconds()) );
2003-06-30 08:06:47 +00:00
m_textScores[l].SetText( "" );
} else {
m_textPoints[l].SetText( "" );
m_textTime[l].SetText( "" );
2005-08-12 02:37:04 +00:00
m_textScores[l].SetText( ssprintf("%09d",hs.GetScore()) );
2003-06-30 08:06:47 +00:00
}
2005-02-28 17:18:01 +00:00
m_textNames[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
m_textPoints[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
m_textTime[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
m_textScores[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
2003-12-28 08:20:48 +00:00
if( bRecentHighScore )
2003-01-27 02:00:38 +00:00
{
2003-12-28 08:20:48 +00:00
m_textNames[l].SetEffectGlowBlink(0.1f);
m_textScores[l].SetEffectGlowBlink(0.1f);
}
else
{
2005-07-24 03:11:03 +00:00
m_textNames[l].StopEffect();
m_textScores[l].StopEffect();
2003-01-27 02:00:38 +00:00
}
2003-01-26 07:33:03 +00:00
}
}
2003-12-28 08:20:48 +00:00
return SECONDS_PER_PAGE;
2004-05-02 03:01:27 +00:00
case PAGE_TYPE_ALL_STEPS:
{
2005-04-25 22:44:32 +00:00
m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.st) );
for( unsigned s=0; s<m_vScoreRowItem.size(); s++ )
{
ScoreRowItem &item = m_vScoreRowItem[s];
const Song* pSong = item.m_pSong;
2005-05-23 00:38:09 +00:00
item.m_textTitle.SetText( pSong->GetDisplayFullTitle() );
2005-06-03 01:57:57 +00:00
item.m_textTitle.SetDiffuse( SONGMAN->GetSongColor(pSong) );
FOREACH_CONST( Difficulty, DIFFICULTIES_TO_SHOW.GetValue(), iter )
2003-12-28 08:20:48 +00:00
{
2005-04-25 22:44:32 +00:00
const Steps* pSteps = pSong->GetStepsByDifficulty( pts.st, *iter, false );
2005-06-27 05:24:14 +00:00
if( pSteps && UNLOCKMAN->StepsIsLocked(pSong, pSteps) )
2005-06-27 04:48:03 +00:00
pSteps = NULL;
BitmapText* pTextStepsScore = &item.m_textScore[*iter];
if( pSteps == NULL )
{
2003-12-28 08:20:48 +00:00
pTextStepsScore->SetHidden( true );
}
else
{
HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong,pSteps);
2004-02-09 06:26:13 +00:00
HighScore hs = hsl.GetTopScore();
2003-12-28 08:20:48 +00:00
bool bRecentHighScore = false;
2004-02-09 06:26:13 +00:00
if( !hsl.vHighScores.empty() )
2003-12-28 08:20:48 +00:00
{
2004-02-09 06:26:13 +00:00
hs = hsl.GetTopScore();
2005-08-12 01:52:01 +00:00
const CString *psName = hsl.GetTopScore().GetNameMutable();
2003-12-28 08:20:48 +00:00
bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
}
2003-12-24 23:38:56 +00:00
else
2003-12-28 08:20:48 +00:00
{
2005-08-12 01:52:01 +00:00
hs.SetName( NO_SCORE_NAME );
2003-12-28 08:20:48 +00:00
}
2005-08-12 02:46:58 +00:00
CString s = hs.GetDisplayName() + "\n" + PercentageDisplay::FormatPercentScore( hs.GetPercentDP() );
if( SHOW_SURVIVAL_TIME )
s += " " + SecondsToMSSMsMs(hs.GetSurvivalSeconds());
2003-12-28 08:20:48 +00:00
pTextStepsScore->SetText( s );
}
}
}
}
2003-12-28 08:20:48 +00:00
return m_ListScoreRowItems.GetSecondsForCompleteScrollThrough();
case PAGE_TYPE_NONSTOP_COURSES:
case PAGE_TYPE_ONI_COURSES:
case PAGE_TYPE_SURVIVAL_COURSES:
2004-01-29 01:46:08 +00:00
{
2005-04-25 22:44:32 +00:00
m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.st) );
2004-01-29 01:46:08 +00:00
for( unsigned c=0; c<m_vScoreRowItem.size(); c++ )
2004-01-29 01:46:08 +00:00
{
ScoreRowItem &item = m_vScoreRowItem[c];
const Course* pCourse = item.m_pCourse;
2004-01-29 01:46:08 +00:00
2005-05-23 00:38:09 +00:00
item.m_textTitle.SetText( pCourse->GetDisplayFullTitle() );
2005-06-03 01:57:57 +00:00
item.m_textTitle.SetDiffuse( SONGMAN->GetCourseColor(pCourse) );
FOREACH_CONST( CourseDifficulty, COURSE_DIFFICULTIES_TO_SHOW.GetValue(), cd )
2004-01-29 01:46:08 +00:00
{
BitmapText* pTextStepsScore = &item.m_textScore[*cd];
2004-06-03 20:47:37 +00:00
Trail *pTrail = pCourse->GetTrail( pts.st, *cd );
2004-06-03 20:47:37 +00:00
pTextStepsScore->SetHidden( pTrail==NULL );
if( pTrail == NULL )
continue;
2004-05-23 09:17:10 +00:00
const HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList( pCourse, pTrail );
2004-01-29 01:46:08 +00:00
2004-02-09 06:26:13 +00:00
HighScore hs;
2004-01-29 01:46:08 +00:00
bool bRecentHighScore = false;
2004-02-09 06:26:13 +00:00
if( !hsl.vHighScores.empty() )
2004-01-29 01:46:08 +00:00
{
2004-02-09 06:26:13 +00:00
hs = hsl.vHighScores[0];
2005-08-12 01:52:01 +00:00
const CString *psName = hsl.GetTopScore().GetNameMutable();
2004-01-29 01:46:08 +00:00
bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
}
else
{
2005-08-12 01:52:01 +00:00
hs.SetName( NO_SCORE_NAME );
2004-01-29 01:46:08 +00:00
}
2005-08-12 02:46:58 +00:00
CString s = hs.GetDisplayName() + "\n" + PercentageDisplay::FormatPercentScore( hs.GetPercentDP() );
if( SHOW_SURVIVAL_TIME )
s += " " + SecondsToMSSMsMs(hs.GetSurvivalSeconds());
2004-01-29 01:46:08 +00:00
pTextStepsScore->SetText( s );
}
}
}
return m_ListScoreRowItems.GetSecondsForCompleteScrollThrough();
2003-01-26 07:33:03 +00:00
default:
ASSERT(0);
2003-12-28 08:20:48 +00:00
return 0;
2003-01-26 07:33:03 +00:00
}
2003-01-26 20:49:05 +00:00
}
void ScreenRanking::TweenPageOffScreen()
{
2003-12-28 08:20:48 +00:00
OFF_COMMAND( m_Banner );
2003-12-18 20:26:48 +00:00
OFF_COMMAND( m_sprBannerFrame );
OFF_COMMAND( m_textCourseTitle );
2003-11-02 16:32:45 +00:00
OFF_COMMAND( m_textCategory );
2003-12-28 08:20:48 +00:00
OFF_COMMAND( m_textStepsType );
2004-05-02 03:01:27 +00:00
OFF_COMMAND( m_sprPageType );
2003-10-22 09:45:23 +00:00
2003-12-28 08:20:48 +00:00
for( int l=0; l<NUM_RANKING_LINES; l++ )
2003-01-26 07:33:03 +00:00
{
2003-12-28 08:20:48 +00:00
OFF_COMMAND( m_sprBullets[l] );
OFF_COMMAND( m_textNames[l] );
OFF_COMMAND( m_textScores[l] );
OFF_COMMAND( m_textPoints[l] );
OFF_COMMAND( m_textTime[l] );
}
FOREACH_CONST( Difficulty, DIFFICULTIES_TO_SHOW.GetValue(), iter )
2003-12-28 08:20:48 +00:00
{
if( !m_sprDifficulty[*iter]->GetHidden() )
OFF_COMMAND( m_sprDifficulty[*iter] );
2003-01-26 07:33:03 +00:00
}
FOREACH_CONST( CourseDifficulty, COURSE_DIFFICULTIES_TO_SHOW.GetValue(), cd )
2004-01-29 09:24:56 +00:00
{
if( !m_sprCourseDifficulty[*cd]->GetHidden() )
OFF_COMMAND( m_sprCourseDifficulty[*cd] );
2004-01-29 09:24:56 +00:00
}
if( !m_ListScoreRowItems.GetHidden() )
OFF_COMMAND( m_ListScoreRowItems );
2003-01-26 07:33:03 +00:00
}
2004-06-08 05:22:33 +00:00
/*
* (c) 2001-2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/