use GradeWeight in grade calculation, not ScoreWeight
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "GameState.h"
|
||||
#include "Course.h"
|
||||
#include "Steps.h"
|
||||
#include "ScoreKeeperMAX2.h"
|
||||
|
||||
#define GRADE_PERCENT_TIER(i) THEME->GetMetricF("PlayerStageStats",ssprintf("GradePercent%s",GradeToString((Grade)i).c_str()))
|
||||
#define GRADE_TIER02_IS_ALL_PERFECTS THEME->GetMetricB("PlayerStageStats","GradeTier02IsAllPerfects")
|
||||
@@ -23,6 +24,7 @@ void PlayerStageStats::Init()
|
||||
bFailedEarlier = false;
|
||||
bGaveUp = false;
|
||||
iPossibleDancePoints = iCurPossibleDancePoints = iActualDancePoints = 0;
|
||||
iPossibleGradePoints = 0;
|
||||
iCurCombo = iMaxCombo = iCurMissCombo = iScore = iBonus = iMaxScore = iCurMaxScore = 0;
|
||||
iSongsPassed = iSongsPlayed = 0;
|
||||
iTotalError = 0;
|
||||
@@ -52,6 +54,7 @@ void PlayerStageStats::AddStats( const PlayerStageStats& other )
|
||||
iPossibleDancePoints += other.iPossibleDancePoints;
|
||||
iActualDancePoints += other.iActualDancePoints;
|
||||
iCurPossibleDancePoints += other.iCurPossibleDancePoints;
|
||||
iPossibleGradePoints += other.iPossibleGradePoints;
|
||||
|
||||
for( int t=0; t<NUM_TAP_NOTE_SCORES; t++ )
|
||||
iTapNoteScores[t] += other.iTapNoteScores[t];
|
||||
@@ -136,42 +139,20 @@ Grade PlayerStageStats::GetGrade() const
|
||||
float fActual = 0;
|
||||
FOREACH_TapNoteScore( tns )
|
||||
{
|
||||
int iTapScoreValue;
|
||||
switch( tns )
|
||||
{
|
||||
case TNS_NONE: iTapScoreValue = 0; break;
|
||||
case TNS_AVOIDED_MINE: iTapScoreValue = 0; break;
|
||||
case TNS_HIT_MINE: iTapScoreValue = PREFSMAN->m_iGradeWeightHitMine; break;
|
||||
case TNS_MISS: iTapScoreValue = PREFSMAN->m_iGradeWeightMiss; break;
|
||||
case TNS_BOO: iTapScoreValue = PREFSMAN->m_iGradeWeightBoo; break;
|
||||
case TNS_GOOD: iTapScoreValue = PREFSMAN->m_iGradeWeightGood; break;
|
||||
case TNS_GREAT: iTapScoreValue = PREFSMAN->m_iGradeWeightGreat; break;
|
||||
case TNS_PERFECT: iTapScoreValue = PREFSMAN->m_iGradeWeightPerfect; break;
|
||||
case TNS_MARVELOUS: iTapScoreValue = PREFSMAN->m_iGradeWeightMarvelous; break;
|
||||
default: FAIL_M( ssprintf("%i", tns) ); break;
|
||||
}
|
||||
if( PREFSMAN->m_bMercifulBeginner )
|
||||
iTapScoreValue = max( 0, iTapScoreValue );
|
||||
int iTapScoreValue = ScoreKeeperMAX2::TapNoteScoreToGradePoints( tns );
|
||||
fActual += iTapNoteScores[tns] * iTapScoreValue;
|
||||
}
|
||||
|
||||
FOREACH_HoldNoteScore( hns )
|
||||
{
|
||||
int iHoldScoreValue;
|
||||
switch( hns )
|
||||
{
|
||||
case HNS_NONE: iHoldScoreValue = 0; break;
|
||||
case HNS_NG: iHoldScoreValue = PREFSMAN->m_iGradeWeightNG; break;
|
||||
case HNS_OK: iHoldScoreValue = PREFSMAN->m_iGradeWeightOK; break;
|
||||
default: FAIL_M( ssprintf("%i", hns) ); break;
|
||||
}
|
||||
int iHoldScoreValue = ScoreKeeperMAX2::HoldNoteScoreToGradePoints( hns );
|
||||
fActual += iHoldNoteScores[hns] * iHoldScoreValue;
|
||||
}
|
||||
|
||||
LOG->Trace( "GetGrade: fActual: %f, fPossible: %d", fActual, iPossibleDancePoints );
|
||||
LOG->Trace( "GetGrade: fActual: %f, fPossible: %d", fActual, iPossibleGradePoints );
|
||||
|
||||
|
||||
float fPercent = (iPossibleDancePoints == 0) ? 0 : fActual / iPossibleDancePoints;
|
||||
float fPercent = (iPossibleGradePoints == 0) ? 0 : fActual / iPossibleGradePoints;
|
||||
|
||||
Grade grade = GetGradeFromPercent( fPercent );
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ struct PlayerStageStats
|
||||
int iPossibleDancePoints;
|
||||
int iCurPossibleDancePoints;
|
||||
int iActualDancePoints;
|
||||
int iPossibleGradePoints;
|
||||
int iTapNoteScores[NUM_TAP_NOTE_SCORES];
|
||||
int iHoldNoteScores[NUM_HOLD_NOTE_SCORES];
|
||||
int iCurCombo;
|
||||
|
||||
@@ -37,6 +37,7 @@ void ScoreKeeperMAX2::Load(
|
||||
// Fill in STATSMAN->m_CurStageStats, calculate multiplier
|
||||
//
|
||||
int iTotalPossibleDancePoints = 0;
|
||||
int iTotalPossibleGradePoints = 0;
|
||||
for( unsigned i=0; i<apSteps.size(); i++ )
|
||||
{
|
||||
Song* pSong = apSongs[i];
|
||||
@@ -74,9 +75,11 @@ void ScoreKeeperMAX2::Load(
|
||||
NoteDataUtil::CalculateRadarValues( nd, pSong->m_fMusicLengthSeconds, rvPost );
|
||||
|
||||
iTotalPossibleDancePoints += this->GetPossibleDancePoints( rvPre, rvPost );
|
||||
iTotalPossibleGradePoints += this->GetPossibleGradePoints( rvPre, rvPost );
|
||||
}
|
||||
|
||||
m_pPlayerStageStats->iPossibleDancePoints = iTotalPossibleDancePoints;
|
||||
m_pPlayerStageStats->iPossibleGradePoints = iTotalPossibleGradePoints;
|
||||
|
||||
m_iScoreRemainder = 0;
|
||||
m_iCurToastyCombo = 0;
|
||||
@@ -474,6 +477,31 @@ int ScoreKeeperMAX2::GetPossibleDancePoints( const RadarValues& fOriginalRadars,
|
||||
GetPossibleDancePoints(fPostRadars) );
|
||||
}
|
||||
|
||||
int ScoreKeeperMAX2::GetPossibleGradePoints( const RadarValues& radars )
|
||||
{
|
||||
/* Note that, if Marvelous timing is disabled or not active (not course mode),
|
||||
* PERFECT will be used instead. */
|
||||
|
||||
int NumTaps = int(radars[RADAR_NUM_TAPS_AND_HOLDS]);
|
||||
int NumHolds = int(radars[RADAR_NUM_HOLDS]);
|
||||
int NumRolls = int(radars[RADAR_NUM_ROLLS]);
|
||||
return
|
||||
NumTaps*TapNoteScoreToGradePoints(TNS_MARVELOUS)+
|
||||
NumHolds*HoldNoteScoreToGradePoints(HNS_OK) +
|
||||
NumRolls*HoldNoteScoreToGradePoints(HNS_OK);
|
||||
}
|
||||
|
||||
int ScoreKeeperMAX2::GetPossibleGradePoints( const RadarValues& fOriginalRadars, const RadarValues& fPostRadars )
|
||||
{
|
||||
/*
|
||||
* The logic here is that if you use a modifier that adds notes, you should have to
|
||||
* hit the new notes to get a high grade. However, if you use one that removes notes,
|
||||
* they should simply be counted as misses. */
|
||||
return max(
|
||||
GetPossibleGradePoints(fOriginalRadars),
|
||||
GetPossibleGradePoints(fPostRadars) );
|
||||
}
|
||||
|
||||
|
||||
int ScoreKeeperMAX2::TapNoteScoreToDancePoints( TapNoteScore tns )
|
||||
{
|
||||
@@ -502,13 +530,58 @@ int ScoreKeeperMAX2::TapNoteScoreToDancePoints( TapNoteScore tns )
|
||||
|
||||
int ScoreKeeperMAX2::HoldNoteScoreToDancePoints( HoldNoteScore hns )
|
||||
{
|
||||
int iWeight = 0;
|
||||
switch( hns )
|
||||
{
|
||||
case HNS_NONE: return 0;
|
||||
case HNS_NG: return PREFSMAN->m_iPercentScoreWeightNG;
|
||||
case HNS_OK: return PREFSMAN->m_iPercentScoreWeightOK;
|
||||
case HNS_NONE: iWeight = 0; break;
|
||||
case HNS_NG: iWeight = PREFSMAN->m_iPercentScoreWeightNG; break;
|
||||
case HNS_OK: iWeight = PREFSMAN->m_iPercentScoreWeightOK; break;
|
||||
default: FAIL_M( ssprintf("%i", hns) );
|
||||
}
|
||||
if( PREFSMAN->m_bMercifulBeginner )
|
||||
iWeight = max( 0, iWeight );
|
||||
return iWeight;
|
||||
}
|
||||
|
||||
int ScoreKeeperMAX2::TapNoteScoreToGradePoints( TapNoteScore tns )
|
||||
{
|
||||
if( !GAMESTATE->ShowMarvelous() && tns == TNS_MARVELOUS )
|
||||
tns = TNS_PERFECT;
|
||||
|
||||
/* This is used for Oni percentage displays. Grading values are currently in
|
||||
* StageStats::GetGrade. */
|
||||
int iWeight = 0;
|
||||
switch( tns )
|
||||
{
|
||||
case TNS_NONE: iWeight = 0;
|
||||
case TNS_AVOIDED_MINE: iWeight = 0;
|
||||
case TNS_HIT_MINE: iWeight = PREFSMAN->m_iGradeWeightHitMine; break;
|
||||
case TNS_MISS: iWeight = PREFSMAN->m_iGradeWeightMiss; break;
|
||||
case TNS_BOO: iWeight = PREFSMAN->m_iGradeWeightBoo; break;
|
||||
case TNS_GOOD: iWeight = PREFSMAN->m_iGradeWeightGood; break;
|
||||
case TNS_GREAT: iWeight = PREFSMAN->m_iGradeWeightGreat; break;
|
||||
case TNS_PERFECT: iWeight = PREFSMAN->m_iGradeWeightPerfect; break;
|
||||
case TNS_MARVELOUS: iWeight = PREFSMAN->m_iGradeWeightMarvelous;break;
|
||||
default: FAIL_M( ssprintf("%i", tns) );
|
||||
}
|
||||
if( PREFSMAN->m_bMercifulBeginner )
|
||||
iWeight = max( 0, iWeight );
|
||||
return iWeight;
|
||||
}
|
||||
|
||||
int ScoreKeeperMAX2::HoldNoteScoreToGradePoints( HoldNoteScore hns )
|
||||
{
|
||||
int iWeight = 0;
|
||||
switch( hns )
|
||||
{
|
||||
case HNS_NONE: iWeight = 0; break;
|
||||
case HNS_NG: iWeight = PREFSMAN->m_iGradeWeightNG; break;
|
||||
case HNS_OK: iWeight = PREFSMAN->m_iGradeWeightOK; break;
|
||||
default: FAIL_M( ssprintf("%i", hns) );
|
||||
}
|
||||
if( PREFSMAN->m_bMercifulBeginner )
|
||||
iWeight = max( 0, iWeight );
|
||||
return iWeight;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -52,11 +52,13 @@ public:
|
||||
// do it quickly.
|
||||
static int GetPossibleDancePoints( const RadarValues& fRadars );
|
||||
static int GetPossibleDancePoints( const RadarValues& fOriginalRadars, const RadarValues& fPostRadars );
|
||||
static int GetPossibleGradePoints( const RadarValues& fRadars );
|
||||
static int GetPossibleGradePoints( const RadarValues& fOriginalRadars, const RadarValues& fPostRadars );
|
||||
|
||||
private:
|
||||
static int TapNoteScoreToDancePoints( TapNoteScore tns );
|
||||
static int HoldNoteScoreToDancePoints( HoldNoteScore hns );
|
||||
|
||||
static int TapNoteScoreToGradePoints( TapNoteScore tns );
|
||||
static int HoldNoteScoreToGradePoints( HoldNoteScore hns );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user