diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 0005ea2431..38127791dc 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -566,6 +566,7 @@ void ScreenEdit::Init() m_pSong = GAMESTATE->m_pCurSong; m_pSteps = GAMESTATE->m_pCurSteps[PLAYER_1]; m_pAttacksFromCourse = NULL; + m_fBeatToReturnTo = 0; GAMESTATE->m_bPastHereWeGo = false; @@ -1706,6 +1707,8 @@ void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType typ switch( EditB ) { case EDIT_BUTTON_RETURN_TO_EDIT: + /* When exiting play mode manually, leave the cursor where it is. */ + m_fBeatToReturnTo = GAMESTATE->m_fSongBeat; TransitionEditState( STATE_EDITING ); break; case EDIT_BUTTON_TOGGLE_ASSIST_TICK: @@ -1759,6 +1762,10 @@ void ScreenEdit::TransitionEditState( EditState em ) /* If we're playing sample music when changing modes, stop it. */ SOUND->PlayMusic(""); + // If exiting EDIT mode, save the cursor position. + if( old == STATE_EDITING ) + m_fBeatToReturnTo = GAMESTATE->m_fSongBeat; + if( old == STATE_PLAYING ) { if( GAMESTATE->IsSyncDataChanged() ) @@ -1778,6 +1785,9 @@ void ScreenEdit::TransitionEditState( EditState em ) m_soundMusic.StopPlaying(); m_soundAssistTick.StopPlaying(); /* Stop any queued assist ticks. */ + /* Restore the cursor position. */ + GAMESTATE->m_fSongBeat = m_fBeatToReturnTo; + /* Make sure we're snapped. */ GAMESTATE->m_fSongBeat = Quantize( GAMESTATE->m_fSongBeat, NoteTypeToBeat(m_SnapDisplay.GetNoteType()) ); diff --git a/stepmania/src/ScreenEdit.h b/stepmania/src/ScreenEdit.h index ba9d977a70..c7f9c34e47 100644 --- a/stepmania/src/ScreenEdit.h +++ b/stepmania/src/ScreenEdit.h @@ -226,6 +226,7 @@ protected: // for MODE_RECORD and MODE_PLAY int m_iStartPlayingAt, m_iStopPlayingAt; + float m_fBeatToReturnTo; RageSound m_soundMusic;