diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index d11c08f2bc..8707da7293 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -3503,7 +3503,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, const vector &iAns // don't move the step from where it is, just move everything later NoteDataUtil::InsertRows( m_NoteDataEdit, BeatToNoteRow(GAMESTATE->m_fSongBeat) + 1, BeatToNoteRow(fStopBeats) ); - m_pSong->m_Timing.InsertRows( BeatToNoteRow(GAMESTATE->m_fSongBeat) + 1, BeatToNoteRow(fStopSeconds) ); + m_pSong->m_Timing.InsertRows( BeatToNoteRow(GAMESTATE->m_fSongBeat) + 1, BeatToNoteRow(fStopBeats) ); } break; case undo: diff --git a/src/TimingData.cpp b/src/TimingData.cpp index baf3e0c3a6..d7a9ccb3cf 100644 --- a/src/TimingData.cpp +++ b/src/TimingData.cpp @@ -676,7 +676,7 @@ void TimingData::ScaleRegion( float fScale, int iStartIndex, int iEndIndex, bool else m_BPMSegments[i].m_iStartRow = lrintf( (iSegStart - iStartIndex) * fScale ) + iStartIndex; } - + for( unsigned i = 0; i < m_StopSegments.size(); i++ ) { const int iSegStartRow = m_StopSegments[i].m_iStartRow; @@ -688,6 +688,25 @@ void TimingData::ScaleRegion( float fScale, int iStartIndex, int iEndIndex, bool m_StopSegments[i].m_iStartRow = lrintf((iSegStartRow - iStartIndex) * fScale) + iStartIndex; } + for( unsigned i = 0; i < m_WarpSegments.size(); i++ ) + { + const int iSegStartRow = m_WarpSegments[i].m_iStartRow; + const int iSegEndRow = BeatToNoteRow( m_WarpSegments[i].m_fEndBeat ); + if( iSegEndRow >= iStartIndex ) + { + if( iSegEndRow > iEndIndex ) + m_WarpSegments[i].m_fEndBeat += NoteRowToBeat(lrintf((iEndIndex - iStartIndex) * (fScale - 1))); + else + m_WarpSegments[i].m_fEndBeat = NoteRowToBeat(lrintf((iSegEndRow - iStartIndex) * fScale) + iStartIndex); + } + if( iSegStartRow < iStartIndex ) + continue; + else if( iSegStartRow > iEndIndex ) + m_WarpSegments[i].m_iStartRow += lrintf((iEndIndex - iStartIndex) * (fScale - 1)); + else + m_WarpSegments[i].m_iStartRow = lrintf((iSegStartRow - iStartIndex) * fScale) + iStartIndex; + } + // adjust BPM changes to preserve timing if( bAdjustBPM ) { @@ -735,7 +754,9 @@ void TimingData::InsertRows( int iStartRow, int iRowsToAdd ) for( unsigned i = 0; i < m_WarpSegments.size(); i++ ) { WarpSegment &warp = m_WarpSegments[i]; - if (warp.m_iStartRow < iStartRow ) + if( BeatToNoteRow(warp.m_fEndBeat) >= iStartRow ) + warp.m_fEndBeat += NoteRowToBeat(iRowsToAdd); + if( warp.m_iStartRow < iStartRow ) continue; warp.m_iStartRow += iRowsToAdd; } @@ -825,6 +846,9 @@ void TimingData::DeleteRows( int iStartRow, int iRowsToDelete ) { WarpSegment &warp = m_WarpSegments[i]; + if( BeatToNoteRow(warp.m_fEndBeat) >= iStartRow ) + warp.m_fEndBeat = max( NoteRowToBeat(iStartRow), warp.m_fEndBeat - NoteRowToBeat(iRowsToDelete) ); + if( warp.m_iStartRow < iStartRow ) continue;