Removed #BackgroundMovie tag. Instead, TidyUpData will create a BackgroundChange for the movie if one is found in the song directory.
This commit is contained in:
@@ -110,22 +110,6 @@ void Background::LoadFromSong( Song* pSong )
|
|||||||
const float fXZoom = RECTWIDTH(RECT_BACKGROUND) / (float)SCREEN_WIDTH;
|
const float fXZoom = RECTWIDTH(RECT_BACKGROUND) / (float)SCREEN_WIDTH;
|
||||||
const float fYZoom = RECTHEIGHT(RECT_BACKGROUND) / (float)SCREEN_HEIGHT;
|
const float fYZoom = RECTHEIGHT(RECT_BACKGROUND) / (float)SCREEN_HEIGHT;
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// figure out what BackgroundMode to use
|
|
||||||
//
|
|
||||||
if( PREFSMAN->m_BackgroundMode == PrefsManager::BGMODE_OFF )
|
|
||||||
m_BackgroundMode = MODE_STATIC_BG;
|
|
||||||
else if( pSong->HasMovieBackground() )
|
|
||||||
m_BackgroundMode = MODE_MOVIE_BG;
|
|
||||||
else if( PREFSMAN->m_BackgroundMode == PrefsManager::BGMODE_MOVIEVIS )
|
|
||||||
m_BackgroundMode = MODE_MOVIE_VIS;
|
|
||||||
else if( PREFSMAN->m_BackgroundMode == PrefsManager::BGMODE_RANDOMMOVIES )
|
|
||||||
m_BackgroundMode = MODE_RANDOMMOVIES;
|
|
||||||
else
|
|
||||||
m_BackgroundMode = MODE_ANIMATIONS;
|
|
||||||
|
|
||||||
|
|
||||||
const CString sSongBackgroundPath = pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","fallback background");
|
const CString sSongBackgroundPath = pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","fallback background");
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -165,9 +149,9 @@ void Background::LoadFromSong( Song* pSong )
|
|||||||
CStringArray asFiles;
|
CStringArray asFiles;
|
||||||
|
|
||||||
// Look for movies in the song dir
|
// Look for movies in the song dir
|
||||||
GetDirListing( pSong->m_sSongDir+"movies\\"+aniseg.m_sBGName+".avi", asFiles, false, true );
|
GetDirListing( pSong->m_sSongDir+aniseg.m_sBGName+".avi", asFiles, false, true );
|
||||||
GetDirListing( pSong->m_sSongDir+"movies\\"+aniseg.m_sBGName+".mpg", asFiles, false, true );
|
GetDirListing( pSong->m_sSongDir+aniseg.m_sBGName+".mpg", asFiles, false, true );
|
||||||
GetDirListing( pSong->m_sSongDir+"movies\\"+aniseg.m_sBGName+".mpeg", asFiles, false, true );
|
GetDirListing( pSong->m_sSongDir+aniseg.m_sBGName+".mpeg", asFiles, false, true );
|
||||||
if( asFiles.GetSize() > 0 )
|
if( asFiles.GetSize() > 0 )
|
||||||
{
|
{
|
||||||
pTempBGA = new BGAnimation;
|
pTempBGA = new BGAnimation;
|
||||||
@@ -226,6 +210,19 @@ void Background::LoadFromSong( Song* pSong )
|
|||||||
}
|
}
|
||||||
else // pSong doesn't have an animation plan
|
else // pSong doesn't have an animation plan
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// figure out what BackgroundMode to use
|
||||||
|
//
|
||||||
|
if( PREFSMAN->m_BackgroundMode == PrefsManager::BGMODE_OFF )
|
||||||
|
m_BackgroundMode = MODE_STATIC_BG;
|
||||||
|
else if( PREFSMAN->m_BackgroundMode == PrefsManager::BGMODE_MOVIEVIS )
|
||||||
|
m_BackgroundMode = MODE_MOVIE_VIS;
|
||||||
|
else if( PREFSMAN->m_BackgroundMode == PrefsManager::BGMODE_RANDOMMOVIES )
|
||||||
|
m_BackgroundMode = MODE_RANDOMMOVIES;
|
||||||
|
else
|
||||||
|
m_BackgroundMode = MODE_ANIMATIONS;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load animations that will play while notes are active
|
// Load animations that will play while notes are active
|
||||||
//
|
//
|
||||||
@@ -233,13 +230,6 @@ void Background::LoadFromSong( Song* pSong )
|
|||||||
{
|
{
|
||||||
case MODE_STATIC_BG:
|
case MODE_STATIC_BG:
|
||||||
break;
|
break;
|
||||||
case MODE_MOVIE_BG:
|
|
||||||
{
|
|
||||||
pTempBGA = new BGAnimation;
|
|
||||||
pTempBGA->LoadFromMovie( pSong->GetMovieBackgroundPath(), false, true, true, sSongBackgroundPath );
|
|
||||||
m_BGAnimations.Add( pTempBGA );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MODE_MOVIE_VIS:
|
case MODE_MOVIE_VIS:
|
||||||
{
|
{
|
||||||
CStringArray arrayPossibleMovies;
|
CStringArray arrayPossibleMovies;
|
||||||
@@ -310,10 +300,7 @@ void Background::LoadFromSong( Song* pSong )
|
|||||||
/* If we have only 2, only generate a single animation segment for for the
|
/* If we have only 2, only generate a single animation segment for for the
|
||||||
* whole song. Otherwise, if it's a movie., it'll loop every four bars; we
|
* whole song. Otherwise, if it's a movie., it'll loop every four bars; we
|
||||||
* want it to play continuously. */
|
* want it to play continuously. */
|
||||||
float fMusicStartBeat, fBPS;
|
const float fFirstBeat = pSong->m_fFirstBeat;
|
||||||
bool bFreeze;
|
|
||||||
pSong->GetBeatAndBPSFromElapsedTime( -pSong->m_fBeat0OffsetInSeconds, fMusicStartBeat, fBPS, bFreeze );
|
|
||||||
const float fFirstBeat = (m_BackgroundMode==MODE_MOVIE_BG) ? fMusicStartBeat : pSong->m_fFirstBeat;
|
|
||||||
const float fLastBeat = pSong->m_fLastBeat;
|
const float fLastBeat = pSong->m_fLastBeat;
|
||||||
|
|
||||||
if( m_BGAnimations.GetSize() == 2) {
|
if( m_BGAnimations.GetSize() == 2) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
bool DangerVisible();
|
bool DangerVisible();
|
||||||
|
|
||||||
enum BackgroundMode { MODE_STATIC_BG, MODE_MOVIE_BG, MODE_ANIMATIONS, MODE_MOVIE_VIS, MODE_RANDOMMOVIES };
|
enum BackgroundMode { MODE_STATIC_BG, MODE_ANIMATIONS, MODE_MOVIE_VIS, MODE_RANDOMMOVIES };
|
||||||
BackgroundMode m_BackgroundMode;
|
BackgroundMode m_BackgroundMode;
|
||||||
|
|
||||||
BGAnimation m_BGADanger;
|
BGAnimation m_BGADanger;
|
||||||
|
|||||||
@@ -98,9 +98,6 @@ bool SMLoader::LoadFromSMFile( CString sPath, Song &out )
|
|||||||
else if( 0==stricmp(sValueName,"CDTITLE") )
|
else if( 0==stricmp(sValueName,"CDTITLE") )
|
||||||
out.m_sCDTitleFile = sParams[1];
|
out.m_sCDTitleFile = sParams[1];
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"MOVIEBACKGROUND") )
|
|
||||||
out.m_sMovieBackgroundFile = sParams[1];
|
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"MUSIC") )
|
else if( 0==stricmp(sValueName,"MUSIC") )
|
||||||
out.m_sMusicFile = sParams[1];
|
out.m_sMusicFile = sParams[1];
|
||||||
|
|
||||||
@@ -179,7 +176,7 @@ bool SMLoader::LoadFromSMFile( CString sPath, Song &out )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"BGCHANGES") )
|
else if( 0==stricmp(sValueName,"BGCHANGES") || 0==stricmp(sValueName,"ANIMATIONS") )
|
||||||
{
|
{
|
||||||
CStringArray aBGChangeExpressions;
|
CStringArray aBGChangeExpressions;
|
||||||
split( sParams[1], ",", aBGChangeExpressions );
|
split( sParams[1], ",", aBGChangeExpressions );
|
||||||
|
|||||||
+20
-12
@@ -385,7 +385,7 @@ void Song::TidyUpData()
|
|||||||
|
|
||||||
if( arrayPossibleMusic.GetSize() > 0 ) // we found a match
|
if( arrayPossibleMusic.GetSize() > 0 ) // we found a match
|
||||||
m_sMusicFile = arrayPossibleMusic[0];
|
m_sMusicFile = arrayPossibleMusic[0];
|
||||||
// Chris: Don't throw on missing music
|
// Don't throw on missing music. -Chris
|
||||||
// else
|
// else
|
||||||
// throw RageException( "The song in '%s' is missing a music file. You must place a music file in the song folder or remove the song", m_sSongDir );
|
// throw RageException( "The song in '%s' is missing a music file. You must place a music file in the song folder or remove the song", m_sSongDir );
|
||||||
}
|
}
|
||||||
@@ -507,8 +507,9 @@ void Song::TidyUpData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// If no BGChanges are specified and there are movies in the song directory, then assume
|
||||||
if( !HasMovieBackground() )
|
// they are DWI style where the movie begins at beat 0.
|
||||||
|
if( !HasBGChanges() )
|
||||||
{
|
{
|
||||||
CStringArray arrayPossibleMovies;
|
CStringArray arrayPossibleMovies;
|
||||||
GetDirListing( m_sSongDir + CString("*movie*.avi"), arrayPossibleMovies );
|
GetDirListing( m_sSongDir + CString("*movie*.avi"), arrayPossibleMovies );
|
||||||
@@ -518,7 +519,20 @@ void Song::TidyUpData()
|
|||||||
GetDirListing( m_sSongDir + CString("*.mpg"), arrayPossibleMovies );
|
GetDirListing( m_sSongDir + CString("*.mpg"), arrayPossibleMovies );
|
||||||
GetDirListing( m_sSongDir + CString("*.mpeg"), arrayPossibleMovies );
|
GetDirListing( m_sSongDir + CString("*.mpeg"), arrayPossibleMovies );
|
||||||
if( arrayPossibleMovies.GetSize() > 0 )
|
if( arrayPossibleMovies.GetSize() > 0 )
|
||||||
m_sMovieBackgroundFile = arrayPossibleMovies[0];
|
{
|
||||||
|
CString sBGMovieFile = arrayPossibleMovies[0];
|
||||||
|
|
||||||
|
// strip off extension from file name
|
||||||
|
CString sDir, sFName, sExt;
|
||||||
|
splitrelpath( sBGMovieFile, sDir, sFName, sExt );
|
||||||
|
|
||||||
|
// calculate start beat of music
|
||||||
|
float fMusicStartBeat, fBPS;
|
||||||
|
bool bFreeze;
|
||||||
|
this->GetBeatAndBPSFromElapsedTime( -this->m_fBeat0OffsetInSeconds, fMusicStartBeat, fBPS, bFreeze );
|
||||||
|
|
||||||
|
this->AddBackgroundChange( BackgroundChange(fMusicStartBeat,sFName) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -655,7 +669,6 @@ void Song::SaveToSMFile( CString sPath, bool bSavingCache )
|
|||||||
fprintf( fp, "#BANNER:%s;\n", m_sBannerFile );
|
fprintf( fp, "#BANNER:%s;\n", m_sBannerFile );
|
||||||
fprintf( fp, "#BACKGROUND:%s;\n", m_sBackgroundFile );
|
fprintf( fp, "#BACKGROUND:%s;\n", m_sBackgroundFile );
|
||||||
fprintf( fp, "#CDTITLE:%s;\n", m_sCDTitleFile );
|
fprintf( fp, "#CDTITLE:%s;\n", m_sCDTitleFile );
|
||||||
fprintf( fp, "#MOVIEBACKGROUND:%s;\n", m_sMovieBackgroundFile );
|
|
||||||
fprintf( fp, "#MUSIC:%s;\n", m_sMusicFile );
|
fprintf( fp, "#MUSIC:%s;\n", m_sMusicFile );
|
||||||
fprintf( fp, "#MUSICBYTES:%u;\n", m_iMusicBytes );
|
fprintf( fp, "#MUSICBYTES:%u;\n", m_iMusicBytes );
|
||||||
fprintf( fp, "#MUSICLENGTH:%.2f;\n", m_fMusicLengthSeconds );
|
fprintf( fp, "#MUSICLENGTH:%.2f;\n", m_fMusicLengthSeconds );
|
||||||
@@ -983,7 +996,6 @@ bool Song::HasMusic() const {return m_sMusicFile != "" && IsAFile(GetMusicPa
|
|||||||
bool Song::HasBanner() const {return m_sBannerFile != "" && IsAFile(GetBannerPath()); };
|
bool Song::HasBanner() const {return m_sBannerFile != "" && IsAFile(GetBannerPath()); };
|
||||||
bool Song::HasBackground() const {return m_sBackgroundFile != "" && IsAFile(GetBackgroundPath()); };
|
bool Song::HasBackground() const {return m_sBackgroundFile != "" && IsAFile(GetBackgroundPath()); };
|
||||||
bool Song::HasCDTitle() const {return m_sCDTitleFile != "" && IsAFile(GetCDTitlePath()); };
|
bool Song::HasCDTitle() const {return m_sCDTitleFile != "" && IsAFile(GetCDTitlePath()); };
|
||||||
bool Song::HasMovieBackground() const {return m_sMovieBackgroundFile != ""&& IsAFile(GetMovieBackgroundPath()); };
|
|
||||||
bool Song::HasBGChanges() const {return m_BackgroundChanges.GetSize() > 0; };
|
bool Song::HasBGChanges() const {return m_BackgroundChanges.GetSize() > 0; };
|
||||||
|
|
||||||
int Song::GetNumTimesPlayed() const
|
int Song::GetNumTimesPlayed() const
|
||||||
@@ -1045,10 +1057,6 @@ CString Song::GetBannerPath() const
|
|||||||
return m_sSongDir+m_sBannerFile;
|
return m_sSongDir+m_sBannerFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString Song::GetBackgroundPath() const
|
|
||||||
{
|
|
||||||
return m_sSongDir+m_sBackgroundFile;
|
|
||||||
}
|
|
||||||
CString Song::GetCDTitlePath() const
|
CString Song::GetCDTitlePath() const
|
||||||
{
|
{
|
||||||
if( m_sCDTitleFile.Find('\\') == -1)
|
if( m_sCDTitleFile.Find('\\') == -1)
|
||||||
@@ -1060,7 +1068,7 @@ CString Song::GetCDTitlePath() const
|
|||||||
return m_sCDTitleFile;
|
return m_sCDTitleFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString Song::GetMovieBackgroundPath() const
|
CString Song::GetBackgroundPath() const
|
||||||
{
|
{
|
||||||
return m_sSongDir+m_sMovieBackgroundFile;
|
return m_sSongDir+m_sBackgroundFile;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,13 +122,11 @@ public:
|
|||||||
CString m_sBannerFile;
|
CString m_sBannerFile;
|
||||||
CString m_sBackgroundFile;
|
CString m_sBackgroundFile;
|
||||||
CString m_sCDTitleFile;
|
CString m_sCDTitleFile;
|
||||||
CString m_sMovieBackgroundFile;
|
|
||||||
|
|
||||||
CString GetMusicPath() const;
|
CString GetMusicPath() const;
|
||||||
CString GetBannerPath() const;
|
CString GetBannerPath() const;
|
||||||
CString GetBackgroundPath() const;
|
CString GetBackgroundPath() const;
|
||||||
CString GetCDTitlePath() const;
|
CString GetCDTitlePath() const;
|
||||||
CString GetMovieBackgroundPath() const;
|
|
||||||
|
|
||||||
|
|
||||||
bool HasMusic() const;
|
bool HasMusic() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user