floating-point scores
This commit is contained in:
@@ -178,7 +178,14 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName ) : Screen(sClassName)
|
||||
if( GAMESTATE->IsHumanPlayer(p) && GAMESTATE->m_SongOptions.m_bSaveScore )
|
||||
{
|
||||
if( GAMESTATE->m_pCurNotes[p] )
|
||||
GAMESTATE->m_pCurNotes[p]->AddScore( (PlayerNumber)p, grade[p], stageStats.iScore[p] + stageStats.iBonus[p], bNewRecord[p] );
|
||||
{
|
||||
float score;
|
||||
if( PREFSMAN->m_bPercentageScoring )
|
||||
score = stageStats.GetPercentDancePoints( (PlayerNumber)p );
|
||||
else
|
||||
score = float(stageStats.iScore[p] + stageStats.iBonus[p]);
|
||||
GAMESTATE->m_pCurNotes[p]->AddScore( (PlayerNumber)p, grade[p], score, bNewRecord[p] );
|
||||
}
|
||||
|
||||
// update unlock data if unlocks are on
|
||||
if ( PREFSMAN->m_bUseUnlockSystem )
|
||||
|
||||
@@ -900,12 +900,12 @@ void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn )
|
||||
|
||||
if( pNotes )
|
||||
{
|
||||
int iScore;
|
||||
float fScore;
|
||||
if( PROFILEMAN->IsUsingProfile(pn) )
|
||||
iScore = pNotes->m_MemCardScores[pn].iScore;
|
||||
fScore = pNotes->m_MemCardScores[pn].fScore;
|
||||
else
|
||||
iScore = pNotes->m_MemCardScores[MEMORY_CARD_MACHINE].iScore;
|
||||
m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, iScore) );
|
||||
fScore = pNotes->m_MemCardScores[MEMORY_CARD_MACHINE].fScore;
|
||||
m_textHighScore[pn].SetText( ssprintf("%*i", NUM_SCORE_DIGITS, (int) fScore) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -358,14 +358,14 @@ void SongManager::ReadNoteScoresFromFile( CString fn, int c )
|
||||
|
||||
int iNumTimesPlayed;
|
||||
Grade grade;
|
||||
int iScore;
|
||||
if( sscanf(line.c_str(), "%d %d %i\n", &iNumTimesPlayed, (int *)&grade, &iScore) != 3 )
|
||||
float fScore;
|
||||
if( sscanf(line.c_str(), "%d %d %f\n", &iNumTimesPlayed, (int *)&grade, &fScore) != 3 )
|
||||
break;
|
||||
if( pNotes )
|
||||
{
|
||||
pNotes->m_MemCardScores[c].iNumTimesPlayed = iNumTimesPlayed;
|
||||
pNotes->m_MemCardScores[c].grade = grade;
|
||||
pNotes->m_MemCardScores[c].iScore = iScore;
|
||||
pNotes->m_MemCardScores[c].fScore = fScore;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -550,10 +550,10 @@ void SongManager::ReadSM300NoteScores()
|
||||
|
||||
iRetVal = sscanf(
|
||||
value,
|
||||
"%d::%[^:]::%d::%d",
|
||||
"%d::%[^:]::%f::%d",
|
||||
&pNotes->m_MemCardScores[MEMORY_CARD_MACHINE].iNumTimesPlayed,
|
||||
szGradeLetters,
|
||||
&pNotes->m_MemCardScores[MEMORY_CARD_MACHINE].iScore,
|
||||
&pNotes->m_MemCardScores[MEMORY_CARD_MACHINE].fScore,
|
||||
&iMaxCombo
|
||||
);
|
||||
if( iRetVal != 4 )
|
||||
@@ -661,10 +661,10 @@ void SongManager::SaveNoteScoresToFile( CString fn, int c )
|
||||
pNotes->GetDifficulty(),
|
||||
pNotes->GetDescription().c_str() );
|
||||
|
||||
fprintf(fp, "%d %d %i\n",
|
||||
fprintf(fp, "%d %d %f\n",
|
||||
pNotes->m_MemCardScores[c].iNumTimesPlayed,
|
||||
pNotes->m_MemCardScores[c].grade,
|
||||
pNotes->m_MemCardScores[c].iScore);
|
||||
pNotes->m_MemCardScores[c].fScore);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ Steps::Steps()
|
||||
{
|
||||
m_MemCardScores[m].iNumTimesPlayed = 0;
|
||||
m_MemCardScores[m].grade = GRADE_NO_DATA;
|
||||
m_MemCardScores[m].iScore = 0;
|
||||
m_MemCardScores[m].fScore = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,32 +298,32 @@ void Steps::SetRadarValue(int r, float val)
|
||||
* XXX: Isn't it possible to beat the grade but not beat the score, since
|
||||
* grading and scores are on completely different systems? Should we be
|
||||
* checking for these completely separately? */
|
||||
bool Steps::MemCardScore::HigherScore( int vsScore, Grade vsGrade ) const
|
||||
bool Steps::MemCardScore::HigherScore( float vsScore, Grade vsGrade ) const
|
||||
{
|
||||
if( vsScore > this->iScore )
|
||||
if( vsScore > this->fScore )
|
||||
return true;
|
||||
if( vsScore < this->iScore )
|
||||
if( vsScore < this->fScore )
|
||||
return false;
|
||||
return vsGrade > this->grade;
|
||||
}
|
||||
|
||||
void Steps::AddScore( PlayerNumber pn, Grade grade, int iScore, bool& bNewRecordOut )
|
||||
void Steps::AddScore( PlayerNumber pn, Grade grade, float fScore, bool& bNewRecordOut )
|
||||
{
|
||||
bNewRecordOut = false;
|
||||
|
||||
m_MemCardScores[MEMORY_CARD_MACHINE].iNumTimesPlayed++;
|
||||
m_MemCardScores[pn].iNumTimesPlayed++;
|
||||
|
||||
if( m_MemCardScores[pn].HigherScore(iScore, grade) && iScore > 0)
|
||||
if( m_MemCardScores[pn].HigherScore(fScore, grade) && fScore > 0)
|
||||
{
|
||||
m_MemCardScores[pn].iScore = iScore;
|
||||
m_MemCardScores[pn].fScore = fScore;
|
||||
m_MemCardScores[pn].grade = grade;
|
||||
bNewRecordOut = true;
|
||||
}
|
||||
|
||||
if( m_MemCardScores[MEMORY_CARD_MACHINE].HigherScore(iScore, grade) )
|
||||
if( m_MemCardScores[MEMORY_CARD_MACHINE].HigherScore(fScore, grade) )
|
||||
{
|
||||
m_MemCardScores[MEMORY_CARD_MACHINE].iScore = iScore;
|
||||
m_MemCardScores[MEMORY_CARD_MACHINE].fScore = fScore;
|
||||
m_MemCardScores[MEMORY_CARD_MACHINE].grade = grade;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,11 +58,11 @@ public:
|
||||
{
|
||||
int iNumTimesPlayed;
|
||||
Grade grade;
|
||||
int iScore;
|
||||
bool HigherScore( int iScore, Grade grade ) const;
|
||||
float fScore;
|
||||
bool HigherScore( float fScore, Grade grade ) const;
|
||||
} m_MemCardScores[NUM_MEMORY_CARDS];
|
||||
|
||||
void AddScore( PlayerNumber pn, Grade grade, int iScore, bool& bNewRecordOut );
|
||||
void AddScore( PlayerNumber pn, Grade grade, float fScore, bool& bNewRecordOut );
|
||||
|
||||
|
||||
void TidyUpData();
|
||||
|
||||
Reference in New Issue
Block a user