Cleanup, fix rare div/0 errors.
This commit is contained in:
@@ -190,21 +190,22 @@ float NoteDataWithScoring::GetActualStreamRadarValue( float fSongSeconds, Player
|
|||||||
return min( fReturn, 1.0f );
|
return min( fReturn, 1.0f );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int totalnotes = GetNumTapNotes();
|
int TotalSteps = GetNumTapNotes();
|
||||||
int perfects = GetNumTapNotesWithScore(TNS_PERFECT) + GetNumTapNotesWithScore(TNS_MARVELOUS);
|
if( !TotalSteps )
|
||||||
|
return 1;
|
||||||
float result = float(perfects)/totalnotes;
|
|
||||||
return result;
|
|
||||||
|
|
||||||
|
const int Perfects = GetNumTapNotesWithScore(TNS_PERFECT) + GetNumTapNotesWithScore(TNS_MARVELOUS);
|
||||||
|
return clamp( float(Perfects)/TotalSteps, 0.0f, 1.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
float NoteDataWithScoring::GetActualVoltageRadarValue( float fSongSeconds, PlayerNumber pn ) const
|
float NoteDataWithScoring::GetActualVoltageRadarValue( float fSongSeconds, PlayerNumber pn ) const
|
||||||
{
|
{
|
||||||
|
const int TotalSteps = GetNumTapNotes();
|
||||||
|
if( !TotalSteps )
|
||||||
|
return 1;
|
||||||
|
|
||||||
int MaxCombo = GAMESTATE->m_CurStageStats.iMaxCombo[pn];
|
const int MaxCombo = GAMESTATE->m_CurStageStats.iMaxCombo[pn];
|
||||||
int TotalSteps = GetNumTapNotes();
|
return clamp( (float)MaxCombo/TotalSteps, 0.0f, 1.0f );
|
||||||
|
|
||||||
return min( (float)MaxCombo/TotalSteps, 1.0f);
|
|
||||||
|
|
||||||
// voltage is essentialy perfects divided by # of steps
|
// voltage is essentialy perfects divided by # of steps
|
||||||
/* float fAvgBPS = GetLastBeat() / fSongSeconds;
|
/* float fAvgBPS = GetLastBeat() / fSongSeconds;
|
||||||
@@ -233,17 +234,16 @@ float NoteDataWithScoring::GetActualVoltageRadarValue( float fSongSeconds, Playe
|
|||||||
|
|
||||||
float NoteDataWithScoring::GetActualAirRadarValue( float fSongSeconds, PlayerNumber pn ) const
|
float NoteDataWithScoring::GetActualAirRadarValue( float fSongSeconds, PlayerNumber pn ) const
|
||||||
{
|
{
|
||||||
// number of doubles
|
|
||||||
int iNumDoubles =
|
|
||||||
GetNumDoublesWithScore(TNS_MARVELOUS) +
|
|
||||||
GetNumDoublesWithScore(TNS_PERFECT);
|
|
||||||
|
|
||||||
// float fReturn = iNumDoubles / fSongSeconds;
|
// float fReturn = iNumDoubles / fSongSeconds;
|
||||||
int iTotalDoubles = GetNumDoubles();
|
const int iTotalDoubles = GetNumDoubles();
|
||||||
|
if (iTotalDoubles == 0)
|
||||||
|
return 1; // no jumps in song
|
||||||
|
|
||||||
if (iTotalDoubles == 0) return 1.0f; // no jumps in song
|
// number of doubles
|
||||||
float fReturn = (float)iNumDoubles / iTotalDoubles;
|
const int iNumDoubles =
|
||||||
return min( fReturn, 1.0f );
|
GetNumDoublesWithScore(TNS_MARVELOUS) + GetNumDoublesWithScore(TNS_PERFECT);
|
||||||
|
|
||||||
|
return clamp( (float)iNumDoubles / iTotalDoubles, 0.0f, 1.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
float NoteDataWithScoring::GetActualChaosRadarValue( float fSongSeconds, PlayerNumber pn ) const
|
float NoteDataWithScoring::GetActualChaosRadarValue( float fSongSeconds, PlayerNumber pn ) const
|
||||||
@@ -260,21 +260,24 @@ float NoteDataWithScoring::GetActualChaosRadarValue( float fSongSeconds, PlayerN
|
|||||||
return min( fReturn, 1.0f );
|
return min( fReturn, 1.0f );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int PossibleDP = GAMESTATE->m_CurStageStats.iPossibleDancePoints[pn];
|
const int PossibleDP = GAMESTATE->m_CurStageStats.iPossibleDancePoints[pn];
|
||||||
int ActualDP = GAMESTATE->m_CurStageStats.iActualDancePoints[pn];
|
if ( PossibleDP == 0 )
|
||||||
|
return 1; // no jumps in song
|
||||||
|
|
||||||
float fResult = float(ActualDP)/PossibleDP;
|
const int ActualDP = GAMESTATE->m_CurStageStats.iActualDancePoints[pn];
|
||||||
|
return clamp( float(ActualDP)/PossibleDP, 0.0f, 1.0f );
|
||||||
return clamp( fResult, 0.0f, 1.0f );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float NoteDataWithScoring::GetActualFreezeRadarValue( float fSongSeconds, PlayerNumber pn ) const
|
float NoteDataWithScoring::GetActualFreezeRadarValue( float fSongSeconds, PlayerNumber pn ) const
|
||||||
{
|
{
|
||||||
// number of hold steps
|
// number of hold steps
|
||||||
float totalsteps = (float)GetNumHoldNotes();
|
const int TotalHolds = GetNumHoldNotes();
|
||||||
if (totalsteps == 0) return 1.0f;
|
if ( TotalHolds == 0 )
|
||||||
float fReturn = GetNumHoldNotesWithScore(HNS_OK) / totalsteps;
|
return 1.0f;
|
||||||
return min( fReturn, 1.0f );
|
|
||||||
|
const int ActualHolds = GetNumHoldNotesWithScore(HNS_OK);
|
||||||
|
|
||||||
|
return clamp( float(ActualHolds) / TotalHolds, 0.0f, 1.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
Reference in New Issue
Block a user