Update of /cvsroot/stepmania/stepmania/src In directory sc8-pr-cvs1:/tmp/cvs-serv14610 Modified Files: Course.cpp Course.h GameState.cpp GameState.h ProfileManager.cpp ProfileManager.h ScreenNameEntryTraditional.cpp Steps.cpp Log Message: fix category feats show wrong score on ScreenNameEntryTraditional store both iScore and fPercentDP for courses and categories Index: Course.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/Course.cpp,v retrieving revision 1.164 retrieving revision 1.165 diff -u -d -p -r1.164 -r1.165 --- Course.cpp 10 Dec 2003 09:21:34 -0000 1.164 +++ Course.cpp 10 Dec 2003 11:35:34 -0000 1.165 @@ -36,6 +36,7 @@ const int DIFFICULT_METER_CHANGE = 2; /* Maximum lower value of ranges when difficult: */ const int MAX_BOTTOM_RANGE = 10; + /* -1 is the default parameter of a few Course calls; leaving it out indicates * to use GAMESTATE->m_bDifficultCourses. */ static bool IsDifficult( int Difficult ) @@ -1034,4 +1035,12 @@ void SortCoursePointerArrayByMostPlayed( course_sort_val[arrayCoursePointers[i]] = arrayCoursePointers[i]->GetNumTimesPlayed( card ); stable_sort( arrayCoursePointers.begin(), arrayCoursePointers.end(), CompareCoursePointersBySortValueDescending ); course_sort_val.clear(); +} + +bool Course::MemCardData::HighScore::operator>=( const HighScore& other ) const +{ + if( PREFSMAN->m_bPercentageScoring ) + return fPercentDP >= other.fPercentDP; + else + return iScore >= other.iScore; } Index: Course.h =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/Course.h,v retrieving revision 1.75 retrieving revision 1.76 diff -u -d -p -r1.75 -r1.76 --- Course.h 17 Nov 2003 03:17:29 -0000 1.75 +++ Course.h 10 Dec 2003 11:35:34 -0000 1.76 @@ -147,20 +147,19 @@ public: struct HighScore { + CString sName; int iScore; + float fPercentDP; float fSurviveTime; - CString sName; HighScore() { iScore = 0; + fPercentDP = 0; fSurviveTime = 0; } - bool operator>=( const HighScore& other ) const - { - return iScore >= other.iScore; - } + bool operator>=( const HighScore& other ) const; }; vector<HighScore> vHighScores; Index: GameState.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/GameState.cpp,v retrieving revision 1.212 retrieving revision 1.213 diff -u -d -p -r1.212 -r1.213 --- GameState.cpp 10 Dec 2003 09:44:16 -0000 1.212 +++ GameState.cpp 10 Dec 2003 11:35:34 -0000 1.213 @@ -1000,11 +1000,9 @@ void GameState::GetRankingFeats( PlayerN feat.Type = RankingFeats::SONG; feat.Feat = ssprintf("MR #%d in %s %s", j+1, pSong->GetTranslitMainTitle().c_str(), DifficultyToString(pSteps->GetDifficulty()).c_str() ); feat.pStringToFill = &vMachineHighScores[j].sName; - feat.g = vMachineHighScores[j].grade; - if( PREFSMAN->m_bPercentageScoring ) - feat.Score = vMachineHighScores[j].fPercentDP; - else - feat.Score = (float) vMachineHighScores[j].iScore; + feat.grade = vMachineHighScores[j].grade; + feat.fPercentDP = vMachineHighScores[j].fPercentDP; + feat.iScore = vMachineHighScores[j].iScore; if( pSong->HasBanner() ) feat.Banner = pSong->GetBannerPath(); @@ -1023,8 +1021,9 @@ void GameState::GetRankingFeats( PlayerN feat.Type = RankingFeats::SONG; feat.Feat = ssprintf("PR #%d in %s %s", j+1, pSong->GetTranslitMainTitle().c_str(), DifficultyToString(pSteps->GetDifficulty()).c_str() ); feat.pStringToFill = &vPersonalHighScores[j].sName; - feat.g = vPersonalHighScores[j].grade; - feat.Score = (float) vPersonalHighScores[j].iScore; + feat.grade = vPersonalHighScores[j].grade; + feat.fPercentDP = vMachineHighScores[j].fPercentDP; + feat.iScore = vMachineHighScores[j].iScore; // XXX: temporary hack if( pSong->HasBackground() ) @@ -1052,11 +1051,12 @@ void GameState::GetRankingFeats( PlayerN continue; RankingFeats feat; - feat.Type = RankingFeats::RANKING; + feat.Type = RankingFeats::CATEGORY; feat.Feat = ssprintf("MR #%d in Type %c (%d)", j+1, 'A'+i, stats.iMeter[pn] ); feat.pStringToFill = &vHighScores[j].sName; - feat.g = GRADE_NO_DATA; - feat.Score = (float) vHighScores[j].iScore; + feat.grade = GRADE_NO_DATA; + feat.iScore = (float) vHighScores[j].iScore; + feat.fPercentDP = (float) vHighScores[j].fPercentDP; asFeatsOut.push_back( feat ); } } @@ -1071,11 +1071,12 @@ void GameState::GetRankingFeats( PlayerN continue; RankingFeats feat; - feat.Type = RankingFeats::RANKING; + feat.Type = RankingFeats::CATEGORY; feat.Feat = ssprintf("PR #%d in Type %c (%d)", j+1, 'A'+i, stats.iMeter[pn] ); feat.pStringToFill = &vHighScores[j].sName; - feat.g = GRADE_NO_DATA; - feat.Score = (float) vHighScores[j].iScore; + feat.grade = GRADE_NO_DATA; + feat.iScore = (float) vHighScores[j].iScore; + feat.fPercentDP = (float) vHighScores[j].fPercentDP; asFeatsOut.push_back( feat ); } } @@ -1102,8 +1103,9 @@ void GameState::GetRankingFeats( PlayerN feat.Type = RankingFeats::COURSE; feat.Feat = ssprintf("No. %d in %s", i+1, pCourse->m_sName.c_str() ); feat.pStringToFill = &vHighScores[i].sName; - feat.g = GRADE_NO_DATA; - feat.Score = (float) vHighScores[i].iScore; + feat.grade = GRADE_NO_DATA; + feat.iScore = vHighScores[i].iScore; + feat.fPercentDP = vHighScores[i].fPercentDP; if( pCourse->HasBanner() ) feat.Banner = pCourse->m_sBannerPath; asFeatsOut.push_back( feat ); Index: GameState.h =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/GameState.h,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -p -r1.104 -r1.105 --- GameState.h 8 Dec 2003 04:02:42 -0000 1.104 +++ GameState.h 10 Dec 2003 11:35:34 -0000 1.105 @@ -247,10 +247,11 @@ public: // struct RankingFeats { - enum { SONG, COURSE, RANKING } Type; + enum { SONG, COURSE, CATEGORY } Type; - float Score; - Grade g; + Grade grade; + int iScore; + float fPercentDP; CString Banner; CString Feat; CString *pStringToFill; Index: ProfileManager.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ProfileManager.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -p -r1.40 -r1.41 --- ProfileManager.cpp 10 Dec 2003 10:30:53 -0000 1.40 +++ ProfileManager.cpp 10 Dec 2003 11:35:34 -0000 1.41 @@ -49,11 +49,11 @@ ProfileManager* PROFILEMAN = NULL; // gl #define USER_PROFILES_DIR "Data/LocalProfiles/" #define MACHINE_PROFILE_DIR "Data/MachineProfile/" -const int CATEGORY_RANKING_VERSION = 5; +const int CATEGORY_RANKING_VERSION = 6; const int SONG_SCORES_VERSION = 9; -const int COURSE_SCORES_VERSION = 7; +const int COURSE_SCORES_VERSION = 8; -#define STATS_TITLE THEME->GetMetric("ProfileManager","StatsTitle") +#define STATS_TITLE THEME->GetMetric("ProfileManager","StatsTitle") static const char *MemCardDirs[NUM_PLAYERS] = { @@ -547,11 +547,18 @@ void ProfileManager::ReadCategoryScoresF CString sName; if( !FileRead(f, sName) ) WARN_AND_RETURN; + int iScore; if( !FileRead(f, iScore) ) WARN_AND_RETURN; + + float fPercentDP; + 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; } } } @@ -624,6 +631,10 @@ void ProfileManager::ReadCourseScoresFro if( !FileRead(f, iScore) ) WARN_AND_RETURN; + float fPercentDP; + if( !FileRead(f, fPercentDP) ) + WARN_AND_RETURN; + float fSurviveTime; if( !FileRead(f, fSurviveTime) ) WARN_AND_RETURN; @@ -632,6 +643,7 @@ void ProfileManager::ReadCourseScoresFro { 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; } } @@ -754,6 +766,7 @@ void ProfileManager::SaveCategoryScoresT 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 ); } } } @@ -813,6 +826,7 @@ void ProfileManager::SaveCourseScoresToD 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 ); } } @@ -1332,4 +1346,12 @@ void ProfileManager::SaveStatsWebPageToD CString sStyleFile = THEME->GetPathToO("ProfileManager style.css"); CopyFile2( sStyleFile, sDir+STYLE_CSS_FILE ); +} + +bool ProfileManager::CategoryData::HighScore::operator>=( const HighScore& other ) const +{ + if( PREFSMAN->m_bPercentageScoring ) + return fPercentDP >= other.fPercentDP; + else + return iScore >= other.iScore; } Index: ProfileManager.h =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ProfileManager.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -p -r1.12 -r1.13 --- ProfileManager.h 9 Dec 2003 10:20:15 -0000 1.12 +++ ProfileManager.h 10 Dec 2003 11:35:34 -0000 1.13 @@ -98,18 +98,17 @@ public: { struct HighScore { - int iScore; CString sName; + int iScore; + float fPercentDP; HighScore() { iScore = 0; + fPercentDP = 0; } - bool operator>=( const HighScore& other ) const - { - return iScore >= other.iScore; - } + bool operator>=( const HighScore& other ) const; }; vector<HighScore> vHighScores; Index: ScreenNameEntryTraditional.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/ScreenNameEntryTraditional.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -p -r1.16 -r1.17 --- ScreenNameEntryTraditional.cpp 7 Dec 2003 07:09:13 -0000 1.16 +++ ScreenNameEntryTraditional.cpp 10 Dec 2003 11:35:34 -0000 1.17 @@ -227,26 +227,23 @@ ScreenNameEntryTraditional::ScreenNameEn this->AddChild( &m_sprBanner[p][i] ); } - if( feat.g != GRADE_NO_DATA ) + if( feat.grade != GRADE_NO_DATA ) { m_Grade[p][i].SetName( ssprintf("GradeP%i",p+1) ); m_Grade[p][i].Load( THEME->GetPathToG("ScreenNameEntryTraditional grades") ); - m_Grade[p][i].SetGrade( (PlayerNumber)p, feat.g ); + m_Grade[p][i].SetGrade( (PlayerNumber)p, feat.grade ); SET_ON( m_Grade[p][i] ); this->AddChild( &m_Grade[p][i] ); } - if( feat.Score != 0 ) - { - m_textScore[p][i].SetName( ssprintf("ScoreP%i",p+1) ); - m_textScore[p][i].LoadFromFont( THEME->GetPathToF("ScreenNameEntryTraditional score") ); - if( PREFSMAN->m_bPercentageScoring ) - m_textScore[p][i].SetText( ssprintf("%.2f%%", feat.Score*100) ); - else - m_textScore[p][i].SetText( ssprintf("%.0f", feat.Score) ); - SET_ON( m_textScore[p][i] ); - this->AddChild( &m_textScore[p][i] ); - } + m_textScore[p][i].SetName( ssprintf("ScoreP%i",p+1) ); + m_textScore[p][i].LoadFromFont( THEME->GetPathToF("ScreenNameEntryTraditional score") ); + if( PREFSMAN->m_bPercentageScoring ) + m_textScore[p][i].SetText( ssprintf("%.2f%%", feat.fPercentDP*100) ); + else + m_textScore[p][i].SetText( ssprintf("%.0f", feat.iScore) ); + SET_ON( m_textScore[p][i] ); + this->AddChild( &m_textScore[p][i] ); if( feat.Feat != "" ) { Index: Steps.cpp =================================================================== RCS file: /cvsroot/stepmania/stepmania/src/Steps.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -p -r1.23 -r1.24 --- Steps.cpp 9 Dec 2003 07:12:28 -0000 1.23 +++ Steps.cpp 10 Dec 2003 11:35:34 -0000 1.24 @@ -25,7 +25,7 @@ #include "GameManager.h" #include "NoteDataUtil.h" #include "ProfileManager.h" - +#include "PrefsManager.h" Steps::Steps() { @@ -349,7 +349,10 @@ void SortStepsByTypeAndDifficulty( vecto bool Steps::MemCardData::HighScore::operator>=( const Steps::MemCardData::HighScore& other ) const { - return iScore >= other.iScore; + if( PREFSMAN->m_bPercentageScoring ) + return fPercentDP >= other.fPercentDP; + else + return iScore >= other.iScore; /* Make sure we treat AAAA as higher than AAA, even though the score * is the same. * @@ -391,3 +394,4 @@ void Steps::AddHighScore( PlayerNumber p iPersonalIndexOut = -1; m_MemCardDatas[MEMORY_CARD_MACHINE].AddHighScore( hs, iMachineIndexOut ); } + |