add loading of edits from a profile
This commit is contained in:
@@ -0,0 +1 @@
|
||||
ScreenSelectMusic difficulty icons 1x6
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -2911,6 +2911,7 @@ EasyColor=0.9,0.9,0,1 // yellow
|
||||
MediumColor=1,0.1,0.1,1 // light red
|
||||
HardColor=0.2,1,0.2,1 // light green
|
||||
ChallengeColor=0.2,0.6,1.0,1 // blue
|
||||
EditColor=0.8,0.8,0.8,1 // gray
|
||||
ExtraColor=1.0,0.0,0.0,1.0 // red
|
||||
ExtraColorMeter=10
|
||||
|
||||
@@ -3079,6 +3080,7 @@ EasyColor=0,0,0,0
|
||||
MediumColor=0,0,0,0
|
||||
HardColor=0,0,0,0
|
||||
ChallengeColor=0,0,0,0
|
||||
EditColor=0,0,0,0
|
||||
ShowStream=
|
||||
ShowVoltage=
|
||||
ShowAir=
|
||||
|
||||
@@ -1036,10 +1036,10 @@ void Course::AddHighScore( StepsType st, PlayerNumber pn, MemCardData::HighScore
|
||||
m_MemCardDatas[st][pn].AddHighScore( hs, iPersonalIndexOut );
|
||||
else
|
||||
iPersonalIndexOut = -1;
|
||||
m_MemCardDatas[st][MEMORY_CARD_MACHINE].AddHighScore( hs, iMachineIndexOut );
|
||||
m_MemCardDatas[st][PROFILE_SLOT_MACHINE].AddHighScore( hs, iMachineIndexOut );
|
||||
}
|
||||
|
||||
int Course::GetNumTimesPlayed( MemoryCard card ) const
|
||||
int Course::GetNumTimesPlayed( ProfileSlot card ) const
|
||||
{
|
||||
int iTotalNumTimesPlayed = 0;
|
||||
for( unsigned i = 0; i < NUM_STEPS_TYPES; ++i )
|
||||
@@ -1077,7 +1077,7 @@ void SortCoursePointerArrayByAvgDifficulty( vector<Course*> &apCourses )
|
||||
}
|
||||
|
||||
|
||||
void SortCoursePointerArrayByMostPlayed( vector<Course*> &arrayCoursePointers, MemoryCard card )
|
||||
void SortCoursePointerArrayByMostPlayed( vector<Course*> &arrayCoursePointers, ProfileSlot card )
|
||||
{
|
||||
for(unsigned i = 0; i < arrayCoursePointers.size(); ++i)
|
||||
course_sort_val[arrayCoursePointers[i]] = (float) arrayCoursePointers[i]->GetNumTimesPlayed( card );
|
||||
|
||||
@@ -176,21 +176,21 @@ public:
|
||||
return vHighScores[0];
|
||||
}
|
||||
|
||||
} m_MemCardDatas[NUM_STEPS_TYPES][NUM_MEMORY_CARDS];
|
||||
} m_MemCardDatas[NUM_STEPS_TYPES][NUM_PROFILE_SLOTS];
|
||||
|
||||
void AddHighScore( StepsType st, PlayerNumber pn, MemCardData::HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut );
|
||||
|
||||
MemCardData::HighScore GetTopScore( StepsType st, MemoryCard card )
|
||||
MemCardData::HighScore GetTopScore( StepsType st, ProfileSlot slot )
|
||||
{
|
||||
return m_MemCardDatas[st][card].GetTopScore();
|
||||
return m_MemCardDatas[st][slot].GetTopScore();
|
||||
}
|
||||
|
||||
int GetNumTimesPlayed( StepsType st, MemoryCard card ) const
|
||||
int GetNumTimesPlayed( StepsType st, ProfileSlot slot ) const
|
||||
{
|
||||
return m_MemCardDatas[st][card].iNumTimesPlayed;
|
||||
return m_MemCardDatas[st][slot].iNumTimesPlayed;
|
||||
}
|
||||
|
||||
int GetNumTimesPlayed( MemoryCard card ) const;
|
||||
int GetNumTimesPlayed( ProfileSlot slot ) const;
|
||||
|
||||
// sorting values
|
||||
int SortOrder_TotalDifficulty;
|
||||
@@ -217,7 +217,7 @@ void SortCoursePointerArrayByType( vector<Course*> &apCourses );
|
||||
void SortCoursePointerArrayByAvgDifficulty( vector<Course*> &apCourses );
|
||||
void SortCoursePointerArrayByTotalDifficulty( vector<Course*> &apCourses );
|
||||
void SortCoursePointerArrayByRanking( vector<Course*> &apCourses );
|
||||
void SortCoursePointerArrayByMostPlayed( vector<Course*> &arrayCoursePointers, MemoryCard card );
|
||||
void SortCoursePointerArrayByMostPlayed( vector<Course*> &arrayCoursePointers, ProfileSlot slot );
|
||||
|
||||
void MoveRandomToEnd( vector<Course*> &apCourses );
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ DifficultyDisplay::DifficultyDisplay()
|
||||
int diff;
|
||||
for( diff = DIFFICULTY_BEGINNER; diff <= DIFFICULTY_CHALLENGE; ++diff )
|
||||
{
|
||||
m_difficulty[diff].Load( THEME->GetPathToG("DifficultyDisplay bar 5x1") );
|
||||
m_difficulty[diff].Load( THEME->GetPathToG(ssprintf("DifficultyDisplay bar %dx1",NUM_DIFFICULTIES)) );
|
||||
m_difficulty[diff].SetState(diff);
|
||||
m_difficulty[diff].StopAnimating();
|
||||
this->AddChild( &m_difficulty[diff] );
|
||||
|
||||
@@ -26,8 +26,16 @@ bool DifficultyIcon::Load( CString sPath )
|
||||
{
|
||||
Sprite::Load( sPath );
|
||||
int iStates = GetNumStates();
|
||||
if( iStates != 5 && iStates != 10 )
|
||||
HOOKS->MessageBoxOK( ssprintf("The difficulty icon graphic '%s' must have 5 or 10 frames. It has %d states.", sPath.c_str(), iStates) );
|
||||
if( iStates != NUM_DIFFICULTIES && iStates != NUM_DIFFICULTIES*2 )
|
||||
{
|
||||
CString sError = ssprintf(
|
||||
"The difficulty icon graphic '%s' must have %d or %d frames. It has %d states.",
|
||||
sPath.c_str(),
|
||||
NUM_DIFFICULTIES,
|
||||
NUM_DIFFICULTIES*2,
|
||||
iStates );
|
||||
HOOKS->MessageBoxOK( sError );
|
||||
}
|
||||
StopAnimating();
|
||||
return true;
|
||||
}
|
||||
@@ -47,9 +55,9 @@ void DifficultyIcon::SetFromNotes( PlayerNumber pn, Steps* pNotes )
|
||||
|
||||
switch( GetNumStates() )
|
||||
{
|
||||
case 5: SetState( iStateNo ); break;
|
||||
case 10: SetState( iStateNo*2+pn ); break;
|
||||
default: SetState( 0 ); break;
|
||||
case NUM_DIFFICULTIES: SetState( iStateNo ); break;
|
||||
case NUM_DIFFICULTIES*2: SetState( iStateNo*2+pn ); break;
|
||||
default: SetState( 0 ); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +305,11 @@ void DifficultyList::SetFromGameState()
|
||||
|
||||
Difficulty dc = row.m_Steps->GetDifficulty();
|
||||
|
||||
CString s = SONGMAN->GetDifficultyThemeName(dc);
|
||||
CString s;
|
||||
if( row.m_Steps->GetDifficulty() == DIFFICULTY_EDIT )
|
||||
s = row.m_Steps->GetDescription();
|
||||
else
|
||||
s = SONGMAN->GetDifficultyThemeName(dc);
|
||||
m_Descriptions[i].SetMaxWidth( DESCRIPTION_MAX_WIDTH );
|
||||
m_Descriptions[i].SetText( s );
|
||||
/* Don't mess with alpha; it might be fading on. */
|
||||
|
||||
@@ -41,6 +41,7 @@ CString DifficultyToString( Difficulty dc )
|
||||
case DIFFICULTY_MEDIUM: return "medium";
|
||||
case DIFFICULTY_HARD: return "hard";
|
||||
case DIFFICULTY_CHALLENGE: return "challenge";
|
||||
case DIFFICULTY_EDIT: return "edit";
|
||||
default: ASSERT(0); return ""; // invalid Difficulty
|
||||
}
|
||||
}
|
||||
@@ -67,6 +68,7 @@ Difficulty StringToDifficulty( CString sDC )
|
||||
else if( sDC == "challenge" ) return DIFFICULTY_CHALLENGE;
|
||||
else if( sDC == "expert" ) return DIFFICULTY_CHALLENGE;
|
||||
else if( sDC == "oni" ) return DIFFICULTY_CHALLENGE;
|
||||
else if( sDC == "edit" ) return DIFFICULTY_EDIT;
|
||||
else return DIFFICULTY_INVALID;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@ enum Difficulty
|
||||
DIFFICULTY_MEDIUM, // corresponds to Trick, Another, Standard, Normal
|
||||
DIFFICULTY_HARD, // corresponds to Maniac, SSR, Heavy, Crazy
|
||||
DIFFICULTY_CHALLENGE, // corresponds to 5th SMANIAC, MAX2 Challenge, EX Challenge
|
||||
DIFFICULTY_EDIT,
|
||||
NUM_DIFFICULTIES,
|
||||
DIFFICULTY_INVALID
|
||||
};
|
||||
@@ -200,14 +201,15 @@ enum HoldNoteScore
|
||||
|
||||
|
||||
//
|
||||
// MemCard stuff
|
||||
// Profile and MemCard stuff
|
||||
//
|
||||
enum MemoryCard
|
||||
enum ProfileSlot
|
||||
{
|
||||
MEMORY_CARD_PLAYER_1,
|
||||
MEMORY_CARD_PLAYER_2,
|
||||
MEMORY_CARD_MACHINE,
|
||||
NUM_MEMORY_CARDS
|
||||
PROFILE_SLOT_PLAYER_1,
|
||||
PROFILE_SLOT_PLAYER_2,
|
||||
PROFILE_SLOT_MACHINE,
|
||||
NUM_PROFILE_SLOTS,
|
||||
PROFILE_SLOT_INVALID
|
||||
};
|
||||
|
||||
enum MemoryCardState
|
||||
|
||||
@@ -161,11 +161,6 @@ void GameState::Reset()
|
||||
m_iCpuSkill[p] = 5;
|
||||
}
|
||||
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
PROFILEMAN->SaveProfile( (PlayerNumber)p );
|
||||
PROFILEMAN->UnloadProfile( (PlayerNumber)p );
|
||||
}
|
||||
MEMCARDMAN->LockCards( false );
|
||||
|
||||
LIGHTSMAN->SetLightMode( LIGHTMODE_ATTRACT );
|
||||
@@ -192,6 +187,12 @@ void CheckStageStats( const StageStats &ss, int p )
|
||||
// RAGE_ASSERT_M( ss.iMeter[p] < MAX_METER+1, ssprintf("%i", ss.iMeter[p]) );
|
||||
}
|
||||
|
||||
void GameState::PlayersFinalized()
|
||||
{
|
||||
MEMCARDMAN->LockCards( true );
|
||||
SONGMAN->LoadAllFromProfiles();
|
||||
}
|
||||
|
||||
void GameState::EndGame()
|
||||
{
|
||||
// Update profile stats
|
||||
@@ -265,6 +266,14 @@ void GameState::EndGame()
|
||||
|
||||
BOOKKEEPER->WriteToDisk();
|
||||
PROFILEMAN->SaveMachineScoresToDisk();
|
||||
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
PROFILEMAN->SaveProfile( (PlayerNumber)p );
|
||||
PROFILEMAN->UnloadProfile( (PlayerNumber)p );
|
||||
}
|
||||
|
||||
SONGMAN->FreeAllLoadedFromProfiles();
|
||||
}
|
||||
|
||||
void GameState::Update( float fDelta )
|
||||
@@ -1122,7 +1131,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
|
||||
Steps* pSteps = vSongAndSteps[i].pSteps;
|
||||
|
||||
// Find Machine Records
|
||||
vector<Steps::MemCardData::HighScore> &vMachineHighScores = pSteps->m_MemCardDatas[MEMORY_CARD_MACHINE].vHighScores;
|
||||
vector<Steps::MemCardData::HighScore> &vMachineHighScores = pSteps->m_MemCardDatas[PROFILE_SLOT_MACHINE].vHighScores;
|
||||
for( j=0; j<vMachineHighScores.size(); j++ )
|
||||
{
|
||||
if( vMachineHighScores[j].sName != RANKING_TO_FILL_IN_MARKER[pn] )
|
||||
@@ -1176,7 +1185,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
|
||||
// Find Machine Records
|
||||
for( i=0; i<NUM_RANKING_CATEGORIES; i++ )
|
||||
{
|
||||
vector<ProfileManager::CategoryData::HighScore> &vHighScores = PROFILEMAN->m_CategoryDatas[MEMORY_CARD_MACHINE][nt][i].vHighScores;
|
||||
vector<ProfileManager::CategoryData::HighScore> &vHighScores = PROFILEMAN->m_CategoryDatas[PROFILE_SLOT_MACHINE][nt][i].vHighScores;
|
||||
for( unsigned j=0; j<vHighScores.size(); j++ )
|
||||
{
|
||||
if( vHighScores[j].sName != RANKING_TO_FILL_IN_MARKER[pn] )
|
||||
@@ -1228,7 +1237,7 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
|
||||
|
||||
// Find Machine Records
|
||||
{
|
||||
vector<Course::MemCardData::HighScore> &vHighScores = pCourse->m_MemCardDatas[nt][MEMORY_CARD_MACHINE].vHighScores;
|
||||
vector<Course::MemCardData::HighScore> &vHighScores = pCourse->m_MemCardDatas[nt][PROFILE_SLOT_MACHINE].vHighScores;
|
||||
for( unsigned i=0; i<vHighScores.size(); i++ )
|
||||
{
|
||||
if( vHighScores[i].sName != RANKING_TO_FILL_IN_MARKER[pn] )
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
~GameState();
|
||||
void Reset();
|
||||
void BeginGame(); // called when first player joins
|
||||
void PlayersFinalized(); // called after a style is chosen, which means the number of players is finalized
|
||||
void EndGame(); // called on ScreenGameOver, ScreenMusicScroll, ScreenCredits
|
||||
|
||||
void Update( float fDelta );
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
|
||||
MemoryCardState GetCardState( PlayerNumber pn );
|
||||
|
||||
CString GetOsMountDir( PlayerNumber pn ); // only valid when ready
|
||||
CString GetOsMountDir( PlayerNumber pn ); // only valid when state = ready
|
||||
|
||||
void LockCards( bool bLock ); // prevent removing or changing of memory cards
|
||||
|
||||
|
||||
@@ -340,7 +340,7 @@ void ModeChoice::Apply( PlayerNumber pn ) const
|
||||
//
|
||||
if( m_style != STYLE_INVALID )
|
||||
{
|
||||
MEMCARDMAN->LockCards( true );
|
||||
GAMESTATE->PlayersFinalized();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ void MusicWheelItem::LoadFromWheelItemData( WheelItemData* pWID )
|
||||
ASSERT( 0 ); // invalid type
|
||||
}
|
||||
}
|
||||
Steps::MemCardData::HighScore GetHighScoreForDifficulty( const Song *s, const StyleDef *st, MemoryCard card, Difficulty dc );
|
||||
Steps::MemCardData::HighScore GetHighScoreForDifficulty( const Song *s, const StyleDef *st, ProfileSlot card, Difficulty dc );
|
||||
|
||||
void MusicWheelItem::RefreshGrades()
|
||||
{
|
||||
@@ -207,9 +207,9 @@ void MusicWheelItem::RefreshGrades()
|
||||
dc = GAMESTATE->m_PreferredDifficulty[p];
|
||||
Grade grade;
|
||||
if( PROFILEMAN->IsUsingProfile((PlayerNumber)p) )
|
||||
grade = GetHighScoreForDifficulty( data->m_pSong, GAMESTATE->GetCurrentStyleDef(), (MemoryCard)p, dc ).grade;
|
||||
grade = GetHighScoreForDifficulty( data->m_pSong, GAMESTATE->GetCurrentStyleDef(), (ProfileSlot)p, dc ).grade;
|
||||
else
|
||||
grade = GetHighScoreForDifficulty( data->m_pSong, GAMESTATE->GetCurrentStyleDef(), MEMORY_CARD_MACHINE, dc ).grade;
|
||||
grade = GetHighScoreForDifficulty( data->m_pSong, GAMESTATE->GetCurrentStyleDef(), PROFILE_SLOT_MACHINE, dc ).grade;
|
||||
|
||||
m_GradeDisplay[p].SetGrade( (PlayerNumber)p, grade );
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "MsdFile.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageUtil.h"
|
||||
#include "SongManager.h"
|
||||
|
||||
void SMLoader::LoadFromSMTokens(
|
||||
CString sNotesType,
|
||||
@@ -378,3 +379,69 @@ bool SMLoader::LoadFromDir( CString sPath, Song &out )
|
||||
return LoadFromSMFile( sPath + aFileNames[0], out );
|
||||
}
|
||||
|
||||
bool SMLoader::LoadEdit( CString sEditFilePath )
|
||||
{
|
||||
LOG->Trace( "Song::LoadEdit(%s)", sEditFilePath.c_str() );
|
||||
|
||||
MsdFile msd;
|
||||
bool bResult = msd.ReadFile( sEditFilePath );
|
||||
if( !bResult )
|
||||
RageException::Throw( "Error opening file '%s'.", sEditFilePath.c_str() );
|
||||
|
||||
Song* pSong = NULL;
|
||||
|
||||
for( unsigned i=0; i<msd.GetNumValues(); i++ )
|
||||
{
|
||||
int iNumParams = msd.GetNumParams(i);
|
||||
const MsdFile::value_t &sParams = msd.GetValue(i);
|
||||
const CString sValueName = sParams[0];
|
||||
|
||||
// handle the data
|
||||
if( 0==stricmp(sValueName,"SONG") )
|
||||
{
|
||||
if( pSong )
|
||||
{
|
||||
LOG->Warn( "The edit file '%s' has more than one #SONG tag.", sEditFilePath.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
CString& sSongFullTitle = sParams[1];
|
||||
sSongFullTitle.Replace( '\\', '/' );
|
||||
|
||||
pSong = SONGMAN->FindSong( sSongFullTitle );
|
||||
if( pSong == NULL )
|
||||
{
|
||||
LOG->Warn( "The edit file '%s' required a song '%s' that isn't present.", sEditFilePath.c_str(), sSongFullTitle.c_str() );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
else if( 0==stricmp(sValueName,"NOTES") )
|
||||
{
|
||||
if( pSong == NULL )
|
||||
{
|
||||
LOG->Warn( "The edit file '%s' has doesn't have a #SONG tag preceeding the first #NOTES tag.", sEditFilePath.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
Steps* pNewNotes = new Steps;
|
||||
ASSERT( pNewNotes );
|
||||
pSong->m_apNotes.push_back( pNewNotes );
|
||||
|
||||
if( iNumParams < 7 )
|
||||
{
|
||||
LOG->Trace( "The song file '%s' is has %d fields in a #NOTES tag, but should have at least %d.", sEditFilePath.c_str(), iNumParams, 7 );
|
||||
continue;
|
||||
}
|
||||
|
||||
LoadFromSMTokens(
|
||||
sParams[1], sParams[2], sParams[3], sParams[4], sParams[5], sParams[6], (iNumParams>=8)?sParams[7]:"",
|
||||
*pNewNotes);
|
||||
}
|
||||
else
|
||||
LOG->Trace( "Unexpected value named '%s'", sValueName.c_str() );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
bool LoadFromDir( CString sPath, Song &out );
|
||||
static bool LoadTimingFromFile( const CString &fn, TimingData &out );
|
||||
static void LoadTimingFromSMFile( const MsdFile &msd, TimingData &out );
|
||||
static bool LoadEdit( CString sEditFilePath );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -68,13 +68,13 @@ static const PaneModes PaneMode[NUM_PANES] =
|
||||
// PANEMODE_COURSE
|
||||
};
|
||||
|
||||
static MemoryCard PlayerMemCard( PlayerNumber pn )
|
||||
static ProfileSlot PlayerMemCard( PlayerNumber pn )
|
||||
{
|
||||
switch( pn )
|
||||
{
|
||||
case PLAYER_1: return MEMORY_CARD_PLAYER_1;
|
||||
default: ASSERT(0);
|
||||
case PLAYER_2: return MEMORY_CARD_PLAYER_2;
|
||||
case PLAYER_1: return PROFILE_SLOT_PLAYER_1;
|
||||
case PLAYER_2: return PROFILE_SLOT_PLAYER_2;
|
||||
default: ASSERT(0); return PROFILE_SLOT_MACHINE;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -198,12 +198,12 @@ void PaneDisplay::SetContent( PaneContents c )
|
||||
|
||||
case SONG_MACHINE_HIGH_NAME: /* set val for color */
|
||||
case SONG_MACHINE_HIGH_SCORE:
|
||||
val = 100.0f * GAMESTATE->m_pCurNotes[m_PlayerNumber]->GetTopScore( MEMORY_CARD_MACHINE ).fPercentDP;
|
||||
val = 100.0f * GAMESTATE->m_pCurNotes[m_PlayerNumber]->GetTopScore( PROFILE_SLOT_MACHINE ).fPercentDP;
|
||||
break;
|
||||
|
||||
case SONG_MACHINE_RANK:
|
||||
{
|
||||
const vector<Song*> best = SONGMAN->GetBestSongs( MEMORY_CARD_MACHINE );
|
||||
const vector<Song*> best = SONGMAN->GetBestSongs( PROFILE_SLOT_MACHINE );
|
||||
val = (float) FindIndex( best.begin(), best.end(), GAMESTATE->m_pCurSong );
|
||||
val += 1;
|
||||
break;
|
||||
@@ -219,16 +219,16 @@ void PaneDisplay::SetContent( PaneContents c )
|
||||
|
||||
case COURSE_MACHINE_HIGH_NAME: /* set val for color */
|
||||
case COURSE_MACHINE_HIGH_SCORE:
|
||||
val = 100.0f * GAMESTATE->m_pCurCourse->GetTopScore( GAMESTATE->GetCurrentStyleDef()->m_StepsType, MEMORY_CARD_MACHINE ).fPercentDP;
|
||||
val = 100.0f * GAMESTATE->m_pCurCourse->GetTopScore( GAMESTATE->GetCurrentStyleDef()->m_StepsType, PROFILE_SLOT_MACHINE ).fPercentDP;
|
||||
break;
|
||||
|
||||
case COURSE_MACHINE_NUM_PLAYS:
|
||||
val = (float) GAMESTATE->m_pCurCourse->GetNumTimesPlayed( MEMORY_CARD_MACHINE );
|
||||
val = (float) GAMESTATE->m_pCurCourse->GetNumTimesPlayed( PROFILE_SLOT_MACHINE );
|
||||
break;
|
||||
|
||||
case COURSE_MACHINE_RANK:
|
||||
{
|
||||
const vector<Course*> best = SONGMAN->GetBestCourses( MEMORY_CARD_MACHINE );
|
||||
const vector<Course*> best = SONGMAN->GetBestCourses( PROFILE_SLOT_MACHINE );
|
||||
val = (float) FindIndex( best.begin(), best.end(), GAMESTATE->m_pCurCourse );
|
||||
val += 1;
|
||||
}
|
||||
@@ -265,10 +265,10 @@ void PaneDisplay::SetContent( PaneContents c )
|
||||
switch( c )
|
||||
{
|
||||
case SONG_MACHINE_HIGH_NAME:
|
||||
str = GAMESTATE->m_pCurNotes[m_PlayerNumber]->GetTopScore( MEMORY_CARD_MACHINE ).sName;
|
||||
str = GAMESTATE->m_pCurNotes[m_PlayerNumber]->GetTopScore( PROFILE_SLOT_MACHINE ).sName;
|
||||
break;
|
||||
case COURSE_MACHINE_HIGH_NAME:
|
||||
str = GAMESTATE->m_pCurCourse->GetTopScore( GAMESTATE->GetCurrentStyleDef()->m_StepsType, MEMORY_CARD_MACHINE ).sName;
|
||||
str = GAMESTATE->m_pCurCourse->GetTopScore( GAMESTATE->GetCurrentStyleDef()->m_StepsType, PROFILE_SLOT_MACHINE ).sName;
|
||||
break;
|
||||
|
||||
case SONG_MACHINE_HIGH_SCORE:
|
||||
|
||||
@@ -141,9 +141,9 @@ bool ProfileManager::LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIs
|
||||
return false;
|
||||
}
|
||||
|
||||
ReadCategoryScoresFromDir( m_sProfileDir[pn], (MemoryCard)pn );
|
||||
ReadSongScoresFromDir( m_sProfileDir[pn], (MemoryCard)pn );
|
||||
ReadCourseScoresFromDir( m_sProfileDir[pn], (MemoryCard)pn );
|
||||
ReadCategoryScoresFromDir( m_sProfileDir[pn], (ProfileSlot)pn );
|
||||
ReadSongScoresFromDir( m_sProfileDir[pn], (ProfileSlot)pn );
|
||||
ReadCourseScoresFromDir( m_sProfileDir[pn], (ProfileSlot)pn );
|
||||
|
||||
// apply saved default modifiers if any
|
||||
if( m_Profile[pn].m_bUsingProfileDefaultModifiers )
|
||||
@@ -245,10 +245,10 @@ bool ProfileManager::SaveProfile( PlayerNumber pn )
|
||||
|
||||
m_Profile[pn].SaveToIni( m_sProfileDir[pn]+PROFILE_FILE );
|
||||
|
||||
SaveCategoryScoresToDir( m_sProfileDir[pn], (MemoryCard)pn );
|
||||
SaveSongScoresToDir( m_sProfileDir[pn], (MemoryCard)pn );
|
||||
SaveCourseScoresToDir( m_sProfileDir[pn], (MemoryCard)pn );
|
||||
SaveStatsWebPageToDir( m_sProfileDir[pn], (MemoryCard)pn );
|
||||
SaveCategoryScoresToDir( m_sProfileDir[pn], (ProfileSlot)pn );
|
||||
SaveSongScoresToDir( m_sProfileDir[pn], (ProfileSlot)pn );
|
||||
SaveCourseScoresToDir( m_sProfileDir[pn], (ProfileSlot)pn );
|
||||
SaveStatsWebPageToDir( m_sProfileDir[pn], (ProfileSlot)pn );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -414,10 +414,10 @@ void ProfileManager::SaveMachineScoresToDisk()
|
||||
{
|
||||
m_MachineProfile.SaveToIni( MACHINE_PROFILE_DIR PROFILE_FILE );
|
||||
|
||||
SaveCategoryScoresToDir( MACHINE_PROFILE_DIR, MEMORY_CARD_MACHINE );
|
||||
SaveSongScoresToDir( MACHINE_PROFILE_DIR, MEMORY_CARD_MACHINE );
|
||||
SaveCourseScoresToDir( MACHINE_PROFILE_DIR, MEMORY_CARD_MACHINE );
|
||||
SaveStatsWebPageToDir( MACHINE_PROFILE_DIR, MEMORY_CARD_MACHINE );
|
||||
SaveCategoryScoresToDir( MACHINE_PROFILE_DIR, PROFILE_SLOT_MACHINE );
|
||||
SaveSongScoresToDir( MACHINE_PROFILE_DIR, PROFILE_SLOT_MACHINE );
|
||||
SaveCourseScoresToDir( MACHINE_PROFILE_DIR, PROFILE_SLOT_MACHINE );
|
||||
SaveStatsWebPageToDir( MACHINE_PROFILE_DIR, PROFILE_SLOT_MACHINE );
|
||||
}
|
||||
|
||||
void ProfileManager::CategoryData::AddHighScore( HighScore hs, int &iIndexOut )
|
||||
@@ -440,7 +440,7 @@ void ProfileManager::CategoryData::AddHighScore( HighScore hs, int &iIndexOut )
|
||||
|
||||
#define WARN_AND_RETURN { LOG->Warn("Error parsing file '%s' at %s:%d",fn.c_str(),__FILE__,__LINE__); return; }
|
||||
|
||||
void ProfileManager::ReadSongScoresFromDir( CString sDir, MemoryCard mc )
|
||||
void ProfileManager::ReadSongScoresFromDir( CString sDir, ProfileSlot slot )
|
||||
{
|
||||
CString fn = sDir + SONG_SCORES_FILE;
|
||||
|
||||
@@ -503,14 +503,14 @@ void ProfileManager::ReadSongScoresFromDir( CString sDir, MemoryCard mc )
|
||||
WARN_AND_RETURN;
|
||||
|
||||
if( pNotes )
|
||||
pNotes->m_MemCardDatas[mc].iNumTimesPlayed = iNumTimesPlayed;
|
||||
pNotes->m_MemCardDatas[slot].iNumTimesPlayed = iNumTimesPlayed;
|
||||
|
||||
int iNumHighScores;
|
||||
if( !FileRead(f, iNumHighScores) )
|
||||
WARN_AND_RETURN;
|
||||
|
||||
if( pNotes )
|
||||
pNotes->m_MemCardDatas[mc].vHighScores.resize( iNumHighScores );
|
||||
pNotes->m_MemCardDatas[slot].vHighScores.resize( iNumHighScores );
|
||||
|
||||
int l;
|
||||
for( l=0; l<iNumHighScores; l++ )
|
||||
@@ -535,18 +535,18 @@ void ProfileManager::ReadSongScoresFromDir( CString sDir, MemoryCard mc )
|
||||
if( pNotes == NULL )
|
||||
continue; // ignore this high score
|
||||
|
||||
pNotes->m_MemCardDatas[mc].vHighScores[l].sName = sName;
|
||||
pNotes->m_MemCardDatas[mc].vHighScores[l].grade = grade;
|
||||
pNotes->m_MemCardDatas[mc].vHighScores[l].iScore = iScore;
|
||||
pNotes->m_MemCardDatas[mc].vHighScores[l].fPercentDP = fPercentDP;
|
||||
pNotes->m_MemCardDatas[slot].vHighScores[l].sName = sName;
|
||||
pNotes->m_MemCardDatas[slot].vHighScores[l].grade = grade;
|
||||
pNotes->m_MemCardDatas[slot].vHighScores[l].iScore = iScore;
|
||||
pNotes->m_MemCardDatas[slot].vHighScores[l].fPercentDP = fPercentDP;
|
||||
}
|
||||
|
||||
// ignore all high scores that are 0
|
||||
for( l=0; l<iNumHighScores; l++ )
|
||||
{
|
||||
if( pNotes && pNotes->m_MemCardDatas[mc].vHighScores[l].iScore <= 0 )
|
||||
if( pNotes && pNotes->m_MemCardDatas[slot].vHighScores[l].iScore <= 0 )
|
||||
{
|
||||
pNotes->m_MemCardDatas[mc].vHighScores.resize(l);
|
||||
pNotes->m_MemCardDatas[slot].vHighScores.resize(l);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -555,7 +555,7 @@ void ProfileManager::ReadSongScoresFromDir( CString sDir, MemoryCard mc )
|
||||
}
|
||||
|
||||
|
||||
void ProfileManager::ReadCategoryScoresFromDir( CString sDir, MemoryCard mc )
|
||||
void ProfileManager::ReadCategoryScoresFromDir( CString sDir, ProfileSlot slot )
|
||||
{
|
||||
CString fn = sDir + CATEGORY_SCORES_FILE;
|
||||
|
||||
@@ -580,7 +580,7 @@ void ProfileManager::ReadCategoryScoresFromDir( CString sDir, MemoryCard mc )
|
||||
if( !FileRead(f, iNumHighScores) )
|
||||
WARN_AND_RETURN;
|
||||
|
||||
m_CategoryDatas[mc][st][rc].vHighScores.resize( iNumHighScores );
|
||||
m_CategoryDatas[slot][st][rc].vHighScores.resize( iNumHighScores );
|
||||
|
||||
for( int l=0; l<iNumHighScores; l++ )
|
||||
{
|
||||
@@ -596,15 +596,15 @@ void ProfileManager::ReadCategoryScoresFromDir( CString sDir, MemoryCard mc )
|
||||
if( !FileRead(f, fPercentDP) )
|
||||
WARN_AND_RETURN;
|
||||
|
||||
m_CategoryDatas[mc][st][rc].vHighScores[l].sName = sName;
|
||||
m_CategoryDatas[mc][st][rc].vHighScores[l].iScore = iScore;
|
||||
m_CategoryDatas[mc][st][rc].vHighScores[l].fPercentDP = fPercentDP;
|
||||
m_CategoryDatas[slot][st][rc].vHighScores[l].sName = sName;
|
||||
m_CategoryDatas[slot][st][rc].vHighScores[l].iScore = iScore;
|
||||
m_CategoryDatas[slot][st][rc].vHighScores[l].fPercentDP = fPercentDP;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProfileManager::ReadCourseScoresFromDir( CString sDir, MemoryCard mc )
|
||||
void ProfileManager::ReadCourseScoresFromDir( CString sDir, ProfileSlot slot )
|
||||
{
|
||||
CString fn = sDir + COURSE_SCORES_FILE;
|
||||
|
||||
@@ -652,14 +652,14 @@ void ProfileManager::ReadCourseScoresFromDir( CString sDir, MemoryCard mc )
|
||||
WARN_AND_RETURN;
|
||||
|
||||
if( pCourse )
|
||||
pCourse->m_MemCardDatas[st][mc].iNumTimesPlayed = iNumTimesPlayed;
|
||||
pCourse->m_MemCardDatas[st][slot].iNumTimesPlayed = iNumTimesPlayed;
|
||||
|
||||
int iNumHighScores;
|
||||
if( !FileRead(f, iNumHighScores) )
|
||||
WARN_AND_RETURN;
|
||||
|
||||
if( pCourse )
|
||||
pCourse->m_MemCardDatas[st][mc].vHighScores.resize(iNumHighScores);
|
||||
pCourse->m_MemCardDatas[st][slot].vHighScores.resize(iNumHighScores);
|
||||
|
||||
for( int l=0; l<iNumHighScores; l++ )
|
||||
{
|
||||
@@ -681,10 +681,10 @@ void ProfileManager::ReadCourseScoresFromDir( CString sDir, MemoryCard mc )
|
||||
|
||||
if( pCourse && st < NUM_STEPS_TYPES )
|
||||
{
|
||||
pCourse->m_MemCardDatas[st][mc].vHighScores[l].sName = sName;
|
||||
pCourse->m_MemCardDatas[st][mc].vHighScores[l].iScore = iScore;
|
||||
pCourse->m_MemCardDatas[st][mc].vHighScores[l].fPercentDP = fPercentDP;
|
||||
pCourse->m_MemCardDatas[st][mc].vHighScores[l].fSurviveTime = fSurviveTime;
|
||||
pCourse->m_MemCardDatas[st][slot].vHighScores[l].sName = sName;
|
||||
pCourse->m_MemCardDatas[st][slot].vHighScores[l].iScore = iScore;
|
||||
pCourse->m_MemCardDatas[st][slot].vHighScores[l].fPercentDP = fPercentDP;
|
||||
pCourse->m_MemCardDatas[st][slot].vHighScores[l].fSurviveTime = fSurviveTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -697,9 +697,9 @@ void ProfileManager::InitMachineScoresFromDisk()
|
||||
ReadSM300NoteScores();
|
||||
|
||||
// category ranking
|
||||
ReadCategoryScoresFromDir( MACHINE_PROFILE_DIR, MEMORY_CARD_MACHINE );
|
||||
ReadSongScoresFromDir( MACHINE_PROFILE_DIR, MEMORY_CARD_MACHINE );
|
||||
ReadCourseScoresFromDir( MACHINE_PROFILE_DIR, MEMORY_CARD_MACHINE );
|
||||
ReadCategoryScoresFromDir( MACHINE_PROFILE_DIR, PROFILE_SLOT_MACHINE );
|
||||
ReadSongScoresFromDir( MACHINE_PROFILE_DIR, PROFILE_SLOT_MACHINE );
|
||||
ReadCourseScoresFromDir( MACHINE_PROFILE_DIR, PROFILE_SLOT_MACHINE );
|
||||
|
||||
if( !m_MachineProfile.LoadFromIni(MACHINE_PROFILE_DIR PROFILE_FILE) )
|
||||
{
|
||||
@@ -758,26 +758,26 @@ void ProfileManager::ReadSM300NoteScores()
|
||||
char szGradeLetters[10]; // longest possible string is "AAA"
|
||||
int iMaxCombo; // throw away
|
||||
|
||||
pNotes->m_MemCardDatas[MEMORY_CARD_MACHINE].vHighScores.resize(1);
|
||||
pNotes->m_MemCardDatas[PROFILE_SLOT_MACHINE].vHighScores.resize(1);
|
||||
|
||||
iRetVal = sscanf(
|
||||
value,
|
||||
"%d::%[^:]::%d::%d",
|
||||
&pNotes->m_MemCardDatas[MEMORY_CARD_MACHINE].iNumTimesPlayed,
|
||||
&pNotes->m_MemCardDatas[PROFILE_SLOT_MACHINE].iNumTimesPlayed,
|
||||
szGradeLetters,
|
||||
&pNotes->m_MemCardDatas[MEMORY_CARD_MACHINE].vHighScores[0].iScore,
|
||||
&pNotes->m_MemCardDatas[PROFILE_SLOT_MACHINE].vHighScores[0].iScore,
|
||||
&iMaxCombo
|
||||
);
|
||||
if( iRetVal != 4 )
|
||||
continue;
|
||||
|
||||
pNotes->m_MemCardDatas[MEMORY_CARD_MACHINE].vHighScores[0].grade = StringToGrade( szGradeLetters );
|
||||
pNotes->m_MemCardDatas[PROFILE_SLOT_MACHINE].vHighScores[0].grade = StringToGrade( szGradeLetters );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ProfileManager::SaveCategoryScoresToDir( CString sDir, MemoryCard mc )
|
||||
void ProfileManager::SaveCategoryScoresToDir( CString sDir, ProfileSlot slot )
|
||||
{
|
||||
CString fn = sDir + CATEGORY_SCORES_FILE;
|
||||
|
||||
@@ -796,23 +796,23 @@ void ProfileManager::SaveCategoryScoresToDir( CString sDir, MemoryCard mc )
|
||||
{
|
||||
for( int rc=0; rc<NUM_RANKING_CATEGORIES; rc++ )
|
||||
{
|
||||
FileWrite( f, m_CategoryDatas[mc][st][rc].vHighScores.size() );
|
||||
FileWrite( f, m_CategoryDatas[slot][st][rc].vHighScores.size() );
|
||||
|
||||
for( unsigned l=0; l<m_CategoryDatas[mc][st][rc].vHighScores.size(); l++ )
|
||||
for( unsigned l=0; l<m_CategoryDatas[slot][st][rc].vHighScores.size(); l++ )
|
||||
{
|
||||
// tricky: wipe out "name to fill in" markers
|
||||
if( IsRankingToFillIn(m_CategoryDatas[mc][st][rc].vHighScores[l].sName) )
|
||||
m_CategoryDatas[mc][st][rc].vHighScores[l].sName = "";
|
||||
if( IsRankingToFillIn(m_CategoryDatas[slot][st][rc].vHighScores[l].sName) )
|
||||
m_CategoryDatas[slot][st][rc].vHighScores[l].sName = "";
|
||||
|
||||
FileWrite( f, m_CategoryDatas[mc][st][rc].vHighScores[l].sName );
|
||||
FileWrite( f, m_CategoryDatas[mc][st][rc].vHighScores[l].iScore );
|
||||
FileWrite( f, m_CategoryDatas[mc][st][rc].vHighScores[l].fPercentDP );
|
||||
FileWrite( f, m_CategoryDatas[slot][st][rc].vHighScores[l].sName );
|
||||
FileWrite( f, m_CategoryDatas[slot][st][rc].vHighScores[l].iScore );
|
||||
FileWrite( f, m_CategoryDatas[slot][st][rc].vHighScores[l].fPercentDP );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProfileManager::SaveCourseScoresToDir( CString sDir, MemoryCard mc )
|
||||
void ProfileManager::SaveCourseScoresToDir( CString sDir, ProfileSlot slot )
|
||||
{
|
||||
CString fn = sDir + COURSE_SCORES_FILE;
|
||||
|
||||
@@ -845,36 +845,36 @@ void ProfileManager::SaveCourseScoresToDir( CString sDir, MemoryCard mc )
|
||||
int NumStepsPlayed = 0;
|
||||
int st;
|
||||
for( st=0; st<NUM_STEPS_TYPES; st++ )
|
||||
if( pCourse->m_MemCardDatas[st][mc].iNumTimesPlayed )
|
||||
if( pCourse->m_MemCardDatas[st][slot].iNumTimesPlayed )
|
||||
++NumStepsPlayed;
|
||||
FileWrite( f, NumStepsPlayed );
|
||||
|
||||
for( st=0; st<NUM_STEPS_TYPES; st++ )
|
||||
{
|
||||
if( !pCourse->m_MemCardDatas[st][mc].iNumTimesPlayed )
|
||||
if( !pCourse->m_MemCardDatas[st][slot].iNumTimesPlayed )
|
||||
continue;
|
||||
--NumStepsPlayed;
|
||||
|
||||
FileWrite( f, st );
|
||||
FileWrite( f, pCourse->m_MemCardDatas[st][mc].iNumTimesPlayed );
|
||||
FileWrite( f, pCourse->m_MemCardDatas[st][mc].vHighScores.size() );
|
||||
for( unsigned l=0; l<pCourse->m_MemCardDatas[st][mc].vHighScores.size(); l++ )
|
||||
FileWrite( f, pCourse->m_MemCardDatas[st][slot].iNumTimesPlayed );
|
||||
FileWrite( f, pCourse->m_MemCardDatas[st][slot].vHighScores.size() );
|
||||
for( unsigned l=0; l<pCourse->m_MemCardDatas[st][slot].vHighScores.size(); l++ )
|
||||
{
|
||||
// tricky: wipe out "name to fill in" markers
|
||||
if( IsRankingToFillIn(pCourse->m_MemCardDatas[st][mc].vHighScores[l].sName) )
|
||||
pCourse->m_MemCardDatas[st][mc].vHighScores[l].sName = "";
|
||||
if( IsRankingToFillIn(pCourse->m_MemCardDatas[st][slot].vHighScores[l].sName) )
|
||||
pCourse->m_MemCardDatas[st][slot].vHighScores[l].sName = "";
|
||||
|
||||
FileWrite( f, pCourse->m_MemCardDatas[st][mc].vHighScores[l].sName );
|
||||
FileWrite( f, pCourse->m_MemCardDatas[st][mc].vHighScores[l].iScore );
|
||||
FileWrite( f, pCourse->m_MemCardDatas[st][mc].vHighScores[l].fPercentDP );
|
||||
FileWrite( f, pCourse->m_MemCardDatas[st][mc].vHighScores[l].fSurviveTime );
|
||||
FileWrite( f, pCourse->m_MemCardDatas[st][slot].vHighScores[l].sName );
|
||||
FileWrite( f, pCourse->m_MemCardDatas[st][slot].vHighScores[l].iScore );
|
||||
FileWrite( f, pCourse->m_MemCardDatas[st][slot].vHighScores[l].fPercentDP );
|
||||
FileWrite( f, pCourse->m_MemCardDatas[st][slot].vHighScores[l].fSurviveTime );
|
||||
}
|
||||
}
|
||||
ASSERT( !NumStepsPlayed );
|
||||
}
|
||||
}
|
||||
|
||||
void ProfileManager::SaveSongScoresToDir( CString sDir, MemoryCard mc )
|
||||
void ProfileManager::SaveSongScoresToDir( CString sDir, ProfileSlot slot )
|
||||
{
|
||||
CString fn = sDir + SONG_SCORES_FILE;
|
||||
|
||||
@@ -905,7 +905,7 @@ void ProfileManager::SaveSongScoresToDir( CString sDir, MemoryCard mc )
|
||||
for( unsigned i=0; i<pSong->m_apNotes.size(); ++i )
|
||||
{
|
||||
Steps* pNotes = pSong->m_apNotes[i];
|
||||
if( pNotes->m_MemCardDatas[mc].iNumTimesPlayed == 0 && pNotes->m_MemCardDatas[mc].vHighScores.empty() )
|
||||
if( pNotes->m_MemCardDatas[slot].iNumTimesPlayed == 0 && pNotes->m_MemCardDatas[slot].vHighScores.empty() )
|
||||
continue;
|
||||
vNotes.push_back( pNotes );
|
||||
}
|
||||
@@ -924,20 +924,20 @@ void ProfileManager::SaveSongScoresToDir( CString sDir, MemoryCard mc )
|
||||
FileWrite( f, pNotes->m_StepsType );
|
||||
FileWrite( f, pNotes->GetDifficulty() );
|
||||
FileWrite( f, pNotes->GetDescription() );
|
||||
FileWrite( f, pNotes->m_MemCardDatas[mc].iNumTimesPlayed );
|
||||
FileWrite( f, pNotes->m_MemCardDatas[slot].iNumTimesPlayed );
|
||||
|
||||
FileWrite( f, pNotes->m_MemCardDatas[mc].vHighScores.size() );
|
||||
FileWrite( f, pNotes->m_MemCardDatas[slot].vHighScores.size() );
|
||||
|
||||
for( int l=0; l<(int)pNotes->m_MemCardDatas[mc].vHighScores.size(); l++ )
|
||||
for( int l=0; l<(int)pNotes->m_MemCardDatas[slot].vHighScores.size(); l++ )
|
||||
{
|
||||
// tricky: wipe out "name to fill in" markers
|
||||
if( IsRankingToFillIn(pNotes->m_MemCardDatas[mc].vHighScores[l].sName) )
|
||||
pNotes->m_MemCardDatas[mc].vHighScores[l].sName = "";
|
||||
if( IsRankingToFillIn(pNotes->m_MemCardDatas[slot].vHighScores[l].sName) )
|
||||
pNotes->m_MemCardDatas[slot].vHighScores[l].sName = "";
|
||||
|
||||
FileWrite( f, pNotes->m_MemCardDatas[mc].vHighScores[l].sName );
|
||||
FileWrite( f, pNotes->m_MemCardDatas[mc].vHighScores[l].grade );
|
||||
FileWrite( f, pNotes->m_MemCardDatas[mc].vHighScores[l].iScore );
|
||||
FileWrite( f, pNotes->m_MemCardDatas[mc].vHighScores[l].fPercentDP );
|
||||
FileWrite( f, pNotes->m_MemCardDatas[slot].vHighScores[l].sName );
|
||||
FileWrite( f, pNotes->m_MemCardDatas[slot].vHighScores[l].grade );
|
||||
FileWrite( f, pNotes->m_MemCardDatas[slot].vHighScores[l].iScore );
|
||||
FileWrite( f, pNotes->m_MemCardDatas[slot].vHighScores[l].fPercentDP );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -949,7 +949,7 @@ void ProfileManager::SaveSongScoresToDir( CString sDir, MemoryCard mc )
|
||||
return str;
|
||||
} */
|
||||
|
||||
void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc )
|
||||
void ProfileManager::SaveStatsWebPageToDir( CString sDir, ProfileSlot slot )
|
||||
{
|
||||
CString fn = sDir + STATS_HTML_FILE;
|
||||
|
||||
@@ -958,10 +958,10 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc )
|
||||
// Get Profile
|
||||
//
|
||||
Profile* pProfile;
|
||||
if( mc == MEMORY_CARD_MACHINE )
|
||||
if( slot == PROFILE_SLOT_MACHINE )
|
||||
pProfile = GetMachineProfile();
|
||||
else
|
||||
pProfile = GetProfile( (PlayerNumber)mc );
|
||||
pProfile = GetProfile( (PlayerNumber)slot );
|
||||
ASSERT(pProfile);
|
||||
|
||||
//
|
||||
@@ -1150,12 +1150,12 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc )
|
||||
{
|
||||
unsigned uNumToShow = min( vpSongs.size(), (unsigned)100 );
|
||||
|
||||
SortSongPointerArrayByMostPlayed( vpSongs, mc );
|
||||
SortSongPointerArrayByMostPlayed( vpSongs, slot );
|
||||
PRINT_DIV_START( "Songs by Popularity" );
|
||||
for( unsigned i=0; i<uNumToShow; i++ )
|
||||
{
|
||||
Song* pSong = vpSongs[i];
|
||||
PRINT_LINE_RANK_LINK( i+1, pSong->GetFullDisplayTitle(), ssprintf("#%u",(unsigned)pSong).c_str(), pSong->GetNumTimesPlayed(mc) );
|
||||
PRINT_LINE_RANK_LINK( i+1, pSong->GetFullDisplayTitle(), ssprintf("#%u",(unsigned)pSong).c_str(), pSong->GetNumTimesPlayed(slot) );
|
||||
}
|
||||
PRINT_DIV_END;
|
||||
}
|
||||
@@ -1164,7 +1164,7 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc )
|
||||
{
|
||||
unsigned uNumToShow = min( vpAllSteps.size(), (unsigned)100 );
|
||||
|
||||
SortStepsPointerArrayByMostPlayed( vpAllSteps, mc );
|
||||
SortStepsPointerArrayByMostPlayed( vpAllSteps, slot );
|
||||
PRINT_DIV_START( "Steps by Popularity" );
|
||||
for( unsigned i=0; i<uNumToShow; i++ )
|
||||
{
|
||||
@@ -1176,7 +1176,7 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc )
|
||||
s += GAMEMAN->NotesTypeToString(pSteps->m_StepsType);
|
||||
s += " ";
|
||||
s += DifficultyToString(pSteps->GetDifficulty());
|
||||
PRINT_LINE_RANK_LINK( i+1, s, ssprintf("#%u",(unsigned)pSteps).c_str(), pSteps->GetNumTimesPlayed(mc) );
|
||||
PRINT_LINE_RANK_LINK( i+1, s, ssprintf("#%u",(unsigned)pSteps).c_str(), pSteps->GetNumTimesPlayed(slot) );
|
||||
}
|
||||
PRINT_DIV_END;
|
||||
}
|
||||
@@ -1185,12 +1185,12 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc )
|
||||
{
|
||||
unsigned uNumToShow = min( vpCourses.size(), (unsigned)100 );
|
||||
|
||||
SortCoursePointerArrayByMostPlayed( vpCourses, mc );
|
||||
SortCoursePointerArrayByMostPlayed( vpCourses, slot );
|
||||
PRINT_DIV_START( "Courses by Popularity" );
|
||||
for( unsigned i=0; i<uNumToShow; i++ )
|
||||
{
|
||||
Course* pCourse = vpCourses[i];
|
||||
PRINT_LINE_RANK_LINK( i+1, pCourse->m_sName, ssprintf("#%u",(unsigned)pCourse).c_str(), pCourse->GetNumTimesPlayed(mc) );
|
||||
PRINT_LINE_RANK_LINK( i+1, pCourse->m_sName, ssprintf("#%u",(unsigned)pCourse).c_str(), pCourse->GetNumTimesPlayed(slot) );
|
||||
}
|
||||
PRINT_DIV_END;
|
||||
}
|
||||
@@ -1240,13 +1240,13 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc )
|
||||
if( pSteps )
|
||||
{
|
||||
CString sHighScore;
|
||||
if( !pSteps->m_MemCardDatas[mc].vHighScores.empty() )
|
||||
if( !pSteps->m_MemCardDatas[slot].vHighScores.empty() )
|
||||
{
|
||||
sHighScore += pSteps->m_MemCardDatas[mc].vHighScores[0].sName;
|
||||
sHighScore += pSteps->m_MemCardDatas[slot].vHighScores[0].sName;
|
||||
sHighScore += "<br>";
|
||||
sHighScore += GradeToString( pSteps->m_MemCardDatas[mc].vHighScores[0].grade );
|
||||
sHighScore += GradeToString( pSteps->m_MemCardDatas[slot].vHighScores[0].grade );
|
||||
sHighScore += "<br>";
|
||||
sHighScore += ssprintf("%d",pSteps->m_MemCardDatas[mc].vHighScores[0].iScore);
|
||||
sHighScore += ssprintf("%d",pSteps->m_MemCardDatas[slot].vHighScores[0].iScore);
|
||||
}
|
||||
f.PutLine( ssprintf("<td><p align='right'><a href='#%u'>%s</a></p></td>",
|
||||
(unsigned)pSteps, // use pointer value as the hash
|
||||
@@ -1352,7 +1352,7 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc )
|
||||
pSong->GetDisplayBPM( fMinBPM, fMaxBPM );
|
||||
CString sBPM = (fMinBPM==fMaxBPM) ? ssprintf("%.1f",fMinBPM) : ssprintf("%.1f - %.1f",fMinBPM,fMaxBPM);
|
||||
PRINT_LINE_S( "BPM", sBPM );
|
||||
PRINT_LINE_I( "NumTimesPlayed", pSong->GetNumTimesPlayed(mc) );
|
||||
PRINT_LINE_I( "NumTimesPlayed", pSong->GetNumTimesPlayed(slot) );
|
||||
PRINT_LINE_S( "Credit", pSong->m_sCredit );
|
||||
PRINT_LINE_S( "MusicLength", SecondsToTime(pSong->m_fMusicLengthSeconds) );
|
||||
PRINT_LINE_B( "Lyrics", !pSong->m_sLyricsFile.empty() );
|
||||
@@ -1371,9 +1371,9 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc )
|
||||
" - " +
|
||||
DifficultyToString(pSteps->GetDifficulty());
|
||||
PRINT_DIV2_START_ANCHOR( /*Steps primary key*/pSteps, s.c_str() ); // use pointer value as the hash
|
||||
PRINT_LINE_I( "NumTimesPlayed", pSteps->m_MemCardDatas[mc].iNumTimesPlayed );
|
||||
PRINT_LINE_I( "NumTimesPlayed", pSteps->m_MemCardDatas[slot].iNumTimesPlayed );
|
||||
|
||||
vector<Steps::MemCardData::HighScore>& vHighScores = pSteps->m_MemCardDatas[mc].vHighScores;
|
||||
vector<Steps::MemCardData::HighScore>& vHighScores = pSteps->m_MemCardDatas[slot].vHighScores;
|
||||
for( unsigned i=0; i<vHighScores.size(); i++ )
|
||||
{
|
||||
Steps::MemCardData::HighScore &hs = vHighScores[i];
|
||||
@@ -1478,3 +1478,18 @@ bool ProfileManager::ProfileWasLoadedFromMemoryCard( PlayerNumber pn )
|
||||
{
|
||||
return GetProfile(pn) && m_bWasLoadedFromMemoryCard[pn];
|
||||
}
|
||||
|
||||
CString ProfileManager::GetProfileDir( ProfileSlot slot )
|
||||
{
|
||||
switch( slot )
|
||||
{
|
||||
case PROFILE_SLOT_PLAYER_1:
|
||||
case PROFILE_SLOT_PLAYER_2:
|
||||
return m_sProfileDir[slot];
|
||||
case PROFILE_SLOT_MACHINE:
|
||||
return MACHINE_PROFILE_DIR;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ public:
|
||||
|
||||
bool IsUsingProfile( PlayerNumber pn ) { return !m_sProfileDir[pn].empty(); }
|
||||
Profile* GetProfile( PlayerNumber pn );
|
||||
CString GetProfileDir( ProfileSlot slot );
|
||||
|
||||
Profile* GetMachineProfile() { return &m_MachineProfile; }
|
||||
|
||||
@@ -121,24 +122,24 @@ public:
|
||||
|
||||
void AddHighScore( HighScore hs, int &iIndexOut );
|
||||
|
||||
} m_CategoryDatas[NUM_MEMORY_CARDS][NUM_STEPS_TYPES][NUM_RANKING_CATEGORIES];
|
||||
} m_CategoryDatas[NUM_PROFILE_SLOTS][NUM_STEPS_TYPES][NUM_RANKING_CATEGORIES];
|
||||
|
||||
void AddHighScore( StepsType nt, RankingCategory rc, PlayerNumber pn, CategoryData::HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut )
|
||||
{
|
||||
hs.sName = RANKING_TO_FILL_IN_MARKER[pn];
|
||||
m_CategoryDatas[pn][nt][rc].AddHighScore( hs, iPersonalIndexOut );
|
||||
m_CategoryDatas[MEMORY_CARD_MACHINE][nt][rc].AddHighScore( hs, iMachineIndexOut );
|
||||
m_CategoryDatas[PROFILE_SLOT_MACHINE][nt][rc].AddHighScore( hs, iMachineIndexOut );
|
||||
}
|
||||
|
||||
void ReadSM300NoteScores();
|
||||
void ReadSongScoresFromDir( CString sDir, MemoryCard mc );
|
||||
void ReadCourseScoresFromDir( CString sDir, MemoryCard mc );
|
||||
void ReadCategoryScoresFromDir( CString sDir, MemoryCard mc );
|
||||
void ReadSongScoresFromDir( CString sDir, ProfileSlot slot );
|
||||
void ReadCourseScoresFromDir( CString sDir, ProfileSlot slot );
|
||||
void ReadCategoryScoresFromDir( CString sDir, ProfileSlot slot );
|
||||
|
||||
void SaveSongScoresToDir( CString sDir, MemoryCard mc );
|
||||
void SaveCourseScoresToDir( CString sDir, MemoryCard mc );
|
||||
void SaveCategoryScoresToDir( CString sDir, MemoryCard mc );
|
||||
void SaveStatsWebPageToDir( CString sDir, MemoryCard mc );
|
||||
void SaveSongScoresToDir( CString sDir, ProfileSlot slot );
|
||||
void SaveCourseScoresToDir( CString sDir, ProfileSlot slot );
|
||||
void SaveCategoryScoresToDir( CString sDir, ProfileSlot slot );
|
||||
void SaveStatsWebPageToDir( CString sDir, ProfileSlot slot );
|
||||
|
||||
private:
|
||||
bool LoadDefaultProfileFromMachine( PlayerNumber pn );
|
||||
|
||||
@@ -174,7 +174,7 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S
|
||||
/* Increment the play count. */
|
||||
if( !m_bDemonstration )
|
||||
{
|
||||
for( int mc = 0; mc < NUM_MEMORY_CARDS; ++mc )
|
||||
for( int mc = 0; mc < NUM_PROFILE_SLOTS; ++mc )
|
||||
++GAMESTATE->m_pCurCourse->m_MemCardDatas[st][mc].iNumTimesPlayed;
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S
|
||||
if( !GAMESTATE->IsPlayerEnabled(p) )
|
||||
continue;
|
||||
|
||||
m_DifficultyIcon[p].Load( THEME->GetPathToG("ScreenGameplay difficulty icons 2x5") );
|
||||
m_DifficultyIcon[p].Load( THEME->GetPathToG(ssprintf("ScreenGameplay difficulty icons 2x%d",NUM_DIFFICULTIES)) );
|
||||
|
||||
/* Position it in LoadNextSong. */
|
||||
this->AddChild( &m_DifficultyIcon[p] );
|
||||
@@ -873,7 +873,7 @@ void ScreenGameplay::LoadNextSong()
|
||||
* even if the people playing it aren't good at it.) */
|
||||
if( !m_bDemonstration )
|
||||
{
|
||||
for( int mc = 0; mc < NUM_MEMORY_CARDS; ++mc )
|
||||
for( int mc = 0; mc < NUM_PROFILE_SLOTS; ++mc )
|
||||
++GAMESTATE->m_pCurNotes[p]->m_MemCardDatas[mc].iNumTimesPlayed;
|
||||
}
|
||||
|
||||
|
||||
@@ -673,10 +673,10 @@ float ScreenRanking::SetPage( PageToShow pts )
|
||||
{
|
||||
ProfileManager::CategoryData::HighScore hs;
|
||||
bool bRecentHighScore = false;
|
||||
if( l < (int)PROFILEMAN->m_CategoryDatas[MEMORY_CARD_MACHINE][pts.nt][pts.category].vHighScores.size() )
|
||||
if( l < (int)PROFILEMAN->m_CategoryDatas[PROFILE_SLOT_MACHINE][pts.nt][pts.category].vHighScores.size() )
|
||||
{
|
||||
hs = PROFILEMAN->m_CategoryDatas[MEMORY_CARD_MACHINE][pts.nt][pts.category].vHighScores[l];
|
||||
CString *psName = &PROFILEMAN->m_CategoryDatas[MEMORY_CARD_MACHINE][pts.nt][pts.category].vHighScores[l].sName;
|
||||
hs = PROFILEMAN->m_CategoryDatas[PROFILE_SLOT_MACHINE][pts.nt][pts.category].vHighScores[l];
|
||||
CString *psName = &PROFILEMAN->m_CategoryDatas[PROFILE_SLOT_MACHINE][pts.nt][pts.category].vHighScores[l].sName;
|
||||
bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
|
||||
}
|
||||
else
|
||||
@@ -714,10 +714,10 @@ float ScreenRanking::SetPage( PageToShow pts )
|
||||
{
|
||||
Course::MemCardData::HighScore hs;
|
||||
bool bRecentHighScore = false;
|
||||
if( l < (int)pts.pCourse->m_MemCardDatas[pts.nt][MEMORY_CARD_MACHINE].vHighScores.size() )
|
||||
if( l < (int)pts.pCourse->m_MemCardDatas[pts.nt][PROFILE_SLOT_MACHINE].vHighScores.size() )
|
||||
{
|
||||
hs = pts.pCourse->m_MemCardDatas[pts.nt][MEMORY_CARD_MACHINE].vHighScores[l];
|
||||
CString *psName = &pts.pCourse->m_MemCardDatas[pts.nt][MEMORY_CARD_MACHINE].vHighScores[l].sName;
|
||||
hs = pts.pCourse->m_MemCardDatas[pts.nt][PROFILE_SLOT_MACHINE].vHighScores[l];
|
||||
CString *psName = &pts.pCourse->m_MemCardDatas[pts.nt][PROFILE_SLOT_MACHINE].vHighScores[l].sName;
|
||||
bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
|
||||
}
|
||||
else
|
||||
@@ -780,10 +780,10 @@ float ScreenRanking::SetPage( PageToShow pts )
|
||||
{
|
||||
Steps::MemCardData::HighScore hs;
|
||||
bool bRecentHighScore = false;
|
||||
if( !pSteps->m_MemCardDatas[MEMORY_CARD_MACHINE].vHighScores.empty() )
|
||||
if( !pSteps->m_MemCardDatas[PROFILE_SLOT_MACHINE].vHighScores.empty() )
|
||||
{
|
||||
hs = pSteps->m_MemCardDatas[MEMORY_CARD_MACHINE].vHighScores[0];
|
||||
const CString *psName = &pSteps->m_MemCardDatas[MEMORY_CARD_MACHINE].vHighScores[0].sName;
|
||||
hs = pSteps->m_MemCardDatas[PROFILE_SLOT_MACHINE].vHighScores[0];
|
||||
const CString *psName = &pSteps->m_MemCardDatas[PROFILE_SLOT_MACHINE].vHighScores[0].sName;
|
||||
bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
|
||||
}
|
||||
else
|
||||
@@ -818,10 +818,10 @@ float ScreenRanking::SetPage( PageToShow pts )
|
||||
|
||||
Course::MemCardData::HighScore hs;
|
||||
bool bRecentHighScore = false;
|
||||
if( !pCourse->m_MemCardDatas[pts.nt][MEMORY_CARD_MACHINE].vHighScores.empty() )
|
||||
if( !pCourse->m_MemCardDatas[pts.nt][PROFILE_SLOT_MACHINE].vHighScores.empty() )
|
||||
{
|
||||
hs = pCourse->m_MemCardDatas[pts.nt][MEMORY_CARD_MACHINE].vHighScores[0];
|
||||
const CString *psName = &pCourse->m_MemCardDatas[pts.nt][MEMORY_CARD_MACHINE].vHighScores[0].sName;
|
||||
hs = pCourse->m_MemCardDatas[pts.nt][PROFILE_SLOT_MACHINE].vHighScores[0];
|
||||
const CString *psName = &pCourse->m_MemCardDatas[pts.nt][PROFILE_SLOT_MACHINE].vHighScores[0].sName;
|
||||
bRecentHighScore = find( GAMESTATE->m_vpsNamesThatWereFilled.begin(), GAMESTATE->m_vpsNamesThatWereFilled.end(), psName ) != GAMESTATE->m_vpsNamesThatWereFilled.end();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -416,7 +416,7 @@ void ScreenSelectCourse::AfterCourseChange()
|
||||
{
|
||||
const StepsType &st = GAMESTATE->GetCurrentStyleDef()->m_StepsType;
|
||||
|
||||
int mc = MEMORY_CARD_MACHINE;
|
||||
int mc = PROFILE_SLOT_MACHINE;
|
||||
if( PROFILEMAN->IsUsingProfile( (PlayerNumber)p ) )
|
||||
mc = p;
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ ScreenSelectMusic::ScreenSelectMusic( CString sClassName ) : Screen( sClassName
|
||||
this->AddChild( &m_sprDifficultyFrame[p] );
|
||||
|
||||
m_DifficultyIcon[p].SetName( ssprintf("DifficultyIconP%d",p+1) );
|
||||
m_DifficultyIcon[p].Load( THEME->GetPathToG("ScreenSelectMusic difficulty icons 1x5") );
|
||||
m_DifficultyIcon[p].Load( THEME->GetPathToG(ssprintf("ScreenSelectMusic difficulty icons 1x%d",NUM_DIFFICULTIES)) );
|
||||
SET_XY( m_DifficultyIcon[p] );
|
||||
this->AddChild( &m_DifficultyIcon[p] );
|
||||
|
||||
@@ -1151,8 +1151,8 @@ void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn )
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !pNotes->m_MemCardDatas[MEMORY_CARD_MACHINE].vHighScores.empty() )
|
||||
iScore = pNotes->m_MemCardDatas[MEMORY_CARD_MACHINE].vHighScores[0].iScore;
|
||||
if( !pNotes->m_MemCardDatas[PROFILE_SLOT_MACHINE].vHighScores.empty() )
|
||||
iScore = pNotes->m_MemCardDatas[PROFILE_SLOT_MACHINE].vHighScores[0].iScore;
|
||||
}
|
||||
m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, iScore) );
|
||||
}
|
||||
@@ -1316,7 +1316,7 @@ void ScreenSelectMusic::AfterMusicChange()
|
||||
TEXTUREMAN->EnableOddDimensionWarning();
|
||||
FlipSpriteHorizontally(m_sprCDTitleBack);
|
||||
|
||||
const vector<Song*> best = SONGMAN->GetBestSongs( MEMORY_CARD_MACHINE );
|
||||
const vector<Song*> best = SONGMAN->GetBestSongs( PROFILE_SLOT_MACHINE );
|
||||
const int index = FindIndex( best.begin(), best.end(), pSong );
|
||||
if( index != -1 )
|
||||
m_MachineRank.SetText( ssprintf("%i", index+1) );
|
||||
@@ -1416,7 +1416,7 @@ void ScreenSelectMusic::AfterMusicChange()
|
||||
}
|
||||
}
|
||||
|
||||
const vector<Course*> best = SONGMAN->GetBestCourses( MEMORY_CARD_MACHINE );
|
||||
const vector<Course*> best = SONGMAN->GetBestCourses( PROFILE_SLOT_MACHINE );
|
||||
const int index = FindCourseIndexOfSameMode( best.begin(), best.end(), pCourse );
|
||||
if( index != -1 )
|
||||
m_MachineRank.SetText( ssprintf("%i", index+1) );
|
||||
|
||||
+15
-5
@@ -72,6 +72,7 @@ void SortBackgroundChangesArray( vector<BackgroundChange> &arrayBackgroundChange
|
||||
//////////////////////////////
|
||||
Song::Song()
|
||||
{
|
||||
m_LoadedFromProfile = PROFILE_SLOT_INVALID;
|
||||
m_bChangedSinceSave = false;
|
||||
m_fMusicSampleStartSeconds = -1;
|
||||
m_fMusicSampleLengthSeconds = DEFAULT_MUSIC_SAMPLE_LENGTH;
|
||||
@@ -1114,7 +1115,7 @@ void Song::RemoveAutoGenNotes()
|
||||
}
|
||||
|
||||
|
||||
Steps::MemCardData::HighScore GetHighScoreForDifficulty( const Song *s, const StyleDef *st, MemoryCard card, Difficulty dc )
|
||||
Steps::MemCardData::HighScore GetHighScoreForDifficulty( const Song *s, const StyleDef *st, ProfileSlot card, Difficulty dc )
|
||||
{
|
||||
// return max grade of notes in difficulty class
|
||||
vector<Steps*> aNotes;
|
||||
@@ -1132,7 +1133,7 @@ Steps::MemCardData::HighScore GetHighScoreForDifficulty( const Song *s, const St
|
||||
|
||||
bool Song::IsNew() const
|
||||
{
|
||||
return GetNumTimesPlayed(MEMORY_CARD_MACHINE) == 0;
|
||||
return GetNumTimesPlayed(PROFILE_SLOT_MACHINE) == 0;
|
||||
}
|
||||
|
||||
bool Song::IsEasy( StepsType nt ) const
|
||||
@@ -1386,7 +1387,7 @@ bool CompareSongPointersBySortValueDescending(const Song *pSong1, const Song *pS
|
||||
return song_sort_val[pSong1] > song_sort_val[pSong2];
|
||||
}
|
||||
|
||||
void SortSongPointerArrayByMostPlayed( vector<Song*> &arraySongPointers, MemoryCard card )
|
||||
void SortSongPointerArrayByMostPlayed( vector<Song*> &arraySongPointers, ProfileSlot card )
|
||||
{
|
||||
for(unsigned i = 0; i < arraySongPointers.size(); ++i)
|
||||
song_sort_val[arraySongPointers[i]] = ssprintf("%9i", arraySongPointers[i]->GetNumTimesPlayed(card));
|
||||
@@ -1552,7 +1553,7 @@ bool Song::HasBackground() const {return m_sBackgroundFile != "" && IsAFile(G
|
||||
bool Song::HasCDTitle() const {return m_sCDTitleFile != "" && IsAFile(GetCDTitlePath()); }
|
||||
bool Song::HasBGChanges() const {return !m_BackgroundChanges.empty(); }
|
||||
|
||||
int Song::GetNumTimesPlayed( MemoryCard card ) const
|
||||
int Song::GetNumTimesPlayed( ProfileSlot card ) const
|
||||
{
|
||||
int iTotalNumTimesPlayed = 0;
|
||||
for( unsigned i=0; i<m_apNotes.size(); i++ )
|
||||
@@ -1672,7 +1673,7 @@ int Song::GetNumNotesWithGrade( Grade g ) const
|
||||
{
|
||||
Steps* pSteps = vNotes[j];
|
||||
|
||||
if( pSteps->GetTopScore(MEMORY_CARD_MACHINE).grade == g )
|
||||
if( pSteps->GetTopScore(PROFILE_SLOT_MACHINE).grade == g )
|
||||
iCount++;
|
||||
}
|
||||
return iCount;
|
||||
@@ -1699,3 +1700,12 @@ bool Song::Matches(CString sGroup, CString sSong) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void Song::FreeAllLoadedFromProfiles()
|
||||
{
|
||||
for( unsigned s=0; s<m_apNotes.size(); s++ )
|
||||
{
|
||||
Steps* pSteps = m_apNotes[s];
|
||||
if( pSteps->WasLoadedFromProfile() )
|
||||
this->RemoveNotes( pSteps );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "RageTextureManager.h"
|
||||
#include "Banner.h"
|
||||
#include "ProfileManager.h"
|
||||
#include "MemoryCardManager.h"
|
||||
#include "NotesLoaderSM.h"
|
||||
|
||||
SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
@@ -45,6 +47,7 @@ CachedThemeMetricC EASY_COLOR ("SongManager","EasyColor");
|
||||
CachedThemeMetricC MEDIUM_COLOR ("SongManager","MediumColor");
|
||||
CachedThemeMetricC HARD_COLOR ("SongManager","HardColor");
|
||||
CachedThemeMetricC CHALLENGE_COLOR ("SongManager","ChallengeColor");
|
||||
CachedThemeMetricC EDIT_COLOR ("SongManager","EditColor");
|
||||
CachedThemeMetricC EXTRA_COLOR ("SongManager","ExtraColor");
|
||||
CachedThemeMetricI EXTRA_COLOR_METER ("SongManager","ExtraColorMeter");
|
||||
|
||||
@@ -66,6 +69,7 @@ static void UpdateMetrics()
|
||||
MEDIUM_COLOR.Refresh();
|
||||
HARD_COLOR.Refresh();
|
||||
CHALLENGE_COLOR.Refresh();
|
||||
EDIT_COLOR.Refresh();
|
||||
EXTRA_COLOR.Refresh();
|
||||
EXTRA_COLOR_METER.Refresh();
|
||||
}
|
||||
@@ -397,7 +401,8 @@ RageColor SongManager::GetDifficultyColor( Difficulty dc ) const
|
||||
case DIFFICULTY_MEDIUM: return MEDIUM_COLOR;
|
||||
case DIFFICULTY_HARD: return HARD_COLOR;
|
||||
case DIFFICULTY_CHALLENGE: return CHALLENGE_COLOR;
|
||||
default: ASSERT(0); return CHALLENGE_COLOR;
|
||||
case DIFFICULTY_EDIT: return EDIT_COLOR;
|
||||
default: ASSERT(0); return EDIT_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -777,6 +782,8 @@ Song* SongManager::GetSongFromDir( CString sDir )
|
||||
if( sDir.Right(1) != "/" )
|
||||
sDir += "/";
|
||||
|
||||
sDir.Replace( '\\', '/' );
|
||||
|
||||
for( unsigned int i=0; i<m_pSongs.size(); i++ )
|
||||
if( sDir.CompareNoCase(m_pSongs[i]->GetSongDir()) == 0 )
|
||||
return m_pSongs[i];
|
||||
@@ -822,7 +829,7 @@ Course* SongManager::GetCourseFromName( CString sName )
|
||||
|
||||
Song *SongManager::FindSong( CString sPath )
|
||||
{
|
||||
sPath.Replace( "\\", "/" );
|
||||
sPath.Replace( '\\', '/' );
|
||||
CStringArray bits;
|
||||
split( sPath, "/", bits );
|
||||
|
||||
@@ -860,13 +867,13 @@ Course *SongManager::FindCourse( CString sName )
|
||||
void SongManager::UpdateBestAndShuffled()
|
||||
{
|
||||
// update players best
|
||||
for( int i = 0; i < NUM_MEMORY_CARDS; ++i )
|
||||
for( int i = 0; i < NUM_PROFILE_SLOTS; ++i )
|
||||
{
|
||||
m_pBestSongs[i] = m_pSongs;
|
||||
SortSongPointerArrayByMostPlayed( m_pBestSongs[i], (MemoryCard) i );
|
||||
SortSongPointerArrayByMostPlayed( m_pBestSongs[i], (ProfileSlot) i );
|
||||
|
||||
m_pBestCourses[i] = m_pCourses;
|
||||
SortCoursePointerArrayByMostPlayed( m_pBestCourses[i], (MemoryCard) i );
|
||||
SortCoursePointerArrayByMostPlayed( m_pBestCourses[i], (ProfileSlot) i );
|
||||
}
|
||||
|
||||
// update shuffled
|
||||
@@ -899,3 +906,43 @@ void SongManager::UpdateRankingCourses()
|
||||
}
|
||||
}
|
||||
|
||||
void SongManager::LoadAllFromProfiles()
|
||||
{
|
||||
for( int s=0; s<NUM_PROFILE_SLOTS; s++ )
|
||||
{
|
||||
CString sProfileDir = PROFILEMAN->GetProfileDir( (ProfileSlot)s );
|
||||
if( sProfileDir.empty() )
|
||||
continue; // skip
|
||||
//
|
||||
// Load all edits. Edits are dangling .sm files in the Edits folder
|
||||
//
|
||||
{
|
||||
CString sEditsDir = sProfileDir+"Edits/";
|
||||
CStringArray asEditsFilesWithPath;
|
||||
GetDirListing( sEditsDir+"*.sm", asEditsFilesWithPath, false, true );
|
||||
|
||||
for( unsigned i=0; i<asEditsFilesWithPath.size(); i++ )
|
||||
{
|
||||
CString sEditFileWithPath = asEditsFilesWithPath[i];
|
||||
|
||||
SMLoader::LoadEdit( sEditFileWithPath );
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Load all songs
|
||||
//
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SongManager::FreeAllLoadedFromProfiles()
|
||||
{
|
||||
for( unsigned s=0; s<m_pSongs.size(); s++ )
|
||||
{
|
||||
Song* pSong = m_pSongs[s];
|
||||
pSong->FreeAllLoadedFromProfiles();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ public:
|
||||
void FreeSongs();
|
||||
void Cleanup();
|
||||
|
||||
void LoadAllFromProfiles(); // song, edits
|
||||
void FreeAllLoadedFromProfiles();
|
||||
|
||||
void LoadGroupSymLinks( CString sDir, CString sGroupFolder );
|
||||
|
||||
void InitCoursesFromDisk( LoadingWindow *ld );
|
||||
@@ -61,8 +64,8 @@ public:
|
||||
|
||||
// Lookup
|
||||
const vector<Song*> &GetAllSongs() const { return m_pSongs; }
|
||||
const vector<Song*> &GetBestSongs( MemoryCard card=MEMORY_CARD_MACHINE ) const { return m_pBestSongs[MEMORY_CARD_MACHINE]; }
|
||||
const vector<Course*> &GetBestCourses( MemoryCard card=MEMORY_CARD_MACHINE ) const { return m_pBestCourses[MEMORY_CARD_MACHINE]; }
|
||||
const vector<Song*> &GetBestSongs( ProfileSlot slot=PROFILE_SLOT_MACHINE ) const { return m_pBestSongs[PROFILE_SLOT_MACHINE]; }
|
||||
const vector<Course*> &GetBestCourses( ProfileSlot slot=PROFILE_SLOT_MACHINE ) const { return m_pBestCourses[PROFILE_SLOT_MACHINE]; }
|
||||
void GetSongs( vector<Song*> &AddTo, CString sGroupName, int iMaxStages = 100000 /*inf*/ ) const;
|
||||
void GetSongs( vector<Song*> &AddTo, int iMaxStages ) const { GetSongs(AddTo,"",iMaxStages); }
|
||||
void GetSongs( vector<Song*> &AddTo ) const { GetSongs(AddTo,"",100000 /*inf*/ ); }
|
||||
@@ -103,12 +106,12 @@ protected:
|
||||
Song *FindSong( CString sGroup, CString sSong );
|
||||
|
||||
vector<Song*> m_pSongs; // all songs that can be played
|
||||
vector<Song*> m_pBestSongs[NUM_MEMORY_CARDS];
|
||||
vector<Song*> m_pBestSongs[NUM_PROFILE_SLOTS];
|
||||
vector<Song*> m_pShuffledSongs; // used by GetRandomSong
|
||||
CStringArray m_sGroupNames;
|
||||
CStringArray m_sGroupBannerPaths; // each song group may have a banner associated with it
|
||||
vector<Course*> m_pCourses;
|
||||
vector<Course*> m_pBestCourses[NUM_MEMORY_CARDS];
|
||||
vector<Course*> m_pBestCourses[NUM_PROFILE_SLOTS];
|
||||
vector<Course*> m_pShuffledCourses; // used by GetRandomCourse
|
||||
};
|
||||
|
||||
|
||||
+4
-11
@@ -36,7 +36,7 @@ Steps::Steps()
|
||||
* until after b6 to do this. -glenn */
|
||||
/* Yep, it should be STEPS_TYPE_INVALID. -Chris */
|
||||
m_StepsType = STEPS_TYPE_INVALID;
|
||||
m_bIsAnEdit = false;
|
||||
m_LoadedFromProfile = PROFILE_SLOT_INVALID;
|
||||
m_Difficulty = DIFFICULTY_INVALID;
|
||||
m_iMeter = 0;
|
||||
for(int i = 0; i < NUM_RADAR_CATEGORIES; ++i)
|
||||
@@ -127,7 +127,7 @@ float Steps::PredictMeter() const
|
||||
|
||||
const float DifficultyCoeffs[NUM_DIFFICULTIES] =
|
||||
{
|
||||
-0.877f, -0.877f, 0, 0.722f, 0.722f
|
||||
-0.877f, -0.877f, 0, 0.722f, 0.722f, 0
|
||||
};
|
||||
pMeter += DifficultyCoeffs[this->GetDifficulty()];
|
||||
|
||||
@@ -233,7 +233,6 @@ void Steps::DeAutogen()
|
||||
|
||||
Decompress(); // fills in notes with sliding window transform
|
||||
|
||||
m_bIsAnEdit = Real()->m_bIsAnEdit;
|
||||
m_sDescription = Real()->m_sDescription;
|
||||
m_Difficulty = Real()->m_Difficulty;
|
||||
m_iMeter = Real()->m_iMeter;
|
||||
@@ -287,12 +286,6 @@ bool Steps::IsAutogen() const
|
||||
return parent != NULL;
|
||||
}
|
||||
|
||||
void Steps::SetIsAnEdit(bool b)
|
||||
{
|
||||
DeAutogen();
|
||||
m_bIsAnEdit = b;
|
||||
}
|
||||
|
||||
void Steps::SetDescription(CString desc)
|
||||
{
|
||||
DeAutogen();
|
||||
@@ -334,7 +327,7 @@ bool CompareStepsPointersBySortValueDescending(const Steps *pSteps1, const Steps
|
||||
return steps_sort_val[pSteps1] > steps_sort_val[pSteps2];
|
||||
}
|
||||
|
||||
void SortStepsPointerArrayByMostPlayed( vector<Steps*> &vStepsPointers, MemoryCard card )
|
||||
void SortStepsPointerArrayByMostPlayed( vector<Steps*> &vStepsPointers, ProfileSlot card )
|
||||
{
|
||||
for(unsigned i = 0; i < vStepsPointers.size(); ++i)
|
||||
steps_sort_val[vStepsPointers[i]] = ssprintf("%9i", vStepsPointers[i]->GetNumTimesPlayed(card));
|
||||
@@ -434,6 +427,6 @@ void Steps::AddHighScore( PlayerNumber pn, MemCardData::HighScore hs, int &iPers
|
||||
m_MemCardDatas[pn].AddHighScore( hs, iPersonalIndexOut );
|
||||
else
|
||||
iPersonalIndexOut = -1;
|
||||
m_MemCardDatas[MEMORY_CARD_MACHINE].AddHighScore( hs, iMachineIndexOut );
|
||||
m_MemCardDatas[PROFILE_SLOT_MACHINE].AddHighScore( hs, iMachineIndexOut );
|
||||
}
|
||||
|
||||
|
||||
+10
-8
@@ -33,12 +33,14 @@ public:
|
||||
void Decompress() const;
|
||||
void DeAutogen(); /* If this Steps is autogenerated, make it a real Steps. */
|
||||
|
||||
// Use a special value of difficulty
|
||||
bool IsAnEdit() const { return m_Difficulty == DIFFICULTY_EDIT; }
|
||||
bool WasLoadedFromProfile() const { return m_LoadedFromProfile != PROFILE_SLOT_INVALID; }
|
||||
CString GetDescription() const { return Real()->m_sDescription; }
|
||||
Difficulty GetDifficulty() const { return Real()->m_Difficulty; }
|
||||
int GetMeter() const { return Real()->m_iMeter; }
|
||||
const float *GetRadarValues() const { return Real()->m_fRadarValues; }
|
||||
|
||||
void SetIsAnEdit(bool b);
|
||||
void SetDescription(CString desc);
|
||||
void SetDifficulty(Difficulty d);
|
||||
void SetMeter(int meter);
|
||||
@@ -91,18 +93,18 @@ public:
|
||||
return vHighScores[0];
|
||||
}
|
||||
|
||||
} m_MemCardDatas[NUM_MEMORY_CARDS];
|
||||
} m_MemCardDatas[NUM_PROFILE_SLOTS];
|
||||
|
||||
void AddHighScore( PlayerNumber pn, MemCardData::HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut );
|
||||
|
||||
MemCardData::HighScore GetTopScore( MemoryCard card )
|
||||
MemCardData::HighScore GetTopScore( ProfileSlot slot )
|
||||
{
|
||||
return m_MemCardDatas[card].GetTopScore();
|
||||
return m_MemCardDatas[slot].GetTopScore();
|
||||
}
|
||||
|
||||
int GetNumTimesPlayed( MemoryCard card )
|
||||
int GetNumTimesPlayed( ProfileSlot slot )
|
||||
{
|
||||
return m_MemCardDatas[card].iNumTimesPlayed;
|
||||
return m_MemCardDatas[slot].iNumTimesPlayed;
|
||||
}
|
||||
|
||||
void TidyUpData();
|
||||
@@ -125,7 +127,7 @@ protected:
|
||||
const Steps *Real() const;
|
||||
|
||||
/* These values are pulled from the autogen source first, if there is one. */
|
||||
bool m_bIsAnEdit; // true if this was loaded from a memory card
|
||||
ProfileSlot m_LoadedFromProfile; // PROFILE_SLOT_INVALID if wasn't loaded from a profile
|
||||
CString m_sDescription; // Step author, edit name, or something meaningful
|
||||
Difficulty m_Difficulty; // difficulty classification
|
||||
int m_iMeter; // difficulty rating from MIN_METER to MAX_METER
|
||||
@@ -139,6 +141,6 @@ bool CompareNotesPointersByDifficulty(const Steps *pNotes1, const Steps *pNotes2
|
||||
void SortNotesArrayByDifficulty( vector<Steps*> &arrayNotess );
|
||||
bool CompareStepsPointersByTypeAndDifficulty(const Steps *pStep1, const Steps *pStep2);
|
||||
void SortStepsByTypeAndDifficulty( vector<Steps*> &arraySongPointers );
|
||||
void SortStepsPointerArrayByMostPlayed( vector<Steps*> &vStepsPointers, MemoryCard card );
|
||||
void SortStepsPointerArrayByMostPlayed( vector<Steps*> &vStepsPointers, ProfileSlot slot );
|
||||
|
||||
#endif
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
|
||||
CString m_sGroupName;
|
||||
|
||||
|
||||
ProfileSlot m_LoadedFromProfile; // PROFILE_SLOT_INVALID if wasn't loaded from a profile
|
||||
bool m_bChangedSinceSave;
|
||||
bool m_bIsSymLink;
|
||||
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
Steps* GetStepsByDescription( StepsType nt, CString sDescription, bool bIncludeAutoGen = true ) const;
|
||||
Steps* GetClosestNotes( StepsType nt, Difficulty dc, bool bIncludeAutoGen = true ) const;
|
||||
void GetEdits( vector<Steps*>& arrayAddTo, StepsType nt, bool bIncludeAutoGen = true ) const;
|
||||
int GetNumTimesPlayed( MemoryCard card ) const;
|
||||
int GetNumTimesPlayed( ProfileSlot slot ) const;
|
||||
bool IsNew() const;
|
||||
bool IsEasy( StepsType nt ) const;
|
||||
bool HasEdits( StepsType nt ) const;
|
||||
@@ -198,6 +198,9 @@ public:
|
||||
|
||||
void AddNotes( Steps* pNotes ); // we are responsible for deleting the memory pointed to by pNotes!
|
||||
void RemoveNotes( const Steps* pNotes );
|
||||
|
||||
void FreeAllLoadedFromProfiles();
|
||||
bool WasLoadedFromProfile() const { return m_LoadedFromProfile != PROFILE_SLOT_INVALID; }
|
||||
};
|
||||
|
||||
CString MakeSortString( CString s );
|
||||
@@ -208,7 +211,7 @@ void SortSongPointerArrayByGrade( vector<Song*> &arraySongPointers );
|
||||
void SortSongPointerArrayByArtist( vector<Song*> &arraySongPointers );
|
||||
void SortSongPointerArrayByGroupAndDifficulty( vector<Song*> &arraySongPointers );
|
||||
void SortSongPointerArrayByGroupAndTitle( vector<Song*> &arraySongPointers );
|
||||
void SortSongPointerArrayByMostPlayed( vector<Song*> &arraySongPointers, MemoryCard card );
|
||||
void SortSongPointerArrayByMostPlayed( vector<Song*> &arraySongPointers, ProfileSlot slot );
|
||||
void SortSongPointerArrayByMeter( vector<Song*> &arraySongPointers, Difficulty dc );
|
||||
CString GetSectionNameFromSongAndSort( const Song* pSong, SongSortOrder so );
|
||||
void SortSongPointerArrayBySectionName( vector<Song*> &arraySongPointers, SongSortOrder so );
|
||||
|
||||
Reference in New Issue
Block a user