diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 26ad4a3369..13feecb0d8 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -165,12 +165,12 @@ bool NoteData::IsThereANoteAtRow( int iRow ) const } -int NoteData::GetFirstRow() +int NoteData::GetFirstRow() const { return BeatToNoteRow( GetFirstBeat() ); } -float NoteData::GetFirstBeat() +float NoteData::GetFirstBeat() const { float fEarliestBeatFoundSoFar = MAX_BEATS; @@ -443,37 +443,25 @@ void NoteData::LoadTransformedSlidingWindow( NoteData* pOriginal, int iNewNumTra int bOffsetIncreasing = true; int iLastRow = pOriginal->GetLastRow(); - for( int r=0; r<=iLastRow; r++ ) + for( int r=0; r<=iLastRow; ) { // copy notes in this measure for( int t=0; tm_iNumTracks; t++ ) { - int iOldTrack = t; - int iNewTrack = (iOldTrack + iCurTrackOffset) % iNewNumTracks; - if( pOriginal->GetTapNote(iOldTrack, r) != TAP_EMPTY ) + /* Copy a measure's worth of rows. This is an optimization; it's + * faster to copy row-wise than track-wise. */ + do { + int iOldTrack = t; + int iNewTrack = (iOldTrack + iCurTrackOffset) % iNewNumTracks; this->SetTapNote(iNewTrack, r, pOriginal->GetTapNote(iOldTrack, r)); + r++; + } while (r<=iLastRow && r % (ROWS_PER_MEASURE*4) == 0 ); } if( r % (ROWS_PER_MEASURE*4) == 0 ) // adjust sliding window every 4 measures { // See if there is a hold crossing the beginning of this measure bool bHoldCrossesThisMeasure = false; -#if 0 - pOriginal->Convert4sToHoldNotes(); - for( int i=0; iGetNumHoldNotes(); i++ ) - { - const HoldNote& hn = pOriginal->GEtHoldNote(i); - /* Bug here: NoteRowToBeat() may have floating point error, - * so we need to do an epsilon here. But we can do this in - * 4s easier anyway ... XXX -glenn */ - if( hn.m_fStartBeat < NoteRowToBeat(r) && hn.m_fEndBeat > NoteRowToBeat(r) ) - { - bHoldCrossesThisMeasure = true; - break; - } - } - pOriginal->ConvertHoldNotesTo4s(); -#endif if( r ) for( int t=0; t<=pOriginal->m_iNumTracks; t++ ) @@ -501,7 +489,6 @@ void NoteData::LoadTransformedSlidingWindow( NoteData* pOriginal, int iNewNumTra Convert4sToHoldNotes(); } - void NoteData::PadTapNotes(int rows) { int needed = rows - m_TapNotes[0].size() + 1; diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h index 49fb316a6b..d68253e5f6 100644 --- a/stepmania/src/NoteData.h +++ b/stepmania/src/NoteData.h @@ -84,8 +84,8 @@ public: // statistics bool IsThereANoteAtRow( int iRow ) const; - float GetFirstBeat(); // return the beat number of the first note - int GetFirstRow(); + float GetFirstBeat() const; // return the beat number of the first note + int GetFirstRow() const; float GetLastBeat() const; // return the beat number of the last note int GetLastRow() const; int GetNumTapNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS ) const;