diff --git a/stepmania/src/OptionRow.cpp b/stepmania/src/OptionRow.cpp index d7b5ebc586..aef42064e6 100644 --- a/stepmania/src/OptionRow.cpp +++ b/stepmania/src/OptionRow.cpp @@ -120,12 +120,16 @@ void OptionRow::LoadMetrics( const CString &sType ) ARROWS_X .Load(m_sType,"ArrowsX"); LABELS_X .Load(m_sType,"LabelsX"); LABELS_ON_COMMAND .Load(m_sType,"LabelsOnCommand"); + LABEL_GAIN_FOCUS_COMMAND .Load(m_sType,"LabelGainFocusCommand"); + LABEL_LOSE_FOCUS_COMMAND .Load(m_sType,"LabelLoseFocusCommand"); ITEMS_START_X .Load(m_sType,"ItemsStartX"); ITEMS_END_X .Load(m_sType,"ItemsEndX"); ITEMS_GAP_X .Load(m_sType,"ItemsGapX"); ITEMS_LONG_ROW_X .Load(m_sType,ITEMS_LONG_ROW_X_NAME,NUM_PLAYERS); ITEMS_LONG_ROW_SHARED_X .Load(m_sType,"ItemsLongRowSharedX"); ITEMS_ON_COMMAND .Load(m_sType,"ItemsOnCommand"); + ITEM_GAIN_FOCUS_COMMAND .Load(m_sType,"ItemGainFocusCommand"); + ITEM_LOSE_FOCUS_COMMAND .Load(m_sType,"ItemLoseFocusCommand"); ICONS_X .Load(m_sType,ICONS_X_NAME,NUM_PLAYERS); ICONS_ON_COMMAND .Load(m_sType,"IconsOnCommand"); COLOR_SELECTED .Load(m_sType,"ColorSelected"); @@ -161,17 +165,17 @@ void OptionRow::LoadNormal( const OptionRowDefinition &def, OptionRowHandler *pH { vector &vbSelected = m_vbSelected[p]; vbSelected.resize( 0 ); - vbSelected.resize( m_RowDef.choices.size(), false ); + vbSelected.resize( m_RowDef.m_vsChoices.size(), false ); // set select the first item if a SELECT_ONE row - if( vbSelected.size() && m_RowDef.selectType == SELECT_ONE ) + if( vbSelected.size() && m_RowDef.m_selectType == SELECT_ONE ) vbSelected[0] = true; } // TRICKY: Insert a down arrow as the first choice in the row. if( m_bFirstItemGoesDown ) { - m_RowDef.choices.insert( m_RowDef.choices.begin(), NEXT_ROW_NAME ); + m_RowDef.m_vsChoices.insert( m_RowDef.m_vsChoices.begin(), NEXT_ROW_NAME ); FOREACH_PlayerNumber( p ) m_vbSelected[p].insert( m_vbSelected[p].begin(), false ); } @@ -179,7 +183,7 @@ void OptionRow::LoadNormal( const OptionRowDefinition &def, OptionRowHandler *pH CString OptionRow::GetRowTitle() const { - CString sLineName = m_RowDef.name; + CString sLineName = m_RowDef.m_sName; CString sTitle = OptionTitle(sLineName); // HACK: tack the BPM onto the name of the speed line @@ -230,7 +234,7 @@ void OptionRow::AfterImportOptions() // Make all selections the same if bOneChoiceForAllPlayers // Hack: we only import active players, so if only player 2 is imported, // we need to copy p2 to p1, not p1 to p2. - if( m_RowDef.bOneChoiceForAllPlayers ) + if( m_RowDef.m_bOneChoiceForAllPlayers ) { PlayerNumber pnCopyFrom = GAMESTATE->m_MasterPlayerNumber; if( GAMESTATE->m_MasterPlayerNumber == PLAYER_INVALID ) @@ -241,7 +245,7 @@ void OptionRow::AfterImportOptions() FOREACH_PlayerNumber( p ) { - switch( m_RowDef.selectType ) + switch( m_RowDef.m_selectType ) { case SELECT_ONE: { @@ -283,20 +287,20 @@ void OptionRow::AfterImportOptions() float fX = ITEMS_START_X; - for( unsigned c=0; c ITEMS_END_X ) { - m_RowDef.layoutType = LAYOUT_SHOW_ONE_IN_ROW; + m_RowDef.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; break; } } @@ -305,7 +309,7 @@ void OptionRow::AfterImportOptions() // // load m_textItems // - switch( m_RowDef.layoutType ) + switch( m_RowDef.m_layoutType ) { case LAYOUT_SHOW_ONE_IN_ROW: // init text @@ -317,13 +321,13 @@ void OptionRow::AfterImportOptions() const int iChoiceInRowWithFocus = m_iChoiceInRowWithFocus[p]; bt->LoadFromFont( THEME->GetPathF(m_sType,"item") ); - CString sText = (iChoiceInRowWithFocus==-1) ? "" : m_RowDef.choices[iChoiceInRowWithFocus]; + CString sText = (iChoiceInRowWithFocus==-1) ? "" : m_RowDef.m_vsChoices[iChoiceInRowWithFocus]; PrepareItemText( sText ); bt->SetText( sText ); bt->RunCommands( ITEMS_ON_COMMAND ); bt->SetShadowLength( 0 ); - if( m_RowDef.bOneChoiceForAllPlayers ) + if( m_RowDef.m_bOneChoiceForAllPlayers ) { bt->SetX( ITEMS_LONG_ROW_SHARED_X ); break; // only initialize one item since it's shared @@ -351,13 +355,13 @@ void OptionRow::AfterImportOptions() case LAYOUT_SHOW_ALL_IN_ROW: { float fX = ITEMS_START_X; - for( unsigned c=0; cLoadFromFont( THEME->GetPathF(m_sType,"item") ); - CString sText = m_RowDef.choices[c]; + CString sText = m_RowDef.m_vsChoices[c]; PrepareItemText( sText ); bt->SetText( sText ); bt->RunCommands( ITEMS_ON_COMMAND ); @@ -415,8 +419,8 @@ void OptionRow::AfterImportOptions() void OptionRow::LoadExit() { m_RowType = OptionRow::ROW_EXIT; - m_RowDef.name = EXIT_NAME; - m_RowDef.choices.push_back( "" ); + m_RowDef.m_sName = EXIT_NAME; + m_RowDef.m_vsChoices.push_back( "" ); BitmapText *bt = new BitmapText; m_textItems.push_back( bt ); @@ -443,15 +447,15 @@ void OptionRow::PositionUnderlines( PlayerNumber pn ) vector &vpUnderlines = m_Underline[pn]; - PlayerNumber pnTakeSelectedFrom = m_RowDef.bOneChoiceForAllPlayers ? PLAYER_1 : pn; + PlayerNumber pnTakeSelectedFrom = m_RowDef.m_bOneChoiceForAllPlayers ? PLAYER_1 : pn; - const int iNumUnderlines = (m_RowDef.layoutType == LAYOUT_SHOW_ONE_IN_ROW) ? 1 : vpUnderlines.size(); + const int iNumUnderlines = (m_RowDef.m_layoutType == LAYOUT_SHOW_ONE_IN_ROW) ? 1 : vpUnderlines.size(); for( int i=0; iRunCommands( ITEM_GAIN_FOCUS_COMMAND ); + else + m_textItems[j]->RunCommands( ITEM_LOSE_FOCUS_COMMAND ); + } + + switch( m_RowDef.m_layoutType ) { case LAYOUT_SHOW_ALL_IN_ROW: for( unsigned j=0; j= 0 && iChoice < (int)m_RowDef.choices.size()); + ASSERT(iChoice >= 0 && iChoice < (int)m_RowDef.m_vsChoices.size()); m_iChoiceInRowWithFocus[pn] = iChoice; } @@ -755,15 +779,15 @@ void OptionRow::Reload( const OptionRowDefinition &def ) m_RowDef = def; else m_pHand->Reload( m_RowDef ); - ASSERT( !m_RowDef.choices.empty() ); + ASSERT( !m_RowDef.m_vsChoices.empty() ); FOREACH_PlayerNumber( p ) - m_vbSelected[p].resize( m_RowDef.choices.size(), false ); + m_vbSelected[p].resize( m_RowDef.m_vsChoices.size(), false ); // TODO: Nothing uses this yet and it causes skips when changing options. //ImportOptions( vpns ); - switch( m_RowDef.selectType ) + switch( m_RowDef.m_selectType ) { case SELECT_ONE: FOREACH_HumanPlayer( p ) @@ -775,7 +799,7 @@ void OptionRow::Reload( const OptionRowDefinition &def ) break; case SELECT_MULTIPLE: FOREACH_HumanPlayer( p ) - CLAMP( m_iChoiceInRowWithFocus[p], 0, m_RowDef.choices.size()-1 ); + CLAMP( m_iChoiceInRowWithFocus[p], 0, m_RowDef.m_vsChoices.size()-1 ); break; default: ASSERT(0); @@ -838,7 +862,7 @@ void OptionRow::ImportOptions( const vector &vpns ) if( m_pHand == NULL ) return; - ASSERT( m_RowDef.choices.size() > 0 ); + ASSERT( m_RowDef.m_vsChoices.size() > 0 ); FOREACH_CONST( PlayerNumber, vpns, iter ) { @@ -847,7 +871,7 @@ void OptionRow::ImportOptions( const vector &vpns ) FOREACH( bool, m_vbSelected[p], b ) *b = false; - ASSERT( m_vbSelected[p].size() == m_RowDef.choices.size() ); + ASSERT( m_vbSelected[p].size() == m_RowDef.m_vsChoices.size() ); ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] ); } @@ -858,7 +882,7 @@ void OptionRow::ImportOptions( const vector &vpns ) PlayerNumber p = *iter; INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] ); - VerifySelected( m_RowDef.selectType, m_vbSelected[p], m_RowDef.name ); + VerifySelected( m_RowDef.m_selectType, m_vbSelected[p], m_RowDef.m_sName ); } } @@ -867,7 +891,7 @@ int OptionRow::ExportOptions( const vector &vpns, bool bRowHasFocu if( m_pHand == NULL ) return 0; - ASSERT( m_RowDef.choices.size() > 0 ); + ASSERT( m_RowDef.m_vsChoices.size() > 0 ); int iChangeMask = 0; @@ -876,14 +900,14 @@ int OptionRow::ExportOptions( const vector &vpns, bool bRowHasFocu PlayerNumber p = *iter; bool bFocus = bRowHasFocus[p]; - VerifySelected( m_RowDef.selectType, m_vbSelected[p], m_RowDef.name ); - ASSERT( m_vbSelected[p].size() == m_RowDef.choices.size() ); + VerifySelected( m_RowDef.m_selectType, m_vbSelected[p], m_RowDef.m_sName ); + ASSERT( m_vbSelected[p].size() == m_RowDef.m_vsChoices.size() ); ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] ); // SELECT_NONE rows get exported if they have focus when the user presses // Start. int iChoice = GetChoiceInRowWithFocus( p ); - if( m_RowDef.selectType == SELECT_NONE && bFocus ) + if( m_RowDef.m_selectType == SELECT_NONE && bFocus ) m_vbSelected[p][iChoice] = true; } @@ -895,7 +919,7 @@ int OptionRow::ExportOptions( const vector &vpns, bool bRowHasFocu bool bFocus = bRowHasFocus[p]; int iChoice = GetChoiceInRowWithFocus( p ); - if( m_RowDef.selectType == SELECT_NONE && bFocus ) + if( m_RowDef.m_selectType == SELECT_NONE && bFocus ) m_vbSelected[p][iChoice] = false; INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED( m_vbSelected[p] ); diff --git a/stepmania/src/OptionRow.h b/stepmania/src/OptionRow.h index 1e809cfdcf..7507ca357f 100644 --- a/stepmania/src/OptionRow.h +++ b/stepmania/src/OptionRow.h @@ -34,11 +34,11 @@ LayoutType StringToLayoutType( const CString& s ); struct OptionRowDefinition { - CString name; - bool bOneChoiceForAllPlayers; - SelectType selectType; - LayoutType layoutType; - vector choices; + CString m_sName; + bool m_bOneChoiceForAllPlayers; + SelectType m_selectType; + LayoutType m_layoutType; + vector m_vsChoices; set m_vEnabledForPlayers; // only players in this set may change focus to this row bool m_bExportOnChange; bool m_bAllowThemeItems; // if false, ignores ScreenOptions::THEME_ITEMS @@ -54,11 +54,11 @@ struct OptionRowDefinition OptionRowDefinition() { Init(); } void Init() { - name = ""; - bOneChoiceForAllPlayers = false; - selectType = SELECT_ONE; - layoutType = LAYOUT_SHOW_ALL_IN_ROW; - choices.clear(); + m_sName = ""; + m_bOneChoiceForAllPlayers = false; + m_selectType = SELECT_ONE; + m_layoutType = LAYOUT_SHOW_ALL_IN_ROW; + m_vsChoices.clear(); m_vEnabledForPlayers.clear(); FOREACH_PlayerNumber( pn ) m_vEnabledForPlayers.insert( pn ); @@ -72,11 +72,11 @@ struct OptionRowDefinition OptionRowDefinition( const char *n, bool b, const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, const char *c6=NULL, const char *c7=NULL, const char *c8=NULL, const char *c9=NULL, const char *c10=NULL, const char *c11=NULL, const char *c12=NULL, const char *c13=NULL, const char *c14=NULL, const char *c15=NULL, const char *c16=NULL, const char *c17=NULL, const char *c18=NULL, const char *c19=NULL ) { Init(); - name=n; - bOneChoiceForAllPlayers=b; - selectType=SELECT_ONE; - layoutType=LAYOUT_SHOW_ALL_IN_ROW; -#define PUSH( c ) if(c) choices.push_back(c); + m_sName=n; + m_bOneChoiceForAllPlayers=b; + m_selectType=SELECT_ONE; + m_layoutType=LAYOUT_SHOW_ALL_IN_ROW; +#define PUSH( c ) if(c) m_vsChoices.push_back(c); PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19); #undef PUSH } @@ -120,13 +120,13 @@ public: bool GetSelected( PlayerNumber pn, int iChoice ) const { - if( m_RowDef.bOneChoiceForAllPlayers ) + if( m_RowDef.m_bOneChoiceForAllPlayers ) pn = PLAYER_1; return m_vbSelected[pn][iChoice]; } void SetSelected( PlayerNumber pn, int iChoice, bool b ) { - if( m_RowDef.bOneChoiceForAllPlayers ) + if( m_RowDef.m_bOneChoiceForAllPlayers ) pn = PLAYER_1; m_vbSelected[pn][iChoice] = b; } @@ -190,12 +190,16 @@ protected: ThemeMetric ARROWS_X; ThemeMetric LABELS_X; ThemeMetric LABELS_ON_COMMAND; + ThemeMetric LABEL_GAIN_FOCUS_COMMAND; + ThemeMetric LABEL_LOSE_FOCUS_COMMAND; ThemeMetric ITEMS_START_X; ThemeMetric ITEMS_END_X; ThemeMetric ITEMS_GAP_X; ThemeMetric1D ITEMS_LONG_ROW_X; ThemeMetric ITEMS_LONG_ROW_SHARED_X; ThemeMetric ITEMS_ON_COMMAND; + ThemeMetric ITEM_GAIN_FOCUS_COMMAND; + ThemeMetric ITEM_LOSE_FOCUS_COMMAND; ThemeMetric1D ICONS_X; ThemeMetric ICONS_ON_COMMAND; ThemeMetric COLOR_SELECTED; diff --git a/stepmania/src/OptionRowHandler.cpp b/stepmania/src/OptionRowHandler.cpp index 231c47031c..540225637b 100644 --- a/stepmania/src/OptionRowHandler.cpp +++ b/stepmania/src/OptionRowHandler.cpp @@ -83,7 +83,7 @@ public: m_bUseModNameForIcon = true; - defOut.name = sParam; + defOut.m_sName = sParam; Default.Load( -1, ParseCommands(ENTRY_DEFAULT(sParam)) ); @@ -92,18 +92,18 @@ public: if( cmds.v.size() < 1 ) RageException::Throw( "Parse error in ScreenOptionsMaster::%s", sParam.c_str() ); - defOut.bOneChoiceForAllPlayers = false; + defOut.m_bOneChoiceForAllPlayers = false; const int NumCols = atoi( cmds.v[0].m_vsArgs[0] ); for( unsigned i=1; i &vpns, vector vbSelectedOut[NUM_PLAYERS] ) const @@ -174,17 +174,17 @@ public: /* The entry has no effect. This is usually a default "none of the * above" entry. It will always return true for DescribesCurrentMode(). * It's only the selected choice if nothing else matches. */ - if( def.selectType != SELECT_MULTIPLE ) + if( def.m_selectType != SELECT_MULTIPLE ) iFallbackOption = e; continue; } - if( def.bOneChoiceForAllPlayers ) + if( def.m_bOneChoiceForAllPlayers ) { if( mc.DescribesCurrentModeForAllPlayers() ) { bUseFallbackOption = false; - if( def.selectType != SELECT_MULTIPLE ) + if( def.m_selectType != SELECT_MULTIPLE ) SelectExactlyOne( e, vbSelOut ); else vbSelOut[e] = true; @@ -195,7 +195,7 @@ public: if( mc.DescribesCurrentMode( p) ) { bUseFallbackOption = false; - if( def.selectType != SELECT_MULTIPLE ) + if( def.m_selectType != SELECT_MULTIPLE ) SelectExactlyOne( e, vbSelOut ); else vbSelOut[e] = true; @@ -203,7 +203,7 @@ public: } } - if( def.selectType == SELECT_ONE && bUseFallbackOption ) + if( def.m_selectType == SELECT_ONE && bUseFallbackOption ) { if( iFallbackOption == -1 ) { @@ -216,7 +216,7 @@ public: SelectExactlyOne( iFallbackOption, vbSelOut ); } - VerifySelected( def.selectType, vbSelOut, def.name ); + VerifySelected( def.m_selectType, vbSelOut, def.m_sName ); } } @@ -243,7 +243,7 @@ public: { return m_bUseModNameForIcon ? ListEntries[iFirstSelection].m_sModifiers : - def.choices[iFirstSelection]; + def.m_vsChoices[iFirstSelection]; } virtual bool HasScreen( int iChoice ) const { @@ -259,8 +259,8 @@ public: ASSERT( sParam.size() ); m_sName = sParam; - defOut.name = "NoteSkins"; - defOut.bOneChoiceForAllPlayers = false; + defOut.m_sName = "NoteSkins"; + defOut.m_bOneChoiceForAllPlayers = false; defOut.m_bAllowThemeItems = false; // we theme the text ourself CStringArray arraySkinNames; @@ -272,7 +272,7 @@ public: GameCommand mc; mc.m_sModifiers = arraySkinNames[skin]; ListEntries.push_back( mc ); - defOut.choices.push_back( arraySkinNames[skin] ); + defOut.m_vsChoices.push_back( arraySkinNames[skin] ); } } @@ -284,19 +284,19 @@ public: ASSERT( sParam.size() ); m_sName = sParam; - defOut.name = "Steps"; - defOut.bOneChoiceForAllPlayers = bLockedTogether; + defOut.m_sName = "Steps"; + defOut.m_bOneChoiceForAllPlayers = bLockedTogether; defOut.m_bAllowThemeItems = false; // we theme the text ourself // fill in difficulty names if( GAMESTATE->m_bEditing ) { - defOut.choices.push_back( "" ); + defOut.m_vsChoices.push_back( "" ); ListEntries.push_back( GameCommand() ); } else if( GAMESTATE->IsCourseMode() ) // playing a course { - defOut.bOneChoiceForAllPlayers = (bool)PREFSMAN->m_bLockCourseDifficulties; + defOut.m_bOneChoiceForAllPlayers = (bool)PREFSMAN->m_bLockCourseDifficulties; vector vTrails; GAMESTATE->m_pCurCourse->GetTrails( vTrails, GAMESTATE->GetCurrentStyle()->m_StepsType ); @@ -306,7 +306,7 @@ public: CString s = CourseDifficultyToThemedString( pTrail->m_CourseDifficulty ); s += ssprintf( " %d", pTrail->GetMeter() ); - defOut.choices.push_back( s ); + defOut.m_vsChoices.push_back( s ); GameCommand mc; mc.m_pTrail = pTrail; ListEntries.push_back( mc ); @@ -329,7 +329,7 @@ public: else s = DifficultyToThemedString( pSteps->GetDifficulty() ); s += ssprintf( " %d", pSteps->GetMeter() ); - defOut.choices.push_back( s ); + defOut.m_vsChoices.push_back( s ); GameCommand mc; mc.m_pSteps = pSteps; mc.m_dc = pSteps->GetDifficulty(); @@ -346,13 +346,13 @@ public: ASSERT( sParam.size() ); m_sName = sParam; - defOut.bOneChoiceForAllPlayers = false; + defOut.m_bOneChoiceForAllPlayers = false; defOut.m_bAllowThemeItems = false; - defOut.name = "Characters"; + defOut.m_sName = "Characters"; Default.m_pCharacter = GAMESTATE->GetDefaultCharacter(); { - defOut.choices.push_back( "Off" ); + defOut.m_vsChoices.push_back( "Off" ); GameCommand mc; mc.m_pCharacter = NULL; ListEntries.push_back( mc ); @@ -366,7 +366,7 @@ public: CString s = pCharacter->m_sName; s.MakeUpper(); - defOut.choices.push_back( s ); + defOut.m_vsChoices.push_back( s ); GameCommand mc; mc.m_pCharacter = pCharacter; ListEntries.push_back( mc ); @@ -381,8 +381,8 @@ public: ASSERT( sParam.size() ); m_sName = sParam; - defOut.bOneChoiceForAllPlayers = true; - defOut.name = "Style"; + defOut.m_bOneChoiceForAllPlayers = true; + defOut.m_sName = "Style"; defOut.m_bAllowThemeItems = false; // we theme the text ourself vector vStyles; @@ -390,7 +390,7 @@ public: ASSERT( vStyles.size() ); FOREACH_CONST( const Style*, vStyles, s ) { - defOut.choices.push_back( GAMEMAN->StyleToThemedString(*s) ); + defOut.m_vsChoices.push_back( GAMEMAN->StyleToThemedString(*s) ); GameCommand mc; mc.m_pStyle = *s; ListEntries.push_back( mc ); @@ -407,9 +407,9 @@ public: ASSERT( sParam.size() ); m_sName = sParam; - defOut.bOneChoiceForAllPlayers = true; + defOut.m_bOneChoiceForAllPlayers = true; defOut.m_bAllowThemeItems = false; // we theme the text ourself - defOut.name = "Group"; + defOut.m_sName = "Group"; Default.m_sSongGroup = GROUP_ALL; vector vSongGroups; @@ -417,7 +417,7 @@ public: ASSERT( vSongGroups.size() ); { - defOut.choices.push_back( "AllGroups" ); + defOut.m_vsChoices.push_back( "AllGroups" ); GameCommand mc; mc.m_sSongGroup = GROUP_ALL; ListEntries.push_back( mc ); @@ -425,7 +425,7 @@ public: FOREACH_CONST( CString, vSongGroups, g ) { - defOut.choices.push_back( *g ); + defOut.m_vsChoices.push_back( *g ); GameCommand mc; mc.m_sSongGroup = *g; ListEntries.push_back( mc ); @@ -440,13 +440,13 @@ public: ASSERT( sParam.size() ); m_sName = sParam; - defOut.bOneChoiceForAllPlayers = true; - defOut.name = "Difficulty"; + defOut.m_bOneChoiceForAllPlayers = true; + defOut.m_sName = "Difficulty"; Default.m_dc = DIFFICULTY_INVALID; defOut.m_bAllowThemeItems = false; // we theme the text ourself { - defOut.choices.push_back( "AllDifficulties" ); + defOut.m_vsChoices.push_back( "AllDifficulties" ); GameCommand mc; mc.m_dc = DIFFICULTY_INVALID; ListEntries.push_back( mc ); @@ -456,7 +456,7 @@ public: { CString s = DifficultyToThemedString( *d ); - defOut.choices.push_back( s ); + defOut.m_vsChoices.push_back( s ); GameCommand mc; mc.m_dc = *d; ListEntries.push_back( mc ); @@ -477,14 +477,14 @@ public: if( GAMESTATE->m_pCurSong == NULL ) GAMESTATE->m_pCurSong.Set( vpSongs[0] ); - defOut.name = "SongsInCurrentSongGroup"; - defOut.bOneChoiceForAllPlayers = true; - defOut.layoutType = LAYOUT_SHOW_ONE_IN_ROW; + defOut.m_sName = "SongsInCurrentSongGroup"; + defOut.m_bOneChoiceForAllPlayers = true; + defOut.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; defOut.m_bExportOnChange = true; FOREACH_CONST( Song*, vpSongs, p ) { - defOut.choices.push_back( (*p)->GetTranslitFullTitle() ); + defOut.m_vsChoices.push_back( (*p)->GetTranslitFullTitle() ); GameCommand mc; mc.m_pSong = *p; ListEntries.push_back( mc ); @@ -529,13 +529,13 @@ public: const char *pStr = lua_tostring( L, -1 ); if( pStr == NULL ) RageException::Throw( "\"%s\" \"Name\" entry is not a string", sLuaFunction.c_str() ); - defOut.name = pStr; + defOut.m_sName = pStr; lua_pop( L, 1 ); lua_pushstring( L, "OneChoiceForAllPlayers" ); lua_gettable( L, -2 ); - defOut.bOneChoiceForAllPlayers = !!lua_toboolean( L, -1 ); + defOut.m_bOneChoiceForAllPlayers = !!lua_toboolean( L, -1 ); lua_pop( L, 1 ); @@ -550,8 +550,8 @@ public: pStr = lua_tostring( L, -1 ); if( pStr == NULL ) RageException::Throw( "\"%s\" \"LayoutType\" entry is not a string", sLuaFunction.c_str() ); - defOut.layoutType = StringToLayoutType( pStr ); - ASSERT( defOut.layoutType != LAYOUT_INVALID ); + defOut.m_layoutType = StringToLayoutType( pStr ); + ASSERT( defOut.m_layoutType != LAYOUT_INVALID ); lua_pop( L, 1 ); @@ -560,8 +560,8 @@ public: pStr = lua_tostring( L, -1 ); if( pStr == NULL ) RageException::Throw( "\"%s\" \"SelectType\" entry is not a string", sLuaFunction.c_str() ); - defOut.selectType = StringToSelectType( pStr ); - ASSERT( defOut.selectType != SELECT_INVALID ); + defOut.m_selectType = StringToSelectType( pStr ); + ASSERT( defOut.m_selectType != SELECT_INVALID ); lua_pop( L, 1 ); @@ -580,7 +580,7 @@ public: RageException::Throw( "\"%s\" Column entry is not a string", sLuaFunction.c_str() ); // LOG->Trace( "'%s'", pValue); - defOut.choices.push_back( pValue ); + defOut.m_vsChoices.push_back( pValue ); lua_pop( L, 1 ); /* removes `value'; keeps `key' for next iteration */ } @@ -723,7 +723,7 @@ public: lua_pushstring( L, "LoadSelections" ); lua_gettable( L, -2 ); if( !lua_isfunction( L, -1 ) ) - RageException::Throw( "\"%s\" \"LoadSelections\" entry is not a function", def.name.c_str() ); + RageException::Throw( "\"%s\" \"LoadSelections\" entry is not a function", def.m_sName.c_str() ); /* Argument 1 (self): */ m_pLuaTable->PushSelf( L ); @@ -777,7 +777,7 @@ public: lua_pushstring( L, "SaveSelections" ); lua_gettable( L, -2 ); if( !lua_isfunction( L, -1 ) ) - RageException::Throw( "\"%s\" \"SaveSelections\" entry is not a function", def.name.c_str() ); + RageException::Throw( "\"%s\" \"SaveSelections\" entry is not a function", def.m_sName.c_str() ); /* Argument 1 (self): */ m_pLuaTable->PushSelf( L ); @@ -825,7 +825,7 @@ public: defOut.Init(); /* Configuration values are never per-player. */ - defOut.bOneChoiceForAllPlayers = true; + defOut.m_bOneChoiceForAllPlayers = true; ConfOption *pConfOption = ConfOption::Find( sParam ); if( pConfOption == NULL ) @@ -834,9 +834,9 @@ public: pConfOption->UpdateAvailableOptions(); opt = pConfOption; - opt->MakeOptionsList( defOut.choices ); + opt->MakeOptionsList( defOut.m_vsChoices ); - defOut.name = opt->name; + defOut.m_sName = opt->name; } virtual void ImportOption( const OptionRowDefinition &def, const vector &vpns, vector vbSelectedOut[NUM_PLAYERS] ) const { @@ -917,9 +917,9 @@ public: } m_sName = sParam; - defOut.name = sParam; - defOut.bOneChoiceForAllPlayers = true; - defOut.layoutType = LAYOUT_SHOW_ONE_IN_ROW; + defOut.m_sName = sParam; + defOut.m_bOneChoiceForAllPlayers = true; + defOut.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; defOut.m_bExportOnChange = true; defOut.m_bAllowThemeItems = false; // we theme the text ourself @@ -929,7 +929,7 @@ public: FOREACH_CONST( StepsType, m_vStepsTypesToShow, st ) { CString s = GAMEMAN->StepsTypeToThemedString( *st ); - defOut.choices.push_back( s ); + defOut.m_vsChoices.push_back( s ); } if( *m_pstToFill == STEPS_TYPE_INVALID ) @@ -1019,9 +1019,9 @@ public: } m_sName = sParam; - defOut.name = sParam; - defOut.bOneChoiceForAllPlayers = true; - defOut.layoutType = LAYOUT_SHOW_ONE_IN_ROW; + defOut.m_sName = sParam; + defOut.m_bOneChoiceForAllPlayers = true; + defOut.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; defOut.m_bExportOnChange = true; defOut.m_bAllowThemeItems = false; // we theme the text ourself m_vsReloadRowMessages.push_back( MessageToString(MESSAGE_CURRENT_SONG_CHANGED) ); @@ -1062,14 +1062,14 @@ public: { s = DifficultyToThemedString( dc ); } - defOut.choices.push_back( s ); + defOut.m_vsChoices.push_back( s ); } } else { m_vDifficulties.push_back( DIFFICULTY_EDIT ); m_vSteps.push_back( NULL ); - defOut.choices.push_back( "none" ); + defOut.m_vsChoices.push_back( "none" ); } if( m_pDifficultyToFill ) diff --git a/stepmania/src/ScreenCourseManager.cpp b/stepmania/src/ScreenCourseManager.cpp index 1b61d5a315..6ffb85cf84 100644 --- a/stepmania/src/ScreenCourseManager.cpp +++ b/stepmania/src/ScreenCourseManager.cpp @@ -58,23 +58,23 @@ void ScreenCourseManager::Init() vector vHands; OptionRowDefinition def; - def.layoutType = LAYOUT_SHOW_ONE_IN_ROW; + def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; - def.name = "Group"; - def.choices.clear(); - SONGMAN->GetCourseGroupNames( def.choices ); + def.m_sName = "Group"; + def.m_vsChoices.clear(); + SONGMAN->GetCourseGroupNames( def.m_vsChoices ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Course Group"; - def.choices.clear(); - def.choices.push_back( "" ); + def.m_sName = "Course Group"; + def.m_vsChoices.clear(); + def.m_vsChoices.push_back( "" ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Action"; - def.choices.clear(); - def.choices.push_back( "" ); + def.m_sName = "Action"; + def.m_vsChoices.clear(); + def.m_vsChoices.push_back( "" ); vDefs.push_back( def ); vHands.push_back( NULL ); @@ -102,7 +102,7 @@ void ScreenCourseManager::AfterChangeValueInRow( PlayerNumber pn ) { OptionRow &row = *m_pRows[ROW_COURSE_GROUP]; int iChoice = row.GetChoiceInRowWithFocus(pn); - CString sCourseGroup = row.GetRowDef().choices[iChoice]; + CString sCourseGroup = row.GetRowDef().m_vsChoices[iChoice]; GAMESTATE->m_sPreferredCourseGroup.Set( sCourseGroup ); } // Refresh courses @@ -111,10 +111,10 @@ void ScreenCourseManager::AfterChangeValueInRow( PlayerNumber pn ) vector vpCourses; SONGMAN->GetCoursesInGroup( vpCourses, GAMESTATE->m_sPreferredCourseGroup.Get(), false ); OptionRowDefinition def = row.GetRowDef(); - def.choices.clear(); + def.m_vsChoices.clear(); FOREACH_CONST( Course*, vpCourses, c ) - def.choices.push_back( (*c)->GetTranslitFullTitle() ); - def.choices.push_back( NULL ); // new course + def.m_vsChoices.push_back( (*c)->GetTranslitFullTitle() ); + def.m_vsChoices.push_back( NULL ); // new course row.Reload( def ); } // fall through @@ -132,11 +132,11 @@ void ScreenCourseManager::AfterChangeValueInRow( PlayerNumber pn ) { OptionRow &row = *m_pRows[ROW_ACTION]; OptionRowDefinition def = row.GetRowDef(); - def.choices.clear(); + def.m_vsChoices.clear(); vector vActions; GetPossibleActions( vActions ); FOREACH_CONST( CourseManagerAction, vActions, a ) - def.choices.push_back( CourseManagerActionToString(*a) ); + def.m_vsChoices.push_back( CourseManagerActionToString(*a) ); row.Reload( def ); } // fall through diff --git a/stepmania/src/ScreenEditCourse.cpp b/stepmania/src/ScreenEditCourse.cpp index 479425059f..b6d77369dc 100644 --- a/stepmania/src/ScreenEditCourse.cpp +++ b/stepmania/src/ScreenEditCourse.cpp @@ -67,59 +67,59 @@ void ScreenEditCourse::Init() vector vHands; OptionRowDefinition def; - def.layoutType = LAYOUT_SHOW_ONE_IN_ROW; + def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; - def.name = "Title"; - def.choices.clear(); - def.choices.push_back( pCourse->GetTranslitFullTitle() ); + def.m_sName = "Title"; + def.m_vsChoices.clear(); + def.m_vsChoices.push_back( pCourse->GetTranslitFullTitle() ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Repeat"; - def.choices.clear(); - def.choices.push_back( "NO" ); - def.choices.push_back( "YES" ); + def.m_sName = "Repeat"; + def.m_vsChoices.clear(); + def.m_vsChoices.push_back( "NO" ); + def.m_vsChoices.push_back( "YES" ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Randomize"; - def.choices.clear(); - def.choices.push_back( "NO" ); - def.choices.push_back( "YES" ); + def.m_sName = "Randomize"; + def.m_vsChoices.clear(); + def.m_vsChoices.push_back( "NO" ); + def.m_vsChoices.push_back( "YES" ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Lives"; - def.choices.clear(); - def.choices.push_back( "Use Bar Life" ); + def.m_sName = "Lives"; + def.m_vsChoices.clear(); + def.m_vsChoices.push_back( "Use Bar Life" ); for( int i=1; i<=10; i++ ) - def.choices.push_back( ssprintf("%d",i) ); + def.m_vsChoices.push_back( ssprintf("%d",i) ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Type"; - def.choices.clear(); + def.m_sName = "Type"; + def.m_vsChoices.clear(); FOREACH_CONST( StepsType, STEPS_TYPES_TO_SHOW.GetValue(), st ) - def.choices.push_back( GAMEMAN->StepsTypeToString(*st) ); + def.m_vsChoices.push_back( GAMEMAN->StepsTypeToString(*st) ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Type Meter"; - def.choices.clear(); + def.m_sName = "Type Meter"; + def.m_vsChoices.clear(); for( int i=MIN_METER; i<=MAX_METER; i++ ) - def.choices.push_back( ssprintf("%d",i) ); + def.m_vsChoices.push_back( ssprintf("%d",i) ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Edit Entry"; - def.choices.clear(); + def.m_sName = "Edit Entry"; + def.m_vsChoices.clear(); for( unsigned i=0; im_vEntries.size(); i++ ) - def.choices.push_back( ssprintf("%u of %u",i+1,pCourse->m_vEntries.size()) ); + def.m_vsChoices.push_back( ssprintf("%u of %u",i+1,pCourse->m_vEntries.size()) ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Insert Entry"; - def.choices.clear(); + def.m_sName = "Insert Entry"; + def.m_vsChoices.clear(); for( unsigned i=0; i<=pCourse->m_vEntries.size(); i++ ) { CString s; @@ -127,15 +127,15 @@ void ScreenEditCourse::Init() s = ssprintf("After %u",i); else s = ssprintf("Before %u",i+1); - def.choices.push_back( s ); + def.m_vsChoices.push_back( s ); } vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Delete Entry"; - def.choices.clear(); + def.m_sName = "Delete Entry"; + def.m_vsChoices.clear(); for( unsigned i=0; im_vEntries.size(); i++ ) - def.choices.push_back( ssprintf("%u of %u",i+1,pCourse->m_vEntries.size()) ); + def.m_vsChoices.push_back( ssprintf("%u of %u",i+1,pCourse->m_vEntries.size()) ); vDefs.push_back( def ); vHands.push_back( NULL ); @@ -173,9 +173,9 @@ void ScreenEditCourse::AfterChangeValueInRow( PlayerNumber pn ) { OptionRow &row = *m_pRows[ROW_TYPE]; OptionRowDefinition def = row.GetRowDef(); - def.choices.clear(); + def.m_vsChoices.clear(); vector vThrowAway; - GetStepsTypeAndDifficulty( vThrowAway, def.choices ); + GetStepsTypeAndDifficulty( vThrowAway, def.m_vsChoices ); row.Reload( def ); } // fall through diff --git a/stepmania/src/ScreenEditCourseEntry.cpp b/stepmania/src/ScreenEditCourseEntry.cpp index 6adcfe226a..eb5dda1d3c 100644 --- a/stepmania/src/ScreenEditCourseEntry.cpp +++ b/stepmania/src/ScreenEditCourseEntry.cpp @@ -43,65 +43,65 @@ void ScreenEditCourseEntry::Init() vector vHands; OptionRowDefinition def; - def.layoutType = LAYOUT_SHOW_ONE_IN_ROW; + def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; - def.name = "Song Group"; - def.choices.clear(); + def.m_sName = "Song Group"; + def.m_vsChoices.clear(); vector vsSongGroups; SONGMAN->GetSongGroupNames( vsSongGroups ); - def.choices.push_back( "(any)" ); + def.m_vsChoices.push_back( "(any)" ); FOREACH_CONST( CString, vsSongGroups, s ) - def.choices.push_back( *s ); + def.m_vsChoices.push_back( *s ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Song"; - def.choices.clear(); - def.choices.push_back( "" ); + def.m_sName = "Song"; + def.m_vsChoices.clear(); + def.m_vsChoices.push_back( "" ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Base Difficulty"; - def.choices.clear(); - def.choices.push_back( "(any)" ); + def.m_sName = "Base Difficulty"; + def.m_vsChoices.clear(); + def.m_vsChoices.push_back( "(any)" ); FOREACH_CONST( Difficulty, DIFFICULTIES_TO_SHOW.GetValue(), dc ) - def.choices.push_back( DifficultyToThemedString(*dc) ); + def.m_vsChoices.push_back( DifficultyToThemedString(*dc) ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Low Meter"; - def.choices.clear(); - def.choices.push_back( "(any)" ); + def.m_sName = "Low Meter"; + def.m_vsChoices.clear(); + def.m_vsChoices.push_back( "(any)" ); for( int i=MIN_METER; i<=MAX_METER; i++ ) - def.choices.push_back( ssprintf("%i",i) ); + def.m_vsChoices.push_back( ssprintf("%i",i) ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "High Meter"; - def.choices.clear(); - def.choices.push_back( "(any)" ); + def.m_sName = "High Meter"; + def.m_vsChoices.clear(); + def.m_vsChoices.push_back( "(any)" ); for( int i=MIN_METER; i<=MAX_METER; i++ ) - def.choices.push_back( ssprintf("%i",i) ); + def.m_vsChoices.push_back( ssprintf("%i",i) ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Sort"; - def.choices.clear(); + def.m_sName = "Sort"; + def.m_vsChoices.clear(); FOREACH_SongSort( i ) - def.choices.push_back( SongSortToThemedString(i) ); + def.m_vsChoices.push_back( SongSortToThemedString(i) ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Choose"; - def.choices.clear(); + def.m_sName = "Choose"; + def.m_vsChoices.clear(); for( int i=0; i<20; i++ ) - def.choices.push_back( FormatNumberAndSuffix(i+1) ); + def.m_vsChoices.push_back( FormatNumberAndSuffix(i+1) ); vDefs.push_back( def ); vHands.push_back( NULL ); - def.name = "Set Mods"; - def.choices.clear(); - def.choices.push_back( "Set Mods" ); + def.m_sName = "Set Mods"; + def.m_vsChoices.clear(); + def.m_vsChoices.push_back( "Set Mods" ); vDefs.push_back( def ); vHands.push_back( NULL ); @@ -131,21 +131,21 @@ void ScreenEditCourseEntry::AfterChangeValueInRow( PlayerNumber pn ) if( iChoice == 0 ) ce.sSongGroup = ""; else - ce.sSongGroup = row.GetRowDef().choices[ iChoice ]; + ce.sSongGroup = row.GetRowDef().m_vsChoices[ iChoice ]; } // refresh songs { OptionRow &row = *m_pRows[ROW_SONG]; OptionRowDefinition def = row.GetRowDef(); - def.choices.clear(); - def.choices.push_back( "(any)" ); + def.m_vsChoices.clear(); + def.m_vsChoices.push_back( "(any)" ); vector vpSongs; if( ce.sSongGroup.empty() ) SONGMAN->GetSongs( vpSongs ); else SONGMAN->GetSongs( vpSongs, ce.sSongGroup ); FOREACH_CONST( Song*, vpSongs, s ) - def.choices.push_back( (*s)->GetTranslitFullTitle() ); + def.m_vsChoices.push_back( (*s)->GetTranslitFullTitle() ); vector::const_iterator iter = find( vpSongs.begin(), vpSongs.end(), ce.pSong ); if( iter != vpSongs.end() ) { @@ -235,11 +235,11 @@ void ScreenEditCourseEntry::ImportAllOptions() // import song group { OptionRow &row = *m_pRows[ROW_SONG_GROUP]; - FOREACH_CONST( CString, row.GetRowDef().choices, s ) + FOREACH_CONST( CString, row.GetRowDef().m_vsChoices, s ) { if( *s == ce.sSongGroup ) { - int iChoice = s - row.GetRowDef().choices.begin(); + int iChoice = s - row.GetRowDef().m_vsChoices.begin(); row.SetOneSharedSelection( iChoice ); AfterChangeValueInRow( GAMESTATE->m_MasterPlayerNumber ); break; diff --git a/stepmania/src/ScreenMiniMenu.cpp b/stepmania/src/ScreenMiniMenu.cpp index 830ebacb60..281acd54be 100644 --- a/stepmania/src/ScreenMiniMenu.cpp +++ b/stepmania/src/ScreenMiniMenu.cpp @@ -15,13 +15,15 @@ AutoScreenMessage( SM_GoToOK ) AutoScreenMessage( SM_GoToCancel ) +bool ScreenMiniMenu::s_bCancelled = false; int ScreenMiniMenu::s_iLastRowCode = -1; vector ScreenMiniMenu::s_viLastAnswers; -void ScreenMiniMenu::MiniMenu( MenuDef* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel ) +void ScreenMiniMenu::MiniMenu( MenuDef* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel, float fX, float fY ) { ScreenMiniMenu *pNewScreen = new ScreenMiniMenu( pDef->sClassName ); pNewScreen->Init( pDef, SM_SendOnOK, SM_SendOnCancel ); + pNewScreen->SetXY( fX, fY ); SCREENMAN->ZeroNextUpdate(); SCREENMAN->SetFromNewScreen( pNewScreen ); } @@ -63,8 +65,8 @@ void ScreenMiniMenu::Init( const MenuDef* pDef, ScreenMessage SM_SendOnOK, Scree const MenuRowDef &mr = m_vMenuRows[r]; OptionRowDefinition &def = vDefs[r]; - def.name = mr.sName; - FontCharAliases::ReplaceMarkers( def.name ); // Allow special characters + def.m_sName = mr.sName; + FontCharAliases::ReplaceMarkers( def.m_sName ); // Allow special characters if( mr.bEnabled ) { @@ -77,14 +79,14 @@ void ScreenMiniMenu::Init( const MenuDef* pDef, ScreenMessage SM_SendOnOK, Scree def.m_vEnabledForPlayers.clear(); } - def.bOneChoiceForAllPlayers = true; - def.selectType = SELECT_ONE; - def.layoutType = LAYOUT_SHOW_ONE_IN_ROW; + def.m_bOneChoiceForAllPlayers = true; + def.m_selectType = SELECT_ONE; + def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; def.m_bExportOnChange = false; - def.choices = mr.choices; + def.m_vsChoices = mr.choices; - FOREACH( CString, def.choices, c ) + FOREACH( CString, def.m_vsChoices, c ) FontCharAliases::ReplaceMarkers( *c ); // Allow special characters } @@ -135,11 +137,13 @@ void ScreenMiniMenu::ExportOptions( int r, const vector &vpns ) void ScreenMiniMenu::GoToNextScreen() { + s_bCancelled = false; SCREENMAN->PopTopScreen( m_SMSendOnOK ); } void ScreenMiniMenu::GoToPrevScreen() { + s_bCancelled = true; SCREENMAN->PopTopScreen( m_SMSendOnCancel ); } diff --git a/stepmania/src/ScreenMiniMenu.h b/stepmania/src/ScreenMiniMenu.h index b4551edf6f..80b8a8f235 100644 --- a/stepmania/src/ScreenMiniMenu.h +++ b/stepmania/src/ScreenMiniMenu.h @@ -80,7 +80,7 @@ struct MenuDef class ScreenMiniMenu : public ScreenOptions { public: - static void MiniMenu( MenuDef* pDef, ScreenMessage smSendOnOK, ScreenMessage smSendOnCancel = SM_None ); + static void MiniMenu( MenuDef* pDef, ScreenMessage smSendOnOK, ScreenMessage smSendOnCancel = SM_None, float fX = 0, float fY = 0 ); ScreenMiniMenu( CString sScreenClass ); void Init( const MenuDef* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel ); @@ -103,6 +103,7 @@ protected: vector m_vMenuRows; public: + static bool s_bCancelled; static int s_iLastRowCode; static vector s_viLastAnswers; }; diff --git a/stepmania/src/ScreenNetworkOptions.cpp b/stepmania/src/ScreenNetworkOptions.cpp index 9c3728eb12..e330001fdf 100644 --- a/stepmania/src/ScreenNetworkOptions.cpp +++ b/stepmania/src/ScreenNetworkOptions.cpp @@ -45,15 +45,15 @@ void ScreenNetworkOptions::Init() { ScreenOptions::Init(); - g_NetworkOptionsLines[PO_CONNECTION].choices.clear(); + g_NetworkOptionsLines[PO_CONNECTION].m_vsChoices.clear(); if ( NSMAN->useSMserver ) - g_NetworkOptionsLines[PO_CONNECTION].choices.push_back("Disconnect from "+NSMAN->GetServerName()); + g_NetworkOptionsLines[PO_CONNECTION].m_vsChoices.push_back("Disconnect from "+NSMAN->GetServerName()); else - g_NetworkOptionsLines[PO_CONNECTION].choices.push_back("Connect..."); + g_NetworkOptionsLines[PO_CONNECTION].m_vsChoices.push_back("Connect..."); - g_NetworkOptionsLines[PO_SERVER].choices.clear(); - g_NetworkOptionsLines[PO_SERVER].choices.push_back("Stop"); - g_NetworkOptionsLines[PO_SERVER].choices.push_back("Start..."); + g_NetworkOptionsLines[PO_SERVER].m_vsChoices.clear(); + g_NetworkOptionsLines[PO_SERVER].m_vsChoices.push_back("Stop"); + g_NetworkOptionsLines[PO_SERVER].m_vsChoices.push_back("Start..."); //Enable all lines for all players for ( unsigned int i = 0; i < NUM_NETWORK_OPTIONS_LINES; i++ ) diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index b9673acc01..386c42d22e 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -85,6 +85,7 @@ ScreenOptions::ScreenOptions( CString sClassName ) : ScreenWithMenuElements(sCla SHOW_SCROLL_BAR (m_sName,"ShowScrollBar"), SCROLL_BAR_HEIGHT (m_sName,"ScrollBarHeight"), SCROLL_BAR_TIME (m_sName,"ScrollBarTime"), + LINE_HIGHLIGHT_X (m_sName,"LineHighlightX"), EXPLANATION_ZOOM (m_sName,"ExplanationZoom"), SHOW_EXIT_ROW (m_sName,"ShowExitRow"), SEPARATE_EXIT_ROW (m_sName,"SeparateExitRow"), @@ -157,7 +158,7 @@ void ScreenOptions::InitMenu( InputMode im, const vector &v vpns.push_back( p ); this->ImportOptions( r, vpns ); - CHECKPOINT_M( ssprintf("row %i: %s", r, row.GetRowDef().name.c_str()) ); + CHECKPOINT_M( ssprintf("row %i: %s", r, row.GetRowDef().m_sName.c_str()) ); row.AfterImportOptions(); } @@ -172,7 +173,7 @@ void ScreenOptions::InitMenu( InputMode im, const vector &v { m_sprLineHighlight[p].Load( THEME->GetPathG(m_sName,"line highlight") ); m_sprLineHighlight[p].SetName( "LineHighlight" ); - m_sprLineHighlight[p].SetX( SCREEN_CENTER_X ); + m_sprLineHighlight[p].SetX( LINE_HIGHLIGHT_X ); m_framePage.AddChild( &m_sprLineHighlight[p] ); ON_COMMAND( m_sprLineHighlight[p] ); } @@ -317,7 +318,7 @@ CString ScreenOptions::GetExplanationText( int iRow ) const { OptionRow &row = *m_pRows[iRow]; - CString sLineName = row.GetRowDef().name; + CString sLineName = row.GetRowDef().m_sName; ASSERT( !sLineName.empty() ); bool bAllowExplanation = row.GetRowDef().m_bAllowExplanation; @@ -830,7 +831,7 @@ void ScreenOptions::ProcessMenuStart( PlayerNumber pn, const InputEventType type } } - if( row.GetRowDef().selectType == SELECT_MULTIPLE ) + if( row.GetRowDef().m_selectType == SELECT_MULTIPLE ) { int iChoiceInRow = row.GetChoiceInRowWithFocus(pn); bool bSelected = !row.GetSelected( pn, iChoiceInRow ); @@ -862,10 +863,10 @@ void ScreenOptions::ProcessMenuStart( PlayerNumber pn, const InputEventType type break; case NAV_TOGGLE_THREE_KEY: case NAV_TOGGLE_FIVE_KEY: - if( row.GetRowDef().selectType != SELECT_MULTIPLE ) + if( row.GetRowDef().m_selectType != SELECT_MULTIPLE ) { int iChoiceInRow = row.GetChoiceInRowWithFocus(pn); - if( row.GetRowDef().bOneChoiceForAllPlayers ) + if( row.GetRowDef().m_bOneChoiceForAllPlayers ) row.SetOneSharedSelection( iChoiceInRow ); else row.SetOneSelection( pn, iChoiceInRow ); @@ -894,7 +895,7 @@ void ScreenOptions::StoreFocus( PlayerNumber pn ) /* Long rows always put us in the center, so don't update the focus. */ int iCurrentRow = m_iCurrentRow[pn]; const OptionRow &row = *m_pRows[iCurrentRow]; - if( row.GetRowDef().layoutType == LAYOUT_SHOW_ONE_IN_ROW ) + if( row.GetRowDef().m_layoutType == LAYOUT_SHOW_ONE_IN_ROW ) return; int iWidth, iY; @@ -912,7 +913,7 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat ) OptionRow &row = *m_pRows[iCurRow]; - const int iNumChoices = row.GetRowDef().choices.size(); + const int iNumChoices = row.GetRowDef().m_vsChoices.size(); if( m_OptionsNavigation == NAV_THREE_KEY_MENU && iNumChoices <= 1 ) // 1 or 0 { @@ -945,7 +946,7 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat ) row.SetChoiceInRowWithFocus( pn, iNewChoiceWithFocus ); StoreFocus( pn ); - if( row.GetRowDef().bOneChoiceForAllPlayers ) + if( row.GetRowDef().m_bOneChoiceForAllPlayers ) { /* If this row is bOneChoiceForAllPlayers, then lock the cursors together * for this row. Don't do this in toggle modes, since the current selection @@ -953,7 +954,7 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat ) bool bForceFocusedChoiceTogether = false; if( m_OptionsNavigation!=NAV_TOGGLE_THREE_KEY && m_OptionsNavigation!=NAV_TOGGLE_FIVE_KEY && - row.GetRowDef().bOneChoiceForAllPlayers ) + row.GetRowDef().m_bOneChoiceForAllPlayers ) { bForceFocusedChoiceTogether = true; } @@ -980,7 +981,7 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat ) } else { - if( row.GetRowDef().selectType == SELECT_MULTIPLE ) + if( row.GetRowDef().m_selectType == SELECT_MULTIPLE ) ; // do nothing. User must press Start to toggle the selection. else row.SetOneSelection( p, iNewChoiceWithFocus ); @@ -995,7 +996,7 @@ void ScreenOptions::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat ) } else { - if( row.GetRowDef().selectType == SELECT_MULTIPLE ) + if( row.GetRowDef().m_selectType == SELECT_MULTIPLE ) ; // do nothing. User must press Start to toggle the selection. else row.SetOneSelection( pn, iNewChoiceWithFocus ); @@ -1059,7 +1060,7 @@ void ScreenOptions::MoveRow( PlayerNumber pn, int dir, bool Repeat ) { case NAV_TOGGLE_THREE_KEY: case NAV_TOGGLE_FIVE_KEY: - if( row.GetRowDef().layoutType != LAYOUT_SHOW_ONE_IN_ROW ) + if( row.GetRowDef().m_layoutType != LAYOUT_SHOW_ONE_IN_ROW ) { int iSelectionDist = -1; for( unsigned i = 0; i < row.GetTextItemsSize(); ++i ) diff --git a/stepmania/src/ScreenOptions.h b/stepmania/src/ScreenOptions.h index 70977f371b..92f904afdf 100644 --- a/stepmania/src/ScreenOptions.h +++ b/stepmania/src/ScreenOptions.h @@ -137,6 +137,7 @@ protected: ThemeMetric SHOW_SCROLL_BAR; ThemeMetric SCROLL_BAR_HEIGHT; ThemeMetric SCROLL_BAR_TIME; + ThemeMetric LINE_HIGHLIGHT_X; ThemeMetric EXPLANATION_ZOOM; ThemeMetric SHOW_EXIT_ROW; ThemeMetric SEPARATE_EXIT_ROW; diff --git a/stepmania/src/ScreenOptionsMaster.cpp b/stepmania/src/ScreenOptionsMaster.cpp index d1b9f0631a..8f78ab39a7 100644 --- a/stepmania/src/ScreenOptionsMaster.cpp +++ b/stepmania/src/ScreenOptionsMaster.cpp @@ -204,7 +204,7 @@ void ScreenOptionsMaster::RefreshIcons( int r, PlayerNumber pn ) /* XXX: hack to not display text in the song options menu */ - if( def.bOneChoiceForAllPlayers ) + if( def.m_bOneChoiceForAllPlayers ) sIcon = ""; LoadOptionIcon( pn, r, sIcon ); diff --git a/stepmania/src/ScreenOptionsProfiles.cpp b/stepmania/src/ScreenOptionsProfiles.cpp index 071b1ba8a7..39fb068218 100644 --- a/stepmania/src/ScreenOptionsProfiles.cpp +++ b/stepmania/src/ScreenOptionsProfiles.cpp @@ -71,13 +71,14 @@ void ScreenOptionsProfiles::Init() vector vHands; OptionRowDefinition def; - def.layoutType = LAYOUT_SHOW_ONE_IN_ROW; + def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; + def.m_bOneChoiceForAllPlayers = true; def.m_bAllowThemeItems = false; def.m_bAllowThemeTitles = false; def.m_bAllowExplanation = false; - def.name = "Create New"; - def.choices.clear(); + def.m_sName = "Create New"; + def.m_vsChoices.clear(); vDefs.push_back( def ); vHands.push_back( NULL ); @@ -86,8 +87,8 @@ void ScreenOptionsProfiles::Init() FOREACH_CONST( CString, vsProfileNames, s ) { - def.name = *s; - def.choices.clear(); + def.m_sName = *s; + def.m_vsChoices.clear(); vDefs.push_back( def ); vHands.push_back( NULL ); } @@ -152,29 +153,32 @@ void ScreenOptionsProfiles::HandleScreenMessage( const ScreenMessage SM ) } else if( SM == SM_BackFromProfileContextMenu ) { - switch( ScreenMiniMenu::s_iLastRowCode ) + if( !ScreenMiniMenu::s_bCancelled ) { - default: - ASSERT(0); - case A_EDIT: - SCREENMAN->SetNewScreen( "ScreenOptionsEditProfile" ); - break; - case A_RENAME: + switch( ScreenMiniMenu::s_iLastRowCode ) { - CString sCurrentProfileName = PROFILEMAN->ProfileIDToName( s_sCurrentProfileID ); - ScreenTextEntry::TextEntry( SM_BackFromEnterName, "Enter a name for a new profile.", sCurrentProfileName, PROFILE_MAX_NAME_LENGTH, ValidateProfileName ); + default: + ASSERT(0); + case A_EDIT: + SCREENMAN->SetNewScreen( "ScreenOptionsEditProfile" ); + break; + case A_RENAME: + { + CString sCurrentProfileName = PROFILEMAN->ProfileIDToName( s_sCurrentProfileID ); + ScreenTextEntry::TextEntry( SM_BackFromEnterName, "Enter a name for a new profile.", sCurrentProfileName, PROFILE_MAX_NAME_LENGTH, ValidateProfileName ); + } + break; + case A_DELETE: + { + CString sCurrentProfileName = PROFILEMAN->ProfileIDToName( s_sCurrentProfileID ); + CString sMessage = ssprintf( "Are you sure you want to delete the profile '%s'?", sCurrentProfileName.c_str() ); + ScreenPrompt::Prompt( SM_BackFromDelete, sMessage, PROMPT_YES_NO ); + } + break; + case A_CANCEL: + SCREENMAN->PlayInvalidSound(); + break; } - break; - case A_DELETE: - { - CString sCurrentProfileName = PROFILEMAN->ProfileIDToName( s_sCurrentProfileID ); - CString sMessage = ssprintf( "Are you sure you want to delete the profile '%s'?", sCurrentProfileName.c_str() ); - ScreenPrompt::Prompt( SM_BackFromDelete, sMessage, PROMPT_YES_NO ); - } - break; - case A_CANCEL: - SCREENMAN->PlayInvalidSound(); - break; } } else if( SM == SM_BackFromDelete ) @@ -185,6 +189,8 @@ void ScreenOptionsProfiles::HandleScreenMessage( const ScreenMessage SM ) SCREENMAN->SetNewScreen( m_sName ); // reload } } + + ScreenOptions::HandleScreenMessage( SM ); } void ScreenOptionsProfiles::ProcessMenuStart( PlayerNumber pn, const InputEventType type ) @@ -208,7 +214,9 @@ void ScreenOptionsProfiles::ProcessMenuStart( PlayerNumber pn, const InputEventT vector vsProfileIDs; PROFILEMAN->GetLocalProfileIDs( vsProfileIDs ); s_sCurrentProfileID = vsProfileIDs[ iProfileIndex ]; - ScreenMiniMenu::MiniMenu( &g_ProfileContextMenu, SM_BackFromProfileContextMenu ); + int iThrowAway, iX, iY; + GetWidthXY( PLAYER_1, iRow, 0, iThrowAway, iX, iY ); + ScreenMiniMenu::MiniMenu( &g_ProfileContextMenu, SM_BackFromProfileContextMenu, SM_BackFromProfileContextMenu, (float)iX, (float)iY ); } } diff --git a/stepmania/src/ScreenProfileOptions.cpp b/stepmania/src/ScreenProfileOptions.cpp index 253d40e7fb..da1c232699 100644 --- a/stepmania/src/ScreenProfileOptions.cpp +++ b/stepmania/src/ScreenProfileOptions.cpp @@ -46,31 +46,31 @@ void ScreenProfileOptions::Init() { ScreenOptions::Init(); - g_ProfileOptionsLines[PO_PLAYER1].choices.clear(); - g_ProfileOptionsLines[PO_PLAYER1].choices.push_back( "-NONE-" ); - PROFILEMAN->GetLocalProfileNames( g_ProfileOptionsLines[PO_PLAYER1].choices ); + g_ProfileOptionsLines[PO_PLAYER1].m_vsChoices.clear(); + g_ProfileOptionsLines[PO_PLAYER1].m_vsChoices.push_back( "-NONE-" ); + PROFILEMAN->GetLocalProfileNames( g_ProfileOptionsLines[PO_PLAYER1].m_vsChoices ); - g_ProfileOptionsLines[PO_PLAYER2].choices.clear(); - g_ProfileOptionsLines[PO_PLAYER2].choices.push_back( "-NONE-" ); - PROFILEMAN->GetLocalProfileNames( g_ProfileOptionsLines[PO_PLAYER2].choices ); + g_ProfileOptionsLines[PO_PLAYER2].m_vsChoices.clear(); + g_ProfileOptionsLines[PO_PLAYER2].m_vsChoices.push_back( "-NONE-" ); + PROFILEMAN->GetLocalProfileNames( g_ProfileOptionsLines[PO_PLAYER2].m_vsChoices ); - g_ProfileOptionsLines[PO_DELETE_].choices.clear(); - g_ProfileOptionsLines[PO_DELETE_].choices.push_back( "-NONE-" ); - PROFILEMAN->GetLocalProfileNames( g_ProfileOptionsLines[PO_DELETE_].choices ); + g_ProfileOptionsLines[PO_DELETE_].m_vsChoices.clear(); + g_ProfileOptionsLines[PO_DELETE_].m_vsChoices.push_back( "-NONE-" ); + PROFILEMAN->GetLocalProfileNames( g_ProfileOptionsLines[PO_DELETE_].m_vsChoices ); - g_ProfileOptionsLines[PO_RENAME_].choices.clear(); - g_ProfileOptionsLines[PO_RENAME_].choices.push_back( "-NONE-" ); - PROFILEMAN->GetLocalProfileNames( g_ProfileOptionsLines[PO_RENAME_].choices ); + g_ProfileOptionsLines[PO_RENAME_].m_vsChoices.clear(); + g_ProfileOptionsLines[PO_RENAME_].m_vsChoices.push_back( "-NONE-" ); + PROFILEMAN->GetLocalProfileNames( g_ProfileOptionsLines[PO_RENAME_].m_vsChoices ); if( PREFSMAN->GetMemoryCardOsMountPoint(PLAYER_1).Get().empty() ) - g_ProfileOptionsLines[PO_OS_MOUNT_1].choices[0] = "-NOT SET IN INI-"; + g_ProfileOptionsLines[PO_OS_MOUNT_1].m_vsChoices[0] = "-NOT SET IN INI-"; else - g_ProfileOptionsLines[PO_OS_MOUNT_1].choices[0] = PREFSMAN->GetMemoryCardOsMountPoint(PLAYER_1).Get(); + g_ProfileOptionsLines[PO_OS_MOUNT_1].m_vsChoices[0] = PREFSMAN->GetMemoryCardOsMountPoint(PLAYER_1).Get(); if( PREFSMAN->GetMemoryCardOsMountPoint(PLAYER_2).Get().empty() ) - g_ProfileOptionsLines[PO_OS_MOUNT_2].choices[0] = "-NOT SET IN INI-"; + g_ProfileOptionsLines[PO_OS_MOUNT_2].m_vsChoices[0] = "-NOT SET IN INI-"; else - g_ProfileOptionsLines[PO_OS_MOUNT_2].choices[0] = PREFSMAN->GetMemoryCardOsMountPoint(PLAYER_2).Get(); + g_ProfileOptionsLines[PO_OS_MOUNT_2].m_vsChoices[0] = PREFSMAN->GetMemoryCardOsMountPoint(PLAYER_2).Get(); //Enable all lines for all players for ( unsigned int i = 0; i < NUM_PROFILE_OPTIONS_LINES; i++ ) @@ -235,7 +235,7 @@ CString ScreenProfileOptions::GetSelectedProfileName() const int Selection = row.GetOneSharedSelection(); if( !Selection ) return ""; - return g_ProfileOptionsLines[PO_PLAYER1].choices[ Selection ]; + return g_ProfileOptionsLines[PO_PLAYER1].m_vsChoices[ Selection ]; } /* diff --git a/stepmania/src/ScreenSMOnlineLogin.cpp b/stepmania/src/ScreenSMOnlineLogin.cpp index 3a2771d6d6..fe63e9c19b 100644 --- a/stepmania/src/ScreenSMOnlineLogin.cpp +++ b/stepmania/src/ScreenSMOnlineLogin.cpp @@ -34,10 +34,10 @@ void ScreenSMOnlineLogin::Init() { ScreenOptions::Init(); - g_ProfileLine[0].choices.clear(); - PROFILEMAN->GetLocalProfileNames( g_ProfileLine[0].choices ); + g_ProfileLine[0].m_vsChoices.clear(); + PROFILEMAN->GetLocalProfileNames( g_ProfileLine[0].m_vsChoices ); - if(!g_ProfileLine[0].choices.size()) + if(!g_ProfileLine[0].m_vsChoices.size()) { SCREENMAN->SystemMessage("You Must Define A Profile!"); SCREENMAN->SetNewScreen("ScreenProfileOptions");