grading error fixes, ranking calculation and display fixes, set default difficulty back to same level as 3.0 final

This commit is contained in:
Chris Danford
2003-02-03 05:53:59 +00:00
parent f34705a495
commit d12e090808
23 changed files with 182 additions and 113 deletions
+45 -2
View File
@@ -11,6 +11,9 @@
*/
#include "StageStats.h"
#include "GameState.h"
#include "RageLog.h"
StageStats::StageStats()
{
@@ -28,12 +31,12 @@ void StageStats::operator+=( const StageStats& other )
fAliveSeconds[p] += other.fAliveSeconds[p];
bFailed[p] |= other.bFailed[p];
iPossibleDancePoints[p] += other.iPossibleDancePoints[p];
iActualDancePoints[p] += other.iPossibleDancePoints[p];
iActualDancePoints[p] += other.iActualDancePoints[p];
for( int t=0; t<NUM_TAP_NOTE_SCORES; t++ )
iTapNoteScores[p][t] += other.iTapNoteScores[p][t];
for( int h=0; h<NUM_HOLD_NOTE_SCORES; h++ )
iHoldNoteScores[p][h] += iHoldNoteScores[p][h];
iHoldNoteScores[p][h] += other.iHoldNoteScores[p][h];
iMaxCombo[p] += other.iMaxCombo[p];
fScore[p] += other.fScore[p];
for( int r=0; r<NUM_RADAR_CATEGORIES; r++ )
@@ -46,3 +49,43 @@ void StageStats::operator+=( const StageStats& other )
}
}
Grade StageStats::GetGrade( PlayerNumber pn )
{
ASSERT( GAMESTATE->IsPlayerEnabled(pn) ); // should be calling this is player isn't joined!
if( bFailed[pn] )
return GRADE_E;
/* Based on the percentage of your total "Dance Points" to the maximum
* possible number, the following rank is assigned:
*
* 100% - AAA
* 93% - AA
* 80% - A
* 65% - B
* 45% - C
* Less - D
* Fail - E
*/
float fPercentDancePoints = iActualDancePoints[pn] / (float)iPossibleDancePoints[pn];
fPercentDancePoints = max( 0.f, fPercentDancePoints );
LOG->Trace( "iActualDancePoints: %i", iActualDancePoints[pn] );
LOG->Trace( "iPossibleDancePoints: %i", iPossibleDancePoints[pn] );
LOG->Trace( "fPercentDancePoints: %f", fPercentDancePoints );
// check for "AAAA"
if( iTapNoteScores[pn][TNS_MARVELOUS] > 0 &&
iTapNoteScores[pn][TNS_PERFECT] == 0 &&
iTapNoteScores[pn][TNS_GREAT] == 0 &&
iTapNoteScores[pn][TNS_GOOD] == 0 &&
iTapNoteScores[pn][TNS_BOO] == 0 &&
iTapNoteScores[pn][TNS_MISS] == 0 )
return GRADE_AAAA;
if ( fPercentDancePoints == 1.00 ) return GRADE_AAA;
else if( fPercentDancePoints >= 0.93 ) return GRADE_AA;
else if( fPercentDancePoints >= 0.80 ) return GRADE_A;
else if( fPercentDancePoints >= 0.65 ) return GRADE_B;
else if( fPercentDancePoints >= 0.45 ) return GRADE_C;
else return GRADE_D;
}