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.
This commit is contained in:
Chris Danford
2003-04-14 04:10:01 +00:00
parent 5ea408a547
commit cfe1f9ec67
20 changed files with 125 additions and 62 deletions
+4 -4
View File
@@ -119,12 +119,12 @@ void BGAnimation::LoadFromAniDir( CString sAniDir )
} }
} }
void BGAnimation::LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind ) void BGAnimation::LoadFromMovie( CString sMoviePath )
{ {
Unload(); Unload();
BGAnimationLayer* pLayer = new BGAnimationLayer; BGAnimationLayer* pLayer = new BGAnimationLayer;
pLayer->LoadFromMovie( sMoviePath, bLoop, bRewind ); pLayer->LoadFromMovie( sMoviePath );
m_Layers.push_back( pLayer ); m_Layers.push_back( pLayer );
} }
@@ -158,10 +158,10 @@ void BGAnimation::DrawPrimitives()
m_Layers[i]->Draw(); m_Layers[i]->Draw();
} }
void BGAnimation::GainingFocus() void BGAnimation::GainingFocus( float fRate, bool bRewindMovie, bool bLoop )
{ {
for( unsigned i=0; i<m_Layers.size(); i++ ) for( unsigned i=0; i<m_Layers.size(); i++ )
m_Layers[i]->GainingFocus(); m_Layers[i]->GainingFocus( fRate, bRewindMovie, bLoop );
SetDiffuse( RageColor(1,1,1,1) ); SetDiffuse( RageColor(1,1,1,1) );
} }
+2 -2
View File
@@ -29,7 +29,7 @@ public:
void LoadFromStaticGraphic( CString sPath ); void LoadFromStaticGraphic( CString sPath );
void LoadFromAniDir( CString sAniDir ); void LoadFromAniDir( CString sAniDir );
void LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind ); void LoadFromMovie( CString sMoviePath );
void LoadFromVisualization( CString sMoviePath ); void LoadFromVisualization( CString sMoviePath );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
@@ -37,7 +37,7 @@ public:
virtual void SetDiffuse( const RageColor &c ); virtual void SetDiffuse( const RageColor &c );
void GainingFocus(); void GainingFocus( float fRate, bool bRewindMovie, bool bLoop );
void LosingFocus(); void LosingFocus();
float GetLengthSeconds() { return m_fLengthSeconds; } float GetLengthSeconds() { return m_fLengthSeconds; }
+6 -8
View File
@@ -65,7 +65,6 @@ void BGAnimationLayer::Init()
m_fStretchTexCoordVelocityX = 0; m_fStretchTexCoordVelocityX = 0;
m_fStretchTexCoordVelocityY = 0; m_fStretchTexCoordVelocityY = 0;
m_bRewindMovie = false;
m_fZoomMin = 1; m_fZoomMin = 1;
m_fZoomMax = 1; m_fZoomMax = 1;
m_fVelocityXMin = 10; 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) ); 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(); Init();
m_Sprites.push_back(new Sprite); m_Sprites.push_back(new Sprite);
@@ -126,9 +125,6 @@ void BGAnimationLayer::LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewi
m_Sprites.back()->GetTexture()->Play(); m_Sprites.back()->GetTexture()->Play();
SDL_Delay( 50 ); // decode a frame so we don't see a black flash at the beginning SDL_Delay( 50 ); // decode a frame so we don't see a black flash at the beginning
m_Sprites.back()->GetTexture()->Pause(); m_Sprites.back()->GetTexture()->Pause();
m_bRewindMovie = bRewind;
if( !bLoop )
m_Sprites.back()->GetTexture()->SetLooping(false);
} }
void BGAnimationLayer::LoadFromVisualization( CString sMoviePath ) void BGAnimationLayer::LoadFromVisualization( CString sMoviePath )
@@ -486,7 +482,6 @@ void BGAnimationLayer::LoadFromIni( CString sAniDir, CString sLayer )
ini.GetValue ( sLayer, "Command", m_sCommand ); ini.GetValue ( sLayer, "Command", m_sCommand );
ini.GetValueF( sLayer, "StretchTexCoordVelocityX", m_fStretchTexCoordVelocityX ); ini.GetValueF( sLayer, "StretchTexCoordVelocityX", m_fStretchTexCoordVelocityX );
ini.GetValueF( sLayer, "StretchTexCoordVelocityY", m_fStretchTexCoordVelocityY ); ini.GetValueF( sLayer, "StretchTexCoordVelocityY", m_fStretchTexCoordVelocityY );
ini.GetValueB( sLayer, "RewindMovie", m_bRewindMovie );
ini.GetValueF( sLayer, "ZoomMin", m_fZoomMin ); ini.GetValueF( sLayer, "ZoomMin", m_fZoomMin );
ini.GetValueF( sLayer, "ZoomMax", m_fZoomMax ); ini.GetValueF( sLayer, "ZoomMax", m_fZoomMax );
ini.GetValueF( sLayer, "VelocityXMin", m_fVelocityXMin ); ini.GetValueF( sLayer, "VelocityXMin", m_fVelocityXMin );
@@ -872,10 +867,13 @@ void BGAnimationLayer::SetDiffuse( RageColor c )
m_Sprites[i]->SetDiffuse(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[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 // 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(); m_Sprites[0]->GetTexture()->Play();
+2 -3
View File
@@ -31,7 +31,7 @@ public:
void LoadFromStaticGraphic( CString sPath ); void LoadFromStaticGraphic( CString sPath );
void LoadFromAniLayerFile( CString sPath ); void LoadFromAniLayerFile( CString sPath );
void LoadFromMovie( CString sMoviePath, bool bLoop, bool bRewind ); void LoadFromMovie( CString sMoviePath );
void LoadFromVisualization( CString sMoviePath ); void LoadFromVisualization( CString sMoviePath );
void LoadFromIni( CString sDir, CString sLayer ); void LoadFromIni( CString sDir, CString sLayer );
@@ -41,7 +41,7 @@ public:
virtual void SetDiffuse( RageColor c ); virtual void SetDiffuse( RageColor c );
float GetMaxTweenTimeLeft() const; float GetMaxTweenTimeLeft() const;
void GainingFocus(); void GainingFocus( float fRate, bool bRewindMovie, bool bLoop );
void LosingFocus(); void LosingFocus();
protected: protected:
@@ -102,7 +102,6 @@ protected:
float m_fStretchTexCoordVelocityY; float m_fStretchTexCoordVelocityY;
// particle and tile stuff // particle and tile stuff
bool m_bRewindMovie;
float m_fZoomMin, m_fZoomMax; float m_fZoomMin, m_fZoomMax;
float m_fVelocityXMin, m_fVelocityXMax; float m_fVelocityXMin, m_fVelocityXMax;
float m_fVelocityYMin, m_fVelocityYMax; float m_fVelocityYMin, m_fVelocityYMax;
+29 -20
View File
@@ -49,6 +49,7 @@ Background::Background()
{ {
m_bInDanger = false; m_bInDanger = false;
m_iCurBGChangeIndex = -1;
m_pCurrentBGA = NULL; m_pCurrentBGA = NULL;
m_pFadingBGA = NULL; m_pFadingBGA = NULL;
m_fSecsLeftInFade = 0; m_fSecsLeftInFade = 0;
@@ -123,7 +124,7 @@ BGAnimation *Background::CreateSongBGA(const Song *pSong, CString sBGName) const
if( sExt.CompareNoCase("avi")==0 || if( sExt.CompareNoCase("avi")==0 ||
sExt.CompareNoCase("mpg")==0 || sExt.CompareNoCase("mpg")==0 ||
sExt.CompareNoCase("mpeg")==0 ) sExt.CompareNoCase("mpeg")==0 )
pTempBGA->LoadFromMovie( asFiles[0], true, true ); pTempBGA->LoadFromMovie( asFiles[0] );
else else
pTempBGA->LoadFromStaticGraphic( asFiles[0] ); pTempBGA->LoadFromStaticGraphic( asFiles[0] );
return pTempBGA; return pTempBGA;
@@ -133,7 +134,7 @@ BGAnimation *Background::CreateSongBGA(const Song *pSong, CString sBGName) const
if( !asFiles.empty() ) if( !asFiles.empty() )
{ {
pTempBGA = new BGAnimation; pTempBGA = new BGAnimation;
pTempBGA->LoadFromMovie( asFiles[0], true, false ); pTempBGA->LoadFromMovie( asFiles[0] );
return pTempBGA; return pTempBGA;
} }
@@ -212,7 +213,7 @@ BGAnimation* Background::CreateRandomBGA() const
return NULL; return NULL;
unsigned index = rand() % arrayPossibleMovies.size(); unsigned index = rand() % arrayPossibleMovies.size();
BGAnimation *pTempBGA = new BGAnimation; BGAnimation *pTempBGA = new BGAnimation;
pTempBGA->LoadFromMovie( arrayPossibleMovies[index], true, false ); pTempBGA->LoadFromMovie( arrayPossibleMovies[index] );
return pTempBGA; return pTempBGA;
} }
break; break;
@@ -260,8 +261,8 @@ void Background::LoadFromSong( Song* pSong )
// Load all song-specified backgrounds // Load all song-specified backgrounds
for( unsigned i=0; i<pSong->m_BackgroundChanges.size(); i++ ) for( unsigned i=0; i<pSong->m_BackgroundChanges.size(); i++ )
{ {
float fStartBeat = pSong->m_BackgroundChanges[i].m_fStartBeat; BackgroundChange change = pSong->m_BackgroundChanges[i];
CString sBGName = pSong->m_BackgroundChanges[i].m_sBGName; CString sBGName = change.m_sBGName;
bool bIsAlreadyLoaded = m_BGAnimations.find(sBGName) != m_BGAnimations.end(); bool bIsAlreadyLoaded = m_BGAnimations.find(sBGName) != m_BGAnimations.end();
@@ -277,7 +278,7 @@ void Background::LoadFromSong( Song* pSong )
sBGName = STATIC_BACKGROUND; sBGName = STATIC_BACKGROUND;
} }
m_aBGChanges.push_back( BackgroundChange(fStartBeat, sBGName) ); m_aBGChanges.push_back( change );
} }
} }
else // pSong doesn't have an animation plan 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 ) if( GAMESTATE->m_fSongBeat < m_aBGChanges[i+1].m_fStartBeat )
break; break;
BGAnimation* pOld = m_pCurrentBGA; if( i != m_iCurBGChangeIndex )
CString sNewBGName = m_aBGChanges[i].m_sBGName;
BGAnimation* pNew = m_BGAnimations[sNewBGName];
if( pOld != pNew )
{ {
// LOG->Trace( "new bga %d, %d, %f, %f", m_iCurBGChange, i, m_aBGChanges[i].m_fStartBeat, GAMESTATE->m_fSongBeat ); LOG->Trace( "old bga %d -> new bga %d, %f, %f", i, m_iCurBGChangeIndex, m_aBGChanges[i].m_fStartBeat, GAMESTATE->m_fSongBeat );
m_pFadingBGA = pOld; m_iCurBGChangeIndex = i;
m_pCurrentBGA = pNew;
if( pOld ) const BackgroundChange& change = m_aBGChanges[i];
pOld->LosingFocus();
if( pNew )
pNew->GainingFocus();
bool bBGAnimsMode = PREFSMAN->m_BackgroundMode == PrefsManager::BGMODE_ANIMATIONS; BGAnimation* pOld = m_pCurrentBGA;
m_fSecsLeftInFade = bBGAnimsMode ? 0 : FADE_SECONDS;
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 ) if( m_pCurrentBGA )
+1
View File
@@ -50,6 +50,7 @@ protected:
map<CString,BGAnimation*> m_BGAnimations; map<CString,BGAnimation*> m_BGAnimations;
vector<BackgroundChange> m_aBGChanges; vector<BackgroundChange> m_aBGChanges;
int m_iCurBGChangeIndex;
BGAnimation* m_pCurrentBGA; BGAnimation* m_pCurrentBGA;
BGAnimation* m_pFadingBGA; BGAnimation* m_pFadingBGA;
float m_fSecsLeftInFade; float m_fSecsLeftInFade;
+11 -1
View File
@@ -309,7 +309,17 @@ void NoteField::DrawPrimitives()
{ {
if(aBackgroundChanges[i].m_fStartBeat >= fFirstBeatToDraw && if(aBackgroundChanges[i].m_fStartBeat >= fFirstBeatToDraw &&
aBackgroundChanges[i].m_fStartBeat <= fLastBeatToDraw) 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 );
}
} }
// //
+19 -10
View File
@@ -232,17 +232,26 @@ bool SMLoader::LoadFromSMFile( CString sPath, Song &out )
split( aBGChangeExpressions[b], "=", aBGChangeValues ); split( aBGChangeExpressions[b], "=", aBGChangeValues );
/* XXX: Once we have a way to display warnings that the user actually /* XXX: Once we have a way to display warnings that the user actually
* cares about (unlike most warnings), this should be one of them. */ * cares about (unlike most warnings), this should be one of them. */
if(aBGChangeValues.size() != 2)
{
LOG->Warn("Invalid #%s value \"%s\" (must have exactly one '='), ignored",
sValueName.GetString(), aBGChangeExpressions[b].GetString());
continue;
}
float fBeat = (float)atof( aBGChangeValues[0] );
CString sBGName = aBGChangeValues[1];
sBGName.MakeLower();
out.AddBackgroundChange( BackgroundChange(fBeat, sBGName) ); BackgroundChange change;
switch( aBGChangeValues.size() )
{
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());
break;
}
} }
} }
+1 -1
View File
@@ -65,7 +65,7 @@ void NotesWriterSM::WriteGlobalTags(FILE *fp, const Song &out)
{ {
const BackgroundChange &seg = out.m_BackgroundChanges[i]; 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 ) if( i != out.m_BackgroundChanges.size()-1 )
fprintf( fp, "," ); fprintf( fp, "," );
} }
+1
View File
@@ -59,6 +59,7 @@ public:
virtual void Stop() {} virtual void Stop() {}
virtual void Pause() {} virtual void Pause() {}
virtual void SetPosition( float fSeconds ) {} virtual void SetPosition( float fSeconds ) {}
virtual void SetPlaybackRate( float fRate ) {}
virtual bool IsAMovie() const { return false; } virtual bool IsAMovie() const { return false; }
virtual bool IsPlaying() const { return false; } virtual bool IsPlaying() const { return false; }
void SetLooping(bool looping) { } void SetLooping(bool looping) { }
+17 -7
View File
@@ -194,6 +194,10 @@ Menu g_EditSongInfo
Menu g_BGChange Menu g_BGChange
( (
"Background Change", "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 random", true ),
MenuRow( "Add Change to song BGAnimation", true ), MenuRow( "Add Change to song BGAnimation", true ),
MenuRow( "Add Change to song Movie", 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 ) void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, int* iAnswers )
{ {
CString sBGName; BackgroundChange change;
change.m_fStartBeat = GAMESTATE->m_fSongBeat;
switch( c ) switch( c )
{ {
case add_random: case add_random:
sBGName = "-random-"; change.m_sBGName = "-random-";
break; break;
case add_song_bganimation: case add_song_bganimation:
case add_song_movie: case add_song_movie:
@@ -1555,15 +1560,20 @@ void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, int* iAnswers )
case add_global_random_movie: case add_global_random_movie:
case add_global_bganimation: case add_global_bganimation:
case add_global_visualization: case add_global_visualization:
sBGName = g_BGChange.rows[c].choices[iAnswers[c]]; change.m_sBGName = g_BGChange.rows[c].choices[iAnswers[c]];
break; break;
case delete_change: case delete_change:
sBGName = ""; change.m_sBGName = "";
break; break;
default: 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; unsigned i;
for( i=0; i<m_pSong->m_BackgroundChanges.size(); i++ ) for( i=0; i<m_pSong->m_BackgroundChanges.size(); i++ )
if( m_pSong->m_BackgroundChanges[i].m_fStartBeat == GAMESTATE->m_fSongBeat ) 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); m_pSong->m_BackgroundChanges.begin()+i+1);
// create a new BGChange // create a new BGChange
if( sBGName != "" ) if( change.m_sBGName != "" )
m_pSong->AddBackgroundChange( BackgroundChange(GAMESTATE->m_fSongBeat, sBGName) ); m_pSong->AddBackgroundChange( change );
} }
+4
View File
@@ -167,6 +167,10 @@ public:
void HandleEditSongInfoChoice( EditSongInfoChoice c, int* iAnswers ); void HandleEditSongInfoChoice( EditSongInfoChoice c, int* iAnswers );
enum BGChangeChoice { enum BGChangeChoice {
rate,
fade_last,
rewind_movie,
loop,
add_random, add_random,
add_song_bganimation, add_song_bganimation,
add_song_movie, add_song_movie,
+3 -3
View File
@@ -33,13 +33,13 @@ struct MenuRow
defaultChoice = 0; 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; name = n;
enabled = e; enabled = e;
defaultChoice = 0; defaultChoice = d;
#define PUSH( c ) if(c!=NULL) choices.push_back(c); #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 #undef PUSH
// printf( "choices.size = %u", choices.size() ); // printf( "choices.size = %u", choices.size() );
} }
+1 -1
View File
@@ -638,7 +638,7 @@ void Song::TidyUpData()
/* Use this->GetBeatFromElapsedTime(0) instead of 0 to start when the /* Use this->GetBeatFromElapsedTime(0) instead of 0 to start when the
* music starts. */ * music starts. */
if( arrayPossibleMovies.size() == 1 ) 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_apNotes.size(); i++ ) for( i=0; i<m_apNotes.size(); i++ )
+5
View File
@@ -54,8 +54,13 @@ void Transition::Update( float fDeltaTime )
/* Start the transition on the first update, not in the ctor, so /* Start the transition on the first update, not in the ctor, so
* we don't play a sound while our parent is still loading. */ * we don't play a sound while our parent is still loading. */
if( m_fSecsIntoTransition==0 ) // first update if( m_fSecsIntoTransition==0 ) // first update
{
m_sound.PlayRandom(); m_sound.PlayRandom();
// stop the sound from playing multiple times on an Update(0)
m_fSecsIntoTransition+=0.000001f;
}
m_BGAnimation.Update( fDeltaTime ); m_BGAnimation.Update( fDeltaTime );
if( m_fSecsIntoTransition > m_BGAnimation.GetLengthSeconds() ) // over if( m_fSecsIntoTransition > m_BGAnimation.GetLengthSeconds() ) // over
{ {
@@ -83,7 +83,7 @@ bool LowLevelWindow_SDL::SetVideoMode( bool windowed, int width, int height, int
* in the real branch we can remove this #if. */ * in the real branch we can remove this #if. */
#if defined(WIN32) #if defined(WIN32)
SDL_Event e; SDL_Event e;
if(SDL_GetEvent(&e, SDL_OPENGLRESETMASK)) if(SDL_GetEvent(e, SDL_OPENGLRESETMASK))
{ {
LOG->Trace("New OpenGL context"); LOG->Trace("New OpenGL context");
@@ -16,6 +16,7 @@ public:
virtual void Pause() = 0; virtual void Pause() = 0;
virtual void Stop() = 0; virtual void Stop() = 0;
virtual void SetPosition( float fSeconds ) = 0; virtual void SetPosition( float fSeconds ) = 0;
virtual void SetPlaybackRate( float fRate ) = 0;
virtual bool IsPlaying() const = 0; virtual bool IsPlaying() const = 0;
virtual void SetLooping(bool looping=true) { } virtual void SetLooping(bool looping=true) { }
@@ -378,6 +378,17 @@ void MovieTexture_DShow::SetPosition( float fSeconds )
StopSkippingUpdates(); StopSkippingUpdates();
} }
void MovieTexture_DShow::SetPlaybackRate( float fRate )
{
SkipUpdates();
CComPtr<IMediaPosition> pMP;
m_pGB.QueryInterface(&pMP);
pMP->put_Rate(fRate);
StopSkippingUpdates();
}
bool MovieTexture_DShow::IsPlaying() const bool MovieTexture_DShow::IsPlaying() const
{ {
return m_bPlaying; return m_bPlaying;
@@ -57,6 +57,7 @@ public:
virtual void Pause(); virtual void Pause();
virtual void Stop(); virtual void Stop();
virtual void SetPosition( float fSeconds ); virtual void SetPosition( float fSeconds );
virtual void SetPlaybackRate( float fRate );
virtual bool IsPlaying() const; virtual bool IsPlaying() const;
void SetLooping(bool looping=true) { m_bLoop = looping; } void SetLooping(bool looping=true) { m_bLoop = looping; }
+6 -2
View File
@@ -41,10 +41,14 @@ struct StopSegment
struct BackgroundChange struct BackgroundChange
{ {
BackgroundChange() { m_fStartBeat = -1; }; BackgroundChange() { m_fStartBeat=-1; m_fRate=1; m_bFadeLast=false; m_bRewindMovie=false; m_bLoop=true; };
BackgroundChange( float s, CString sBGName ) { m_fStartBeat = s; m_sBGName = sBGName; }; 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; float m_fStartBeat;
CString m_sBGName; CString m_sBGName;
float m_fRate;
bool m_bFadeLast;
bool m_bRewindMovie;
bool m_bLoop;
}; };
void SortBackgroundChangesArray( vector<BackgroundChange> &arrayBackgroundChanges ); void SortBackgroundChangesArray( vector<BackgroundChange> &arrayBackgroundChanges );