2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2003-01-26 07:33:03 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: ScreenRanking
|
|
|
|
|
|
|
|
|
|
Desc: See header.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#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-09-09 03:24:34 +00:00
|
|
|
#include "PrefsManager.h"
|
2003-10-20 01:06:26 +00:00
|
|
|
#include "NoteData.h"
|
|
|
|
|
#include "NoteDataUtil.h"
|
|
|
|
|
#include "ScoreKeeperMAX2.h"
|
|
|
|
|
#include "ScoreKeeper5th.h"
|
2003-01-26 07:33:03 +00:00
|
|
|
|
|
|
|
|
#define CATEGORY_X THEME->GetMetricF("ScreenRanking","CategoryX")
|
|
|
|
|
#define CATEGORY_Y THEME->GetMetricF("ScreenRanking","CategoryY")
|
2003-05-19 23:50:31 +00:00
|
|
|
#define CATEGORY_WIDTH THEME->GetMetricF("ScreenRanking","CategoryWidth")
|
2003-10-20 01:06:26 +00:00
|
|
|
#define BANNER_X THEME->GetMetricF("ScreenRanking","BannerX")
|
|
|
|
|
#define BANNER_Y THEME->GetMetricF("ScreenRanking","BannerY")
|
2003-01-26 07:33:03 +00:00
|
|
|
#define TYPE_X THEME->GetMetricF("ScreenRanking","TypeX")
|
|
|
|
|
#define TYPE_Y THEME->GetMetricF("ScreenRanking","TypeY")
|
|
|
|
|
#define LINE_SPACING_X THEME->GetMetricF("ScreenRanking","LineSpacingX")
|
|
|
|
|
#define LINE_SPACING_Y THEME->GetMetricF("ScreenRanking","LineSpacingY")
|
|
|
|
|
#define BULLETS_START_X THEME->GetMetricF("ScreenRanking","BulletsStartX")
|
|
|
|
|
#define BULLETS_START_Y THEME->GetMetricF("ScreenRanking","BulletsStartY")
|
2003-02-12 22:52:28 +00:00
|
|
|
#define TEXT_ZOOM THEME->GetMetricF("ScreenRanking","TextZoom")
|
2003-10-19 02:05:34 +00:00
|
|
|
#define TEXT_SONGZOOM THEME->GetMetricF("ScreenRanking","TextSongZoom")
|
2003-04-13 02:34:14 +00:00
|
|
|
#define TEXT_COLOR( i ) THEME->GetMetricC("ScreenRanking",ssprintf("TextColor%d",i+1))
|
2003-01-26 07:33:03 +00:00
|
|
|
#define NAMES_START_X THEME->GetMetricF("ScreenRanking","NamesStartX")
|
|
|
|
|
#define NAMES_START_Y THEME->GetMetricF("ScreenRanking","NamesStartY")
|
|
|
|
|
#define SCORES_START_X THEME->GetMetricF("ScreenRanking","ScoresStartX")
|
|
|
|
|
#define SCORES_START_Y THEME->GetMetricF("ScreenRanking","ScoresStartY")
|
2003-02-12 22:52:28 +00:00
|
|
|
#define POINTS_START_X THEME->GetMetricF("ScreenRanking","PointsStartX")
|
|
|
|
|
#define POINTS_START_Y THEME->GetMetricF("ScreenRanking","PointsStartY")
|
|
|
|
|
#define TIME_START_X THEME->GetMetricF("ScreenRanking","TimeStartX")
|
|
|
|
|
#define TIME_START_Y THEME->GetMetricF("ScreenRanking","TimeStartY")
|
2003-10-14 17:06:30 +00:00
|
|
|
#define PERCENT_START_X THEME->GetMetricF("ScreenRanking","PercentStartX")
|
|
|
|
|
#define PERCENT_START_Y THEME->GetMetricF("ScreenRanking","PercentStartY")
|
|
|
|
|
#define PERCENT_COL_SPACING_X THEME->GetMetricF("ScreenRanking","PercentColSpacingX")
|
|
|
|
|
#define PERCENT_COL_SPACING_Y THEME->GetMetricF("ScreenRanking","PercentColSpacingY")
|
2003-01-26 20:49:05 +00:00
|
|
|
#define SECONDS_PER_PAGE THEME->GetMetricF("ScreenRanking","SecondsPerPage")
|
2003-01-26 07:33:03 +00:00
|
|
|
#define SHOW_CATEGORIES THEME->GetMetricB("ScreenRanking","ShowCategories")
|
2003-10-14 17:06:30 +00:00
|
|
|
#define SHOW_ALL_SONGS THEME->GetMetricB("ScreenRanking","ShowAllSongs")
|
2003-04-13 02:34:14 +00:00
|
|
|
#define NOTES_TYPES_TO_HIDE THEME->GetMetric ("ScreenRanking","NotesTypesToHide")
|
2003-10-14 17:06:30 +00:00
|
|
|
#define EMPTY_SCORE_NAME THEME->GetMetric ("ScreenRanking","EmptyScoreName")
|
2003-10-20 01:06:26 +00:00
|
|
|
#define SHOW_SONG_DIFFICULTIES THEME->GetMetric ("ScreenRanking","ShowSongDifficulties")
|
2003-01-26 07:33:03 +00:00
|
|
|
|
2003-09-09 02:54:34 +00:00
|
|
|
#define COURSES_TO_SHOW PREFSMAN->m_sCoursesToShowRanking
|
2003-01-26 07:33:03 +00:00
|
|
|
|
2003-01-26 20:49:05 +00:00
|
|
|
const ScreenMessage SM_ShowNextPage = (ScreenMessage)(SM_User+67);
|
|
|
|
|
const ScreenMessage SM_HidePage = (ScreenMessage)(SM_User+68);
|
|
|
|
|
|
2003-01-26 07:33:03 +00:00
|
|
|
|
2003-09-27 22:30:51 +00:00
|
|
|
ScreenRanking::ScreenRanking( CString sClassName ) : ScreenAttract( sClassName )
|
2003-01-26 07:33:03 +00:00
|
|
|
{
|
2003-07-10 03:37:34 +00:00
|
|
|
m_sprCategory.SetXY( CATEGORY_X, CATEGORY_Y );
|
|
|
|
|
this->AddChild( &m_sprCategory );
|
2003-01-26 07:33:03 +00:00
|
|
|
|
2003-10-20 01:06:26 +00:00
|
|
|
m_banner.SetXY( BANNER_X, BANNER_Y );
|
|
|
|
|
this->AddChild( &m_banner );
|
|
|
|
|
|
2003-07-16 02:32:37 +00:00
|
|
|
m_textCategory.LoadFromFont( THEME->GetPathToF("ScreenRanking title") );
|
|
|
|
|
m_textCategory.EnableShadow( false );
|
|
|
|
|
m_textCategory.SetXY( CATEGORY_X, CATEGORY_Y );
|
|
|
|
|
this->AddChild( &m_textCategory );
|
|
|
|
|
|
2003-07-10 03:37:34 +00:00
|
|
|
m_sprType.SetXY( TYPE_X, TYPE_Y );
|
|
|
|
|
this->AddChild( &m_sprType );
|
2003-01-26 07:33:03 +00:00
|
|
|
|
2003-10-19 02:05:34 +00:00
|
|
|
|
|
|
|
|
// make the list of difficulties to show
|
|
|
|
|
vector<CString> sShowDiffs;
|
2003-10-20 01:06:26 +00:00
|
|
|
split( SHOW_SONG_DIFFICULTIES, ",", sShowDiffs, true );
|
2003-10-19 02:05:34 +00:00
|
|
|
|
|
|
|
|
for( vector<CString>::const_iterator iter = sShowDiffs.begin(); iter != sShowDiffs.end(); iter++ )
|
|
|
|
|
{
|
|
|
|
|
m_vDiffsToShow.push_back( StringToDifficulty( *iter ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-01-27 02:00:38 +00:00
|
|
|
for( int i=0; i<NUM_RANKING_LINES; i++ )
|
2003-01-26 07:33:03 +00:00
|
|
|
{
|
2003-04-12 17:39:27 +00:00
|
|
|
m_sprBullets[i].Load( THEME->GetPathToG(("ScreenRanking bullets 1x5")) );
|
2003-01-26 07:33:03 +00:00
|
|
|
m_sprBullets[i].SetXY( BULLETS_START_X+LINE_SPACING_X*i, BULLETS_START_Y+LINE_SPACING_Y*i );
|
2003-02-03 05:53:59 +00:00
|
|
|
m_sprBullets[i].SetDiffuse( RageColor(1,1,1,0) );
|
2003-01-26 07:33:03 +00:00
|
|
|
m_sprBullets[i].StopAnimating();
|
|
|
|
|
m_sprBullets[i].SetState(i);
|
|
|
|
|
this->AddChild( &m_sprBullets[i] );
|
|
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_textNames[i].LoadFromFont( THEME->GetPathToF("ScreenRanking letters") );
|
2003-03-02 01:43:33 +00:00
|
|
|
m_textNames[i].EnableShadow( false );
|
2003-01-26 07:33:03 +00:00
|
|
|
m_textNames[i].SetXY( NAMES_START_X+LINE_SPACING_X*i, NAMES_START_Y+LINE_SPACING_Y*i );
|
2003-02-12 22:52:28 +00:00
|
|
|
m_textNames[i].SetZoom( TEXT_ZOOM );
|
2003-01-27 02:00:38 +00:00
|
|
|
m_textNames[i].SetHorizAlign( Actor::align_left );
|
2003-01-26 07:33:03 +00:00
|
|
|
this->AddChild( &m_textNames[i] );
|
|
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_textScores[i].LoadFromFont( THEME->GetPathToF("ScreenRanking letters") );
|
2003-03-02 01:43:33 +00:00
|
|
|
m_textScores[i].EnableShadow( false );
|
2003-01-26 07:33:03 +00:00
|
|
|
m_textScores[i].SetXY( SCORES_START_X+LINE_SPACING_X*i, SCORES_START_Y+LINE_SPACING_Y*i );
|
2003-02-12 22:52:28 +00:00
|
|
|
m_textScores[i].SetZoom( TEXT_ZOOM );
|
2003-01-27 02:00:38 +00:00
|
|
|
m_textScores[i].SetHorizAlign( Actor::align_right );
|
2003-01-26 07:33:03 +00:00
|
|
|
this->AddChild( &m_textScores[i] );
|
2003-02-12 22:52:28 +00:00
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_textPoints[i].LoadFromFont( THEME->GetPathToF("ScreenRanking letters") );
|
2003-03-02 01:43:33 +00:00
|
|
|
m_textPoints[i].EnableShadow( false );
|
2003-02-12 22:52:28 +00:00
|
|
|
m_textPoints[i].SetXY( POINTS_START_X+LINE_SPACING_X*i, POINTS_START_Y+LINE_SPACING_Y*i );
|
|
|
|
|
m_textPoints[i].SetZoom( TEXT_ZOOM );
|
|
|
|
|
m_textPoints[i].SetHorizAlign( Actor::align_right );
|
|
|
|
|
this->AddChild( &m_textPoints[i] );
|
|
|
|
|
|
2003-04-12 17:39:27 +00:00
|
|
|
m_textTime[i].LoadFromFont( THEME->GetPathToF("ScreenRanking letters") );
|
2003-03-02 01:43:33 +00:00
|
|
|
m_textTime[i].EnableShadow( false );
|
2003-02-12 22:52:28 +00:00
|
|
|
m_textTime[i].SetXY( TIME_START_X+LINE_SPACING_X*i, TIME_START_Y+LINE_SPACING_Y*i );
|
|
|
|
|
m_textTime[i].SetZoom( TEXT_ZOOM );
|
|
|
|
|
m_textTime[i].SetHorizAlign( Actor::align_right );
|
|
|
|
|
this->AddChild( &m_textTime[i] );
|
2003-09-09 02:54:34 +00:00
|
|
|
|
2003-10-19 02:05:34 +00:00
|
|
|
|
2003-10-14 17:06:30 +00:00
|
|
|
|
2003-09-09 02:54:34 +00:00
|
|
|
if( PREFSMAN->m_sCoursesToShowRanking == "" )
|
2003-09-09 03:24:34 +00:00
|
|
|
PREFSMAN->m_sCoursesToShowRanking = THEME->GetMetric("ScreenRanking","CoursesToShow");
|
2003-01-26 07:33:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-10-19 02:05:34 +00:00
|
|
|
// init all the difficulty graphics
|
|
|
|
|
for( int d=0; d<NUM_DIFFICULTIES; d++ )
|
|
|
|
|
{
|
|
|
|
|
m_sprDiffHeaders[d].Load( THEME->GetPathToG(("ScreenRanking difficulty 1x5")) );
|
|
|
|
|
m_sprDiffHeaders[d].SetDiffuse( RageColor(1,1,1,0) );
|
|
|
|
|
m_sprDiffHeaders[d].StopAnimating();
|
|
|
|
|
m_sprDiffHeaders[d].SetState(d);
|
|
|
|
|
|
|
|
|
|
for( int i=0; i<NUM_RANKING_LINES; i++ )
|
|
|
|
|
{
|
|
|
|
|
m_textPercent[i][d].LoadFromFont( THEME->GetPathToF("ScreenRanking letters") );
|
|
|
|
|
m_textPercent[i][d].EnableShadow( false );
|
|
|
|
|
m_textPercent[i][d].SetZoom( TEXT_SONGZOOM );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// enable the difficulty graphics that we care about
|
|
|
|
|
DiffVectorCIter pDiff = m_vDiffsToShow.begin();
|
|
|
|
|
for( int j=0; pDiff != m_vDiffsToShow.end() && j<NUM_DIFFICULTIES; pDiff++, j++ )
|
|
|
|
|
{
|
|
|
|
|
int d = (int)*pDiff;
|
|
|
|
|
|
|
|
|
|
m_sprDiffHeaders[d].SetX( PERCENT_START_X+PERCENT_COL_SPACING_X*j );
|
|
|
|
|
m_sprDiffHeaders[d].SetY( PERCENT_START_Y-LINE_SPACING_Y );
|
|
|
|
|
this->AddChild( &m_sprDiffHeaders[d] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for( int i=0; i<NUM_RANKING_LINES; i++ )
|
|
|
|
|
{
|
|
|
|
|
m_textPercent[i][d].SetX( PERCENT_START_X+LINE_SPACING_X*i+PERCENT_COL_SPACING_X*j );
|
|
|
|
|
m_textPercent[i][d].SetY( PERCENT_START_Y+LINE_SPACING_Y*i+PERCENT_COL_SPACING_Y*j );
|
|
|
|
|
this->AddChild( &m_textPercent[i][d] );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-08-07 06:16:17 +00:00
|
|
|
vector<StepsType> aNotesTypesToShow;
|
2003-01-26 20:49:05 +00:00
|
|
|
GAMEMAN->GetNotesTypesForGame( GAMESTATE->m_CurGame, aNotesTypesToShow );
|
|
|
|
|
|
|
|
|
|
// subtract hidden NotesTypes
|
2003-01-26 07:33:03 +00:00
|
|
|
{
|
|
|
|
|
vector<CString> asNotesTypesToHide;
|
|
|
|
|
split( NOTES_TYPES_TO_HIDE, ",", asNotesTypesToHide, true );
|
|
|
|
|
for( unsigned i=0; i<asNotesTypesToHide.size(); i++ )
|
2003-01-26 20:49:05 +00:00
|
|
|
{
|
2003-08-07 06:16:17 +00:00
|
|
|
StepsType nt = GameManager::StringToNotesType(asNotesTypesToHide[i]);
|
|
|
|
|
if( nt != STEPS_TYPE_INVALID )
|
2003-01-26 20:49:05 +00:00
|
|
|
{
|
2003-08-07 06:16:17 +00:00
|
|
|
const vector<StepsType>::iterator iter = find( aNotesTypesToShow.begin(), aNotesTypesToShow.end(), nt );
|
2003-01-26 20:49:05 +00:00
|
|
|
if( iter != aNotesTypesToShow.end() )
|
|
|
|
|
aNotesTypesToShow.erase( iter );
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-01-26 07:33:03 +00:00
|
|
|
}
|
|
|
|
|
|
2003-01-26 20:49:05 +00:00
|
|
|
|
|
|
|
|
// fill m_vPagesToShow
|
2003-01-26 07:33:03 +00:00
|
|
|
if( SHOW_CATEGORIES )
|
|
|
|
|
{
|
2003-01-26 20:49:05 +00:00
|
|
|
for( unsigned i=0; i<aNotesTypesToShow.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;
|
|
|
|
|
pts.type = PageToShow::TYPE_CATEGORY;
|
2003-04-13 02:34:14 +00:00
|
|
|
pts.colorIndex = i;
|
2003-01-26 20:49:05 +00:00
|
|
|
pts.category = (RankingCategory)c;
|
|
|
|
|
pts.nt = aNotesTypesToShow[i];
|
|
|
|
|
m_vPagesToShow.push_back( pts );
|
2003-01-26 07:33:03 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2003-01-26 21:45:13 +00:00
|
|
|
vector<CString> asCoursePaths;
|
|
|
|
|
split( COURSES_TO_SHOW, ",", asCoursePaths, true );
|
|
|
|
|
for( unsigned i=0; i<aNotesTypesToShow.size(); i++ )
|
2003-01-26 07:33:03 +00:00
|
|
|
{
|
2003-01-26 21:45:13 +00:00
|
|
|
for( unsigned c=0; c<asCoursePaths.size(); c++ )
|
|
|
|
|
{
|
|
|
|
|
PageToShow pts;
|
|
|
|
|
pts.type = PageToShow::TYPE_COURSE;
|
2003-04-13 02:34:14 +00:00
|
|
|
pts.colorIndex = i;
|
2003-01-26 21:45:13 +00:00
|
|
|
pts.nt = aNotesTypesToShow[i];
|
|
|
|
|
pts.pCourse = SONGMAN->GetCourseFromPath( asCoursePaths[c] );
|
|
|
|
|
if( pts.pCourse )
|
|
|
|
|
m_vPagesToShow.push_back( pts );
|
|
|
|
|
}
|
2003-01-26 07:33:03 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-10-14 17:06:30 +00:00
|
|
|
if( SHOW_ALL_SONGS )
|
|
|
|
|
{
|
|
|
|
|
vector<Song*> vpSongs = SONGMAN->GetAllSongs();
|
|
|
|
|
for( unsigned i=0; i<aNotesTypesToShow.size(); i++ )
|
|
|
|
|
{
|
2003-10-14 21:44:58 +00:00
|
|
|
for( unsigned j=0; j<vpSongs.size(); j++ )
|
2003-10-14 17:06:30 +00:00
|
|
|
{
|
|
|
|
|
PageToShow pts;
|
|
|
|
|
pts.type = PageToShow::TYPE_SONG;
|
|
|
|
|
pts.colorIndex = i;
|
|
|
|
|
pts.pSong = vpSongs[j];
|
|
|
|
|
pts.nt = aNotesTypesToShow[i];
|
|
|
|
|
m_vPagesToShow.push_back( pts );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-09 00:55:49 +00:00
|
|
|
this->MoveToTail( &m_In ); // put it in the back so it covers up the stuff we just added
|
|
|
|
|
this->MoveToTail( &m_Out ); // put it in the back so it covers up the stuff we just added
|
2003-01-26 07:33:03 +00:00
|
|
|
|
2003-01-26 20:49:05 +00:00
|
|
|
this->ClearMessageQueue( SM_BeginFadingOut ); // ignore ScreenAttract's SecsToShow
|
|
|
|
|
|
2003-03-25 21:17:29 +00:00
|
|
|
this->PostScreenMessage( SM_ShowNextPage, 0.5f );
|
2003-01-26 07:33:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenRanking::HandleScreenMessage( const ScreenMessage SM )
|
|
|
|
|
{
|
|
|
|
|
switch( SM )
|
|
|
|
|
{
|
2003-03-09 00:55:49 +00:00
|
|
|
// redundant
|
|
|
|
|
// case SM_BeginFadingOut:
|
|
|
|
|
// m_Out.CloseWipingRight(SM_GoToNextScreen);
|
|
|
|
|
// break;
|
2003-01-26 20:49:05 +00:00
|
|
|
case SM_ShowNextPage:
|
|
|
|
|
if( m_vPagesToShow.size() > 0 )
|
2003-01-26 07:33:03 +00:00
|
|
|
{
|
2003-01-26 20:49:05 +00:00
|
|
|
SetPage( m_vPagesToShow[0] );
|
|
|
|
|
m_vPagesToShow.erase( m_vPagesToShow.begin() );
|
2003-03-25 21:17:29 +00:00
|
|
|
this->PostScreenMessage( SM_HidePage, SECONDS_PER_PAGE-1 );
|
2003-01-26 20:49:05 +00:00
|
|
|
TweenPageOnScreen();
|
2003-01-26 07:33:03 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2003-03-09 00:55:49 +00:00
|
|
|
m_Out.StartTransitioning(SM_GoToNextScreen);
|
2003-01-26 07:33:03 +00:00
|
|
|
}
|
|
|
|
|
break;
|
2003-01-26 20:49:05 +00:00
|
|
|
case SM_HidePage:
|
|
|
|
|
TweenPageOffScreen();
|
2003-03-25 21:17:29 +00:00
|
|
|
this->PostScreenMessage( SM_ShowNextPage, 1 );
|
2003-01-26 20:49:05 +00:00
|
|
|
break;
|
2003-01-26 07:33:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScreenAttract::HandleScreenMessage( SM );
|
|
|
|
|
}
|
|
|
|
|
|
2003-01-26 20:49:05 +00:00
|
|
|
void ScreenRanking::SetPage( PageToShow pts )
|
2003-01-26 07:33:03 +00:00
|
|
|
{
|
2003-10-14 17:06:30 +00:00
|
|
|
// Clear all text
|
|
|
|
|
for( int l=0; l<NUM_RANKING_LINES; l++ )
|
|
|
|
|
{
|
|
|
|
|
m_textScores[l].SetText( "" );
|
|
|
|
|
m_textPoints[l].SetText( "" );
|
|
|
|
|
m_textTime[l].SetText( "" );
|
2003-10-19 02:05:34 +00:00
|
|
|
for( DiffVectorCIter j=m_vDiffsToShow.begin(); j<m_vDiffsToShow.end(); j++ )
|
|
|
|
|
m_textPercent[l][*j].SetText( "" );
|
2003-10-20 01:06:26 +00:00
|
|
|
m_banner.UnloadTexture();
|
2003-10-19 02:05:34 +00:00
|
|
|
}
|
|
|
|
|
for( int d=0; d<NUM_DIFFICULTIES; d++ )
|
|
|
|
|
{
|
|
|
|
|
m_sprDiffHeaders[d].SetDiffuseAlpha(0);
|
2003-10-14 17:06:30 +00:00
|
|
|
}
|
|
|
|
|
|
2003-01-26 20:49:05 +00:00
|
|
|
switch( pts.type )
|
2003-01-26 07:33:03 +00:00
|
|
|
{
|
2003-01-26 20:49:05 +00:00
|
|
|
case PageToShow::TYPE_CATEGORY:
|
2003-01-26 07:33:03 +00:00
|
|
|
{
|
2003-07-16 02:32:37 +00:00
|
|
|
m_textCategory.SetDiffuseAlpha(0);
|
2003-07-10 03:37:34 +00:00
|
|
|
m_sprCategory.SetDiffuse( RageColor(1,1,1,1) );
|
|
|
|
|
m_sprCategory.Load( THEME->GetPathToG(ssprintf("ScreenRanking category %c", 'A'+pts.category)) );
|
|
|
|
|
m_sprType.SetDiffuse( RageColor(1,1,1,1) );
|
|
|
|
|
m_sprType.Load( THEME->GetPathToG("ScreenRanking type "+GameManager::NotesTypeToString(pts.nt)) );
|
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
|
|
|
{
|
2003-10-14 17:06:30 +00:00
|
|
|
SongManager::CategoryData::HighScore hs;
|
2003-10-14 21:44:58 +00:00
|
|
|
if( l < (int)SONGMAN->m_CategoryDatas[pts.nt][pts.category].vHighScores.size() )
|
2003-10-14 17:06:30 +00:00
|
|
|
hs = SONGMAN->m_CategoryDatas[pts.nt][pts.category].vHighScores[l];
|
2003-10-20 01:06:26 +00:00
|
|
|
if( hs.sName.empty() )
|
2003-10-14 17:06:30 +00:00
|
|
|
hs.sName = EMPTY_SCORE_NAME;
|
|
|
|
|
|
2003-02-03 05:53:59 +00:00
|
|
|
m_sprBullets[l].SetDiffuse( RageColor(1,1,1,1) );
|
2003-10-14 17:06:30 +00:00
|
|
|
m_textNames[l].SetText( hs.sName );
|
|
|
|
|
m_textScores[l].SetText( ssprintf("%09i",hs.iScore) );
|
2003-04-13 02:34:14 +00:00
|
|
|
m_textNames[l].SetDiffuse( TEXT_COLOR(pts.colorIndex) );
|
|
|
|
|
m_textScores[l].SetDiffuse( TEXT_COLOR(pts.colorIndex) );
|
2003-02-03 05:53:59 +00:00
|
|
|
|
|
|
|
|
bool bRecentHighScore = false;
|
2003-10-14 17:06:30 +00:00
|
|
|
// FIXME
|
|
|
|
|
// for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
// {
|
|
|
|
|
// bRecentHighScore |=
|
|
|
|
|
// pts.nt == GAMESTATE->m_RankingNotesType &&
|
|
|
|
|
// GAMESTATE->m_RankingCategory[p] == pts.category &&
|
|
|
|
|
// GAMESTATE->m_iRankingIndex[p] == l;
|
|
|
|
|
// }
|
2003-02-03 05:53:59 +00:00
|
|
|
|
|
|
|
|
if( bRecentHighScore )
|
|
|
|
|
{
|
2003-03-02 01:43:33 +00:00
|
|
|
m_textNames[l].SetEffectGlowBlink(0.1f);
|
|
|
|
|
m_textScores[l].SetEffectGlowBlink(0.1f);
|
2003-02-03 05:53:59 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2003-01-26 20:49:05 +00:00
|
|
|
case PageToShow::TYPE_COURSE:
|
2003-01-26 07:33:03 +00:00
|
|
|
{
|
2003-07-16 02:32:37 +00:00
|
|
|
m_textCategory.SetDiffuseAlpha(0);
|
|
|
|
|
m_sprCategory.SetDiffuseAlpha(0);
|
|
|
|
|
CString path = THEME->GetPathToG("ScreenRanking category "+pts.pCourse->m_sName, true);
|
|
|
|
|
if( IsAFile(path) )
|
|
|
|
|
{
|
|
|
|
|
m_sprCategory.Load( path );
|
|
|
|
|
m_sprCategory.SetDiffuseAlpha(1);
|
|
|
|
|
} else {
|
|
|
|
|
m_textCategory.SetZoom(1);
|
|
|
|
|
m_textCategory.SetTextMaxWidth( CATEGORY_WIDTH, pts.pCourse->m_sName );
|
|
|
|
|
m_textCategory.SetDiffuseAlpha(1);
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-10 03:37:34 +00:00
|
|
|
m_sprType.SetDiffuse( RageColor(1,1,1,1) );
|
|
|
|
|
m_sprType.Load( THEME->GetPathToG("ScreenRanking type "+GameManager::NotesTypeToString(pts.nt)) );
|
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
|
|
|
{
|
2003-10-14 17:06:30 +00:00
|
|
|
Course::MemCardData::HighScore hs;
|
2003-10-14 21:44:58 +00:00
|
|
|
if( l < (int)pts.pCourse->m_MemCardDatas[pts.nt][MEMORY_CARD_MACHINE].vHighScores.size() )
|
2003-10-14 17:06:30 +00:00
|
|
|
hs = pts.pCourse->m_MemCardDatas[pts.nt][MEMORY_CARD_MACHINE].vHighScores[l];
|
2003-10-20 01:06:26 +00:00
|
|
|
if( hs.sName.empty() )
|
2003-10-14 17:06:30 +00:00
|
|
|
hs.sName = EMPTY_SCORE_NAME;
|
2003-10-20 01:06:26 +00:00
|
|
|
|
2003-02-12 22:52:28 +00:00
|
|
|
m_sprBullets[l].SetDiffuse( RageColor(1,1,1,1) );
|
2003-10-14 17:06:30 +00:00
|
|
|
m_textNames[l].SetText( hs.sName );
|
2003-06-30 08:06:47 +00:00
|
|
|
if( pts.pCourse->IsOni() )
|
|
|
|
|
{
|
2003-10-14 17:06:30 +00:00
|
|
|
m_textPoints[l].SetText( ssprintf("%04d",hs.iScore) );
|
|
|
|
|
m_textTime[l].SetText( SecondsToTime(hs.fSurviveTime) );
|
2003-06-30 08:06:47 +00:00
|
|
|
m_textScores[l].SetText( "" );
|
|
|
|
|
} else {
|
|
|
|
|
m_textPoints[l].SetText( "" );
|
|
|
|
|
m_textTime[l].SetText( "" );
|
2003-10-14 17:06:30 +00:00
|
|
|
m_textScores[l].SetText( ssprintf("%09d",hs.iScore) );
|
2003-06-30 08:06:47 +00:00
|
|
|
}
|
2003-04-13 02:34:14 +00:00
|
|
|
m_textNames[l].SetDiffuse( TEXT_COLOR(pts.colorIndex) );
|
|
|
|
|
m_textPoints[l].SetDiffuse( TEXT_COLOR(pts.colorIndex) );
|
|
|
|
|
m_textTime[l].SetDiffuse( TEXT_COLOR(pts.colorIndex) );
|
2003-06-30 08:06:47 +00:00
|
|
|
m_textScores[l].SetDiffuse( TEXT_COLOR(pts.colorIndex) );
|
2003-01-27 02:00:38 +00:00
|
|
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
|
|
|
|
{
|
2003-10-14 17:06:30 +00:00
|
|
|
bool bHighlight = false;
|
|
|
|
|
// FIXME
|
|
|
|
|
// bHighlight = pts.pCourse == GAMESTATE->m_pRankingCourse &&
|
|
|
|
|
// pts.nt == GAMESTATE->m_RankingNotesType &&
|
|
|
|
|
// GAMESTATE->m_iRankingIndex[p] == l;
|
|
|
|
|
if( bHighlight )
|
2003-01-27 02:00:38 +00:00
|
|
|
{
|
2003-03-02 01:43:33 +00:00
|
|
|
m_textNames[l].SetEffectGlowBlink(0.1f);
|
|
|
|
|
m_textScores[l].SetEffectGlowBlink(0.1f);
|
2003-01-27 02:00:38 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_textNames[l].SetEffectNone();
|
|
|
|
|
m_textScores[l].SetEffectNone();
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-01-26 07:33:03 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2003-10-14 17:06:30 +00:00
|
|
|
case PageToShow::TYPE_SONG:
|
|
|
|
|
{
|
|
|
|
|
m_textCategory.SetDiffuseAlpha(0);
|
|
|
|
|
m_sprCategory.SetDiffuseAlpha(0);
|
|
|
|
|
|
2003-10-20 01:06:26 +00:00
|
|
|
m_banner.LoadFromSong( pts.pSong );
|
|
|
|
|
m_banner.SetDiffuseAlpha(1);
|
|
|
|
|
|
2003-10-14 17:06:30 +00:00
|
|
|
m_textCategory.SetZoom(1);
|
|
|
|
|
m_textCategory.SetTextMaxWidth( CATEGORY_WIDTH, pts.pSong->GetFullTranslitTitle() );
|
|
|
|
|
m_textCategory.SetDiffuseAlpha(1);
|
|
|
|
|
|
|
|
|
|
m_sprType.SetDiffuse( RageColor(1,1,1,1) );
|
|
|
|
|
m_sprType.Load( THEME->GetPathToG("ScreenRanking type "+GameManager::NotesTypeToString(pts.nt)) );
|
|
|
|
|
|
2003-10-19 02:05:34 +00:00
|
|
|
for( DiffVectorCIter dIter = m_vDiffsToShow.begin(); dIter != m_vDiffsToShow.end(); dIter++ )
|
|
|
|
|
{
|
|
|
|
|
int d = (int)*dIter;
|
|
|
|
|
|
|
|
|
|
Difficulty dc = (Difficulty)d;
|
|
|
|
|
Steps* pSteps = pts.pSong->GetStepsByDifficulty( pts.nt, dc );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( pSteps == NULL )
|
2003-10-14 17:06:30 +00:00
|
|
|
{
|
2003-10-19 02:05:34 +00:00
|
|
|
// set alpha to 0.0 and continue
|
|
|
|
|
m_sprDiffHeaders[d].SetDiffuse( RageColor(1,1,1,0) );
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// set the header visible
|
|
|
|
|
m_sprDiffHeaders[d].SetDiffuse( RageColor(1,1,1,1) );
|
|
|
|
|
|
|
|
|
|
for( int l=0; l<NUM_RANKING_LINES; l++ )
|
|
|
|
|
{
|
|
|
|
|
m_sprBullets[l].SetDiffuse( RageColor(1,1,1,1) );
|
|
|
|
|
|
2003-10-14 17:06:30 +00:00
|
|
|
Steps::MemCardData::HighScore hs;
|
2003-10-14 21:44:58 +00:00
|
|
|
if( l < (int)pSteps->m_MemCardDatas[MEMORY_CARD_MACHINE].vHighScores.size() )
|
2003-10-14 17:06:30 +00:00
|
|
|
hs = pSteps->m_MemCardDatas[MEMORY_CARD_MACHINE].vHighScores[l];
|
2003-10-20 01:06:26 +00:00
|
|
|
if( hs.sName.empty() )
|
|
|
|
|
hs.sName = EMPTY_SCORE_NAME;
|
2003-10-19 02:05:34 +00:00
|
|
|
|
2003-10-20 01:06:26 +00:00
|
|
|
m_textPercent[l][d].SetText( ssprintf("%s\n%0.3f%%", hs.sName.c_str(), hs.fPercentDP*100) );
|
|
|
|
|
m_textPercent[l][d].SetDiffuse( TEXT_COLOR(pts.colorIndex) );
|
2003-10-14 17:06:30 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2003-01-26 07:33:03 +00:00
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
}
|
2003-01-26 20:49:05 +00:00
|
|
|
}
|
2003-01-26 07:33:03 +00:00
|
|
|
|
2003-01-26 20:49:05 +00:00
|
|
|
void ScreenRanking::TweenPageOnScreen()
|
|
|
|
|
{
|
2003-07-10 03:37:34 +00:00
|
|
|
m_sprCategory.FadeOn(0,"bounce right",0.5f);
|
|
|
|
|
m_sprType.FadeOn(0.1f,"bounce right",0.5f);
|
2003-07-16 02:32:37 +00:00
|
|
|
m_textCategory.FadeOn(0,"bounce right",0.5f);
|
2003-01-26 07:33:03 +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
|
|
|
{
|
2003-01-26 20:49:05 +00:00
|
|
|
m_sprBullets[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f);
|
|
|
|
|
m_textNames[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f);
|
|
|
|
|
m_textScores[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f);
|
2003-02-12 22:52:28 +00:00
|
|
|
m_textPoints[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f);
|
|
|
|
|
m_textTime[l].FadeOn(0.2f+l*0.1f,"bounce right far",1.f);
|
2003-10-20 01:06:26 +00:00
|
|
|
for( int d=0; d<NUM_DIFFICULTIES; d++ )
|
|
|
|
|
m_textPercent[l][d].FadeOn(0.2f+l*0.1f,"bounce right far",1.f);
|
2003-01-26 20:49:05 +00:00
|
|
|
}
|
2003-10-19 02:05:34 +00:00
|
|
|
for( int d=0; d<NUM_DIFFICULTIES; d++ )
|
2003-10-20 01:06:26 +00:00
|
|
|
m_sprDiffHeaders[d].FadeOn(0,"bounce right far",1.f);
|
2003-10-19 02:05:34 +00:00
|
|
|
|
2003-01-26 20:49:05 +00:00
|
|
|
}
|
2003-01-26 07:33:03 +00:00
|
|
|
|
2003-01-26 20:49:05 +00:00
|
|
|
void ScreenRanking::TweenPageOffScreen()
|
|
|
|
|
{
|
2003-07-10 03:37:34 +00:00
|
|
|
m_sprCategory.FadeOff(0,"fade",0.25f);
|
|
|
|
|
m_sprType.FadeOff(0.1f,"fade",0.25f);
|
2003-07-16 02:32:37 +00:00
|
|
|
m_textCategory.FadeOff(0.1f,"fade",0.25f);
|
2003-01-26 20:49:05 +00:00
|
|
|
|
2003-01-27 02:00:38 +00:00
|
|
|
for( int l=0; l<NUM_RANKING_LINES; l++ )
|
2003-01-26 20:49:05 +00:00
|
|
|
{
|
|
|
|
|
m_sprBullets[l].FadeOff(0.2f+l*0.1f,"fade",0.25f);
|
|
|
|
|
m_textNames[l].FadeOff(0.2f+l*0.1f,"fade",0.25f);
|
|
|
|
|
m_textScores[l].FadeOff(0.2f+l*0.1f,"fade",0.25f);
|
2003-02-12 22:52:28 +00:00
|
|
|
m_textPoints[l].FadeOff(0.2f+l*0.1f,"fade",0.25f);
|
|
|
|
|
m_textTime[l].FadeOff(0.2f+l*0.1f,"fade",0.25f);
|
2003-10-20 01:06:26 +00:00
|
|
|
for( int d=0; d<NUM_DIFFICULTIES; d++ )
|
|
|
|
|
m_textPercent[l][d].FadeOff(0.2f+l*0.1f,"fade",0.25f);
|
2003-01-26 07:33:03 +00:00
|
|
|
}
|
2003-10-19 02:05:34 +00:00
|
|
|
for( int d=0; d<NUM_DIFFICULTIES; d++ )
|
2003-10-20 01:06:26 +00:00
|
|
|
m_sprDiffHeaders[d].FadeOff(0,"fade",0.25f);
|
2003-01-26 07:33:03 +00:00
|
|
|
}
|