move background file enumerating into BackgroundUtil.*

fix editor background change functionality
This commit is contained in:
Chris Danford
2005-05-31 01:17:37 +00:00
parent 6b2b3ec6b1
commit dac72665e3
28 changed files with 609 additions and 410 deletions
+1 -6
View File
@@ -378,12 +378,7 @@ public:
virtual void SetState( int iNewState ) {} virtual void SetState( int iNewState ) {}
virtual float GetAnimationLengthSeconds() const { return 0; } virtual float GetAnimationLengthSeconds() const { return 0; }
virtual void SetSecondsIntoAnimation( float fSeconds ) {} virtual void SetSecondsIntoAnimation( float fSeconds ) {}
virtual void SetUpdateRate( float fRate ) {}
//
// BGAnimation stuff
//
virtual void GainFocus( float fRate, bool bRewindMovie, bool bLoop ) {}
virtual void LoseFocus() {}
protected: protected:
-16
View File
@@ -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; i<m_SubActors.size(); i++ )
m_SubActors[i]->GainFocus( fRate, bRewindMovie, bLoop );
}
void ActorFrame::LoseFocus()
{
Actor::LoseFocus();
for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->LoseFocus();
}
void ActorFrame::PlayCommand( const CString &sCommandName ) void ActorFrame::PlayCommand( const CString &sCommandName )
{ {
// HACK: Don't propogate Init. It gets called once for every Actor when the // HACK: Don't propogate Init. It gets called once for every Actor when the
-2
View File
@@ -93,8 +93,6 @@ public:
/* Amount of time until all tweens (and all children's tweens) have stopped: */ /* Amount of time until all tweens (and all children's tweens) have stopped: */
virtual float GetTweenTimeLeft() const; virtual float GetTweenTimeLeft() const;
virtual void GainFocus( float fRate, bool bRewindMovie, bool bLoop );
virtual void LoseFocus();
virtual void PlayCommand( const CString &sCommandName ); virtual void PlayCommand( const CString &sCommandName );
virtual void RunCommands( const LuaReference& cmds ); virtual void RunCommands( const LuaReference& cmds );
void RunCommands( const apActorCommands& cmds ) { ActorFrame::RunCommands( *cmds ); } // convenience void RunCommands( const apActorCommands& cmds ) { ActorFrame::RunCommands( *cmds ); } // convenience
-7
View File
@@ -682,13 +682,6 @@ void BGAnimationLayer::DrawPrimitives()
ActorFrame::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 * (c) 2001-2004 Ben Nordstrom, Chris Danford, Glenn Maynard
-1
View File
@@ -25,7 +25,6 @@ public:
bool EarlyAbortDraw(); bool EarlyAbortDraw();
float GetMaxTweenTimeLeft() const; float GetMaxTweenTimeLeft() const;
void GainFocus( float fRate, bool bRewindMovie, bool bLoop );
protected: protected:
vector<RageVector3> m_vParticleVelocity; vector<RageVector3> m_vParticleVelocity;
+64 -54
View File
@@ -21,9 +21,7 @@
#include <set> #include <set>
#include <float.h> #include <float.h>
#include "XmlFile.h" #include "XmlFile.h"
#include "BackgroundUtil.h"
const CString BACKGROUND_EFFECTS_DIR = "BackgroundEffects/";
const CString BACKGROUND_TRANSITIONS_DIR = "BackgroundTransitions/";
ThemeMetric<float> LEFT_EDGE ("Background","LeftEdge"); ThemeMetric<float> LEFT_EDGE ("Background","LeftEdge");
ThemeMetric<float> TOP_EDGE ("Background","TopEdge"); ThemeMetric<float> TOP_EDGE ("Background","TopEdge");
@@ -78,26 +76,27 @@ void Background::Init()
// load transitions // load transitions
{ {
ASSERT( m_mapNameToTransition.empty() ); ASSERT( m_mapNameToTransition.empty() );
vector<CString> v; vector<CString> vsPaths, vsNames;
GetDirListing( BACKGROUND_TRANSITIONS_DIR+"*.xml", v, false, true ); BackgroundUtil::GetBackgroundTransitions( "", vsPaths, vsNames );
FOREACH( CString, v, sPath ) for( unsigned i=0; i<vsPaths.size(); i++ )
{ {
CString sThrowAway, sFilename; const CString &sPath = vsPaths[i];
splitpath( *sPath, sThrowAway, sFilename, sThrowAway ); const CString &sName = vsNames[i];
XNode xml; XNode xml;
xml.LoadFromFile( *sPath ); xml.LoadFromFile( sPath );
ASSERT( xml.m_sName == "BackgroundTransition" ); ASSERT( xml.m_sName == "BackgroundTransition" );
BackgroundTransition &bgt = m_mapNameToTransition[sFilename]; BackgroundTransition &bgt = m_mapNameToTransition[sName];
CString sCmdLeaves; CString sCmdLeaves;
bool bSuccess = xml.GetAttrValue( "LeavesCommand", sCmdLeaves ); bool bSuccess = xml.GetAttrValue( "LeavesCommand", sCmdLeaves );
ASSERT( bSuccess ); ASSERT( bSuccess );
bgt.cmdLeaves = apActorCommands(new ActorCommands(sCmdLeaves) ); bgt.cmdLeaves = apActorCommands( new ActorCommands(sCmdLeaves) );
CString sCmdRoot; CString sCmdRoot;
bSuccess = xml.GetAttrValue( "RootCommand", sCmdRoot ); bSuccess = xml.GetAttrValue( "RootCommand", sCmdRoot );
ASSERT( bSuccess ); ASSERT( bSuccess );
bgt.cmdRoot = apActorCommands(new ActorCommands(sCmdRoot) ); bgt.cmdRoot = apActorCommands( new ActorCommands(sCmdRoot) );
} }
} }
@@ -205,16 +204,19 @@ Actor *MakeMovie( const CString &sMoviePath )
bool Background::Layer::CreateBackground( const Song *pSong, const BackgroundDef &bd ) bool Background::Layer::CreateBackground( const Song *pSong, const BackgroundDef &bd )
{ {
// Resolve the background names // Resolve the background names
vector<CString> vsResolvedFile; vector<CString> vsToResolve;
vsResolvedFile.push_back( bd.m_sFile1 ); vsToResolve.push_back( bd.m_sFile1 );
vsResolvedFile.push_back( bd.m_sFile2 ); vsToResolve.push_back( bd.m_sFile2 );
for( unsigned i=0; i<vsResolvedFile.size(); i++ ) vector<CString> vsResolved;
vsResolved.resize( vsToResolve.size() );
for( unsigned i=0; i<vsToResolve.size(); i++ )
{ {
const CString &sToResolve = vsToResolve[i];
LUA->SetGlobal( ssprintf("File%d",i+1), CString() ); LUA->SetGlobal( ssprintf("File%d",i+1), CString() );
CString &sResolvedFile = vsResolvedFile[0]; if( sToResolve.empty() )
if( sResolvedFile.empty() )
{ {
if( i == 0 ) if( i == 0 )
return false; return false;
@@ -226,17 +228,22 @@ bool Background::Layer::CreateBackground( const Song *pSong, const BackgroundDef
// - song's dir // - song's dir
// - RandomMovies dir // - RandomMovies dir
// - BGAnimations dir. // - BGAnimations dir.
CStringArray asMatches; CStringArray vsPaths, vsThrowAway;
// Look for BGAnims in the song dir // Look for BGAnims in the song dir
GetDirListing( sResolvedFile+"*", asMatches, false, true ); if( sToResolve == SONG_BACKGROUND_FILE )
if( asMatches.empty() ) GetDirListing( pSong->GetSongDir()+sResolvedFile+"*", asMatches, false, true ); vsPaths.push_back( pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathG("Common","fallback background") );
if( asMatches.empty() ) GetDirListing( RANDOMMOVIES_DIR+sResolvedFile+"*", asMatches, false, true ); if( vsPaths.empty() ) BackgroundUtil::GetSongBGAnimations( pSong, sToResolve, vsPaths, vsThrowAway );
if( asMatches.empty() ) GetDirListing( BG_ANIMS_DIR+sResolvedFile+"*", asMatches, false, true ); 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 else
{ {
@@ -244,45 +251,48 @@ bool Background::Layer::CreateBackground( const Song *pSong, const BackgroundDef
if( i == 0 ) if( i == 0 )
return false; return false;
else 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; CString sEffect = bd.m_sEffect;
if( sEffect.empty() ) if( sEffect.empty() )
{ {
FileType ft = ActorUtil::GetFileType(vsResolvedFile[0]); FileType ft = ActorUtil::GetFileType(vsResolved[0]);
switch( ft ) switch( ft )
{ {
default:
ASSERT(0); // fall through
case FT_Bitmap: case FT_Bitmap:
case FT_Sprite: case FT_Sprite:
case FT_Movie: case FT_Movie:
sEffect = StandardBackgroundEffectToString( SBE_Stretch ); sEffect = SBE_StretchNormal;
break; break;
case FT_Actor: case FT_Actor:
case FT_Directory: case FT_Directory:
case FT_Xml: case FT_Xml:
case FT_Model: case FT_Model:
sEffect = StandardBackgroundEffectToString( SBE_Centered ); sEffect = SBE_Centered;
break; break;
default:
ASSERT(0);
} }
} }
ASSERT( !sEffect.empty() ); ASSERT( !sEffect.empty() );
vector<CString> v; vector<CString> vsPaths, vsThrowAway;
GetDirListing( BACKGROUND_EFFECTS_DIR + sEffect+"*", v, false, true ); BackgroundUtil::GetBackgroundEffects( sEffect, vsPaths, vsThrowAway );
ASSERT( v.size()==1 ); ASSERT_M( !vsPaths.empty(), ssprintf("BackgroundEffect '%s' is missing.",sEffect.c_str()) );
CString sEffectFile = v[0]; 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 ); Actor *pActor = ActorUtil::MakeActor( sEffectFile );
ASSERT( pActor ); ASSERT( pActor );
m_BGAnimations[bd] = pActor; m_BGAnimations[bd] = pActor;
for( unsigned i=0; i<vsResolvedFile.size(); i++ ) for( unsigned i=0; i<vsResolved.size(); i++ )
LUA->SetGlobal( ssprintf("File%d",i+1), CString() ); LUA->SetGlobal( ssprintf("File%d",i+1), CString() );
return true; return true;
@@ -309,7 +319,7 @@ BackgroundDef Background::Layer::CreateRandomBGA( const Song *pSong, CString sPr
return first; return first;
} }
CStringArray arrayPaths; CStringArray vsPaths, vsThrowAway;
for( int i=0; i<2; i++ ) for( int i=0; i<2; i++ )
{ {
switch( PREFSMAN->m_BackgroundMode ) 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) ); FAIL_M( ssprintf("Invalid BackgroundMode: %i", (PrefsManager::BackgroundMode)PREFSMAN->m_BackgroundMode) );
break; break;
case PrefsManager::BGMODE_OFF:
break;
case PrefsManager::BGMODE_ANIMATIONS: case PrefsManager::BGMODE_ANIMATIONS:
GetDirListing( BG_ANIMS_DIR + sPreferredSubDir + "*", arrayPaths, true, true ); BackgroundUtil::GetGlobalBGAnimations( sPreferredSubDir, vsPaths, vsThrowAway );
break; break;
case PrefsManager::BGMODE_RANDOMMOVIES: case PrefsManager::BGMODE_RANDOMMOVIES:
GetDirListing( RANDOMMOVIES_DIR + sPreferredSubDir + "*.avi", arrayPaths, false, true ); BackgroundUtil::GetGlobalRandomMovies( sPreferredSubDir, vsPaths, vsThrowAway );
GetDirListing( RANDOMMOVIES_DIR + sPreferredSubDir + "*.mpg", arrayPaths, false, true );
GetDirListing( RANDOMMOVIES_DIR + sPreferredSubDir + "*.mpeg", arrayPaths, false, true );
break; break;
} }
// strip out "cvs" // strip out "cvs"
for( int j=arrayPaths.size()-1; j>=0; j-- ) for( int j=vsPaths.size()-1; j>=0; j-- )
if( Basename(arrayPaths[j]).CompareNoCase("cvs")==0 ) if( Basename(vsPaths[j]).CompareNoCase("cvs")==0 )
arrayPaths.erase( arrayPaths.begin()+j, arrayPaths.begin()+j+1 ); vsPaths.erase( vsPaths.begin()+j, vsPaths.begin()+j+1 );
if( !arrayPaths.empty() ) // found one if( !vsPaths.empty() ) // found one
break; break;
// now search without a subdir // now search without a subdir
sPreferredSubDir = ""; sPreferredSubDir = "";
} }
if( arrayPaths.empty() ) if( vsPaths.empty() )
return BackgroundDef(); 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. */ /* Find the first BackgroundDef in arrayPaths we havn't already loaded. */
BackgroundDef bd; BackgroundDef bd;
@@ -355,7 +366,7 @@ BackgroundDef Background::Layer::CreateRandomBGA( const Song *pSong, CString sPr
loaded.insert( m_RandomBGAnimations[i] ); loaded.insert( m_RandomBGAnimations[i] );
bool bFound = false; bool bFound = false;
FOREACH_CONST( CString, arrayPaths, p ) FOREACH_CONST( CString, vsPaths, p )
{ {
FOREACHD_CONST( BackgroundDef, m_RandomBGAnimations, b ) FOREACHD_CONST( BackgroundDef, m_RandomBGAnimations, b )
{ {
@@ -431,7 +442,7 @@ void Background::LoadFromSong( const Song* pSong )
m_pSong = 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 ) if( PREFSMAN->m_fBGBrightness == 0.0f )
return; return;
@@ -499,7 +510,7 @@ void Background::LoadFromSong( const Song* pSong )
for( int i=0; i<NUM_BACKGROUND_LAYERS; i++ ) for( int i=0; i<NUM_BACKGROUND_LAYERS; i++ )
{ {
Layer &layer = m_Layer[i]; Layer &layer = m_Layer[i];
SortBackgroundChangesArray( layer.m_aBGChanges ); BackgroundUtil::SortBackgroundChangesArray( layer.m_aBGChanges );
} }
@@ -553,7 +564,7 @@ void Background::LoadFromSong( const Song* pSong )
// Re-sort. // Re-sort.
SortBackgroundChangesArray( mainlayer.m_aBGChanges ); BackgroundUtil::SortBackgroundChangesArray( mainlayer.m_aBGChanges );
m_DangerAll.SetXY( (float)LEFT_EDGE, (float)TOP_EDGE ); m_DangerAll.SetXY( (float)LEFT_EDGE, (float)TOP_EDGE );
m_DangerAll.SetZoomX( fXZoom ); m_DangerAll.SetZoomX( fXZoom );
@@ -657,7 +668,6 @@ void Background::Layer::UpdateCurBGChange( const Song *pSong, float fLastMusicSe
{ {
if( m_pFadingBGA ) if( m_pFadingBGA )
{ {
m_pFadingBGA->LoseFocus();
m_pFadingBGA->PlayCommand( "LoseFocus" ); m_pFadingBGA->PlayCommand( "LoseFocus" );
if( !change.m_sTransition.empty() ) if( !change.m_sTransition.empty() )
@@ -671,7 +681,7 @@ void Background::Layer::UpdateCurBGChange( const Song *pSong, float fLastMusicSe
} }
m_pCurrentBGA->Reset(); 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( "On" );
m_pCurrentBGA->PlayCommand( "GainFocus" ); m_pCurrentBGA->PlayCommand( "GainFocus" );
+1
View File
@@ -52,6 +52,7 @@ public:
DancingCharacters* GetDancingCharacters() { return m_pDancingCharacters; }; DancingCharacters* GetDancingCharacters() { return m_pDancingCharacters; };
protected: protected:
bool m_bInitted; bool m_bInitted;
DancingCharacters* m_pDancingCharacters; DancingCharacters* m_pDancingCharacters;
+169
View File
@@ -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<CString> &vsPathsToStrip, vector<CString> &vsNamesToStrip )
{
ASSERT( vsPathsToStrip.size() == vsNamesToStrip.size() );
for( unsigned i=0; i<vsNamesToStrip.size(); i++ )
{
if( vsNamesToStrip[i].Right(3).CompareNoCase("CVS") == 0 )
{
vsPathsToStrip.erase( vsPathsToStrip.begin()+i );
vsNamesToStrip.erase( vsNamesToStrip.begin()+i );
}
}
}
int CompareBackgroundChanges(const BackgroundChange &seg1, const BackgroundChange &seg2)
{
return seg1.m_fStartBeat < seg2.m_fStartBeat;
}
void BackgroundUtil::SortBackgroundChangesArray( vector<BackgroundChange> &vBackgroundChanges )
{
sort( vBackgroundChanges.begin(), vBackgroundChanges.end(), CompareBackgroundChanges );
}
void BackgroundUtil::GetBackgroundEffects( const CString &sName, vector<CString> &vsPathsOut, vector<CString> &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<CString> &vsPathsOut, vector<CString> &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<CString> &vsPathsOut, vector<CString> &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<CString> &vsPathsOut, vector<CString> &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<CString> &vsPathsOut, vector<CString> &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<CString> &vsPathsOut, vector<CString> &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<CString> &vsPathsOut, vector<CString> &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<CString> vSubDirs;
GetDirListing( RANDOMMOVIES_DIR+"*", vSubDirs, true );
FOREACH_CONST( CString, vSubDirs, sSubDir )
{
vector<CString> 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.
*/
+113
View File
@@ -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<BackgroundChange> &vBackgroundChanges );
void GetBackgroundEffects( const CString &sName, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut );
void GetBackgroundTransitions( const CString &sName, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut );
void GetSongBGAnimations( const Song *pSong, const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut );
void GetSongMovies( const Song *pSong, const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut );
void GetSongBitmaps( const Song *pSong, const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut );
void GetGlobalBGAnimations( const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &vsNamesOut );
void GetGlobalRandomMovies( const CString &sMatch, vector<CString> &vsPathsOut, vector<CString> &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.
*/
-14
View File
@@ -366,20 +366,6 @@ static const CString StageNames[] = {
XToString( Stage, NUM_STAGES ); 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 * (c) 2001-2004 Chris Danford
* All rights reserved. * All rights reserved.
-86
View File
@@ -257,9 +257,6 @@ const int NUM_ATTACKS_PER_LEVEL = 3;
const int ITEM_NONE = -1; 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/") #define DATA_DIR CString("Data/")
@@ -419,89 +416,6 @@ enum Stage
const CString& StageToString( Stage s ); 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<BackgroundChange> &arrayBackgroundChanges );
#endif #endif
/* /*
+1
View File
@@ -64,6 +64,7 @@ endif
DataStructures = \ DataStructures = \
ActorCommands.cpp ActorCommands.h Attack.cpp Attack.h AutoKeysounds.cpp AutoKeysounds.h \ ActorCommands.cpp ActorCommands.h Attack.cpp Attack.h AutoKeysounds.cpp AutoKeysounds.h \
BackgroundUtil.cpp BackgroundUtil.h \
BannerCache.cpp BannerCache.h CatalogXml.cpp CatalogXml.h \ BannerCache.cpp BannerCache.h CatalogXml.cpp CatalogXml.h \
Character.cpp Character.h CharacterHead.cpp CharacterHead.h \ Character.cpp Character.h CharacterHead.cpp CharacterHead.h \
CodeDetector.cpp CodeDetector.h \ CodeDetector.cpp CodeDetector.h \
+3 -4
View File
@@ -541,14 +541,13 @@ void NoteField::DrawPrimitives()
aBackgroundChanges[i].m_fStartBeat <= fLastBeatToDraw ) aBackgroundChanges[i].m_fStartBeat <= fLastBeatToDraw )
{ {
const BackgroundChange& change = aBackgroundChanges[i]; 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(), ((b!=0) ? ssprintf("%d: ",b) : CString()).c_str(),
(!change.m_sFile1.empty() ? " "+change.m_sFile1 : 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_sFile2.empty() ? " "+change.m_sFile2 : CString()).c_str(),
((change.m_fRate!=1.0f) ? ssprintf("%.2f%%",change.m_fRate*100) : CString()).c_str(), ((change.m_fRate!=1.0f) ? ssprintf("%.2f%%",change.m_fRate*100) : CString()).c_str(),
change.m_bRewindMovie ? " Rewind" : "", (!change.m_sTransition.empty() ? " "+change.m_sTransition : CString()).c_str(),
change.m_bLoop ? " Loop" : "" , (!change.m_sEffect.empty() ? " "+change.m_sEffect : CString()).c_str()
(!change.m_sTransition.empty() ? " "+change.m_sTransition : CString()).c_str()
); );
if( IS_ON_SCREEN(change.m_fStartBeat) ) if( IS_ON_SCREEN(change.m_fStartBeat) )
DrawBGChangeText( change.m_fStartBeat, sChangeText ); DrawBGChangeText( change.m_fStartBeat, sChangeText );
+12 -5
View File
@@ -165,13 +165,20 @@ bool LoadFromBGChangesString( BackgroundChange &change, const CString &sBGChange
{ {
change.m_fRate = strtof( aBGChangeValues[2], NULL ); change.m_fRate = strtof( aBGChangeValues[2], NULL );
change.m_sTransition = (atoi( aBGChangeValues[3] ) != 0) ? "CrossFade" : ""; change.m_sTransition = (atoi( aBGChangeValues[3] ) != 0) ? "CrossFade" : "";
change.m_bRewindMovie = atoi( aBGChangeValues[4] ) != 0; bool bRewindMovie = atoi( aBGChangeValues[4] ) != 0;
change.m_bLoop = atoi( aBGChangeValues[5] ) != 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_sEffect = aBGChangeValues[6];
change.m_sTransition = aBGChangeValues[7]; change.m_sFile2 = aBGChangeValues[7];
change.m_sTransition = aBGChangeValues[8];
} }
if( aBGChangeValues.size() >= 2 ) if( aBGChangeValues.size() >= 2 )
{ {
+15 -7
View File
@@ -14,7 +14,18 @@
static CString BackgroundChangeToString( const BackgroundChange &bgc ) 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 ) void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out )
@@ -39,12 +50,9 @@ void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out )
f.Write( "#SELECTABLE:" ); f.Write( "#SELECTABLE:" );
switch(out.m_SelectionDisplay) { switch(out.m_SelectionDisplay) {
default: ASSERT(0); /* fallthrough */ default: ASSERT(0); /* fallthrough */
case Song::SHOW_ALWAYS: case Song::SHOW_ALWAYS: f.Write( "YES" ); break;
f.Write( "YES" ); break; case Song::SHOW_NEVER: f.Write( "NO" ); break;
case Song::SHOW_NEVER: case Song::SHOW_ROULETTE: f.Write( "ROULETTE" ); break;
f.Write( "NO" ); break;
case Song::SHOW_ROULETTE:
f.Write( "ROULETTE" ); break;
} }
f.PutLine( ";" ); f.PutLine( ";" );
+7
View File
@@ -519,6 +519,13 @@ CString GetExtension( const CString &sPath )
return sPath.substr( pos+1, sPath.size()-pos+1 ); 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() CString GetCwd()
{ {
#ifdef _XBOX #ifdef _XBOX
+1
View File
@@ -241,6 +241,7 @@ void splitpath( const CString &Path, CString &Dir, CString &Filename, CString &E
CString SetExtension( const CString &path, const CString &ext ); CString SetExtension( const CString &path, const CString &ext );
CString GetExtension( const CString &sPath ); CString GetExtension( const CString &sPath );
CString GetFileNameWithoutExtension( const CString &sPath );
typedef int longchar; typedef int longchar;
extern const wchar_t INVALID_CHAR; extern const wchar_t INVALID_CHAR;
+116 -93
View File
@@ -33,6 +33,7 @@
#include "ScreenPlayerOptions.h" // for SM_BackFromPlayerOptions #include "ScreenPlayerOptions.h" // for SM_BackFromPlayerOptions
#include "ScreenSongOptions.h" // for SM_BackFromSongOptions #include "ScreenSongOptions.h" // for SM_BackFromSongOptions
#include <float.h> #include <float.h>
#include "BackgroundUtil.h"
// //
// Defines specific to ScreenEdit // Defines specific to ScreenEdit
@@ -322,11 +323,12 @@ const MapEditToDI *ScreenEdit::GetCurrentMap() const
} }
} }
static Menu g_EditHelp( static Menu g_EditHelp(
"ScreenMiniMenuEditHelp", "ScreenMiniMenuEditHelp",
#if defined(XBOX) #if defined(XBOX)
MenuRow( -1, "L + Up/Down: Change zoom", 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, 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, "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 + Start: Play whole song", false, EDIT_MODE_PRACTICE, 0, NULL ),
MenuRow( -1, "R + Select: Record", 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 ) 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( static Menu g_BackgroundChange(
"ScreenMiniMenuBackgroundChange", "ScreenMiniMenuBackgroundChange",
MenuRow( ScreenEdit::layer, "Layer", true, EDIT_MODE_FULL, 0, "0","1" ), 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::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::transition, "Transition", true, EDIT_MODE_FULL, 0, NULL ),
MenuRow( ScreenEdit::loop, "Loop", true, EDIT_MODE_FULL, 1, "NO","YES" ), MenuRow( ScreenEdit::effect, "Force Effect", true, EDIT_MODE_FULL, 0, NULL ),
MenuRow( ScreenEdit::transition, "Transition", 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::effect, "Effect", true, EDIT_MODE_FULL, 0, NULL ), MenuRow( ScreenEdit::file1_song_bganimation, "File1 Song BGAnimation", EnabledIfSet1SB,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_movie, "File1 Song Movie", EnabledIfSet1SM,EDIT_MODE_FULL, 0, NULL ),
MenuRow( ScreenEdit::file1_song_bganimation, "file1_type Song BGAnimation", true, EDIT_MODE_FULL, 0, NULL ), MenuRow( ScreenEdit::file1_song_still, "File1 Song Still", EnabledIfSet1SI,EDIT_MODE_FULL, 0, NULL ),
MenuRow( ScreenEdit::file1_song_movie, "file1_type Song Movie", true, EDIT_MODE_FULL, 0, NULL ), MenuRow( ScreenEdit::file1_global_bganimation, "File1 Global BGAnimation", EnabledIfSet1GB,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 Global Random Movie", EnabledIfSet1GM,EDIT_MODE_FULL, 0, NULL ),
MenuRow( ScreenEdit::file1_global_random_movie, "file1_type Global Random Movie", true, 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::file1_global_bganimation, "file1_type Global BGAnimation", true, EDIT_MODE_FULL, 0, NULL ), MenuRow( ScreenEdit::file2_song_bganimation, "File2 Song BGAnimation", EnabledIfSet2SB,EDIT_MODE_FULL, 0, NULL ),
MenuRow( ScreenEdit::file1_global_bganimation, "file1_type Global Visualization", true, EDIT_MODE_FULL, 0, NULL ), MenuRow( ScreenEdit::file2_song_movie, "File2 Song Movie", EnabledIfSet2SM,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_still, "File2 Song Still", EnabledIfSet2SI,EDIT_MODE_FULL, 0, NULL ),
MenuRow( ScreenEdit::file2_song_bganimation, "file2_type Song BGAnimation", true, EDIT_MODE_FULL, 0, NULL ), MenuRow( ScreenEdit::file2_global_bganimation, "File2 Global BGAnimation", EnabledIfSet2GB,EDIT_MODE_FULL, 0, NULL ),
MenuRow( ScreenEdit::file2_song_movie, "file2_type Song Movie", true, EDIT_MODE_FULL, 0, NULL ), MenuRow( ScreenEdit::file2_global_random_movie, "File2 Global Random Movie", EnabledIfSet2GM,EDIT_MODE_FULL, 0, NULL ),
MenuRow( ScreenEdit::file2_song_still, "file2_type Song Still", true, EDIT_MODE_FULL, 0, NULL ), MenuRow( ScreenEdit::delete_change, "Remove Change", 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 )
); );
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( static Menu g_Prefs(
"ScreenMiniMenuPreferences", "ScreenMiniMenuPreferences",
@@ -2036,47 +2056,20 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
// //
// Fill in option names // Fill in option names
// //
vector<CString> vThrowAway;
// m_pSong->GetSongDir() has trailing slash BackgroundUtil::GetBackgroundTransitions( "", vThrowAway, g_BackgroundChange.rows[transition].choices );
g_BackgroundChange.rows[file1_song_bganimation].choices.clear(); g_BackgroundChange.rows[transition].choices.insert( g_BackgroundChange.rows[transition].choices.begin(), "" ); // add "no transition"
GetDirListing( m_pSong->GetSongDir()+"*", g_BackgroundChange.rows[file1_song_bganimation].choices, true ); 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(); BackgroundUtil::GetSongBGAnimations( m_pSong, "", vThrowAway, g_BackgroundChange.rows[file1_song_bganimation].choices );
GetDirListing( m_pSong->GetSongDir()+"*.avi", g_BackgroundChange.rows[file1_song_movie].choices, false ); BackgroundUtil::GetSongMovies( m_pSong, "", vThrowAway, g_BackgroundChange.rows[file1_song_movie].choices );
GetDirListing( m_pSong->GetSongDir()+"*.mpg", g_BackgroundChange.rows[file1_song_movie].choices, false ); BackgroundUtil::GetSongBitmaps( m_pSong, "", vThrowAway, g_BackgroundChange.rows[file1_song_still].choices );
GetDirListing( m_pSong->GetSongDir()+"*.mpeg", g_BackgroundChange.rows[file1_song_movie].choices, false ); 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(); g_BackgroundChange.rows[file2_type].choices = g_BackgroundChange.rows[file1_type].choices;
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<CString> vSubDirs;
GetDirListing( RANDOMMOVIES_DIR+"*", vSubDirs, true );
FOREACH_CONST( CString, vSubDirs, s )
{
const CString &sSubDir = *s;
vector<CString> 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_song_bganimation].choices = g_BackgroundChange.rows[file1_song_bganimation].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_movie].choices = g_BackgroundChange.rows[file1_song_movie].choices;
g_BackgroundChange.rows[file2_song_still].choices = g_BackgroundChange.rows[file1_song_still].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<int> &iAns
} }
} }
g_BackgroundChange.rows[file1_type].bEnabled = true; #define FILL_ENABLED( x ) g_BackgroundChange.rows[x].bEnabled = g_BackgroundChange.rows[x].choices.size() > 0;
g_BackgroundChange.rows[file1_song_bganimation].bEnabled = g_BackgroundChange.rows[file1_song_bganimation].choices.size() > 0; FILL_ENABLED( transition );
g_BackgroundChange.rows[file1_song_movie].bEnabled = g_BackgroundChange.rows[file1_song_movie].choices.size() > 0; FILL_ENABLED( effect );
g_BackgroundChange.rows[file1_song_still].bEnabled = g_BackgroundChange.rows[file1_song_still].choices.size() > 0; FILL_ENABLED( file1_song_bganimation );
g_BackgroundChange.rows[file1_global_random_movie].bEnabled = g_BackgroundChange.rows[file1_global_random_movie].choices.size() > 0; FILL_ENABLED( file1_song_movie );
g_BackgroundChange.rows[file1_global_bganimation].bEnabled = g_BackgroundChange.rows[file1_global_bganimation].choices.size() > 0; FILL_ENABLED( file1_song_still );
g_BackgroundChange.rows[file2_type].bEnabled = g_BackgroundChange.rows[file1_type].bEnabled; FILL_ENABLED( file1_global_random_movie );
g_BackgroundChange.rows[file2_song_bganimation].bEnabled = g_BackgroundChange.rows[file1_song_bganimation].bEnabled; FILL_ENABLED( file1_global_bganimation );
g_BackgroundChange.rows[file2_song_movie].bEnabled = g_BackgroundChange.rows[file1_song_movie].bEnabled; FILL_ENABLED( file2_song_bganimation );
g_BackgroundChange.rows[file2_song_still].bEnabled = g_BackgroundChange.rows[file1_song_still].bEnabled; FILL_ENABLED( file2_song_movie );
g_BackgroundChange.rows[file2_global_random_movie].bEnabled = g_BackgroundChange.rows[file1_global_random_movie].bEnabled; FILL_ENABLED( file2_song_still );
g_BackgroundChange.rows[file2_global_bganimation].bEnabled = g_BackgroundChange.rows[file1_global_bganimation].bEnabled; FILL_ENABLED( file2_global_random_movie );
FILL_ENABLED( file2_global_bganimation );
#undef FILL_ENABLED
g_BackgroundChange.rows[delete_change].bEnabled = bAlreadyBGChangeHere; g_BackgroundChange.rows[delete_change].bEnabled = bAlreadyBGChangeHere;
// set default choices // set default choices
g_BackgroundChange.rows[layer]. SetDefaultChoiceIfPresent( ssprintf("%d",iLayer) ); g_BackgroundChange.rows[layer]. SetDefaultChoiceIfPresent( ssprintf("%d",iLayer) );
g_BackgroundChange.rows[rate]. SetDefaultChoiceIfPresent( ssprintf("%2.0f%%",bgChange.m_fRate*100) ); 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[transition]. SetDefaultChoiceIfPresent( bgChange.m_sTransition );
g_BackgroundChange.rows[file1_type].iDefaultChoice = 0; // FIXME g_BackgroundChange.rows[effect]. SetDefaultChoiceIfPresent( bgChange.m_sEffect );
g_BackgroundChange.rows[file1_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ); g_BackgroundChange.rows[file1_type].iDefaultChoice = none;
g_BackgroundChange.rows[file1_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ); if( bgChange.m_sFile1 == RANDOM_BACKGROUND_FILE ) g_BackgroundChange.rows[file1_type].iDefaultChoice = random;
g_BackgroundChange.rows[file1_song_still]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ); if( g_BackgroundChange.rows[file1_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = song_bganimation;
g_BackgroundChange.rows[file1_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ); if( g_BackgroundChange.rows[file1_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = song_movie;
g_BackgroundChange.rows[file1_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ); if( g_BackgroundChange.rows[file1_song_still]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = song_bitmap;
g_BackgroundChange.rows[file2_type].iDefaultChoice = 0; // FIXME if( g_BackgroundChange.rows[file1_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = global_bganimation;
g_BackgroundChange.rows[file2_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ); if( g_BackgroundChange.rows[file1_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = global_movie;
g_BackgroundChange.rows[file2_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ); g_BackgroundChange.rows[file2_type].iDefaultChoice = none;
g_BackgroundChange.rows[file2_song_still]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ); if( bgChange.m_sFile2 == RANDOM_BACKGROUND_FILE ) g_BackgroundChange.rows[file2_type].iDefaultChoice = random;
g_BackgroundChange.rows[file2_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ); if( g_BackgroundChange.rows[file2_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = song_bganimation;
g_BackgroundChange.rows[file2_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sFile2 ); 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 ); SCREENMAN->MiniMenu( &g_BackgroundChange, SM_BackFromBGChange );
@@ -2666,13 +2662,40 @@ void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, const vector<int> &iAns
newChange.m_fStartBeat = GAMESTATE->m_fSongBeat; newChange.m_fStartBeat = GAMESTATE->m_fSongBeat;
newChange.m_fRate = strtof( g_BackgroundChange.rows[rate].choices[iAnswers[rate]], NULL )/100.f; 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]]; newChange.m_sTransition = g_BackgroundChange.rows[transition].choices[iAnswers[transition]];
int iRow1 = file1_song_bganimation + iAnswers[file1_type]; newChange.m_sEffect = g_BackgroundChange.rows[effect].choices[iAnswers[effect]];
newChange.m_sFile1 = g_BackgroundChange.rows[iRow1].choices[iAnswers[iRow1]]; switch( iAnswers[file1_type] )
int iRow2 = file2_song_bganimation + iAnswers[file2_type]; {
newChange.m_sFile2 = g_BackgroundChange.rows[iRow2].choices[iAnswers[iRow2]]; 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 ); m_pSong->AddBackgroundChange( iLayer, newChange );
} }
+2 -4
View File
@@ -366,22 +366,20 @@ public:
enum BGChangeChoice { enum BGChangeChoice {
layer, layer,
rate, rate,
rewind_movie,
loop,
transition, transition,
effect, effect,
file1_type, file1_type,
file1_song_bganimation, file1_song_bganimation,
file1_song_movie, file1_song_movie,
file1_song_still, file1_song_still,
file1_global_random_movie,
file1_global_bganimation, file1_global_bganimation,
file1_global_random_movie,
file2_type, file2_type,
file2_song_bganimation, file2_song_bganimation,
file2_song_movie, file2_song_movie,
file2_song_still, file2_song_still,
file2_global_random_movie,
file2_global_bganimation, file2_global_bganimation,
file2_global_random_movie,
delete_change, delete_change,
NUM_BGCHANGE_CHOICES NUM_BGCHANGE_CHOICES
}; };
+35 -12
View File
@@ -53,30 +53,30 @@ void ScreenMiniMenu::Init( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMe
for( unsigned r=0; r<m_vMenuRows.size(); r++ ) for( unsigned r=0; r<m_vMenuRows.size(); r++ )
{ {
const MenuRow &mr = m_vMenuRows[r]; const MenuRow &mr = m_vMenuRows[r];
OptionRowDefinition &ord = vDefs[r]; OptionRowDefinition &def = vDefs[r];
ord.name = mr.sName; def.name = mr.sName;
FontCharAliases::ReplaceMarkers( ord.name ); // Allow special characters FontCharAliases::ReplaceMarkers( def.name ); // Allow special characters
if( mr.bEnabled ) if( mr.bEnabled )
{ {
ord.m_vEnabledForPlayers.clear(); def.m_vEnabledForPlayers.clear();
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledPlayer( pn )
ord.m_vEnabledForPlayers.insert( pn ); def.m_vEnabledForPlayers.insert( pn );
} }
else else
{ {
ord.m_vEnabledForPlayers.clear(); def.m_vEnabledForPlayers.clear();
} }
ord.bOneChoiceForAllPlayers = true; def.bOneChoiceForAllPlayers = true;
ord.selectType = SELECT_ONE; def.selectType = SELECT_ONE;
ord.layoutType = LAYOUT_SHOW_ONE_IN_ROW; def.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
ord.m_bExportOnChange = false; def.m_bExportOnChange = false;
ord.choices = mr.choices; def.choices = mr.choices;
FOREACH( CString, ord.choices, c ) FOREACH( CString, def.choices, c )
FontCharAliases::ReplaceMarkers( *c ); // Allow special characters FontCharAliases::ReplaceMarkers( *c ); // Allow special characters
} }
@@ -86,6 +86,29 @@ void ScreenMiniMenu::Init( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMe
ScreenOptions::InitMenu( INPUTMODE_SHARE_CURSOR, vDefs, vHands ); ScreenOptions::InitMenu( INPUTMODE_SHARE_CURSOR, vDefs, vHands );
} }
void ScreenMiniMenu::OnChange( PlayerNumber pn )
{
ScreenOptions::OnChange( pn );
vector<PlayerNumber> vpns;
vpns.push_back( GAMESTATE->m_MasterPlayerNumber );
for( unsigned i=0; i<m_Rows.size(); i++ )
ExportOptions( i, vpns );
for( unsigned i=0; i<m_Rows.size(); i++ )
{
MenuRow &mr = m_vMenuRows[i];
OptionRow &optrow = *m_Rows[i];
if( mr.pfnEnabled )
{
optrow.GetRowDef().m_vEnabledForPlayers.clear();
if( mr.pfnEnabled() )
optrow.GetRowDef().m_vEnabledForPlayers.insert( GAMESTATE->m_MasterPlayerNumber );
}
}
UpdateEnabledDisabled();
}
void ScreenMiniMenu::ImportOptions( int r, const vector<PlayerNumber> &vpns ) void ScreenMiniMenu::ImportOptions( int r, const vector<PlayerNumber> &vpns )
{ {
OptionRow &optrow = *m_Rows[r]; OptionRow &optrow = *m_Rows[r];
+34 -7
View File
@@ -10,30 +10,56 @@
#include "RageSound.h" #include "RageSound.h"
#include "BGAnimation.h" #include "BGAnimation.h"
typedef bool (*MenuRowUpdateEnabled)();
struct MenuRow struct MenuRow
{ {
int iRowCode; int iRowCode;
CString sName; CString sName;
bool bEnabled; bool bEnabled;
EditMode emShowIn; MenuRowUpdateEnabled pfnEnabled; // if ! NULL, used to fill bEnabled
int iDefaultChoice; EditMode emShowIn;
int iDefaultChoice;
vector<CString> choices; vector<CString> choices;
MenuRow() {} 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 ) 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); #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); 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
} }
void SetDefaultChoiceIfPresent( CString sChoice ) bool SetDefaultChoiceIfPresent( CString sChoice )
{ {
iDefaultChoice = 0; iDefaultChoice = 0;
FOREACH_CONST( CString, choices, s ) FOREACH_CONST( CString, choices, s )
{
if( sChoice == *s ) if( sChoice == *s )
{
iDefaultChoice = s - choices.begin(); iDefaultChoice = s - choices.begin();
return true;
}
}
return false;
} }
}; };
@@ -58,6 +84,7 @@ public:
ScreenMiniMenu( CString sScreenClass ); ScreenMiniMenu( CString sScreenClass );
void Init( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel ); void Init( const Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel );
protected: protected:
virtual void OnChange( PlayerNumber pn );
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns ); virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns ); virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
+3 -15
View File
@@ -44,18 +44,6 @@ const int FILE_CACHE_VERSION = 144; // increment this to invalidate cache
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f; 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<BackgroundChange> &arrayBackgroundChanges )
{
sort( arrayBackgroundChanges.begin(), arrayBackgroundChanges.end(), CompareBackgroundChanges );
}
////////////////////////////// //////////////////////////////
// Song // Song
////////////////////////////// //////////////////////////////
@@ -114,13 +102,13 @@ void Song::AddBackgroundChange( int iLayer, BackgroundChange seg )
{ {
ASSERT( iLayer >= 0 && iLayer < NUM_BACKGROUND_LAYERS ); ASSERT( iLayer >= 0 && iLayer < NUM_BACKGROUND_LAYERS );
m_BackgroundChanges[iLayer].push_back( seg ); m_BackgroundChanges[iLayer].push_back( seg );
SortBackgroundChangesArray( m_BackgroundChanges[iLayer] ); BackgroundUtil::SortBackgroundChangesArray( m_BackgroundChanges[iLayer] );
} }
void Song::AddForegroundChange( BackgroundChange seg ) void Song::AddForegroundChange( BackgroundChange seg )
{ {
m_ForegroundChanges.push_back( seg ); m_ForegroundChanges.push_back( seg );
SortBackgroundChangesArray( m_ForegroundChanges ); BackgroundUtil::SortBackgroundChangesArray( m_ForegroundChanges );
} }
void Song::AddLyricSegment( LyricSegment seg ) void Song::AddLyricSegment( LyricSegment seg )
@@ -721,7 +709,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( 0, BackgroundChange(0,arrayPossibleMovies[0],"",1.f,true,true,false) ); this->AddBackgroundChange( 0, BackgroundChange(0,arrayPossibleMovies[0],"",1.f,SBE_StretchNoLoop) );
} }
-58
View File
@@ -925,64 +925,6 @@ void Sprite::SetPosition( float f ) { GetTexture()->SetPosition(f); }
void Sprite::SetLooping( bool b ) { GetTexture()->SetLooping(b); } void Sprite::SetLooping( bool b ) { GetTexture()->SetLooping(b); }
void Sprite::SetPlaybackRate( float f ) { GetTexture()->SetPlaybackRate(f); } 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 * (c) 2001-2004 Chris Danford
-3
View File
@@ -20,9 +20,6 @@ public:
virtual void DrawPrimitives(); virtual void DrawPrimitives();
virtual void Update( float fDeltaTime ); 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 void UpdateAnimationState(); // take m_fSecondsIntoState, and move to a new state
/* Adjust texture properties for song backgrounds. */ /* Adjust texture properties for song backgrounds. */
+12 -4
View File
@@ -59,10 +59,10 @@ LINK32=link.exe
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib # SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# Begin Special Build Tool # Begin Special Build Tool
IntDir=.\../Debug6 IntDir=.\../Debug6
TargetDir=\StepMania\Program TargetDir=\stepmania\Program
TargetName=StepMania-debug TargetName=StepMania-debug
SOURCE="$(InputPath)" 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 PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool # End Special Build Tool
@@ -96,10 +96,10 @@ LINK32=link.exe
# SUBTRACT LINK32 /pdb:none # SUBTRACT LINK32 /pdb:none
# Begin Special Build Tool # Begin Special Build Tool
IntDir=.\../Release6 IntDir=.\../Release6
TargetDir=\StepMania\Program TargetDir=\stepmania\Program
TargetName=StepMania TargetName=StepMania
SOURCE="$(InputPath)" 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 PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool # End Special Build Tool
@@ -684,6 +684,14 @@ SOURCE=.\AutoKeysounds.h
# End Source File # End Source File
# Begin 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 SOURCE=.\BannerCache.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
+12 -6
View File
@@ -677,6 +677,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File <File
RelativePath="AutoKeysounds.h"> RelativePath="AutoKeysounds.h">
</File> </File>
<File
RelativePath="BackgroundUtil.cpp">
</File>
<File
RelativePath="BackgroundUtil.h">
</File>
<File <File
RelativePath="BannerCache.cpp"> RelativePath="BannerCache.cpp">
</File> </File>
@@ -1225,6 +1231,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File <File
RelativePath="arch\InputHandler\InputHandler_MonkeyKeyboard.h"> RelativePath="arch\InputHandler\InputHandler_MonkeyKeyboard.h">
</File> </File>
<File
RelativePath="arch\InputHandler\InputHandler_Win32_MIDI.cpp">
</File>
<File
RelativePath="arch\InputHandler\InputHandler_Win32_MIDI.h">
</File>
<File <File
RelativePath="arch\InputHandler\InputHandler_Win32_Para.cpp"> RelativePath="arch\InputHandler\InputHandler_Win32_Para.cpp">
</File> </File>
@@ -1237,12 +1249,6 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File <File
RelativePath="arch\InputHandler\InputHandler_Win32_Pump.h"> RelativePath="arch\InputHandler\InputHandler_Win32_Pump.h">
</File> </File>
<File
RelativePath="arch\InputHandler\InputHandler_Win32_MIDI.cpp">
</File>
<File
RelativePath="arch\InputHandler\InputHandler_Win32_MIDI.h">
</File>
</Filter> </Filter>
<Filter <Filter
Name="MovieTexture" Name="MovieTexture"
+1 -1
View File
@@ -907,7 +907,7 @@ void ThemeManager::LoadPreferencesFromSection( const CString &sClassName )
CString ThemeManager::GetBlankGraphicPath() CString ThemeManager::GetBlankGraphicPath()
{ {
return THEMES_DIR + BASE_THEME_NAME + "/" + ElementCategoryToString(EC_GRAPHICS) + "/_blank"; return THEMES_DIR + BASE_THEME_NAME + "/" + ElementCategoryToString(EC_GRAPHICS) + "/_blank.png";
} }
// lua start // lua start
+7 -5
View File
@@ -4,7 +4,7 @@
#define SONG_H #define SONG_H
#include "PlayerNumber.h" #include "PlayerNumber.h"
#include "GameConstantsAndTypes.h" #include "BackgroundUtil.h"
#include "Grade.h" #include "Grade.h"
#include "TimingData.h" #include "TimingData.h"
#include "Difficulty.h" #include "Difficulty.h"
@@ -37,10 +37,12 @@ class Song
public: public:
/* Set when this song should be displayed in the music wheel: */ /* Set when this song should be displayed in the music wheel: */
enum SelectionDisplay { SHOW_ALWAYS, /* all the time */ enum SelectionDisplay
SHOW_ROULETTE, /* only when rouletting */ {
SHOW_NEVER } /* never (unless song hiding is turned off) */ SHOW_ALWAYS, /* all the time */
m_SelectionDisplay; SHOW_ROULETTE, /* only when rouletting */
SHOW_NEVER /* never (unless song hiding is turned off) */
} m_SelectionDisplay;
Song(); Song();
~Song(); ~Song();