don't lose HoldNoteResult when converting to/from 2sAnd3s
This commit is contained in:
@@ -601,7 +601,8 @@ void NoteData::Convert2sAnd3sToHoldNotes()
|
||||
{
|
||||
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
|
||||
|
||||
SetTapNote(t, r, TAP_EMPTY); // clear the hold head marker
|
||||
@@ -616,7 +617,9 @@ void NoteData::Convert2sAnd3sToHoldNotes()
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -634,11 +637,13 @@ void NoteData::ConvertHoldNotesTo2sAnd3s()
|
||||
const HoldNote &hn = GetHoldNote(i);
|
||||
|
||||
/* If they're the same, then they got clamped together, so just ignore it. */
|
||||
if( hn.iStartRow != hn.iEndRow )
|
||||
{
|
||||
SetTapNote( hn.iTrack, hn.iStartRow, TAP_ORIGINAL_HOLD_HEAD );
|
||||
SetTapNote( hn.iTrack, hn.iEndRow, TAP_ORIGINAL_HOLD_TAIL );
|
||||
}
|
||||
if( hn.iStartRow == hn.iEndRow )
|
||||
continue;
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -581,8 +581,8 @@ void NoteField::DrawPrimitives()
|
||||
continue; // skip
|
||||
}
|
||||
|
||||
const bool bIsActive = hn.bActive;
|
||||
const bool bIsHoldingNote = hn.bHeld;
|
||||
const bool bIsActive = hn.result.bActive;
|
||||
const bool bIsHoldingNote = hn.result.bHeld;
|
||||
if( bIsActive )
|
||||
SearchForSongBeat()->m_GhostArrowRow.SetHoldIsActive( hn.iTrack );
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ struct TapNoteResult
|
||||
bool bHidden;
|
||||
};
|
||||
|
||||
/* This HoldNote data is persisted when converted to 2sAnd3s. */
|
||||
struct HoldNoteResult
|
||||
{
|
||||
HoldNoteScore hns;
|
||||
@@ -40,9 +41,13 @@ struct HoldNoteResult
|
||||
hns = HNS_NONE;
|
||||
fLife = 1.0f;
|
||||
iLastHeldRow = 0;
|
||||
bHeld = bActive = false;
|
||||
}
|
||||
|
||||
float GetLastHeldBeat() const;
|
||||
|
||||
bool bHeld;
|
||||
bool bActive;
|
||||
};
|
||||
|
||||
|
||||
@@ -112,9 +117,10 @@ struct TapNote
|
||||
return true;
|
||||
}
|
||||
|
||||
/* This data is only used and manipulated by NoteDataWithScoring. It's only in
|
||||
* here for the sake of efficiency. */
|
||||
TapNoteResult result;
|
||||
|
||||
/* This is valid for hold_head when in 2sAnd3s. */
|
||||
HoldNoteResult HoldResult;
|
||||
};
|
||||
|
||||
extern TapNote TAP_EMPTY; // '0'
|
||||
@@ -173,7 +179,7 @@ inline float NoteRowToBeat( int row ) { return NoteRowToBeat( (float)row ); }
|
||||
|
||||
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 RangeOverlaps( int start, int end ) const
|
||||
{
|
||||
@@ -189,16 +195,12 @@ struct HoldNote
|
||||
float GetStartBeat() const { return NoteRowToBeat( iStartRow ); }
|
||||
float GetEndBeat() const { return NoteRowToBeat( iEndRow ); }
|
||||
|
||||
/* Invariant: iStartRow <= iEndRow */
|
||||
/* Invariant: iStartRow <= iEndRow. If equal, the hold note is empty. */
|
||||
int iStartRow;
|
||||
int iEndRow;
|
||||
int iTrack;
|
||||
|
||||
/* This data is only used and manipulated by NoteDataWithScoring. It's only in
|
||||
* here for the sake of efficiency. */
|
||||
HoldNoteResult result;
|
||||
bool bHeld;
|
||||
bool bActive;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user