From cded5dbac050bf96e29f6d022ddf48f1c367795a Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 14 Apr 2003 04:54:16 +0000 Subject: [PATCH] Scale background playback speed by song rate. This sync isn't very accurate though (because of inaccurate playback rate code in sound library?) --- stepmania/NEWS | 4 ++++ stepmania/src/BGAnimationLayer.cpp | 6 ++++++ stepmania/src/BGAnimationLayer.h | 1 + stepmania/src/Background.cpp | 3 +++ 4 files changed, 14 insertions(+) diff --git a/stepmania/NEWS b/stepmania/NEWS index 3856252d0d..e36ef26b95 100644 --- a/stepmania/NEWS +++ b/stepmania/NEWS @@ -44,6 +44,10 @@ NEW FEATURE: Courses can be organized into group folders. See README-FIRST.html for details. NEW FEATURE: Switch current theme from TitleMenu with L,L,L,R,R,R,L,R. NEW FEATURE: Switch current announcer from TitleMenu with L,L,R,R,L,R,L,R. +NEW FEATURE: New parameters for background changes: rate, fade old, loop, + rewind. +CHANGE: Background playback speed scaled by song rate, so movies stay in + sync (although syncing isn't very accurate at some song rates). ----------------------- Version 3.01 --------------------------- CHANGE: Simplified NoteSkin tap graphic format. Old NoteSkins will need to diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index 0c49bdb850..d7a2c7fcd6 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -54,6 +54,9 @@ void BGAnimationLayer::Unload() void BGAnimationLayer::Init() { Unload(); + + m_fUpdateRate = 1; + // m_bCycleColor = false; // m_bCycleAlpha = false; // m_Effect = EFFECT_STRETCH_STILL; @@ -593,6 +596,8 @@ float BGAnimationLayer::GetMaxTweenTimeLeft() const void BGAnimationLayer::Update( float fDeltaTime ) { + fDeltaTime *= m_fUpdateRate; + const float fSongBeat = GAMESTATE->m_fSongBeat; unsigned i; @@ -869,6 +874,7 @@ void BGAnimationLayer::SetDiffuse( RageColor c ) void BGAnimationLayer::GainingFocus( float fRate, bool bRewindMovie, bool bLoop ) { + m_fUpdateRate = m_fRate; m_Sprites.back()->GetTexture()->SetPlaybackRate(fRate); if( bRewindMovie ) m_Sprites[0]->GetTexture()->SetPosition( 0 ); diff --git a/stepmania/src/BGAnimationLayer.h b/stepmania/src/BGAnimationLayer.h index daaffa6ae5..d766bef5be 100644 --- a/stepmania/src/BGAnimationLayer.h +++ b/stepmania/src/BGAnimationLayer.h @@ -96,6 +96,7 @@ protected: // common stuff CString m_sCommand; + float m_fUpdateRate; // get by GainingFocus // stretch stuff float m_fStretchTexCoordVelocityX; diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 3e76fe679a..260f5d5d10 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -323,6 +323,9 @@ void Background::LoadFromSong( Song* pSong ) // sort segments SortBackgroundChangesArray( m_aBGChanges ); + // scale all rates by the current music rate + for( unsigned i=0; im_SongOptions.m_fMusicRate; for( map::iterator iter = m_BGAnimations.begin();