ranking refactoring
This commit is contained in:
+83
-157
@@ -25,15 +25,11 @@ static const char *PageTypeNames[] = {
|
|||||||
"SurvivalCourses",
|
"SurvivalCourses",
|
||||||
"AllCourses",
|
"AllCourses",
|
||||||
};
|
};
|
||||||
XToString( PageType );
|
|
||||||
StringToX( PageType );
|
StringToX( PageType );
|
||||||
|
|
||||||
#define TYPE THEME->GetMetric(m_sName,"Type")
|
#define TYPE THEME->GetMetric(m_sName,"Type")
|
||||||
#define COURSES_TO_SHOW THEME->GetMetric(m_sName,"CoursesToShow")
|
#define COURSES_TO_SHOW THEME->GetMetric(m_sName,"CoursesToShow")
|
||||||
|
|
||||||
#define DIFFICULTY_X(col) (DIFFICULTY_START_X+COL_SPACING_X*col)
|
|
||||||
#define SCORE_OFFSET_X(col) (SCORE_OFFSET_START_X+COL_SPACING_X*col)
|
|
||||||
|
|
||||||
AutoScreenMessage( SM_ShowNextPage )
|
AutoScreenMessage( SM_ShowNextPage )
|
||||||
AutoScreenMessage( SM_HidePage )
|
AutoScreenMessage( SM_HidePage )
|
||||||
|
|
||||||
@@ -101,14 +97,8 @@ void ScreenRanking::Init()
|
|||||||
// watch out: ThemeMetricStepsTypesToShow inverts the results
|
// watch out: ThemeMetricStepsTypesToShow inverts the results
|
||||||
STEPS_TYPES_TO_SHOW.Load ( m_sName,"StepsTypesToHide" );
|
STEPS_TYPES_TO_SHOW.Load ( m_sName,"StepsTypesToHide" );
|
||||||
|
|
||||||
ROW_SPACING_X.Load ( m_sName,"RowSpacingX" );
|
|
||||||
ROW_SPACING_Y.Load ( m_sName,"RowSpacingY" );
|
|
||||||
|
|
||||||
STEPS_TYPE_COLOR.Load ( m_sName,STEPS_TYPE_COLOR_NAME,5 );
|
|
||||||
SHOW_ONLY_MOST_RECENT_SCORES.Load ( m_sName,"ShowOnlyMostRecentScores" );
|
|
||||||
SECONDS_PER_PAGE.Load ( m_sName,"SecondsPerPage" );
|
SECONDS_PER_PAGE.Load ( m_sName,"SecondsPerPage" );
|
||||||
PAGE_FADE_SECONDS.Load ( m_sName,"PageFadeSeconds" );
|
PAGE_FADE_SECONDS.Load ( m_sName,"PageFadeSeconds" );
|
||||||
NO_SCORE_NAME.Load ( m_sName,"NoScoreName" );
|
|
||||||
MANUAL_SCROLLING.Load ( m_sName, "ManualScrolling" );
|
MANUAL_SCROLLING.Load ( m_sName, "ManualScrolling" );
|
||||||
|
|
||||||
ScreenAttract::Init();
|
ScreenAttract::Init();
|
||||||
@@ -196,17 +186,18 @@ float ScreenRanking::SetPage( const PageToShow &pts )
|
|||||||
//
|
//
|
||||||
// init page
|
// init page
|
||||||
//
|
//
|
||||||
m_textStepsType.SetText( GameManager::StepsTypeToLocalizedString(pts.st) );
|
m_textStepsType.SetText( GameManager::StepsTypeToLocalizedString(pts.aTypes.front().second) );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenRankingScroller::DoScroll( int iDir )
|
void ScreenRankingScroller::DoScroll( int iDir )
|
||||||
{
|
{
|
||||||
if( m_ListScoreRowItems.Scroll(iDir) )
|
if( !m_ListScoreRowItems.Scroll(iDir) )
|
||||||
m_soundChange.Play();
|
iDir = 0;
|
||||||
else
|
Message msg("Scrolled");
|
||||||
SCREENMAN->PlayInvalidSound();
|
msg.SetParam( "Dir", iDir );
|
||||||
|
this->HandleMessage( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
@@ -216,31 +207,22 @@ ScoreScroller::ScoreScroller()
|
|||||||
this->DeleteChildrenWhenDone();
|
this->DeleteChildrenWhenDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreScroller::SetStepsType( StepsType st, RageColor color )
|
void ScoreScroller::SetDisplay( const vector<DifficultyAndStepsType> &DifficultiesToShow )
|
||||||
{
|
{
|
||||||
m_StepsType = st;
|
m_DifficultiesToShow = DifficultiesToShow;
|
||||||
|
|
||||||
for( unsigned s=0; s<m_SubActors.size(); s++ )
|
|
||||||
{
|
|
||||||
ScoreRowItem *pItem = (ScoreRowItem *) m_SubActors[s];
|
|
||||||
|
|
||||||
FOREACH_CONST( Difficulty, CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(), cd )
|
|
||||||
pItem->m_textScore[*cd].SetDiffuse( color );
|
|
||||||
}
|
|
||||||
|
|
||||||
ShiftSubActors( INT_MAX );
|
ShiftSubActors( INT_MAX );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ScoreScroller::Scroll( int iDir )
|
bool ScoreScroller::Scroll( int iDir )
|
||||||
{
|
{
|
||||||
if( (int)m_vScoreRowItemData.size() <= m_metricSongScoreRowsToDraw )
|
if( (int)m_vScoreRowItemData.size() <= SONG_SCORE_ROWS_TO_DRAW )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
float fDest = GetDestinationItem();
|
float fDest = GetDestinationItem();
|
||||||
float fOldDest = fDest;
|
float fOldDest = fDest;
|
||||||
fDest += iDir;
|
fDest += iDir;
|
||||||
float fLowClamp = (m_metricSongScoreRowsToDraw-1)/2.0f;
|
float fLowClamp = (SONG_SCORE_ROWS_TO_DRAW-1)/2.0f;
|
||||||
float fHighClamp = m_vScoreRowItemData.size()-(m_metricSongScoreRowsToDraw-1)/2.0f-1;
|
float fHighClamp = m_vScoreRowItemData.size()-(SONG_SCORE_ROWS_TO_DRAW-1)/2.0f-1;
|
||||||
CLAMP( fDest, fLowClamp, fHighClamp );
|
CLAMP( fDest, fLowClamp, fHighClamp );
|
||||||
if( fOldDest != fDest )
|
if( fOldDest != fDest )
|
||||||
{
|
{
|
||||||
@@ -255,75 +237,57 @@ bool ScoreScroller::Scroll( int iDir )
|
|||||||
|
|
||||||
void ScoreScroller::ScrollTop()
|
void ScoreScroller::ScrollTop()
|
||||||
{
|
{
|
||||||
SetCurrentAndDestinationItem( (m_metricSongScoreRowsToDraw-1)/2.0f );
|
SetCurrentAndDestinationItem( (SONG_SCORE_ROWS_TO_DRAW-1)/2.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreScroller::ConfigureActor( Actor *pActor, int iItem )
|
void ScoreScroller::ConfigureActor( Actor *pActor, int iItem )
|
||||||
{
|
{
|
||||||
ScoreRowItemData &data = m_vScoreRowItemData[iItem];
|
Actor &item = *dynamic_cast<Actor *>(pActor);
|
||||||
|
const ScoreRowItemData &data = m_vScoreRowItemData[iItem];
|
||||||
|
|
||||||
|
Message msg("Set");
|
||||||
if( data.m_pSong != NULL )
|
if( data.m_pSong != NULL )
|
||||||
|
msg.SetParam( "Song", data.m_pSong );
|
||||||
|
if( data.m_pCourse != NULL )
|
||||||
|
msg.SetParam( "Course", data.m_pCourse );
|
||||||
|
|
||||||
|
Lua *L = LUA->Get();
|
||||||
|
lua_newtable( L );
|
||||||
|
lua_pushvalue( L, -1 );
|
||||||
|
msg.SetParamFromStack( L, "Entries" );
|
||||||
|
|
||||||
|
FOREACH( DifficultyAndStepsType, m_DifficultiesToShow, iter )
|
||||||
{
|
{
|
||||||
ScoreRowItem &item = *(ScoreRowItem *) pActor;
|
Difficulty dc = iter->first;
|
||||||
const Song* pSong = data.m_pSong;
|
StepsType st = iter->second;
|
||||||
|
|
||||||
item.m_textTitle.SetText( pSong->GetDisplayFullTitle() );
|
if( data.m_pSong != NULL )
|
||||||
item.m_textTitle.SetDiffuse( SONGMAN->GetSongColor(pSong) );
|
|
||||||
|
|
||||||
FOREACH_CONST( Difficulty, m_DifficultiesToShow, iter )
|
|
||||||
{
|
{
|
||||||
const Steps* pSteps = SongUtil::GetStepsByDifficulty( pSong, m_StepsType, *iter, false );
|
const Song* pSong = data.m_pSong;
|
||||||
|
|
||||||
|
Steps *pSteps = SongUtil::GetStepsByDifficulty( pSong, st, dc, false );
|
||||||
if( pSteps && UNLOCKMAN->StepsIsLocked(pSong, pSteps) )
|
if( pSteps && UNLOCKMAN->StepsIsLocked(pSong, pSteps) )
|
||||||
pSteps = NULL;
|
|
||||||
BitmapText* pTextStepsScore = &item.m_textScore[*iter];
|
|
||||||
pTextStepsScore->SetVisible( pSteps != NULL );
|
|
||||||
if( pSteps == NULL )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong,pSteps);
|
LuaHelpers::Push( L, pSteps );
|
||||||
SetScoreFromHighScoreList( pTextStepsScore, hsl );
|
lua_rawseti( L, -2, lua_objlen(L, -2)+1 );
|
||||||
}
|
}
|
||||||
}
|
else if( data.m_pCourse != NULL )
|
||||||
else if( data.m_pCourse != NULL )
|
|
||||||
{
|
|
||||||
const Course* pCourse = data.m_pCourse;
|
|
||||||
|
|
||||||
ScoreRowItem &item = *(ScoreRowItem *) pActor;
|
|
||||||
item.m_textTitle.SetText( pCourse->GetDisplayFullTitle() );
|
|
||||||
item.m_textTitle.SetDiffuse( SONGMAN->GetCourseColor(pCourse) );
|
|
||||||
|
|
||||||
FOREACH_CONST( Difficulty, m_DifficultiesToShow, cd )
|
|
||||||
{
|
{
|
||||||
BitmapText* pTextStepsScore = &item.m_textScore[*cd];
|
const Course* pCourse = data.m_pCourse;
|
||||||
|
|
||||||
const Trail *pTrail = pCourse->GetTrail( m_StepsType, *cd );
|
Trail *pTrail = pCourse->GetTrail( st, dc );
|
||||||
if( UNLOCKMAN->CourseIsLocked(pCourse) )
|
if( UNLOCKMAN->CourseIsLocked(pCourse) )
|
||||||
pTrail = NULL;
|
|
||||||
pTextStepsScore->SetVisible( pTrail != NULL );
|
|
||||||
if( pTrail == NULL )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList( pCourse, pTrail );
|
LuaHelpers::Push( L, pTrail );
|
||||||
SetScoreFromHighScoreList( pTextStepsScore, hsl );
|
lua_rawseti( L, -2, lua_objlen(L, -2)+1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
lua_pop( L, 1 );
|
||||||
|
LUA->Release( L );
|
||||||
|
|
||||||
ScoreScroller::ScoreRowItem::ScoreRowItem()
|
item.HandleMessage( msg );
|
||||||
{
|
|
||||||
this->AddChild( &m_textTitle );
|
|
||||||
}
|
|
||||||
|
|
||||||
ScoreScroller::ScoreRowItem::ScoreRowItem( const ScoreRowItem &cpy ):
|
|
||||||
ActorFrame( cpy ),
|
|
||||||
m_sprFrame( cpy.m_sprFrame ),
|
|
||||||
m_textTitle( cpy.m_textTitle ),
|
|
||||||
m_textScore( cpy.m_textScore )
|
|
||||||
{
|
|
||||||
if( m_sprFrame.IsLoaded() )
|
|
||||||
this->AddChild( m_sprFrame );
|
|
||||||
this->AddChild( &m_textTitle );
|
|
||||||
FOREACH( BitmapText, m_textScore, bt )
|
|
||||||
this->AddChild( &*bt );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreScroller::LoadSongs( bool bOnlyRecentScores, int iNumRecentScores )
|
void ScoreScroller::LoadSongs( bool bOnlyRecentScores, int iNumRecentScores )
|
||||||
@@ -344,76 +308,34 @@ void ScoreScroller::LoadCourses( CourseType ct, bool bOnlyRecentScores, int iNum
|
|||||||
m_vScoreRowItemData[i].m_pCourse = vpCourses[i];
|
m_vScoreRowItemData[i].m_pCourse = vpCourses[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreScroller::Load(
|
void ScoreScroller::Load( RString sClassName )
|
||||||
RString sClassName,
|
|
||||||
const vector<Difficulty> &DifficultiesToShow,
|
|
||||||
float fItemHeight )
|
|
||||||
{
|
{
|
||||||
SCORE_OFFSET_START_X.Load (sClassName, "ScoreOffsetStartX");
|
SONG_SCORE_ROWS_TO_DRAW.Load(sClassName, "SongScoreRowsToDraw");
|
||||||
SCORE_OFFSET_Y.Load (sClassName, "ScoreOffsetY");
|
|
||||||
NO_SCORE_NAME.Load (sClassName, "NoScoreName");
|
|
||||||
COL_SPACING_X.Load (sClassName, "ColSpacingX");
|
|
||||||
SONG_SCORE_SECONDS_PER_ROW.Load (sClassName, "SongScoreSecondsPerRow");
|
|
||||||
m_metricSongScoreRowsToDraw.Load(sClassName, "SongScoreRowsToDraw");
|
|
||||||
|
|
||||||
m_DifficultiesToShow = DifficultiesToShow;
|
int iNumCopies = SONG_SCORE_ROWS_TO_DRAW+1;
|
||||||
|
for( int i=0; i<iNumCopies; ++i )
|
||||||
ScoreScroller::ScoreRowItem ItemTemplate;
|
|
||||||
{
|
{
|
||||||
ItemTemplate.m_sprFrame.Load( THEME->GetPathG(sClassName,"list frame") );
|
Actor *pActor = ActorUtil::MakeActor( THEME->GetPathG(sClassName,"list item") );
|
||||||
ItemTemplate.m_sprFrame->SetName( "Frame" );
|
this->AddChild( pActor );
|
||||||
ActorUtil::LoadAllCommands( *ItemTemplate.m_sprFrame, sClassName );
|
|
||||||
|
|
||||||
ItemTemplate.m_textTitle.SetName( "Title" );
|
|
||||||
ItemTemplate.m_textTitle.LoadFromFont( THEME->GetPathF(sClassName,"list title") );
|
|
||||||
ActorUtil::LoadAllCommands( ItemTemplate.m_textTitle, sClassName );
|
|
||||||
|
|
||||||
ItemTemplate.m_textScore.resize( NUM_Difficulty );
|
|
||||||
FOREACH_CONST( Difficulty, m_DifficultiesToShow, d )
|
|
||||||
{
|
|
||||||
ItemTemplate.m_textScore[*d].SetName( "Score" );
|
|
||||||
ItemTemplate.m_textScore[*d].LoadFromFont( THEME->GetPathF(sClassName,"list score") );
|
|
||||||
ItemTemplate.m_textScore[*d].SetXY( SCORE_OFFSET_X(*d), SCORE_OFFSET_Y );
|
|
||||||
ActorUtil::LoadAllCommands( ItemTemplate.m_textScore[*d], sClassName );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int iNumCopies = m_metricSongScoreRowsToDraw+1;
|
DynamicActorScroller::SetNumItemsToDraw( (float) SONG_SCORE_ROWS_TO_DRAW );
|
||||||
for( int i=0; i<iNumCopies; ++i )
|
|
||||||
this->AddChild( new ScoreRowItem(ItemTemplate) );
|
|
||||||
|
|
||||||
DynamicActorScroller::SetNumItemsToDraw( (float) m_metricSongScoreRowsToDraw );
|
|
||||||
DynamicActorScroller::Load2();
|
DynamicActorScroller::Load2();
|
||||||
DynamicActorScroller::SetTransformFromHeight( fItemHeight );
|
|
||||||
DynamicActorScroller::SetSecondsPerItem( SONG_SCORE_SECONDS_PER_ROW );
|
|
||||||
DynamicActorScroller::EnableMask( SCREEN_WIDTH, fItemHeight );
|
|
||||||
DynamicActorScroller::ScrollThroughAllItems();
|
|
||||||
|
|
||||||
m_iNumItems = m_vScoreRowItemData.size();
|
m_iNumItems = m_vScoreRowItemData.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenRankingScroller::Init()
|
void ScreenRankingScroller::Init()
|
||||||
{
|
{
|
||||||
|
ThemeMetric<bool> SHOW_ONLY_MOST_RECENT_SCORES;
|
||||||
|
ThemeMetric<RString> DIFFICULTIES_TO_SHOW;
|
||||||
|
ThemeMetric<int> NUM_MOST_RECENT_SCORES_TO_SHOW;
|
||||||
|
SHOW_ONLY_MOST_RECENT_SCORES.Load ( m_sName,"ShowOnlyMostRecentScores" );
|
||||||
DIFFICULTIES_TO_SHOW.Load( m_sName, "DifficultiesToShow" );
|
DIFFICULTIES_TO_SHOW.Load( m_sName, "DifficultiesToShow" );
|
||||||
|
|
||||||
COL_SPACING_X.Load( m_sName, "ColSpacingX" );
|
|
||||||
DIFFICULTY_START_X.Load( m_sName, "DifficultyStartX" );
|
|
||||||
DIFFICULTY_Y.Load( m_sName, "DifficultyY" );
|
|
||||||
NUM_MOST_RECENT_SCORES_TO_SHOW.Load( m_sName, "NumMostRecentScoresToShow" );
|
NUM_MOST_RECENT_SCORES_TO_SHOW.Load( m_sName, "NumMostRecentScoresToShow" );
|
||||||
|
|
||||||
ScreenRanking::Init();
|
ScreenRanking::Init();
|
||||||
|
|
||||||
FOREACH_CONST( Difficulty, DIFFICULTIES_TO_SHOW.GetValue(), d )
|
|
||||||
{
|
|
||||||
if( m_PageType == PageType_AllSteps )
|
|
||||||
m_sprDifficulty[*d].Load( THEME->GetPathG(m_sName,"difficulty "+DifficultyToString(*d)) );
|
|
||||||
else
|
|
||||||
m_sprDifficulty[*d].Load( THEME->GetPathG(m_sName,"CourseDifficulty "+DifficultyToString(*d)) );
|
|
||||||
m_sprDifficulty[*d]->SetName( "Difficulty"+DifficultyToString(*d) );
|
|
||||||
m_sprDifficulty[*d]->SetXY( DIFFICULTY_X(*d), DIFFICULTY_Y );
|
|
||||||
this->AddChild( m_sprDifficulty[*d] );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_ListScoreRowItems.SetName( "ListScoreRowItems" );
|
m_ListScoreRowItems.SetName( "ListScoreRowItems" );
|
||||||
LOAD_ALL_COMMANDS( m_ListScoreRowItems );
|
LOAD_ALL_COMMANDS( m_ListScoreRowItems );
|
||||||
switch( m_PageType )
|
switch( m_PageType )
|
||||||
@@ -442,40 +364,37 @@ void ScreenRankingScroller::Init()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ListScoreRowItems.Load( m_sName, DIFFICULTIES_TO_SHOW.GetValue(), ROW_SPACING_Y );
|
m_ListScoreRowItems.Load( m_sName );
|
||||||
this->AddChild( &m_ListScoreRowItems );
|
this->AddChild( &m_ListScoreRowItems );
|
||||||
|
|
||||||
for( unsigned i=0; i<STEPS_TYPES_TO_SHOW.GetValue().size(); i++ )
|
for( unsigned i=0; i<STEPS_TYPES_TO_SHOW.GetValue().size(); i++ )
|
||||||
{
|
{
|
||||||
|
vector<RString> asDifficulties;
|
||||||
|
split( DIFFICULTIES_TO_SHOW, ",", asDifficulties );
|
||||||
|
|
||||||
PageToShow pts;
|
PageToShow pts;
|
||||||
pts.colorIndex = i;
|
for( unsigned d=0; d<asDifficulties.size(); ++d )
|
||||||
pts.st = STEPS_TYPES_TO_SHOW.GetValue()[i];
|
{
|
||||||
|
vector<RString> asBits;
|
||||||
|
split( asDifficulties[d], ":", asBits, false );
|
||||||
|
ASSERT( !asBits.empty() );
|
||||||
|
Difficulty dc = StringToDifficulty(asBits[0]);
|
||||||
|
|
||||||
|
StepsType st = STEPS_TYPES_TO_SHOW.GetValue()[i];
|
||||||
|
if( asBits.size() > 1 )
|
||||||
|
st = GAMEMAN->StringToStepsType( asBits[1] );
|
||||||
|
|
||||||
|
pts.aTypes.push_back( make_pair(dc, st) );
|
||||||
|
}
|
||||||
m_vPagesToShow.push_back( pts );
|
m_vPagesToShow.push_back( pts );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_soundChange.Load( THEME->GetPathS(m_sName,"change") );
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScreenRankingScroller::BeginScreen()
|
|
||||||
{
|
|
||||||
ScreenRanking::BeginScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScoreScroller::SetScoreFromHighScoreList( BitmapText *pTextStepsScore, const HighScoreList &hsl )
|
|
||||||
{
|
|
||||||
HighScore hs = hsl.GetTopScore();
|
|
||||||
if( hsl.vHighScores.empty() )
|
|
||||||
hs.SetName( NO_SCORE_NAME );
|
|
||||||
|
|
||||||
RString s = hs.GetDisplayName() + "\n" + PercentageDisplay::FormatPercentScore( hs.GetPercentDP() );
|
|
||||||
pTextStepsScore->SetText( s );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float ScreenRankingScroller::SetPage( const PageToShow &pts )
|
float ScreenRankingScroller::SetPage( const PageToShow &pts )
|
||||||
{
|
{
|
||||||
ScreenRanking::SetPage( pts );
|
ScreenRanking::SetPage( pts );
|
||||||
|
|
||||||
m_ListScoreRowItems.SetStepsType( pts.st, STEPS_TYPE_COLOR.GetValue(pts.colorIndex) );
|
m_ListScoreRowItems.SetDisplay( pts.aTypes );
|
||||||
|
|
||||||
if( (bool)MANUAL_SCROLLING )
|
if( (bool)MANUAL_SCROLLING )
|
||||||
m_ListScoreRowItems.ScrollTop();
|
m_ListScoreRowItems.ScrollTop();
|
||||||
@@ -500,6 +419,9 @@ float ScreenRankingScroller::SetPage( const PageToShow &pts )
|
|||||||
|
|
||||||
void ScreenRankingLines::Init()
|
void ScreenRankingLines::Init()
|
||||||
{
|
{
|
||||||
|
NO_SCORE_NAME.Load( m_sName,"NoScoreName" );
|
||||||
|
ROW_SPACING_X.Load( m_sName,"RowSpacingX" );
|
||||||
|
ROW_SPACING_Y.Load( m_sName,"RowSpacingY" );
|
||||||
BULLET_START_X.Load( m_sName, "BulletStartX" );
|
BULLET_START_X.Load( m_sName, "BulletStartX" );
|
||||||
BULLET_START_Y.Load( m_sName, "BulletStartY" );
|
BULLET_START_Y.Load( m_sName, "BulletStartY" );
|
||||||
NAME_START_X.Load( m_sName, "NameStartX" );
|
NAME_START_X.Load( m_sName, "NameStartX" );
|
||||||
@@ -510,6 +432,7 @@ void ScreenRankingLines::Init()
|
|||||||
POINTS_START_Y.Load( m_sName, "PointsStartY" );
|
POINTS_START_Y.Load( m_sName, "PointsStartY" );
|
||||||
TIME_START_X.Load( m_sName, "TimeStartX" );
|
TIME_START_X.Load( m_sName, "TimeStartX" );
|
||||||
TIME_START_Y.Load( m_sName, "TimeStartY" );
|
TIME_START_Y.Load( m_sName, "TimeStartY" );
|
||||||
|
STEPS_TYPE_COLOR.Load( m_sName,STEPS_TYPE_COLOR_NAME,5 );
|
||||||
|
|
||||||
ScreenRanking::Init();
|
ScreenRanking::Init();
|
||||||
|
|
||||||
@@ -528,7 +451,8 @@ void ScreenRankingLines::Init()
|
|||||||
PageToShow pts;
|
PageToShow pts;
|
||||||
pts.colorIndex = i;
|
pts.colorIndex = i;
|
||||||
pts.category = (RankingCategory)c;
|
pts.category = (RankingCategory)c;
|
||||||
pts.st = STEPS_TYPES_TO_SHOW.GetValue()[i];
|
StepsType st = STEPS_TYPES_TO_SHOW.GetValue()[i];
|
||||||
|
pts.aTypes.push_back( make_pair(Difficulty_Invalid, st) );
|
||||||
m_vPagesToShow.push_back( pts );
|
m_vPagesToShow.push_back( pts );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -554,12 +478,13 @@ void ScreenRankingLines::Init()
|
|||||||
{
|
{
|
||||||
PageToShow pts;
|
PageToShow pts;
|
||||||
pts.colorIndex = i;
|
pts.colorIndex = i;
|
||||||
pts.st = STEPS_TYPES_TO_SHOW.GetValue()[i];
|
StepsType st = STEPS_TYPES_TO_SHOW.GetValue()[i];
|
||||||
|
pts.aTypes.push_back( make_pair(Difficulty_Invalid, st) );
|
||||||
pts.pCourse = SONGMAN->GetCourseFromPath( asCoursePaths[c] );
|
pts.pCourse = SONGMAN->GetCourseFromPath( asCoursePaths[c] );
|
||||||
if( pts.pCourse == NULL )
|
if( pts.pCourse == NULL )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pts.pTrail = pts.pCourse->GetTrail( pts.st );
|
pts.pTrail = pts.pCourse->GetTrail( st );
|
||||||
if( pts.pTrail == NULL )
|
if( pts.pTrail == NULL )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -647,7 +572,8 @@ float ScreenRankingLines::SetPage( const PageToShow &pts )
|
|||||||
|
|
||||||
for( int l=0; l<NUM_RANKING_LINES; l++ )
|
for( int l=0; l<NUM_RANKING_LINES; l++ )
|
||||||
{
|
{
|
||||||
HighScoreList& hsl = PROFILEMAN->GetMachineProfile()->GetCategoryHighScoreList(pts.st,pts.category);
|
StepsType st = pts.aTypes.front().second;
|
||||||
|
HighScoreList& hsl = PROFILEMAN->GetMachineProfile()->GetCategoryHighScoreList(st, pts.category);
|
||||||
HighScore hs;
|
HighScore hs;
|
||||||
bool bRecentHighScore = false;
|
bool bRecentHighScore = false;
|
||||||
if( l < (int)hsl.vHighScores.size() )
|
if( l < (int)hsl.vHighScores.size() )
|
||||||
@@ -742,7 +668,7 @@ void ScreenRankingLines::BeginScreen()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2005 Chris Danford, Glenn Maynard
|
* (c) 2001-2007 Chris Danford, Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
|||||||
@@ -12,12 +12,12 @@
|
|||||||
#include "Difficulty.h"
|
#include "Difficulty.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
#include "CommonMetrics.h"
|
#include "CommonMetrics.h"
|
||||||
#include "RageSound.h"
|
|
||||||
|
|
||||||
class Course;
|
class Course;
|
||||||
class Song;
|
class Song;
|
||||||
class Trail;
|
class Trail;
|
||||||
struct HighScoreList;
|
struct HighScoreList;
|
||||||
|
typedef pair<Difficulty, StepsType> DifficultyAndStepsType;
|
||||||
|
|
||||||
enum PageType
|
enum PageType
|
||||||
{
|
{
|
||||||
@@ -31,8 +31,6 @@ enum PageType
|
|||||||
NUM_PageType,
|
NUM_PageType,
|
||||||
PageType_Invalid
|
PageType_Invalid
|
||||||
};
|
};
|
||||||
#define FOREACH_PageType( pt ) FOREACH_ENUM( PageType, pt )
|
|
||||||
const RString& PageTypeToString( PageType pt );
|
|
||||||
PageType StringToPageType( const RString& s );
|
PageType StringToPageType( const RString& s );
|
||||||
|
|
||||||
class ScreenRanking : public ScreenAttract
|
class ScreenRanking : public ScreenAttract
|
||||||
@@ -60,7 +58,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int colorIndex;
|
int colorIndex;
|
||||||
StepsType st;
|
vector<DifficultyAndStepsType> aTypes;
|
||||||
RankingCategory category;
|
RankingCategory category;
|
||||||
Course* pCourse;
|
Course* pCourse;
|
||||||
Trail* pTrail;
|
Trail* pTrail;
|
||||||
@@ -78,14 +76,8 @@ protected:
|
|||||||
// Don't use the version in CommonMetrics because we may have multiple
|
// Don't use the version in CommonMetrics because we may have multiple
|
||||||
// ranking screens that want to show different types and difficulties.
|
// ranking screens that want to show different types and difficulties.
|
||||||
ThemeMetricStepsTypesToShow STEPS_TYPES_TO_SHOW;
|
ThemeMetricStepsTypesToShow STEPS_TYPES_TO_SHOW;
|
||||||
ThemeMetric<float> ROW_SPACING_X;
|
|
||||||
ThemeMetric<float> ROW_SPACING_Y;
|
|
||||||
ThemeMetric1D<RageColor> STEPS_TYPE_COLOR;
|
|
||||||
|
|
||||||
ThemeMetric<bool> SHOW_ONLY_MOST_RECENT_SCORES;
|
|
||||||
ThemeMetric<float> SECONDS_PER_PAGE;
|
ThemeMetric<float> SECONDS_PER_PAGE;
|
||||||
ThemeMetric<float> PAGE_FADE_SECONDS;
|
ThemeMetric<float> PAGE_FADE_SECONDS;
|
||||||
LocalizedString NO_SCORE_NAME;
|
|
||||||
ThemeMetric<bool> MANUAL_SCROLLING;
|
ThemeMetric<bool> MANUAL_SCROLLING;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -95,28 +87,14 @@ public:
|
|||||||
ScoreScroller();
|
ScoreScroller();
|
||||||
void LoadSongs( bool bOnlyRecentScores, int iNumRecentScores );
|
void LoadSongs( bool bOnlyRecentScores, int iNumRecentScores );
|
||||||
void LoadCourses( CourseType ct, bool bOnlyRecentScores, int iNumRecentScores );
|
void LoadCourses( CourseType ct, bool bOnlyRecentScores, int iNumRecentScores );
|
||||||
void Load(
|
void Load( RString sClassName );
|
||||||
RString sClassName,
|
void SetDisplay( const vector<DifficultyAndStepsType> &DifficultiesToShow );
|
||||||
const vector<Difficulty> &DifficultiesToShow,
|
|
||||||
float fItemHeight );
|
|
||||||
void SetStepsType( StepsType st, RageColor color );
|
|
||||||
bool Scroll( int iDir );
|
bool Scroll( int iDir );
|
||||||
void ScrollTop();
|
void ScrollTop();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ConfigureActor( Actor *pActor, int iItem );
|
virtual void ConfigureActor( Actor *pActor, int iItem );
|
||||||
void SetScoreFromHighScoreList( BitmapText *pTextStepsScore, const HighScoreList &hsl );
|
vector<DifficultyAndStepsType> m_DifficultiesToShow;
|
||||||
StepsType m_StepsType;
|
|
||||||
vector<Difficulty> m_DifficultiesToShow;
|
|
||||||
|
|
||||||
struct ScoreRowItem: public ActorFrame
|
|
||||||
{
|
|
||||||
ScoreRowItem();
|
|
||||||
ScoreRowItem( const ScoreRowItem &cpy );
|
|
||||||
AutoActor m_sprFrame;
|
|
||||||
BitmapText m_textTitle;
|
|
||||||
vector<BitmapText> m_textScore;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ScoreRowItemData // for all_steps and all_courses
|
struct ScoreRowItemData // for all_steps and all_courses
|
||||||
{
|
{
|
||||||
@@ -127,19 +105,13 @@ protected:
|
|||||||
};
|
};
|
||||||
vector<ScoreRowItemData> m_vScoreRowItemData;
|
vector<ScoreRowItemData> m_vScoreRowItemData;
|
||||||
|
|
||||||
ThemeMetric<float> SCORE_OFFSET_START_X;
|
ThemeMetric<int> SONG_SCORE_ROWS_TO_DRAW;
|
||||||
ThemeMetric<float> SCORE_OFFSET_Y;
|
|
||||||
LocalizedString NO_SCORE_NAME;
|
|
||||||
ThemeMetric<float> COL_SPACING_X;
|
|
||||||
ThemeMetric<float> SONG_SCORE_SECONDS_PER_ROW;
|
|
||||||
ThemeMetric<int> m_metricSongScoreRowsToDraw;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScreenRankingScroller: public ScreenRanking
|
class ScreenRankingScroller: public ScreenRanking
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Init();
|
virtual void Init();
|
||||||
virtual void BeginScreen();
|
|
||||||
|
|
||||||
virtual void MenuLeft( const InputEventPlus &input ) { DoScroll(-1); }
|
virtual void MenuLeft( const InputEventPlus &input ) { DoScroll(-1); }
|
||||||
virtual void MenuRight( const InputEventPlus &input ) { DoScroll(+1); }
|
virtual void MenuRight( const InputEventPlus &input ) { DoScroll(+1); }
|
||||||
@@ -151,16 +123,6 @@ private:
|
|||||||
virtual float SetPage( const PageToShow &pts );
|
virtual float SetPage( const PageToShow &pts );
|
||||||
|
|
||||||
ScoreScroller m_ListScoreRowItems;
|
ScoreScroller m_ListScoreRowItems;
|
||||||
|
|
||||||
AutoActor m_sprDifficulty[NUM_Difficulty]; // for all_steps
|
|
||||||
|
|
||||||
ThemeMetricDifficultiesToShow DIFFICULTIES_TO_SHOW;
|
|
||||||
ThemeMetric<float> COL_SPACING_X;
|
|
||||||
ThemeMetric<float> DIFFICULTY_START_X;
|
|
||||||
ThemeMetric<float> DIFFICULTY_Y;
|
|
||||||
ThemeMetric<int> NUM_MOST_RECENT_SCORES_TO_SHOW;
|
|
||||||
|
|
||||||
RageSound m_soundChange;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const int NUM_RANKING_LINES = 5;
|
static const int NUM_RANKING_LINES = 5;
|
||||||
@@ -183,7 +145,11 @@ private:
|
|||||||
BitmapText m_textScores[NUM_RANKING_LINES]; // for category and course
|
BitmapText m_textScores[NUM_RANKING_LINES]; // for category and course
|
||||||
BitmapText m_textPoints[NUM_RANKING_LINES]; // for course
|
BitmapText m_textPoints[NUM_RANKING_LINES]; // for course
|
||||||
BitmapText m_textTime[NUM_RANKING_LINES]; // for course
|
BitmapText m_textTime[NUM_RANKING_LINES]; // for course
|
||||||
|
ThemeMetric1D<RageColor> STEPS_TYPE_COLOR;
|
||||||
|
|
||||||
|
LocalizedString NO_SCORE_NAME;
|
||||||
|
ThemeMetric<float> ROW_SPACING_X;
|
||||||
|
ThemeMetric<float> ROW_SPACING_Y;
|
||||||
ThemeMetric<float> BULLET_START_X;
|
ThemeMetric<float> BULLET_START_X;
|
||||||
ThemeMetric<float> BULLET_START_Y;
|
ThemeMetric<float> BULLET_START_Y;
|
||||||
ThemeMetric<float> NAME_START_X;
|
ThemeMetric<float> NAME_START_X;
|
||||||
@@ -199,7 +165,7 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2005 Chris Danford, Ben Nordstrom, Glenn Maynard
|
* (c) 2001-2007 Chris Danford, Ben Nordstrom, Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
|||||||
Reference in New Issue
Block a user