From 3022def914e79be9882b11ae595f5eacc7a90fc9 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 1 Dec 2006 05:37:33 +0000 Subject: [PATCH] don't allow Hopo on the same note 2x in series --- stepmania/src/GameState.cpp | 2 +- stepmania/src/Player.cpp | 22 +++++++++++++++++++--- stepmania/src/PlayerState.cpp | 1 + stepmania/src/PlayerState.h | 10 ++++++++-- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index d6ebf2a264..b6122dd4df 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -666,7 +666,7 @@ void GameState::ResetMusicStatistics() FOREACH_PlayerNumber( p ) - m_pPlayerState[p]->m_fLastHopoNoteMusicSeconds = -1; + m_pPlayerState[p]->ClearHopoState(); } void GameState::ResetStageStatistics() diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 4fa654d2c0..8ae33e16c7 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -1460,7 +1460,20 @@ void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, b } else { + int iLastNoteCol = -1; + for( int i=GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer-1; i>=0; i-- ) + { + const TapNote &tn = m_NoteData.GetTapNote( i, iRowOfOverlappingNoteOrRow ); + bool bIsNote = (tn.type != TapNote::empty); + if( bIsNote ) + { + iLastNoteCol = i; + break; + } + } + m_pPlayerState->m_fLastHopoNoteMusicSeconds = fStepSeconds; + m_pPlayerState->m_iLastHopoNoteCol = iLastNoteCol; } } break; @@ -1476,13 +1489,16 @@ void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, b goto done_checking_hopo; } - const TapNote &tn = m_NoteData.GetTapNote( col, iRowOfOverlappingNoteOrRow ); - if( tn.type == TapNote::empty ) + // con't hopo on the same note 2x in a row + if( col == m_pPlayerState->m_iLastHopoNoteCol ) { bDidHopo = false; goto done_checking_hopo; } + const TapNote &tn = m_NoteData.GetTapNote( col, iRowOfOverlappingNoteOrRow ); + ASSERT( tn.type != TapNote::empty ); + int iRowsAgoLastNote = 100000; // TODO: find more reasonable value based on HOPO_CHAIN_SECONDS? NoteData::all_tracks_reverse_iterator iter = m_NoteData.GetTapNoteRangeAllTracksReverse( iRowsAgoLastNote-iRowsAgoLastNote, iRowOfOverlappingNoteOrRow-1 ); ASSERT( !iter.IsAtEnd() ); // there must have been a note that started the hopo @@ -1603,7 +1619,7 @@ done_checking_hopo: // check for hopo end if( score <= TNS_Miss ) { - m_pPlayerState->m_fLastHopoNoteMusicSeconds = -1; + m_pPlayerState->ClearHopoState(); } diff --git a/stepmania/src/PlayerState.cpp b/stepmania/src/PlayerState.cpp index 73264d9d0e..3950d4c1a8 100644 --- a/stepmania/src/PlayerState.cpp +++ b/stepmania/src/PlayerState.cpp @@ -20,6 +20,7 @@ void PlayerState::Reset() m_HealthState = ALIVE; m_fLastHopoNoteMusicSeconds = -1; + m_iLastHopoNoteCol = -1; m_PlayerController = PC_HUMAN; diff --git a/stepmania/src/PlayerState.h b/stepmania/src/PlayerState.h index b04458057b..74b5584781 100644 --- a/stepmania/src/PlayerState.h +++ b/stepmania/src/PlayerState.h @@ -34,8 +34,14 @@ public: enum HealthState { HOT, ALIVE, DANGER, DEAD }; HealthState m_HealthState; - // Set to the MusicSeconds of the last note successfully strummed or hammered in a hammer chain - float m_fLastHopoNoteMusicSeconds; // if -1, then there is no current hammer chain + float m_fLastHopoNoteMusicSeconds; // Set to the MusicSeconds of the last note successfully strummed or hammered in a hopochain, -1, then there is no current hopo chain + int m_iLastHopoNoteCol; // if -1, then there is no current hopo chain + + void ClearHopoState() + { + m_fLastHopoNoteMusicSeconds = -1; + m_iLastHopoNoteCol = -1; + } PlayerController m_PlayerController;