From f1229d29cb647b26150bc3926d0cff2ef14c29bd Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Mon, 16 Feb 2015 13:31:21 -0700 Subject: [PATCH] Made backslash mappable. Fixed mistake in previous AddSegment fix so now it correctly compares to the previous segment again. F7/F8 no longer allow negative bpms to match Edit BPM behavior. --- src/RageInputDevice.cpp | 11 +++++++---- src/ScreenEdit.cpp | 5 ++++- src/TimingData.cpp | 12 ++++++++++++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/RageInputDevice.cpp b/src/RageInputDevice.cpp index 39ea7e52e6..d1bb07d4c1 100644 --- a/src/RageInputDevice.cpp +++ b/src/RageInputDevice.cpp @@ -28,6 +28,7 @@ static void InitNames() g_mapNamesToString[KEY_COMMA] = "comma"; g_mapNamesToString[KEY_SPACE] = "space"; g_mapNamesToString[KEY_DEL] = "delete"; + g_mapNamesToString[KEY_BACKSLASH] = "backslash"; g_mapNamesToString[KEY_BACK] = "backspace"; g_mapNamesToString[KEY_TAB] = "tab"; @@ -145,6 +146,12 @@ RString DeviceButtonToString( DeviceButton key ) { InitNames(); + // Check the name map first to allow making names for keys that are inside + // the ascii range. -Kyz + map::const_iterator it = g_mapNamesToString.find( key ); + if( it != g_mapNamesToString.end() ) + return it->second; + // All printable ASCII except for uppercase alpha characters line up. if( key >= 33 && key < 127 && !(key >= 'A' && key <= 'Z' ) ) return ssprintf( "%c", key ); @@ -158,10 +165,6 @@ RString DeviceButtonToString( DeviceButton key ) if( key >= MIDI_FIRST && key <= MIDI_LAST ) return ssprintf( "Midi %d", key-MIDI_FIRST ); - map::const_iterator it = g_mapNamesToString.find( key ); - if( it != g_mapNamesToString.end() ) - return it->second; - return "unknown"; } diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index 506ace23cc..3caf613f97 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -2367,7 +2367,10 @@ bool ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB ) } float fNewBPM = fBPM + fDelta; - GetAppropriateTimingForUpdate().SetBPMAtBeat( GetBeat(), fNewBPM ); + if(fNewBPM > 0.0f) + { + GetAppropriateTimingForUpdate().AddSegment(BPMSegment(GetRow(), fNewBPM)); + } (fDelta>0 ? m_soundValueIncrease : m_soundValueDecrease).Play(); SetDirty( true ); } diff --git a/src/TimingData.cpp b/src/TimingData.cpp index fd2311f453..55abde30f2 100644 --- a/src/TimingData.cpp +++ b/src/TimingData.cpp @@ -423,6 +423,18 @@ void TimingData::AddSegment( const TimingSegment *seg ) return; } } + else + { + // if true, this is redundant segment change + if( (*prev) == (*seg) ) + { + if( prev != cur ) + { + EraseSegment( vSegs, index, cur ); + } + return; + } + } } else {