From 3d6f1c522741a8bf584b6c07f5b7c9b3e8336535 Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Mon, 21 Jan 2013 23:13:38 -0500 Subject: [PATCH] ScreenEdit: handle beat-0 offset the same as other timing data --- src/ScreenEdit.cpp | 53 +++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index 8acd7e2e5d..207f554987 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -86,6 +86,7 @@ AutoScreenMessage( SM_DoRevertToLastSave ); AutoScreenMessage( SM_DoRevertFromDisk ); AutoScreenMessage( SM_BackFromTimingDataInformation ); AutoScreenMessage( SM_BackFromDifficultyMeterChange ); +AutoScreenMessage( SM_BackFromBeat0Change ); AutoScreenMessage( SM_BackFromBPMChange ); AutoScreenMessage( SM_BackFromStopChange ); AutoScreenMessage( SM_BackFromDelayChange ); @@ -3312,6 +3313,27 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM ) GAMESTATE->m_pCurSteps[PLAYER_1]->SetMeter(i); SetDirty( true ); } + else if( SM == SM_BackFromBeat0Change && !ScreenTextEntry::s_bCancelledLast ) + { + float fBeat0 = StringToFloat( ScreenTextEntry::s_sLastAnswer ); + + TimingData &timing = GetAppropriateTimingForUpdate(); + float old = timing.m_fBeat0OffsetInSeconds; + timing.m_fBeat0OffsetInSeconds = fBeat0; + float delta = timing.m_fBeat0OffsetInSeconds - old; + + if (GAMESTATE->m_bIsUsingStepTiming) + { + GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks.UpdateStartTimes(delta); + } + else + { + GAMESTATE->m_pCurSong->m_Attacks.UpdateStartTimes(delta); + GAMESTATE->m_pCurSong->m_fMusicSampleStartSeconds += delta; + } + + SetDirty( true ); + } else if( SM == SM_BackFromBPMChange && !ScreenTextEntry::s_bCancelledLast ) { float fBPM = StringToFloat( ScreenTextEntry::s_sLastAnswer ); @@ -4116,26 +4138,6 @@ static void ChangeArtistTranslit( const RString &sNew ) pSong->m_sArtistTranslit = sNew; } -static void ChangeBeat0Offset( const RString &sNew ) -{ - TimingData &timing = (GAMESTATE->m_bIsUsingStepTiming ? - GAMESTATE->m_pCurSteps[PLAYER_1]->m_Timing : - GAMESTATE->m_pCurSong->m_SongTiming); - float old = timing.m_fBeat0OffsetInSeconds; - timing.m_fBeat0OffsetInSeconds = StringToFloat(sNew); - float delta = timing.m_fBeat0OffsetInSeconds - old; - - if (GAMESTATE->m_bIsUsingStepTiming) - { - GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks.UpdateStartTimes(delta); - } - else - { - GAMESTATE->m_pCurSong->m_Attacks.UpdateStartTimes(delta); - GAMESTATE->m_pCurSong->m_fMusicSampleStartSeconds += delta; - } -} - static void ChangeLastSecondHint( const RString &sNew ) { Song &s = *GAMESTATE->m_pCurSong; @@ -5231,11 +5233,14 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice { DEFAULT_FAIL( c ); case beat_0_offset: - ScreenTextEntry::TextEntry( SM_None, ENTER_BEAT_0_OFFSET, - FloatToString(GetAppropriateTiming().m_fBeat0OffsetInSeconds), 20, - ScreenTextEntry::FloatValidate, ChangeBeat0Offset, NULL ); + ScreenTextEntry::TextEntry( + SM_BackFromBeat0Change, + ENTER_BEAT_0_OFFSET, + FloatToString(GetAppropriateTiming().m_fBeat0OffsetInSeconds), + 20 + ); break; - case bpm: + case bpm: ScreenTextEntry::TextEntry( SM_BackFromBPMChange, ENTER_BPM_VALUE,