From c0c680317c49ca5bec68931da665165b1ed13040 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 8 Sep 2003 07:21:41 +0000 Subject: [PATCH] profiles are usable --- stepmania/Themes/default/metrics.ini | 1 + stepmania/src/GameConstantsAndTypes.h | 1 + stepmania/src/ModeChoice.cpp | 8 +- stepmania/src/MusicWheelItem.cpp | 11 ++- stepmania/src/ProfileManager.cpp | 124 ++++++++++++++++++++++--- stepmania/src/ProfileManager.h | 27 +++++- stepmania/src/RageUtil.cpp | 5 + stepmania/src/RageUtil.h | 1 + stepmania/src/ScreenManager.cpp | 3 + stepmania/src/ScreenProfileOptions.cpp | 97 +++++++++++++++---- stepmania/src/ScreenProfileOptions.h | 2 + stepmania/src/ScreenSelectMusic.cpp | 16 +++- stepmania/src/ScreenTextEntry.cpp | 2 - stepmania/src/Song.cpp | 4 +- stepmania/src/SongManager.cpp | 34 ++----- stepmania/src/SongManager.h | 28 +++--- stepmania/src/StepMania.dsp | 10 +- stepmania/src/StepMania.vcproj | 12 +++ stepmania/src/song.h | 2 +- 19 files changed, 296 insertions(+), 92 deletions(-) diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index db4fc67508..43fc2caa7d 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -1959,6 +1959,7 @@ Player1Profile= Player2Profile= CreateNew= Delete= +Rename= [ScreenUnlock] UseUnlocksDat=1 diff --git a/stepmania/src/GameConstantsAndTypes.h b/stepmania/src/GameConstantsAndTypes.h index c41d2f5786..91571f16ec 100644 --- a/stepmania/src/GameConstantsAndTypes.h +++ b/stepmania/src/GameConstantsAndTypes.h @@ -249,6 +249,7 @@ const int ITEM_NONE = -1; #define RANDOMMOVIES_DIR CString(BASE_PATH "RandomMovies" SLASH) +#define PROFILES_DIR BASE_PATH "Data" SLASH "Profiles" SLASH // diff --git a/stepmania/src/ModeChoice.cpp b/stepmania/src/ModeChoice.cpp index 9f9ff4cb40..a89eaaa4c7 100644 --- a/stepmania/src/ModeChoice.cpp +++ b/stepmania/src/ModeChoice.cpp @@ -144,5 +144,11 @@ void ModeChoice::Apply( PlayerNumber pn ) GAMESTATE->m_SongOptions.m_LifeType = SongOptions::LIFE_BATTERY; - PROFILEMAN->TryLoadProfile( pn ); + // + // We know what players are joined at the time we set the Style + // + if( style != STYLE_INVALID ) + { + PROFILEMAN->TryLoadProfile( pn ); + } } diff --git a/stepmania/src/MusicWheelItem.cpp b/stepmania/src/MusicWheelItem.cpp index dc86e9feb3..16b00f3249 100644 --- a/stepmania/src/MusicWheelItem.cpp +++ b/stepmania/src/MusicWheelItem.cpp @@ -26,6 +26,7 @@ #include "Steps.h" #include "song.h" #include "Course.h" +#include "ProfileManager.h" // WheelItem stuff @@ -186,8 +187,7 @@ void MusicWheelItem::RefreshGrades() for( int p=0; pm_pSong || // this isn't a song display - !GAMESTATE->IsHumanPlayer(p) || - !SONGMAN->IsUsingMemoryCard((PlayerNumber)p) ) + !GAMESTATE->IsHumanPlayer(p) ) { m_GradeDisplay[p].SetDiffuse( RageColor(1,1,1,0) ); continue; @@ -198,7 +198,12 @@ void MusicWheelItem::RefreshGrades() dc = GAMESTATE->m_pCurNotes[p]->GetDifficulty(); else dc = GAMESTATE->m_PreferredDifficulty[p]; - const Grade grade = data->m_pSong->GetGradeForDifficulty( GAMESTATE->GetCurrentStyleDef(), (PlayerNumber)p, dc ); + Grade grade; + if( PROFILEMAN->IsUsingProfile((PlayerNumber)p) ) + grade = data->m_pSong->GetGradeForDifficulty( GAMESTATE->GetCurrentStyleDef(), (MemoryCard)p, dc ); + else + grade = data->m_pSong->GetGradeForDifficulty( GAMESTATE->GetCurrentStyleDef(), MEMORY_CARD_MACHINE, dc ); + m_GradeDisplay[p].SetGrade( (PlayerNumber)p, grade ); } diff --git a/stepmania/src/ProfileManager.cpp b/stepmania/src/ProfileManager.cpp index 712cef781e..f65528a8a7 100644 --- a/stepmania/src/ProfileManager.cpp +++ b/stepmania/src/ProfileManager.cpp @@ -16,13 +16,16 @@ #include "PrefsManager.h" #include "RageLog.h" #include "IniFile.h" +#include "GameConstantsAndTypes.h" +#include "SongManager.h" ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our program -#define PROFILES_DIR BASE_PATH "Data" SLASH "Profiles" SLASH #define PROFILE_FILE "Profile.ini" +#define NOTES_SCORES_FILE "NotesScores.dat" +#define COURSE_SCORES_FILE "CourseScores.dat" ProfileManager::ProfileManager() { @@ -35,22 +38,42 @@ ProfileManager::~ProfileManager() } -void ProfileManager::GetProfileNames( vector &asNamesOut ) +void ProfileManager::GetProfiles( vector &asNamesOut ) { // don't pick up the profile named "Machine" GetDirListing( PROFILES_DIR "0*", asNamesOut, true, false ); } +void ProfileManager::GetProfileDisplayNames( vector &asNamesOut ) +{ + CStringArray vsProfiles; + GetProfiles( vsProfiles ); + for( unsigned i=0; i vsProfiles; + GetProfiles( vsProfiles ); + + return find(vsProfiles.begin(), vsProfiles.end(), sProfile) != vsProfiles.end(); +} + + void ProfileManager::TryLoadProfile( PlayerNumber pn ) { CString sProfile = PREFSMAN->m_sDefaultProfile[pn]; if( sProfile.empty() ) return; - vector vsProfiles; - GetProfileNames( vsProfiles ); - - if( find(vsProfiles.begin(), vsProfiles.end(), "sProfile") == vsProfiles.end() ) + if( !DoesProfileExist(sProfile) ) { LOG->Warn( "Default profile '%s' does not exist", sProfile.c_str() ); return; @@ -58,11 +81,14 @@ void ProfileManager::TryLoadProfile( PlayerNumber pn ) m_sProfileDir[pn] = PROFILES_DIR + sProfile + SLASH; - IniFile ini( m_sProfileDir[pn]+PROFILE_FILE ); - ini.ReadFile(); + m_Profile[pn].LoadFromIni( m_sProfileDir[pn]+PROFILE_FILE ); - m_sDisplayName[pn] = ssprintf("No Name"); - ini.GetValue( "Profile", "DisplayName", m_sDisplayName[pn] ); + + // + // Load scores into SONGMAN + // + SONGMAN->ReadNoteScoresFromFile( m_sProfileDir[pn]+NOTES_SCORES_FILE, (MemoryCard)pn ); + SONGMAN->ReadCourseScoresFromFile( m_sProfileDir[pn]+COURSE_SCORES_FILE, (MemoryCard)pn ); } void ProfileManager::UnloadProfile( PlayerNumber pn ) @@ -70,9 +96,79 @@ void ProfileManager::UnloadProfile( PlayerNumber pn ) if( m_sProfileDir[pn].empty() ) return; - IniFile ini( m_sProfileDir[pn]+PROFILE_FILE ); + m_Profile[pn].WriteToIni( m_sProfileDir[pn]+PROFILE_FILE ); - ini.SetValue( "Profile", "DisplayName", m_sDisplayName[pn] ); - - ini.WriteFile(); + // + // Save scores into SONGMAN + // + SONGMAN->SaveNoteScoresToFile( m_sProfileDir[pn]+NOTES_SCORES_FILE, (MemoryCard)pn ); + SONGMAN->SaveCourseScoresToFile( m_sProfileDir[pn]+COURSE_SCORES_FILE, (MemoryCard)pn ); +} + +CString ProfileManager::GetDisplayName( PlayerNumber pn ) +{ + ASSERT(!m_sProfileDir[pn].empty()); + return m_Profile[pn].m_sDisplayName; +} + +bool Profile::LoadFromIni( CString sIniPath ) +{ + Init(); + + CString sDir, sFName, sExt; + splitrelpath( sIniPath, sDir, sFName, sExt ); + + CStringArray asBits; + split( sDir, SLASH, asBits, true ); + CString sLastDir = asBits.back(); // this is a number name, e.g. "0000001" + + // Fill in a default value in case ini doesn't have it. + m_sDisplayName = ssprintf("Profile%d", atoi(sLastDir)); + + + // + // read ini + // + IniFile ini( sIniPath ); + if( !ini.ReadFile() ) + return false; + + ini.GetValue( "Profile", "DisplayName", m_sDisplayName ); + ini.GetValue( "Profile", "LastUsedHighScoreName", m_sLastUsedHighScoreName ); + return true; +} + +bool Profile::WriteToIni( CString sIniPath ) +{ + IniFile ini( sIniPath ); + ini.SetValue( "Profile", "DisplayName", m_sDisplayName ); + ini.SetValue( "Profile", "LastUsedHighScoreName", m_sLastUsedHighScoreName ); + ini.WriteFile(); + return true; +} + +void ProfileManager::CreateProfile( CString sDisplayName ) +{ + // + // Find a free directory name in the profiles directory + // + CString sProfile, sDir; + for( int i=0; i<1000; i++ ) + { + sProfile = ssprintf("%08d",i); + sDir = PROFILES_DIR + sProfile; + if( !DoesFileExist(sDir) ) + break; + } + + + CreateDirectories( sDir ); + + sDir += SLASH; + + Profile pro; + pro.m_sDisplayName = sDisplayName; + pro.WriteToIni( sDir + PROFILE_FILE ); + + FlushDirCache(); } diff --git a/stepmania/src/ProfileManager.h b/stepmania/src/ProfileManager.h index 429d5e71c5..ab104b8bbf 100644 --- a/stepmania/src/ProfileManager.h +++ b/stepmania/src/ProfileManager.h @@ -15,18 +15,38 @@ #include "PlayerNumber.h" +struct Profile +{ + Profile() { Init(); } + void Init() + { + m_sDisplayName = ""; + m_sLastUsedHighScoreName = ""; + } + + bool LoadFromIni( CString sIniPath ); + bool WriteToIni( CString sIniPath ); + CString m_sDisplayName; + CString m_sLastUsedHighScoreName; +}; + class ProfileManager { public: ProfileManager(); ~ProfileManager(); - void GetProfileNames( vector &asNamesOut ); + void CreateProfile( CString sDisplayName ); + + bool DoesProfileExist( CString sProfile ); + + void GetProfiles( vector &asProfilesOut ); + void GetProfileDisplayNames( vector &asNamesOut ); void TryLoadProfile( PlayerNumber pn ); void UnloadProfile( PlayerNumber pn ); - CString sGetDisplayName( PlayerNumber pn ) { ASSERT(!m_sProfileDir[pn].empty()); return m_sProfileDir[pn]; } + CString GetDisplayName( PlayerNumber pn ); bool IsUsingProfile( PlayerNumber pn ) { return !m_sProfileDir[pn].empty(); } @@ -38,8 +58,7 @@ private: CString m_sProfileDir[NUM_PLAYERS]; bool m_bUsingMemoryCard[NUM_PLAYERS]; - // cached from profile.ini - CString m_sDisplayName[NUM_PLAYERS]; + Profile m_Profile[NUM_PLAYERS]; }; diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 59aed954b5..b3e5234e92 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -363,6 +363,11 @@ bool CreateDirectories( CString Path ) return true; } +bool Rename( const char *oldname, const char *newname ) +{ + return 0 == rename( oldname, newname ); +} + #if 0 void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs, bool bReturnPathToo ) { diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index dbe8da859d..ba7f45b5d9 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -201,6 +201,7 @@ CString join(const CString &Deliminator, const CStringArray& Source); CString GetCwd(); bool CreateDirectories( CString Path ); +bool Rename( const char *oldname, const char *newname ); void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs=false, bool bReturnPathToo=false ); unsigned int GetHashForString( CString s ); diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index d738d8b52b..793d2615c0 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -27,6 +27,7 @@ #include "BitmapText.h" #include "Quad.h" #include "RageTextureManager.h" +#include "ProfileManager.h" ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our program @@ -182,6 +183,8 @@ void ScreenSystemLayer::RefreshCreditsMessages() ASSERT(0); } + if( PROFILEMAN->IsUsingProfile((PlayerNumber)p) ) + sText += " " + PROFILEMAN->GetDisplayName((PlayerNumber)p); m_textCreditInfo[p].SetText( sText ); } } diff --git a/stepmania/src/ScreenProfileOptions.cpp b/stepmania/src/ScreenProfileOptions.cpp index 7aa3cb3a97..bbcebb8b64 100644 --- a/stepmania/src/ScreenProfileOptions.cpp +++ b/stepmania/src/ScreenProfileOptions.cpp @@ -25,6 +25,7 @@ enum { PO_PLAYER2, PO_CREATE_NEW, PO_DELETE_, + PO_RENAME_, NUM_GAMEPLAY_OPTIONS_LINES }; @@ -33,6 +34,7 @@ OptionRow g_ProfileOptionsLines[NUM_GAMEPLAY_OPTIONS_LINES] = { OptionRow( "Player2\nProfile", true ), OptionRow( "Create\nNew", true, "PRESS START" ), OptionRow( "Delete", true ), + OptionRow( "Rename", true ), }; ScreenProfileOptions::ScreenProfileOptions() : @@ -41,19 +43,20 @@ ScreenProfileOptions::ScreenProfileOptions() : LOG->Trace( "ScreenProfileOptions::ScreenProfileOptions()" ); g_ProfileOptionsLines[PO_PLAYER1].choices.clear(); - PROFILEMAN->GetProfileNames( g_ProfileOptionsLines[PO_PLAYER1].choices ); - if( g_ProfileOptionsLines[PO_PLAYER1].choices.empty() ) - g_ProfileOptionsLines[PO_PLAYER1].choices.push_back( "-NONE-" ); + g_ProfileOptionsLines[PO_PLAYER1].choices.push_back( "-NONE-" ); + PROFILEMAN->GetProfileDisplayNames( g_ProfileOptionsLines[PO_PLAYER1].choices ); g_ProfileOptionsLines[PO_PLAYER2].choices.clear(); - PROFILEMAN->GetProfileNames( g_ProfileOptionsLines[PO_PLAYER2].choices ); - if( g_ProfileOptionsLines[PO_PLAYER2].choices.empty() ) - g_ProfileOptionsLines[PO_PLAYER2].choices.push_back( "-NONE-" ); + g_ProfileOptionsLines[PO_PLAYER2].choices.push_back( "-NONE-" ); + PROFILEMAN->GetProfileDisplayNames( g_ProfileOptionsLines[PO_PLAYER2].choices ); g_ProfileOptionsLines[PO_DELETE_].choices.clear(); - PROFILEMAN->GetProfileNames( g_ProfileOptionsLines[PO_DELETE_].choices ); - if( g_ProfileOptionsLines[PO_DELETE_].choices.empty() ) - g_ProfileOptionsLines[PO_DELETE_].choices.push_back( "-NONE-" ); + g_ProfileOptionsLines[PO_DELETE_].choices.push_back( "-NONE-" ); + PROFILEMAN->GetProfileDisplayNames( g_ProfileOptionsLines[PO_DELETE_].choices ); + + g_ProfileOptionsLines[PO_RENAME_].choices.clear(); + g_ProfileOptionsLines[PO_RENAME_].choices.push_back( "-NONE-" ); + PROFILEMAN->GetProfileDisplayNames( g_ProfileOptionsLines[PO_RENAME_].choices ); Init( INPUTMODE_TOGETHER, @@ -67,27 +70,40 @@ ScreenProfileOptions::ScreenProfileOptions() : void ScreenProfileOptions::ImportOptions() { + vector vsProfiles; + PROFILEMAN->GetProfiles( vsProfiles ); + CStringArray::iterator iter; iter = find( - g_ProfileOptionsLines[PO_PLAYER1].choices.begin(), - g_ProfileOptionsLines[PO_PLAYER1].choices.end(), + vsProfiles.begin(), + vsProfiles.end(), PREFSMAN->m_sDefaultProfile[PLAYER_1] ); - if( iter != g_ProfileOptionsLines[PO_PLAYER1].choices.end() ) - m_iSelectedOption[0][PO_PLAYER1] = iter - g_ProfileOptionsLines[PO_PLAYER1].choices.begin(); + if( iter != vsProfiles.end() ) + m_iSelectedOption[0][PO_PLAYER1] = iter - vsProfiles.begin() + 1; iter = find( - g_ProfileOptionsLines[PO_PLAYER2].choices.begin(), - g_ProfileOptionsLines[PO_PLAYER2].choices.end(), - PREFSMAN->m_sDefaultProfile[PLAYER_2] ); - if( iter != g_ProfileOptionsLines[PO_PLAYER2].choices.end() ) - m_iSelectedOption[0][PO_PLAYER2] = iter - g_ProfileOptionsLines[PO_PLAYER2].choices.begin(); + vsProfiles.begin(), + vsProfiles.end(), + PREFSMAN->m_sDefaultProfile[PO_PLAYER2] ); + if( iter != vsProfiles.end() ) + m_iSelectedOption[0][PO_PLAYER2] = iter - vsProfiles.begin() + 1; } void ScreenProfileOptions::ExportOptions() { - PREFSMAN->m_sDefaultProfile[PLAYER_1] = g_ProfileOptionsLines[PO_PLAYER1].choices[m_iSelectedOption[0][PO_PLAYER1]]; - PREFSMAN->m_sDefaultProfile[PLAYER_2] = g_ProfileOptionsLines[PO_PLAYER2].choices[m_iSelectedOption[0][PO_PLAYER2]]; + vector vsProfiles; + PROFILEMAN->GetProfiles( vsProfiles ); + + if( m_iSelectedOption[0][PO_PLAYER1] > 0 ) + PREFSMAN->m_sDefaultProfile[PLAYER_1] = vsProfiles[m_iSelectedOption[0][PO_PLAYER1]-1]; + else + PREFSMAN->m_sDefaultProfile[PLAYER_1] = ""; + + if( m_iSelectedOption[0][PO_PLAYER2] > 0 ) + PREFSMAN->m_sDefaultProfile[PLAYER_2] = vsProfiles[m_iSelectedOption[0][PO_PLAYER2]-1]; + else + PREFSMAN->m_sDefaultProfile[PLAYER_2] = ""; } void ScreenProfileOptions::GoToPrevState() @@ -95,8 +111,49 @@ void ScreenProfileOptions::GoToPrevState() SCREENMAN->SetNewScreen( "ScreenOptionsMenu" ); } +void CreateProfile( CString sDisplayName ) +{ + PROFILEMAN->CreateProfile( sDisplayName ); + SCREENMAN->SetNewScreen( "ScreenProfileOptions" ); +} + void ScreenProfileOptions::GoToNextState() { PREFSMAN->SaveGlobalPrefsToDisk(); GoToPrevState(); } + +void ScreenProfileOptions::MenuStart( PlayerNumber pn ) +{ + vector vsProfiles; + PROFILEMAN->GetProfiles( vsProfiles ); + + switch( GetCurrentRow() ) + { + case PO_CREATE_NEW: + SCREENMAN->TextEntry( SM_None, "Enter a profile name", "", CreateProfile ); + return; + case PO_DELETE_: + { + CString sProfile; + if( m_iSelectedOption[0][PO_DELETE_] > 0 ) + sProfile = vsProfiles[m_iSelectedOption[0][PO_DELETE_]-1]; + else + sProfile = ""; + } + break; + case PO_RENAME_: + { + CString sProfile; + if( m_iSelectedOption[0][PO_RENAME_] > 0 ) + sProfile = vsProfiles[m_iSelectedOption[0][PO_RENAME_]-1]; + else + sProfile = ""; + +// SCREENMAN->TextEntry( SM_None, "Enter a profile name", "NewProfile", SetProfile ); + } + break; + default: + ScreenOptions::MenuStart( pn ); + } +} diff --git a/stepmania/src/ScreenProfileOptions.h b/stepmania/src/ScreenProfileOptions.h index ff06107696..2986725db3 100644 --- a/stepmania/src/ScreenProfileOptions.h +++ b/stepmania/src/ScreenProfileOptions.h @@ -16,6 +16,8 @@ class ScreenProfileOptions : public ScreenOptions public: ScreenProfileOptions(); + virtual void MenuStart( PlayerNumber pn ); + private: void ImportOptions(); void ExportOptions(); diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 848731206a..ebcb9a7620 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -34,6 +34,7 @@ #include "RageDisplay.h" #include "RageTextureManager.h" #include "Course.h" +#include "ProfileManager.h" const int NUM_SCORE_DIGITS = 9; @@ -886,8 +887,19 @@ void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn ) // m_BPMDisplay.BeginTweening( 0.2f ); // m_BPMDisplay.SetZoomY( 1.2f ); - if( pNotes && SONGMAN->IsUsingMemoryCard(pn) ) - m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, pNotes->m_MemCardScores[pn].iScore) ); + if( pNotes ) + { + int iScore; + if( PROFILEMAN->IsUsingProfile(pn) ) + iScore = pNotes->m_MemCardScores[pn].iScore; + else + iScore = pNotes->m_MemCardScores[MEMORY_CARD_MACHINE].iScore; + m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, iScore) ); + } + else + { + m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, 0) ); + } m_DifficultyIcon[pn].SetFromNotes( pn, pNotes ); if( pNotes && pNotes->IsAutogen() ) diff --git a/stepmania/src/ScreenTextEntry.cpp b/stepmania/src/ScreenTextEntry.cpp index 08ddbc83c4..47db9a1f32 100644 --- a/stepmania/src/ScreenTextEntry.cpp +++ b/stepmania/src/ScreenTextEntry.cpp @@ -56,8 +56,6 @@ ScreenTextEntry::ScreenTextEntry( ScreenMessage SM_SendWhenDone, CString sQuesti this->AddChild( &m_textQuestion ); m_rectAnswerBox.SetDiffuse( RageColor(0.5f,0.5f,1.0f,0.7f) ); - this->AddChild( &m_rectAnswerBox ); - m_rectAnswerBox.SetXY( ANSWER_X, ANSWER_Y ); m_rectAnswerBox.SetZoomX( ANSWER_WIDTH ); m_rectAnswerBox.SetZoomY( ANSWER_HEIGHT ); diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index d1395c8ff4..2c368e9211 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -1159,7 +1159,7 @@ void Song::RemoveAutoGenNotes() } -Grade Song::GetGradeForDifficulty( const StyleDef *st, PlayerNumber pn, Difficulty dc ) const +Grade Song::GetGradeForDifficulty( const StyleDef *st, MemoryCard card, Difficulty dc ) const { // return max grade of notes in difficulty class vector aNotes; @@ -1172,7 +1172,7 @@ Grade Song::GetGradeForDifficulty( const StyleDef *st, PlayerNumber pn, Difficul { const Steps* pNotes = aNotes[i]; if( pNotes->GetDifficulty() == dc ) - grade = max( grade, pNotes->m_MemCardScores[pn].grade ); + grade = max( grade, pNotes->m_MemCardScores[card].grade ); } return grade; } diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 685222f0d1..107c28c0b6 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -36,10 +36,10 @@ SongManager* SONGMAN = NULL; // global and accessable from anywhere in our progr #define SONGS_DIR BASE_PATH "Songs" SLASH #define COURSES_DIR BASE_PATH "Courses" SLASH #define STATS_PATH BASE_PATH "stats.html" -const CString CATEGORY_RANKING_FILE = BASE_PATH "Data" SLASH "CategoryRanking.dat"; -const CString COURSE_RANKING_FILE = BASE_PATH "Data" SLASH "CourseRanking.dat"; -const CString NOTES_SCORES_FILE[NUM_MEMORY_CARDS] = { BASE_PATH "Data" SLASH "Player1NotesScores.dat", BASE_PATH "Data" SLASH "Player2NotesScores.dat", BASE_PATH "Data" SLASH "MachineNotesScores.dat" }; -const CString COURSE_SCORES_FILE[NUM_MEMORY_CARDS] = { BASE_PATH "Data" SLASH "Player1CourseScores.dat", BASE_PATH "Data" SLASH "Player2CourseScores.dat", BASE_PATH "Data" SLASH "MachineCourseScores.dat" }; +const CString CATEGORY_RANKING_FILE = BASE_PATH "Data" SLASH "CategoryRanking.dat"; +const CString COURSE_RANKING_FILE = BASE_PATH "Data" SLASH "CourseRanking.dat"; +const CString MACHINE_NOTES_SCORES_FILE = "Data" SLASH "MachineNotesScores.dat"; +const CString MACHINE_COURSE_SCORES_FILE = "Data" SLASH "MachineCourseScores.dat"; const int CATEGORY_RANKING_VERSION = 1; const int COURSE_RANKING_VERSION = 1; const int NOTES_SCORES_VERSION = 2; @@ -122,11 +122,8 @@ void SongManager::SaveMachineScoresToDisk() { SaveCategoryRankingsToFile( CATEGORY_RANKING_FILE ); SaveCourseRankingsToFile( COURSE_RANKING_FILE ); - for( int c=0; c m_pSongs; // all songs that can be played diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 536301e989..198c759437 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -1,5 +1,5 @@ # Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# Microsoft Developer Studio Generated Build File, Format Version 60000 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Application" 0x0101 @@ -98,6 +98,10 @@ XBCP=xbecopy.exe # ADD BASE XBCP /NOLOGO # ADD XBCP /NOLOGO # Begin Special Build Tool +IntDir=.\Debug +TargetDir=\stepmania\stepmania +TargetName=default +SOURCE="$(InputPath)" PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -175,6 +179,10 @@ XBCP=xbecopy.exe # ADD BASE XBCP /NOLOGO # ADD XBCP /NOLOGO # Begin Special Build Tool +IntDir=.\StepMania___Xbox_Release +TargetDir=\stepmania\stepmania +TargetName=default +SOURCE="$(InputPath)" PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 879e35b159..fb5d704701 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -379,6 +379,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + + @@ -1831,6 +1837,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + + diff --git a/stepmania/src/song.h b/stepmania/src/song.h index ee38e33455..5289c6fa88 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -254,7 +254,7 @@ public: bool IsNew() const; bool IsEasy( StepsType nt ) const; bool HasEdits( StepsType nt ) const; - Grade GetGradeForDifficulty( const StyleDef *s, PlayerNumber pn, Difficulty dc ) const; + Grade GetGradeForDifficulty( const StyleDef *s, MemoryCard card, Difficulty dc ) const; bool NormallyDisplayed() const; bool RouletteDisplayed() const; int GetNumNotesWithGrade( Grade g ) const;