diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index b98d171f48..147a9a1d99 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -51,7 +51,7 @@ void BGAnimation::LoadFromAniDir( CString sAniDir ) { Unload(); - if( sAniDir.Right(1) != "/" ) + if( !sAniDir.empty() && sAniDir.Right(1) != "/" ) sAniDir += "/"; ASSERT( IsADirectory(sAniDir) ); diff --git a/stepmania/src/TransitionBGAnimation.cpp b/stepmania/src/TransitionBGAnimation.cpp index 7683aa2a00..501d62a7ef 100644 --- a/stepmania/src/TransitionBGAnimation.cpp +++ b/stepmania/src/TransitionBGAnimation.cpp @@ -13,6 +13,7 @@ #include "TransitionBGAnimation.h" #include "RageUtil.h" #include "ScreenManager.h" +#include "IniFile.h" TransitionBGAnimation::TransitionBGAnimation() @@ -23,9 +24,21 @@ TransitionBGAnimation::TransitionBGAnimation() void TransitionBGAnimation::Load( CString sBGAniDir ) { + if( !sBGAniDir.empty() && sBGAniDir.Right(1) != "/" ) + sBGAniDir += "/"; + m_BGAnimation.LoadFromAniDir( sBGAniDir ); - m_sound.Load( sBGAniDir ); + // load sound from file specified by ini, or use the first sound in the directory + IniFile ini; + ini.SetPath( sBGAniDir+"BGAnimation.ini" ); + ini.ReadFile(); + + CString sSoundFileName; + if( ini.GetValue("BGAnimation","Sound",sSoundFileName) ) + m_sound.Load( sBGAniDir+sSoundFileName ); + else + m_sound.Load( sBGAniDir ); }