From d7aba9fd68a6c40f8314374afd3f9390dec29b6e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 9 Jan 2005 22:24:52 +0000 Subject: [PATCH] fix some cases of transforms brute-force iterating over rows --- stepmania/src/NoteDataUtil.cpp | 60 ++++++++++++++++------------------ 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/stepmania/src/NoteDataUtil.cpp b/stepmania/src/NoteDataUtil.cpp index c6daac4719..0afbf164ff 100644 --- a/stepmania/src/NoteDataUtil.cpp +++ b/stepmania/src/NoteDataUtil.cpp @@ -276,6 +276,8 @@ void NoteDataUtil::LoadTransformedSlidingWindow( const NoteData &in, NoteData &o int bOffsetIncreasing = true; int iLastRow = Original.GetLastRow(); + + int iLastMeasure = 0; for( int r=0; r<=iLastRow; ) { // copy notes in this measure @@ -288,7 +290,8 @@ void NoteDataUtil::LoadTransformedSlidingWindow( const NoteData &in, NoteData &o } r++; - if( r % (ROWS_PER_MEASURE*4) == 0 ) // adjust sliding window every 4 measures + const int iMeasure = r / ROWS_PER_MEASURE; + if( iMeasure / 4 != iLastMeasure / 4 ) // adjust sliding window every 4 measures { // See if there is a hold crossing the beginning of this measure bool bHoldCrossesThisMeasure = false; @@ -313,6 +316,8 @@ void NoteDataUtil::LoadTransformedSlidingWindow( const NoteData &in, NoteData &o CLAMP( iCurTrackOffset, iTrackOffsetMin, iTrackOffsetMax ); } } + + iLastMeasure = iMeasure; } out.Convert4sToHoldNotes(); @@ -894,7 +899,7 @@ void NoteDataUtil::Wide( NoteData &inout, float fStartBeat, float fEndBeat ) continue; // skip bool bSpaceAroundIsEmpty = true; // no other notes with a 1/8th of this row - for( int j=i-ROWS_PER_BEAT/2+1; j 0 ) { bSpaceAroundIsEmpty = false; @@ -994,16 +999,12 @@ void NoteDataUtil::InsertIntelligentTaps( // don't insert a new note if there's already one within this interval bool bNoteInMiddle = false; - for( int j=iRowEarlier+1; j<=iRowLater-1; j++ ) - if( !inout.IsRowEmpty(j) ) - { - bNoteInMiddle = true; - break; - } + FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( inout, j, iRowEarlier+1, iRowLater-1 ) + bNoteInMiddle = true; if( bNoteInMiddle ) continue; - // add a note determinitsitcally somewhere on a track different from the two surrounding notes + // add a note deterministically somewhere on a track different from the two surrounding notes int iTrackOfNoteEarlier = -1; bool bEarlierHasNonEmptyTrack = inout.GetTapFirstNonEmptyTrack( iRowEarlier, iTrackOfNoteEarlier ); int iTrackOfNoteLater = -1; @@ -1058,25 +1059,24 @@ void NoteDataUtil::AddMines( NoteData &inout, float fStartBeat, float fEndBeat ) int iRowCount = 0; int iPlaceEveryRows = 6; - for( int r=first_row; r<=last_row; r++ ) + FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( inout, r, first_row, last_row ) { - if( !inout.IsRowEmpty(r) ) - { - iRowCount++; + iRowCount++; - // place every 6 or 7 rows - if( iRowCount>=iPlaceEveryRows ) - { - for( int t=0; t=iPlaceEveryRows ) + { + for( int t=0; t