From 2b9982f50567e261933e6842fe8517aed1b39e65 Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Thu, 8 May 2014 03:07:02 -0600 Subject: [PATCH] Added Mmod compensation to ArrowEffects::GetYOffset. --- src/ArrowEffects.cpp | 12 ++++++++---- src/Player.cpp | 7 ++----- src/PlayerOptions.cpp | 3 +-- src/PlayerState.h | 3 +++ 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/ArrowEffects.cpp b/src/ArrowEffects.cpp index dd621bbee8..8c99cf9701 100644 --- a/src/ArrowEffects.cpp +++ b/src/ArrowEffects.cpp @@ -282,10 +282,17 @@ float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float // TODO: If we allow noteskins to have metricable row spacing // (per issue 24), edit this to reflect that. -aj fYOffset *= ARROW_SPACING; + + // Factor in scroll speed + float fScrollSpeed = pPlayerState->m_PlayerOptions.GetCurrent().m_fScrollSpeed; + if(pPlayerState->m_PlayerOptions.GetCurrent().m_fMaxScrollBPM != 0) + { + fScrollSpeed= pPlayerState->m_PlayerOptions.GetCurrent().m_fMaxScrollBPM / pPlayerState->m_fReadBPM; + } // don't mess with the arrows after they've crossed 0 if( fYOffset < 0 ) - return fYOffset * pPlayerState->m_PlayerOptions.GetCurrent().m_fScrollSpeed; + return fYOffset * fScrollSpeed; const float* fAccels = pPlayerState->m_PlayerOptions.GetCurrent().m_fAccels; //const float* fEffects = pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; @@ -326,9 +333,6 @@ float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float fYOffset = (-1*fYOffset*fYOffset/SCREEN_HEIGHT) + 1.5f*fYOffset; } - // Factor in scroll speed - float fScrollSpeed = pPlayerState->m_PlayerOptions.GetCurrent().m_fScrollSpeed; - if( pPlayerState->m_PlayerOptions.GetCurrent().m_fRandomSpeed > 0 && !bAbsolute ) { // Generate a deterministically "random" speed for each arrow. diff --git a/src/Player.cpp b/src/Player.cpp index cd43a57840..99ac782828 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -402,7 +402,7 @@ void Player::Init( // calculate M-mod speed here, so we can adjust properly on a per-song basis. // XXX: can we find a better location for this? - if( m_pPlayerState->m_PlayerOptions.GetCurrent().m_fMaxScrollBPM != 0 ) + // Always calculate the reading bpm, to allow switching to an mmod mid-song. { DisplayBpms bpms; @@ -464,10 +464,7 @@ void Player::Init( } ASSERT( fMaxBPM > 0 ); - - // set an X-mod equal to Mnum / fMaxBPM (e.g. M600 with 150 becomes 4x) - PO_GROUP_ASSIGN(m_pPlayerState->m_PlayerOptions, ModsLevel_Preferred, m_fScrollSpeed, - m_pPlayerState->m_PlayerOptions.GetPreferred().m_fMaxScrollBPM / fMaxBPM); + m_pPlayerState->m_fReadBPM= fMaxBPM; } float fBalance = GameSoundManager::GetPlayerBalance( pn ); diff --git a/src/PlayerOptions.cpp b/src/PlayerOptions.cpp index cc354c3b95..c25ddb2672 100644 --- a/src/PlayerOptions.cpp +++ b/src/PlayerOptions.cpp @@ -66,7 +66,7 @@ void PlayerOptions::Approach( const PlayerOptions& other, float fDeltaSeconds ) APPROACH( fTimeSpacing ); APPROACH( fScrollSpeed ); - //APPROACH( fMaxScrollBPM ); // if uncommented, causes crashes. -aj + APPROACH( fMaxScrollBPM ); fapproach( m_fScrollBPM, other.m_fScrollBPM, fDeltaSeconds * other.m_SpeedfScrollBPM*150 ); for( int i=0; i