#include "stdafx.h" /* ----------------------------------------------------------------------------- File: NoteData.cpp Desc: A pattern of ColorNotes that past Y==0. Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ #include "NoteData.h" #include "RageUtil.h" #include "ScreenDimensions.h" #include "ThemeManager.h" #include "ArrowEffects.h" #include "PrefsManager.h" #include "GameConstants.h" #include "ErrorCatcher/ErrorCatcher.h" NoteData::NoteData() { for( int i=0; i= iNoteIndexBegin && hn.m_iStartIndex <= iNoteIndexEnd) || (hn.m_iEndIndex >= iNoteIndexBegin && hn.m_iEndIndex <= iNoteIndexEnd) ) // overlap (kinda) { ; // do nothing } else // ! overlap { m_HoldNotes[iIndexWrite] = m_HoldNotes[iIndexRead]; iIndexWrite++; } } m_iNumHoldNotes = iIndexWrite; } void NoteData::CopyRange( NoteData* pFrom, NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd ) { ASSERT( pFrom->m_iNumTracks == m_iNumTracks ); int i; // copy recorded TapNotes for( i=iNoteIndexBegin; i<=iNoteIndexEnd; i++ ) { for( int c=0; cm_TapNotes[c][i]; } // copy recorded HoldNotes for( i=0; im_iNumHoldNotes; i++ ) { HoldNote hn = pFrom->m_HoldNotes[i]; if( (hn.m_iStartIndex >= iNoteIndexBegin && hn.m_iStartIndex <= iNoteIndexEnd) || (hn.m_iEndIndex >= iNoteIndexBegin && hn.m_iEndIndex <= iNoteIndexEnd) ) // overlap (kinda) { this->AddHoldNote( hn ); } } } void NoteData::AddHoldNote( HoldNote add ) { int i; // look for other hold notes that overlap and merge them for( i=0; i= add.m_iStartIndex ) // these HoldNotes overlap (this isn't entirely correct!) { add.m_iStartIndex = min(add.m_iStartIndex, other.m_iStartIndex); add.m_iEndIndex = max(add.m_iEndIndex, other.m_iEndIndex); // delete this HoldNote for( int j=i; j 0 && index < m_iNumHoldNotes ); for( int j=index; j iOldestIndexFoundSoFar ) iOldestIndexFoundSoFar = m_HoldNotes[i].m_iEndIndex; } for( i=MAX_TAP_NOTE_ELEMENTS-1; i>=iOldestIndexFoundSoFar; i-- ) // iterate back to front { for( int t=0; t=0; i-- ) // foreach HoldNote { if( c >= iFirstRightSideColumn ) { // delete this HoldNote by shifting everything down for( int j=i; j=0; i-- ) // foreach HoldNote { HoldNote &hn = m_HoldNotes[i]; if( hn.m_iTrack < iFirstRightSideColumn ) { // delete this HoldNote by shifting everything down RemoveHoldNote( i ); } else { m_HoldNotes[i].m_iTrack -= 4; } } } void NoteData::RemoveHoldNotes() { // turn all the HoldNotes into TapNotes for( int i=0; im_iNumTracks = m_iNumTracks; // transform m_TapNotes for( int i=0; im_TapNotes[iNewCol][i] = m_TapNotes[iOldCol][i]; } } // transform m_HoldNotes for( i=0; iAddHoldNote( newHN ); } } } // // copy note data from newData back into this // (*this) = *pNewData; } void NoteData::MakeLittle() { // filter out all non-quarter notes for( int i=0; iGetLastBeat(); int iLastMeasure = int( fLastBeat/BEATS_PER_MEASURE ); for( int m=0; m<=iLastMeasure; m++ ) // foreach measure { CString sMeasureString; int iMeasureStartIndex = m * ELEMENTS_PER_MEASURE; int iMeasureLastIndex = (m+1) * ELEMENTS_PER_MEASURE - 1; // probe to find the smallest note type NoteType nt; int iNoteIndexSpacing; for( nt=(NoteType)0; ntm_TapNotes[iOriginalTrack][i]; for( i=0; im_HoldNotes[i]; if( hn.m_iTrack == iOriginalTrack ) { hn.m_iTrack = t; this->AddHoldNote( hn ); } } } }