Deal with corner case.
The hardcoded 600 will soon become a metric.
This commit is contained in:
@@ -360,12 +360,17 @@ float DisplayBpms::GetMin() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
float DisplayBpms::GetMax() const
|
float DisplayBpms::GetMax() const
|
||||||
|
{
|
||||||
|
return this->GetMaxWithin();
|
||||||
|
}
|
||||||
|
|
||||||
|
float DisplayBpms::GetMaxWithin(float highest) const
|
||||||
{
|
{
|
||||||
float fMax = 0;
|
float fMax = 0;
|
||||||
FOREACH_CONST( float, vfBpms, f )
|
FOREACH_CONST( float, vfBpms, f )
|
||||||
{
|
{
|
||||||
if( *f != -1 )
|
if( *f != -1 )
|
||||||
fMax = max( fMax, *f );
|
fMax = clamp(max( fMax, *f ), 0, highest);
|
||||||
}
|
}
|
||||||
return fMax;
|
return fMax;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#define GAME_CONSTANTS_AND_TYPES_H
|
#define GAME_CONSTANTS_AND_TYPES_H
|
||||||
|
|
||||||
#include "EnumHelper.h"
|
#include "EnumHelper.h"
|
||||||
|
#include <float.h> // need the max for default.
|
||||||
|
|
||||||
// Note definitions
|
// Note definitions
|
||||||
/** @brief Define the mininum difficulty value allowed. */
|
/** @brief Define the mininum difficulty value allowed. */
|
||||||
@@ -513,6 +514,13 @@ struct DisplayBpms
|
|||||||
* @return the maximum BPM.
|
* @return the maximum BPM.
|
||||||
*/
|
*/
|
||||||
float GetMax() const;
|
float GetMax() const;
|
||||||
|
/**
|
||||||
|
* @brief Retrieve the maximum BPM of the set,
|
||||||
|
* but no higher than a certain value.
|
||||||
|
* @param highest the highest BPM to use.
|
||||||
|
* @return the maximum BPM.
|
||||||
|
*/
|
||||||
|
float GetMaxWithin(float highest = FLT_MAX) const;
|
||||||
/**
|
/**
|
||||||
* @brief Determine if the BPM is really constant.
|
* @brief Determine if the BPM is really constant.
|
||||||
* @return Whether the BPM is constant or not.
|
* @return Whether the BPM is constant or not.
|
||||||
|
|||||||
+1
-1
@@ -432,7 +432,7 @@ void Player::Init(
|
|||||||
// if the BPMs are < 0, reset and get the actual values.
|
// if the BPMs are < 0, reset and get the actual values.
|
||||||
if( !bpms.IsSecret() )
|
if( !bpms.IsSecret() )
|
||||||
{
|
{
|
||||||
fMaxBPM = bpms.GetMax();
|
fMaxBPM = bpms.GetMaxWithin(600);
|
||||||
fMaxBPM = max( 0, fMaxBPM );
|
fMaxBPM = max( 0, fMaxBPM );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user