Files
itgmania212121/stepmania/src/ScreenRanking.cpp
T

976 lines
31 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"
#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"
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"
2003-01-26 07:33:03 +00:00
2004-05-02 03:01:27 +00:00
static const CString PageTypeNames[NUM_PAGE_TYPES] = {
"Category",
"Course",
"AllSteps",
"AllCourses",
};
2005-03-05 21:50:33 +00:00
XToString( PageType, NUM_PAGE_TYPES );
2004-05-02 03:01:27 +00:00
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)
const AutoScreenMessage SM_ShowNextPage;
const AutoScreenMessage SM_HidePage;
2003-01-26 20:49:05 +00:00
2003-01-26 07:33:03 +00:00
2005-02-28 17:18:01 +00:00
CString STEPS_TYPE_COLOR_NAME( size_t i ) { return ssprintf("StepsTypeColor%d",i+1); }
2004-11-26 17:28:47 +00:00
REGISTER_SCREEN_CLASS( ScreenRanking );
2005-02-28 17:18:01 +00:00
ScreenRanking::ScreenRanking( CString sClassName ) : ScreenAttract( sClassName ),
STEPS_TYPES_TO_HIDE (m_sName,"StepsTypesToHide"),
SHOW_CATEGORIES (m_sName,"ShowCategories"),
SHOW_ALL_STEPS_SCORES (m_sName,"ShowAllStepsScores"),
SHOW_ALL_COURSE_SCORES (m_sName,"ShowAllCourseScores"),
DIFFICULTIES_TO_SHOW (m_sName,"DifficultiesToShow"),
SECONDS_PER_PAGE (m_sName,"SecondsPerPage"),
PAGE_FADE_SECONDS (m_sName,"PageFadeSeconds"),
PERCENT_DECIMAL_PLACES (m_sName,"PercentDecimalPlaces"),
PERCENT_TOTAL_SIZE (m_sName,"PercentTotalSize"),
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"),
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();
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
if( PREFSMAN->m_sCoursesToShowRanking == "" )
2005-02-28 17:18:01 +00:00
PREFSMAN->m_sCoursesToShowRanking = COURSES_TO_SHOW2;
2003-12-28 08:20:48 +00:00
}
}
// make the list of difficulties to show
{
2003-12-28 08:20:48 +00:00
vector<CString> sShowDiffs;
split( DIFFICULTIES_TO_SHOW, ",", sShowDiffs, true );
for( vector<CString>::const_iterator iter = sShowDiffs.begin(); iter != sShowDiffs.end(); iter++ )
{
m_vDiffsToShow.push_back( StringToDifficulty( *iter ) );
}
}
2003-12-28 08:20:48 +00:00
// init Actors for all_steps
2003-01-26 07:33:03 +00:00
{
2004-06-11 08:52:41 +00:00
FOREACH_Difficulty( d )
2003-12-28 08:20:48 +00:00
{
bool bShowThis = find(m_vDiffsToShow.begin(), m_vDiffsToShow.end(), d) != m_vDiffsToShow.end();
if( !bShowThis )
continue; // skip
2004-06-11 08:52:41 +00:00
m_sprDifficulty[d].Load( THEME->GetPathG(m_sName,"difficulty "+DifficultyToString(d)) );
m_sprDifficulty[d]->SetName( ssprintf("Difficulty%d",d) );
m_sprDifficulty[d]->SetHidden( true );
this->AddChild( m_sprDifficulty[d] );
2003-12-28 08:20:48 +00:00
}
2004-01-29 09:24:56 +00:00
const unsigned num_songs = SONGMAN->GetAllSongs().size();
2003-12-28 23:03:58 +00:00
for( unsigned s=0; s<num_songs; s++ )
2003-12-28 08:20:48 +00:00
{
2004-01-29 09:24:56 +00:00
Song *pSong = SONGMAN->GetAllSongs()[s];
2004-02-21 01:06:35 +00:00
if( UNLOCKMAN->SongIsLocked(pSong) )
2004-01-29 09:24:56 +00:00
continue;
if( !pSong->ShowInDemonstrationAndRanking() )
2004-06-11 08:52:41 +00:00
continue;
2004-01-29 09:24:56 +00:00
2003-12-28 08:20:48 +00:00
StepsScoreRowItem* pStepsScoreRowItem = new StepsScoreRowItem;
2004-01-29 09:24:56 +00:00
pStepsScoreRowItem ->m_pSong = pSong;
2003-01-26 07:33:03 +00:00
2003-12-28 08:20:48 +00:00
pStepsScoreRowItem->m_sprSongFrame.SetName( "SongFrame" );
pStepsScoreRowItem->m_sprSongFrame.SetHidden( true );
2005-02-28 16:48:13 +00:00
pStepsScoreRowItem->m_sprSongFrame.Load( THEME->GetPathG(m_sName,"song frame") );
2003-12-28 08:20:48 +00:00
pStepsScoreRowItem->AddChild( &pStepsScoreRowItem->m_sprSongFrame );
2003-01-26 07:33:03 +00:00
2003-12-28 08:20:48 +00:00
pStepsScoreRowItem->m_textSongTitle.SetName( "SongTitle" );
pStepsScoreRowItem->m_textSongTitle.SetHidden( true );
2005-02-28 16:48:13 +00:00
pStepsScoreRowItem->m_textSongTitle.LoadFromFont( THEME->GetPathF(m_sName,"song title") );
2003-12-28 08:20:48 +00:00
pStepsScoreRowItem->AddChild( &pStepsScoreRowItem->m_textSongTitle );
2003-12-28 08:20:48 +00:00
for( int d=0; d<NUM_DIFFICULTIES; d++ )
{
pStepsScoreRowItem->m_textStepsScore[d].SetName( "StepsScore" );
2005-02-28 16:48:13 +00:00
pStepsScoreRowItem->m_textStepsScore[d].LoadFromFont( THEME->GetPathF(m_sName,"steps score") );
2003-12-28 08:20:48 +00:00
pStepsScoreRowItem->m_textStepsScore[d].SetHidden( true );
pStepsScoreRowItem->AddChild( &pStepsScoreRowItem->m_textStepsScore[d] );
}
2003-12-28 08:20:48 +00:00
m_vpStepsScoreRowItem.push_back( pStepsScoreRowItem );
}
2003-12-28 08:20:48 +00:00
m_ListScoreRowItems.SetName( "ListScoreRowItems" );
this->AddChild( &m_ListScoreRowItems );
}
2004-01-29 01:46:08 +00:00
{
// for all_courses:
2004-05-20 22:27:45 +00:00
FOREACH_ShownCourseDifficulty(d)
2004-01-29 01:46:08 +00:00
{
CString cd = CourseDifficultyToString(d);
2004-06-11 08:52:41 +00:00
m_sprCourseDifficulty[d].Load( THEME->GetPathG(m_sName,"CourseDifficulty "+cd) );
m_sprCourseDifficulty[d]->SetName( ssprintf("CourseDifficulty%s",cd.c_str()) );
m_sprCourseDifficulty[d]->SetHidden( true );
this->AddChild( m_sprCourseDifficulty[d] );
2004-01-29 01:46:08 +00:00
}
vector<Course*> courses;
SONGMAN->GetAllCourses( courses, false );
2004-02-17 18:16:26 +00:00
LOG->Trace("rankings: adding %u courses", unsigned(courses.size()));
2004-01-29 01:46:08 +00:00
for( unsigned s=0; s<courses.size(); s++ )
{
2004-02-21 01:06:35 +00:00
if( UNLOCKMAN->CourseIsLocked(courses[s]) )
2004-01-29 09:24:56 +00:00
continue;
2004-01-29 01:46:08 +00:00
2004-01-29 09:24:56 +00:00
CourseScoreRowItem* pCourseScoreRowItem = new CourseScoreRowItem;
pCourseScoreRowItem->m_pCourse = courses[s];
2004-01-29 01:46:08 +00:00
2004-01-29 09:24:56 +00:00
pCourseScoreRowItem->m_sprSongFrame.SetName( "CourseListFrame" );
pCourseScoreRowItem->m_sprSongFrame.SetHidden( true );
2005-02-28 16:48:13 +00:00
pCourseScoreRowItem->m_sprSongFrame.Load( THEME->GetPathG(m_sName,"course frame") );
2004-01-29 09:24:56 +00:00
pCourseScoreRowItem->AddChild( &pCourseScoreRowItem->m_sprSongFrame );
pCourseScoreRowItem->m_textSongTitle.SetName( "CourseListTitle" );
pCourseScoreRowItem->m_textSongTitle.SetHidden( true );
2005-02-28 16:48:13 +00:00
pCourseScoreRowItem->m_textSongTitle.LoadFromFont( THEME->GetPathF(m_sName,"course list title") );
2004-01-29 09:24:56 +00:00
pCourseScoreRowItem->AddChild( &pCourseScoreRowItem->m_textSongTitle );
2004-01-29 01:46:08 +00:00
2004-05-20 22:27:45 +00:00
FOREACH_ShownCourseDifficulty(d)
2004-01-29 01:46:08 +00:00
{
2004-01-29 09:24:56 +00:00
pCourseScoreRowItem->m_textStepsScore[d].SetName( "CourseListScore" );
2005-02-28 16:48:13 +00:00
pCourseScoreRowItem->m_textStepsScore[d].LoadFromFont( THEME->GetPathF(m_sName,"course list score") );
2004-01-29 09:24:56 +00:00
pCourseScoreRowItem->m_textStepsScore[d].SetHidden( true );
pCourseScoreRowItem->AddChild( &pCourseScoreRowItem->m_textStepsScore[d] );
2004-01-29 01:46:08 +00:00
}
2004-01-29 09:24:56 +00:00
m_vpCourseScoreRowItem.push_back( pCourseScoreRowItem );
2004-01-29 01:46:08 +00:00
}
m_ListCourseRowItems.SetName( "ListCourseRowItems" );
this->AddChild( &m_ListCourseRowItems );
2004-11-05 06:35:10 +00:00
m_ListCourseRowItems.SetXY( SCREEN_CENTER_X, SCREEN_CENTER_Y );
2004-01-29 01:46:08 +00:00
}
2003-12-28 08:20:48 +00:00
// calculate which StepsTypes to show
vector<StepsType> aStepsTypesToShow;
2003-01-26 07:33:03 +00:00
{
GAMEMAN->GetStepsTypesForGame( GAMESTATE->m_pCurGame, aStepsTypesToShow );
2003-12-28 08:20:48 +00:00
// subtract hidden StepsTypes
2003-01-26 20:49:05 +00:00
{
2003-12-28 08:20:48 +00:00
vector<CString> asStepsTypesToHide;
split( STEPS_TYPES_TO_HIDE, ",", asStepsTypesToHide, true );
for( unsigned i=0; i<asStepsTypesToHide.size(); i++ )
2003-01-26 20:49:05 +00:00
{
2004-07-12 02:19:24 +00:00
StepsType st = GameManager::StringToStepsType(asStepsTypesToHide[i]);
if( st != STEPS_TYPE_INVALID )
2003-12-28 08:20:48 +00:00
{
const vector<StepsType>::iterator iter = find( aStepsTypesToShow.begin(), aStepsTypesToShow.end(), st );
2003-12-28 08:20:48 +00:00
if( iter != aStepsTypesToShow.end() )
aStepsTypesToShow.erase( iter );
}
2003-01-26 20:49:05 +00:00
}
}
2003-01-26 07:33:03 +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
//
2003-01-26 07:33:03 +00:00
if( SHOW_CATEGORIES )
{
2003-12-28 08:20:48 +00:00
for( unsigned i=0; i<aStepsTypesToShow.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;
2003-12-28 08:20:48 +00:00
pts.nt = aStepsTypesToShow[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 );
2003-12-28 08:20:48 +00:00
for( unsigned i=0; i<aStepsTypesToShow.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;
2003-12-28 08:20:48 +00:00
pts.nt = aStepsTypesToShow[i];
pts.pCourse = SONGMAN->GetCourseFromPath( asCoursePaths[c] );
2004-06-03 20:47:37 +00:00
if( pts.pCourse == NULL )
continue;
pts.pTrail = pts.pCourse->GetTrail( pts.nt );
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
}
}
2003-12-28 08:20:48 +00:00
if( SHOW_ALL_STEPS_SCORES )
{
vector<Song*> vpSongs = SONGMAN->GetAllSongs();
if( !vpSongs.empty() )
{
2003-12-28 08:20:48 +00:00
for( unsigned i=0; i<aStepsTypesToShow.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;
pts.nt = aStepsTypesToShow[i];
m_vPagesToShow.push_back( pts );
}
}
}
2004-01-29 01:46:08 +00:00
if( SHOW_ALL_COURSE_SCORES )
{
vector<Course*> courses;
SONGMAN->GetAllCourses( courses, false );
if( !courses.empty() )
{
for( unsigned i=0; i<aStepsTypesToShow.size(); i++ )
{
PageToShow pts;
2004-05-02 03:01:27 +00:00
pts.type = PAGE_TYPE_ALL_COURSES;
2004-01-29 01:46:08 +00:00
pts.colorIndex = i;
pts.nt = aStepsTypesToShow[i];
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()
{
// delete dynamically allocated members
2004-01-29 01:46:08 +00:00
for( unsigned s=0; s<m_vpStepsScoreRowItem.size(); s++ )
2003-12-28 08:20:48 +00:00
delete m_vpStepsScoreRowItem[s];
2004-01-29 01:46:08 +00:00
for( unsigned c=0; c<m_vpCourseScoreRowItem.size(); c++ )
delete m_vpCourseScoreRowItem[c];
2003-12-28 08:20:48 +00:00
}
2005-02-28 18:49:17 +00:00
void ScreenRanking::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
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( DeviceI, type, GameI, MenuI, StyleI );
else
ScreenAttract::Input( DeviceI, type, GameI, MenuI, StyleI );
}
void ScreenRanking::Scroll( int iDir )
{
float fDest = m_ListScoreRowItems.GetDestinationItem();
float fOldDest = fDest;
fDest += iDir;
CLAMP( fDest, 0.0f, (float)m_vpStepsScoreRowItem.size()-SONG_SCORE_ROWS_TO_SHOW );
if( fOldDest != fDest )
{
// TODO: play sound
m_ListScoreRowItems.SetDestinationItem( fDest );
2005-03-08 01:22:50 +00:00
m_ListCourseRowItems.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;
2004-05-02 03:01:27 +00:00
case PAGE_TYPE_ALL_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 );
2003-12-28 08:20:48 +00:00
{
for( int l=0; l<NUM_RANKING_LINES; l++ )
2003-10-22 09:45:23 +00:00
{
2003-12-28 08:20:48 +00:00
m_sprBullets[l].SetHidden( !bShowBullets );
if( bShowBullets )
{
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] );
}
m_textNames[l].SetHidden( !bShowNames );
if( bShowNames )
{
m_textNames[l].Reset();
m_textNames[l].SetXY( NAME_X(l), NAME_Y(l) );
2005-02-28 17:18:01 +00:00
m_textNames[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
2003-12-28 08:20:48 +00:00
ON_COMMAND( m_textNames[l] );
}
m_textScores[l].SetHidden( !bShowScores );
if( bShowScores )
{
m_textScores[l].Reset();
m_textScores[l].SetXY( SCORE_X(l), SCORE_Y(l) );
2005-02-28 17:18:01 +00:00
m_textScores[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
2003-12-28 08:20:48 +00:00
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) );
2005-02-28 17:18:01 +00:00
m_textPoints[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
2003-12-28 08:20:48 +00:00
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) );
2005-02-28 17:18:01 +00:00
m_textTime[l].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
2003-12-28 08:20:48 +00:00
ON_COMMAND( m_textTime[l] );
}
2003-10-22 09:45:23 +00:00
}
}
{
2003-12-28 08:20:48 +00:00
for( vector<Difficulty>::iterator dc_iter=m_vDiffsToShow.begin(); dc_iter!=m_vDiffsToShow.end(); dc_iter++ )
2003-10-22 09:45:23 +00:00
{
2004-06-11 08:52:41 +00:00
m_sprDifficulty[*dc_iter]->SetHidden( !bShowDifficulty );
2003-12-28 08:20:48 +00:00
if( bShowDifficulty )
{
2004-06-11 08:52:41 +00:00
m_sprDifficulty[*dc_iter]->Reset();
m_sprDifficulty[*dc_iter]->SetXY( DIFFICULTY_X(*dc_iter), DIFFICULTY_Y );
2003-12-28 08:20:48 +00:00
ON_COMMAND( m_sprDifficulty[*dc_iter] );
}
2003-10-22 09:45:23 +00:00
}
2003-12-28 08:20:48 +00:00
m_ListScoreRowItems.SetHidden( !bShowStepsScore );
if( bShowStepsScore )
2003-10-22 09:45:23 +00:00
{
2003-12-28 08:20:48 +00:00
m_ListScoreRowItems.Reset();
SET_XY_AND_ON_COMMAND( m_ListScoreRowItems );
vector<Actor*> vpActors;
2003-12-28 23:03:58 +00:00
for( unsigned i=0; i<m_vpStepsScoreRowItem.size(); i++ )
2003-12-28 08:20:48 +00:00
vpActors.push_back( m_vpStepsScoreRowItem[i] );
2003-12-31 07:20:05 +00:00
m_ListScoreRowItems.Load( vpActors, SONG_SCORE_ROWS_TO_SHOW, SCREEN_WIDTH, ROW_SPACING_Y, false, SONG_SCORE_SECONDS_PER_ROW, 0, false );
2003-12-28 08:20:48 +00:00
2005-02-28 18:49:17 +00:00
if( (bool)MANUAL_SCROLLING )
{
m_ListScoreRowItems.SetCurrentItem( 0 );
m_ListScoreRowItems.SetDestinationItem( 0 );
}
2004-01-29 09:24:56 +00:00
for( unsigned s=0; s<m_vpStepsScoreRowItem.size(); s++ )
2003-10-22 09:45:23 +00:00
{
2003-12-28 08:20:48 +00:00
StepsScoreRowItem *pStepsScoreRowItems = m_vpStepsScoreRowItem[s];
pStepsScoreRowItems->m_sprSongFrame.Reset();
pStepsScoreRowItems->m_sprSongFrame.SetXY( SONG_FRAME_OFFSET_X, SONG_FRAME_OFFSET_Y );
pStepsScoreRowItems->m_sprSongFrame.SetUseZBuffer( true );
ON_COMMAND( pStepsScoreRowItems->m_sprSongFrame );
pStepsScoreRowItems->m_textSongTitle.Reset();
pStepsScoreRowItems->m_textSongTitle.SetXY( SONG_TITLE_OFFSET_X, SONG_TITLE_OFFSET_Y );
pStepsScoreRowItems->m_textSongTitle.SetUseZBuffer( true );
ON_COMMAND( pStepsScoreRowItems->m_textSongTitle );
for( vector<Difficulty>::iterator dc_iter=m_vDiffsToShow.begin(); dc_iter!=m_vDiffsToShow.end(); dc_iter++ )
{
pStepsScoreRowItems->m_textStepsScore[*dc_iter].Reset();
pStepsScoreRowItems->m_textStepsScore[*dc_iter].SetXY( STEPS_SCORE_OFFSET_X(*dc_iter), STEPS_SCORE_OFFSET_Y );
pStepsScoreRowItems->m_textStepsScore[*dc_iter].SetUseZBuffer( true );
2005-02-28 17:18:01 +00:00
pStepsScoreRowItems->m_textStepsScore[*dc_iter].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
2003-12-28 08:20:48 +00:00
ON_COMMAND( pStepsScoreRowItems->m_textStepsScore[*dc_iter] );
}
2003-10-22 09:45:23 +00:00
}
}
}
2004-01-29 01:46:08 +00:00
{
2004-05-20 22:27:45 +00:00
FOREACH_ShownCourseDifficulty(d)
2004-01-29 01:46:08 +00:00
{
2004-06-11 08:52:41 +00:00
m_sprCourseDifficulty[d]->SetHidden( !bShowCourseDifficulty );
2004-01-29 01:46:08 +00:00
if( bShowCourseDifficulty )
{
2004-06-11 08:52:41 +00:00
m_sprCourseDifficulty[d]->Reset();
m_sprCourseDifficulty[d]->SetXY( COURSE_DIFFICULTY_X(d), COURSE_DIFFICULTY_Y );
2004-01-29 01:46:08 +00:00
ON_COMMAND( m_sprCourseDifficulty[d] );
}
}
m_ListCourseRowItems.SetHidden( !bShowCourseScore );
if( bShowCourseScore )
{
m_ListCourseRowItems.Reset();
SET_XY_AND_ON_COMMAND( m_ListCourseRowItems );
vector<Actor*> vpActors;
for( unsigned i=0; i<m_vpCourseScoreRowItem.size(); i++ )
vpActors.push_back( m_vpCourseScoreRowItem[i] );
m_ListCourseRowItems.Load( vpActors, SONG_SCORE_ROWS_TO_SHOW, SCREEN_WIDTH, ROW_SPACING_Y, false, SONG_SCORE_SECONDS_PER_ROW, 0, false );
2005-03-08 01:22:50 +00:00
if( (bool)MANUAL_SCROLLING )
{
m_ListCourseRowItems.SetCurrentItem( 0 );
m_ListCourseRowItems.SetDestinationItem( 0 );
}
2004-01-29 09:24:56 +00:00
for( unsigned s=0; s<m_vpCourseScoreRowItem.size(); s++ )
2004-01-29 01:46:08 +00:00
{
2004-01-29 09:24:56 +00:00
CourseScoreRowItem *pCourseScoreRowItem = m_vpCourseScoreRowItem[s];
pCourseScoreRowItem->m_sprSongFrame.Reset();
pCourseScoreRowItem->m_sprSongFrame.SetXY( SONG_FRAME_OFFSET_X, SONG_FRAME_OFFSET_Y );
pCourseScoreRowItem->m_sprSongFrame.SetUseZBuffer( true );
ON_COMMAND( pCourseScoreRowItem->m_sprSongFrame );
2004-01-29 01:46:08 +00:00
2004-01-29 09:24:56 +00:00
pCourseScoreRowItem->m_textSongTitle.Reset();
pCourseScoreRowItem->m_textSongTitle.SetXY( SONG_TITLE_OFFSET_X, SONG_TITLE_OFFSET_Y );
pCourseScoreRowItem->m_textSongTitle.SetUseZBuffer( true );
ON_COMMAND( pCourseScoreRowItem->m_textSongTitle );
2004-01-29 01:46:08 +00:00
2004-05-20 22:27:45 +00:00
FOREACH_ShownCourseDifficulty(d)
2004-01-29 01:46:08 +00:00
{
2004-01-29 09:24:56 +00:00
pCourseScoreRowItem->m_textStepsScore[d].Reset();
pCourseScoreRowItem->m_textStepsScore[d].SetXY( COURSE_SCORE_OFFSET_X(d), COURSE_SCORE_OFFSET_Y );
pCourseScoreRowItem->m_textStepsScore[d].SetUseZBuffer( true );
2005-02-28 17:18:01 +00:00
pCourseScoreRowItem->m_textStepsScore[d].SetDiffuse( STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
2004-01-29 09:24:56 +00:00
ON_COMMAND( pCourseScoreRowItem->m_textStepsScore[d] );
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) );
2004-07-12 02:19:24 +00:00
m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.nt) );
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
{
2004-02-09 06:26:13 +00:00
HighScoreList& hsl = PROFILEMAN->GetMachineProfile()->GetCategoryHighScoreList(pts.nt,pts.category);
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];
CString *psName = &hsl.vHighScores[l].sName;
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
{
hs.sName = NO_SCORE_NAME;
}
2004-03-08 02:50:46 +00:00
m_textNames[l].SetText( hs.GetDisplayName() );
m_textScores[l].SetText( ssprintf("%09i",hs.iScore) );
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
{
m_textNames[l].SetEffectNone();
m_textScores[l].SetEffectNone();
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
{
2004-07-11 10:02:38 +00:00
m_textCourseTitle.SetText( pts.pCourse->GetFullDisplayTitle() );
2003-12-28 08:20:48 +00:00
m_Banner.LoadFromCourse( pts.pCourse );
2004-07-12 02:19:24 +00:00
m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.nt) );
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];
const CString *psName = &hsl.vHighScores[l].sName;
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
{
hs.sName = NO_SCORE_NAME;
}
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() )
{
m_textPoints[l].SetText( ssprintf("%04d",hs.iScore) );
2004-02-22 19:51:46 +00:00
m_textTime[l].SetText( SecondsToMMSSMsMs(hs.fSurviveSeconds) );
2003-06-30 08:06:47 +00:00
m_textScores[l].SetText( "" );
} else {
m_textPoints[l].SetText( "" );
m_textTime[l].SetText( "" );
m_textScores[l].SetText( ssprintf("%09d",hs.iScore) );
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
{
m_textNames[l].SetEffectNone();
m_textScores[l].SetEffectNone();
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:
{
2004-07-12 02:19:24 +00:00
m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.nt) );
2004-01-29 09:24:56 +00:00
for( unsigned s=0; s<m_vpStepsScoreRowItem.size(); s++ )
{
2003-12-28 08:20:48 +00:00
StepsScoreRowItem *pStepsScoreRowItem = m_vpStepsScoreRowItem[s];
2004-01-29 09:24:56 +00:00
const Song* pSong = pStepsScoreRowItem->m_pSong;
2003-12-28 08:20:48 +00:00
pStepsScoreRowItem->m_textSongTitle.SetText( pSong->GetFullDisplayTitle() );
2003-12-28 08:20:48 +00:00
for( vector<Difficulty>::iterator dc_iter = m_vDiffsToShow.begin(); dc_iter != m_vDiffsToShow.end(); dc_iter++ )
{
2004-01-20 23:57:22 +00:00
const Steps* pSteps = pSong->GetStepsByDifficulty( pts.nt, *dc_iter, false );
2003-12-28 08:20:48 +00:00
BitmapText* pTextStepsScore = &pStepsScoreRowItem->m_textStepsScore[*dc_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();
const CString *psName = &hsl.GetTopScore().sName;
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
{
hs.sName = NO_SCORE_NAME;
}
2003-11-30 02:20:05 +00:00
CString s;
2004-03-08 02:50:46 +00:00
s = hs.GetDisplayName() + "\n";
2005-02-28 17:23:28 +00:00
s += ssprintf( "%0*.*f%%", PERCENT_TOTAL_SIZE.GetValue(), PERCENT_DECIMAL_PLACES.GetValue(), hs.fPercentDP*100 );
2003-12-28 08:20:48 +00:00
pTextStepsScore->SetText( s );
}
}
}
}
2003-12-28 08:20:48 +00:00
return m_ListScoreRowItems.GetSecondsForCompleteScrollThrough();
2004-05-02 03:01:27 +00:00
case PAGE_TYPE_ALL_COURSES:
2004-01-29 01:46:08 +00:00
{
2004-07-12 02:19:24 +00:00
m_textStepsType.SetText( GameManager::StepsTypeToThemedString(pts.nt) );
2004-01-29 01:46:08 +00:00
2004-01-29 09:24:56 +00:00
for( unsigned c=0; c<m_vpCourseScoreRowItem.size(); c++ )
2004-01-29 01:46:08 +00:00
{
2004-01-29 09:24:56 +00:00
CourseScoreRowItem *pCourseScoreRowItem = m_vpCourseScoreRowItem[c];
const Course* pCourse = pCourseScoreRowItem->m_pCourse;
2004-01-29 01:46:08 +00:00
2004-07-11 10:02:38 +00:00
pCourseScoreRowItem->m_textSongTitle.SetText( pCourse->GetFullDisplayTitle() );
2004-05-20 22:27:45 +00:00
FOREACH_ShownCourseDifficulty( cd )
2004-01-29 01:46:08 +00:00
{
2004-06-03 20:47:37 +00:00
BitmapText* pTextStepsScore = &pCourseScoreRowItem->m_textStepsScore[cd];
2004-05-23 09:17:10 +00:00
Trail *pTrail = pCourse->GetTrail( pts.nt, 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];
const CString *psName = &hsl.GetTopScore().sName;
2004-01-29 01:46:08 +00:00
bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
}
else
{
hs.sName = NO_SCORE_NAME;
}
CString s;
2004-03-08 02:50:46 +00:00
s = hs.GetDisplayName() + "\n";
2005-02-28 17:23:28 +00:00
s += ssprintf( "%0*.*f%%", PERCENT_TOTAL_SIZE.GetValue(), PERCENT_DECIMAL_PLACES.GetValue(), hs.fPercentDP*100 );
2004-01-29 01:46:08 +00:00
pTextStepsScore->SetText( s );
}
}
}
return m_ListCourseRowItems.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] );
}
for( vector<Difficulty>::iterator dc_iter=m_vDiffsToShow.begin(); dc_iter!=m_vDiffsToShow.end(); dc_iter++ )
{
2004-06-11 08:52:41 +00:00
if( !m_sprDifficulty[*dc_iter]->GetHidden() )
OFF_COMMAND( m_sprDifficulty[*dc_iter] );
2003-01-26 07:33:03 +00:00
}
2004-05-20 22:27:45 +00:00
FOREACH_ShownCourseDifficulty(d)
2004-01-29 09:24:56 +00:00
{
2004-06-11 08:52:41 +00:00
if( !m_sprCourseDifficulty[d]->GetHidden() )
2004-01-29 09:24:56 +00:00
OFF_COMMAND( m_sprCourseDifficulty[d] );
}
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.
*/