From 22487df03c8685d190b20024aa338495bc745df9 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sat, 26 Nov 2011 13:56:27 -0500 Subject: [PATCH] New editor feature: Shift + F9/F10 for delays. Works the same as stops really. --- Docs/Changelog_sm5.txt | 2 ++ Themes/_fallback/Languages/en.ini | 1 + src/ScreenEdit.cpp | 57 ++++++++++++++++++++++++++++--- src/ScreenEdit.h | 4 +-- 4 files changed, 58 insertions(+), 6 deletions(-) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index 81384ab234..aae885b234 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -15,6 +15,8 @@ StepMania 5.0 $next | 20111xxx * [ScreenEdit] Minor convenience. If you attempt to create a negative stop segment from scratch, it does not create, and you are not requested to save on exit, for there is nothing to save. [Wolfman2000] +* [ScreenEdit] Allow Shift + F9/F10 for adjusting delays. This works the same + way as adjusting stops. [Wolfman2000] 2011/11/25 ---------- diff --git a/Themes/_fallback/Languages/en.ini b/Themes/_fallback/Languages/en.ini index 14fdb9d3a4..bbf0093f6a 100644 --- a/Themes/_fallback/Languages/en.ini +++ b/Themes/_fallback/Languages/en.ini @@ -2030,6 +2030,7 @@ Toggle assist tick=Toggle assist tick Next/prev steps of same StepsType=Next/prev steps of same StepsType Decrease/increase BPM at cur beat=Decrease/increase BPM at cur beat Decrease/increase stop at cur beat=Decrease/increase stop at cur beat +Decrease/increase delay at cur beat=Decrease/increase delay at cur beat Decrease/increase music offset=Decrease/increase music offset Decrease/increase sample music start=Decrease/increase sample music start Decrease/increase sample music length=Decrease/increase sample music length diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index cc4342f3ab..c62155e544 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -226,10 +226,14 @@ void ScreenEdit::InitEditMappings() m_EditMappingsDeviceInput.button[EDIT_BUTTON_BPM_UP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_F8); m_EditMappingsDeviceInput.button[EDIT_BUTTON_STOP_DOWN][0] = DeviceInput(DEVICE_KEYBOARD, KEY_F9); m_EditMappingsDeviceInput.button[EDIT_BUTTON_STOP_UP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_F10); - /* + m_EditMappingsDeviceInput.button[EDIT_BUTTON_DELAY_DOWN][0] = DeviceInput(DEVICE_KEYBOARD, KEY_F9); + m_EditMappingsDeviceInput.hold[EDIT_BUTTON_DELAY_DOWN][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT); + m_EditMappingsDeviceInput.hold[EDIT_BUTTON_DELAY_DOWN][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT); m_EditMappingsDeviceInput.button[EDIT_BUTTON_DELAY_UP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_F10); - */ + m_EditMappingsDeviceInput.hold[EDIT_BUTTON_DELAY_UP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT); + m_EditMappingsDeviceInput.hold[EDIT_BUTTON_DELAY_UP][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT); + m_EditMappingsDeviceInput.button[EDIT_BUTTON_OFFSET_DOWN][0] = DeviceInput(DEVICE_KEYBOARD, KEY_F11); m_EditMappingsDeviceInput.button[EDIT_BUTTON_OFFSET_UP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_F12); @@ -1924,7 +1928,52 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB ) SetDirty( true ); } break; - + // TODO: Combine the stop and delay call somehow? + case EDIT_BUTTON_DELAY_UP: + case EDIT_BUTTON_DELAY_DOWN: + { + float fDelta; + switch( EditB ) + { + DEFAULT_FAIL( EditB ); + case EDIT_BUTTON_DELAY_UP: fDelta = +0.020f; break; + case EDIT_BUTTON_DELAY_DOWN: fDelta = -0.020f; break; + } + if( EditIsBeingPressed( EDIT_BUTTON_ADJUST_FINE ) ) + { + fDelta /= 20; // 1ms + } + else if( input.type == IET_REPEAT ) + { + if( INPUTFILTER->GetSecsHeld(input.DeviceI) < 1.0f ) + fDelta *= 10; + else + fDelta *= 40; + } + + // is there a StopSegment on the current row? + TimingData & timing = GetAppropriateTiming(); + DelaySegment *seg = timing.GetDelaySegmentAtRow( GetRow() ); + int i = timing.GetSegmentIndexAtRow(SEGMENT_DELAY, GetRow()); + if (i == -1 || seg->GetRow() != GetRow()) // invalid + { + if( fDelta > 0 ) + timing.AddSegment( DelaySegment(GetRow(), fDelta) ); + else + break; + } + else + { + vector &stops = timing.GetTimingSegments(SEGMENT_DELAY); + seg->SetPause(seg->GetPause() + fDelta); + if( seg->GetPause() <= 0 ) + stops.erase( stops.begin()+i, stops.begin()+i+1); + } + + (fDelta>0 ? m_soundValueIncrease : m_soundValueDecrease).Play(); + SetDirty( true ); + } + break; case EDIT_BUTTON_OFFSET_UP: case EDIT_BUTTON_OFFSET_DOWN: { @@ -5080,7 +5129,7 @@ static const EditHelpLine g_EditHelpLines[] = EditHelpLine( "Next/prev steps of same StepsType", EDIT_BUTTON_OPEN_NEXT_STEPS, EDIT_BUTTON_OPEN_PREV_STEPS ), EditHelpLine( "Decrease/increase BPM at cur beat", EDIT_BUTTON_BPM_DOWN, EDIT_BUTTON_BPM_UP ), EditHelpLine( "Decrease/increase stop at cur beat", EDIT_BUTTON_STOP_DOWN, EDIT_BUTTON_STOP_UP ), - //EditHelpLine( "Decrease/increase delay at cur beat", EDIT_BUTTON_DELAY_DOWN, EDIT_BUTTON_DELAY_UP ), + EditHelpLine( "Decrease/increase delay at cur beat", EDIT_BUTTON_DELAY_DOWN, EDIT_BUTTON_DELAY_UP ), EditHelpLine( "Decrease/increase music offset", EDIT_BUTTON_OFFSET_DOWN, EDIT_BUTTON_OFFSET_UP ), EditHelpLine( "Decrease/increase sample music start", EDIT_BUTTON_SAMPLE_START_DOWN, EDIT_BUTTON_SAMPLE_START_UP ), EditHelpLine( "Decrease/increase sample music length", EDIT_BUTTON_SAMPLE_LENGTH_DOWN, EDIT_BUTTON_SAMPLE_LENGTH_UP ), diff --git a/src/ScreenEdit.h b/src/ScreenEdit.h index bb68c9d523..ecac3673dc 100644 --- a/src/ScreenEdit.h +++ b/src/ScreenEdit.h @@ -128,10 +128,10 @@ enum EditButton EDIT_BUTTON_BPM_DOWN, EDIT_BUTTON_STOP_UP, EDIT_BUTTON_STOP_DOWN, - /* + EDIT_BUTTON_DELAY_UP, EDIT_BUTTON_DELAY_DOWN, - */ + EDIT_BUTTON_OFFSET_UP, EDIT_BUTTON_OFFSET_DOWN, EDIT_BUTTON_SAMPLE_START_UP,