From 45591679e6f218f0b0d0fdd3485135527bb39b56 Mon Sep 17 00:00:00 2001 From: Matt Denham Date: Wed, 25 Feb 2004 08:25:39 +0000 Subject: [PATCH] added NoteDataUtil::ScaleRegion, made NoteDataUtil::Scale call that instead --- stepmania/src/NoteDataUtil.cpp | 37 ++++++++++++++++++++++++++++++++++ stepmania/src/NoteDataUtil.h | 4 +++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/stepmania/src/NoteDataUtil.cpp b/stepmania/src/NoteDataUtil.cpp index 60b3e40a27..4fa1d39bd5 100644 --- a/stepmania/src/NoteDataUtil.cpp +++ b/stepmania/src/NoteDataUtil.cpp @@ -1399,6 +1399,7 @@ void NoteDataUtil::AddTapAttacks( NoteData &nd, Song* pSong ) } } +#if 0 // undo this if ScaleRegion breaks more things than it fixes void NoteDataUtil::Scale( NoteData &nd, float fScale ) { ASSERT( fScale > 0 ); @@ -1422,6 +1423,42 @@ void NoteDataUtil::Scale( NoteData &nd, float fScale ) } } } +#endif + +// added to fix things in the editor +void NoteDataUtil::ScaleRegion( NoteData &nd, float fScale, float fStartBeat, float fEndBeat) { + ASSERT( fScale > 0 ); + + NoteData temp1, temp2; + temp1.Config( nd ); + temp2.Config( nd ); + + int iFirstRowAtEndOfRegion = (nd.GetLastRow() > (fEndBeat * ROWS_PER_BEAT)) ? + nd.GetLastRow() : + fEndBeat * ROWS_PER_BEAT; + + temp1.CopyRange( &nd, 0, fStartBeat * ROWS_PER_BEAT ); + temp1.CopyRange( &nd, (fEndBeat - fStartBeat) * fScale * ROWS_PER_BEAT, nd.GetLastRow(), iFirstRowAtEndOfRegion); + temp2.CopyRange( &nd, fStartBeat * ROWS_PER_BEAT, fEndBeat * ROWS_PER_BEAT ); + nd.ClearAll(); + + for( int r=0; r<=temp2.GetLastRow(); r++ ) + { + for( int t=0; t0, add blank rows. If fBeatsToShift<0, delete rows void ShiftRows( NoteData &nd, float fStartBeat, float fBeatsToShift );