diff --git a/stepmania/src/ArrowEffects.cpp b/stepmania/src/ArrowEffects.cpp index 1daebb5930..c04a61a850 100644 --- a/stepmania/src/ArrowEffects.cpp +++ b/stepmania/src/ArrowEffects.cpp @@ -134,7 +134,7 @@ void ArrowEffects::Update() fAccelTime /= fDiv; fTotalTime /= fDiv; - float fBeat = GAMESTATE->m_fSongBeat + fAccelTime; + float fBeat = GAMESTATE->m_fSongBeatVisible + fAccelTime; fBeat /= fDiv; const bool bEvenBeat = ( int(fBeat) % 2 ) != 0; @@ -182,7 +182,7 @@ float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float * entirely time spacing (respectively). Occasionally, we tween between them. */ if( pPlayerState->m_PlayerOptions.GetCurrent().m_fTimeSpacing != 1.0f ) { - float fSongBeat = GAMESTATE->m_fSongBeat; + float fSongBeat = GAMESTATE->m_fSongBeatVisible; float fBeatsUntilStep = fNoteBeat - fSongBeat; float fYOffsetBeatSpacing = fBeatsUntilStep; fYOffset += fYOffsetBeatSpacing * (1-pPlayerState->m_PlayerOptions.GetCurrent().m_fTimeSpacing); @@ -190,7 +190,7 @@ float ArrowEffects::GetYOffset( const PlayerState* pPlayerState, int iCol, float if( pPlayerState->m_PlayerOptions.GetCurrent().m_fTimeSpacing != 0.0f ) { - float fSongSeconds = GAMESTATE->m_fMusicSeconds; + float fSongSeconds = GAMESTATE->m_fMusicSecondsVisible; float fNoteSeconds = GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat(fNoteBeat); float fSecondsUntilStep = fNoteSeconds - fSongSeconds; float fBPM = pPlayerState->m_PlayerOptions.GetCurrent().m_fScrollBPM; @@ -398,7 +398,7 @@ float ArrowEffects::GetRotation( const PlayerState* pPlayerState, float fNoteBea { if( pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects[PlayerOptions::EFFECT_DIZZY] != 0 ) { - const float fSongBeat = GAMESTATE->m_fSongBeat; + const float fSongBeat = GAMESTATE->m_fSongBeatVisible; float fDizzyRotation = fNoteBeat - fSongBeat; fDizzyRotation *= pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects[PlayerOptions::EFFECT_DIZZY]; fDizzyRotation = fmodf( fDizzyRotation, 2*PI ); @@ -553,7 +553,7 @@ float ArrowEffects::GetBrightness( const PlayerState* pPlayerState, float fNoteB if( GAMESTATE->IsEditing() ) return 1; - float fSongBeat = GAMESTATE->m_fSongBeat; + float fSongBeat = GAMESTATE->m_fSongBeatVisible; float fBeatsUntilStep = fNoteBeat - fSongBeat; float fBrightness = SCALE( fBeatsUntilStep, 0, -1, 1.f, 0.f ); diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index b4326aa33a..0cc58ebb1a 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -727,6 +727,8 @@ void GameState::ResetMusicStatistics() m_fSongBeatNoOffset = 0; m_fCurBPS = 10; m_bFreeze = false; + m_fMusicSecondsVisible = 0; + m_fSongBeatVisible = 0; Actor::SetBGMTime( 0, 0 ); @@ -785,6 +787,7 @@ void GameState::ResetStageStatistics() m_iStageSeed = rand(); } +static Preference g_fVisualDelaySeconds( "VisualDelaySeconds", 0.0f ); void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &timing, const RageTimer ×tamp ) { if( !timestamp.IsZero() ) @@ -799,7 +802,12 @@ void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &ti m_fSongBeatNoOffset = timing.GetBeatFromElapsedTimeNoOffset( fPositionSeconds ); Actor::SetBGMTime( fPositionSeconds, m_fSongBeatNoOffset ); - + + m_fMusicSecondsVisible = fPositionSeconds - g_fVisualDelaySeconds.Get(); + float fThrowAway; + bool bThrowAway; + timing.GetBeatAndBPSFromElapsedTime( m_fMusicSecondsVisible, m_fSongBeatVisible, fThrowAway, bThrowAway ); + // LOG->Trace( "m_fMusicSeconds = %f, m_fSongBeat = %f, m_fCurBPS = %f, m_bFreeze = %f", m_fMusicSeconds, m_fSongBeat, m_fCurBPS, m_bFreeze ); } diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 1f6315652b..02cdf80558 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -172,6 +172,9 @@ public: RageTimer m_LastBeatUpdate; // time of last m_fSongBeat, etc. update BroadcastOnChange m_bGameplayLeadIn; + float m_fMusicSecondsVisible; + float m_fSongBeatVisible; + void GetAllUsedNoteSkins( vector &out ) const; static const float MUSIC_SECONDS_INVALID;