track fOverlappedTime for hold notes

This commit is contained in:
Glenn Maynard
2007-01-15 06:35:09 +00:00
parent 6bf9354b06
commit ce407f819f
2 changed files with 12 additions and 3 deletions
+5 -1
View File
@@ -27,7 +27,7 @@ struct TapNoteResult
struct HoldNoteResult
{
HoldNoteResult() : hns(HNS_None), fLife(1.f), iLastHeldRow(0), bHeld(false), bActive(false) { }
HoldNoteResult() : hns(HNS_None), fLife(1.f), fOverlappedTime(0), iLastHeldRow(0), bHeld(false), bActive(false) { }
float GetLastHeldBeat() const;
HoldNoteScore hns;
@@ -38,6 +38,10 @@ struct HoldNoteResult
* If the life is > 0.0 when the HoldNote ends, then m_HoldScore becomes HNS_Held. */
float fLife;
/* The number of seconds the hold note has overlapped the current beat, or 0 if it
* doesn't overlap. */
float fOverlappedTime;
/* Last index where fLife was greater than 0. If the tap was missed, this will
* be the first index of the hold. */
int iLastHeldRow;
+7 -2
View File
@@ -663,11 +663,18 @@ void Player::Update( float fDeltaTime )
if( tn.type != TapNote::hold_head )
continue;
int iRow = begin->first;
int iEndRow = iRow + tn.iDuration;
// set hold flags so NoteField can do intelligent drawing
tn.HoldResult.bHeld = false;
tn.HoldResult.bActive = false;
// If the song beat is in the range of this hold:
if( iRow <= iSongRow && iRow <= iEndRow )
tn.HoldResult.fOverlappedTime += fDeltaTime;
else
tn.HoldResult.fOverlappedTime = 0;
HoldNoteScore hns = tn.HoldResult.hns;
if( hns != HNS_None ) // if this HoldNote already has a result
continue; // we don't need to update the logic for this one
@@ -693,8 +700,6 @@ void Player::Update( float fDeltaTime )
bIsHoldingButton = INPUTMAPPER->IsBeingPressed( GameI, m_pPlayerState->m_mp );
}
int iEndRow = iRow + tn.iDuration;
float fLife = tn.HoldResult.fLife;
if( bSteppedOnTapNote && fLife != 0 )
{