From fe240ddcd9b93bf7f570156abe8210c04ef1f1f2 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 21 Jul 2005 02:44:53 +0000 Subject: [PATCH] it's typically not useful to leave the cursor where it was when exiting play/record, so restore the cursor position. (do leave the cursor where it is when exiting play mode explicitly) --- stepmania/src/ScreenEdit.cpp | 10 ++++++++++ stepmania/src/ScreenEdit.h | 1 + 2 files changed, 11 insertions(+) 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;