Rewrote the score calculation code, fixed a HACK.
This commit is contained in:
@@ -96,7 +96,9 @@ void GameState::Reset()
|
||||
for( s=0; s<NUM_HOLD_NOTE_SCORES; s++ )
|
||||
m_HoldNoteScores[p][s] = 0;
|
||||
m_iMaxCombo[p] = 0;
|
||||
m_lScore[p] = 0;
|
||||
m_fScore[p] = 0;
|
||||
|
||||
for( int r=0; r<NUM_RADAR_VALUES; r++ )
|
||||
{
|
||||
m_fRadarPossible[p][r] = 0;
|
||||
|
||||
@@ -101,6 +101,8 @@ public:
|
||||
int m_HoldNoteScores[NUM_PLAYERS][NUM_HOLD_NOTE_SCORES];
|
||||
int m_iMaxCombo[NUM_PLAYERS];
|
||||
float m_fScore[NUM_PLAYERS];
|
||||
long m_lScore[NUM_PLAYERS];
|
||||
float m_fScoreMultiplier;
|
||||
float m_fRadarPossible[NUM_PLAYERS][NUM_RADAR_VALUES]; // filled in by ScreenGameplay on end of notes
|
||||
float m_fRadarActual[NUM_PLAYERS][NUM_RADAR_VALUES]; // filled in by ScreenGameplay on end of notes
|
||||
|
||||
|
||||
+13
-32
@@ -576,7 +576,6 @@ void Player::CrossedRow( int iNoteRow )
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Player::HandleNoteScore( TapNoteScore score, int iNumTapsInRow )
|
||||
{
|
||||
ASSERT( iNumTapsInRow >= 1 );
|
||||
@@ -620,47 +619,29 @@ void Player::HandleNoteScore( TapNoteScore score, int iNumTapsInRow )
|
||||
//Remember this is just the score for the step, not the cumulative score up to the 57th step. Also, please note that I am currently checking into rounding errors with the system and if there are any, how they are resolved in the system.
|
||||
//
|
||||
//Note: if you got all Perfect on this song, you would get (p=10)*B, which is 80,000,000. In fact, the maximum possible score for any song is the number of feet difficulty X 10,000,000.
|
||||
|
||||
float& fScore = GAMESTATE->m_fScore[m_PlayerNumber];
|
||||
ASSERT( fScore >= 0 );
|
||||
|
||||
|
||||
//3dfsux:
|
||||
//I redid this code so it will store the score as a long, then correct the score for each song based on that value.
|
||||
// lScore == p * n
|
||||
// m_fScoreMultiplier = (B/S)
|
||||
// keeping these seperate for as long as possible improves accuracy.
|
||||
long &lScore = GAMESTATE->m_lScore[m_PlayerNumber];
|
||||
int p; // score multiplier
|
||||
|
||||
switch( score )
|
||||
{
|
||||
case TNS_PERFECT: p = 10; break;
|
||||
case TNS_GREAT: p = 5; break;
|
||||
default: p = 0; break;
|
||||
}
|
||||
|
||||
|
||||
for( int i=0; i<iNumTapsInRow; i++ )
|
||||
{
|
||||
|
||||
int N = m_iNumTapNotes;
|
||||
int n = m_iTapNotesHit+1;
|
||||
int B = m_iMeter * 1000000;
|
||||
float S = (1+N)*N/2.0f;
|
||||
|
||||
// printf( "m_iNumTapNotes %d, m_iTapNotesHit %d\n", m_iNumTapNotes, m_iTapNotesHit );
|
||||
|
||||
float one_step_score = p * (B/S) * n;
|
||||
|
||||
fScore += one_step_score;
|
||||
|
||||
m_iTapNotesHit++;
|
||||
}
|
||||
|
||||
ASSERT( m_iTapNotesHit <= m_iNumTapNotes );
|
||||
|
||||
// HACK: Correct for rounding errors that cause a 100% perfect score to be slightly off
|
||||
if( m_iTapNotesHit == m_iNumTapNotes &&
|
||||
fabsf( fScore - froundf(fScore,1000000) ) < 50.0f ) // close to a multiple of 1,000,000
|
||||
fScore = froundf(fScore,1000000);
|
||||
|
||||
if( m_pScore )
|
||||
m_pScore->SetScore( fScore );
|
||||
lScore += p * ++m_iTapNotesHit;
|
||||
ASSERT(lScore > 0);
|
||||
if (m_pScore)
|
||||
m_pScore->SetScore(GAMESTATE->m_fScore[m_PlayerNumber] = lScore * GAMESTATE->m_fScoreMultiplier);
|
||||
}
|
||||
|
||||
|
||||
void Player::HandleNoteScore( HoldNoteScore score, TapNoteScore TapNoteScore )
|
||||
{
|
||||
// don't accumulate points if AutoPlay is on.
|
||||
|
||||
Reference in New Issue
Block a user