From b447ccb01d584f28c62a6c16cd574a5fa9fbf03e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 21 Jul 2003 19:07:10 +0000 Subject: [PATCH] Fix scoring when using transforms. --- stepmania/src/ScoreKeeper.h | 3 ++- stepmania/src/ScoreKeeperMAX2.cpp | 6 ++---- stepmania/src/ScoreKeeperMAX2.h | 3 ++- stepmania/src/ScoreKeeperRave.cpp | 2 +- stepmania/src/ScoreKeeperRave.h | 2 +- stepmania/src/ScreenGameplay.cpp | 12 ++++++++---- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/stepmania/src/ScoreKeeper.h b/stepmania/src/ScoreKeeper.h index 6343097426..dc8ac465ca 100644 --- a/stepmania/src/ScoreKeeper.h +++ b/stepmania/src/ScoreKeeper.h @@ -42,7 +42,8 @@ public: virtual void DrawPrimitives() { } virtual void Update( float fDelta ) { } - virtual void OnNextSong( int iSongInCourseIndex, Notes* pNotes ) = 0; // before a song plays (called multiple times if course) + /* Note that pNoteData will include any transformations due to modifiers. */ + virtual void OnNextSong( int iSongInCourseIndex, Notes* pNotes, NoteData* pNoteData ) = 0; // before a song plays (called multiple times if course) virtual void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow ) = 0; virtual void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ) = 0; diff --git a/stepmania/src/ScoreKeeperMAX2.cpp b/stepmania/src/ScoreKeeperMAX2.cpp index 828d8096c4..2e36d43581 100644 --- a/stepmania/src/ScoreKeeperMAX2.cpp +++ b/stepmania/src/ScoreKeeperMAX2.cpp @@ -72,7 +72,7 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector& apNotes_, PlayerNumber p m_bIsLastSongInCourse = false; } -void ScoreKeeperMAX2::OnNextSong( int iSongInCourseIndex, Notes* pNotes ) +void ScoreKeeperMAX2::OnNextSong( int iSongInCourseIndex, Notes* pNotes, NoteData* pNoteData ) { /* http://www.aaroninjapan.com/ddr2.html @@ -128,9 +128,7 @@ void ScoreKeeperMAX2::OnNextSong( int iSongInCourseIndex, Notes* pNotes ) ASSERT( m_iMaxPossiblePoints >= 0 ); m_iMaxScoreSoFar += m_iMaxPossiblePoints; - NoteData noteData; - pNotes->GetNoteData( ¬eData ); - m_iNumTapsAndHolds = noteData.GetNumRowsWithTaps() + noteData.GetNumHoldNotes(); + m_iNumTapsAndHolds = pNoteData->GetNumRowsWithTaps() + pNoteData->GetNumHoldNotes(); m_iPointBonus = m_iMaxPossiblePoints; diff --git a/stepmania/src/ScoreKeeperMAX2.h b/stepmania/src/ScoreKeeperMAX2.h index 7599e86dc9..5fe01033a1 100644 --- a/stepmania/src/ScoreKeeperMAX2.h +++ b/stepmania/src/ScoreKeeperMAX2.h @@ -35,7 +35,8 @@ class ScoreKeeperMAX2: public ScoreKeeper public: ScoreKeeperMAX2( const vector& apNotes, PlayerNumber pn); - void OnNextSong( int iSongInCourseIndex, Notes* pNotes ); // before a song plays (called multiple times if course) + // before a song plays (called multiple times if course) + void OnNextSong( int iSongInCourseIndex, Notes* pNotes, NoteData* pNoteData ); void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow ); void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ); diff --git a/stepmania/src/ScoreKeeperRave.cpp b/stepmania/src/ScoreKeeperRave.cpp index 335dc94517..56977a1700 100644 --- a/stepmania/src/ScoreKeeperRave.cpp +++ b/stepmania/src/ScoreKeeperRave.cpp @@ -29,7 +29,7 @@ ScoreKeeperRave::ScoreKeeperRave(PlayerNumber pn) : ScoreKeeper(pn) m_soundAttackEnding.Load( THEME->GetPathToS(ssprintf("ScoreKeeperRave attack end p%d",pn+1)) ); } -void ScoreKeeperRave::OnNextSong( int iSongInCourseIndex, Notes* pNotes ) +void ScoreKeeperRave::OnNextSong( int iSongInCourseIndex, Notes* pNotes, NoteData* pNoteData ) { } diff --git a/stepmania/src/ScoreKeeperRave.h b/stepmania/src/ScoreKeeperRave.h index 0e4fb5fde3..5e1a1f1e41 100644 --- a/stepmania/src/ScoreKeeperRave.h +++ b/stepmania/src/ScoreKeeperRave.h @@ -22,7 +22,7 @@ public: // Overrides ScoreKeeperRave(PlayerNumber pn); virtual void Update( float fDelta ); - virtual void OnNextSong( int iSongInCourseIndex, Notes* pNotes ); // before a song plays (called multiple times if course) + virtual void OnNextSong( int iSongInCourseIndex, Notes* pNotes, NoteData* pNoteData ); // before a song plays (called multiple times if course) virtual void HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow ); virtual void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ); virtual int TapNoteScoreToDancePoints( TapNoteScore tns ) { return 0; }; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 953cf9f5ed..fc78a0abde 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -688,9 +688,6 @@ void ScreenGameplay::LoadNextSong() continue; GAMESTATE->m_pCurNotes[p] = m_apNotesQueue[p][iPlaySongIndex]; - m_pPrimaryScoreKeeper[p]->OnNextSong( GAMESTATE->GetCourseSongIndex(), GAMESTATE->m_pCurNotes[p] ); - if( m_pSecondaryScoreKeeper[p] ) - m_pSecondaryScoreKeeper[p]->OnNextSong( GAMESTATE->GetCourseSongIndex(), GAMESTATE->m_pCurNotes[p] ); // Put courses options into effect. GAMESTATE->ApplyModifiers( (PlayerNumber)p, m_asModifiersQueue[p][iPlaySongIndex] ); @@ -714,8 +711,15 @@ void ScreenGameplay::LoadNextSong() const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef(); NoteData pNewNoteData; pStyleDef->GetTransformedNoteDataForStyle( (PlayerNumber)p, &pOriginalNoteData, &pNewNoteData ); - m_Player[p].Load( (PlayerNumber)p, &pNewNoteData, m_pLifeMeter[p], m_pCombinedLifeMeter, m_pScoreDisplay[p], m_pInventory[p], m_pPrimaryScoreKeeper[p], m_pSecondaryScoreKeeper[p] ); + + /* The actual note data for scoring is the base class of Player. This includes + * transforms, like Wide. Otherwise, the scoring will operate on the worng + * data. */ + m_pPrimaryScoreKeeper[p]->OnNextSong( GAMESTATE->GetCourseSongIndex(), GAMESTATE->m_pCurNotes[p], &m_Player[p] ); + if( m_pSecondaryScoreKeeper[p] ) + m_pSecondaryScoreKeeper[p]->OnNextSong( GAMESTATE->GetCourseSongIndex(), GAMESTATE->m_pCurNotes[p], &m_Player[p] ); + if( m_bDemonstration ) { GAMESTATE->m_PlayerController[p] = PC_CPU;