simplify RangeOverlaps
add ContainedByRange
This commit is contained in:
@@ -568,6 +568,8 @@ void NoteField::DrawPrimitives()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool bIsActive = m_ActiveHoldNotes[hn];
|
const bool bIsActive = m_ActiveHoldNotes[hn];
|
||||||
|
const bool bIsHoldingNote = m_HeldHoldNotes[hn];
|
||||||
|
const float fLife = GetHoldNoteLife( hn );
|
||||||
if( bIsActive )
|
if( bIsActive )
|
||||||
SearchForSongBeat()->m_GhostArrowRow.SetHoldIsActive( hn.iTrack );
|
SearchForSongBeat()->m_GhostArrowRow.SetHoldIsActive( hn.iTrack );
|
||||||
|
|
||||||
@@ -576,16 +578,9 @@ void NoteField::DrawPrimitives()
|
|||||||
|
|
||||||
bool bIsInSelectionRange = false;
|
bool bIsInSelectionRange = false;
|
||||||
if( m_fBeginMarker!=-1 && m_fEndMarker!=-1 )
|
if( m_fBeginMarker!=-1 && m_fEndMarker!=-1 )
|
||||||
bIsInSelectionRange =
|
bIsInSelectionRange = hn.ContainedByRange( BeatToNoteRow( m_fBeginMarker ), BeatToNoteRow( m_fEndMarker ) );
|
||||||
m_fBeginMarker <= hn.GetStartBeat() &&
|
|
||||||
hn.GetStartBeat() <= m_fEndMarker &&
|
|
||||||
m_fBeginMarker <= hn.GetEndBeat() &&
|
|
||||||
hn.GetEndBeat() <= m_fEndMarker;
|
|
||||||
|
|
||||||
NoteDisplayCols *nd = CurDisplay->second;
|
NoteDisplayCols *nd = CurDisplay->second;
|
||||||
|
|
||||||
const bool bIsHoldingNote = m_HeldHoldNotes[hn];
|
|
||||||
const float fLife = GetHoldNoteLife( hn );
|
|
||||||
nd->display[c].DrawHold( hn, bIsHoldingNote, bIsActive, fLife, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, false, m_fYReverseOffsetPixels );
|
nd->display[c].DrawHold( hn, bIsHoldingNote, bIsActive, fLife, bIsInSelectionRange ? fSelectedRangeGlow : m_fPercentFadeToFail, false, m_fYReverseOffsetPixels );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,20 +145,22 @@ struct HoldNote
|
|||||||
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
|
||||||
{
|
{
|
||||||
return
|
/* If the range doesn't overlap us, then start and end are either both before
|
||||||
( iStartRow >= start && end >= iEndRow ) || // other consumes us
|
* us or both after us. */
|
||||||
( iStartRow <= start && end <= iEndRow ) || // other inside us
|
return !( (start < iStartRow && end < iStartRow) ||
|
||||||
( iStartRow <= start && start <= iEndRow ) || // other overlaps us
|
(start > iEndRow && end > iEndRow) );
|
||||||
( iStartRow <= end && end <= iEndRow ); // other overlaps us
|
|
||||||
}
|
}
|
||||||
bool RangeOverlaps( const HoldNote &hn ) const { return RangeOverlaps(hn.iStartRow, hn.iEndRow); }
|
bool RangeOverlaps( const HoldNote &hn ) const { return RangeOverlaps(hn.iStartRow, hn.iEndRow); }
|
||||||
bool RangeInside( int start, int end ) const { return iStartRow <= start && end <= iEndRow; }
|
bool RangeInside( int start, int end ) const { return iStartRow <= start && end <= iEndRow; }
|
||||||
|
bool ContainedByRange( int start, int end ) const { return start <= iStartRow && iEndRow <= end; }
|
||||||
|
|
||||||
float GetStartBeat() const { return NoteRowToBeat( iStartRow ); }
|
float GetStartBeat() const { return NoteRowToBeat( iStartRow ); }
|
||||||
float GetEndBeat() const { return NoteRowToBeat( iEndRow ); }
|
float GetEndBeat() const { return NoteRowToBeat( iEndRow ); }
|
||||||
int iTrack;
|
|
||||||
|
/* Invariant: iStartRow <= iEndRow */
|
||||||
int iStartRow;
|
int iStartRow;
|
||||||
int iEndRow;
|
int iEndRow;
|
||||||
|
int iTrack;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user