diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 7af2b96954..b185cd95b5 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -689,11 +689,14 @@ void Player::Update( float fDeltaTime ) if( m_pNoteField ) m_pNoteField->DidHoldNote( iTrack, HNS_Held, bBright ); // bright ghost flash } - + + tn.HoldResult.fLife = fLife; + tn.HoldResult.hns = hns; + if( hns != HNS_None ) { /* this note has been judged */ - HandleHoldScore( hns, tns ); + HandleHoldScore( tn ); if( m_pPlayerStageStats != NULL ) m_pPlayerStageStats->hnsLast = hns; @@ -702,9 +705,6 @@ void Player::Update( float fDeltaTime ) m_vHoldJudgment[iTrack]->SetHoldJudgment( hns ); } - - tn.HoldResult.fLife = fLife; - tn.HoldResult.hns = hns; } } @@ -1277,9 +1277,9 @@ void Player::HandleStep( int col, const RageTimer &tm, bool bHeld ) NSMAN->ReportTiming( fNoteOffset,pn ); if( m_pPrimaryScoreKeeper ) - m_pPrimaryScoreKeeper->HandleTapScore( score ); + m_pPrimaryScoreKeeper->HandleTapScore( tn ); if( m_pSecondaryScoreKeeper ) - m_pSecondaryScoreKeeper->HandleTapScore( score ); + m_pSecondaryScoreKeeper->HandleTapScore( tn ); switch( tn.type ) { @@ -1569,7 +1569,8 @@ void Player::RandomizeNotes( int iNoteRow ) void Player::HandleTapRowScore( unsigned row ) { - TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, row ).result.tns; + const TapNote &lastTN = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, row ); + TapNoteScore scoreOfLastTap = lastTN.result.tns; int iNumTapsInRow = m_NoteData.GetNumTracksWithTapOrHoldHead(row); ASSERT_M( iNumTapsInRow > 0, ssprintf("%d, %u",iNumTapsInRow,row) ); @@ -1619,9 +1620,9 @@ void Player::HandleTapRowScore( unsigned row ) const int iOldCombo = iCurCombo; if( m_pPrimaryScoreKeeper != NULL ) - m_pPrimaryScoreKeeper->HandleTapRowScore( scoreOfLastTap, iNumTapsInRow ); + m_pPrimaryScoreKeeper->HandleTapRowScore( lastTN, iNumTapsInRow ); if( m_pSecondaryScoreKeeper != NULL ) - m_pSecondaryScoreKeeper->HandleTapRowScore( scoreOfLastTap, iNumTapsInRow ); + m_pSecondaryScoreKeeper->HandleTapRowScore( lastTN, iNumTapsInRow ); if( m_pPlayerStageStats ) { @@ -1713,8 +1714,10 @@ void Player::HandleTapRowScore( unsigned row ) } -void Player::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ) +void Player::HandleHoldScore( const TapNote &tn ) { + HoldNoteScore holdScore = tn.HoldResult.hns; + TapNoteScore tapScore = tn.result.tns; bool NoCheating = true; #ifdef DEBUG NoCheating = false; @@ -1726,10 +1729,10 @@ void Player::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ) if( NoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY ) return; - if(m_pPrimaryScoreKeeper) - m_pPrimaryScoreKeeper->HandleHoldScore(holdScore, tapScore ); - if(m_pSecondaryScoreKeeper) - m_pSecondaryScoreKeeper->HandleHoldScore(holdScore, tapScore ); + if( m_pPrimaryScoreKeeper ) + m_pPrimaryScoreKeeper->HandleHoldScore( tn ); + if( m_pSecondaryScoreKeeper ) + m_pSecondaryScoreKeeper->HandleHoldScore( tn ); // TODO: Remove use of PlayerNumber. PlayerNumber pn = m_pPlayerState->m_PlayerNumber; diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index 3a76ca2b73..01aeeb2a9d 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -82,7 +82,7 @@ protected: void DisplayJudgedRow( int iIndexThatWasSteppedOn, TapNoteScore score, int iTrack ); void OnRowCompletelyJudged( int iStepIndex ); void HandleTapRowScore( unsigned row ); - void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ); + void HandleHoldScore( const TapNote &tn ); void DrawTapJudgments(); void DrawHoldJudgments(); diff --git a/stepmania/src/ScoreKeeper.h b/stepmania/src/ScoreKeeper.h index 79b761c8a1..d3a9799e89 100644 --- a/stepmania/src/ScoreKeeper.h +++ b/stepmania/src/ScoreKeeper.h @@ -11,15 +11,14 @@ * Results are injected directly into GameState. */ -#include "Attack.h" -#include "GameConstantsAndTypes.h" // for TapNoteScore and HoldNoteScore class NoteData; class Inventory; class Song; class Steps; class PlayerState; class PlayerStageStats; - +struct TapNote; +struct AttackArray; class ScoreKeeper { @@ -47,9 +46,9 @@ public: /* Note that pNoteData will include any transformations due to modifiers. */ virtual void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ) = 0; // before a song plays (called multiple times if course) - virtual void HandleTapScore( TapNoteScore score ) = 0; - virtual void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow ) = 0; - virtual void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ) = 0; + virtual void HandleTapScore( const TapNote &tn ) = 0; + virtual void HandleTapRowScore( const TapNote &lastTN, int iNumTapsInRow ) = 0; + virtual void HandleHoldScore( const TapNote &tn ) = 0; }; #endif diff --git a/stepmania/src/ScoreKeeperNormal.cpp b/stepmania/src/ScoreKeeperNormal.cpp index 9cdb747a3e..7e4505cf95 100644 --- a/stepmania/src/ScoreKeeperNormal.cpp +++ b/stepmania/src/ScoreKeeperNormal.cpp @@ -332,8 +332,10 @@ void ScoreKeeperNormal::AddScore( TapNoteScore score ) // LOG->Trace( "score: %i", iScore ); } -void ScoreKeeperNormal::HandleTapScore( TapNoteScore score ) +void ScoreKeeperNormal::HandleTapScore( const TapNote &tn ) { + TapNoteScore score = tn.result.tns; + if( score == TNS_HitMine ) { if( !m_pPlayerStageStats->bFailed ) @@ -346,9 +348,10 @@ void ScoreKeeperNormal::HandleTapScore( TapNoteScore score ) } } -void ScoreKeeperNormal::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow ) +void ScoreKeeperNormal::HandleTapRowScore( const TapNote &lastTN, int iNumTapsInRow ) { ASSERT( iNumTapsInRow >= 1 ); + TapNoteScore scoreOfLastTap = lastTN.result.tns; // Update dance points. if( !m_pPlayerStageStats->bFailed ) @@ -417,8 +420,10 @@ void ScoreKeeperNormal::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNum } -void ScoreKeeperNormal::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ) +void ScoreKeeperNormal::HandleHoldScore( const TapNote &tn ) { + HoldNoteScore holdScore = tn.HoldResult.hns; + // update dance points totals if( !m_pPlayerStageStats->bFailed ) m_pPlayerStageStats->iActualDancePoints += HoldNoteScoreToDancePoints( holdScore ); diff --git a/stepmania/src/ScoreKeeperNormal.h b/stepmania/src/ScoreKeeperNormal.h index ff6f2ca04a..f510ec61ed 100644 --- a/stepmania/src/ScoreKeeperNormal.h +++ b/stepmania/src/ScoreKeeperNormal.h @@ -52,9 +52,9 @@ public: // before a song plays (called multiple times if course) void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); - void HandleTapScore( TapNoteScore score ); - void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow ); - void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ); + void HandleTapScore( const TapNote &tn ); + void HandleTapRowScore( const TapNote &lastTN, int iNumTapsInRow ); + void HandleHoldScore( const TapNote &tn ); // This must be calculated using only cached radar values so that we can // do it quickly. diff --git a/stepmania/src/ScoreKeeperRave.cpp b/stepmania/src/ScoreKeeperRave.cpp index 494790ba6f..5d1c62ae89 100644 --- a/stepmania/src/ScoreKeeperRave.cpp +++ b/stepmania/src/ScoreKeeperRave.cpp @@ -8,7 +8,7 @@ #include "PrefsManager.h" #include "ThemeMetric.h" #include "PlayerState.h" - +#include "NoteTypes.h" ThemeMetric ATTACK_DURATION_SECONDS ("ScoreKeeperRave","AttackDurationSeconds"); @@ -23,8 +23,9 @@ void ScoreKeeperRave::OnNextSong( int iSongInCourseIndex, const Steps* pSteps, c } -void ScoreKeeperRave::HandleTapScore( TapNoteScore score ) +void ScoreKeeperRave::HandleTapScore( const TapNote &tn ) { + TapNoteScore score = tn.result.tns; float fPercentToMove = 0; switch( score ) { @@ -36,12 +37,13 @@ void ScoreKeeperRave::HandleTapScore( TapNoteScore score ) #define CROSSED( val ) (fOld < val && fNew >= val) #define CROSSED_ATTACK_LEVEL( level ) CROSSED(1.f/NUM_ATTACK_LEVELS*(level+1)) -void ScoreKeeperRave::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow ) +void ScoreKeeperRave::HandleTapRowScore( const TapNote &lastTN, int iNumTapsInRow ) { + TapNoteScore scoreOfLastTap = lastTN.result.tns; float fPercentToMove; switch( scoreOfLastTap ) { - default: ASSERT(0); + DEFAULT_FAIL( scoreOfLastTap ); case TNS_W1: fPercentToMove = PREFSMAN->m_fSuperMeterPercentChange[SE_W1]; break; case TNS_W2: fPercentToMove = PREFSMAN->m_fSuperMeterPercentChange[SE_W2]; break; case TNS_W3: fPercentToMove = PREFSMAN->m_fSuperMeterPercentChange[SE_W3]; break; @@ -52,8 +54,9 @@ void ScoreKeeperRave::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa AddSuperMeterDelta( fPercentToMove ); } -void ScoreKeeperRave::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ) +void ScoreKeeperRave::HandleHoldScore( const TapNote &tn ) { + TapNoteScore tapScore = tn.result.tns; float fPercentToMove = 0; switch( tapScore ) { diff --git a/stepmania/src/ScoreKeeperRave.h b/stepmania/src/ScoreKeeperRave.h index 6f85b9e7b8..93b484d3c0 100644 --- a/stepmania/src/ScoreKeeperRave.h +++ b/stepmania/src/ScoreKeeperRave.h @@ -13,9 +13,9 @@ public: ScoreKeeperRave( PlayerState* pPlayerState, PlayerStageStats* pPlayerStageStats ); virtual ~ScoreKeeperRave() { } void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); // before a song plays (called multiple times if course) - void HandleTapScore( TapNoteScore score ); - void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow ); - void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ); + void HandleTapScore( const TapNote &tn ); + void HandleTapRowScore( const TapNote &lastTN, int iNumTapsInRow ); + void HandleHoldScore( const TapNote &tn ); protected: void LaunchAttack( AttackLevel al );