don't lose HoldNoteResult when converting to/from 2sAnd3s

This commit is contained in:
Glenn Maynard
2005-01-23 17:17:24 +00:00
parent 4ad39097ef
commit 18e32dbda4
3 changed files with 24 additions and 17 deletions
+12 -7
View File
@@ -601,7 +601,8 @@ void NoteData::Convert2sAnd3sToHoldNotes()
{ {
FOREACH_NONEMPTY_ROW_IN_TRACK( *this, t, r ) FOREACH_NONEMPTY_ROW_IN_TRACK( *this, t, r )
{ {
if( GetTapNote(t,r).type != TapNote::hold_head ) TapNote head = GetTapNote(t,r);
if( head.type != TapNote::hold_head )
continue; // skip continue; // skip
SetTapNote(t, r, TAP_EMPTY); // clear the hold head marker SetTapNote(t, r, TAP_EMPTY); // clear the hold head marker
@@ -616,7 +617,9 @@ void NoteData::Convert2sAnd3sToHoldNotes()
SetTapNote(t, j, TAP_EMPTY); SetTapNote(t, j, TAP_EMPTY);
AddHoldNote( HoldNote(t, r, j) ); HoldNote hold(t, r, j);
hold.result = head.HoldResult;
AddHoldNote( hold );
break; // done searching for the end of this hold break; // done searching for the end of this hold
} }
} }
@@ -634,11 +637,13 @@ void NoteData::ConvertHoldNotesTo2sAnd3s()
const HoldNote &hn = GetHoldNote(i); const HoldNote &hn = GetHoldNote(i);
/* If they're the same, then they got clamped together, so just ignore it. */ /* If they're the same, then they got clamped together, so just ignore it. */
if( hn.iStartRow != hn.iEndRow ) if( hn.iStartRow == hn.iEndRow )
{ continue;
SetTapNote( hn.iTrack, hn.iStartRow, TAP_ORIGINAL_HOLD_HEAD );
SetTapNote( hn.iTrack, hn.iEndRow, TAP_ORIGINAL_HOLD_TAIL ); TapNote head = TAP_ORIGINAL_HOLD_HEAD;
} head.HoldResult = hn.result;
SetTapNote( hn.iTrack, hn.iStartRow, head );
SetTapNote( hn.iTrack, hn.iEndRow, TAP_ORIGINAL_HOLD_TAIL );
} }
m_HoldNotes.clear(); m_HoldNotes.clear();
} }
+2 -2
View File
@@ -581,8 +581,8 @@ void NoteField::DrawPrimitives()
continue; // skip continue; // skip
} }
const bool bIsActive = hn.bActive; const bool bIsActive = hn.result.bActive;
const bool bIsHoldingNote = hn.bHeld; const bool bIsHoldingNote = hn.result.bHeld;
if( bIsActive ) if( bIsActive )
SearchForSongBeat()->m_GhostArrowRow.SetHoldIsActive( hn.iTrack ); SearchForSongBeat()->m_GhostArrowRow.SetHoldIsActive( hn.iTrack );
+10 -8
View File
@@ -21,6 +21,7 @@ struct TapNoteResult
bool bHidden; bool bHidden;
}; };
/* This HoldNote data is persisted when converted to 2sAnd3s. */
struct HoldNoteResult struct HoldNoteResult
{ {
HoldNoteScore hns; HoldNoteScore hns;
@@ -40,9 +41,13 @@ struct HoldNoteResult
hns = HNS_NONE; hns = HNS_NONE;
fLife = 1.0f; fLife = 1.0f;
iLastHeldRow = 0; iLastHeldRow = 0;
bHeld = bActive = false;
} }
float GetLastHeldBeat() const; float GetLastHeldBeat() const;
bool bHeld;
bool bActive;
}; };
@@ -112,9 +117,10 @@ struct TapNote
return true; return true;
} }
/* This data is only used and manipulated by NoteDataWithScoring. It's only in
* here for the sake of efficiency. */
TapNoteResult result; TapNoteResult result;
/* This is valid for hold_head when in 2sAnd3s. */
HoldNoteResult HoldResult;
}; };
extern TapNote TAP_EMPTY; // '0' extern TapNote TAP_EMPTY; // '0'
@@ -173,7 +179,7 @@ inline float NoteRowToBeat( int row ) { return NoteRowToBeat( (float)row ); }
struct HoldNote struct HoldNote
{ {
HoldNote( int t, int s, int e ) { iTrack=t; iStartRow=s; iEndRow=e; bHeld = bActive = false; } HoldNote( int t, int s, int e ) { iTrack=t; iStartRow=s; iEndRow=e; }
bool RowIsInRange( int row ) const { return iStartRow <= row && row <= iEndRow; } bool RowIsInRange( int row ) const { return iStartRow <= row && row <= iEndRow; }
bool RangeOverlaps( int start, int end ) const bool RangeOverlaps( int start, int end ) const
{ {
@@ -189,16 +195,12 @@ struct HoldNote
float GetStartBeat() const { return NoteRowToBeat( iStartRow ); } float GetStartBeat() const { return NoteRowToBeat( iStartRow ); }
float GetEndBeat() const { return NoteRowToBeat( iEndRow ); } float GetEndBeat() const { return NoteRowToBeat( iEndRow ); }
/* Invariant: iStartRow <= iEndRow */ /* Invariant: iStartRow <= iEndRow. If equal, the hold note is empty. */
int iStartRow; int iStartRow;
int iEndRow; int iEndRow;
int iTrack; int iTrack;
/* This data is only used and manipulated by NoteDataWithScoring. It's only in
* here for the sake of efficiency. */
HoldNoteResult result; HoldNoteResult result;
bool bHeld;
bool bActive;
}; };
#endif #endif