From 4e86ffe01d453cff4219b3f76d1974fbce5ae04b Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 5 Jun 2005 01:27:15 +0000 Subject: [PATCH] add background change controls for "baked random" Shift+B to choose to choose a different baked random movie add bgchange menu lines for "movie in group" and "movie in group and in genre" --- stepmania/src/BackgroundUtil.cpp | 20 ++- stepmania/src/BackgroundUtil.h | 3 +- stepmania/src/NoteField.cpp | 21 +-- stepmania/src/ScreenEdit.cpp | 227 +++++++++++++++++++++---------- stepmania/src/ScreenEdit.h | 10 +- 5 files changed, 186 insertions(+), 95 deletions(-) diff --git a/stepmania/src/BackgroundUtil.cpp b/stepmania/src/BackgroundUtil.cpp index c32186a8c1..1fba0f9bcb 100644 --- a/stepmania/src/BackgroundUtil.cpp +++ b/stepmania/src/BackgroundUtil.cpp @@ -173,7 +173,13 @@ void BackgroundUtil::GetGlobalBGAnimations( const Song *pSong, const CString &sM StripCvs( vsPathsOut, vsNamesOut ); } -void BackgroundUtil::GetGlobalRandomMovies( const Song *pSong, const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut ) +void BackgroundUtil::GetGlobalRandomMovies( + const Song *pSong, + const CString &sMatch, + vector &vsPathsOut, + vector &vsNamesOut, + bool bTryInsideOfSongGroupAndGenreFirst, + bool bTryInsideOfSongGroupFirst ) { vsPathsOut.clear(); vsNamesOut.clear(); @@ -193,12 +199,12 @@ void BackgroundUtil::GetGlobalRandomMovies( const Song *pSong, const CString &sM // Search for the most appropriate background // { - set ssFilterToFileNames; - if( pSong && !pSong->m_sGenre.empty() ) - GetFilterToFileNames( RANDOMMOVIES_DIR, pSong, ssFilterToFileNames ); + set ssFileNameWhitelist; + if( bTryInsideOfSongGroupAndGenreFirst && pSong && !pSong->m_sGenre.empty() ) + GetFilterToFileNames( RANDOMMOVIES_DIR, pSong, ssFileNameWhitelist ); vector vsDirsToTry; - if( pSong ) + if( bTryInsideOfSongGroupFirst && pSong ) { ASSERT( !pSong->m_sGroupName.empty() ); vsDirsToTry.push_back( RANDOMMOVIES_DIR+pSong->m_sGroupName+"/" ); @@ -211,12 +217,12 @@ void BackgroundUtil::GetGlobalRandomMovies( const Song *pSong, const CString &sM GetDirListing( *sDir+"*.mpg", vsPathsOut, false, true ); GetDirListing( *sDir+"*.mpeg", vsPathsOut, false, true ); - if( !ssFilterToFileNames.empty() ) + if( !ssFileNameWhitelist.empty() ) { for( unsigned i=0; i &vBackgroundChanges ); @@ -83,7 +82,7 @@ namespace BackgroundUtil 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 Song *pSong, const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); - void GetGlobalRandomMovies( const Song *pSong, const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut ); + void GetGlobalRandomMovies( const Song *pSong, const CString &sMatch, vector &vsPathsOut, vector &vsNamesOut, bool bTryInsideOfSongGroupAndGenreFirst = true, bool bTryInsideOfSongGroupFirst = true ); }; diff --git a/stepmania/src/NoteField.cpp b/stepmania/src/NoteField.cpp index 4838db4e2d..d239cf76d9 100644 --- a/stepmania/src/NoteField.cpp +++ b/stepmania/src/NoteField.cpp @@ -566,22 +566,23 @@ void NoteField::DrawPrimitives() if( IS_ON_SCREEN(fLowestBeat) ) { - vector vs; + vector vsBGChanges; FOREACH_CONST( BackgroundLayer, viLowestIndex, i ) { ASSERT( iter[*i] != GAMESTATE->m_pCurSong->GetBackgroundChanges(*i).end() ); const BackgroundChange& change = *iter[*i]; - vs.push_back( ssprintf("%s%s%s%s%s%s", - ((*i!=0) ? ssprintf("%d: ",*i) : CString()).c_str(), - (!change.m_def.m_sFile1.empty() ? " "+change.m_def.m_sFile1 : CString()).c_str(), - (!change.m_def.m_sFile2.empty() ? " "+change.m_def.m_sFile2 : CString()).c_str(), - ((change.m_fRate!=1.0f) ? ssprintf("%.2f%%",change.m_fRate*100) : CString()).c_str(), - (!change.m_sTransition.empty() ? " "+change.m_sTransition : CString()).c_str(), - (!change.m_def.m_sEffect.empty() ? " "+change.m_def.m_sEffect : CString()).c_str() - ) ); + vector vsParts; + if( *i!=0 ) vsParts.push_back( ssprintf("%d: ",*i) ); + if( !change.m_def.m_sFile1.empty() ) vsParts.push_back( change.m_def.m_sFile1 ); + if( !change.m_def.m_sFile2.empty() ) vsParts.push_back( change.m_def.m_sFile2 ); + if( change.m_fRate!=1.0f ) vsParts.push_back( ssprintf("%.2f%%",change.m_fRate*100) ); + if( !change.m_sTransition.empty() ) vsParts.push_back( change.m_sTransition ); + if( !change.m_def.m_sEffect.empty() ) vsParts.push_back( change.m_def.m_sEffect ); + + vsBGChanges.push_back( join("\n",vsParts) ); } - DrawBGChangeText( fLowestBeat, join("\n",vs) ); + DrawBGChangeText( fLowestBeat, join("\n",vsBGChanges) ); } FOREACH_CONST( BackgroundLayer, viLowestIndex, i ) iter[*i]++; diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 61bca9a85a..e2ba31697b 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -144,10 +144,13 @@ void ScreenEdit::InitEditMappings() g_EditMappings.button[EDIT_BUTTON_OPEN_EDIT_MENU][0] = DeviceInput(DEVICE_KEYBOARD, KEY_ESC); g_EditMappings.button[EDIT_BUTTON_OPEN_AREA_MENU][0] = DeviceInput(DEVICE_KEYBOARD, KEY_ENTER); - g_EditMappings.button[EDIT_BUTTON_OPEN_AREA_MENU][1] = DeviceInput(DEVICE_KEYBOARD, KEY_KP_ENTER); g_EditMappings.button[EDIT_BUTTON_OPEN_BGA_MENU][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cb); g_EditMappings.button[EDIT_BUTTON_OPEN_COURSE_MENU][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cc); g_EditMappings.button[EDIT_BUTTON_OPEN_INPUT_HELP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_F1); + + g_EditMappings.button[EDIT_BUTTON_NEW_BAKED_RANDOM_FILE_FOR_BGCHANGE][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cb); + g_EditMappings.hold[EDIT_BUTTON_NEW_BAKED_RANDOM_FILE_FOR_BGCHANGE][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT); + g_EditMappings.hold[EDIT_BUTTON_NEW_BAKED_RANDOM_FILE_FOR_BGCHANGE][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT); g_EditMappings.button[EDIT_BUTTON_PLAY_FROM_START][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cp); g_EditMappings.hold[EDIT_BUTTON_PLAY_FROM_START][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL); @@ -441,48 +444,74 @@ static Menu g_SongInformation( MenuRow( ScreenEdit::artist_transliteration, "Artist transliteration", true, EDIT_MODE_PRACTICE, 0, NULL ) ); -enum { none, pick_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(); +enum { song_bganimation, song_movie, song_bitmap, global_bganimation, global_movie, global_movie_song_group, global_movie_song_group_and_genre, dynamic_random, baked_random, none }; +static bool EnabledIfSet1SongBGAnimation(); +static bool EnabledIfSet1SongMovie(); +static bool EnabledIfSet1SongBitmap(); +static bool EnabledIfSet1GlobalBGAnimation(); +static bool EnabledIfSet1GlobalMovie(); +static bool EnabledIfSet1GlobalMovieSongGroup(); +static bool EnabledIfSet1GlobalMovieSongGroupAndGenre(); +static bool EnabledIfSet2SongBGAnimation(); +static bool EnabledIfSet2SongMovie(); +static bool EnabledIfSet2SongBitmap(); +static bool EnabledIfSet2GlobalBGAnimation(); +static bool EnabledIfSet2GlobalMovie(); +static bool EnabledIfSet2GlobalMovieSongGroup(); +static bool EnabledIfSet2GlobalMovieSongGroupAndGenre(); 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::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 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 Movie", EnabledIfSet2GM,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, "Song BGAnimation", "Song Movie", "Song Bitmap", "Global BGAnimation", "Global Movie", "Global Movie from Song Group", "Global Movie from Song Group and Genre", "Dynamic Random", "Baked Random", "None" ), + MenuRow( ScreenEdit::file1_song_bganimation, "File1 Song BGAnimation", EnabledIfSet1SongBGAnimation, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file1_song_movie, "File1 Song Movie", EnabledIfSet1SongMovie, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file1_song_still, "File1 Song Still", EnabledIfSet1SongBitmap, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file1_global_bganimation, "File1 Global BGAnimation", EnabledIfSet1GlobalBGAnimation, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file1_global_movie, "File1 Global Movie", EnabledIfSet1GlobalMovie, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file1_global_movie_song_group, "File1 Global Movie (Group)", EnabledIfSet1GlobalMovieSongGroup, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file1_global_movie_song_group_and_genre, "File1 Global Movie (Group + Genre)", EnabledIfSet1GlobalMovieSongGroupAndGenre, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file2_type, "File2 Type", true, EDIT_MODE_FULL, 0, "Song BGAnimation", "Song Movie", "Song Bitmap", "Global BGAnimation", "Global Movie", "Global Movie from Song Group", "Global Movie from Song Group and Genre", "Dynamic Random", "Baked Random", "None" ), + MenuRow( ScreenEdit::file2_song_bganimation, "File2 Song BGAnimation", EnabledIfSet2SongBGAnimation, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file2_song_movie, "File2 Song Movie", EnabledIfSet2SongMovie, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file2_song_still, "File2 Song Still", EnabledIfSet2SongBitmap, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file2_global_bganimation, "File2 Global BGAnimation", EnabledIfSet2GlobalBGAnimation, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file2_global_movie, "File2 Global Movie", EnabledIfSet2GlobalMovie, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file2_global_movie_song_group, "File2 Global Movie (Group)", EnabledIfSet2GlobalMovieSongGroup, EDIT_MODE_FULL, 0, NULL ), + MenuRow( ScreenEdit::file2_global_movie_song_group_and_genre, "File2 Global Movie (Group + Genre)", EnabledIfSet2GlobalMovieSongGroupAndGenre, 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 bool EnabledIfSet1SongBGAnimation() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file1_type] == song_bganimation && !g_BackgroundChange.rows[ScreenEdit::file1_song_bganimation].choices.empty(); } +static bool EnabledIfSet1SongMovie() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file1_type] == song_movie && !g_BackgroundChange.rows[ScreenEdit::file1_song_movie].choices.empty(); } +static bool EnabledIfSet1SongBitmap() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file1_type] == song_bitmap && !g_BackgroundChange.rows[ScreenEdit::file1_song_still].choices.empty(); } +static bool EnabledIfSet1GlobalBGAnimation() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file1_type] == global_bganimation && !g_BackgroundChange.rows[ScreenEdit::file1_global_bganimation].choices.empty(); } +static bool EnabledIfSet1GlobalMovie() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file1_type] == global_movie && !g_BackgroundChange.rows[ScreenEdit::file1_global_movie].choices.empty(); } +static bool EnabledIfSet1GlobalMovieSongGroup() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file1_type] == global_movie_song_group && !g_BackgroundChange.rows[ScreenEdit::file1_global_movie_song_group].choices.empty(); } +static bool EnabledIfSet1GlobalMovieSongGroupAndGenre() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file1_type] == global_movie_song_group_and_genre && !g_BackgroundChange.rows[ScreenEdit::file1_global_movie_song_group_and_genre].choices.empty(); } +static bool EnabledIfSet2SongBGAnimation() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file2_type] == song_bganimation && !g_BackgroundChange.rows[ScreenEdit::file2_song_bganimation].choices.empty(); } +static bool EnabledIfSet2SongMovie() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file2_type] == song_movie && !g_BackgroundChange.rows[ScreenEdit::file2_song_movie].choices.empty(); } +static bool EnabledIfSet2SongBitmap() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file2_type] == song_bitmap && !g_BackgroundChange.rows[ScreenEdit::file2_song_still].choices.empty(); } +static bool EnabledIfSet2GlobalBGAnimation() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file2_type] == global_bganimation && !g_BackgroundChange.rows[ScreenEdit::file2_global_bganimation].choices.empty(); } +static bool EnabledIfSet2GlobalMovie() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file2_type] == global_movie && !g_BackgroundChange.rows[ScreenEdit::file2_global_movie].choices.empty(); } +static bool EnabledIfSet2GlobalMovieSongGroup() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file2_type] == global_movie_song_group && !g_BackgroundChange.rows[ScreenEdit::file2_global_movie_song_group].choices.empty(); } +static bool EnabledIfSet2GlobalMovieSongGroupAndGenre() { return ScreenMiniMenu::s_viLastAnswers[ScreenEdit::file2_type] == global_movie_song_group_and_genre && !g_BackgroundChange.rows[ScreenEdit::file2_global_movie_song_group_and_genre].choices.empty(); } +static CString GetOneBakedRandomFile( Song *pSong ) +{ + vector vsPathsOut; + vector vsNamesOut; + BackgroundUtil::GetGlobalRandomMovies( + pSong, + "", + vsPathsOut, + vsNamesOut ); + if( !vsNamesOut.empty() ) + return vsNamesOut[rand()%vsNamesOut.size()]; + else + return ""; +} static Menu g_Prefs( "ScreenMiniMenuPreferences", @@ -1366,6 +1395,39 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ SCREENMAN->MiniMenu( &g_CourseMode, SM_BackFromCourseModeMenu ); break; } + case EDIT_BUTTON_NEW_BAKED_RANDOM_FILE_FOR_BGCHANGE: + { + if( GetOneBakedRandomFile(m_pSong).empty() ) + { + SCREENMAN->PlayInvalidSound(); + SCREENMAN->SystemMessage( "No backgrounds available" ); + } + else + { + bool bAlreadyBGChangeHere = false; + BackgroundLayer iLayer = BACKGROUND_LAYER_1; + BackgroundChange bgChange; + bgChange.m_fStartBeat = GAMESTATE->m_fSongBeat; + FOREACH_BackgroundLayer( l ) + { + FOREACH( BackgroundChange, m_pSong->GetBackgroundChanges(l), bgc ) + { + if( bgc->m_fStartBeat == GAMESTATE->m_fSongBeat ) + { + bAlreadyBGChangeHere = true; + iLayer = l; + bgChange = *bgc; + m_pSong->GetBackgroundChanges(iLayer).erase( bgc ); + } + } + } + bgChange.m_def.m_sFile1 = GetOneBakedRandomFile( m_pSong ); + m_pSong->AddBackgroundChange( iLayer, bgChange ); + m_soundMarker.Play(); + } + } + break; + case EDIT_BUTTON_PLAY_FROM_START: HandleMainMenuChoice( play_whole_song ); break; @@ -2066,15 +2128,19 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector &iAns 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( NULL, "", vThrowAway, g_BackgroundChange.rows[file1_global_bganimation].choices ); // NULL to get all background files - BackgroundUtil::GetGlobalRandomMovies( NULL, "", vThrowAway, g_BackgroundChange.rows[file1_global_random_movie].choices ); // NULL to get all background files + BackgroundUtil::GetGlobalBGAnimations( m_pSong, "", vThrowAway, g_BackgroundChange.rows[file1_global_bganimation].choices ); // NULL to get all background files + BackgroundUtil::GetGlobalRandomMovies( m_pSong, "", vThrowAway, g_BackgroundChange.rows[file1_global_movie].choices, false, false ); // all backgrounds + BackgroundUtil::GetGlobalRandomMovies( m_pSong, "", vThrowAway, g_BackgroundChange.rows[file1_global_movie_song_group].choices, false, true ); // song group's backgrounds + BackgroundUtil::GetGlobalRandomMovies( m_pSong, "", vThrowAway, g_BackgroundChange.rows[file1_global_movie_song_group_and_genre].choices, true, true ); // song group and genre's backgrounds - 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; - g_BackgroundChange.rows[file2_global_random_movie].choices = g_BackgroundChange.rows[file1_global_random_movie].choices; - g_BackgroundChange.rows[file2_global_bganimation].choices = g_BackgroundChange.rows[file1_global_bganimation].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; + g_BackgroundChange.rows[file2_global_bganimation].choices = g_BackgroundChange.rows[file1_global_bganimation].choices; + g_BackgroundChange.rows[file2_global_movie].choices = g_BackgroundChange.rows[file1_global_movie].choices; + g_BackgroundChange.rows[file2_global_movie_song_group].choices = g_BackgroundChange.rows[file1_global_movie_song_group].choices; + g_BackgroundChange.rows[file2_global_movie_song_group_and_genre].choices= g_BackgroundChange.rows[file1_global_movie_song_group_and_genre].choices; // @@ -2102,37 +2168,44 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector &iAns 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( file1_global_movie ); + FILL_ENABLED( file1_global_movie_song_group ); + FILL_ENABLED( file1_global_movie_song_group_and_genre ); 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 ); + FILL_ENABLED( file2_global_movie ); + FILL_ENABLED( file2_global_movie_song_group ); + FILL_ENABLED( file2_global_movie_song_group_and_genre ); #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[transition]. SetDefaultChoiceIfPresent( bgChange.m_sTransition ); - g_BackgroundChange.rows[effect]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sEffect ); - g_BackgroundChange.rows[file1_type].iDefaultChoice = none; - if( bgChange.m_def.m_sFile1 == RANDOM_BACKGROUND_FILE ) g_BackgroundChange.rows[file1_type].iDefaultChoice = pick_random; - if( g_BackgroundChange.rows[file1_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = song_bganimation; - if( g_BackgroundChange.rows[file1_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = song_movie; - if( g_BackgroundChange.rows[file1_song_still]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = song_bitmap; - if( g_BackgroundChange.rows[file1_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = global_bganimation; - if( g_BackgroundChange.rows[file1_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = global_movie; - g_BackgroundChange.rows[file2_type].iDefaultChoice = none; - if( bgChange.m_def.m_sFile2 == RANDOM_BACKGROUND_FILE ) g_BackgroundChange.rows[file2_type].iDefaultChoice = pick_random; - if( g_BackgroundChange.rows[file2_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = song_bganimation; - if( g_BackgroundChange.rows[file2_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = song_movie; - if( g_BackgroundChange.rows[file2_song_still]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = song_bitmap; - if( g_BackgroundChange.rows[file2_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = global_bganimation; - if( g_BackgroundChange.rows[file2_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = global_movie; - + g_BackgroundChange.rows[layer]. SetDefaultChoiceIfPresent( ssprintf("%d",iLayer) ); + g_BackgroundChange.rows[rate]. SetDefaultChoiceIfPresent( ssprintf("%2.0f%%",bgChange.m_fRate*100) ); + g_BackgroundChange.rows[transition]. SetDefaultChoiceIfPresent( bgChange.m_sTransition ); + g_BackgroundChange.rows[effect]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sEffect ); + g_BackgroundChange.rows[file1_type].iDefaultChoice = none; + if( bgChange.m_def.m_sFile1 == RANDOM_BACKGROUND_FILE ) g_BackgroundChange.rows[file1_type].iDefaultChoice = dynamic_random; + if( g_BackgroundChange.rows[file1_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = song_bganimation; + if( g_BackgroundChange.rows[file1_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = song_movie; + if( g_BackgroundChange.rows[file1_song_still]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = song_bitmap; + if( g_BackgroundChange.rows[file1_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = global_bganimation; + if( g_BackgroundChange.rows[file1_global_movie]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = global_movie; + if( g_BackgroundChange.rows[file1_global_movie_song_group]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = global_movie_song_group; + if( g_BackgroundChange.rows[file1_global_movie_song_group_and_genre]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile1 ) ) g_BackgroundChange.rows[file1_type].iDefaultChoice = global_movie_song_group_and_genre; + g_BackgroundChange.rows[file2_type].iDefaultChoice = none; + if( bgChange.m_def.m_sFile2 == RANDOM_BACKGROUND_FILE ) g_BackgroundChange.rows[file2_type].iDefaultChoice = dynamic_random; + if( g_BackgroundChange.rows[file2_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = song_bganimation; + if( g_BackgroundChange.rows[file2_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = song_movie; + if( g_BackgroundChange.rows[file2_song_still]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = song_bitmap; + if( g_BackgroundChange.rows[file2_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = global_bganimation; + if( g_BackgroundChange.rows[file2_global_movie]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = global_movie; + if( g_BackgroundChange.rows[file2_global_movie_song_group]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = global_movie_song_group; + if( g_BackgroundChange.rows[file2_global_movie_song_group_and_genre]. SetDefaultChoiceIfPresent( bgChange.m_def.m_sFile2 ) ) g_BackgroundChange.rows[file2_type].iDefaultChoice = global_movie_song_group_and_genre; SCREENMAN->MiniMenu( &g_BackgroundChange, SM_BackFromBGChange ); } @@ -2667,15 +2740,18 @@ void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, const vector &iAns switch( iAnswers[file1_type] ) { default: ASSERT(0); - case none: newChange.m_def.m_sFile1 = ""; break; - case pick_random: newChange.m_def.m_sFile1 = RANDOM_BACKGROUND_FILE; break; + case none: newChange.m_def.m_sFile1 = ""; break; + case dynamic_random: newChange.m_def.m_sFile1 = RANDOM_BACKGROUND_FILE; break; + case baked_random: newChange.m_def.m_sFile1 = GetOneBakedRandomFile( m_pSong ); break; case song_bganimation: case song_movie: case song_bitmap: case global_bganimation: case global_movie: + case global_movie_song_group: + case global_movie_song_group_and_genre: { - BGChangeChoice row1 = (BGChangeChoice)(file1_song_bganimation + iAnswers[file1_type]-2); + BGChangeChoice row1 = (BGChangeChoice)(file1_song_bganimation + iAnswers[file1_type]); newChange.m_def.m_sFile1 = g_BackgroundChange.rows[row1].choices[iAnswers[row1]]; } break; @@ -2683,15 +2759,18 @@ void ScreenEdit::HandleBGChangeChoice( BGChangeChoice c, const vector &iAns switch( iAnswers[file2_type] ) { default: ASSERT(0); - case none: newChange.m_def.m_sFile2 = ""; break; - case pick_random: newChange.m_def.m_sFile2 = RANDOM_BACKGROUND_FILE; break; + case none: newChange.m_def.m_sFile2 = ""; break; + case dynamic_random: newChange.m_def.m_sFile2 = RANDOM_BACKGROUND_FILE; break; + case baked_random: newChange.m_def.m_sFile2 = GetOneBakedRandomFile( m_pSong ); break; case song_bganimation: case song_movie: case song_bitmap: case global_bganimation: case global_movie: + case global_movie_song_group: + case global_movie_song_group_and_genre: { - BGChangeChoice row2 = (BGChangeChoice)(file2_song_bganimation + iAnswers[file2_type]-2); + BGChangeChoice row2 = (BGChangeChoice)(file2_song_bganimation + iAnswers[file2_type]); newChange.m_def.m_sFile2 = g_BackgroundChange.rows[row2].choices[iAnswers[row2]]; } break; diff --git a/stepmania/src/ScreenEdit.h b/stepmania/src/ScreenEdit.h index d8e1c33f85..d4563848db 100644 --- a/stepmania/src/ScreenEdit.h +++ b/stepmania/src/ScreenEdit.h @@ -63,6 +63,8 @@ enum EditButton EDIT_BUTTON_OPEN_COURSE_MENU, EDIT_BUTTON_OPEN_INPUT_HELP, + EDIT_BUTTON_NEW_BAKED_RANDOM_FILE_FOR_BGCHANGE, + EDIT_BUTTON_PLAY_FROM_START, EDIT_BUTTON_PLAY_FROM_CURSOR, EDIT_BUTTON_PLAY_SELECTION, @@ -373,13 +375,17 @@ public: file1_song_movie, file1_song_still, file1_global_bganimation, - file1_global_random_movie, + file1_global_movie, + file1_global_movie_song_group, + file1_global_movie_song_group_and_genre, file2_type, file2_song_bganimation, file2_song_movie, file2_song_still, file2_global_bganimation, - file2_global_random_movie, + file2_global_movie, + file2_global_movie_song_group, + file2_global_movie_song_group_and_genre, delete_change, NUM_BGCHANGE_CHOICES };