From b0df65805e4223779370c8ea83d77b093da9262a Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 18 Jan 2005 08:20:14 +0000 Subject: [PATCH] Update iLastHeldRow even when out of range, to be sure it's clamped properly. Fixed hold counting glitches. --- stepmania/src/Player.cpp | 45 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index a9d7de7e10..fae6e73c71 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -367,15 +367,31 @@ void Player::Update( float fDeltaTime ) float fLife = m_NoteData.GetHoldNoteLife(hn); + bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI ); + // TODO: Make the CPU miss sometimes. + if( m_pPlayerState->m_PlayerController != PC_HUMAN ) + bIsHoldingButton = true; + + if( bSteppedOnTapNote && bIsHoldingButton ) + { + /* This hold note is not judged and we stepped on its head. Update iLastHeldRow. + * Do this even if we're a little beyond the end of the hold note, to make sure + * iLastHeldRow is clamped to iEndRow if the hold note is held all the way. */ + HoldNoteResult *hnr = NULL; + + if( m_pNoteField ) + { + hnr = m_pNoteField->CreateHoldNoteResult( hn ); + hnr->iLastHeldRow = min( iSongRow, hn.iEndRow ); + } + + hnr = m_NoteData.CreateHoldNoteResult( hn ); + hnr->iLastHeldRow = min( iSongRow, hn.iEndRow ); + } + // If the song beat is in the range of this hold: if( hn.RowIsInRange(iSongRow) ) { - bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI ); - - // TODO: Make the CPU miss sometimes. - if( m_pPlayerState->m_PlayerController != PC_HUMAN ) - bIsHoldingButton = true; - // set hold flag so NoteField can do intelligent drawing if( m_pNoteField ) { @@ -383,23 +399,6 @@ void Player::Update( float fDeltaTime ) m_pNoteField->m_ActiveHoldNotes[hn] = bSteppedOnTapNote; } - if( bSteppedOnTapNote ) - { - /* This hold note is not judged and we stepped on its head. Update - * iLastHeldRow. */ - HoldNoteResult *hnr = NULL; - - if( m_pNoteField ) - { - hnr = m_pNoteField->CreateHoldNoteResult( hn ); - hnr->iLastHeldRow = min( iSongRow, hn.iEndRow ); - } - - hnr = m_NoteData.CreateHoldNoteResult( hn ); - hnr->iLastHeldRow = min( iSongRow, hn.iEndRow ); - } - - if( bSteppedOnTapNote && bIsHoldingButton ) { // Increase life