diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 4801b3a125..90e03c0003 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -86,17 +86,31 @@ const ScreenMessage SM_BackFromEditSongInfo = (ScreenMessage)(SM_User+5); const CString HELP_TEXT = "Up/Down:\n change beat\n" "Left/Right:\n change snap\n" - "PgUp/PgDn:\n jump measure\n" - "Home/End:\n jump to first/\n last beat\n" "Number keys:\n add/remove\n tap note\n" "Create hold note:\n Hold a number\n while moving\n Up or Down\n" - "F7/F8:\n Dec/inc BPM\n at cur beat\n" - "F9/F10:\n Dec/inc stop\n at cur beat\n" - "F11/F12:\n Dec/inc music\n offset\n" - "[ and ]:\n Dec/inc sample\n music start\n" - "{ and }:\n Dec/inc sample\n music length\n"; + "Space bar:\n Set area\n marker\n" + "Enter:\n Area Menu\n" + "Escape:\n Main Menu\n" + "F1:\n Show\n keyboard\n shortcuts\n"; +MiniMenuDefinition g_KeyboardShortcuts = +{ + "Keyboard Shortcuts", + 9, + { + { "PgUp/PgDn: jump measure", false, 1, 0, {""} }, + { "Home/End: jump to first/last beat", false, 1, 0, {""} }, + { "Ctrl + Up/Down: Change zoom", false, 1, 0, {""} }, + { "Shift + Up/Down: Drag area marker", false, 1, 0, {""} }, + { "F7/F8: Decrease/increase BPM at cur beat", false, 1, 0, {""} }, + { "F9/F10: Decrease/increase stop at cur beat", false, 1, 0, {""} }, + { "F11/F12: Decrease/increase music offset", false, 1, 0, {""} }, + { "[ and ]: Decrease/increase sample music start", false, 1, 0, {""} }, + { "{ and }: Decrease/increase sample music length", false, 1, 0, {""} }, + } +}; + MiniMenuDefinition g_MainMenu = { "Main Menu", @@ -105,7 +119,6 @@ MiniMenuDefinition g_MainMenu = { "Edit Notes Statistics", true, 1, 0, {""} }, { "Play Whole Song", true, 1, 0, {""} }, { "Save", true, 1, 0, {""} }, - { "Editor Options", true, 1, 0, {""} }, { "Player Options", true, 1, 0, {""} }, { "Song Options", true, 1, 0, {""} }, { "Edit Song Info", true, 1, 0, {""} }, @@ -155,17 +168,6 @@ MiniMenuDefinition g_EditNotesStatistics = }; -MiniMenuDefinition g_EditOptions = -{ - "Edit Options", - ScreenEdit::NUM_EDIT_OPTIONS_CHOICES, - { - { "Zoom", true, 3, 0, {"1X","2X","4X"} }, - { "Max Notes Per Row", true, 4, 0, {"NO LIMIT","2","3","4"} }, - { "After Note Add", true, 2, 0, {"STAY","NEXT LINE"} }, - } -}; - MiniMenuDefinition g_EditSongInfo = { "Edit Song Info", @@ -490,12 +492,11 @@ void ScreenEdit::Update( float fDeltaTime ) CString sText; sText += ssprintf( "Current Beat:\n %.2f\n", GAMESTATE->m_fSongBeat ); sText += ssprintf( "Snap to:\n %s\n", sNoteType.GetString() ); - sText += ssprintf( "Selection begin:\n %.2f\n", m_NoteFieldEdit.m_fBeginMarker ); - sText += ssprintf( "Selection end:\n %.2f\n", m_NoteFieldEdit.m_fEndMarker ); + sText += ssprintf( "Selection begin:\n %s\n", m_NoteFieldEdit.m_fBeginMarker==-1 ? "not set" : ssprintf("%.2f",m_NoteFieldEdit.m_fBeginMarker).GetString() ); + sText += ssprintf( "Selection end:\n %s\n", m_NoteFieldEdit.m_fEndMarker==-1 ? "not set" : ssprintf("%.2f",m_NoteFieldEdit.m_fEndMarker).GetString() ); sText += ssprintf( "Difficulty:\n %s\n", DifficultyToString( m_pNotes->GetDifficulty() ).GetString() ); sText += ssprintf( "Description:\n %s\n", GAMESTATE->m_pCurNotes[PLAYER_1] ? GAMESTATE->m_pCurNotes[PLAYER_1]->GetDescription().GetString() : "no description" ); sText += ssprintf( "Main title:\n %s\n", m_pSong->m_sMainTitle.GetString() ); - sText += ssprintf( "Sub title:\n %s\n", m_pSong->m_sSubTitle.GetString() ); sText += ssprintf( "Tap Notes:\n %d\n", iNumTapNotes ); sText += ssprintf( "Hold Notes:\n %d\n", iNumHoldNotes ); sText += ssprintf( "Beat 0 Offset:\n %.2f secs\n", m_pSong->m_fBeat0OffsetInSeconds ); @@ -554,71 +555,6 @@ void ScreenEdit::Input( const DeviceInput& DeviceI, const InputEventType type, c } } -// Begin helper functions for InputEdit - -void AddBGChange( CString sBGName ) -{ - Song* pSong = GAMESTATE->m_pCurSong; - unsigned i; - for( i=0; im_BackgroundChanges.size(); i++ ) - { - if( pSong->m_BackgroundChanges[i].m_fStartBeat == GAMESTATE->m_fSongBeat ) - break; - } - - if( i != pSong->m_BackgroundChanges.size() ) // there is already a BGChange here - pSong->m_BackgroundChanges.erase( pSong->m_BackgroundChanges.begin()+i, - pSong->m_BackgroundChanges.begin()+i+1); - - // create a new BGChange - if( sBGName != "" ) - pSong->AddBackgroundChange( BackgroundChange(GAMESTATE->m_fSongBeat, sBGName) ); -} - -void ChangeDescription( CString sNew ) -{ - Notes* pNotes = GAMESTATE->m_pCurNotes[PLAYER_1]; - pNotes->SetDescription(sNew); -} - -void ChangeMainTitle( CString sNew ) -{ - Song* pSong = GAMESTATE->m_pCurSong; - pSong->m_sMainTitle = sNew; -} - -void ChangeSubTitle( CString sNew ) -{ - Song* pSong = GAMESTATE->m_pCurSong; - pSong->m_sSubTitle = sNew; -} - -void ChangeArtist( CString sNew ) -{ - Song* pSong = GAMESTATE->m_pCurSong; - pSong->m_sArtist = sNew; -} - -void ChangeMainTitleTranslit( CString sNew ) -{ - Song* pSong = GAMESTATE->m_pCurSong; - pSong->m_sMainTitleTranslit = sNew; -} - -void ChangeSubTitleTranslit( CString sNew ) -{ - Song* pSong = GAMESTATE->m_pCurSong; - pSong->m_sSubTitleTranslit = sNew; -} - -void ChangeArtistTranslit( CString sNew ) -{ - Song* pSong = GAMESTATE->m_pCurSong; - pSong->m_sArtistTranslit = sNew; -} - -// End helper functions for InputEdit - void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { if( DeviceI.device != DEVICE_KEYBOARD ) @@ -799,11 +735,11 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ GAMESTATE->m_fSongBeat = m_NoteFieldEdit.GetLastBeat(); m_soundChangeLine.Play(); break; - case SDLK_RIGHT: + case SDLK_LEFT: m_SnapDisplay.PrevSnapMode(); OnSnapModeChange(); break; - case SDLK_LEFT: + case SDLK_RIGHT: m_SnapDisplay.NextSnapMode(); OnSnapModeChange(); break; @@ -855,9 +791,8 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ g_AreaMenu.lines[clear].bEnabled = bAreaSelected; g_AreaMenu.lines[quantize].bEnabled = bAreaSelected; g_AreaMenu.lines[transform].bEnabled = bAreaSelected; + g_AreaMenu.lines[play].bEnabled = bAreaSelected; g_AreaMenu.lines[record].bEnabled = bAreaSelected; - g_AreaMenu.lines[insert_and_shift].bEnabled = !bAreaSelected; - g_AreaMenu.lines[delete_and_shift].bEnabled = !bAreaSelected; SCREENMAN->MiniMenu( &g_AreaMenu, SM_BackFromAreaMenu ); } break; @@ -865,38 +800,8 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ SCREENMAN->MiniMenu( &g_MainMenu, SM_BackFromMainMenu ); break; - case SDLK_d: - { - Difficulty dc = Difficulty( (m_pNotes->GetDifficulty()+1)%NUM_DIFFICULTIES ); - m_pNotes->SetDifficulty(dc); - } - break; - - case SDLK_e: - SCREENMAN->TextEntry( SM_None, "Edit notes description.\nPress Enter to confirm,\nEscape to cancel.", m_pNotes->GetDescription(), ChangeDescription, NULL ); - break; - - case SDLK_b: - { - CString sOldBackground; - unsigned i; - for( i=0; im_BackgroundChanges.size(); i++ ) - { - if( m_pSong->m_BackgroundChanges[i].m_fStartBeat == GAMESTATE->m_fSongBeat ) - break; - } - if( i != m_pSong->m_BackgroundChanges.size() ) // there is already a BGChange here - sOldBackground = m_pSong->m_BackgroundChanges[i].m_sBGName; - - SCREENMAN->TextEntry( SM_None, "Type a background name.\nPress Enter to keep,\nEscape to cancel.\nEnter an empty string to remove\nthe Background Change.", sOldBackground, AddBGChange, NULL ); - } - break; - - case SDLK_i: - if( GAMESTATE->m_SongOptions.m_AssistType==SongOptions::ASSIST_TICK ) - GAMESTATE->m_SongOptions.m_AssistType = SongOptions::ASSIST_NONE; - else - GAMESTATE->m_SongOptions.m_AssistType = SongOptions::ASSIST_TICK; + case SDLK_F1: + SCREENMAN->MiniMenu( &g_KeyboardShortcuts, SM_None ); break; case SDLK_F7: @@ -1156,12 +1061,14 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM ) case SM_BackFromEditNotesStatistics: HandleEditNotesStatisticsChoice( (EditNotesStatisticsChoice)ScreenMiniMenu::s_iLastLine, ScreenMiniMenu::s_iLastAnswers ); break; - case SM_BackFromEditOptions: - HandleEditOptionsChoice( (EditOptionsChoice)ScreenMiniMenu::s_iLastLine, ScreenMiniMenu::s_iLastAnswers ); - break; case SM_BackFromEditSongInfo: HandleEditSongInfoChoice( (EditSongInfoChoice)ScreenMiniMenu::s_iLastLine, ScreenMiniMenu::s_iLastAnswers ); break; + case SM_RegainingFocus: + // coming back from PlayerOptions or SongOptions + m_fDestinationScrollSpeed = GAMESTATE->m_PlayerOptions[PLAYER_1].m_fScrollSpeed; + m_soundMusic.SetPlaybackRate( GAMESTATE->m_SongOptions.m_fMusicRate ); + break; } } @@ -1176,6 +1083,78 @@ void ScreenEdit::OnSnapModeChange() GAMESTATE->m_fSongBeat -= NoteRowToBeat( iStepIndexHangover ); } + + +// Helper function for below + +// Begin helper functions for InputEdit + +void AddBGChange( CString sBGName ) +{ + Song* pSong = GAMESTATE->m_pCurSong; + unsigned i; + for( i=0; im_BackgroundChanges.size(); i++ ) + { + if( pSong->m_BackgroundChanges[i].m_fStartBeat == GAMESTATE->m_fSongBeat ) + break; + } + + if( i != pSong->m_BackgroundChanges.size() ) // there is already a BGChange here + pSong->m_BackgroundChanges.erase( pSong->m_BackgroundChanges.begin()+i, + pSong->m_BackgroundChanges.begin()+i+1); + + // create a new BGChange + if( sBGName != "" ) + pSong->AddBackgroundChange( BackgroundChange(GAMESTATE->m_fSongBeat, sBGName) ); +} + +void ChangeDescription( CString sNew ) +{ + Notes* pNotes = GAMESTATE->m_pCurNotes[PLAYER_1]; + pNotes->SetDescription(sNew); +} + +void ChangeMainTitle( CString sNew ) +{ + Song* pSong = GAMESTATE->m_pCurSong; + pSong->m_sMainTitle = sNew; +} + +void ChangeSubTitle( CString sNew ) +{ + Song* pSong = GAMESTATE->m_pCurSong; + pSong->m_sSubTitle = sNew; +} + +void ChangeArtist( CString sNew ) +{ + Song* pSong = GAMESTATE->m_pCurSong; + pSong->m_sArtist = sNew; +} + +void ChangeMainTitleTranslit( CString sNew ) +{ + Song* pSong = GAMESTATE->m_pCurSong; + pSong->m_sMainTitleTranslit = sNew; +} + +void ChangeSubTitleTranslit( CString sNew ) +{ + Song* pSong = GAMESTATE->m_pCurSong; + pSong->m_sSubTitleTranslit = sNew; +} + +void ChangeArtistTranslit( CString sNew ) +{ + Song* pSong = GAMESTATE->m_pCurSong; + pSong->m_sArtistTranslit = sNew; +} + +// End helper functions + + + + void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers ) { switch( c ) @@ -1186,7 +1165,7 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers ) float fMusicSeconds = m_soundMusic.GetLengthSeconds(); g_EditNotesStatistics.lines[difficulty].iDefaultOption = pNotes->GetDifficulty(); - g_EditNotesStatistics.lines[meter].iDefaultOption = pNotes->GetMeter()+1; + g_EditNotesStatistics.lines[meter].iDefaultOption = pNotes->GetMeter()-1; strcpy( g_EditNotesStatistics.lines[description].szOptionsText[0], pNotes->GetDescription() ); strcpy( g_EditNotesStatistics.lines[tap_notes].szOptionsText[0], ssprintf("%d", m_NoteFieldEdit.GetNumTapNotes()) ); strcpy( g_EditNotesStatistics.lines[hold_notes].szOptionsText[0], ssprintf("%d", m_NoteFieldEdit.GetNumHoldNotes()) ); @@ -1199,6 +1178,11 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers ) } break; case play_whole_song: + { + m_NoteFieldEdit.m_fBeginMarker = 0; + m_NoteFieldEdit.m_fEndMarker = m_NoteFieldEdit.GetLastBeat(); + HandleAreaMenuChoice( play, NULL ); + } break; case save: { @@ -1213,21 +1197,43 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers ) SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","edit save") ); } break; - case editor_options: - SCREENMAN->MiniMenu( &g_EditOptions, SM_BackFromEditOptions ); - break; case player_options: + SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions" ); break; case song_options: + SCREENMAN->AddNewScreenToTop( "ScreenSongOptions" ); break; case edit_song_info: - SCREENMAN->MiniMenu( &g_EditSongInfo, SM_BackFromEditSongInfo ); + { + Song* pSong = GAMESTATE->m_pCurSong; + strcpy( g_EditSongInfo.lines[main_title].szOptionsText[0], pSong->m_sMainTitle ); + strcpy( g_EditSongInfo.lines[sub_title].szOptionsText[0], pSong->m_sSubTitle ); + strcpy( g_EditSongInfo.lines[artist].szOptionsText[0], pSong->m_sArtist ); + strcpy( g_EditSongInfo.lines[main_title_transliteration].szOptionsText[0], pSong->m_sMainTitleTranslit ); + strcpy( g_EditSongInfo.lines[sub_title_transliteration].szOptionsText[0], pSong->m_sSubTitleTranslit ); + strcpy( g_EditSongInfo.lines[artist_transliteration].szOptionsText[0], pSong->m_sArtistTranslit ); + + SCREENMAN->MiniMenu( &g_EditSongInfo, SM_BackFromEditSongInfo ); + } break; case edit_bpm: break; case edit_stop: break; case edit_bg_change: + { + CString sOldBackground; + unsigned i; + for( i=0; im_BackgroundChanges.size(); i++ ) + { + if( m_pSong->m_BackgroundChanges[i].m_fStartBeat == GAMESTATE->m_fSongBeat ) + break; + } + if( i != m_pSong->m_BackgroundChanges.size() ) // there is already a BGChange here + sOldBackground = m_pSong->m_BackgroundChanges[i].m_sBGName; + + SCREENMAN->TextEntry( SM_None, "Type a background name.\nPress Enter to keep,\nEscape to cancel.\nEnter an empty string to remove\nthe Background Change.", sOldBackground, AddBGChange, NULL ); + } break; case play_preview_music: SOUNDMAN->PlayMusic(""); @@ -1386,64 +1392,43 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers ) void ScreenEdit::HandleEditNotesStatisticsChoice( EditNotesStatisticsChoice c, int* iAnswers ) { + Notes* pNotes = GAMESTATE->m_pCurNotes[PLAYER_1]; + Difficulty dc = (Difficulty)iAnswers[difficulty]; + pNotes->SetDifficulty( dc ); + int iMeter = iAnswers[meter]+1; + pNotes->SetMeter( iMeter ); + switch( c ) { - case difficulty: - break; - case meter: - break; case description: + SCREENMAN->TextEntry( SM_None, "Edit notes description.\nPress Enter to confirm,\nEscape to cancel.", m_pNotes->GetDescription(), ChangeDescription, NULL ); break; - case tap_notes: - break; - case hold_notes: - break; - case stream: - break; - case voltage: - break; - case air: - break; - case freeze: - break; - case chaos: - break; - default: - ASSERT(0); - }; - -} - -void ScreenEdit::HandleEditOptionsChoice( EditOptionsChoice c, int* iAnswers ) -{ - switch( c ) - { - case zoom: - break; - case max_notes_per_row: - break; - case after_note_add: - break; - default: - ASSERT(0); - }; + } } void ScreenEdit::HandleEditSongInfoChoice( EditSongInfoChoice c, int* iAnswers ) { + Song* pSong = GAMESTATE->m_pCurSong; + switch( c ) { case main_title: + SCREENMAN->TextEntry( SM_None, "Edit main title.\nPress Enter to confirm,\nEscape to cancel.", pSong->m_sMainTitle, ChangeMainTitle, NULL ); break; case sub_title: + SCREENMAN->TextEntry( SM_None, "Edit sub title.\nPress Enter to confirm,\nEscape to cancel.", pSong->m_sSubTitle, ChangeSubTitle, NULL ); break; case artist: + SCREENMAN->TextEntry( SM_None, "Edit artist.\nPress Enter to confirm,\nEscape to cancel.", pSong->m_sArtist, ChangeArtist, NULL ); break; case main_title_transliteration: + SCREENMAN->TextEntry( SM_None, "Edit main title transliteration.\nPress Enter to confirm,\nEscape to cancel.", pSong->m_sMainTitleTranslit, ChangeMainTitleTranslit, NULL ); break; case sub_title_transliteration: + SCREENMAN->TextEntry( SM_None, "Edit sub title transliteration.\nPress Enter to confirm,\nEscape to cancel.", pSong->m_sSubTitleTranslit, ChangeSubTitleTranslit, NULL ); break; case artist_transliteration: + SCREENMAN->TextEntry( SM_None, "Edit artist transliteration.\nPress Enter to confirm,\nEscape to cancel.", pSong->m_sArtistTranslit, ChangeArtistTranslit, NULL ); break; default: ASSERT(0); diff --git a/stepmania/src/ScreenEdit.h b/stepmania/src/ScreenEdit.h index 9d0014f492..b8adb9a607 100644 --- a/stepmania/src/ScreenEdit.h +++ b/stepmania/src/ScreenEdit.h @@ -108,7 +108,6 @@ public: edit_notes_statistics, play_whole_song, save, - editor_options, player_options, song_options, edit_song_info, @@ -152,14 +151,6 @@ public: }; void HandleEditNotesStatisticsChoice( EditNotesStatisticsChoice c, int* iAnswers ); - enum EditOptionsChoice { - zoom, - max_notes_per_row, - after_note_add, - NUM_EDIT_OPTIONS_CHOICES - }; - void HandleEditOptionsChoice( EditOptionsChoice c, int* iAnswers ); - enum EditSongInfoChoice { main_title, sub_title, diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index 065b76fe8c..fc4e8a0c91 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -340,6 +340,12 @@ void ScreenManager::SetNewScreen( CString sClassName ) else GAMESTATE->m_bIsOnSystemMenu = false; } +void ScreenManager::AddNewScreenToTop( CString sClassName ) +{ + Screen* pNewScreen = MakeNewScreen(sClassName); + m_ScreenStack.push_back( pNewScreen ); +} + void ScreenManager::Prompt( ScreenMessage SM_SendWhenDone, CString sText, bool bYesNo, bool bDefaultAnswer, void(*OnYes)(), void(*OnNo)() ) { // add the new state onto the back of the array @@ -389,13 +395,6 @@ void ScreenManager::SystemMessage( CString sMessage ) LOG->Trace( "WARNING: Didn't find an empty system messages slot." ); } -/* -void ScreenManager::OverrideCreditsMessage( PlayerNumber pn, CString sNewString ) -{ - m_textCreditInfo[p].SetText( sNewString ); -} -*/ - void ScreenManager::RefreshCreditsMessages() { // update joined diff --git a/stepmania/src/ScreenManager.h b/stepmania/src/ScreenManager.h index a649f72c6e..b67aa9b4dc 100644 --- a/stepmania/src/ScreenManager.h +++ b/stepmania/src/ScreenManager.h @@ -38,10 +38,11 @@ public: void PrepNewScreen( CString sClassName ); void LoadPreppedScreen(); void SetNewScreen( CString sClassName ); + void AddNewScreenToTop( CString sClassName ); void Prompt( ScreenMessage SM_SendWhenDone, CString sText, bool bYesNo = false, bool bDefaultAnswer = false, void(*OnYes)() = NULL, void(*OnNo)() = NULL ); void TextEntry( ScreenMessage SM_SendWhenDone, CString sQuestion, CString sInitialAnswer, void(*OnOK)(CString sAnswer) = NULL, void(*OnCanel)() = NULL ); void MiniMenu( MiniMenuDefinition* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel = SM_None ); - void PopTopScreen( ScreenMessage SM ); + void PopTopScreen( ScreenMessage SM = SM_RegainingFocus ); void SystemMessage( CString sMessage ); void SendMessageToTopScreen( ScreenMessage SM, float fDelay ); diff --git a/stepmania/src/ScreenMessage.h b/stepmania/src/ScreenMessage.h index 1fc4863277..a89a02f6ff 100644 --- a/stepmania/src/ScreenMessage.h +++ b/stepmania/src/ScreenMessage.h @@ -23,6 +23,7 @@ enum ScreenMessage { SM_BeginFadingOut, SM_GoToNextScreen, SM_GoToPrevScreen, + SM_RegainingFocus, SM_User = 100 }; diff --git a/stepmania/src/ScreenMiniMenu.cpp b/stepmania/src/ScreenMiniMenu.cpp index 83e17d3731..2dd29657a3 100644 --- a/stepmania/src/ScreenMiniMenu.cpp +++ b/stepmania/src/ScreenMiniMenu.cpp @@ -24,6 +24,12 @@ const float LABEL_X = 200; const float ANSWER_X = 440; const float SPACING_Y = 26; +const float ZOOM_SELECTED = 0.7f; +const float ZOOM_NOT_SELECTED = 0.5f; + +const RageColor COLOR_ENABLED = RageColor(1,1,1,1); +const RageColor COLOR_DISABLED = RageColor(0.5f,0.5f,0.5f,1); + const ScreenMessage SM_GoToOK = (ScreenMessage)(SM_User+1); const ScreenMessage SM_GoToCancel = (ScreenMessage)(SM_User+2); @@ -56,7 +62,10 @@ ScreenMiniMenu::ScreenMiniMenu( MiniMenuDefinition* pDef, ScreenMessage SM_SendO this->AddChild( &m_textTitle ); bool bMarkedFirstEnabledLine = false; - + m_iCurLine = 0; + + float fLongestLabelPlusAnswer = 0; + for( int i=0; iGetPathTo("Fonts","normal") ); m_textLabel[i].SetText( line.szLabel ); - m_textLabel[i].SetXY( LABEL_X, fY ); - m_textLabel[i].SetZoom( 0.5f ); + m_textLabel[i].SetY( fY ); + m_textLabel[i].SetZoom( ZOOM_NOT_SELECTED ); m_textLabel[i].SetHorizAlign( Actor::align_left ); - m_textLabel[i].SetDiffuse( line.bEnabled ? RageColor(1,1,1,1) : RageColor(0.5f,0.5f,0.5f,1) ); + m_textLabel[i].SetDiffuse( line.bEnabled ? COLOR_ENABLED : COLOR_DISABLED ); this->AddChild( &m_textLabel[i] ); m_textAnswer[i].LoadFromFont( THEME->GetPathTo("Fonts","normal") ); - m_textAnswer[i].SetText( line.szOptionsText[0] ); - m_textAnswer[i].SetXY( ANSWER_X, fY ); - m_textAnswer[i].SetZoom( 0.5f ); + m_textAnswer[i].SetText( line.szOptionsText[line.iDefaultOption] ); + m_textAnswer[i].SetY( fY ); + m_textAnswer[i].SetZoom( ZOOM_NOT_SELECTED ); m_textAnswer[i].SetHorizAlign( Actor::align_right ); - m_textAnswer[i].SetDiffuse( line.bEnabled ? RageColor(1,1,1,1) : RageColor(0.5f,0.5f,0.5f,1) ); + m_textAnswer[i].SetDiffuse( line.bEnabled ? COLOR_ENABLED : COLOR_DISABLED ); this->AddChild( &m_textAnswer[i] ); + fLongestLabelPlusAnswer = max( + fLongestLabelPlusAnswer, + m_textLabel[i].GetWidestLineWidthInSourcePixels() * ZOOM_SELECTED + + m_textAnswer[i].GetWidestLineWidthInSourcePixels() * ZOOM_SELECTED ); + if( !bMarkedFirstEnabledLine && line.bEnabled ) { m_iCurLine = i; @@ -90,6 +104,23 @@ ScreenMiniMenu::ScreenMiniMenu( MiniMenuDefinition* pDef, ScreenMessage SM_SendO m_iCurAnswers[i] = line.iDefaultOption; } + // adjust text spacing based on widest line + float fLabelX = LABEL_X; + float fAnswerX = ANSWER_X; + float fDefaultWidth = ANSWER_X - LABEL_X; + if( fLongestLabelPlusAnswer+20 > fDefaultWidth ) + { + float fIncreaseBy = fLongestLabelPlusAnswer - fDefaultWidth + 20; + fLabelX -= fIncreaseBy/2; + fAnswerX += fIncreaseBy/2; + } + + for( int i=0; iPlayOnce( THEME->GetPathTo("Sounds","menu prompt") ); } @@ -194,17 +225,17 @@ void ScreenMiniMenu::BeforeLineChanged() { m_textLabel[m_iCurLine].SetEffectNone(); m_textAnswer[m_iCurLine].SetEffectNone(); - m_textLabel[m_iCurLine].SetZoom( 0.5f ); - m_textAnswer[m_iCurLine].SetZoom( 0.5f ); + m_textLabel[m_iCurLine].SetZoom( ZOOM_NOT_SELECTED ); + m_textAnswer[m_iCurLine].SetZoom( ZOOM_NOT_SELECTED ); + SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","mini menu row") ); } void ScreenMiniMenu::AfterLineChanged() { m_textLabel[m_iCurLine].SetEffectGlowShift( 1.0f, RageColor(0,0.5f,0,1), RageColor(0,1,0,1) ); m_textAnswer[m_iCurLine].SetEffectGlowShift( 1.0f, RageColor(0,0.5f,0,1), RageColor(0,1,0,1) ); - m_textLabel[m_iCurLine].SetZoom( 0.7f ); - m_textAnswer[m_iCurLine].SetZoom( 0.7f ); - SOUNDMAN->PlayOnce( THEME->GetPathTo("Sounds","mini menu row") ); + m_textLabel[m_iCurLine].SetZoom( ZOOM_SELECTED ); + m_textAnswer[m_iCurLine].SetZoom( ZOOM_SELECTED ); } void ScreenMiniMenu::AfterAnswerChanged() diff --git a/stepmania/src/ScreenMiniMenu.h b/stepmania/src/ScreenMiniMenu.h index 5f5802052d..c8a8a7ad4d 100644 --- a/stepmania/src/ScreenMiniMenu.h +++ b/stepmania/src/ScreenMiniMenu.h @@ -25,7 +25,7 @@ struct MiniMenuDefinition int iNumLines; struct MiniMenuLine { - char szLabel[40]; + char szLabel[256]; bool bEnabled; int iNumOptions; int iDefaultOption; diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 93f9b6279c..d710074643 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -179,7 +179,9 @@ void ScreenPlayerOptions::ExportOptions() void ScreenPlayerOptions::GoToPrevState() { - if( GAMESTATE->m_PlayMode == PLAY_MODE_NONSTOP || + if( GAMESTATE->m_bEditing ) + SCREENMAN->PopTopScreen(); + else if( GAMESTATE->m_PlayMode == PLAY_MODE_NONSTOP || GAMESTATE->m_PlayMode == PLAY_MODE_ONI || GAMESTATE->m_PlayMode == PLAY_MODE_ENDLESS) SCREENMAN->SetNewScreen( "ScreenSelectCourse" ); @@ -189,7 +191,9 @@ void ScreenPlayerOptions::GoToPrevState() void ScreenPlayerOptions::GoToNextState() { - if( PREFSMAN->m_bShowSongOptions == true ) + if( GAMESTATE->m_bEditing ) + SCREENMAN->PopTopScreen(); + else if( PREFSMAN->m_bShowSongOptions == true ) SCREENMAN->SetNewScreen( "ScreenSongOptions" ); else SCREENMAN->SetNewScreen( "ScreenStage" ); diff --git a/stepmania/src/ScreenSongOptions.cpp b/stepmania/src/ScreenSongOptions.cpp index e626e86b43..c9fb7c08ad 100644 --- a/stepmania/src/ScreenSongOptions.cpp +++ b/stepmania/src/ScreenSongOptions.cpp @@ -107,14 +107,20 @@ void ScreenSongOptions::ExportOptions() void ScreenSongOptions::GoToPrevState() { - SCREENMAN->SetNewScreen( "ScreenPlayerOptions" ); + SOUNDMAN->StopMusic(); + if( GAMESTATE->m_bEditing ) + SCREENMAN->PopTopScreen( SM_None ); + else + SCREENMAN->SetNewScreen( "ScreenPlayerOptions" ); } void ScreenSongOptions::GoToNextState() { SOUNDMAN->StopMusic(); - - SCREENMAN->SetNewScreen( "ScreenStage" ); + if( GAMESTATE->m_bEditing ) + SCREENMAN->PopTopScreen(); + else + SCREENMAN->SetNewScreen( "ScreenStage" ); } diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 91ceccc1b3..bc8b6d44f6 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -406,6 +406,8 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam case MENU_BUTTON_COIN: /* Handle a coin insertion. */ + if( GAMESTATE->m_bEditing ) + break; if( type == IET_FIRST_PRESS ) return true; switch( PREFSMAN->m_CoinMode )