diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 3eab94e727..104177ad84 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -22,6 +22,7 @@ #include "NoteDataUtil.h" #include "SongUtil.h" #include "StepsUtil.h" +#include "Foreach.h" const float RECORD_HOLD_SECONDS = 0.3f; @@ -1662,9 +1663,15 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers ) // Fill in line enabled/disabled // bool bAlreadyBGChangeHere = false; - for( unsigned i=0; im_BackgroundChanges.size(); i++ ) - if( m_pSong->m_BackgroundChanges[i].m_fStartBeat == GAMESTATE->m_fSongBeat ) + BackgroundChange bgChange; + FOREACH( BackgroundChange, m_pSong->m_BackgroundChanges, bgc ) + { + if( bgc->m_fStartBeat == GAMESTATE->m_fSongBeat ) + { bAlreadyBGChangeHere = true; + bgChange = *bgc; + } + } g_BGChange.rows[add_random].enabled = true; g_BGChange.rows[add_song_bganimation].enabled = g_BGChange.rows[add_song_bganimation].choices.size() > 0; @@ -1676,6 +1683,18 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers ) g_BGChange.rows[delete_change].enabled = bAlreadyBGChangeHere; + // set default choices + g_BGChange.rows[rate]. SetDefaultChoiceIfPresent( ssprintf("%2.0f%%",bgChange.m_fRate*100) ); + g_BGChange.rows[fade_last].defaultChoice = bgChange.m_bFadeLast ? 1 : 0; + g_BGChange.rows[rewind_movie].defaultChoice = bgChange.m_bRewindMovie ? 1 : 0; + g_BGChange.rows[loop].defaultChoice = bgChange.m_bLoop ? 1 : 0; + g_BGChange.rows[add_song_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sBGName ); + g_BGChange.rows[add_song_movie]. SetDefaultChoiceIfPresent( bgChange.m_sBGName ); + g_BGChange.rows[add_song_still]. SetDefaultChoiceIfPresent( bgChange.m_sBGName ); + g_BGChange.rows[add_global_random_movie]. SetDefaultChoiceIfPresent( bgChange.m_sBGName ); + g_BGChange.rows[add_global_bganimation]. SetDefaultChoiceIfPresent( bgChange.m_sBGName ); + g_BGChange.rows[add_global_visualization]. SetDefaultChoiceIfPresent( bgChange.m_sBGName ); + SCREENMAN->MiniMenu( &g_BGChange, SM_BackFromBGChange ); } diff --git a/stepmania/src/ScreenMiniMenu.cpp b/stepmania/src/ScreenMiniMenu.cpp index c0eaadfbfd..3a67780540 100644 --- a/stepmania/src/ScreenMiniMenu.cpp +++ b/stepmania/src/ScreenMiniMenu.cpp @@ -6,6 +6,7 @@ #include "GameConstantsAndTypes.h" #include "PrefsManager.h" #include "ThemeManager.h" +#include "Foreach.h" const float LABEL_X = 200; @@ -316,6 +317,18 @@ MenuRowInternal::MenuRowInternal( const MenuRow &r ) #undef PUSH } +void MenuRowInternal::SetDefaultChoiceIfPresent( const CString &s ) +{ + FOREACH( CString, choices, c ) + { + if( *c == s ) + { + defaultChoice = c - choices.begin(); + return; + } + } +} + /* * (c) 2003-2004 Chris Danford * All rights reserved. diff --git a/stepmania/src/ScreenMiniMenu.h b/stepmania/src/ScreenMiniMenu.h index cd38e608ca..a377090fb7 100644 --- a/stepmania/src/ScreenMiniMenu.h +++ b/stepmania/src/ScreenMiniMenu.h @@ -36,6 +36,8 @@ struct MenuRowInternal } MenuRowInternal( const MenuRow &r ); + + void SetDefaultChoiceIfPresent( const CString &s ); };