Missing a music file is no longer a fatal error.
This commit is contained in:
@@ -69,7 +69,7 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Notes &out )
|
||||
|
||||
CStdioFile file;
|
||||
if( !file.Open( sPath, CFile::modeRead|CFile::shareDenyNone ) )
|
||||
throw RageException( "Failed to open %s.", sPath );
|
||||
throw RageException( "Failed to open %s for reading.", sPath );
|
||||
|
||||
CString line;
|
||||
while( file.ReadString(line) ) // foreach line
|
||||
@@ -115,6 +115,8 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Notes &out )
|
||||
case 3: // double
|
||||
out.m_NotesType = NOTES_TYPE_DANCE_DOUBLE;
|
||||
break;
|
||||
default:
|
||||
throw RageException( "Invalid value '%d' for '#player'", atoi(value_data) );
|
||||
}
|
||||
}
|
||||
if( -1 != value_name.Find("#title") )
|
||||
@@ -285,7 +287,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
|
||||
|
||||
CStdioFile file;
|
||||
if( !file.Open( sPath, CFile::modeRead|CFile::shareDenyNone ) )
|
||||
throw RageException( "Failed to open %s.", sPath );
|
||||
throw RageException( "Failed to open %s for reading.", sPath );
|
||||
|
||||
CString line;
|
||||
while( file.ReadString(line) ) // foreach line
|
||||
@@ -422,7 +424,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
|
||||
// open the song file again and and look for this tag's value
|
||||
CStdioFile file;
|
||||
if( !file.Open( sPath, CFile::modeRead|CFile::shareDenyNone ) )
|
||||
throw RageException( "Failed to open %s.", sPath );
|
||||
throw RageException( "Failed to open %s for reading.", sPath );
|
||||
|
||||
CString line;
|
||||
while( file.ReadString(line) ) // foreach line
|
||||
@@ -484,7 +486,7 @@ bool BMSLoader::LoadFromDir( CString sDir, Song &out )
|
||||
// open the song file again and and look for this tag's value
|
||||
CStdioFile file;
|
||||
if( !file.Open( sPath, CFile::modeRead|CFile::shareDenyNone ) )
|
||||
throw RageException( "Failed to open %s.", sPath );
|
||||
throw RageException( "Failed to open %s for reading.", sPath );
|
||||
|
||||
CString line;
|
||||
while( file.ReadString(line) ) // foreach line
|
||||
|
||||
@@ -250,7 +250,7 @@ bool DWILoader::LoadFromDWIFile( CString sPath, Song &out )
|
||||
MsdFile msd;
|
||||
bool bResult = msd.ReadFile( sPath );
|
||||
if( !bResult )
|
||||
throw RageException( "Error opening file '%s'.", sPath );
|
||||
throw RageException( "Error opening file '%s' for reading.", sPath );
|
||||
|
||||
for( int i=0; i<msd.m_iNumValues; i++ )
|
||||
{
|
||||
|
||||
@@ -137,9 +137,17 @@ void ScreenEditMenu::MenuRight( PlayerNumber pn, const InputEventType type )
|
||||
|
||||
void ScreenEditMenu::MenuStart( PlayerNumber pn )
|
||||
{
|
||||
GAMESTATE->m_pCurSong = Selector.GetSelectedSong();
|
||||
|
||||
if( !GAMESTATE->m_pCurSong->HasMusic() )
|
||||
{
|
||||
SCREENMAN->SystemMessage( "This song is missing a music file and cannot be edited" );
|
||||
SOUND->PlayOnceStreamed( THEME->GetPathTo("Sounds","menu invalid") );
|
||||
return;
|
||||
}
|
||||
|
||||
MUSIC->Stop();
|
||||
|
||||
GAMESTATE->m_pCurSong = Selector.GetSelectedSong();
|
||||
|
||||
// get the style
|
||||
GAMESTATE->m_CurStyle = Selector.GetSelectedStyle();
|
||||
|
||||
@@ -142,6 +142,7 @@ void ScreenHowToPlay::MenuStart( PlayerNumber pn )
|
||||
{
|
||||
m_Menu.TweenOffScreenToMenu( SM_GoToNextScreen );
|
||||
|
||||
m_sprHowToPlay.StopTweening();
|
||||
m_sprHowToPlay.BeginTweening( 0.3f, Actor::TWEEN_BIAS_END );
|
||||
m_sprHowToPlay.SetTweenX( SCREEN_RIGHT+m_sprHowToPlay.GetUnzoomedWidth()/2 );
|
||||
}
|
||||
|
||||
@@ -157,9 +157,11 @@ void ScreenPrompt::MenuStart( PlayerNumber pn )
|
||||
SOUND->PlayOnceStreamed( THEME->GetPathTo("Sounds","menu start") );
|
||||
|
||||
if( m_bAnswer )
|
||||
m_pOnYes();
|
||||
if( m_pOnYes )
|
||||
m_pOnYes();
|
||||
else
|
||||
m_pOnNo();
|
||||
if( m_pOnNo )
|
||||
m_pOnNo();
|
||||
}
|
||||
|
||||
void ScreenPrompt::MenuBack( PlayerNumber pn )
|
||||
|
||||
@@ -771,7 +771,7 @@ void ScreenSelectMusic::PlayMusicSample()
|
||||
//LOG->Trace( "ScreenSelectSong::PlaySONGample()" );
|
||||
|
||||
Song* pSong = m_MusicWheel.GetSelectedSong();
|
||||
if( pSong )
|
||||
if( pSong && pSong->HasMusic() )
|
||||
{
|
||||
MUSIC->Stop();
|
||||
MUSIC->Load( pSong->GetMusicPath() );
|
||||
|
||||
+13
-5
@@ -384,13 +384,21 @@ void Song::TidyUpData()
|
||||
|
||||
if( arrayPossibleMusic.GetSize() > 0 ) // we found a match
|
||||
m_sMusicFile = arrayPossibleMusic[0];
|
||||
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 );
|
||||
// Chris: Don't throw on missing music
|
||||
// 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 );
|
||||
}
|
||||
|
||||
RageSoundStream sound;
|
||||
sound.Load( GetMusicPath() );
|
||||
m_fMusicLengthSeconds = sound.GetLengthSeconds();
|
||||
if( HasMusic() )
|
||||
{
|
||||
RageSoundStream sound;
|
||||
sound.Load( GetMusicPath() );
|
||||
m_fMusicLengthSeconds = sound.GetLengthSeconds();
|
||||
}
|
||||
else // ! HasMusic()
|
||||
{
|
||||
m_fMusicLengthSeconds = 100; // guess
|
||||
}
|
||||
|
||||
|
||||
// We're going to try and do something intelligent here...
|
||||
|
||||
@@ -600,11 +600,15 @@ bool SongManager::ChooseRandomSong()
|
||||
for( i=0; i<600; i++ ) // try 600 times
|
||||
{
|
||||
Song* pSong = m_pSongs[ rand()%m_pSongs.GetSize() ];
|
||||
|
||||
if( pSong->m_apNotes.GetSize() == 0 )
|
||||
continue; // skip
|
||||
|
||||
if( !pSong->HasMusic() )
|
||||
continue; // skip
|
||||
|
||||
for( int j=0; j<3; j++ ) // try 3 times
|
||||
{
|
||||
if( pSong->m_apNotes.GetSize() == 0 )
|
||||
continue;
|
||||
|
||||
/* XXX: This assumes we're set to a style that doesn't use separate
|
||||
* notes for each player, such as VERSUS. */
|
||||
Notes* pNotes = pSong->m_apNotes[ rand()%pSong->m_apNotes.GetSize() ];
|
||||
|
||||
Reference in New Issue
Block a user