fix category feats show wrong score on ScreenNameEntryTraditional
store both iScore and fPercentDP for courses and categories
This commit is contained in:
@@ -36,6 +36,7 @@ const int DIFFICULT_METER_CHANGE = 2;
|
|||||||
/* Maximum lower value of ranges when difficult: */
|
/* Maximum lower value of ranges when difficult: */
|
||||||
const int MAX_BOTTOM_RANGE = 10;
|
const int MAX_BOTTOM_RANGE = 10;
|
||||||
|
|
||||||
|
|
||||||
/* -1 is the default parameter of a few Course calls; leaving it out indicates
|
/* -1 is the default parameter of a few Course calls; leaving it out indicates
|
||||||
* to use GAMESTATE->m_bDifficultCourses. */
|
* to use GAMESTATE->m_bDifficultCourses. */
|
||||||
static bool IsDifficult( int Difficult )
|
static bool IsDifficult( int Difficult )
|
||||||
@@ -1035,3 +1036,11 @@ void SortCoursePointerArrayByMostPlayed( vector<Course*> &arrayCoursePointers, M
|
|||||||
stable_sort( arrayCoursePointers.begin(), arrayCoursePointers.end(), CompareCoursePointersBySortValueDescending );
|
stable_sort( arrayCoursePointers.begin(), arrayCoursePointers.end(), CompareCoursePointersBySortValueDescending );
|
||||||
course_sort_val.clear();
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -147,20 +147,19 @@ public:
|
|||||||
|
|
||||||
struct HighScore
|
struct HighScore
|
||||||
{
|
{
|
||||||
int iScore;
|
|
||||||
float fSurviveTime;
|
|
||||||
CString sName;
|
CString sName;
|
||||||
|
int iScore;
|
||||||
|
float fPercentDP;
|
||||||
|
float fSurviveTime;
|
||||||
|
|
||||||
HighScore()
|
HighScore()
|
||||||
{
|
{
|
||||||
iScore = 0;
|
iScore = 0;
|
||||||
|
fPercentDP = 0;
|
||||||
fSurviveTime = 0;
|
fSurviveTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator>=( const HighScore& other ) const
|
bool operator>=( const HighScore& other ) const;
|
||||||
{
|
|
||||||
return iScore >= other.iScore;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
vector<HighScore> vHighScores;
|
vector<HighScore> vHighScores;
|
||||||
|
|
||||||
|
|||||||
+17
-15
@@ -1000,11 +1000,9 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
|
|||||||
feat.Type = RankingFeats::SONG;
|
feat.Type = RankingFeats::SONG;
|
||||||
feat.Feat = ssprintf("MR #%d in %s %s", j+1, pSong->GetTranslitMainTitle().c_str(), DifficultyToString(pSteps->GetDifficulty()).c_str() );
|
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.pStringToFill = &vMachineHighScores[j].sName;
|
||||||
feat.g = vMachineHighScores[j].grade;
|
feat.grade = vMachineHighScores[j].grade;
|
||||||
if( PREFSMAN->m_bPercentageScoring )
|
feat.fPercentDP = vMachineHighScores[j].fPercentDP;
|
||||||
feat.Score = vMachineHighScores[j].fPercentDP;
|
feat.iScore = vMachineHighScores[j].iScore;
|
||||||
else
|
|
||||||
feat.Score = (float) vMachineHighScores[j].iScore;
|
|
||||||
|
|
||||||
if( pSong->HasBanner() )
|
if( pSong->HasBanner() )
|
||||||
feat.Banner = pSong->GetBannerPath();
|
feat.Banner = pSong->GetBannerPath();
|
||||||
@@ -1023,8 +1021,9 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
|
|||||||
feat.Type = RankingFeats::SONG;
|
feat.Type = RankingFeats::SONG;
|
||||||
feat.Feat = ssprintf("PR #%d in %s %s", j+1, pSong->GetTranslitMainTitle().c_str(), DifficultyToString(pSteps->GetDifficulty()).c_str() );
|
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.pStringToFill = &vPersonalHighScores[j].sName;
|
||||||
feat.g = vPersonalHighScores[j].grade;
|
feat.grade = vPersonalHighScores[j].grade;
|
||||||
feat.Score = (float) vPersonalHighScores[j].iScore;
|
feat.fPercentDP = vMachineHighScores[j].fPercentDP;
|
||||||
|
feat.iScore = vMachineHighScores[j].iScore;
|
||||||
|
|
||||||
// XXX: temporary hack
|
// XXX: temporary hack
|
||||||
if( pSong->HasBackground() )
|
if( pSong->HasBackground() )
|
||||||
@@ -1052,11 +1051,12 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
RankingFeats feat;
|
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.Feat = ssprintf("MR #%d in Type %c (%d)", j+1, 'A'+i, stats.iMeter[pn] );
|
||||||
feat.pStringToFill = &vHighScores[j].sName;
|
feat.pStringToFill = &vHighScores[j].sName;
|
||||||
feat.g = GRADE_NO_DATA;
|
feat.grade = GRADE_NO_DATA;
|
||||||
feat.Score = (float) vHighScores[j].iScore;
|
feat.iScore = (float) vHighScores[j].iScore;
|
||||||
|
feat.fPercentDP = (float) vHighScores[j].fPercentDP;
|
||||||
asFeatsOut.push_back( feat );
|
asFeatsOut.push_back( feat );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1071,11 +1071,12 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
RankingFeats feat;
|
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.Feat = ssprintf("PR #%d in Type %c (%d)", j+1, 'A'+i, stats.iMeter[pn] );
|
||||||
feat.pStringToFill = &vHighScores[j].sName;
|
feat.pStringToFill = &vHighScores[j].sName;
|
||||||
feat.g = GRADE_NO_DATA;
|
feat.grade = GRADE_NO_DATA;
|
||||||
feat.Score = (float) vHighScores[j].iScore;
|
feat.iScore = (float) vHighScores[j].iScore;
|
||||||
|
feat.fPercentDP = (float) vHighScores[j].fPercentDP;
|
||||||
asFeatsOut.push_back( feat );
|
asFeatsOut.push_back( feat );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1102,8 +1103,9 @@ void GameState::GetRankingFeats( PlayerNumber pn, vector<RankingFeats> &asFeatsO
|
|||||||
feat.Type = RankingFeats::COURSE;
|
feat.Type = RankingFeats::COURSE;
|
||||||
feat.Feat = ssprintf("No. %d in %s", i+1, pCourse->m_sName.c_str() );
|
feat.Feat = ssprintf("No. %d in %s", i+1, pCourse->m_sName.c_str() );
|
||||||
feat.pStringToFill = &vHighScores[i].sName;
|
feat.pStringToFill = &vHighScores[i].sName;
|
||||||
feat.g = GRADE_NO_DATA;
|
feat.grade = GRADE_NO_DATA;
|
||||||
feat.Score = (float) vHighScores[i].iScore;
|
feat.iScore = vHighScores[i].iScore;
|
||||||
|
feat.fPercentDP = vHighScores[i].fPercentDP;
|
||||||
if( pCourse->HasBanner() )
|
if( pCourse->HasBanner() )
|
||||||
feat.Banner = pCourse->m_sBannerPath;
|
feat.Banner = pCourse->m_sBannerPath;
|
||||||
asFeatsOut.push_back( feat );
|
asFeatsOut.push_back( feat );
|
||||||
|
|||||||
@@ -247,10 +247,11 @@ public:
|
|||||||
//
|
//
|
||||||
struct RankingFeats
|
struct RankingFeats
|
||||||
{
|
{
|
||||||
enum { SONG, COURSE, RANKING } Type;
|
enum { SONG, COURSE, CATEGORY } Type;
|
||||||
|
|
||||||
float Score;
|
Grade grade;
|
||||||
Grade g;
|
int iScore;
|
||||||
|
float fPercentDP;
|
||||||
CString Banner;
|
CString Banner;
|
||||||
CString Feat;
|
CString Feat;
|
||||||
CString *pStringToFill;
|
CString *pStringToFill;
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our
|
|||||||
#define USER_PROFILES_DIR "Data/LocalProfiles/"
|
#define USER_PROFILES_DIR "Data/LocalProfiles/"
|
||||||
#define MACHINE_PROFILE_DIR "Data/MachineProfile/"
|
#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 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")
|
||||||
|
|
||||||
@@ -547,11 +547,18 @@ void ProfileManager::ReadCategoryScoresFromDir( CString sDir, MemoryCard mc )
|
|||||||
CString sName;
|
CString sName;
|
||||||
if( !FileRead(f, sName) )
|
if( !FileRead(f, sName) )
|
||||||
WARN_AND_RETURN;
|
WARN_AND_RETURN;
|
||||||
|
|
||||||
int iScore;
|
int iScore;
|
||||||
if( !FileRead(f, iScore) )
|
if( !FileRead(f, iScore) )
|
||||||
WARN_AND_RETURN;
|
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].sName = sName;
|
||||||
m_CategoryDatas[mc][st][rc].vHighScores[l].iScore = iScore;
|
m_CategoryDatas[mc][st][rc].vHighScores[l].iScore = iScore;
|
||||||
|
m_CategoryDatas[mc][st][rc].vHighScores[l].fPercentDP = fPercentDP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -624,6 +631,10 @@ void ProfileManager::ReadCourseScoresFromDir( CString sDir, MemoryCard mc )
|
|||||||
if( !FileRead(f, iScore) )
|
if( !FileRead(f, iScore) )
|
||||||
WARN_AND_RETURN;
|
WARN_AND_RETURN;
|
||||||
|
|
||||||
|
float fPercentDP;
|
||||||
|
if( !FileRead(f, fPercentDP) )
|
||||||
|
WARN_AND_RETURN;
|
||||||
|
|
||||||
float fSurviveTime;
|
float fSurviveTime;
|
||||||
if( !FileRead(f, fSurviveTime) )
|
if( !FileRead(f, fSurviveTime) )
|
||||||
WARN_AND_RETURN;
|
WARN_AND_RETURN;
|
||||||
@@ -632,6 +643,7 @@ void ProfileManager::ReadCourseScoresFromDir( CString sDir, MemoryCard mc )
|
|||||||
{
|
{
|
||||||
pCourse->m_MemCardDatas[st][mc].vHighScores[l].sName = sName;
|
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].iScore = iScore;
|
||||||
|
pCourse->m_MemCardDatas[st][mc].vHighScores[l].fPercentDP = fPercentDP;
|
||||||
pCourse->m_MemCardDatas[st][mc].vHighScores[l].fSurviveTime = fSurviveTime;
|
pCourse->m_MemCardDatas[st][mc].vHighScores[l].fSurviveTime = fSurviveTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -754,6 +766,7 @@ void ProfileManager::SaveCategoryScoresToDir( CString sDir, MemoryCard mc )
|
|||||||
|
|
||||||
FileWrite( f, m_CategoryDatas[mc][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].iScore );
|
||||||
|
FileWrite( f, m_CategoryDatas[mc][st][rc].vHighScores[l].fPercentDP );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -813,6 +826,7 @@ void ProfileManager::SaveCourseScoresToDir( CString sDir, MemoryCard mc )
|
|||||||
|
|
||||||
FileWrite( f, pCourse->m_MemCardDatas[st][mc].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].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][mc].vHighScores[l].fSurviveTime );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1333,3 +1347,11 @@ void ProfileManager::SaveStatsWebPageToDir( CString sDir, MemoryCard mc )
|
|||||||
CopyFile2( sStyleFile, sDir+STYLE_CSS_FILE );
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -98,18 +98,17 @@ public:
|
|||||||
{
|
{
|
||||||
struct HighScore
|
struct HighScore
|
||||||
{
|
{
|
||||||
int iScore;
|
|
||||||
CString sName;
|
CString sName;
|
||||||
|
int iScore;
|
||||||
|
float fPercentDP;
|
||||||
|
|
||||||
HighScore()
|
HighScore()
|
||||||
{
|
{
|
||||||
iScore = 0;
|
iScore = 0;
|
||||||
|
fPercentDP = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator>=( const HighScore& other ) const
|
bool operator>=( const HighScore& other ) const;
|
||||||
{
|
|
||||||
return iScore >= other.iScore;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
vector<HighScore> vHighScores;
|
vector<HighScore> vHighScores;
|
||||||
|
|
||||||
|
|||||||
@@ -227,26 +227,23 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S
|
|||||||
this->AddChild( &m_sprBanner[p][i] );
|
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].SetName( ssprintf("GradeP%i",p+1) );
|
||||||
m_Grade[p][i].Load( THEME->GetPathToG("ScreenNameEntryTraditional grades") );
|
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] );
|
SET_ON( m_Grade[p][i] );
|
||||||
this->AddChild( &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].SetName( ssprintf("ScoreP%i",p+1) );
|
||||||
m_textScore[p][i].LoadFromFont( THEME->GetPathToF("ScreenNameEntryTraditional score") );
|
m_textScore[p][i].LoadFromFont( THEME->GetPathToF("ScreenNameEntryTraditional score") );
|
||||||
if( PREFSMAN->m_bPercentageScoring )
|
if( PREFSMAN->m_bPercentageScoring )
|
||||||
m_textScore[p][i].SetText( ssprintf("%.2f%%", feat.Score*100) );
|
m_textScore[p][i].SetText( ssprintf("%.2f%%", feat.fPercentDP*100) );
|
||||||
else
|
else
|
||||||
m_textScore[p][i].SetText( ssprintf("%.0f", feat.Score) );
|
m_textScore[p][i].SetText( ssprintf("%.0f", feat.iScore) );
|
||||||
SET_ON( m_textScore[p][i] );
|
SET_ON( m_textScore[p][i] );
|
||||||
this->AddChild( &m_textScore[p][i] );
|
this->AddChild( &m_textScore[p][i] );
|
||||||
}
|
|
||||||
|
|
||||||
if( feat.Feat != "" )
|
if( feat.Feat != "" )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include "GameManager.h"
|
#include "GameManager.h"
|
||||||
#include "NoteDataUtil.h"
|
#include "NoteDataUtil.h"
|
||||||
#include "ProfileManager.h"
|
#include "ProfileManager.h"
|
||||||
|
#include "PrefsManager.h"
|
||||||
|
|
||||||
Steps::Steps()
|
Steps::Steps()
|
||||||
{
|
{
|
||||||
@@ -349,6 +349,9 @@ void SortStepsByTypeAndDifficulty( vector<Steps*> &arraySongPointers )
|
|||||||
|
|
||||||
bool Steps::MemCardData::HighScore::operator>=( const Steps::MemCardData::HighScore& other ) const
|
bool Steps::MemCardData::HighScore::operator>=( const Steps::MemCardData::HighScore& other ) const
|
||||||
{
|
{
|
||||||
|
if( PREFSMAN->m_bPercentageScoring )
|
||||||
|
return fPercentDP >= other.fPercentDP;
|
||||||
|
else
|
||||||
return iScore >= other.iScore;
|
return iScore >= other.iScore;
|
||||||
/* Make sure we treat AAAA as higher than AAA, even though the score
|
/* Make sure we treat AAAA as higher than AAA, even though the score
|
||||||
* is the same.
|
* is the same.
|
||||||
@@ -391,3 +394,4 @@ void Steps::AddHighScore( PlayerNumber pn, MemCardData::HighScore hs, int &iPers
|
|||||||
iPersonalIndexOut = -1;
|
iPersonalIndexOut = -1;
|
||||||
m_MemCardDatas[MEMORY_CARD_MACHINE].AddHighScore( hs, iMachineIndexOut );
|
m_MemCardDatas[MEMORY_CARD_MACHINE].AddHighScore( hs, iMachineIndexOut );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user