save last played song to profile

This commit is contained in:
Chris Danford
2004-03-25 09:54:28 +00:00
parent e89bbf1565
commit 742daadcf5
4 changed files with 23 additions and 14 deletions
+10 -6
View File
@@ -214,10 +214,12 @@ void GameState::PlayersFinalized()
// Only set the sort order if it wasn't already set by a ModeChoice
if( m_SortOrder == SORT_INVALID && pProfile->m_SortOrder != SORT_INVALID )
m_SortOrder = pProfile->m_SortOrder;
if( pProfile->m_PreferredDifficulty != DIFFICULTY_INVALID )
GAMESTATE->m_PreferredDifficulty[pn] = pProfile->m_PreferredDifficulty;
if( pProfile->m_PreferredCourseDifficulty != COURSE_DIFFICULTY_INVALID )
GAMESTATE->m_PreferredCourseDifficulty[pn] = pProfile->m_PreferredCourseDifficulty;
if( pProfile->m_LastDifficulty != DIFFICULTY_INVALID )
GAMESTATE->m_PreferredDifficulty[pn] = pProfile->m_LastDifficulty;
if( pProfile->m_LastCourseDifficulty != COURSE_DIFFICULTY_INVALID )
GAMESTATE->m_PreferredCourseDifficulty[pn] = pProfile->m_LastCourseDifficulty;
if( m_pCurSong == NULL && pProfile->m_pLastSong )
m_pCurSong = pProfile->m_pLastSong;
}
@@ -311,9 +313,11 @@ void GameState::EndGame()
if( IsSongSort(m_SortOrder) )
pProfile->m_SortOrder = m_SortOrder;
if( m_PreferredDifficulty[pn] != DIFFICULTY_INVALID )
pProfile->m_PreferredDifficulty = m_PreferredDifficulty[pn];
pProfile->m_LastDifficulty = m_PreferredDifficulty[pn];
if( m_PreferredCourseDifficulty[pn] != COURSE_DIFFICULTY_INVALID )
pProfile->m_PreferredCourseDifficulty = m_PreferredCourseDifficulty[pn];
pProfile->m_LastCourseDifficulty = m_PreferredCourseDifficulty[pn];
if( !g_vPlayedStageStats.empty() )
pProfile->m_pLastSong = g_vPlayedStageStats.back().pSong;
PROFILEMAN->SaveProfile( pn );
PROFILEMAN->UnloadProfile( pn );
+9 -6
View File
@@ -80,8 +80,9 @@ void Profile::InitGeneralData()
m_bUsingProfileDefaultModifiers = false;
m_sDefaultModifiers = "";
m_SortOrder = SORT_INVALID;
m_PreferredDifficulty = DIFFICULTY_INVALID;
m_PreferredCourseDifficulty = COURSE_DIFFICULTY_INVALID;
m_LastDifficulty = DIFFICULTY_INVALID;
m_LastCourseDifficulty = COURSE_DIFFICULTY_INVALID;
m_pLastSong = NULL;
m_iTotalPlays = 0;
m_iTotalPlaySeconds = 0;
m_iTotalGameplaySeconds = 0;
@@ -597,8 +598,9 @@ XNode* Profile::SaveGeneralDataCreateNode() const
pGeneralDataNode->AppendChild( "UsingProfileDefaultModifiers", m_bUsingProfileDefaultModifiers );
pGeneralDataNode->AppendChild( "DefaultModifiers", m_sDefaultModifiers );
pGeneralDataNode->AppendChild( "SortOrder", SortOrderToString(m_SortOrder) );
pGeneralDataNode->AppendChild( "PreferredDifficulty", DifficultyToString(m_PreferredDifficulty) );
pGeneralDataNode->AppendChild( "PreferredCourseDifficulty", CourseDifficultyToString(m_PreferredCourseDifficulty) );
pGeneralDataNode->AppendChild( "LastDifficulty", DifficultyToString(m_LastDifficulty) );
pGeneralDataNode->AppendChild( "LastCourseDifficulty", CourseDifficultyToString(m_LastCourseDifficulty) );
if( m_pLastSong ) pGeneralDataNode->AppendChild( "LastSong", m_pLastSong->GetSongDir() );
pGeneralDataNode->AppendChild( "TotalPlays", m_iTotalPlays );
pGeneralDataNode->AppendChild( "TotalPlaySeconds", m_iTotalPlaySeconds );
pGeneralDataNode->AppendChild( "TotalGameplaySeconds", m_iTotalGameplaySeconds );
@@ -737,8 +739,9 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
pNode->GetChildValue( "UsingProfileDefaultModifiers", m_bUsingProfileDefaultModifiers );
pNode->GetChildValue( "DefaultModifiers", m_sDefaultModifiers );
pNode->GetChildValue( "SortOrder", s ); m_SortOrder = StringToSortOrder( s );
pNode->GetChildValue( "PreferredDifficulty", s ); m_PreferredDifficulty = StringToDifficulty( s );
pNode->GetChildValue( "PreferredCourseDifficulty", s ); m_PreferredCourseDifficulty = StringToCourseDifficulty( s );
pNode->GetChildValue( "LastDifficulty", s ); m_LastDifficulty = StringToDifficulty( s );
pNode->GetChildValue( "LastCourseDifficulty", s ); m_LastCourseDifficulty = StringToCourseDifficulty( s );
pNode->GetChildValue( "LastSong", s ); m_pLastSong = SONGMAN->GetSongFromDir(s);
pNode->GetChildValue( "TotalPlays", m_iTotalPlays );
pNode->GetChildValue( "TotalPlaySeconds", m_iTotalPlaySeconds );
pNode->GetChildValue( "TotalGameplaySeconds", m_iTotalGameplaySeconds );
+3 -2
View File
@@ -92,8 +92,9 @@ public:
bool m_bUsingProfileDefaultModifiers;
CString m_sDefaultModifiers;
SortOrder m_SortOrder;
Difficulty m_PreferredDifficulty;
CourseDifficulty m_PreferredCourseDifficulty;
Difficulty m_LastDifficulty;
CourseDifficulty m_LastCourseDifficulty;
Song* m_pLastSong;
int m_iTotalPlays;
int m_iTotalPlaySeconds;
int m_iTotalGameplaySeconds;
+1
View File
@@ -280,6 +280,7 @@ bool Song::LoadFromSongDir( CString sDir )
return true; // do load this song
}
// Should this be called StepsID? -Chris
struct SongID
{
StepsType st;