From cfe1f9ec6782150ac0ff2a33173f1d881e0dd016 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 14 Apr 2003 04:10:01 +0000 Subject: [PATCH] Add parameters to BackgroundChange: fRate, bFadeLast, bRewindMovie, bLoop. I don't like how this changes the syntax for the #BGCHANGES tag in an SM file. I will think more about this - it's important to finalize it quickly. --- stepmania/src/BGAnimation.cpp | 8 +-- stepmania/src/BGAnimation.h | 4 +- stepmania/src/BGAnimationLayer.cpp | 14 +++-- stepmania/src/BGAnimationLayer.h | 5 +- stepmania/src/Background.cpp | 51 +++++++++++-------- stepmania/src/Background.h | 1 + stepmania/src/NoteField.cpp | 12 ++++- stepmania/src/NotesLoaderSM.cpp | 25 ++++++--- stepmania/src/NotesWriterSM.cpp | 2 +- stepmania/src/RageTexture.h | 1 + stepmania/src/ScreenEdit.cpp | 24 ++++++--- stepmania/src/ScreenEdit.h | 4 ++ stepmania/src/ScreenMiniMenu.h | 6 +-- stepmania/src/Song.cpp | 2 +- stepmania/src/Transition.cpp | 5 ++ .../LowLevelWindow/LowLevelWindow_SDL.cpp | 2 +- .../src/arch/MovieTexture/MovieTexture.h | 1 + .../arch/MovieTexture/MovieTexture_DShow.cpp | 11 ++++ .../arch/MovieTexture/MovieTexture_DShow.h | 1 + stepmania/src/song.h | 8 ++- 20 files changed, 125 insertions(+), 62 deletions(-) diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index 3228dd5d96..98cba7afda 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -119,12 +119,12 @@ void BGAnimation::LoadFromAniDir( CString sAniDir ) } } -void BGAnimation::LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind ) +void BGAnimation::LoadFromMovie( CString sMoviePath ) { Unload(); BGAnimationLayer* pLayer = new BGAnimationLayer; - pLayer->LoadFromMovie( sMoviePath, bLoop, bRewind ); + pLayer->LoadFromMovie( sMoviePath ); m_Layers.push_back( pLayer ); } @@ -158,10 +158,10 @@ void BGAnimation::DrawPrimitives() m_Layers[i]->Draw(); } -void BGAnimation::GainingFocus() +void BGAnimation::GainingFocus( float fRate, bool bRewindMovie, bool bLoop ) { for( unsigned i=0; iGainingFocus(); + m_Layers[i]->GainingFocus( fRate, bRewindMovie, bLoop ); SetDiffuse( RageColor(1,1,1,1) ); } diff --git a/stepmania/src/BGAnimation.h b/stepmania/src/BGAnimation.h index 8fadbfb0a3..7ddd5f80bf 100644 --- a/stepmania/src/BGAnimation.h +++ b/stepmania/src/BGAnimation.h @@ -29,7 +29,7 @@ public: void LoadFromStaticGraphic( CString sPath ); void LoadFromAniDir( CString sAniDir ); - void LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind ); + void LoadFromMovie( CString sMoviePath ); void LoadFromVisualization( CString sMoviePath ); virtual void Update( float fDeltaTime ); @@ -37,7 +37,7 @@ public: virtual void SetDiffuse( const RageColor &c ); - void GainingFocus(); + void GainingFocus( float fRate, bool bRewindMovie, bool bLoop ); void LosingFocus(); float GetLengthSeconds() { return m_fLengthSeconds; } diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index 57069d6fd0..0c49bdb850 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -65,7 +65,6 @@ void BGAnimationLayer::Init() m_fStretchTexCoordVelocityX = 0; m_fStretchTexCoordVelocityY = 0; - m_bRewindMovie = false; m_fZoomMin = 1; m_fZoomMax = 1; m_fVelocityXMin = 10; @@ -117,7 +116,7 @@ void BGAnimationLayer::LoadFromStaticGraphic( CString sPath ) m_Sprites.back()->StretchTo( RectI(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM) ); } -void BGAnimationLayer::LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind ) +void BGAnimationLayer::LoadFromMovie( CString sMoviePath ) { Init(); m_Sprites.push_back(new Sprite); @@ -126,9 +125,6 @@ void BGAnimationLayer::LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewi m_Sprites.back()->GetTexture()->Play(); SDL_Delay( 50 ); // decode a frame so we don't see a black flash at the beginning m_Sprites.back()->GetTexture()->Pause(); - m_bRewindMovie = bRewind; - if( !bLoop ) - m_Sprites.back()->GetTexture()->SetLooping(false); } void BGAnimationLayer::LoadFromVisualization( CString sMoviePath ) @@ -486,7 +482,6 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer ) ini.GetValue ( sLayer, "Command", m_sCommand ); ini.GetValueF( sLayer, "StretchTexCoordVelocityX", m_fStretchTexCoordVelocityX ); ini.GetValueF( sLayer, "StretchTexCoordVelocityY", m_fStretchTexCoordVelocityY ); - ini.GetValueB( sLayer, "RewindMovie", m_bRewindMovie ); ini.GetValueF( sLayer, "ZoomMin", m_fZoomMin ); ini.GetValueF( sLayer, "ZoomMax", m_fZoomMax ); ini.GetValueF( sLayer, "VelocityXMin", m_fVelocityXMin ); @@ -872,10 +867,13 @@ void BGAnimationLayer::SetDiffuse( RageColor c ) m_Sprites[i]->SetDiffuse(c); } -void BGAnimationLayer::GainingFocus() +void BGAnimationLayer::GainingFocus( float fRate, bool bRewindMovie, bool bLoop ) { - if( m_bRewindMovie ) + m_Sprites.back()->GetTexture()->SetPlaybackRate(fRate); + if( bRewindMovie ) m_Sprites[0]->GetTexture()->SetPosition( 0 ); + m_Sprites.back()->GetTexture()->SetLooping(bLoop); + // if movie texture, pause and play movie so we don't waste CPU cycles decoding frames that won't be shown m_Sprites[0]->GetTexture()->Play(); diff --git a/stepmania/src/BGAnimationLayer.h b/stepmania/src/BGAnimationLayer.h index 167609f648..daaffa6ae5 100644 --- a/stepmania/src/BGAnimationLayer.h +++ b/stepmania/src/BGAnimationLayer.h @@ -31,7 +31,7 @@ public: void LoadFromStaticGraphic( CString sPath ); void LoadFromAniLayerFile( CString sPath ); - void LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind ); + void LoadFromMovie( CString sMoviePath ); void LoadFromVisualization( CString sMoviePath ); void LoadFromIni( CString sDir, CString sLayer ); @@ -41,7 +41,7 @@ public: virtual void SetDiffuse( RageColor c ); float GetMaxTweenTimeLeft() const; - void GainingFocus(); + void GainingFocus( float fRate, bool bRewindMovie, bool bLoop ); void LosingFocus(); protected: @@ -102,7 +102,6 @@ protected: float m_fStretchTexCoordVelocityY; // particle and tile stuff - bool m_bRewindMovie; float m_fZoomMin, m_fZoomMax; float m_fVelocityXMin, m_fVelocityXMax; float m_fVelocityYMin, m_fVelocityYMax; diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index dc76e90099..3e76fe679a 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -49,6 +49,7 @@ Background::Background() { m_bInDanger = false; + m_iCurBGChangeIndex = -1; m_pCurrentBGA = NULL; m_pFadingBGA = NULL; m_fSecsLeftInFade = 0; @@ -123,7 +124,7 @@ BGAnimation *Background::CreateSongBGA(const Song *pSong, CString sBGName) const if( sExt.CompareNoCase("avi")==0 || sExt.CompareNoCase("mpg")==0 || sExt.CompareNoCase("mpeg")==0 ) - pTempBGA->LoadFromMovie( asFiles[0], true, true ); + pTempBGA->LoadFromMovie( asFiles[0] ); else pTempBGA->LoadFromStaticGraphic( asFiles[0] ); return pTempBGA; @@ -133,7 +134,7 @@ BGAnimation *Background::CreateSongBGA(const Song *pSong, CString sBGName) const if( !asFiles.empty() ) { pTempBGA = new BGAnimation; - pTempBGA->LoadFromMovie( asFiles[0], true, false ); + pTempBGA->LoadFromMovie( asFiles[0] ); return pTempBGA; } @@ -212,7 +213,7 @@ BGAnimation* Background::CreateRandomBGA() const return NULL; unsigned index = rand() % arrayPossibleMovies.size(); BGAnimation *pTempBGA = new BGAnimation; - pTempBGA->LoadFromMovie( arrayPossibleMovies[index], true, false ); + pTempBGA->LoadFromMovie( arrayPossibleMovies[index] ); return pTempBGA; } break; @@ -260,8 +261,8 @@ void Background::LoadFromSong( Song* pSong ) // Load all song-specified backgrounds for( unsigned i=0; im_BackgroundChanges.size(); i++ ) { - float fStartBeat = pSong->m_BackgroundChanges[i].m_fStartBeat; - CString sBGName = pSong->m_BackgroundChanges[i].m_sBGName; + BackgroundChange change = pSong->m_BackgroundChanges[i]; + CString sBGName = change.m_sBGName; bool bIsAlreadyLoaded = m_BGAnimations.find(sBGName) != m_BGAnimations.end(); @@ -277,7 +278,7 @@ void Background::LoadFromSong( Song* pSong ) sBGName = STATIC_BACKGROUND; } - m_aBGChanges.push_back( BackgroundChange(fStartBeat, sBGName) ); + m_aBGChanges.push_back( change ); } } else // pSong doesn't have an animation plan @@ -366,24 +367,32 @@ void Background::Update( float fDeltaTime ) if( GAMESTATE->m_fSongBeat < m_aBGChanges[i+1].m_fStartBeat ) break; - BGAnimation* pOld = m_pCurrentBGA; - CString sNewBGName = m_aBGChanges[i].m_sBGName; - BGAnimation* pNew = m_BGAnimations[sNewBGName]; - - if( pOld != pNew ) + if( i != m_iCurBGChangeIndex ) { - // LOG->Trace( "new bga %d, %d, %f, %f", m_iCurBGChange, i, m_aBGChanges[i].m_fStartBeat, GAMESTATE->m_fSongBeat ); - - m_pFadingBGA = pOld; - m_pCurrentBGA = pNew; + LOG->Trace( "old bga %d -> new bga %d, %f, %f", i, m_iCurBGChangeIndex, m_aBGChanges[i].m_fStartBeat, GAMESTATE->m_fSongBeat ); - if( pOld ) - pOld->LosingFocus(); - if( pNew ) - pNew->GainingFocus(); + m_iCurBGChangeIndex = i; - bool bBGAnimsMode = PREFSMAN->m_BackgroundMode == PrefsManager::BGMODE_ANIMATIONS; - m_fSecsLeftInFade = bBGAnimsMode ? 0 : FADE_SECONDS; + const BackgroundChange& change = m_aBGChanges[i]; + + BGAnimation* pOld = m_pCurrentBGA; + + if( change.m_bFadeLast ) + m_pFadingBGA = m_pCurrentBGA; + else + m_pFadingBGA = NULL; + + m_pCurrentBGA = m_BGAnimations[ change.m_sBGName ]; + + if( pOld != m_pCurrentBGA ) + { + if( pOld ) + pOld->LosingFocus(); + if( m_pCurrentBGA ) + m_pCurrentBGA->GainingFocus( change.m_fRate, change.m_bRewindMovie, change.m_bLoop ); + } + + m_fSecsLeftInFade = m_pFadingBGA!=NULL ? FADE_SECONDS : 0; } if( m_pCurrentBGA ) diff --git a/stepmania/src/Background.h b/stepmania/src/Background.h index 605b9e8363..d0e00334da 100644 --- a/stepmania/src/Background.h +++ b/stepmania/src/Background.h @@ -50,6 +50,7 @@ protected: map m_BGAnimations; vector m_aBGChanges; + int m_iCurBGChangeIndex; BGAnimation* m_pCurrentBGA; BGAnimation* m_pFadingBGA; float m_fSecsLeftInFade; diff --git a/stepmania/src/NoteField.cpp b/stepmania/src/NoteField.cpp index fc32d8d6d2..c683385e85 100644 --- a/stepmania/src/NoteField.cpp +++ b/stepmania/src/NoteField.cpp @@ -309,7 +309,17 @@ void NoteField::DrawPrimitives() { if(aBackgroundChanges[i].m_fStartBeat >= fFirstBeatToDraw && aBackgroundChanges[i].m_fStartBeat <= fLastBeatToDraw) - DrawBGChangeText( aBackgroundChanges[i].m_fStartBeat, aBackgroundChanges[i].m_sBGName ); + { + const BackgroundChange& change = aBackgroundChanges[i]; + CString sChangeText = ssprintf("%s\n%.0f%%%s%s%s", + change.m_sBGName.GetString(), + change.m_fRate*100, + change.m_bFadeLast ? " Fade" : "", + change.m_bRewindMovie ? " Rewind" : "", + change.m_bLoop ? " Loop" : "" ); + + DrawBGChangeText( change.m_fStartBeat, sChangeText ); + } } // diff --git a/stepmania/src/NotesLoaderSM.cpp b/stepmania/src/NotesLoaderSM.cpp index 242348d0bd..69fe1d76dd 100644 --- a/stepmania/src/NotesLoaderSM.cpp +++ b/stepmania/src/NotesLoaderSM.cpp @@ -232,17 +232,26 @@ bool SMLoader::LoadFromSMFile( CString sPath, Song &out ) split( aBGChangeExpressions[b], "=", aBGChangeValues ); /* XXX: Once we have a way to display warnings that the user actually * cares about (unlike most warnings), this should be one of them. */ - if(aBGChangeValues.size() != 2) + + BackgroundChange change; + switch( aBGChangeValues.size() ) { - LOG->Warn("Invalid #%s value \"%s\" (must have exactly one '='), ignored", + case 6: + change.m_fRate = (float)atof( aBGChangeValues[2] ); + change.m_bFadeLast = atoi( aBGChangeValues[3] ) != 0; + change.m_bRewindMovie = atoi( aBGChangeValues[4] ) != 0; + change.m_bLoop = atoi( aBGChangeValues[5] ) != 0; + // fall through + case 2: + change.m_fStartBeat = (float)atof( aBGChangeValues[0] ); + change.m_sBGName = aBGChangeValues[1]; + out.AddBackgroundChange( change ); + break; + default: + LOG->Warn("Invalid #BGCHANGES%s value \"%s\" was ignored", sValueName.GetString(), aBGChangeExpressions[b].GetString()); - continue; + break; } - float fBeat = (float)atof( aBGChangeValues[0] ); - CString sBGName = aBGChangeValues[1]; - sBGName.MakeLower(); - - out.AddBackgroundChange( BackgroundChange(fBeat, sBGName) ); } } diff --git a/stepmania/src/NotesWriterSM.cpp b/stepmania/src/NotesWriterSM.cpp index 51cd605ba9..14b908ebbc 100644 --- a/stepmania/src/NotesWriterSM.cpp +++ b/stepmania/src/NotesWriterSM.cpp @@ -65,7 +65,7 @@ void NotesWriterSM::WriteGlobalTags(FILE *fp, const Song &out) { const BackgroundChange &seg = out.m_BackgroundChanges[i]; - fprintf( fp, "%.3f=%s", seg.m_fStartBeat, seg.m_sBGName.GetString() ); + fprintf( fp, "%.3f=%s=%.3f=%d=%d=%d", seg.m_fStartBeat, seg.m_sBGName.GetString(), seg.m_fRate, seg.m_bFadeLast, seg.m_bRewindMovie, seg.m_bLoop ); if( i != out.m_BackgroundChanges.size()-1 ) fprintf( fp, "," ); } diff --git a/stepmania/src/RageTexture.h b/stepmania/src/RageTexture.h index 49022710b7..3bf8d8d7b2 100644 --- a/stepmania/src/RageTexture.h +++ b/stepmania/src/RageTexture.h @@ -59,6 +59,7 @@ public: virtual void Stop() {} virtual void Pause() {} virtual void SetPosition( float fSeconds ) {} + virtual void SetPlaybackRate( float fRate ) {} virtual bool IsAMovie() const { return false; } virtual bool IsPlaying() const { return false; } void SetLooping(bool looping) { } diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 3beed4af93..02a433855b 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -194,6 +194,10 @@ Menu g_EditSongInfo Menu g_BGChange ( "Background Change", + MenuRow( "Rate (applies to new adds)", true, 5, "50%","60%","70%","80%","90%","100%","110%","120%","130%","140%","150%","160%","170%","180%","190%","200%" ), + MenuRow( "Fade Last (applies to new adds)", true, 0, "NO","YES" ), + MenuRow( "Rewind Movie (applies to new adds)", true, 0, "NO","YES" ), + MenuRow( "Loop (applies to new adds)", true, 1, "NO","YES" ), MenuRow( "Add Change to random", true ), MenuRow( "Add Change to song BGAnimation", true ), MenuRow( "Add Change to song Movie", true ), @@ -1542,12 +1546,13 @@ void ScreenEdit::HandleEditSongInfoChoice( EditSongInfoChoice c, int* iAnswers ) void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, int* iAnswers ) { - CString sBGName; + BackgroundChange change; + change.m_fStartBeat = GAMESTATE->m_fSongBeat; switch( c ) { case add_random: - sBGName = "-random-"; + change.m_sBGName = "-random-"; break; case add_song_bganimation: case add_song_movie: @@ -1555,15 +1560,20 @@ void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, int* iAnswers ) case add_global_random_movie: case add_global_bganimation: case add_global_visualization: - sBGName = g_BGChange.rows[c].choices[iAnswers[c]]; + change.m_sBGName = g_BGChange.rows[c].choices[iAnswers[c]]; break; case delete_change: - sBGName = ""; + change.m_sBGName = ""; break; default: - ASSERT(0); + SOUNDMAN->PlayOnce( THEME->GetPathToS("Common invalid") ); }; + change.m_fRate = (float)atof( g_BGChange.rows[rate].choices[iAnswers[rate]] )/100.f; + change.m_bFadeLast = !!iAnswers[fade_last]; + change.m_bRewindMovie = !!iAnswers[rewind_movie]; + change.m_bLoop = !!iAnswers[loop]; + unsigned i; for( i=0; im_BackgroundChanges.size(); i++ ) if( m_pSong->m_BackgroundChanges[i].m_fStartBeat == GAMESTATE->m_fSongBeat ) @@ -1574,6 +1584,6 @@ void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, int* iAnswers ) m_pSong->m_BackgroundChanges.begin()+i+1); // create a new BGChange - if( sBGName != "" ) - m_pSong->AddBackgroundChange( BackgroundChange(GAMESTATE->m_fSongBeat, sBGName) ); + if( change.m_sBGName != "" ) + m_pSong->AddBackgroundChange( change ); } diff --git a/stepmania/src/ScreenEdit.h b/stepmania/src/ScreenEdit.h index 07f1e36dc0..c37f34fbb6 100644 --- a/stepmania/src/ScreenEdit.h +++ b/stepmania/src/ScreenEdit.h @@ -167,6 +167,10 @@ public: void HandleEditSongInfoChoice( EditSongInfoChoice c, int* iAnswers ); enum BGChangeChoice { + rate, + fade_last, + rewind_movie, + loop, add_random, add_song_bganimation, add_song_movie, diff --git a/stepmania/src/ScreenMiniMenu.h b/stepmania/src/ScreenMiniMenu.h index 5594872e06..6e37992b6e 100644 --- a/stepmania/src/ScreenMiniMenu.h +++ b/stepmania/src/ScreenMiniMenu.h @@ -33,13 +33,13 @@ struct MenuRow defaultChoice = 0; } - MenuRow( const char * n, bool e, const char * c0=NULL, const char * c1=NULL, const char * c2=NULL, const char * c3=NULL, const char * c4=NULL, const char * c5=NULL, const char * c6=NULL, const char * c7=NULL, const char * c8=NULL, const char * c9=NULL, const char * c10=NULL, const char * c11=NULL, const char * c12=NULL, const char * c13=NULL, const char * c14=NULL ) + MenuRow( const char * n, bool e, int d=0, const char * c0=NULL, const char * c1=NULL, const char * c2=NULL, const char * c3=NULL, const char * c4=NULL, const char * c5=NULL, const char * c6=NULL, const char * c7=NULL, const char * c8=NULL, const char * c9=NULL, const char * c10=NULL, const char * c11=NULL, const char * c12=NULL, const char * c13=NULL, const char * c14=NULL, const char * c15=NULL, const char * c16=NULL, const char * c17=NULL, const char * c18=NULL, const char * c19=NULL ) { name = n; enabled = e; - defaultChoice = 0; + defaultChoice = d; #define PUSH( c ) if(c!=NULL) choices.push_back(c); - PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14); + PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19); #undef PUSH // printf( "choices.size = %u", choices.size() ); } diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index ee20557013..5724c2e2c3 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -638,7 +638,7 @@ void Song::TidyUpData() /* Use this->GetBeatFromElapsedTime(0) instead of 0 to start when the * music starts. */ if( arrayPossibleMovies.size() == 1 ) - this->AddBackgroundChange( BackgroundChange(0,arrayPossibleMovies[0]) ); + this->AddBackgroundChange( BackgroundChange(0,arrayPossibleMovies[0],1.f,true,true,false) ); } for( i=0; i m_BGAnimation.GetLengthSeconds() ) // over { diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.cpp b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.cpp index 8ea9267ebc..ae91a05c31 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.cpp +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.cpp @@ -83,7 +83,7 @@ bool LowLevelWindow_SDL::SetVideoMode( bool windowed, int width, int height, int * in the real branch we can remove this #if. */ #if defined(WIN32) SDL_Event e; - if(SDL_GetEvent(&e, SDL_OPENGLRESETMASK)) + if(SDL_GetEvent(e, SDL_OPENGLRESETMASK)) { LOG->Trace("New OpenGL context"); diff --git a/stepmania/src/arch/MovieTexture/MovieTexture.h b/stepmania/src/arch/MovieTexture/MovieTexture.h index af6b3127a5..fbefd562dc 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture.h @@ -16,6 +16,7 @@ public: virtual void Pause() = 0; virtual void Stop() = 0; virtual void SetPosition( float fSeconds ) = 0; + virtual void SetPlaybackRate( float fRate ) = 0; virtual bool IsPlaying() const = 0; virtual void SetLooping(bool looping=true) { } diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_DShow.cpp b/stepmania/src/arch/MovieTexture/MovieTexture_DShow.cpp index 3af25303de..936d6a9038 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_DShow.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture_DShow.cpp @@ -378,6 +378,17 @@ void MovieTexture_DShow::SetPosition( float fSeconds ) StopSkippingUpdates(); } +void MovieTexture_DShow::SetPlaybackRate( float fRate ) +{ + SkipUpdates(); + + CComPtr pMP; + m_pGB.QueryInterface(&pMP); + pMP->put_Rate(fRate); + + StopSkippingUpdates(); +} + bool MovieTexture_DShow::IsPlaying() const { return m_bPlaying; diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_DShow.h b/stepmania/src/arch/MovieTexture/MovieTexture_DShow.h index 980583e979..d63de640e4 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_DShow.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture_DShow.h @@ -57,6 +57,7 @@ public: virtual void Pause(); virtual void Stop(); virtual void SetPosition( float fSeconds ); + virtual void SetPlaybackRate( float fRate ); virtual bool IsPlaying() const; void SetLooping(bool looping=true) { m_bLoop = looping; } diff --git a/stepmania/src/song.h b/stepmania/src/song.h index bb5fe80bd6..a1474bd6ef 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -41,10 +41,14 @@ struct StopSegment struct BackgroundChange { - BackgroundChange() { m_fStartBeat = -1; }; - BackgroundChange( float s, CString sBGName ) { m_fStartBeat = s; m_sBGName = sBGName; }; + BackgroundChange() { m_fStartBeat=-1; m_fRate=1; m_bFadeLast=false; m_bRewindMovie=false; m_bLoop=true; }; + BackgroundChange( float s, CString n, float r=1.f, bool f=false, bool m=false, bool l=true ) { m_fStartBeat=s; m_sBGName=n; m_fRate=r; m_bFadeLast=f; m_bRewindMovie=m; m_bLoop=l; }; float m_fStartBeat; CString m_sBGName; + float m_fRate; + bool m_bFadeLast; + bool m_bRewindMovie; + bool m_bLoop; }; void SortBackgroundChangesArray( vector &arrayBackgroundChanges );