From 89ed68f86dacad85a4129d15efc014999b5db5a3 Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Tue, 9 Dec 2014 15:37:06 -0700 Subject: [PATCH] Edit Mode plays until music end if the music ends after the notes. --- Docs/Changelog_sm5.txt | 2 ++ src/ScreenEdit.cpp | 11 +++++++++-- src/ScreenEdit.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index 00d76fd7bd..36e5a4dcf6 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -6,6 +6,8 @@ ________________________________________________________________________________ 2014/12/10 ---------- +* [EditMode] Play whole song and play from current beat will now play until + either the music or the notes end, whichever is greater. [kyzentun] * [Player] "ComboBreakOnImmediateHoldLetGo" theme metric added. [sillybear] 2014/12/03 diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index 4878aa53b3..16421b3944 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -4423,6 +4423,13 @@ static LocalizedString DESTROY_ALL_UNSAVED_CHANGES ( "ScreenEdit", "This will de static LocalizedString REVERT_FROM_DISK ( "ScreenEdit", "Do you want to revert from disk?" ); static LocalizedString SAVE_CHANGES_BEFORE_EXITING ( "ScreenEdit", "Do you want to save changes before exiting?" ); +int ScreenEdit::GetSongOrNotesEnd() +{ + return max(m_iStartPlayingAt, max(m_NoteDataEdit.GetLastRow(), + BeatToNoteRow(m_pSteps->GetTimingData()->GetBeatFromElapsedTime( + GAMESTATE->m_pCurSong->m_fMusicLengthSeconds)))); +} + void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector &iAnswers ) { GAMESTATE->SetProcessedTimingData(m_pSteps->GetTimingData()); @@ -4440,7 +4447,7 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector &iAns case play_whole_song: { m_iStartPlayingAt = 0; - m_iStopPlayingAt = m_NoteDataEdit.GetLastRow(); + m_iStopPlayingAt= GetSongOrNotesEnd(); TransitionEditState( STATE_PLAYING ); } break; @@ -4454,7 +4461,7 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector &iAns case play_current_beat_to_end: { m_iStartPlayingAt = BeatToNoteRow(GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat); - m_iStopPlayingAt = max( m_iStartPlayingAt, m_NoteDataEdit.GetLastRow() ); + m_iStopPlayingAt= GetSongOrNotesEnd(); TransitionEditState( STATE_PLAYING ); } break; diff --git a/src/ScreenEdit.h b/src/ScreenEdit.h index 481ea6f35d..d9de73739d 100644 --- a/src/ScreenEdit.h +++ b/src/ScreenEdit.h @@ -397,6 +397,7 @@ public: NUM_MAIN_MENU_CHOICES, MAIN_MENU_CHOICE_INVALID }; + int GetSongOrNotesEnd(); void HandleMainMenuChoice( MainMenuChoice c, const vector &iAnswers ); void HandleMainMenuChoice( MainMenuChoice c ) { const vector v; HandleMainMenuChoice( c, v ); } MainMenuChoice m_CurrentAction;