Simplify. Don't recalculate values; it'll break if the rules change elsewhere,
eg. to a change ScoreKeeper.
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "NoteDataWithScoring.h"
|
#include "NoteDataWithScoring.h"
|
||||||
|
#include "GameState.h"
|
||||||
|
|
||||||
NoteDataWithScoring::NoteDataWithScoring()
|
NoteDataWithScoring::NoteDataWithScoring()
|
||||||
{
|
{
|
||||||
@@ -28,35 +29,6 @@ void NoteDataWithScoring::Init()
|
|||||||
m_fHoldNoteLife.clear();
|
m_fHoldNoteLife.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int NoteDataWithScoring::GetMaxCombo() const
|
|
||||||
{
|
|
||||||
int iNumSuccessfulTapNotes = 0;
|
|
||||||
int fEndBeat = GetMaxBeat()+1;
|
|
||||||
|
|
||||||
unsigned iStartIndex = BeatToNoteRow( (float)0 );
|
|
||||||
unsigned iEndIndex = BeatToNoteRow( fEndBeat );
|
|
||||||
|
|
||||||
int combo = 0;
|
|
||||||
int maxcombo = 0;
|
|
||||||
|
|
||||||
for( unsigned i=iStartIndex; i<min(float(iEndIndex), float(m_TapNoteScores[0].size())); i++ )
|
|
||||||
{
|
|
||||||
for( int t=0; t<GetNumTracks(); t++ )
|
|
||||||
{
|
|
||||||
if( this->GetTapNote(t, i) != TAP_EMPTY )
|
|
||||||
if (GetTapNoteScore(t, i) >= TNS_GREAT)
|
|
||||||
combo++;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (combo > maxcombo) maxcombo = combo;
|
|
||||||
combo = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return max(combo, maxcombo);
|
|
||||||
}
|
|
||||||
|
|
||||||
int NoteDataWithScoring::GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat, float fEndBeat ) const
|
int NoteDataWithScoring::GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat, float fEndBeat ) const
|
||||||
{
|
{
|
||||||
int iNumSuccessfulTapNotes = 0;
|
int iNumSuccessfulTapNotes = 0;
|
||||||
@@ -89,7 +61,7 @@ int NoteDataWithScoring::GetNumDoublesWithScore( TapNoteScore tns, const float f
|
|||||||
unsigned iStartIndex = BeatToNoteRow( fStartBeat );
|
unsigned iStartIndex = BeatToNoteRow( fStartBeat );
|
||||||
unsigned iEndIndex = BeatToNoteRow( fEndBeat );
|
unsigned iEndIndex = BeatToNoteRow( fEndBeat );
|
||||||
|
|
||||||
for( unsigned i=iStartIndex; i<min(static_cast<float>(iEndIndex), static_cast<float>(m_TapNoteScores[0].size())); i++ )
|
for( unsigned i=iStartIndex; i<min(float(iEndIndex), float(m_TapNoteScores[0].size())); i++ )
|
||||||
{
|
{
|
||||||
int iNumNotesThisIndex = 0;
|
int iNumNotesThisIndex = 0;
|
||||||
TapNoteScore minTapNoteScore = TNS_MARVELOUS;
|
TapNoteScore minTapNoteScore = TNS_MARVELOUS;
|
||||||
@@ -178,20 +150,20 @@ TapNoteScore NoteDataWithScoring::LastTapNoteScore(unsigned row) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float NoteDataWithScoring::GetActualRadarValue( RadarCategory rv, float fSongSeconds ) const
|
float NoteDataWithScoring::GetActualRadarValue( RadarCategory rv, PlayerNumber pn, float fSongSeconds ) const
|
||||||
{
|
{
|
||||||
switch( rv )
|
switch( rv )
|
||||||
{
|
{
|
||||||
case RADAR_STREAM: return GetActualStreamRadarValue( fSongSeconds ); break;
|
case RADAR_STREAM: return GetActualStreamRadarValue( fSongSeconds, pn ); break;
|
||||||
case RADAR_VOLTAGE: return GetActualVoltageRadarValue( fSongSeconds ); break;
|
case RADAR_VOLTAGE: return GetActualVoltageRadarValue( fSongSeconds, pn ); break;
|
||||||
case RADAR_AIR: return GetActualAirRadarValue( fSongSeconds ); break;
|
case RADAR_AIR: return GetActualAirRadarValue( fSongSeconds, pn ); break;
|
||||||
case RADAR_FREEZE: return GetActualFreezeRadarValue( fSongSeconds ); break;
|
case RADAR_FREEZE: return GetActualFreezeRadarValue( fSongSeconds, pn ); break;
|
||||||
case RADAR_CHAOS: return GetActualChaosRadarValue( fSongSeconds ); break;
|
case RADAR_CHAOS: return GetActualChaosRadarValue( fSongSeconds, pn ); break;
|
||||||
default: ASSERT(0); return 0;
|
default: ASSERT(0); return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float NoteDataWithScoring::GetActualStreamRadarValue( float fSongSeconds ) const
|
float NoteDataWithScoring::GetActualStreamRadarValue( float fSongSeconds, PlayerNumber pn ) const
|
||||||
{
|
{
|
||||||
/* // density of steps
|
/* // density of steps
|
||||||
int iNumSuccessfulNotes =
|
int iNumSuccessfulNotes =
|
||||||
@@ -204,19 +176,19 @@ float NoteDataWithScoring::GetActualStreamRadarValue( float fSongSeconds ) const
|
|||||||
return min( fReturn, 1.0f );
|
return min( fReturn, 1.0f );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int MaxCombo = GetMaxCombo();
|
int MaxCombo = GAMESTATE->m_CurStageStats.iMaxCombo[pn];
|
||||||
float TotalSteps = GetNumTapNotes();
|
int TotalSteps = GetNumTapNotes();
|
||||||
|
|
||||||
return min( (float)MaxCombo/TotalSteps, 1.0f);
|
return min( (float)MaxCombo/TotalSteps, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
float NoteDataWithScoring::GetActualVoltageRadarValue( float fSongSeconds ) const
|
float NoteDataWithScoring::GetActualVoltageRadarValue( float fSongSeconds, PlayerNumber pn ) const
|
||||||
{
|
{
|
||||||
// voltage is essentialy perfects divided by # of steps
|
// voltage is essentialy perfects divided by # of steps
|
||||||
float totalnotes = GetNumTapNotes();
|
int totalnotes = GetNumTapNotes();
|
||||||
float perfects = GetNumTapNotesWithScore(TNS_PERFECT) + GetNumTapNotesWithScore(TNS_MARVELOUS);
|
int perfects = GetNumTapNotesWithScore(TNS_PERFECT) + GetNumTapNotesWithScore(TNS_MARVELOUS);
|
||||||
|
|
||||||
float result = perfects/totalnotes;
|
float result = float(perfects)/totalnotes;
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
/* float fAvgBPS = GetLastBeat() / fSongSeconds;
|
/* float fAvgBPS = GetLastBeat() / fSongSeconds;
|
||||||
@@ -243,7 +215,7 @@ float NoteDataWithScoring::GetActualVoltageRadarValue( float fSongSeconds ) cons
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
float NoteDataWithScoring::GetActualAirRadarValue( float fSongSeconds ) const
|
float NoteDataWithScoring::GetActualAirRadarValue( float fSongSeconds, PlayerNumber pn ) const
|
||||||
{
|
{
|
||||||
// number of doubles
|
// number of doubles
|
||||||
int iNumDoubles =
|
int iNumDoubles =
|
||||||
@@ -258,7 +230,7 @@ float NoteDataWithScoring::GetActualAirRadarValue( float fSongSeconds ) const
|
|||||||
return min( fReturn, 1.0f );
|
return min( fReturn, 1.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
float NoteDataWithScoring::GetActualChaosRadarValue( float fSongSeconds ) const
|
float NoteDataWithScoring::GetActualChaosRadarValue( float fSongSeconds, PlayerNumber pn ) const
|
||||||
{
|
{
|
||||||
/* // count number of triplets
|
/* // count number of triplets
|
||||||
int iNumChaosNotesCompleted = 0;
|
int iNumChaosNotesCompleted = 0;
|
||||||
@@ -272,32 +244,15 @@ float NoteDataWithScoring::GetActualChaosRadarValue( float fSongSeconds ) const
|
|||||||
return min( fReturn, 1.0f );
|
return min( fReturn, 1.0f );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
float marvelous = GetNumTapNotesWithScore(TNS_MARVELOUS);
|
int PossibleDP = GAMESTATE->m_CurStageStats.iPossibleDancePoints[pn];
|
||||||
float perfect = GetNumTapNotesWithScore(TNS_PERFECT);
|
int ActualDP = GAMESTATE->m_CurStageStats.iActualDancePoints[pn];
|
||||||
float great = GetNumTapNotesWithScore(TNS_GREAT);
|
|
||||||
float good = GetNumTapNotesWithScore(TNS_GOOD);
|
|
||||||
float boo = GetNumTapNotesWithScore(TNS_BOO);
|
|
||||||
float miss = GetNumTapNotesWithScore(TNS_MISS);
|
|
||||||
|
|
||||||
float ok = GetNumHoldNotesWithScore(HNS_OK);
|
float fResult = float(ActualDP)/PossibleDP;
|
||||||
float holdnotes = GetNumHoldNotes();
|
|
||||||
|
|
||||||
float DPEarned = 2 * (marvelous + perfect)
|
|
||||||
+ (great)
|
|
||||||
- 4 * (boo)
|
|
||||||
- 8 * (miss)
|
|
||||||
+ 6 * (ok);
|
|
||||||
|
|
||||||
float TotalDP = 2 * (marvelous + perfect + great
|
|
||||||
+ good + boo + miss)
|
|
||||||
+ 6 * holdnotes;
|
|
||||||
|
|
||||||
float fResult = DPEarned/TotalDP;
|
|
||||||
|
|
||||||
return min( fResult, 1.0f );
|
return min( fResult, 1.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
float NoteDataWithScoring::GetActualFreezeRadarValue( float fSongSeconds ) const
|
float NoteDataWithScoring::GetActualFreezeRadarValue( float fSongSeconds, PlayerNumber pn ) const
|
||||||
{
|
{
|
||||||
// number of hold steps
|
// number of hold steps
|
||||||
float totalsteps = (float)GetNumHoldNotes();
|
float totalsteps = (float)GetNumHoldNotes();
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
#include "NoteData.h"
|
#include "NoteData.h"
|
||||||
|
#include "PlayerNumber.h"
|
||||||
|
|
||||||
class NoteDataWithScoring : public NoteData
|
class NoteDataWithScoring : public NoteData
|
||||||
{
|
{
|
||||||
@@ -54,14 +55,14 @@ public:
|
|||||||
int LastTapNoteScoreTrack(unsigned row) const;
|
int LastTapNoteScoreTrack(unsigned row) const;
|
||||||
TapNoteScore LastTapNoteScore(unsigned row) const;
|
TapNoteScore LastTapNoteScore(unsigned row) const;
|
||||||
|
|
||||||
float GetActualRadarValue( RadarCategory rv, float fSongSeconds ) const;
|
float GetActualRadarValue( RadarCategory rv, PlayerNumber pn, float fSongSeconds ) const;
|
||||||
float GetActualStreamRadarValue( float fSongSeconds ) const;
|
|
||||||
float GetActualVoltageRadarValue( float fSongSeconds ) const;
|
|
||||||
float GetActualAirRadarValue( float fSongSeconds ) const;
|
|
||||||
float GetActualFreezeRadarValue( float fSongSeconds ) const;
|
|
||||||
float GetActualChaosRadarValue( float fSongSeconds ) const;
|
|
||||||
|
|
||||||
int GetMaxCombo() const; // used for groove radar calculations
|
private:
|
||||||
|
float GetActualStreamRadarValue( float fSongSeconds, PlayerNumber pn ) const;
|
||||||
|
float GetActualVoltageRadarValue( float fSongSeconds, PlayerNumber pn ) const;
|
||||||
|
float GetActualAirRadarValue( float fSongSeconds, PlayerNumber pn ) const;
|
||||||
|
float GetActualFreezeRadarValue( float fSongSeconds, PlayerNumber pn ) const;
|
||||||
|
float GetActualChaosRadarValue( float fSongSeconds, PlayerNumber pn ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1514,7 +1514,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
{
|
{
|
||||||
RadarCategory rc = (RadarCategory)r;
|
RadarCategory rc = (RadarCategory)r;
|
||||||
GAMESTATE->m_CurStageStats.fRadarPossible[p][r] = NoteDataUtil::GetRadarValue( m_Player[p], rc, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
|
GAMESTATE->m_CurStageStats.fRadarPossible[p][r] = NoteDataUtil::GetRadarValue( m_Player[p], rc, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
|
||||||
GAMESTATE->m_CurStageStats.fRadarActual[p][r] = m_Player[p].GetActualRadarValue( rc, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
|
GAMESTATE->m_CurStageStats.fRadarActual[p][r] = m_Player[p].GetActualRadarValue( rc, (PlayerNumber)p, GAMESTATE->m_pCurSong->m_fMusicLengthSeconds );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user