calculate grade with possible values from radarValues, not from judgement counts from attempted steps

This commit is contained in:
Chris Danford
2005-04-26 04:16:45 +00:00
parent e9c2c4678d
commit 534842c2da
9 changed files with 29 additions and 24 deletions
+1 -1
View File
@@ -522,7 +522,7 @@ void NoteDataUtil::LoadTransformedLights( const NoteData &in, NoteData &out, int
}
}
void NoteDataUtil::GetRadarValues( const NoteData &in, float fSongSeconds, RadarValues& out )
void NoteDataUtil::CalculateRadarValues( const NoteData &in, float fSongSeconds, RadarValues& out )
{
// The for loop and the assert are used to ensure that all fields of
// RadarValue get set in here.
+1 -1
View File
@@ -31,7 +31,7 @@ namespace NoteDataUtil
float GetFreezeRadarValue( const NoteData &in, float fSongSeconds );
float GetChaosRadarValue( const NoteData &in, float fSongSeconds );
void GetRadarValues( const NoteData &in, float fSongSeconds, RadarValues& out );
void CalculateRadarValues( const NoteData &in, float fSongSeconds, RadarValues& out );
void RemoveHoldNotes( NoteData &inout, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW );
void ChangeRollsToHolds( NoteData &in, int iStartIndex, int iEndIndex );
+1 -1
View File
@@ -51,7 +51,7 @@ void SMLoader::LoadFromSMTokens(
RadarValues v;
FOREACH_RadarCategory(rc)
v[rc] = strtof( saValues[rc], NULL );
out.SetRadarValues( v );
out.SetCachedRadarValues( v );
}
out.SetSMNoteData(sNoteData);
+13 -8
View File
@@ -9,6 +9,7 @@
#include <float.h>
#include "GameState.h"
#include "Course.h"
#include "Steps.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")
@@ -129,7 +130,14 @@ Grade PlayerStageStats::GetGrade() const
/* XXX: This entire calculation should be in ScoreKeeper, but final evaluation
* is tricky since at that point the ScoreKeepers no longer exist. */
float Possible = 0, Actual = 0;
float fPossible = 0;
FOREACH_CONST( Steps*, vpPossibleSteps, s )
{
fPossible += (*s)->GetRadarValues().m_Values.v.fNumTapsAndHolds * PREFSMAN->m_iGradeWeightMarvelous;
fPossible += (*s)->GetRadarValues().m_Values.v.fNumHolds * PREFSMAN->m_iGradeWeightOK;
}
float fActual = 0;
FOREACH_TapNoteScore( tns )
{
int iTapScoreValue;
@@ -146,9 +154,7 @@ Grade PlayerStageStats::GetGrade() const
case TNS_MARVELOUS: iTapScoreValue = PREFSMAN->m_iGradeWeightMarvelous; break;
default: FAIL_M( ssprintf("%i", tns) ); break;
}
Actual += iTapNoteScores[tns] * iTapScoreValue;
if( tns != TNS_HIT_MINE )
Possible += iTapNoteScores[tns] * PREFSMAN->m_iGradeWeightMarvelous;
fActual += iTapNoteScores[tns] * iTapScoreValue;
}
FOREACH_HoldNoteScore( hns )
@@ -161,14 +167,13 @@ Grade PlayerStageStats::GetGrade() const
case HNS_OK: iHoldScoreValue = PREFSMAN->m_iGradeWeightOK; break;
default: FAIL_M( ssprintf("%i", hns) ); break;
}
Actual += iHoldNoteScores[hns] * iHoldScoreValue;
Possible += iHoldNoteScores[hns] * PREFSMAN->m_iGradeWeightOK;
fActual += iHoldNoteScores[hns] * iHoldScoreValue;
}
LOG->Trace( "GetGrade: Actual: %f, Possible: %f", Actual, Possible );
LOG->Trace( "GetGrade: fActual: %f, fPossible: %f", fActual, fPossible );
float fPercent = (Possible == 0) ? 0 : Actual / Possible;
float fPercent = (fPossible == 0) ? 0 : fActual / fPossible;
Grade grade = GetGradeFromPercent( fPercent );
+2 -2
View File
@@ -60,7 +60,7 @@ void ScoreKeeperMAX2::Load(
*/
NoteDataUtil::TransformNoteData( nd, aa, pSteps->m_StepsType, pSong );
RadarValues rvPre;
NoteDataUtil::GetRadarValues( nd, pSong->m_fMusicLengthSeconds, rvPre );
NoteDataUtil::CalculateRadarValues( nd, pSong->m_fMusicLengthSeconds, rvPre );
/* Apply user transforms to find out how the notes will really look.
*
@@ -71,7 +71,7 @@ void ScoreKeeperMAX2::Load(
* mean moving the queues in ScreenGameplay to GameState ... */
NoteDataUtil::TransformNoteData( nd, m_pPlayerState->m_PlayerOptions, pSteps->m_StepsType );
RadarValues rvPost;
NoteDataUtil::GetRadarValues( nd, pSong->m_fMusicLengthSeconds, rvPost );
NoteDataUtil::CalculateRadarValues( nd, pSong->m_fMusicLengthSeconds, rvPost );
iTotalPossibleDancePoints += this->GetPossibleDancePoints( rvPre, rvPost );
}
+1 -1
View File
@@ -2145,7 +2145,7 @@ void ScreenGameplay::SongFinished()
* not for the percentages (RADAR_AIR). */
RadarValues v;
NoteDataUtil::GetRadarValues( m_Player[p].m_NoteData, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds, v );
NoteDataUtil::CalculateRadarValues( m_Player[p].m_NoteData, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds, v );
STATSMAN->m_CurStageStats.m_player[p].radarPossible += v;
NoteDataWithScoring::GetActualRadarValues( m_Player[p].m_NoteData, p, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds, v );
+5 -5
View File
@@ -153,7 +153,7 @@ void Steps::TidyUpData()
void Steps::CalculateRadarValues( float fMusicLengthSeconds )
{
m_RadarValues = RadarValues();
m_CachedRadarValues = RadarValues();
// If we're autogen, don't calculate values. GetRadarValues will take from our parent.
if( parent != NULL )
@@ -165,7 +165,7 @@ void Steps::CalculateRadarValues( float fMusicLengthSeconds )
NoteData tempNoteData;
this->GetNoteData( tempNoteData );
NoteDataUtil::GetRadarValues( tempNoteData, fMusicLengthSeconds, m_RadarValues );
NoteDataUtil::CalculateRadarValues( tempNoteData, fMusicLengthSeconds, m_CachedRadarValues );
}
void Steps::Decompress() const
@@ -270,7 +270,7 @@ void Steps::DeAutogen()
m_sDescription = Real()->m_sDescription;
m_Difficulty = Real()->m_Difficulty;
m_iMeter = Real()->m_iMeter;
m_RadarValues = Real()->m_RadarValues;
m_CachedRadarValues = Real()->m_CachedRadarValues;
parent = NULL;
@@ -347,10 +347,10 @@ void Steps::SetMeter(int meter)
m_iMeter = meter;
}
void Steps::SetRadarValues( const RadarValues& v )
void Steps::SetCachedRadarValues( const RadarValues& v )
{
DeAutogen();
m_RadarValues = v;
m_CachedRadarValues = v;
}
+3 -3
View File
@@ -38,7 +38,7 @@ public:
Difficulty GetDifficulty() const { return Real()->m_Difficulty; }
ProfileSlot GetLoadedFromProfile() const { return m_LoadedFromProfile; }
int GetMeter() const { return Real()->m_iMeter; }
const RadarValues& GetRadarValues() const { return Real()->m_RadarValues; }
const RadarValues& GetRadarValues() const { return Real()->m_CachedRadarValues; }
void SetFile( CString fn );
void SetSavedToDisk( bool b ) { m_bSavedToDisk = b; }
@@ -50,7 +50,7 @@ public:
void SetLoadedFromProfile( ProfileSlot slot ) { m_LoadedFromProfile = slot; }
void SetMeter(int meter);
void SetRadarValues( const RadarValues& v );
void SetCachedRadarValues( const RadarValues& v );
bool IsAutogen() const; // Was created by autogen?
float PredictMeter() const;
@@ -90,7 +90,7 @@ protected:
CString m_sDescription; // Step author, edit name, or something meaningful
Difficulty m_Difficulty; // difficulty classification
int m_iMeter; // difficulty rating from MIN_METER to MAX_METER
RadarValues m_RadarValues;
RadarValues m_CachedRadarValues;
};
#endif
+2 -2
View File
@@ -75,14 +75,14 @@ RadarValues Trail::GetRadarValues() const
NoteData nd;
pSteps->GetNoteData( nd );
RadarValues rv_orig;
NoteDataUtil::GetRadarValues( nd, e->pSong->m_fMusicLengthSeconds, rv_orig );
NoteDataUtil::CalculateRadarValues( nd, e->pSong->m_fMusicLengthSeconds, rv_orig );
PlayerOptions po;
po.FromString( e->Modifiers );
if( po.ContainsTransformOrTurn() )
NoteDataUtil::TransformNoteData( nd, po, pSteps->m_StepsType );
NoteDataUtil::TransformNoteData( nd, e->Attacks, pSteps->m_StepsType, e->pSong );
RadarValues transformed_rv;
NoteDataUtil::GetRadarValues( nd, e->pSong->m_fMusicLengthSeconds, transformed_rv );
NoteDataUtil::CalculateRadarValues( nd, e->pSong->m_fMusicLengthSeconds, transformed_rv );
rv += transformed_rv;
}
else