From e224b1787c929dfb73b9f51f80fbbbb66c3d9c43 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 16 Nov 2006 12:25:05 +0000 Subject: [PATCH] add params to AddTapRowScore for calculating score based on num taps in row fix row scored before combo and score multiplier calculated in guitar fix CurrentComboChanged not broadcasted on combo stopped --- stepmania/src/ScoreKeeper.h | 1 + stepmania/src/ScoreKeeperGuitar.cpp | 34 +++++++++++++++++------------ stepmania/src/ScoreKeeperGuitar.h | 2 +- stepmania/src/ScoreKeeperNormal.cpp | 23 +++++++++++-------- stepmania/src/ScoreKeeperNormal.h | 4 +++- 5 files changed, 39 insertions(+), 25 deletions(-) diff --git a/stepmania/src/ScoreKeeper.h b/stepmania/src/ScoreKeeper.h index c8aeffa1df..2c402d10c5 100644 --- a/stepmania/src/ScoreKeeper.h +++ b/stepmania/src/ScoreKeeper.h @@ -51,6 +51,7 @@ 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) + // HandleTap* is called before HandleTapRow* virtual void HandleTapScore( const TapNote &tn ) = 0; virtual void HandleTapRowScore( const NoteData &nd, int iRow ) = 0; virtual void HandleHoldScore( const TapNote &tn ) = 0; diff --git a/stepmania/src/ScoreKeeperGuitar.cpp b/stepmania/src/ScoreKeeperGuitar.cpp index e139e3eedc..df280f6ec2 100644 --- a/stepmania/src/ScoreKeeperGuitar.cpp +++ b/stepmania/src/ScoreKeeperGuitar.cpp @@ -10,6 +10,18 @@ ScoreKeeperGuitar::ScoreKeeperGuitar( PlayerState *pPlayerState, PlayerStageStat } void ScoreKeeperGuitar::AddTapScore( TapNoteScore tns ) +{ +} + +void ScoreKeeperGuitar::AddHoldScore( HoldNoteScore hns ) +{ + if( hns == HNS_Held ) + AddTapScore( TNS_W1 ); + else if ( hns == HNS_LetGo ) + AddTapScore( TNS_W4 ); // required for subtractive score display to work properly +} + +void ScoreKeeperGuitar::AddTapRowScore( TapNoteScore tns, const NoteData &nd, int iRow ) { // calculate score multiplier int iNewCurScoreMultiplier = m_pPlayerStageStats->m_iCurScoreMultiplier; @@ -25,24 +37,18 @@ void ScoreKeeperGuitar::AddTapScore( TapNoteScore tns ) if( tns != TNS_Miss ) { - iScore += 50 * iNewCurScoreMultiplier; + TapNoteScore scoreOfLastTap; + int iNumTapsInRow; + + GetScoreOfLastTapInRow( nd, iRow, scoreOfLastTap, iNumTapsInRow ); + + ASSERT( iNumTapsInRow > 0 ); + + iScore += 50 * iNumTapsInRow * iNewCurScoreMultiplier; MESSAGEMAN->Broadcast( Message_ScoreChangedP1 ); } } -void ScoreKeeperGuitar::AddHoldScore( HoldNoteScore hns ) -{ - if( hns == HNS_Held ) - AddTapScore( TNS_W1 ); - else if ( hns == HNS_LetGo ) - AddTapScore( TNS_W4 ); // required for subtractive score display to work properly -} - -void ScoreKeeperGuitar::AddTapRowScore( TapNoteScore score ) -{ - -} - /* * (c) 2001-2004 Chris Danford * All rights reserved. diff --git a/stepmania/src/ScoreKeeperGuitar.h b/stepmania/src/ScoreKeeperGuitar.h index b2eb53ae47..533aaf97bd 100644 --- a/stepmania/src/ScoreKeeperGuitar.h +++ b/stepmania/src/ScoreKeeperGuitar.h @@ -12,7 +12,7 @@ public: ScoreKeeperGuitar( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ); virtual void AddTapScore( TapNoteScore score ); void AddHoldScore( HoldNoteScore hns ); - virtual void AddTapRowScore( TapNoteScore score ); + virtual void AddTapRowScore( TapNoteScore score, const NoteData &nd, int iRow ); }; #endif diff --git a/stepmania/src/ScoreKeeperNormal.cpp b/stepmania/src/ScoreKeeperNormal.cpp index 7b3734c23b..80043e7769 100644 --- a/stepmania/src/ScoreKeeperNormal.cpp +++ b/stepmania/src/ScoreKeeperNormal.cpp @@ -227,12 +227,17 @@ void ScoreKeeperNormal::AddTapScore( TapNoteScore tns ) void ScoreKeeperNormal::AddHoldScore( HoldNoteScore hns ) { if( hns == HNS_Held ) - AddTapRowScore( TNS_W1 ); + AddScoreInternal( TNS_W1 ); else if ( hns == HNS_LetGo ) - AddTapRowScore( TNS_W4 ); // required for subtractive score display to work properly + AddScoreInternal( TNS_W4 ); // required for subtractive score display to work properly } -void ScoreKeeperNormal::AddTapRowScore( TapNoteScore score ) +void ScoreKeeperNormal::AddTapRowScore( TapNoteScore score, const NoteData &nd, int iRow ) +{ + AddScoreInternal( score ); +} + +void ScoreKeeperNormal::AddScoreInternal( TapNoteScore score ) { int &iScore = m_pPlayerStageStats->m_iScore; int &iCurMaxScore = m_pPlayerStageStats->m_iCurMaxScore; @@ -387,6 +392,7 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow ) // increment the current total possible dance score m_pPlayerStageStats->m_iCurPossibleDancePoints += TapNoteScoreToDancePoints( TNS_W1 ); + // // Regular combo @@ -396,11 +402,7 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow ) { m_pPlayerStageStats->m_iCurMissCombo = 0; if( scoreOfLastTap >= m_MinScoreToContinueCombo ) - { m_pPlayerStageStats->m_iCurCombo += iComboCountIfHit; - if( m_pPlayerState->m_PlayerNumber != PLAYER_INVALID ) - MESSAGEMAN->Broadcast( enum_add2(Message_CurrentComboChangedP1,m_pPlayerState->m_PlayerNumber) ); - } } else { @@ -409,7 +411,10 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow ) ++m_pPlayerStageStats->m_iCurMissCombo; } - AddTapRowScore( scoreOfLastTap ); // only score once per row + if( m_pPlayerState->m_PlayerNumber != PLAYER_INVALID ) + MESSAGEMAN->Broadcast( enum_add2(Message_CurrentComboChangedP1,m_pPlayerState->m_PlayerNumber) ); + + AddTapRowScore( scoreOfLastTap, nd, iRow ); // only score once per row // // handle combo logic @@ -446,7 +451,7 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow ) break; } - + // TODO: Remove indexing with PlayerNumber PlayerNumber pn = m_pPlayerState->m_PlayerNumber; float offset = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow, pn ).result.fTapNoteOffset; diff --git a/stepmania/src/ScoreKeeperNormal.h b/stepmania/src/ScoreKeeperNormal.h index 9e792caef3..e486f8bcd3 100644 --- a/stepmania/src/ScoreKeeperNormal.h +++ b/stepmania/src/ScoreKeeperNormal.h @@ -15,6 +15,8 @@ AutoScreenMessage( SM_PlayToasty ); class ScoreKeeperNormal: public ScoreKeeper { + void AddScoreInternal( TapNoteScore score ); + int m_iScoreRemainder; int m_iMaxPossiblePoints; int m_iTapNotesHit; // number of notes judged so far, needed by scoring @@ -34,7 +36,7 @@ class ScoreKeeperNormal: public ScoreKeeper virtual void AddTapScore( TapNoteScore tns ); virtual void AddHoldScore( HoldNoteScore hns ); - virtual void AddTapRowScore( TapNoteScore tns ); + virtual void AddTapRowScore( TapNoteScore tns, const NoteData &nd, int iRow ); /* Configuration: */ /* Score after each tap will be rounded to the nearest m_iRoundTo; 1 to do nothing. */