make HoldNotes a vector
This commit is contained in:
+13
-23
@@ -36,19 +36,18 @@ NoteData::NoteData(const NoteData &cpy)
|
|||||||
NoteData &NoteData::operator= (const NoteData &cpy)
|
NoteData &NoteData::operator= (const NoteData &cpy)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
for(int t = 0; t < MAX_NOTE_TRACKS; ++t)
|
for(int t = 0; t < MAX_NOTE_TRACKS; ++t)
|
||||||
m_TapNotes[t] = cpy.m_TapNotes[t];
|
m_TapNotes[t] = cpy.m_TapNotes[t];
|
||||||
memmove(m_HoldNotes, cpy.m_HoldNotes, sizeof(m_HoldNotes));
|
|
||||||
|
|
||||||
m_iNumTracks = cpy.m_iNumTracks;
|
m_iNumTracks = cpy.m_iNumTracks;
|
||||||
m_iNumHoldNotes = cpy.m_iNumHoldNotes;
|
m_HoldNotes = cpy.m_HoldNotes;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteData::Init()
|
void NoteData::Init()
|
||||||
{
|
{
|
||||||
m_iNumTracks = 0;
|
m_iNumTracks = 0;
|
||||||
m_iNumHoldNotes = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NoteData::~NoteData()
|
NoteData::~NoteData()
|
||||||
@@ -239,10 +238,7 @@ void NoteData::AddHoldNote( HoldNote add )
|
|||||||
add.m_fEndBeat = max(add.m_fEndBeat, other.m_fEndBeat);
|
add.m_fEndBeat = max(add.m_fEndBeat, other.m_fEndBeat);
|
||||||
|
|
||||||
// delete this HoldNote
|
// delete this HoldNote
|
||||||
for( int j=i; j<GetNumHoldNotes()-1; j++ )
|
m_HoldNotes.erase(m_HoldNotes.begin()+i, m_HoldNotes.begin()+i+1);
|
||||||
m_HoldNotes[j] = m_HoldNotes[j+1];
|
|
||||||
|
|
||||||
m_iNumHoldNotes--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,13 +252,13 @@ void NoteData::AddHoldNote( HoldNote add )
|
|||||||
// add a tap note at the start of this hold
|
// add a tap note at the start of this hold
|
||||||
SetTapNote(add.m_iTrack, iAddStartIndex, TAP_HOLD_HEAD); // Hold begin marker. Don't draw this, but do grade it.
|
SetTapNote(add.m_iTrack, iAddStartIndex, TAP_HOLD_HEAD); // Hold begin marker. Don't draw this, but do grade it.
|
||||||
|
|
||||||
ASSERT( m_iNumHoldNotes < MAX_HOLD_NOTES );
|
ASSERT( m_HoldNotes.size() < MAX_HOLD_NOTES );
|
||||||
m_HoldNotes[m_iNumHoldNotes++] = add;
|
m_HoldNotes.push_back(add);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteData::RemoveHoldNote( int iHoldIndex )
|
void NoteData::RemoveHoldNote( int iHoldIndex )
|
||||||
{
|
{
|
||||||
ASSERT( iHoldIndex >= 0 && iHoldIndex < m_iNumHoldNotes );
|
ASSERT( iHoldIndex >= 0 && iHoldIndex < GetNumHoldNotes() );
|
||||||
|
|
||||||
HoldNote& hn = GetHoldNote(iHoldIndex);
|
HoldNote& hn = GetHoldNote(iHoldIndex);
|
||||||
|
|
||||||
@@ -272,10 +268,7 @@ void NoteData::RemoveHoldNote( int iHoldIndex )
|
|||||||
SetTapNote(hn.m_iTrack, iHoldStartIndex, TAP_EMPTY);
|
SetTapNote(hn.m_iTrack, iHoldStartIndex, TAP_EMPTY);
|
||||||
|
|
||||||
// remove from list
|
// remove from list
|
||||||
for( int j=iHoldIndex; j<GetNumHoldNotes()-1; j++ )
|
m_HoldNotes.erase(m_HoldNotes.begin()+iHoldIndex, m_HoldNotes.begin()+iHoldIndex+1);
|
||||||
m_HoldNotes[j] = m_HoldNotes[j+1];
|
|
||||||
|
|
||||||
m_iNumHoldNotes--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NoteData::IsThereANoteAtRow( int iRow ) const
|
bool NoteData::IsThereANoteAtRow( int iRow ) const
|
||||||
@@ -440,11 +433,8 @@ void NoteData::CropToLeftSide()
|
|||||||
{
|
{
|
||||||
if( c >= iFirstRightSideColumn )
|
if( c >= iFirstRightSideColumn )
|
||||||
{
|
{
|
||||||
// delete this HoldNote by shifting everything down
|
// delete this HoldNote
|
||||||
// XXX: err, why not just call RemoveHoldNote?
|
m_HoldNotes.erase(m_HoldNotes.begin()+i, m_HoldNotes.begin()+i+1);
|
||||||
for( int j=i; j<GetNumHoldNotes()-1; j++ )
|
|
||||||
GetHoldNote(j) = GetHoldNote(j+1);
|
|
||||||
m_iNumHoldNotes--;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -504,7 +494,7 @@ void NoteData::RemoveHoldNotes()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove all HoldNotes
|
// Remove all HoldNotes
|
||||||
m_iNumHoldNotes = 0;
|
m_HoldNotes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -683,7 +673,7 @@ void NoteData::MakeLittle()
|
|||||||
// leave HoldNotes unchanged (what should be do with them?)
|
// leave HoldNotes unchanged (what should be do with them?)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ConvertHoldNotesTo2sAnd3s also clears m_iNumHoldNotes;
|
/* ConvertHoldNotesTo2sAnd3s also clears m_iHoldNotes;
|
||||||
* shouldn't this do likewise and set all 2/3's to 0?
|
* shouldn't this do likewise and set all 2/3's to 0?
|
||||||
* -glenn
|
* -glenn
|
||||||
*
|
*
|
||||||
@@ -741,7 +731,7 @@ void NoteData::ConvertHoldNotesTo2sAnd3s()
|
|||||||
SetTapNote(hn.m_iTrack, iHoldEndIndex, TAP_HOLD_TAIL);
|
SetTapNote(hn.m_iTrack, iHoldEndIndex, TAP_HOLD_TAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_iNumHoldNotes = 0;
|
m_HoldNotes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "104444001" ==
|
/* "104444001" ==
|
||||||
@@ -785,7 +775,7 @@ void NoteData::ConvertHoldNotesTo4s()
|
|||||||
for( int j = iHoldStartIndex; j < iHoldEndIndex; ++j)
|
for( int j = iHoldStartIndex; j < iHoldEndIndex; ++j)
|
||||||
SetTapNote(hn.m_iTrack, j, TAP_HOLD);
|
SetTapNote(hn.m_iTrack, j, TAP_HOLD);
|
||||||
}
|
}
|
||||||
m_iNumHoldNotes = 0;
|
m_HoldNotes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteData::SnapToNearestNoteType( NoteType nt1, NoteType nt2, float fBeginBeat, float fEndBeat )
|
void NoteData::SnapToNearestNoteType( NoteType nt1, NoteType nt2, float fBeginBeat, float fEndBeat )
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ public:
|
|||||||
|
|
||||||
int m_iNumTracks;
|
int m_iNumTracks;
|
||||||
|
|
||||||
HoldNote m_HoldNotes[MAX_HOLD_NOTES];
|
vector<HoldNote> m_HoldNotes;
|
||||||
int m_iNumHoldNotes;
|
|
||||||
|
|
||||||
/* Return the note at the given track and row. Row may be out of
|
/* Return the note at the given track and row. Row may be out of
|
||||||
* range; pretend the song goes on with TAP_EMPTYs indefinitely. */
|
* range; pretend the song goes on with TAP_EMPTYs indefinitely. */
|
||||||
@@ -57,7 +56,7 @@ public:
|
|||||||
void ClearRange( int iNoteIndexBegin, int iNoteIndexEnd );
|
void ClearRange( int iNoteIndexBegin, int iNoteIndexEnd );
|
||||||
void ClearAll() { ClearRange( 0, MAX_TAP_NOTE_ROWS ); };
|
void ClearAll() { ClearRange( 0, MAX_TAP_NOTE_ROWS ); };
|
||||||
void CopyRange( NoteData* pFrom, int iFromIndexBegin, int iFromIndexEnd, int iToIndexBegin = -1 );
|
void CopyRange( NoteData* pFrom, int iFromIndexBegin, int iFromIndexEnd, int iToIndexBegin = -1 );
|
||||||
void CopyAll( NoteData* pFrom ) { m_iNumTracks = pFrom->m_iNumTracks; m_iNumHoldNotes = 0; CopyRange( pFrom, 0, MAX_TAP_NOTE_ROWS ); };
|
void CopyAll( NoteData* pFrom ) { m_iNumTracks = pFrom->m_iNumTracks; m_HoldNotes.clear(); CopyRange( pFrom, 0, MAX_TAP_NOTE_ROWS ); };
|
||||||
|
|
||||||
inline bool IsRowEmpty( int index )
|
inline bool IsRowEmpty( int index )
|
||||||
{
|
{
|
||||||
@@ -84,7 +83,7 @@ public:
|
|||||||
int GetNumDoubles( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
int GetNumDoubles( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
||||||
/* optimization: for the default of start to end, use the second (faster) */
|
/* optimization: for the default of start to end, use the second (faster) */
|
||||||
int GetNumHoldNotes( const float fStartBeat, const float fEndBeat = MAX_BEATS );
|
int GetNumHoldNotes( const float fStartBeat, const float fEndBeat = MAX_BEATS );
|
||||||
int GetNumHoldNotes() const { return m_iNumHoldNotes; }
|
int GetNumHoldNotes() const { return m_HoldNotes.size(); }
|
||||||
|
|
||||||
int GetPossibleDancePoints();
|
int GetPossibleDancePoints();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user