From dac72665e3a85b43fe2a791379725a033c46d98e Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 31 May 2005 01:17:37 +0000 Subject: [PATCH] move background file enumerating into BackgroundUtil.* fix editor background change functionality --- stepmania/src/Actor.h | 7 +- stepmania/src/ActorFrame.cpp | 16 -- stepmania/src/ActorFrame.h | 2 - stepmania/src/BGAnimationLayer.cpp | 7 - stepmania/src/BGAnimationLayer.h | 1 - stepmania/src/Background.cpp | 118 +++++++------ stepmania/src/Background.h | 1 + stepmania/src/BackgroundUtil.cpp | 169 +++++++++++++++++++ stepmania/src/BackgroundUtil.h | 113 +++++++++++++ stepmania/src/GameConstantsAndTypes.cpp | 14 -- stepmania/src/GameConstantsAndTypes.h | 86 ---------- stepmania/src/Makefile.am | 1 + stepmania/src/NoteField.cpp | 7 +- stepmania/src/NotesLoaderSM.cpp | 17 +- stepmania/src/NotesWriterSM.cpp | 22 ++- stepmania/src/RageUtil.cpp | 7 + stepmania/src/RageUtil.h | 1 + stepmania/src/ScreenEdit.cpp | 209 +++++++++++++----------- stepmania/src/ScreenEdit.h | 6 +- stepmania/src/ScreenMiniMenu.cpp | 47 ++++-- stepmania/src/ScreenMiniMenu.h | 41 ++++- stepmania/src/Song.cpp | 18 +- stepmania/src/Sprite.cpp | 58 ------- stepmania/src/Sprite.h | 3 - stepmania/src/StepMania.dsp | 16 +- stepmania/src/StepMania.vcproj | 18 +- stepmania/src/ThemeManager.cpp | 2 +- stepmania/src/song.h | 12 +- 28 files changed, 609 insertions(+), 410 deletions(-) create mode 100644 stepmania/src/BackgroundUtil.cpp create mode 100644 stepmania/src/BackgroundUtil.h diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 8533d11a9d..9c01c1ec80 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -378,12 +378,7 @@ public: virtual void SetState( int iNewState ) {} virtual float GetAnimationLengthSeconds() const { return 0; } virtual void SetSecondsIntoAnimation( float fSeconds ) {} - - // - // BGAnimation stuff - // - virtual void GainFocus( float fRate, bool bRewindMovie, bool bLoop ) {} - virtual void LoseFocus() {} + virtual void SetUpdateRate( float fRate ) {} protected: diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index 70aeaff44d..819160bfa0 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -339,22 +339,6 @@ void ActorFrame::HandleCommand( const Command &command ) } */ -void ActorFrame::GainFocus( float fRate, bool bRewindMovie, bool bLoop ) -{ - Actor::GainFocus( fRate, bRewindMovie, bLoop ); - - for( unsigned i=0; iGainFocus( fRate, bRewindMovie, bLoop ); -} - -void ActorFrame::LoseFocus() -{ - Actor::LoseFocus(); - - for( unsigned i=0; iLoseFocus(); -} - void ActorFrame::PlayCommand( const CString &sCommandName ) { // HACK: Don't propogate Init. It gets called once for every Actor when the diff --git a/stepmania/src/ActorFrame.h b/stepmania/src/ActorFrame.h index faf92ecd9c..87e9ce2e0d 100644 --- a/stepmania/src/ActorFrame.h +++ b/stepmania/src/ActorFrame.h @@ -93,8 +93,6 @@ public: /* Amount of time until all tweens (and all children's tweens) have stopped: */ virtual float GetTweenTimeLeft() const; - virtual void GainFocus( float fRate, bool bRewindMovie, bool bLoop ); - virtual void LoseFocus(); virtual void PlayCommand( const CString &sCommandName ); virtual void RunCommands( const LuaReference& cmds ); void RunCommands( const apActorCommands& cmds ) { ActorFrame::RunCommands( *cmds ); } // convenience diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index a74775ff11..663ed4a702 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -682,13 +682,6 @@ void BGAnimationLayer::DrawPrimitives() ActorFrame::DrawPrimitives(); } -void BGAnimationLayer::GainFocus( float fRate, bool bRewindMovie, bool bLoop ) -{ - m_fUpdateRate = fRate; - - ActorFrame::GainFocus( fRate, bRewindMovie, bLoop ); -} - /* * (c) 2001-2004 Ben Nordstrom, Chris Danford, Glenn Maynard diff --git a/stepmania/src/BGAnimationLayer.h b/stepmania/src/BGAnimationLayer.h index 2f20308730..fb78899e5b 100644 --- a/stepmania/src/BGAnimationLayer.h +++ b/stepmania/src/BGAnimationLayer.h @@ -25,7 +25,6 @@ public: bool EarlyAbortDraw(); float GetMaxTweenTimeLeft() const; - void GainFocus( float fRate, bool bRewindMovie, bool bLoop ); protected: vector m_vParticleVelocity; diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 0d1bf1899e..5dd0194898 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -21,9 +21,7 @@ #include #include #include "XmlFile.h" - -const CString BACKGROUND_EFFECTS_DIR = "BackgroundEffects/"; -const CString BACKGROUND_TRANSITIONS_DIR = "BackgroundTransitions/"; +#include "BackgroundUtil.h" ThemeMetric LEFT_EDGE ("Background","LeftEdge"); ThemeMetric TOP_EDGE ("Background","TopEdge"); @@ -78,26 +76,27 @@ void Background::Init() // load transitions { ASSERT( m_mapNameToTransition.empty() ); - vector v; - GetDirListing( BACKGROUND_TRANSITIONS_DIR+"*.xml", v, false, true ); - FOREACH( CString, v, sPath ) + vector vsPaths, vsNames; + BackgroundUtil::GetBackgroundTransitions( "", vsPaths, vsNames ); + for( unsigned i=0; i vsResolvedFile; - vsResolvedFile.push_back( bd.m_sFile1 ); - vsResolvedFile.push_back( bd.m_sFile2 ); + vector vsToResolve; + vsToResolve.push_back( bd.m_sFile1 ); + vsToResolve.push_back( bd.m_sFile2 ); - for( unsigned i=0; i vsResolved; + vsResolved.resize( vsToResolve.size() ); + for( unsigned i=0; iSetGlobal( ssprintf("File%d",i+1), CString() ); - CString &sResolvedFile = vsResolvedFile[0]; - if( sResolvedFile.empty() ) + if( sToResolve.empty() ) { if( i == 0 ) return false; @@ -226,17 +228,22 @@ bool Background::Layer::CreateBackground( const Song *pSong, const BackgroundDef // - song's dir // - RandomMovies dir // - BGAnimations dir. - CStringArray asMatches; + CStringArray vsPaths, vsThrowAway; // Look for BGAnims in the song dir - GetDirListing( sResolvedFile+"*", asMatches, false, true ); - if( asMatches.empty() ) GetDirListing( pSong->GetSongDir()+sResolvedFile+"*", asMatches, false, true ); - if( asMatches.empty() ) GetDirListing( RANDOMMOVIES_DIR+sResolvedFile+"*", asMatches, false, true ); - if( asMatches.empty() ) GetDirListing( BG_ANIMS_DIR+sResolvedFile+"*", asMatches, false, true ); + if( sToResolve == SONG_BACKGROUND_FILE ) + vsPaths.push_back( pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathG("Common","fallback background") ); + if( vsPaths.empty() ) BackgroundUtil::GetSongBGAnimations( pSong, sToResolve, vsPaths, vsThrowAway ); + if( vsPaths.empty() ) BackgroundUtil::GetSongMovies( pSong, sToResolve, vsPaths, vsThrowAway ); + if( vsPaths.empty() ) BackgroundUtil::GetSongBitmaps( pSong, sToResolve, vsPaths, vsThrowAway ); + if( vsPaths.empty() ) BackgroundUtil::GetGlobalBGAnimations( sToResolve, vsPaths, vsThrowAway ); + if( vsPaths.empty() ) BackgroundUtil::GetGlobalRandomMovies( sToResolve, vsPaths, vsThrowAway ); - if( !asMatches.empty() ) + CString &sResolved = vsResolved[i]; + + if( !vsPaths.empty() ) { - sResolvedFile = asMatches[0]; + sResolved = vsPaths[0]; } else { @@ -244,45 +251,48 @@ bool Background::Layer::CreateBackground( const Song *pSong, const BackgroundDef if( i == 0 ) return false; else - sResolvedFile = ThemeManager::GetBlankGraphicPath(); + sResolved = ThemeManager::GetBlankGraphicPath(); } - LUA->SetGlobal( ssprintf("File%d",i+1), sResolvedFile ); + ASSERT( !sResolved.empty() ); + + LUA->SetGlobal( ssprintf("File%d",i+1), sResolved ); } CString sEffect = bd.m_sEffect; if( sEffect.empty() ) { - FileType ft = ActorUtil::GetFileType(vsResolvedFile[0]); + FileType ft = ActorUtil::GetFileType(vsResolved[0]); switch( ft ) { + default: + ASSERT(0); // fall through case FT_Bitmap: case FT_Sprite: case FT_Movie: - sEffect = StandardBackgroundEffectToString( SBE_Stretch ); + sEffect = SBE_StretchNormal; break; case FT_Actor: case FT_Directory: case FT_Xml: case FT_Model: - sEffect = StandardBackgroundEffectToString( SBE_Centered ); + sEffect = SBE_Centered; break; - default: - ASSERT(0); } } ASSERT( !sEffect.empty() ); - vector v; - GetDirListing( BACKGROUND_EFFECTS_DIR + sEffect+"*", v, false, true ); - ASSERT( v.size()==1 ); - CString sEffectFile = v[0]; + vector vsPaths, vsThrowAway; + BackgroundUtil::GetBackgroundEffects( sEffect, vsPaths, vsThrowAway ); + ASSERT_M( !vsPaths.empty(), ssprintf("BackgroundEffect '%s' is missing.",sEffect.c_str()) ); + ASSERT_M( vsPaths.size()==1, ssprintf("BackgroundEffect '%s' has more than one match.",sEffect.c_str()) ); + const CString &sEffectFile = vsPaths[0]; Actor *pActor = ActorUtil::MakeActor( sEffectFile ); ASSERT( pActor ); m_BGAnimations[bd] = pActor; - for( unsigned i=0; iSetGlobal( ssprintf("File%d",i+1), CString() ); return true; @@ -309,7 +319,7 @@ BackgroundDef Background::Layer::CreateRandomBGA( const Song *pSong, CString sPr return first; } - CStringArray arrayPaths; + CStringArray vsPaths, vsThrowAway; for( int i=0; i<2; i++ ) { switch( PREFSMAN->m_BackgroundMode ) @@ -318,33 +328,34 @@ BackgroundDef Background::Layer::CreateRandomBGA( const Song *pSong, CString sPr FAIL_M( ssprintf("Invalid BackgroundMode: %i", (PrefsManager::BackgroundMode)PREFSMAN->m_BackgroundMode) ); break; + case PrefsManager::BGMODE_OFF: + break; + case PrefsManager::BGMODE_ANIMATIONS: - GetDirListing( BG_ANIMS_DIR + sPreferredSubDir + "*", arrayPaths, true, true ); + BackgroundUtil::GetGlobalBGAnimations( sPreferredSubDir, vsPaths, vsThrowAway ); break; case PrefsManager::BGMODE_RANDOMMOVIES: - GetDirListing( RANDOMMOVIES_DIR + sPreferredSubDir + "*.avi", arrayPaths, false, true ); - GetDirListing( RANDOMMOVIES_DIR + sPreferredSubDir + "*.mpg", arrayPaths, false, true ); - GetDirListing( RANDOMMOVIES_DIR + sPreferredSubDir + "*.mpeg", arrayPaths, false, true ); + BackgroundUtil::GetGlobalRandomMovies( sPreferredSubDir, vsPaths, vsThrowAway ); break; } // strip out "cvs" - for( int j=arrayPaths.size()-1; j>=0; j-- ) - if( Basename(arrayPaths[j]).CompareNoCase("cvs")==0 ) - arrayPaths.erase( arrayPaths.begin()+j, arrayPaths.begin()+j+1 ); + for( int j=vsPaths.size()-1; j>=0; j-- ) + if( Basename(vsPaths[j]).CompareNoCase("cvs")==0 ) + vsPaths.erase( vsPaths.begin()+j, vsPaths.begin()+j+1 ); - if( !arrayPaths.empty() ) // found one + if( !vsPaths.empty() ) // found one break; // now search without a subdir sPreferredSubDir = ""; } - if( arrayPaths.empty() ) + if( vsPaths.empty() ) return BackgroundDef(); - random_shuffle( arrayPaths.begin(), arrayPaths.end() ); + random_shuffle( vsPaths.begin(), vsPaths.end() ); /* Find the first BackgroundDef in arrayPaths we havn't already loaded. */ BackgroundDef bd; @@ -355,7 +366,7 @@ BackgroundDef Background::Layer::CreateRandomBGA( const Song *pSong, CString sPr loaded.insert( m_RandomBGAnimations[i] ); bool bFound = false; - FOREACH_CONST( CString, arrayPaths, p ) + FOREACH_CONST( CString, vsPaths, p ) { FOREACHD_CONST( BackgroundDef, m_RandomBGAnimations, b ) { @@ -431,7 +442,7 @@ void Background::LoadFromSong( const Song* pSong ) m_pSong = pSong; - STATIC_BACKGROUND_DEF.m_sFile1 = m_pSong->HasBackground() ? m_pSong->GetBackgroundPath() : THEME->GetPathG("Common","fallback background"); + STATIC_BACKGROUND_DEF.m_sFile1 = SONG_BACKGROUND_FILE; if( PREFSMAN->m_fBGBrightness == 0.0f ) return; @@ -499,7 +510,7 @@ void Background::LoadFromSong( const Song* pSong ) for( int i=0; iLoseFocus(); m_pFadingBGA->PlayCommand( "LoseFocus" ); if( !change.m_sTransition.empty() ) @@ -671,7 +681,7 @@ void Background::Layer::UpdateCurBGChange( const Song *pSong, float fLastMusicSe } m_pCurrentBGA->Reset(); - m_pCurrentBGA->GainFocus( change.m_fRate, change.m_bRewindMovie, change.m_bLoop ); + m_pCurrentBGA->SetUpdateRate( change.m_fRate ); m_pCurrentBGA->PlayCommand( "On" ); m_pCurrentBGA->PlayCommand( "GainFocus" ); diff --git a/stepmania/src/Background.h b/stepmania/src/Background.h index ba466f0cb2..f25fe68d5a 100644 --- a/stepmania/src/Background.h +++ b/stepmania/src/Background.h @@ -52,6 +52,7 @@ public: DancingCharacters* GetDancingCharacters() { return m_pDancingCharacters; }; + protected: bool m_bInitted; DancingCharacters* m_pDancingCharacters; diff --git a/stepmania/src/BackgroundUtil.cpp b/stepmania/src/BackgroundUtil.cpp new file mode 100644 index 0000000000..21ff0123b2 --- /dev/null +++ b/stepmania/src/BackgroundUtil.cpp @@ -0,0 +1,169 @@ +#include "global.h" +#include "BackgroundUtil.h" +#include "RageUtil.h" +#include "song.h" +#include "Foreach.h" + +const CString BACKGROUND_EFFECTS_DIR = "BackgroundEffects/"; +const CString BACKGROUND_TRANSITIONS_DIR = "BackgroundTransitions/"; +const CString BG_ANIMS_DIR = "BGAnimations/"; +const CString VISUALIZATIONS_DIR = "Visualizations/"; +const CString RANDOMMOVIES_DIR = "RandomMovies/"; + +static void StripCvs( vector &vsPathsToStrip, vector &vsNamesToStrip ) +{ + ASSERT( vsPathsToStrip.size() == vsNamesToStrip.size() ); + for( unsigned i=0; i &vBackgroundChanges ) +{ + sort( vBackgroundChanges.begin(), vBackgroundChanges.end(), CompareBackgroundChanges ); +} + +void BackgroundUtil::GetBackgroundEffects( const CString &sName, vector &vsPathsOut, vector &vsNamesOut ) +{ + vsPathsOut.clear(); + GetDirListing( BACKGROUND_EFFECTS_DIR+sName+"*.xml", vsPathsOut, false, true ); + + vsNamesOut.clear(); + FOREACH_CONST( CString, vsPathsOut, s ) + vsNamesOut.push_back( GetFileNameWithoutExtension(*s) ); + + StripCvs( vsPathsOut, vsNamesOut ); +} + +void BackgroundUtil::GetBackgroundTransitions( const CString &sName, vector &vsPathsOut, vector &vsNamesOut ) +{ + vsPathsOut.clear(); + GetDirListing( BACKGROUND_TRANSITIONS_DIR+sName+"*.xml", vsPathsOut, false, true ); + + vsNamesOut.clear(); + FOREACH_CONST( CString, vsPathsOut, s ) + vsNamesOut.push_back( GetFileNameWithoutExtension(*s) ); + + StripCvs( vsPathsOut, vsNamesOut ); +} + +void BackgroundUtil::GetSongBGAnimations( const Song *pSong, const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) +{ + vsPathsOut.clear(); + GetDirListing( pSong->GetSongDir()+sMatch+"*", vsPathsOut, true, true ); + + vsNamesOut.clear(); + FOREACH_CONST( CString, vsPathsOut, s ) + vsNamesOut.push_back( Basename(*s) ); + + StripCvs( vsPathsOut, vsNamesOut ); +} + +void BackgroundUtil::GetSongMovies( const Song *pSong, const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) +{ + vsPathsOut.clear(); + GetDirListing( pSong->GetSongDir()+sMatch+"*.avi", vsPathsOut, false, true ); + GetDirListing( pSong->GetSongDir()+sMatch+"*.mpg", vsPathsOut, false, true ); + GetDirListing( pSong->GetSongDir()+sMatch+"*.mpeg", vsPathsOut, false, true ); + + vsNamesOut.clear(); + FOREACH_CONST( CString, vsPathsOut, s ) + vsNamesOut.push_back( Basename(*s) ); + + StripCvs( vsPathsOut, vsNamesOut ); +} + +void BackgroundUtil::GetSongBitmaps( const Song *pSong, const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) +{ + vsPathsOut.clear(); + GetDirListing( pSong->GetSongDir()+sMatch+"*.png", vsPathsOut, false, true ); + GetDirListing( pSong->GetSongDir()+sMatch+"*.jpg", vsPathsOut, false, true ); + GetDirListing( pSong->GetSongDir()+sMatch+"*.gif", vsPathsOut, false, true ); + GetDirListing( pSong->GetSongDir()+sMatch+"*.bmp", vsPathsOut, false, true ); + + vsNamesOut.clear(); + FOREACH_CONST( CString, vsPathsOut, s ) + vsNamesOut.push_back( Basename(*s) ); + + StripCvs( vsPathsOut, vsNamesOut ); +} + +void BackgroundUtil::GetGlobalBGAnimations( const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) +{ + vsPathsOut.clear(); + GetDirListing( BG_ANIMS_DIR+sMatch+"*", vsPathsOut, true, true ); + + vsNamesOut.clear(); + FOREACH_CONST( CString, vsPathsOut, s ) + vsNamesOut.push_back( Basename(*s) ); + + StripCvs( vsPathsOut, vsNamesOut ); +} + +void BackgroundUtil::GetGlobalRandomMovies( const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) +{ + vsPathsOut.clear(); + vsNamesOut.clear(); + + { + GetDirListing( RANDOMMOVIES_DIR+sMatch+"*.avi", vsPathsOut, false, true ); + GetDirListing( RANDOMMOVIES_DIR+sMatch+"*.mpg", vsPathsOut, false, true ); + GetDirListing( RANDOMMOVIES_DIR+sMatch+"*.mpeg", vsPathsOut, false, true ); + + FOREACH_CONST( CString, vsPathsOut, s ) + vsNamesOut.push_back( Basename(*s) ); + } + + vector vSubDirs; + GetDirListing( RANDOMMOVIES_DIR+"*", vSubDirs, true ); + FOREACH_CONST( CString, vSubDirs, sSubDir ) + { + vector v; + GetDirListing( RANDOMMOVIES_DIR+*sSubDir+"/"+sMatch+"*.avi", v, false, true ); + GetDirListing( RANDOMMOVIES_DIR+*sSubDir+"/"+sMatch+"*.mpg", v, false, true ); + GetDirListing( RANDOMMOVIES_DIR+*sSubDir+"/"+sMatch+"*.mpeg", v, false, true ); + + FOREACH_CONST( CString, v, s ) + { + vsPathsOut.push_back( *s ); + vsNamesOut.push_back( *sSubDir+"/"+Basename(*s) ); + } + } + + StripCvs( vsPathsOut, vsNamesOut ); +} + +/* + * (c) 2001-2004 Chris Danford, Ben Nordstrom + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/stepmania/src/BackgroundUtil.h b/stepmania/src/BackgroundUtil.h new file mode 100644 index 0000000000..ecb8fa164c --- /dev/null +++ b/stepmania/src/BackgroundUtil.h @@ -0,0 +1,113 @@ +/* BackgroundUtil - Shared background-related routines. */ + +#ifndef BackgroundUtil_H +#define BackgroundUtil_H + +class Song; + +const CString SBE_Centered = "Centered"; +const CString SBE_StretchNormal = "StretchNormal"; +const CString SBE_StretchNoLoop = "StretchNoLoop"; +const CString SBE_StretchRewind = "StretchRewind"; +const CString SBT_CrossFade = "CrossFade"; + +const CString RANDOM_BACKGROUND_FILE = "-random-"; +const CString SONG_BACKGROUND_FILE = "songbackground"; + +struct BackgroundDef +{ + BackgroundDef() + { + } + bool operator<( const BackgroundDef &other ) const + { +#define COMPARE(x) if( x < other.x ) return true; else if( x > other.x ) return false; + COMPARE( m_sEffect ); + COMPARE( m_sFile1 ); + COMPARE( m_sFile2 ); +#undef COMPARE + return false; + } + bool operator==( const BackgroundDef &other ) const + { + return + m_sEffect == other.m_sEffect && + m_sFile1 == other.m_sFile1 && + m_sFile2 == other.m_sFile2; + } + bool IsEmpty() { return m_sFile1.empty() && m_sFile2.empty(); } + CString m_sEffect; // "" == automatically choose + CString m_sFile1; // must not be "" + CString m_sFile2; // may be "" +}; + +struct BackgroundChange : public BackgroundDef +{ + BackgroundChange() + { + m_fStartBeat=-1; + m_fRate=1; + } + BackgroundChange( + float s, + CString f1, + CString f2=CString(), + float r=1.f, + CString e=SBE_Centered, + CString t=CString() + ) + { + m_fStartBeat=s; + m_sFile1=f1; + m_sFile2=f2; + m_fRate=r; + m_sEffect=e; + m_sTransition=t; + } + float m_fStartBeat; + float m_fRate; + CString m_sTransition; +}; + + +namespace BackgroundUtil +{ + void SortBackgroundChangesArray( vector &vBackgroundChanges ); + + void GetBackgroundEffects( const CString &sName, vector &vsPathsOut, vector &vsNamesOut ); + void GetBackgroundTransitions( const CString &sName, vector &vsPathsOut, vector &vsNamesOut ); + + void GetSongBGAnimations( const Song *pSong, const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); + void GetSongMovies( const Song *pSong, const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); + void GetSongBitmaps( const Song *pSong, const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); + void GetGlobalBGAnimations( const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); + void GetGlobalRandomMovies( const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); +}; + + +#endif + +/* + * (c) 2001-2004 Chris Danford, Ben Nordstrom + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/stepmania/src/GameConstantsAndTypes.cpp b/stepmania/src/GameConstantsAndTypes.cpp index 798ac13b82..261436328d 100644 --- a/stepmania/src/GameConstantsAndTypes.cpp +++ b/stepmania/src/GameConstantsAndTypes.cpp @@ -366,20 +366,6 @@ static const CString StageNames[] = { XToString( Stage, NUM_STAGES ); -static const CString StandardBackgroundEffectNames[] = { - "Centered", - "Stretch", -}; -XToString( StandardBackgroundEffect, NUM_StandardBackgroundEffect ); - -static const CString StandardBackgroundTransitionNames[] = { - "None", - "CrossFade", -}; -XToString( StandardBackgroundTransition, NUM_StandardBackgroundTransition ); - - - /* * (c) 2001-2004 Chris Danford * All rights reserved. diff --git a/stepmania/src/GameConstantsAndTypes.h b/stepmania/src/GameConstantsAndTypes.h index 9c78ee9711..0a8d1e31ed 100644 --- a/stepmania/src/GameConstantsAndTypes.h +++ b/stepmania/src/GameConstantsAndTypes.h @@ -257,9 +257,6 @@ const int NUM_ATTACKS_PER_LEVEL = 3; const int ITEM_NONE = -1; -#define BG_ANIMS_DIR CString("BGAnimations/") -#define VISUALIZATIONS_DIR CString("Visualizations/") -#define RANDOMMOVIES_DIR CString("RandomMovies/") #define DATA_DIR CString("Data/") @@ -419,89 +416,6 @@ enum Stage const CString& StageToString( Stage s ); -enum StandardBackgroundEffect -{ - SBE_Centered, - SBE_Stretch, - NUM_StandardBackgroundEffect -}; -const CString& StandardBackgroundEffectToString( StandardBackgroundEffect sbe ); - -const CString RANDOM_BACKGROUND_FILE = "-random-"; -struct BackgroundDef -{ - BackgroundDef() - { - } - bool operator<( const BackgroundDef &other ) const - { -#define COMPARE(x) if( x < other.x ) return true; else if( x > other.x ) return false; - COMPARE( m_sEffect ); - COMPARE( m_sFile1 ); - COMPARE( m_sFile2 ); -#undef COMPARE - return false; - } - bool operator==( const BackgroundDef &other ) const - { - return - m_sEffect == other.m_sEffect && - m_sFile1 == other.m_sFile1 && - m_sFile2 == other.m_sFile2; - } - bool IsEmpty() { return m_sFile1.empty() && m_sFile2.empty(); } - CString m_sEffect; // "" == automatically choose - CString m_sFile1; // must not be "" - CString m_sFile2; // may be "" -}; - -enum StandardBackgroundTransition -{ - SBT_None, - SBT_CrossFade, - NUM_StandardBackgroundTransition -}; -const CString& StandardBackgroundTransitionToString( StandardBackgroundTransition sbt ); - -struct BackgroundChange : public BackgroundDef -{ - BackgroundChange() - { - m_fStartBeat=-1; - m_fRate=1; - m_bRewindMovie=false; - m_bLoop=true; - } - BackgroundChange( - float s, - CString f1, - CString f2=CString(), - float r=1.f, - bool m=false, - bool l=true, - CString e=StandardBackgroundEffectToString(SBE_Centered), - CString t=CString() - ) - { - m_fStartBeat=s; - m_sFile1=f1; - m_sFile2=f2; - m_fRate=r; - m_bRewindMovie=m; - m_bLoop=l; - m_sEffect=e; - m_sTransition=t; - } - float m_fStartBeat; - float m_fRate; - bool m_bRewindMovie; - bool m_bLoop; - CString m_sTransition; -}; - -void SortBackgroundChangesArray( vector &arrayBackgroundChanges ); - - #endif /* diff --git a/stepmania/src/Makefile.am b/stepmania/src/Makefile.am index c2ff271f51..643496773f 100644 --- a/stepmania/src/Makefile.am +++ b/stepmania/src/Makefile.am @@ -64,6 +64,7 @@ endif DataStructures = \ ActorCommands.cpp ActorCommands.h Attack.cpp Attack.h AutoKeysounds.cpp AutoKeysounds.h \ +BackgroundUtil.cpp BackgroundUtil.h \ BannerCache.cpp BannerCache.h CatalogXml.cpp CatalogXml.h \ Character.cpp Character.h CharacterHead.cpp CharacterHead.h \ CodeDetector.cpp CodeDetector.h \ diff --git a/stepmania/src/NoteField.cpp b/stepmania/src/NoteField.cpp index a4c57dcbe0..265d4a80de 100644 --- a/stepmania/src/NoteField.cpp +++ b/stepmania/src/NoteField.cpp @@ -541,14 +541,13 @@ void NoteField::DrawPrimitives() aBackgroundChanges[i].m_fStartBeat <= fLastBeatToDraw ) { const BackgroundChange& change = aBackgroundChanges[i]; - CString sChangeText = ssprintf("%s%s%s%s%s%s%s", + CString sChangeText = ssprintf("%s%s%s%s%s%s", ((b!=0) ? ssprintf("%d: ",b) : CString()).c_str(), (!change.m_sFile1.empty() ? " "+change.m_sFile1 : CString()).c_str(), (!change.m_sFile2.empty() ? " "+change.m_sFile2 : CString()).c_str(), ((change.m_fRate!=1.0f) ? ssprintf("%.2f%%",change.m_fRate*100) : CString()).c_str(), - change.m_bRewindMovie ? " Rewind" : "", - change.m_bLoop ? " Loop" : "" , - (!change.m_sTransition.empty() ? " "+change.m_sTransition : CString()).c_str() + (!change.m_sTransition.empty() ? " "+change.m_sTransition : CString()).c_str(), + (!change.m_sEffect.empty() ? " "+change.m_sEffect : CString()).c_str() ); if( IS_ON_SCREEN(change.m_fStartBeat) ) DrawBGChangeText( change.m_fStartBeat, sChangeText ); diff --git a/stepmania/src/NotesLoaderSM.cpp b/stepmania/src/NotesLoaderSM.cpp index ecfb9e6199..fc210c26cf 100644 --- a/stepmania/src/NotesLoaderSM.cpp +++ b/stepmania/src/NotesLoaderSM.cpp @@ -165,13 +165,20 @@ bool LoadFromBGChangesString( BackgroundChange &change, const CString &sBGChange { change.m_fRate = strtof( aBGChangeValues[2], NULL ); change.m_sTransition = (atoi( aBGChangeValues[3] ) != 0) ? "CrossFade" : ""; - change.m_bRewindMovie = atoi( aBGChangeValues[4] ) != 0; - change.m_bLoop = atoi( aBGChangeValues[5] ) != 0; + bool bRewindMovie = atoi( aBGChangeValues[4] ) != 0; + bool bLoop = atoi( aBGChangeValues[5] ) != 0; + + // m_sEffect may be overwritten by param 7 below. + if( bRewindMovie ) + change.m_sEffect = SBE_StretchRewind; + if( !bLoop ) + change.m_sEffect = SBE_StretchNoLoop; } - if( aBGChangeValues.size() >= 8 ) + if( aBGChangeValues.size() >= 9 ) { - change.m_sFile1 = aBGChangeValues[6]; - change.m_sTransition = aBGChangeValues[7]; + change.m_sEffect = aBGChangeValues[6]; + change.m_sFile2 = aBGChangeValues[7]; + change.m_sTransition = aBGChangeValues[8]; } if( aBGChangeValues.size() >= 2 ) { diff --git a/stepmania/src/NotesWriterSM.cpp b/stepmania/src/NotesWriterSM.cpp index 940eece52d..38d90aae13 100644 --- a/stepmania/src/NotesWriterSM.cpp +++ b/stepmania/src/NotesWriterSM.cpp @@ -14,7 +14,18 @@ static CString BackgroundChangeToString( const BackgroundChange &bgc ) { - return ssprintf( "%.3f=%s=%.3f=%d=%d=%d=%s,", bgc.m_fStartBeat, bgc.m_sFile1.c_str(), bgc.m_fRate, bgc.m_sTransition=="CrossFade", bgc.m_bRewindMovie, bgc.m_bLoop, bgc.m_sFile2.c_str(), bgc.m_sTransition ); + return ssprintf( + "%.3f=%s=%.3f=%d=%d=%d=%s=%s=%s,", + bgc.m_fStartBeat, + bgc.m_sFile1.c_str(), + bgc.m_fRate, + bgc.m_sTransition == SBT_CrossFade, // backward compat + bgc.m_sEffect == SBE_StretchRewind, // backward compat + bgc.m_sEffect != SBE_StretchNoLoop, // backward compat + bgc.m_sEffect.c_str(), + bgc.m_sFile2.c_str(), + bgc.m_sTransition.c_str() + ); } void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out ) @@ -39,12 +50,9 @@ void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out ) f.Write( "#SELECTABLE:" ); switch(out.m_SelectionDisplay) { default: ASSERT(0); /* fallthrough */ - case Song::SHOW_ALWAYS: - f.Write( "YES" ); break; - case Song::SHOW_NEVER: - f.Write( "NO" ); break; - case Song::SHOW_ROULETTE: - f.Write( "ROULETTE" ); break; + case Song::SHOW_ALWAYS: f.Write( "YES" ); break; + case Song::SHOW_NEVER: f.Write( "NO" ); break; + case Song::SHOW_ROULETTE: f.Write( "ROULETTE" ); break; } f.PutLine( ";" ); diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index bdcdb368e8..f91d2ce119 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -519,6 +519,13 @@ CString GetExtension( const CString &sPath ) return sPath.substr( pos+1, sPath.size()-pos+1 ); } +CString GetFileNameWithoutExtension( const CString &sPath ) +{ + CString sThrowAway, sFName; + splitpath( sPath, sThrowAway, sFName, sThrowAway ); + return sFName; +} + CString GetCwd() { #ifdef _XBOX diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index 9212d9fc80..6c45caccb3 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -241,6 +241,7 @@ void splitpath( const CString &Path, CString &Dir, CString &Filename, CString &E CString SetExtension( const CString &path, const CString &ext ); CString GetExtension( const CString &sPath ); +CString GetFileNameWithoutExtension( const CString &sPath ); typedef int longchar; extern const wchar_t INVALID_CHAR; diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 0c722fa8e4..849c9e8124 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -33,6 +33,7 @@ #include "ScreenPlayerOptions.h" // for SM_BackFromPlayerOptions #include "ScreenSongOptions.h" // for SM_BackFromSongOptions #include +#include "BackgroundUtil.h" // // Defines specific to ScreenEdit @@ -322,11 +323,12 @@ const MapEditToDI *ScreenEdit::GetCurrentMap() const } } + static Menu g_EditHelp( "ScreenMiniMenuEditHelp", #if defined(XBOX) - MenuRow( -1, "L + Up/Down: Change zoom", false, EDIT_MODE_PRACTICE, 0, NULL ), - MenuRow( -1, "R + Up/Down: Drag area marker", false, EDIT_MODE_PRACTICE, 0, NULL ), + MenuRow( -1, "L + Up/Down: Change zoom", false, NULL, EDIT_MODE_PRACTICE, 0, NULL ), + MenuRow( -1, "R + Up/Down: Drag area marker", false, NULL, EDIT_MODE_PRACTICE, 0, NULL ), MenuRow( -1, "L + Select: Play selection", false, EDIT_MODE_PRACTICE, 0, NULL ), MenuRow( -1, "R + Start: Play whole song", false, EDIT_MODE_PRACTICE, 0, NULL ), MenuRow( -1, "R + Select: Record", false, EDIT_MODE_PRACTICE, 0, NULL ), @@ -439,30 +441,48 @@ static Menu g_SongInformation( MenuRow( ScreenEdit::artist_transliteration, "Artist transliteration", true, EDIT_MODE_PRACTICE, 0, NULL ) ); +enum { none, random, song_bganimation, song_movie, song_bitmap, global_bganimation, global_movie }; +static bool EnabledIfSet1SB(); +static bool EnabledIfSet1SM(); +static bool EnabledIfSet1SI(); +static bool EnabledIfSet1GB(); +static bool EnabledIfSet1GM(); +static bool EnabledIfSet2SB(); +static bool EnabledIfSet2SM(); +static bool EnabledIfSet2SI(); +static bool EnabledIfSet2GB(); +static bool EnabledIfSet2GM(); static Menu g_BackgroundChange( "ScreenMiniMenuBackgroundChange", - MenuRow( ScreenEdit::layer, "Layer", true, EDIT_MODE_FULL, 0, "0","1" ), - MenuRow( ScreenEdit::rate, "Rate", true, EDIT_MODE_FULL, 10, "0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%","120%","140%","160%","180%","200%" ), - MenuRow( ScreenEdit::rewind_movie, "Rewind Movie", true, EDIT_MODE_FULL, 0, "NO","YES" ), - MenuRow( ScreenEdit::loop, "Loop", true, EDIT_MODE_FULL, 1, "NO","YES" ), - MenuRow( ScreenEdit::transition, "Transition", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::effect, "Effect", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::file1_type, "file1_type", true, EDIT_MODE_FULL, 0, "None", "Random", "Song BGAnimation", "Song Movie", "Song Still", "Global BGAnimation", "Global Movie" ), - MenuRow( ScreenEdit::file1_song_bganimation, "file1_type Song BGAnimation", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::file1_song_movie, "file1_type Song Movie", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::file1_song_still, "file1_type Song Still", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::file1_global_random_movie, "file1_type Global Random Movie", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::file1_global_bganimation, "file1_type Global BGAnimation", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::file1_global_bganimation, "file1_type Global Visualization", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::file2_type, "file2_type", true, EDIT_MODE_FULL, 0, "None", "Random", "Song BGAnimation", "Song Movie", "Song Still", "Global BGAnimation", "Global Movie" ), - MenuRow( ScreenEdit::file2_song_bganimation, "file2_type Song BGAnimation", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::file2_song_movie, "file2_type Song Movie", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::file2_song_still, "file2_type Song Still", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::file2_global_random_movie, "file2_type Global Random Movie", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::file2_global_bganimation, "file2_type Global BGAnimation", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::file2_global_bganimation, "file2_type Global Visualization", true, EDIT_MODE_FULL, 0, NULL ), - MenuRow( ScreenEdit::delete_change, "Remove Change", true, EDIT_MODE_FULL, 0, NULL ) + MenuRow( ScreenEdit::layer, "Layer", true, EDIT_MODE_FULL, 0, "0","1" ), + MenuRow( ScreenEdit::rate, "Rate", true, EDIT_MODE_FULL, 10, "0%","10%","20%","30%","40%","50%","60%","70%","80%","90%","100%","120%","140%","160%","180%","200%" ), + MenuRow( ScreenEdit::transition, "Transition", true, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::effect, "Force Effect", true, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file1_type, "File1 Type", true, EDIT_MODE_FULL, 0, "None", "Random", "Song BGAnimation", "Song Movie", "Song Bitmap", "Global BGAnimation", "Global Movie" ), + MenuRow( ScreenEdit::file1_song_bganimation, "File1 Song BGAnimation", EnabledIfSet1SB,EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file1_song_movie, "File1 Song Movie", EnabledIfSet1SM,EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file1_song_still, "File1 Song Still", EnabledIfSet1SI,EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file1_global_bganimation, "File1 Global BGAnimation", EnabledIfSet1GB,EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file1_global_random_movie, "File1 Global Random Movie", EnabledIfSet1GM,EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file2_type, "File2 Type", true, EDIT_MODE_FULL, 0, "None", "Random", "Song BGAnimation", "Song Movie", "Song Bitmap", "Global BGAnimation", "Global Movie" ), + MenuRow( ScreenEdit::file2_song_bganimation, "File2 Song BGAnimation", EnabledIfSet2SB,EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file2_song_movie, "File2 Song Movie", EnabledIfSet2SM,EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file2_song_still, "File2 Song Still", EnabledIfSet2SI,EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file2_global_bganimation, "File2 Global BGAnimation", EnabledIfSet2GB,EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file2_global_random_movie, "File2 Global Random Movie", EnabledIfSet2GM,EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::delete_change, "Remove Change", true, EDIT_MODE_FULL, 0, NULL ) ); +static bool EnabledIfSet1SB() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file1_type] == song_bganimation && !g_BackgroundChange.rows[ScreenEdit::file1_song_bganimation].choices.empty(); } +static bool EnabledIfSet1SM() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file1_type] == song_movie && !g_BackgroundChange.rows[ScreenEdit::file1_song_movie].choices.empty(); } +static bool EnabledIfSet1SI() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file1_type] == song_bitmap && !g_BackgroundChange.rows[ScreenEdit::file1_song_still].choices.empty(); } +static bool EnabledIfSet1GB() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file1_type] == global_bganimation && !g_BackgroundChange.rows[ScreenEdit::file1_global_random_movie].choices.empty(); } +static bool EnabledIfSet1GM() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file1_type] == global_movie && !g_BackgroundChange.rows[ScreenEdit::file1_global_bganimation].choices.empty(); } +static bool EnabledIfSet2SB() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file2_type] == song_bganimation && !g_BackgroundChange.rows[ScreenEdit::file2_song_bganimation].choices.empty(); } +static bool EnabledIfSet2SM() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file2_type] == song_movie && !g_BackgroundChange.rows[ScreenEdit::file2_song_movie].choices.empty(); } +static bool EnabledIfSet2SI() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file2_type] == song_bitmap && !g_BackgroundChange.rows[ScreenEdit::file2_song_still].choices.empty(); } +static bool EnabledIfSet2GB() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file2_type] == global_bganimation && !g_BackgroundChange.rows[ScreenEdit::file2_global_bganimation].choices.empty(); } +static bool EnabledIfSet2GM() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file2_type] == global_movie && !g_BackgroundChange.rows[ScreenEdit::file2_global_bganimation].choices.empty(); } + static Menu g_Prefs( "ScreenMiniMenuPreferences", @@ -2036,47 +2056,20 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector &iAns // // Fill in option names // + vector vThrowAway; - // m_pSong->GetSongDir() has trailing slash - g_BackgroundChange.rows[file1_song_bganimation].choices.clear(); - GetDirListing( m_pSong->GetSongDir()+"*", g_BackgroundChange.rows[file1_song_bganimation].choices, true ); + BackgroundUtil::GetBackgroundTransitions( "", vThrowAway, g_BackgroundChange.rows[transition].choices ); + g_BackgroundChange.rows[transition].choices.insert( g_BackgroundChange.rows[transition].choices.begin(), "" ); // add "no transition" + BackgroundUtil::GetBackgroundEffects( "", vThrowAway, g_BackgroundChange.rows[effect].choices ); + g_BackgroundChange.rows[effect].choices.insert( g_BackgroundChange.rows[effect].choices.begin(), "" ); // add "default effect" - g_BackgroundChange.rows[file1_song_movie].choices.clear(); - GetDirListing( m_pSong->GetSongDir()+"*.avi", g_BackgroundChange.rows[file1_song_movie].choices, false ); - GetDirListing( m_pSong->GetSongDir()+"*.mpg", g_BackgroundChange.rows[file1_song_movie].choices, false ); - GetDirListing( m_pSong->GetSongDir()+"*.mpeg", g_BackgroundChange.rows[file1_song_movie].choices, false ); + BackgroundUtil::GetSongBGAnimations( m_pSong, "", vThrowAway, g_BackgroundChange.rows[file1_song_bganimation].choices ); + BackgroundUtil::GetSongMovies( m_pSong, "", vThrowAway, g_BackgroundChange.rows[file1_song_movie].choices ); + BackgroundUtil::GetSongBitmaps( m_pSong, "", vThrowAway, g_BackgroundChange.rows[file1_song_still].choices ); + BackgroundUtil::GetGlobalBGAnimations( "", vThrowAway, g_BackgroundChange.rows[file1_global_bganimation].choices ); + BackgroundUtil::GetGlobalRandomMovies( "", vThrowAway, g_BackgroundChange.rows[file1_global_random_movie].choices ); - g_BackgroundChange.rows[file1_song_still].choices.clear(); - GetDirListing( m_pSong->GetSongDir()+"*.png", g_BackgroundChange.rows[file1_song_still].choices, false ); - GetDirListing( m_pSong->GetSongDir()+"*.jpg", g_BackgroundChange.rows[file1_song_still].choices, false ); - GetDirListing( m_pSong->GetSongDir()+"*.gif", g_BackgroundChange.rows[file1_song_still].choices, false ); - GetDirListing( m_pSong->GetSongDir()+"*.bmp", g_BackgroundChange.rows[file1_song_still].choices, false ); - - g_BackgroundChange.rows[file1_global_random_movie].choices.clear(); - GetDirListing( RANDOMMOVIES_DIR+"*.avi", g_BackgroundChange.rows[file1_global_random_movie].choices, false ); - GetDirListing( RANDOMMOVIES_DIR+"*.mpg", g_BackgroundChange.rows[file1_global_random_movie].choices, false ); - GetDirListing( RANDOMMOVIES_DIR+"*.mpeg", g_BackgroundChange.rows[file1_global_random_movie].choices, false ); - - vector vSubDirs; - GetDirListing( RANDOMMOVIES_DIR+"*", vSubDirs, true ); - FOREACH_CONST( CString, vSubDirs, s ) - { - const CString &sSubDir = *s; - vector vsMovies; - - GetDirListing( RANDOMMOVIES_DIR+sSubDir+"/*.avi", vsMovies, false ); - GetDirListing( RANDOMMOVIES_DIR+sSubDir+"/*.mpg", vsMovies, false ); - GetDirListing( RANDOMMOVIES_DIR+sSubDir+"/*.mpeg", vsMovies, false ); - - FOREACH_CONST( CString, vsMovies, m ) - g_BackgroundChange.rows[file1_global_random_movie].choices.push_back( sSubDir +"/"+ *m ); - } - - g_BackgroundChange.rows[file1_global_bganimation].choices.clear(); - GetDirListing( BG_ANIMS_DIR+"*", g_BackgroundChange.rows[file1_global_bganimation].choices, true ); - - - g_BackgroundChange.rows[file2_type].choices = g_BackgroundChange.rows[file1_type].choices; + g_BackgroundChange.rows[file2_type].choices = g_BackgroundChange.rows[file1_type].choices; g_BackgroundChange.rows[file2_song_bganimation].choices = g_BackgroundChange.rows[file1_song_bganimation].choices; g_BackgroundChange.rows[file2_song_movie].choices = g_BackgroundChange.rows[file1_song_movie].choices; g_BackgroundChange.rows[file2_song_still].choices = g_BackgroundChange.rows[file1_song_still].choices; @@ -2103,39 +2096,42 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector &iAns } } - g_BackgroundChange.rows[file1_type].bEnabled = true; - g_BackgroundChange.rows[file1_song_bganimation].bEnabled = g_BackgroundChange.rows[file1_song_bganimation].choices.size() > 0; - g_BackgroundChange.rows[file1_song_movie].bEnabled = g_BackgroundChange.rows[file1_song_movie].choices.size() > 0; - g_BackgroundChange.rows[file1_song_still].bEnabled = g_BackgroundChange.rows[file1_song_still].choices.size() > 0; - g_BackgroundChange.rows[file1_global_random_movie].bEnabled = g_BackgroundChange.rows[file1_global_random_movie].choices.size() > 0; - g_BackgroundChange.rows[file1_global_bganimation].bEnabled = g_BackgroundChange.rows[file1_global_bganimation].choices.size() > 0; - g_BackgroundChange.rows[file2_type].bEnabled = g_BackgroundChange.rows[file1_type].bEnabled; - g_BackgroundChange.rows[file2_song_bganimation].bEnabled = g_BackgroundChange.rows[file1_song_bganimation].bEnabled; - g_BackgroundChange.rows[file2_song_movie].bEnabled = g_BackgroundChange.rows[file1_song_movie].bEnabled; - g_BackgroundChange.rows[file2_song_still].bEnabled = g_BackgroundChange.rows[file1_song_still].bEnabled; - g_BackgroundChange.rows[file2_global_random_movie].bEnabled = g_BackgroundChange.rows[file1_global_random_movie].bEnabled; - g_BackgroundChange.rows[file2_global_bganimation].bEnabled = g_BackgroundChange.rows[file1_global_bganimation].bEnabled; +#define FILL_ENABLED( x ) g_BackgroundChange.rows[x].bEnabled = g_BackgroundChange.rows[x].choices.size() > 0; + FILL_ENABLED( transition ); + FILL_ENABLED( effect ); + FILL_ENABLED( file1_song_bganimation ); + FILL_ENABLED( file1_song_movie ); + FILL_ENABLED( file1_song_still ); + FILL_ENABLED( file1_global_random_movie ); + FILL_ENABLED( file1_global_bganimation ); + FILL_ENABLED( file2_song_bganimation ); + FILL_ENABLED( file2_song_movie ); + FILL_ENABLED( file2_song_still ); + FILL_ENABLED( file2_global_random_movie ); + FILL_ENABLED( file2_global_bganimation ); +#undef FILL_ENABLED g_BackgroundChange.rows[delete_change].bEnabled = bAlreadyBGChangeHere; // set default choices g_BackgroundChange.rows[layer]. SetDefaultChoiceIfPresent( ssprintf("%d",iLayer) ); g_BackgroundChange.rows[rate]. SetDefaultChoiceIfPresent( ssprintf("%2.0f%%",bgChange.m_fRate*100) ); - g_BackgroundChange.rows[rewind_movie].iDefaultChoice= bgChange.m_bRewindMovie ? 1 : 0; - g_BackgroundChange.rows[loop].iDefaultChoice = bgChange.m_bLoop ? 1 : 0; g_BackgroundChange.rows[transition]. SetDefaultChoiceIfPresent( bgChange.m_sTransition ); - g_BackgroundChange.rows[file1_type].iDefaultChoice = 0; // FIXME - g_BackgroundChange.rows[file1_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ); - g_BackgroundChange.rows[file1_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ); - g_BackgroundChange.rows[file1_song_still]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ); - g_BackgroundChange.rows[file1_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ); - g_BackgroundChange.rows[file1_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ); - g_BackgroundChange.rows[file2_type].iDefaultChoice = 0; // FIXME - g_BackgroundChange.rows[file2_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ); - g_BackgroundChange.rows[file2_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ); - g_BackgroundChange.rows[file2_song_still]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ); - g_BackgroundChange.rows[file2_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ); - g_BackgroundChange.rows[file2_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ); + g_BackgroundChange.rows[effect]. SetDefaultChoiceIfPresent( bgChange.m_sEffect ); + g_BackgroundChange.rows[file1_type].iDefaultChoice = none; + if( bgChange.m_sFile1 == RANDOM_BACKGROUND_FILE ) g_BackgroundChange.rows[file1_type].iDefaultChoice = random; + if( g_BackgroundChange.rows[file1_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = song_bganimation; + if( g_BackgroundChange.rows[file1_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = song_movie; + if( g_BackgroundChange.rows[file1_song_still]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = song_bitmap; + if( g_BackgroundChange.rows[file1_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = global_bganimation; + if( g_BackgroundChange.rows[file1_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = global_movie; + g_BackgroundChange.rows[file2_type].iDefaultChoice = none; + if( bgChange.m_sFile2 == RANDOM_BACKGROUND_FILE ) g_BackgroundChange.rows[file2_type].iDefaultChoice = random; + if( g_BackgroundChange.rows[file2_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = song_bganimation; + if( g_BackgroundChange.rows[file2_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = song_movie; + if( g_BackgroundChange.rows[file2_song_still]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = song_bitmap; + if( g_BackgroundChange.rows[file2_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = global_bganimation; + if( g_BackgroundChange.rows[file2_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = global_movie; SCREENMAN->MiniMenu( &g_BackgroundChange, SM_BackFromBGChange ); @@ -2666,13 +2662,40 @@ void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, const vector &iAns newChange.m_fStartBeat = GAMESTATE->m_fSongBeat; newChange.m_fRate = strtof( g_BackgroundChange.rows[rate].choices[iAnswers[rate]], NULL )/100.f; - newChange.m_bRewindMovie = !!iAnswers[rewind_movie]; - newChange.m_bLoop = !!iAnswers[loop]; newChange.m_sTransition = g_BackgroundChange.rows[transition].choices[iAnswers[transition]]; - int iRow1 = file1_song_bganimation + iAnswers[file1_type]; - newChange.m_sFile1 = g_BackgroundChange.rows[iRow1].choices[iAnswers[iRow1]]; - int iRow2 = file2_song_bganimation + iAnswers[file2_type]; - newChange.m_sFile2 = g_BackgroundChange.rows[iRow2].choices[iAnswers[iRow2]]; + newChange.m_sEffect = g_BackgroundChange.rows[effect].choices[iAnswers[effect]]; + switch( iAnswers[file1_type] ) + { + default: ASSERT(0); + case none: newChange.m_sFile1 = ""; break; + case random: newChange.m_sFile1 = RANDOM_BACKGROUND_FILE; break; + case song_bganimation: + case song_movie: + case song_bitmap: + case global_bganimation: + case global_movie: + { + BGChangeChoice row1 = (BGChangeChoice)(file1_song_bganimation + iAnswers[file1_type]-2); + newChange.m_sFile1 = g_BackgroundChange.rows[row1].choices[iAnswers[row1]]; + } + break; + } + switch( iAnswers[file2_type] ) + { + default: ASSERT(0); + case none: newChange.m_sFile2 = ""; break; + case random: newChange.m_sFile2 = RANDOM_BACKGROUND_FILE; break; + case song_bganimation: + case song_movie: + case song_bitmap: + case global_bganimation: + case global_movie: + { + BGChangeChoice row2 = (BGChangeChoice)(file2_song_bganimation + iAnswers[file2_type]-2); + newChange.m_sFile2 = g_BackgroundChange.rows[row2].choices[iAnswers[row2]]; + } + break; + } m_pSong->AddBackgroundChange( iLayer, newChange ); } diff --git a/stepmania/src/ScreenEdit.h b/stepmania/src/ScreenEdit.h index 57fbd690e3..d8e1c33f85 100644 --- a/stepmania/src/ScreenEdit.h +++ b/stepmania/src/ScreenEdit.h @@ -366,22 +366,20 @@ public: enum BGChangeChoice { layer, rate, - rewind_movie, - loop, transition, effect, file1_type, file1_song_bganimation, file1_song_movie, file1_song_still, - file1_global_random_movie, file1_global_bganimation, + file1_global_random_movie, file2_type, file2_song_bganimation, file2_song_movie, file2_song_still, - file2_global_random_movie, file2_global_bganimation, + file2_global_random_movie, delete_change, NUM_BGCHANGE_CHOICES }; diff --git a/stepmania/src/ScreenMiniMenu.cpp b/stepmania/src/ScreenMiniMenu.cpp index b16e40cb57..6f113bbffe 100644 --- a/stepmania/src/ScreenMiniMenu.cpp +++ b/stepmania/src/ScreenMiniMenu.cpp @@ -53,30 +53,30 @@ void ScreenMiniMenu::Init( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMe for( unsigned r=0; r vpns; + vpns.push_back( GAMESTATE->m_MasterPlayerNumber ); + for( unsigned i=0; im_MasterPlayerNumber ); + } + } + UpdateEnabledDisabled(); +} + void ScreenMiniMenu::ImportOptions( int r, const vector &vpns ) { OptionRow &optrow = *m_Rows[r]; diff --git a/stepmania/src/ScreenMiniMenu.h b/stepmania/src/ScreenMiniMenu.h index 51584e0218..187a82e933 100644 --- a/stepmania/src/ScreenMiniMenu.h +++ b/stepmania/src/ScreenMiniMenu.h @@ -10,30 +10,56 @@ #include "RageSound.h" #include "BGAnimation.h" +typedef bool (*MenuRowUpdateEnabled)(); + struct MenuRow { - int iRowCode; - CString sName; - bool bEnabled; - EditMode emShowIn; - int iDefaultChoice; + int iRowCode; + CString sName; + bool bEnabled; + MenuRowUpdateEnabled pfnEnabled; // if ! NULL, used to fill bEnabled + EditMode emShowIn; + int iDefaultChoice; vector choices; MenuRow() {} + MenuRow( int r, CString n, MenuRowUpdateEnabled pe, EditMode s, int d, 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 ) + { + iRowCode = r; + sName = n; + bEnabled = true; + pfnEnabled = pe; + emShowIn = s; + iDefaultChoice = d; +#define PUSH( c ) if(c) 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(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19); +#undef PUSH + } MenuRow( int r, CString n, bool e, EditMode s, int d, 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 ) { - iRowCode = r; sName = n; bEnabled = e; emShowIn = s; iDefaultChoice = d; + iRowCode = r; + sName = n; + bEnabled = e; + pfnEnabled = NULL; + emShowIn = s; + iDefaultChoice = d; #define PUSH( c ) if(c) 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(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19); #undef PUSH } - void SetDefaultChoiceIfPresent( CString sChoice ) + bool SetDefaultChoiceIfPresent( CString sChoice ) { iDefaultChoice = 0; FOREACH_CONST( CString, choices, s ) + { if( sChoice == *s ) + { iDefaultChoice = s - choices.begin(); + return true; + } + } + return false; } }; @@ -58,6 +84,7 @@ public: ScreenMiniMenu( CString sScreenClass ); void Init( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel ); protected: + virtual void OnChange( PlayerNumber pn ); virtual void ImportOptions( int row, const vector &vpns ); virtual void ExportOptions( int row, const vector &vpns ); diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 79626e5f67..0fd628cd6b 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -44,18 +44,6 @@ const int FILE_CACHE_VERSION = 144; // increment this to invalidate cache const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f; - -int CompareBackgroundChanges(const BackgroundChange &seg1, const BackgroundChange &seg2) -{ - return seg1.m_fStartBeat < seg2.m_fStartBeat; -} - -void SortBackgroundChangesArray( vector &arrayBackgroundChanges ) -{ - sort( arrayBackgroundChanges.begin(), arrayBackgroundChanges.end(), CompareBackgroundChanges ); -} - - ////////////////////////////// // Song ////////////////////////////// @@ -114,13 +102,13 @@ void Song::AddBackgroundChange( int iLayer, BackgroundChange seg ) { ASSERT( iLayer >= 0 && iLayer < NUM_BACKGROUND_LAYERS ); m_BackgroundChanges[iLayer].push_back( seg ); - SortBackgroundChangesArray( m_BackgroundChanges[iLayer] ); + BackgroundUtil::SortBackgroundChangesArray( m_BackgroundChanges[iLayer] ); } void Song::AddForegroundChange( BackgroundChange seg ) { m_ForegroundChanges.push_back( seg ); - SortBackgroundChangesArray( m_ForegroundChanges ); + BackgroundUtil::SortBackgroundChangesArray( m_ForegroundChanges ); } void Song::AddLyricSegment( LyricSegment seg ) @@ -721,7 +709,7 @@ void Song::TidyUpData() /* Use this->GetBeatFromElapsedTime(0) instead of 0 to start when the * music starts. */ if( arrayPossibleMovies.size() == 1 ) - this->AddBackgroundChange( 0, BackgroundChange(0,arrayPossibleMovies[0],"",1.f,true,true,false) ); + this->AddBackgroundChange( 0, BackgroundChange(0,arrayPossibleMovies[0],"",1.f,SBE_StretchNoLoop) ); } diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index e5ee3faa69..6c886f5b8c 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -925,64 +925,6 @@ void Sprite::SetPosition( float f ) { GetTexture()->SetPosition(f); } void Sprite::SetLooping( bool b ) { GetTexture()->SetLooping(b); } void Sprite::SetPlaybackRate( float f ) { GetTexture()->SetPlaybackRate(f); } -/* -void Sprite::HandleCommand( const Command &command ) -{ - BeginHandleArgs; - - const CString& sName = command.GetName(); - - // Commands that go in the tweening queue: - // Commands that take effect immediately (ignoring the tweening queue): - if( sName=="customtexturerect" ) SetCustomTextureRect( RectF(fArg(1),fArg(2),fArg(3),fArg(4)) ); - else if( sName=="texcoordvelocity" ) SetTexCoordVelocity( fArg(1),fArg(2) ); - else if( sName=="scaletoclipped" ) ScaleToClipped( fArg(1),fArg(2) ); - else if( sName=="stretchtexcoords" ) StretchTexCoords( fArg(1),fArg(2) ); - - // Texture commands; these could be moved to RageTexture* (even though that's - // not an Actor) if these are needed for other things that use textures. - // We'd need to break the command helpers into a separate function; RageTexture - // shouldn't depend on Actor. - else if( sName=="position" ) GetTexture()->SetPosition( fArg(1) ); - else if( sName=="loop" ) GetTexture()->SetLooping( bArg(1) ); - else if( sName=="rate" ) GetTexture()->SetPlaybackRate( fArg(1) ); - else - { - Actor::HandleCommand( command ); - return; - } - - EndHandleArgs; -} -*/ - -void Sprite::GainFocus( float fRate, bool bRewindMovie, bool bLoop ) -{ - // - // The order of these actions is important. - // At this point, the movie is probably paused (by LoseFocus()). - // Play the movie, then set the playback rate (which can - // potentially pause the movie again). - // - RageTexture *pTexture = GetTexture(); - if( pTexture != NULL ) - { - if( bRewindMovie ) - pTexture->SetPosition( 0 ); - pTexture->SetLooping( bLoop ); - pTexture->SetPlaybackRate( fRate ); - } - EnableAnimation( true ); - - Actor::GainFocus( fRate, bRewindMovie, bLoop ); -} - -void Sprite::LoseFocus() -{ - EnableAnimation( false ); - - Actor::LoseFocus(); -} /* * (c) 2001-2004 Chris Danford diff --git a/stepmania/src/Sprite.h b/stepmania/src/Sprite.h index 06fceae58b..1338cca046 100644 --- a/stepmania/src/Sprite.h +++ b/stepmania/src/Sprite.h @@ -20,9 +20,6 @@ public: virtual void DrawPrimitives(); virtual void Update( float fDeltaTime ); - virtual void GainFocus( float fRate, bool bRewindMovie, bool bLoop ); - virtual void LoseFocus(); - void UpdateAnimationState(); // take m_fSecondsIntoState, and move to a new state /* Adjust texture properties for song backgrounds. */ diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 8da83805cd..6536ae9652 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -59,10 +59,10 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib # Begin Special Build Tool IntDir=.\../Debug6 -TargetDir=\StepMania\Program +TargetDir=\stepmania\Program TargetName=StepMania-debug SOURCE="$(InputPath)" -PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -96,10 +96,10 @@ LINK32=link.exe # SUBTRACT LINK32 /pdb:none # Begin Special Build Tool IntDir=.\../Release6 -TargetDir=\StepMania\Program +TargetDir=\stepmania\Program TargetName=StepMania SOURCE="$(InputPath)" -PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -684,6 +684,14 @@ SOURCE=.\AutoKeysounds.h # End Source File # Begin Source File +SOURCE=.\BackgroundUtil.cpp +# End Source File +# Begin Source File + +SOURCE=.\BackgroundUtil.h +# End Source File +# Begin Source File + SOURCE=.\BannerCache.cpp # End Source File # Begin Source File diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 5bb655b390..3198cd0321 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -677,6 +677,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + + @@ -1225,6 +1231,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + + @@ -1237,12 +1249,6 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ - - - -