diff --git a/src/Player.cpp b/src/Player.cpp index 9bd6c79efe..fd3a2202e0 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -454,13 +454,19 @@ void Player::Init( FOREACH_CONST( TrailEntry, GAMESTATE->m_pCurTrail[pn]->m_vEntries, e ) { float fMaxForEntry; - e->pSong->m_SongTiming.GetActualBPM( fThrowAway, fMaxForEntry ); + if (M_MOD_HIGH_CAP > 0) + e->pSong->m_SongTiming.GetActualBPM( fThrowAway, fMaxForEntry, M_MOD_HIGH_CAP ); + else + e->pSong->m_SongTiming.GetActualBPM( fThrowAway, fMaxForEntry ); fMaxBPM = max( fMaxForEntry, fMaxBPM ); } } else { - GAMESTATE->m_pCurSong->m_SongTiming.GetActualBPM( fThrowAway, fMaxBPM ); + if (M_MOD_HIGH_CAP > 0) + GAMESTATE->m_pCurSong->m_SongTiming.GetActualBPM( fThrowAway, fMaxBPM, M_MOD_HIGH_CAP ); + else + GAMESTATE->m_pCurSong->m_SongTiming.GetActualBPM( fThrowAway, fMaxBPM ); } } diff --git a/src/TimingData.cpp b/src/TimingData.cpp index 5e1644b5fa..2c75c60614 100644 --- a/src/TimingData.cpp +++ b/src/TimingData.cpp @@ -20,14 +20,14 @@ TimingData::TimingData(float fOffset) : { } -void TimingData::GetActualBPM( float &fMinBPMOut, float &fMaxBPMOut ) const +void TimingData::GetActualBPM( float &fMinBPMOut, float &fMaxBPMOut, float highest ) const { fMinBPMOut = FLT_MAX; fMaxBPMOut = 0; FOREACH_CONST( BPMSegment, m_BPMSegments, seg ) { const float fBPM = seg->GetBPM(); - fMaxBPMOut = max( fBPM, fMaxBPMOut ); + fMaxBPMOut = clamp(max( fBPM, fMaxBPMOut ), 0, highest); fMinBPMOut = min( fBPM, fMinBPMOut ); } } diff --git a/src/TimingData.h b/src/TimingData.h index b8119b4913..a4b490e4cb 100644 --- a/src/TimingData.h +++ b/src/TimingData.h @@ -4,6 +4,7 @@ #include "NoteTypes.h" #include "TimingSegments.h" #include "PrefsManager.h" +#include // max float struct lua_State; /** @brief Compare a TimingData segment's properties with one another. */ @@ -24,11 +25,15 @@ public: * @param fOffset the offset from the 0th beat. */ TimingData(float fOffset); /** - * @brief Gets the actual BPM of the song. + * @brief Gets the actual BPM of the song, + * while respecting a limit. + * + * The high limit is due to the implementation of mMods. * @param fMinBPMOut the minimium specified BPM. * @param fMaxBPMOut the maximum specified BPM. + * @param highest the highest allowed max BPM. */ - void GetActualBPM( float &fMinBPMOut, float &fMaxBPMOut ) const; + void GetActualBPM( float &fMinBPMOut, float &fMaxBPMOut, float highest = FLT_MAX ) const; /** * @brief Retrieve the BPM at the given row. * @param iNoteRow the row in question.