don't throw away Song scores for Songs/Steps that aren't currently loaded on the machine
This commit is contained in:
@@ -1262,7 +1262,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
|
|||||||
|
|
||||||
// Find Machine Records
|
// Find Machine Records
|
||||||
{
|
{
|
||||||
HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSteps);
|
HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong,pSteps);
|
||||||
for( j=0; j<hsl.vHighScores.size(); j++ )
|
for( j=0; j<hsl.vHighScores.size(); j++ )
|
||||||
{
|
{
|
||||||
HighScore &hs = hsl.vHighScores[j];
|
HighScore &hs = hsl.vHighScores[j];
|
||||||
@@ -1290,7 +1290,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeat> &asFeatsOu
|
|||||||
// Find Personal Records
|
// Find Personal Records
|
||||||
if( pProf )
|
if( pProf )
|
||||||
{
|
{
|
||||||
HighScoreList &hsl = pProf->GetStepsHighScoreList(pSteps);
|
HighScoreList &hsl = pProf->GetStepsHighScoreList(pSong,pSteps);
|
||||||
for( j=0; j<hsl.vHighScores.size(); j++ )
|
for( j=0; j<hsl.vHighScores.size(); j++ )
|
||||||
{
|
{
|
||||||
HighScore &hs = hsl.vHighScores[j];
|
HighScore &hs = hsl.vHighScores[j];
|
||||||
|
|||||||
@@ -189,16 +189,16 @@ void PaneDisplay::SetContent( PaneContents c )
|
|||||||
case SONG_DIFFICULTY_RADAR_FREEZE: val = rv[RADAR_FREEZE]; break;
|
case SONG_DIFFICULTY_RADAR_FREEZE: val = rv[RADAR_FREEZE]; break;
|
||||||
case SONG_DIFFICULTY_RADAR_CHAOS: val = rv[RADAR_CHAOS]; break;
|
case SONG_DIFFICULTY_RADAR_CHAOS: val = rv[RADAR_CHAOS]; break;
|
||||||
case SONG_PROFILE_HIGH_SCORE:
|
case SONG_PROFILE_HIGH_SCORE:
|
||||||
val = 100.0f * PROFILEMAN->GetProfile(m_PlayerNumber)->GetStepsHighScoreList(pSteps).GetTopScore().fPercentDP;
|
val = 100.0f * PROFILEMAN->GetProfile(m_PlayerNumber)->GetStepsHighScoreList(pSong,pSteps).GetTopScore().fPercentDP;
|
||||||
break;
|
break;
|
||||||
case SONG_PROFILE_NUM_PLAYS:
|
case SONG_PROFILE_NUM_PLAYS:
|
||||||
val = (float) PROFILEMAN->GetProfile(m_PlayerNumber)->GetStepsNumTimesPlayed(pSteps);
|
val = (float) PROFILEMAN->GetProfile(m_PlayerNumber)->GetStepsNumTimesPlayed(pSong,pSteps);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SONG_MACHINE_HIGH_NAME: /* set val for color */
|
case SONG_MACHINE_HIGH_NAME: /* set val for color */
|
||||||
case SONG_MACHINE_HIGH_SCORE:
|
case SONG_MACHINE_HIGH_SCORE:
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
val = 100.0f * PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSteps).GetTopScore().fPercentDP;
|
val = 100.0f * PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong,pSteps).GetTopScore().fPercentDP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SONG_MACHINE_RANK:
|
case SONG_MACHINE_RANK:
|
||||||
@@ -265,7 +265,7 @@ void PaneDisplay::SetContent( PaneContents c )
|
|||||||
switch( c )
|
switch( c )
|
||||||
{
|
{
|
||||||
case SONG_MACHINE_HIGH_NAME:
|
case SONG_MACHINE_HIGH_NAME:
|
||||||
str = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSteps).GetTopScore().sName;
|
str = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong,pSteps).GetTopScore().sName;
|
||||||
break;
|
break;
|
||||||
case COURSE_MACHINE_HIGH_NAME:
|
case COURSE_MACHINE_HIGH_NAME:
|
||||||
str = PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList(pCourse,st,cd).GetTopScore().sName;
|
str = PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList(pCourse,st,cd).GetTopScore().sName;
|
||||||
|
|||||||
+89
-106
@@ -116,7 +116,7 @@ void Profile::InitGeneralData()
|
|||||||
|
|
||||||
void Profile::InitSongScores()
|
void Profile::InitSongScores()
|
||||||
{
|
{
|
||||||
m_StepsHighScores.clear();
|
m_SongHighScores.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profile::InitCourseScores()
|
void Profile::InitCourseScores()
|
||||||
@@ -195,13 +195,33 @@ int Profile::GetTotalHighScoreDancePointsForStepsType( StepsType st ) const
|
|||||||
|
|
||||||
// add steps high scores
|
// add steps high scores
|
||||||
{
|
{
|
||||||
for( std::map<const Steps*,HighScoresForASteps>::const_iterator iter = m_StepsHighScores.begin();
|
for( std::map<SongID,HighScoresForASong>::const_iterator i = m_SongHighScores.begin();
|
||||||
iter != m_StepsHighScores.end();
|
i != m_SongHighScores.end();
|
||||||
iter++ )
|
i++ )
|
||||||
{
|
{
|
||||||
const Steps* pSteps = iter->first;
|
SongID id = i->first;
|
||||||
ASSERT( pSteps );
|
Song* pSong = id.ToSong();
|
||||||
const HighScoresForASteps& h = iter->second;
|
|
||||||
|
// If the Song isn't loaded on the current machine, then we can't
|
||||||
|
// get radar values to compute dance points.
|
||||||
|
if( pSong == NULL )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const HighScoresForASong &hsfas = i->second;
|
||||||
|
|
||||||
|
for( std::map<StepsID,HighScoresForASteps>::const_iterator j = hsfas.m_StepsHighScores.begin();
|
||||||
|
j != hsfas.m_StepsHighScores.end();
|
||||||
|
j++ )
|
||||||
|
{
|
||||||
|
StepsID id = j->first;
|
||||||
|
Steps* pSteps = id.ToSteps( pSong, true );
|
||||||
|
|
||||||
|
// If the Steps isn't loaded on the current machine, then we can't
|
||||||
|
// get radar values to compute dance points.
|
||||||
|
if( pSteps == NULL )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const HighScoresForASteps& h = j->second;
|
||||||
const HighScoreList& hs = h.hs;
|
const HighScoreList& hs = h.hs;
|
||||||
if( pSteps->m_StepsType == st )
|
if( pSteps->m_StepsType == st )
|
||||||
{
|
{
|
||||||
@@ -211,6 +231,7 @@ int Profile::GetTotalHighScoreDancePointsForStepsType( StepsType st ) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add course high scores
|
// add course high scores
|
||||||
{
|
{
|
||||||
@@ -249,13 +270,25 @@ CString Profile::GetProfileDisplayNameFromDir( CString sDir )
|
|||||||
|
|
||||||
int Profile::GetSongNumTimesPlayed( const Song* pSong ) const
|
int Profile::GetSongNumTimesPlayed( const Song* pSong ) const
|
||||||
{
|
{
|
||||||
int iTotalNumTimesPlayed = 0;
|
SongID songID;
|
||||||
vector<Steps*> vpSteps;
|
songID.FromSong( pSong );
|
||||||
pSong->GetSteps( vpSteps );
|
return GetSongNumTimesPlayed( songID );
|
||||||
for( unsigned i=0; i<vpSteps.size(); i++ )
|
}
|
||||||
|
|
||||||
|
int Profile::GetSongNumTimesPlayed( const SongID& songID ) const
|
||||||
{
|
{
|
||||||
const Steps* pSteps = vpSteps[i];
|
int iTotalNumTimesPlayed = 0;
|
||||||
iTotalNumTimesPlayed += ((Profile*) this)->GetStepsHighScoreList(pSteps).iNumTimesPlayed;
|
|
||||||
|
std::map<SongID,HighScoresForASong> &songHighScores = ((Profile*)(this))->m_SongHighScores;
|
||||||
|
const HighScoresForASong& hsSong = songHighScores[songID];
|
||||||
|
|
||||||
|
for( std::map<StepsID,HighScoresForASteps>::const_iterator j = hsSong.m_StepsHighScores.begin();
|
||||||
|
j != hsSong.m_StepsHighScores.end();
|
||||||
|
j++ )
|
||||||
|
{
|
||||||
|
const HighScoresForASteps &hsSteps = j->second;
|
||||||
|
|
||||||
|
iTotalNumTimesPlayed += hsSteps.hs.iNumTimesPlayed;
|
||||||
}
|
}
|
||||||
return iTotalNumTimesPlayed;
|
return iTotalNumTimesPlayed;
|
||||||
}
|
}
|
||||||
@@ -263,46 +296,38 @@ int Profile::GetSongNumTimesPlayed( const Song* pSong ) const
|
|||||||
//
|
//
|
||||||
// Steps high scores
|
// Steps high scores
|
||||||
//
|
//
|
||||||
void Profile::AddStepsHighScore( const Steps* pSteps, HighScore hs, int &iIndexOut )
|
void Profile::AddStepsHighScore( const Song* pSong, const Steps* pSteps, HighScore hs, int &iIndexOut )
|
||||||
{
|
{
|
||||||
ASSERT(pSteps);
|
GetStepsHighScoreList(pSong,pSteps).AddHighScore( hs, iIndexOut );
|
||||||
std::map<const Steps*,HighScoresForASteps>::iterator iter = m_StepsHighScores.find( pSteps );
|
|
||||||
if( iter == m_StepsHighScores.end() )
|
|
||||||
m_StepsHighScores[pSteps].hs.AddHighScore( hs, iIndexOut ); // operator[] inserts into map
|
|
||||||
else
|
|
||||||
iter->second.hs.AddHighScore( hs, iIndexOut );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const HighScoreList& Profile::GetStepsHighScoreList( const Steps* pSteps ) const
|
const HighScoreList& Profile::GetStepsHighScoreList( const Song* pSong, const Steps* pSteps ) const
|
||||||
{
|
{
|
||||||
ASSERT(pSteps);
|
return ((Profile*)this)->GetStepsHighScoreList(pSong,pSteps);
|
||||||
/* We're const, but insert a blank entry anyway if the requested pointer doesn't exist. */
|
|
||||||
return ((Profile *) this)->m_StepsHighScores[pSteps].hs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HighScoreList& Profile::GetStepsHighScoreList( const Steps* pSteps )
|
HighScoreList& Profile::GetStepsHighScoreList( const Song* pSong, const Steps* pSteps )
|
||||||
{
|
{
|
||||||
ASSERT(pSteps);
|
SongID songID;
|
||||||
std::map<const Steps*,HighScoresForASteps>::iterator iter = m_StepsHighScores.find( pSteps );
|
songID.FromSong( pSong );
|
||||||
if( iter == m_StepsHighScores.end() )
|
|
||||||
return m_StepsHighScores[pSteps].hs; // operator[] inserts into map
|
StepsID stepsID;
|
||||||
else
|
stepsID.FromSteps( pSteps );
|
||||||
return iter->second.hs;
|
|
||||||
|
HighScoresForASong &hsSong = m_SongHighScores[songID]; // operator[] inserts into map
|
||||||
|
HighScoresForASteps &hsSteps = hsSong.m_StepsHighScores[stepsID]; // operator[] inserts into map
|
||||||
|
|
||||||
|
return hsSteps.hs;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Profile::GetStepsNumTimesPlayed( const Steps* pSteps ) const
|
int Profile::GetStepsNumTimesPlayed( const Song* pSong, const Steps* pSteps ) const
|
||||||
{
|
{
|
||||||
ASSERT(pSteps);
|
return GetStepsHighScoreList(pSong,pSteps).iNumTimesPlayed;
|
||||||
std::map<const Steps*,HighScoresForASteps>::const_iterator iter = m_StepsHighScores.find( pSteps );
|
|
||||||
if( iter == m_StepsHighScores.end() )
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return iter->second.hs.iNumTimesPlayed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profile::IncrementStepsPlayCount( const Steps* pSteps )
|
void Profile::IncrementStepsPlayCount( const Song* pSong, const Steps* pSteps )
|
||||||
{
|
{
|
||||||
GetStepsHighScoreList(pSteps).iNumTimesPlayed++;
|
GetStepsHighScoreList(pSong,pSteps).iNumTimesPlayed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -862,38 +887,34 @@ XNode* Profile::SaveSongScoresCreateNode() const
|
|||||||
XNode* pNode = new XNode;
|
XNode* pNode = new XNode;
|
||||||
pNode->name = "SongScores";
|
pNode->name = "SongScores";
|
||||||
|
|
||||||
const vector<Song*> &vpSongs = SONGMAN->GetAllSongs();
|
for( std::map<SongID,HighScoresForASong>::const_iterator i = m_SongHighScores.begin();
|
||||||
|
i != m_SongHighScores.end();
|
||||||
for( unsigned s=0; s<vpSongs.size(); s++ ) // foreach song
|
i++ )
|
||||||
{
|
{
|
||||||
Song* pSong = vpSongs[s];
|
const SongID &songID = i->first;
|
||||||
ASSERT(pSong);
|
const HighScoresForASong &hsSong = i->second;
|
||||||
|
|
||||||
// skip songs that have never been played
|
// skip songs that have never been played
|
||||||
if( pProfile->GetSongNumTimesPlayed(pSong) == 0 )
|
if( pProfile->GetSongNumTimesPlayed(songID) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LPXNode pSongNode = pNode->AppendChild( "Song" );
|
|
||||||
pSongNode->AppendAttr( "Dir", pSong->GetSongDir() );
|
|
||||||
|
|
||||||
const vector<Steps*> vSteps = pSong->GetAllSteps();
|
LPXNode pSongNode = pNode->AppendChild( songID.CreateNode() );
|
||||||
|
|
||||||
for( unsigned n=0; n<vSteps.size(); n++ )
|
for( std::map<StepsID,HighScoresForASteps>::const_iterator j = hsSong.m_StepsHighScores.begin();
|
||||||
|
j != hsSong.m_StepsHighScores.end();
|
||||||
|
j++ )
|
||||||
{
|
{
|
||||||
Steps* pSteps = vSteps[n];
|
const StepsID &stepsID = j->first;
|
||||||
|
const HighScoresForASteps &hsSteps = j->second;
|
||||||
|
|
||||||
|
const HighScoreList &hsl = hsSteps.hs;
|
||||||
|
|
||||||
// skip steps that have never been played
|
// skip steps that have never been played
|
||||||
if( pProfile->GetStepsHighScoreList(pSteps).iNumTimesPlayed == 0 )
|
if( hsl.iNumTimesPlayed == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LPXNode pStepsNode = pSongNode->AppendChild( "Steps" );
|
LPXNode pStepsNode = pSongNode->AppendChild( stepsID.CreateNode() );
|
||||||
|
|
||||||
const HighScoreList &hsl = pProfile->GetStepsHighScoreList( pSteps );
|
|
||||||
|
|
||||||
pStepsNode->AppendAttr( "StepsType", GameManager::NotesTypeToString(pSteps->m_StepsType) );
|
|
||||||
pStepsNode->AppendAttr( "Difficulty", DifficultyToString(pSteps->GetDifficulty()) );
|
|
||||||
if( pSteps->GetDifficulty() == DIFFICULTY_EDIT )
|
|
||||||
pStepsNode->AppendChild( "Description", pSteps->GetDescription() );
|
|
||||||
|
|
||||||
pStepsNode->AppendChild( hsl.CreateNode() );
|
pStepsNode->AppendChild( hsl.CreateNode() );
|
||||||
}
|
}
|
||||||
@@ -913,17 +934,11 @@ void Profile::LoadSongScoresFromNode( const XNode* pNode )
|
|||||||
if( (*song)->name != "Song" )
|
if( (*song)->name != "Song" )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CString sSongDir;
|
SongID songID;
|
||||||
if( !(*song)->GetAttrValue( "Dir", sSongDir ) )
|
songID.LoadFromNode( *song );
|
||||||
|
if( !songID.IsValid() )
|
||||||
WARN_AND_CONTINUE;
|
WARN_AND_CONTINUE;
|
||||||
|
|
||||||
Song* pSong = SONGMAN->GetSongFromDir( sSongDir );
|
|
||||||
if( pSong == NULL )
|
|
||||||
{
|
|
||||||
LOG->Trace("Couldn't find song \"%s\"; scoring data will be lost", sSongDir.c_str() );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for( XNodes::iterator steps = (*song)->childs.begin();
|
for( XNodes::iterator steps = (*song)->childs.begin();
|
||||||
steps != (*song)->childs.end();
|
steps != (*song)->childs.end();
|
||||||
steps++ )
|
steps++ )
|
||||||
@@ -931,48 +946,16 @@ void Profile::LoadSongScoresFromNode( const XNode* pNode )
|
|||||||
if( (*steps)->name != "Steps" )
|
if( (*steps)->name != "Steps" )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CString str;
|
StepsID stepsID;
|
||||||
if( !(*steps)->GetAttrValue("StepsType", str) )
|
stepsID.LoadFromNode( *steps );
|
||||||
|
if( !stepsID.IsValid() )
|
||||||
WARN_AND_CONTINUE;
|
WARN_AND_CONTINUE;
|
||||||
const StepsType st = GameManager::StringToNotesType( str );
|
|
||||||
if( st == STEPS_TYPE_INVALID )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
|
|
||||||
if( !(*steps)->GetAttrValue("Difficulty", str) )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
const Difficulty dc = StringToDifficulty( str );
|
|
||||||
if( dc == DIFFICULTY_INVALID )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
|
|
||||||
Steps* pSteps = NULL;
|
|
||||||
if( dc == DIFFICULTY_EDIT )
|
|
||||||
{
|
|
||||||
CString sDescription;
|
|
||||||
if( !(*steps)->GetChildValue("Description", sDescription) )
|
|
||||||
WARN_AND_CONTINUE;
|
|
||||||
|
|
||||||
pSteps = pSong->GetStepsByDescription( st, sDescription );
|
|
||||||
if( pSteps == NULL )
|
|
||||||
{
|
|
||||||
LOG->Trace("Edit steps \"%s\" missing in song \"%s\"; scoring data will be lost", sDescription.c_str(), sSongDir.c_str() );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pSteps = pSong->GetStepsByDifficulty( st, dc );
|
|
||||||
if( pSteps == NULL )
|
|
||||||
{
|
|
||||||
LOG->Trace("\"%s\" steps missing in song \"%s\"; scoring data will be lost", DifficultyToString(dc).c_str(), sSongDir.c_str() );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
XNode *pHighScoreListNode = (*steps)->GetChild("HighScoreList");
|
XNode *pHighScoreListNode = (*steps)->GetChild("HighScoreList");
|
||||||
if( pHighScoreListNode == NULL )
|
if( pHighScoreListNode == NULL )
|
||||||
WARN_AND_CONTINUE;
|
WARN_AND_CONTINUE;
|
||||||
|
|
||||||
HighScoreList &hsl = this->GetStepsHighScoreList( pSteps );
|
HighScoreList &hsl = m_SongHighScores[songID].m_StepsHighScores[stepsID].hs;
|
||||||
hsl.LoadFromNode( pHighScoreListNode );
|
hsl.LoadFromNode( pHighScoreListNode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1069,7 +1052,7 @@ void Profile::LoadSongScoresFromDirSM390a12( CString sDir )
|
|||||||
if( !FileRead(f, iNumTimesPlayed) )
|
if( !FileRead(f, iNumTimesPlayed) )
|
||||||
WARN_AND_RETURN;
|
WARN_AND_RETURN;
|
||||||
|
|
||||||
HighScoreList &hsl = pProfile->GetStepsHighScoreList(pSteps);
|
HighScoreList &hsl = pProfile->GetStepsHighScoreList(pSong,pSteps);
|
||||||
|
|
||||||
if( pSteps )
|
if( pSteps )
|
||||||
hsl.iNumTimesPlayed = iNumTimesPlayed;
|
hsl.iNumTimesPlayed = iNumTimesPlayed;
|
||||||
|
|||||||
+14
-7
@@ -20,6 +20,8 @@
|
|||||||
#include "XmlFile.h"
|
#include "XmlFile.h"
|
||||||
#include "HighScore.h"
|
#include "HighScore.h"
|
||||||
#include "TimeConstants.h"
|
#include "TimeConstants.h"
|
||||||
|
#include "SongUtil.h" // for SongID
|
||||||
|
#include "StepsUtil.h" // for StepsID
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -73,6 +75,7 @@ public:
|
|||||||
int GetTotalHighScoreDancePointsForStepsType( StepsType st ) const;
|
int GetTotalHighScoreDancePointsForStepsType( StepsType st ) const;
|
||||||
static CString GetProfileDisplayNameFromDir( CString sDir );
|
static CString GetProfileDisplayNameFromDir( CString sDir );
|
||||||
int GetSongNumTimesPlayed( const Song* pSong ) const;
|
int GetSongNumTimesPlayed( const Song* pSong ) const;
|
||||||
|
int GetSongNumTimesPlayed( const SongID& songID ) const;
|
||||||
|
|
||||||
void AddStepTotals( int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumMines, int iNumHands );
|
void AddStepTotals( int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumMines, int iNumHands );
|
||||||
|
|
||||||
@@ -117,19 +120,23 @@ public:
|
|||||||
int m_iNumSongsPassedByGrade[NUM_GRADES];
|
int m_iNumSongsPassedByGrade[NUM_GRADES];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Steps high scores
|
// Song high scores
|
||||||
//
|
//
|
||||||
struct HighScoresForASteps
|
struct HighScoresForASteps
|
||||||
{
|
{
|
||||||
HighScoreList hs;
|
HighScoreList hs;
|
||||||
};
|
};
|
||||||
std::map<const Steps*,HighScoresForASteps> m_StepsHighScores;
|
struct HighScoresForASong
|
||||||
|
{
|
||||||
|
std::map<StepsID,HighScoresForASteps> m_StepsHighScores;
|
||||||
|
};
|
||||||
|
std::map<SongID,HighScoresForASong> m_SongHighScores;
|
||||||
|
|
||||||
void AddStepsHighScore( const Steps* pSteps, HighScore hs, int &iIndexOut );
|
void AddStepsHighScore( const Song* pSong, const Steps* pSteps, HighScore hs, int &iIndexOut );
|
||||||
HighScoreList& GetStepsHighScoreList( const Steps* pSteps );
|
const HighScoreList& GetStepsHighScoreList( const Song* pSong, const Steps* pSteps ) const;
|
||||||
const HighScoreList& GetStepsHighScoreList( const Steps* pSteps ) const;
|
HighScoreList& GetStepsHighScoreList( const Song* pSong, const Steps* pSteps );
|
||||||
int GetStepsNumTimesPlayed( const Steps* pSteps ) const;
|
int GetStepsNumTimesPlayed( const Song* pSong, const Steps* pSteps ) const;
|
||||||
void IncrementStepsPlayCount( const Steps* pSteps );
|
void IncrementStepsPlayCount( const Song* pSong, const Steps* pSteps );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -347,10 +347,16 @@ void PrintStatistics( RageFile &f, const Profile *pProfile, CString sTitle, vect
|
|||||||
int iGradeCount[NUM_GRADES];
|
int iGradeCount[NUM_GRADES];
|
||||||
ZERO( iGradeCount );
|
ZERO( iGradeCount );
|
||||||
|
|
||||||
for( unsigned i=0; i<vpAllSteps.size(); i++ )
|
for( unsigned i=0; i<vpSongs.size(); i++ )
|
||||||
{
|
{
|
||||||
Steps* pSteps = vpAllSteps[i];
|
Song* pSong = vpSongs[i];
|
||||||
const HighScoreList &hsl = pProfile->GetStepsHighScoreList(pSteps);
|
const vector<Steps*> vpSteps = pSong->GetAllSteps();
|
||||||
|
|
||||||
|
for( unsigned j=0; j<vpSteps.size(); j++ )
|
||||||
|
{
|
||||||
|
const Steps* pSteps = vpSteps[j];
|
||||||
|
|
||||||
|
const HighScoreList &hsl = pProfile->GetStepsHighScoreList(pSong,pSteps);
|
||||||
if( hsl.vHighScores.empty() )
|
if( hsl.vHighScores.empty() )
|
||||||
continue; // no data, skip this one
|
continue; // no data, skip this one
|
||||||
Grade g = hsl.GetTopScore().grade;
|
Grade g = hsl.GetTopScore().grade;
|
||||||
@@ -359,6 +365,7 @@ void PrintStatistics( RageFile &f, const Profile *pProfile, CString sTitle, vect
|
|||||||
ASSERT( g >= 0 );
|
ASSERT( g >= 0 );
|
||||||
iGradeCount[g] ++;
|
iGradeCount[g] ++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BEGIN_TABLE(6);
|
BEGIN_TABLE(6);
|
||||||
for( int g=0; g<PREFSMAN->m_iNumGradeTiersUsed; g++ )
|
for( int g=0; g<PREFSMAN->m_iNumGradeTiersUsed; g++ )
|
||||||
@@ -445,10 +452,10 @@ void PrintPopularity( RageFile &f, const Profile *pProfile, CString sTitle, vect
|
|||||||
for( i=0; i<uNumToShow; i++ )
|
for( i=0; i<uNumToShow; i++ )
|
||||||
{
|
{
|
||||||
Steps* pSteps = vpAllSteps[i];
|
Steps* pSteps = vpAllSteps[i];
|
||||||
int iNumTimesPlayed = pProfile->GetStepsNumTimesPlayed(pSteps);
|
Song* pSong = mapStepsToSong[pSteps];
|
||||||
|
int iNumTimesPlayed = pProfile->GetStepsNumTimesPlayed(pSong,pSteps);
|
||||||
if( iNumTimesPlayed==0 )
|
if( iNumTimesPlayed==0 )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
Song* pSong = mapStepsToSong[pSteps];
|
|
||||||
CString s;
|
CString s;
|
||||||
s += GAMEMAN->NotesTypeToString(pSteps->m_StepsType);
|
s += GAMEMAN->NotesTypeToString(pSteps->m_StepsType);
|
||||||
s += " ";
|
s += " ";
|
||||||
@@ -633,10 +640,10 @@ bool PrintHighScoresForSong( RageFile &f, const Profile *pProfile, Song* pSong )
|
|||||||
Steps* pSteps = vpSteps[j];
|
Steps* pSteps = vpSteps[j];
|
||||||
if( pSteps->IsAutogen() )
|
if( pSteps->IsAutogen() )
|
||||||
continue; // skip autogen
|
continue; // skip autogen
|
||||||
if( pProfile->GetStepsNumTimesPlayed(pSteps)==0 )
|
if( pProfile->GetStepsNumTimesPlayed(pSong,pSteps)==0 )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
const HighScoreList &hsl = pProfile->GetStepsHighScoreList( pSteps );
|
const HighScoreList &hsl = pProfile->GetStepsHighScoreList( pSong,pSteps );
|
||||||
if( hsl.vHighScores.empty() )
|
if( hsl.vHighScores.empty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -737,7 +744,7 @@ bool PrintGradeTableForStepsType( RageFile &f, const Profile *pProfile, StepsTyp
|
|||||||
{
|
{
|
||||||
f.PutLine("<td>");
|
f.PutLine("<td>");
|
||||||
f.PutLine( ssprintf("<font class='meter'>%d</font>",pSteps->GetMeter()) );
|
f.PutLine( ssprintf("<font class='meter'>%d</font>",pSteps->GetMeter()) );
|
||||||
HighScore hs = pProfile->GetStepsHighScoreList( pSteps ).GetTopScore();
|
HighScore hs = pProfile->GetStepsHighScoreList( pSong,pSteps ).GetTopScore();
|
||||||
Grade grade = hs.grade;
|
Grade grade = hs.grade;
|
||||||
if( grade != GRADE_NO_DATA )
|
if( grade != GRADE_NO_DATA )
|
||||||
f.PutLine( ssprintf("<font class='grade'>%s</font>",GradeToThemedString(grade).c_str()) );
|
f.PutLine( ssprintf("<font class='grade'>%s</font>",GradeToThemedString(grade).c_str()) );
|
||||||
@@ -803,7 +810,7 @@ bool PrintInventoryForSong( RageFile &f, const Profile *pProfile, Song* pSong )
|
|||||||
BEGIN_TABLE(3);
|
BEGIN_TABLE(3);
|
||||||
TABLE_LINE2( "Meter", pSteps->GetMeter() );
|
TABLE_LINE2( "Meter", pSteps->GetMeter() );
|
||||||
TABLE_LINE2( "Description", pSteps->GetDescription() );
|
TABLE_LINE2( "Description", pSteps->GetDescription() );
|
||||||
TABLE_LINE2( "NumTimesPlayed", pProfile->GetStepsNumTimesPlayed(pSteps) );
|
TABLE_LINE2( "NumTimesPlayed", pProfile->GetStepsNumTimesPlayed(pSong,pSteps) );
|
||||||
END_TABLE;
|
END_TABLE;
|
||||||
|
|
||||||
BEGIN_TABLE(2);
|
BEGIN_TABLE(2);
|
||||||
|
|||||||
@@ -432,21 +432,21 @@ int ProfileManager::GetSongNumTimesPlayed( const Song* pSong, ProfileSlot slot )
|
|||||||
return GetProfile(slot)->GetSongNumTimesPlayed( pSong );
|
return GetProfile(slot)->GetSongNumTimesPlayed( pSong );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileManager::AddStepsHighScore( const Steps* pSteps, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut )
|
void ProfileManager::AddStepsHighScore( const Song* pSong, const Steps* pSteps, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut )
|
||||||
{
|
{
|
||||||
hs.sName = RANKING_TO_FILL_IN_MARKER[pn];
|
hs.sName = RANKING_TO_FILL_IN_MARKER[pn];
|
||||||
if( PROFILEMAN->IsUsingProfile(pn) )
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
||||||
PROFILEMAN->GetProfile(pn)->AddStepsHighScore( pSteps, hs, iPersonalIndexOut );
|
PROFILEMAN->GetProfile(pn)->AddStepsHighScore( pSong, pSteps, hs, iPersonalIndexOut );
|
||||||
else
|
else
|
||||||
iPersonalIndexOut = -1;
|
iPersonalIndexOut = -1;
|
||||||
PROFILEMAN->GetMachineProfile()->AddStepsHighScore( pSteps, hs, iMachineIndexOut );
|
PROFILEMAN->GetMachineProfile()->AddStepsHighScore( pSong, pSteps, hs, iMachineIndexOut );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileManager::IncrementStepsPlayCount( const Steps* pSteps, PlayerNumber pn )
|
void ProfileManager::IncrementStepsPlayCount( const Song* pSong, const Steps* pSteps, PlayerNumber pn )
|
||||||
{
|
{
|
||||||
if( PROFILEMAN->IsUsingProfile(pn) )
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
||||||
PROFILEMAN->GetProfile(pn)->IncrementStepsPlayCount( pSteps );
|
PROFILEMAN->GetProfile(pn)->IncrementStepsPlayCount( pSong, pSteps );
|
||||||
PROFILEMAN->GetMachineProfile()->IncrementStepsPlayCount( pSteps );
|
PROFILEMAN->GetMachineProfile()->IncrementStepsPlayCount( pSong, pSteps );
|
||||||
}
|
}
|
||||||
|
|
||||||
HighScore ProfileManager::GetHighScoreForDifficulty( const Song *s, const StyleDef *st, ProfileSlot slot, Difficulty dc ) const
|
HighScore ProfileManager::GetHighScoreForDifficulty( const Song *s, const StyleDef *st, ProfileSlot slot, Difficulty dc ) const
|
||||||
@@ -459,7 +459,7 @@ HighScore ProfileManager::GetHighScoreForDifficulty( const Song *s, const StyleD
|
|||||||
const Steps* pSteps = s->GetStepsByDifficulty( st->m_StepsType, dc );
|
const Steps* pSteps = s->GetStepsByDifficulty( st->m_StepsType, dc );
|
||||||
|
|
||||||
if( pSteps && PROFILEMAN->IsUsingProfile(slot) )
|
if( pSteps && PROFILEMAN->IsUsingProfile(slot) )
|
||||||
return PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(pSteps).GetTopScore();
|
return PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(s,pSteps).GetTopScore();
|
||||||
else
|
else
|
||||||
return HighScore();
|
return HighScore();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ public:
|
|||||||
//
|
//
|
||||||
int GetSongNumTimesPlayed( const Song* pSong, ProfileSlot card ) const;
|
int GetSongNumTimesPlayed( const Song* pSong, ProfileSlot card ) const;
|
||||||
bool IsSongNew( const Song* pSong ) const { return GetSongNumTimesPlayed(pSong,PROFILE_SLOT_MACHINE)==0; }
|
bool IsSongNew( const Song* pSong ) const { return GetSongNumTimesPlayed(pSong,PROFILE_SLOT_MACHINE)==0; }
|
||||||
void AddStepsHighScore( const Steps* pSteps, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut );
|
void AddStepsHighScore( const Song* pSong, const Steps* pSteps, PlayerNumber pn, HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut );
|
||||||
void IncrementStepsPlayCount( const Steps* pSteps, PlayerNumber pn );
|
void IncrementStepsPlayCount( const Song* pSong, const Steps* pSteps, PlayerNumber pn );
|
||||||
HighScore GetHighScoreForDifficulty( const Song *s, const StyleDef *st, ProfileSlot slot, Difficulty dc ) const;
|
HighScore GetHighScoreForDifficulty( const Song *s, const StyleDef *st, ProfileSlot slot, Difficulty dc ) const;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -919,6 +919,9 @@ void ScreenEvaluation::CommitScores(
|
|||||||
if( GAMESTATE->IsDisqualified((PlayerNumber)p) )
|
if( GAMESTATE->IsDisqualified((PlayerNumber)p) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Song* pSong = GAMESTATE->m_pCurSong;
|
||||||
|
Steps* pSteps = GAMESTATE->m_pCurNotes[p];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add step totals
|
// Add step totals
|
||||||
//
|
//
|
||||||
@@ -952,10 +955,10 @@ void ScreenEvaluation::CommitScores(
|
|||||||
if( stageStats.bFailed[p] )
|
if( stageStats.bFailed[p] )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ASSERT( GAMESTATE->m_pCurNotes[p] );
|
ASSERT( pSteps );
|
||||||
|
|
||||||
if( hs.fPercentDP >= PREFSMAN->m_fMinPercentageForHighScore )
|
if( hs.fPercentDP >= PREFSMAN->m_fMinPercentageForHighScore )
|
||||||
PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, iPersonalHighScoreIndexOut[p], iMachineHighScoreIndexOut[p] );
|
PROFILEMAN->AddStepsHighScore( pSong, pSteps, (PlayerNumber)p, hs, iPersonalHighScoreIndexOut[p], iMachineHighScoreIndexOut[p] );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -853,13 +853,14 @@ void ScreenGameplay::LoadCourseSongNumber( int SongNumber )
|
|||||||
void ScreenGameplay::LoadNextSong()
|
void ScreenGameplay::LoadNextSong()
|
||||||
{
|
{
|
||||||
GAMESTATE->ResetMusicStatistics();
|
GAMESTATE->ResetMusicStatistics();
|
||||||
int p;
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
{
|
||||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
FOREACH_EnabledPlayer( p )
|
||||||
{
|
{
|
||||||
g_CurStageStats.iSongsPlayed[p]++;
|
g_CurStageStats.iSongsPlayed[p]++;
|
||||||
m_textCourseSongNumber[p].SetText( ssprintf("%d", g_CurStageStats.iSongsPlayed[p]) );
|
m_textCourseSongNumber[p].SetText( ssprintf("%d", g_CurStageStats.iSongsPlayed[p]) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LoadCourseSongNumber( GetMaxSongsPlayed() );
|
LoadCourseSongNumber( GetMaxSongsPlayed() );
|
||||||
|
|
||||||
@@ -875,20 +876,22 @@ void ScreenGameplay::LoadNextSong()
|
|||||||
|
|
||||||
m_textSongOptions.SetText( GAMESTATE->m_SongOptions.GetString() );
|
m_textSongOptions.SetText( GAMESTATE->m_SongOptions.GetString() );
|
||||||
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
|
||||||
{
|
|
||||||
if( !GAMESTATE->IsPlayerEnabled(p) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
|
{
|
||||||
|
FOREACH_EnabledPlayer( p )
|
||||||
|
{
|
||||||
SetupSong( p, iPlaySongIndex );
|
SetupSong( p, iPlaySongIndex );
|
||||||
|
|
||||||
|
Song* pSong = GAMESTATE->m_pCurSong;
|
||||||
|
Steps* pSteps = GAMESTATE->m_pCurNotes[p];
|
||||||
|
|
||||||
ASSERT( GAMESTATE->m_pCurNotes[p] );
|
ASSERT( GAMESTATE->m_pCurNotes[p] );
|
||||||
m_textStepsDescription[p].SetText( GAMESTATE->m_pCurNotes[p]->GetDescription() );
|
m_textStepsDescription[p].SetText( GAMESTATE->m_pCurNotes[p]->GetDescription() );
|
||||||
|
|
||||||
/* Increment the play count even if the player fails. (It's still popular,
|
/* Increment the play count even if the player fails. (It's still popular,
|
||||||
* even if the people playing it aren't good at it.) */
|
* even if the people playing it aren't good at it.) */
|
||||||
if( !m_bDemonstration )
|
if( !m_bDemonstration )
|
||||||
PROFILEMAN->IncrementStepsPlayCount( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p );
|
PROFILEMAN->IncrementStepsPlayCount( pSong, pSteps, p );
|
||||||
|
|
||||||
m_textPlayerOptions[p].SetText( GAMESTATE->m_PlayerOptions[p].GetString() );
|
m_textPlayerOptions[p].SetText( GAMESTATE->m_PlayerOptions[p].GetString() );
|
||||||
|
|
||||||
@@ -941,6 +944,7 @@ void ScreenGameplay::LoadNextSong()
|
|||||||
else
|
else
|
||||||
GAMESTATE->m_PlayerController[p] = PC_HUMAN;
|
GAMESTATE->m_PlayerController[p] = PC_HUMAN;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_textSongTitle.SetText( GAMESTATE->m_pCurSong->m_sMainTitle );
|
m_textSongTitle.SetText( GAMESTATE->m_pCurSong->m_sMainTitle );
|
||||||
|
|
||||||
@@ -962,7 +966,8 @@ void ScreenGameplay::LoadNextSong()
|
|||||||
GAMESTATE->m_PlayerOptions[1].m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1
|
GAMESTATE->m_PlayerOptions[1].m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1
|
||||||
};
|
};
|
||||||
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
{
|
||||||
|
FOREACH_EnabledPlayer( p )
|
||||||
{
|
{
|
||||||
if( !GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
|
if( !GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
|
||||||
continue;
|
continue;
|
||||||
@@ -970,6 +975,7 @@ void ScreenGameplay::LoadNextSong()
|
|||||||
m_DifficultyIcon[p].SetName( ssprintf("DifficultyP%d%s%s",p+1,bExtra?"Extra":"",bReverse[p]?"Reverse":"") );
|
m_DifficultyIcon[p].SetName( ssprintf("DifficultyP%d%s%s",p+1,bExtra?"Extra":"",bReverse[p]?"Reverse":"") );
|
||||||
SET_XY( m_DifficultyIcon[p] );
|
SET_XY( m_DifficultyIcon[p] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const bool bBothReverse = bReverse[PLAYER_1] && bReverse[PLAYER_2];
|
const bool bBothReverse = bReverse[PLAYER_1] && bReverse[PLAYER_2];
|
||||||
const bool bOneReverse = !bBothReverse && (bReverse[PLAYER_1] || bReverse[PLAYER_2]);
|
const bool bOneReverse = !bBothReverse && (bReverse[PLAYER_1] || bReverse[PLAYER_2]);
|
||||||
@@ -1003,10 +1009,12 @@ void ScreenGameplay::LoadNextSong()
|
|||||||
// Note: steps can be different if turn modifiers are used.
|
// Note: steps can be different if turn modifiers are used.
|
||||||
if( PREFSMAN->m_bShowBeginnerHelper )
|
if( PREFSMAN->m_bShowBeginnerHelper )
|
||||||
{
|
{
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
FOREACH_HumanPlayer( p )
|
||||||
if( GAMESTATE->IsHumanPlayer(p) && GAMESTATE->m_pCurNotes[p]->GetDifficulty() == DIFFICULTY_BEGINNER )
|
{
|
||||||
|
if( GAMESTATE->m_pCurNotes[p]->GetDifficulty() == DIFFICULTY_BEGINNER )
|
||||||
m_BeginnerHelper.AddPlayer( p, &m_Player[p] );
|
m_BeginnerHelper.AddPlayer( p, &m_Player[p] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( m_BeginnerHelper.Initialize( 2 ) ) // Init for doubles
|
if( m_BeginnerHelper.Initialize( 2 ) ) // Init for doubles
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -168,11 +168,11 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
|
|||||||
hs.iScore = st.iScore[p];
|
hs.iScore = st.iScore[p];
|
||||||
StepsType nt = GAMESTATE->GetCurrentStyleDef()->m_StepsType;
|
StepsType nt = GAMESTATE->GetCurrentStyleDef()->m_StepsType;
|
||||||
int a, b;
|
int a, b;
|
||||||
PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
|
PROFILEMAN->AddStepsHighScore( st.pSong, GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
|
||||||
PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
|
PROFILEMAN->AddStepsHighScore( st.pSong, GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
|
||||||
PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
|
PROFILEMAN->AddStepsHighScore( st.pSong, GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
|
||||||
PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
|
PROFILEMAN->AddStepsHighScore( st.pSong, GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
|
||||||
PROFILEMAN->AddStepsHighScore( GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
|
PROFILEMAN->AddStepsHighScore( st.pSong, GAMESTATE->m_pCurNotes[p], (PlayerNumber)p, hs, a, b );
|
||||||
PROFILEMAN->AddCategoryHighScore( nt, RANKING_A, (PlayerNumber)p, hs, a, b );
|
PROFILEMAN->AddCategoryHighScore( nt, RANKING_A, (PlayerNumber)p, hs, a, b );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,7 +332,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
|
|||||||
const HighScoreList& hsl =
|
const HighScoreList& hsl =
|
||||||
GAMESTATE->IsCourseMode() ?
|
GAMESTATE->IsCourseMode() ?
|
||||||
PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList(pCourse, GAMESTATE->GetCurrentStyleDef()->m_StepsType, GAMESTATE->m_PreferredCourseDifficulty[p]) :
|
PROFILEMAN->GetMachineProfile()->GetCourseHighScoreList(pCourse, GAMESTATE->GetCurrentStyleDef()->m_StepsType, GAMESTATE->m_PreferredCourseDifficulty[p]) :
|
||||||
PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSteps);
|
PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong,pSteps);
|
||||||
|
|
||||||
for( unsigned h=0; h<hsl.vHighScores.size(); h++ )
|
for( unsigned h=0; h<hsl.vHighScores.size(); h++ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -775,7 +775,7 @@ float ScreenRanking::SetPage( PageToShow pts )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSteps);
|
HighScoreList &hsl = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong,pSteps);
|
||||||
HighScore hs = hsl.GetTopScore();
|
HighScore hs = hsl.GetTopScore();
|
||||||
bool bRecentHighScore = false;
|
bool bRecentHighScore = false;
|
||||||
if( !hsl.vHighScores.empty() )
|
if( !hsl.vHighScores.empty() )
|
||||||
|
|||||||
@@ -1164,6 +1164,7 @@ void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn )
|
|||||||
|
|
||||||
m_iSelection[pn] = clamp( m_iSelection[pn], 0, int(m_arrayNotes.size()-1) ); // bounds clamping
|
m_iSelection[pn] = clamp( m_iSelection[pn], 0, int(m_arrayNotes.size()-1) ); // bounds clamping
|
||||||
|
|
||||||
|
Song* pSong = GAMESTATE->m_pCurSong;
|
||||||
Steps* pSteps = m_arrayNotes.empty()? NULL: m_arrayNotes[m_iSelection[pn]];
|
Steps* pSteps = m_arrayNotes.empty()? NULL: m_arrayNotes[m_iSelection[pn]];
|
||||||
|
|
||||||
GAMESTATE->m_pCurNotes[pn] = pSteps;
|
GAMESTATE->m_pCurNotes[pn] = pSteps;
|
||||||
@@ -1176,9 +1177,9 @@ void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn )
|
|||||||
{
|
{
|
||||||
int iScore = 0;
|
int iScore = 0;
|
||||||
if( PROFILEMAN->IsUsingProfile(pn) )
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
||||||
iScore = PROFILEMAN->GetProfile(pn)->GetStepsHighScoreList(pSteps).GetTopScore().iScore;
|
iScore = PROFILEMAN->GetProfile(pn)->GetStepsHighScoreList(pSong,pSteps).GetTopScore().iScore;
|
||||||
else
|
else
|
||||||
iScore = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSteps).GetTopScore().iScore;
|
iScore = PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSong,pSteps).GetTopScore().iScore;
|
||||||
m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, iScore) );
|
m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, iScore) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1278,7 +1278,7 @@ int Song::GetNumNotesWithGrade( Grade g ) const
|
|||||||
{
|
{
|
||||||
Steps* pSteps = vNotes[j];
|
Steps* pSteps = vNotes[j];
|
||||||
|
|
||||||
if( PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(pSteps).GetTopScore().grade == g )
|
if( PROFILEMAN->GetMachineProfile()->GetStepsHighScoreList(this,pSteps).GetTopScore().grade == g )
|
||||||
iCount++;
|
iCount++;
|
||||||
}
|
}
|
||||||
return iCount;
|
return iCount;
|
||||||
|
|||||||
@@ -368,3 +368,26 @@ Song *SongID::ToSong() const
|
|||||||
{
|
{
|
||||||
return SONGMAN->GetSongFromDir( sDir );
|
return SONGMAN->GetSongFromDir( sDir );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
XNode* SongID::CreateNode() const
|
||||||
|
{
|
||||||
|
XNode* pNode = new XNode;
|
||||||
|
pNode->name = "Song";
|
||||||
|
|
||||||
|
pNode->AppendAttr( "Dir", sDir );
|
||||||
|
|
||||||
|
return pNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SongID::LoadFromNode( const XNode* pNode )
|
||||||
|
{
|
||||||
|
ASSERT( pNode->name == "Song" );
|
||||||
|
pNode->GetAttrValue("Dir", sDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SongID::IsValid() const
|
||||||
|
{
|
||||||
|
return !sDir.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
class Song;
|
class Song;
|
||||||
class Profile;
|
class Profile;
|
||||||
|
struct XNode;
|
||||||
|
|
||||||
namespace SongUtil
|
namespace SongUtil
|
||||||
{
|
{
|
||||||
@@ -41,6 +42,15 @@ public:
|
|||||||
SongID() { FromSong(NULL); }
|
SongID() { FromSong(NULL); }
|
||||||
void FromSong( const Song *p );
|
void FromSong( const Song *p );
|
||||||
Song *ToSong() const;
|
Song *ToSong() const;
|
||||||
|
bool operator<( const SongID &other ) const
|
||||||
|
{
|
||||||
|
return sDir < other.sDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
XNode* CreateNode() const;
|
||||||
|
void LoadFromNode( const XNode* pNode );
|
||||||
|
|
||||||
|
bool IsValid() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
#include "Steps.h"
|
#include "Steps.h"
|
||||||
#include "ProfileManager.h"
|
#include "ProfileManager.h"
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
|
#include "SongManager.h"
|
||||||
|
#include "GameManager.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Sorting stuff
|
// Sorting stuff
|
||||||
@@ -42,9 +44,34 @@ void StepsUtil::SortStepsPointerArrayByNumPlays( vector<Steps*> &vStepsPointers,
|
|||||||
|
|
||||||
void StepsUtil::SortStepsPointerArrayByNumPlays( vector<Steps*> &vStepsPointers, const Profile* pProfile, bool bDecending )
|
void StepsUtil::SortStepsPointerArrayByNumPlays( vector<Steps*> &vStepsPointers, const Profile* pProfile, bool bDecending )
|
||||||
{
|
{
|
||||||
|
// ugly...
|
||||||
|
vector<Song*> vpSongs = SONGMAN->GetAllSongs();
|
||||||
|
vector<Steps*> vpAllSteps;
|
||||||
|
map<Steps*,Song*> mapStepsToSong;
|
||||||
|
{
|
||||||
|
for( unsigned i=0; i<vpSongs.size(); i++ )
|
||||||
|
{
|
||||||
|
Song* pSong = vpSongs[i];
|
||||||
|
vector<Steps*> vpSteps = pSong->GetAllSteps();
|
||||||
|
for( unsigned j=0; j<vpSteps.size(); j++ )
|
||||||
|
{
|
||||||
|
Steps* pSteps = vpSteps[j];
|
||||||
|
if( pSteps->IsAutogen() )
|
||||||
|
continue; // skip
|
||||||
|
vpAllSteps.push_back( pSteps );
|
||||||
|
mapStepsToSong[pSteps] = pSong;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ASSERT( pProfile );
|
ASSERT( pProfile );
|
||||||
for(unsigned i = 0; i < vStepsPointers.size(); ++i)
|
for(unsigned i = 0; i < vStepsPointers.size(); ++i)
|
||||||
steps_sort_val[vStepsPointers[i]] = ssprintf("%9i", pProfile->GetStepsNumTimesPlayed(vStepsPointers[i]));
|
{
|
||||||
|
Steps* pSteps = vStepsPointers[i];
|
||||||
|
Song* pSong = mapStepsToSong[pSteps];
|
||||||
|
steps_sort_val[vStepsPointers[i]] = ssprintf("%9i", pProfile->GetStepsNumTimesPlayed(pSong,pSteps));
|
||||||
|
}
|
||||||
stable_sort( vStepsPointers.begin(), vStepsPointers.end(), bDecending ? CompareStepsPointersBySortValueDescending : CompareStepsPointersBySortValueAscending );
|
stable_sort( vStepsPointers.begin(), vStepsPointers.end(), bDecending ? CompareStepsPointersBySortValueDescending : CompareStepsPointersBySortValueAscending );
|
||||||
steps_sort_val.clear();
|
steps_sort_val.clear();
|
||||||
}
|
}
|
||||||
@@ -133,4 +160,37 @@ Steps *StepsID::ToSteps( const Song *p, bool bAllowNull ) const
|
|||||||
RageException::Throw( "%i, %i, \"%s\"", st, dc, sDescription.c_str() );
|
RageException::Throw( "%i, %i, \"%s\"", st, dc, sDescription.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XNode* StepsID::CreateNode() const
|
||||||
|
{
|
||||||
|
XNode* pNode = new XNode;
|
||||||
|
pNode->name = "Steps";
|
||||||
|
|
||||||
|
pNode->AppendAttr( "StepsType", GameManager::NotesTypeToString(st) );
|
||||||
|
pNode->AppendAttr( "Difficulty", DifficultyToString(dc) );
|
||||||
|
if( dc == DIFFICULTY_EDIT )
|
||||||
|
pNode->AppendAttr( "Description", sDescription );
|
||||||
|
|
||||||
|
return pNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StepsID::LoadFromNode( const XNode* pNode )
|
||||||
|
{
|
||||||
|
ASSERT( pNode->name == "Steps" );
|
||||||
|
|
||||||
|
CString sTemp;
|
||||||
|
|
||||||
|
pNode->GetAttrValue("StepsType", sTemp);
|
||||||
|
st = GameManager::StringToNotesType( sTemp );
|
||||||
|
|
||||||
|
pNode->GetAttrValue("Difficulty", sTemp);
|
||||||
|
dc = StringToDifficulty( sTemp );
|
||||||
|
|
||||||
|
if( dc == DIFFICULTY_EDIT )
|
||||||
|
pNode->GetChildValue("Description", sDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StepsID::IsValid() const
|
||||||
|
{
|
||||||
|
return st != STEPS_TYPE_INVALID && dc != DIFFICULTY_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
class Steps;
|
class Steps;
|
||||||
class Song;
|
class Song;
|
||||||
class Profile;
|
class Profile;
|
||||||
|
struct XNode;
|
||||||
|
|
||||||
namespace StepsUtil
|
namespace StepsUtil
|
||||||
{
|
{
|
||||||
@@ -41,6 +42,15 @@ public:
|
|||||||
StepsID() { FromSteps(NULL); }
|
StepsID() { FromSteps(NULL); }
|
||||||
void FromSteps( const Steps *p );
|
void FromSteps( const Steps *p );
|
||||||
Steps *ToSteps( const Song *p, bool bAllowNull ) const;
|
Steps *ToSteps( const Song *p, bool bAllowNull ) const;
|
||||||
|
bool operator<( const StepsID &other ) const
|
||||||
|
{
|
||||||
|
return st < other.st || dc < other.dc || sDescription < other.sDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
XNode* CreateNode() const;
|
||||||
|
void LoadFromNode( const XNode* pNode );
|
||||||
|
|
||||||
|
bool IsValid() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user