diff --git a/src/NoteDataWithScoring.cpp b/src/NoteDataWithScoring.cpp index dd103dd45a..de30070c59 100644 --- a/src/NoteDataWithScoring.cpp +++ b/src/NoteDataWithScoring.cpp @@ -33,7 +33,7 @@ int GetNumNWithScore( const NoteData &in, TapNoteScore tns, int MinTaps, int iSt FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( in, r, iStartRow, iEndRow ) { int iNumNotesInRow = in.GetNumTracksWithTapOrHoldHead( r ); - TapNoteScore tnsRow = NoteDataWithScoring::LastTapNoteWithResult( in, r, PLAYER_INVALID ).result.tns; + TapNoteScore tnsRow = NoteDataWithScoring::LastTapNoteWithResult( in, r ).result.tns; if( iNumNotesInRow >= MinTaps && tnsRow >= tns ) iNumSuccessfulDoubles++; @@ -200,7 +200,7 @@ int MinTapNoteScoreTrack( const NoteData &in, unsigned iRow, PlayerNumber pn ) } -const TapNote &NoteDataWithScoring::LastTapNoteWithResult( const NoteData &in, unsigned iRow, PlayerNumber pn ) +const TapNote &NoteDataWithScoring::LastTapNoteWithResult( const NoteData &in, unsigned iRow ) { // Allow this to be configurable between LastTapNoteScoreTrack and // MinTapNoteScore; this change inspired by PumpMania (Zmey, et al) -aj @@ -219,7 +219,7 @@ const TapNote &NoteDataWithScoring::LastTapNoteWithResult( const NoteData &in, u break; } */ - int iTrack = LastTapNoteScoreTrack( in, iRow, pn ); + int iTrack = LastTapNoteScoreTrack( in, iRow, PLAYER_INVALID ); if( iTrack == -1 ) return TAP_EMPTY; @@ -230,7 +230,7 @@ const TapNote &NoteDataWithScoring::LastTapNoteWithResult( const NoteData &in, u /* Return the minimum tap score of a row. If the row isn't complete (not all * taps have been hit), return TNS_None or TNS_Miss. */ -TapNoteScore NoteDataWithScoring::MinTapNoteScore( const NoteData &in, unsigned row, PlayerNumber pn ) +TapNoteScore NoteDataWithScoring::MinTapNoteScore( const NoteData &in, unsigned row ) { //LOG->Trace("Hey I'm NoteDataWithScoring::MinTapNoteScore"); TapNoteScore score = TNS_W1; @@ -240,8 +240,6 @@ TapNoteScore NoteDataWithScoring::MinTapNoteScore( const NoteData &in, unsigned const TapNote &tn = in.GetTapNote( t, row ); if( tn.type == TapNote::empty || tn.type == TapNote::mine || tn.type == TapNote::fake ) continue; - if( tn.pn != PLAYER_INVALID && tn.pn != pn ) - continue; score = min( score, tn.result.tns ); } @@ -249,9 +247,9 @@ TapNoteScore NoteDataWithScoring::MinTapNoteScore( const NoteData &in, unsigned return score; } -bool NoteDataWithScoring::IsRowCompletelyJudged( const NoteData &in, unsigned row, PlayerNumber pn ) +bool NoteDataWithScoring::IsRowCompletelyJudged( const NoteData &in, unsigned row ) { - return MinTapNoteScore( in, row, pn ) >= TNS_Miss; + return MinTapNoteScore( in, row ) >= TNS_Miss; } namespace diff --git a/src/NoteDataWithScoring.h b/src/NoteDataWithScoring.h index 731138118a..e4a8d50cc2 100644 --- a/src/NoteDataWithScoring.h +++ b/src/NoteDataWithScoring.h @@ -14,9 +14,9 @@ struct TapNote; namespace NoteDataWithScoring { - bool IsRowCompletelyJudged( const NoteData &in, unsigned iRow, PlayerNumber pn ); - TapNoteScore MinTapNoteScore( const NoteData &in, unsigned iRow, PlayerNumber pn ); - const TapNote &LastTapNoteWithResult( const NoteData &in, unsigned iRow, PlayerNumber pn ); + bool IsRowCompletelyJudged( const NoteData &in, unsigned iRow ); + TapNoteScore MinTapNoteScore( const NoteData &in, unsigned iRow ); + const TapNote &LastTapNoteWithResult( const NoteData &in, unsigned iRow ); void GetActualRadarValues( const NoteData &in, const PlayerStageStats &pss, float fSongSeconds, RadarValues& out ); }; diff --git a/src/Player.cpp b/src/Player.cpp index fc0f70376a..ca548c1b76 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -235,7 +235,7 @@ void Player::Init( { // Init judgment positions - bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyle()->m_StyleType==StyleType_OnePlayerTwoSides; + bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyle()->GetUsesCenteredArrows(); Actor TempJudgment; TempJudgment.SetName( "Judgment" ); ActorUtil::LoadCommand( TempJudgment, sType, "Transform" ); @@ -514,7 +514,7 @@ void Player::Load() m_pNoteField->Load( &m_NoteData, iDrawDistanceAfterTargetsPixels, iDrawDistanceBeforeTargetsPixels ); } - bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyle()->m_StyleType==StyleType_OnePlayerTwoSides; + bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyle()->GetUsesCenteredArrows(); if( m_pAttackDisplay ) m_pAttackDisplay->SetX( ATTACK_DISPLAY_X.GetValue(pn, bPlayerUsingBothSides) - 40 ); // set this in Update //m_pAttackDisplay->SetY( bReverse ? ATTACK_DISPLAY_Y_REVERSE : ATTACK_DISPLAY_Y ); @@ -1433,7 +1433,7 @@ int Player::GetClosestNonEmptyRowDirectional( int iStartRow, int iEndRow, bool b while( !iter.IsAtEnd() ) { - if( NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iter.Row(), m_pPlayerState->m_PlayerNumber) ) + if( NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iter.Row()) ) { ++iter; continue; @@ -1447,7 +1447,7 @@ int Player::GetClosestNonEmptyRowDirectional( int iStartRow, int iEndRow, bool b while( !iter.IsAtEnd() ) { - if( NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iter.Row(), m_pPlayerState->m_PlayerNumber) ) + if( NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iter.Row()) ) { ++iter; continue; @@ -2064,7 +2064,7 @@ void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, b goto done_checking_hopo; } - // con't hopo on the same note 2x in a row + // can't hopo on the same note 2x in a row if( col == m_pPlayerState->m_iLastHopoNoteCol ) { bDidHopo = false; @@ -2077,13 +2077,13 @@ void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, b 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 - if( !NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iter.Row(), m_pPlayerState->m_PlayerNumber) ) + if( !NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iter.Row()) ) { bDidHopo = false; goto done_checking_hopo; } - const TapNoteResult &lastTNR = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, iter.Row(), m_pPlayerState->m_PlayerNumber ).result; + const TapNoteResult &lastTNR = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, iter.Row() ).result; if( lastTNR.tns <= TNS_Miss ) { bDidHopo = false; @@ -2171,8 +2171,6 @@ done_checking_hopo: } } - // TODO: Remove use of PlayerNumber - PlayerNumber pn = pTN->pn == PLAYER_INVALID ? m_pPlayerState->m_PlayerNumber : pTN->pn; m_LastTapNoteScore = score; if( GAMESTATE->GetCurrentGame()->m_bCountNotesSeparately ) { @@ -2187,9 +2185,9 @@ done_checking_hopo: HideNote( col, iRowOfOverlappingNoteOrRow ); } } - else if( NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iRowOfOverlappingNoteOrRow, pn) ) + else if( NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iRowOfOverlappingNoteOrRow) ) { - FlashGhostRow( iRowOfOverlappingNoteOrRow, pn ); + FlashGhostRow( iRowOfOverlappingNoteOrRow ); } } @@ -2336,8 +2334,6 @@ void Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds ) if( !NeedsTapJudging(tn) ) continue; - if( tn.pn != PLAYER_INVALID && tn.pn != m_pPlayerState->m_PlayerNumber ) - continue; if( tn.type == TapNote::mine ) { tn.result.tns = TNS_AvoidMine; @@ -2359,7 +2355,6 @@ void Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds ) void Player::UpdateJudgedRows() { const int iEndRow = BeatToNoteRow( GAMESTATE->m_fSongBeat ); - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; bool bAllJudged = true; const bool bSeparately = GAMESTATE->GetCurrentGame()->m_bCountNotesSeparately; @@ -2375,7 +2370,7 @@ void Player::UpdateJudgedRows() iLastSeenRow = iRow; // crossed a nonempty row - if( !NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iRow, pn) ) + if( !NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iRow) ) { bAllJudged = false; continue; @@ -2384,7 +2379,7 @@ void Player::UpdateJudgedRows() *m_pIterUnjudgedRows = iter; if( m_pJudgedRows->JudgeRow(iRow) ) continue; - const TapNoteResult &lastTNR = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, iRow, pn ).result; + const TapNoteResult &lastTNR = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, iRow ).result; if( lastTNR.tns < TNS_Miss ) continue; @@ -2394,7 +2389,6 @@ void Player::UpdateJudgedRows() { const TapNote &tn = m_NoteData.GetTapNote( iTrack, iRow ); if( tn.type == TapNote::empty || tn.type == TapNote::mine ) continue; - if( tn.pn != PLAYER_INVALID && tn.pn != pn ) continue; SetJudgment( tn.result.tns, iTrack, tn.result.fTapNoteOffset ); } } @@ -2431,7 +2425,7 @@ void Player::UpdateJudgedRows() switch( tn.result.tns ) { DEFAULT_FAIL( tn.result.tns ); - case TNS_None: + case TNS_None: bAllJudged = false; continue; case TNS_AvoidMine: @@ -2441,9 +2435,7 @@ void Player::UpdateJudgedRows() } if( m_pNoteField ) m_pNoteField->DidTapNote( iter.Track(), tn.result.tns, false ); - - if( tn.pn != PLAYER_INVALID && tn.pn != pn ) - continue; + if( tn.iKeysoundIndex >= 0 && tn.iKeysoundIndex < (int) m_vKeysounds.size() ) setSounds.insert( &m_vKeysounds[tn.iKeysoundIndex] ); else if( g_bEnableMineSoundPlayback ) @@ -2489,11 +2481,10 @@ void Player::UpdateJudgedRows() } } -void Player::FlashGhostRow( int iRow, PlayerNumber pn ) +void Player::FlashGhostRow( int iRow ) { TapNoteScore lastTNS = NoteDataWithScoring::LastTapNoteWithResult( m_NoteData, iRow, pn ).result.tns; const bool bBlind = (m_pPlayerState->m_PlayerOptions.GetCurrent().m_fBlind != 0); - // XXX This is the wrong combo for shared players. STATSMAN->m_CurStageStats.m_Player[pn] might work but could be wrong. const bool bBright = ( m_pPlayerStageStats && m_pPlayerStageStats->m_iCurCombo > int(BRIGHT_GHOST_COMBO_THRESHOLD) ) || bBlind; for( int iTrack = 0; iTrack < m_NoteData.GetNumTracks(); ++iTrack ) @@ -2502,8 +2493,6 @@ void Player::FlashGhostRow( int iRow, PlayerNumber pn ) if( tn.type == TapNote::empty || tn.type == TapNote::mine || tn.type == TapNote::fake ) continue; - if( tn.pn != PLAYER_INVALID && tn.pn != pn ) - continue; if( m_pNoteField ) m_pNoteField->DidTapNote( iTrack, lastTNS, bBright ); if( lastTNS >= TNS_W3 || bBlind ) @@ -2743,8 +2732,7 @@ void Player::HandleTapRowScore( unsigned row ) if( bNoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY ) return; - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult(m_NoteData, row, pn).result.tns; + TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult(m_NoteData, row).result.tns; const int iOldCombo = m_pPlayerStageStats ? m_pPlayerStageStats->m_iCurCombo : 0; const int iOldMissCombo = m_pPlayerStageStats ? m_pPlayerStageStats->m_iCurMissCombo : 0; diff --git a/src/Player.h b/src/Player.h index e0875bd712..365ef8aa37 100644 --- a/src/Player.h +++ b/src/Player.h @@ -112,7 +112,7 @@ public: protected: void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ); void UpdateJudgedRows(); - void FlashGhostRow( int iRow, PlayerNumber pn ); + void FlashGhostRow( int iRow ); void HandleTapRowScore( unsigned row ); void HandleHoldScore( const TapNote &tn ); void HandleHoldCheckpoint( int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow, const vector &viColsWithHold ); diff --git a/src/ScoreKeeper.cpp b/src/ScoreKeeper.cpp index d07bed4778..14cd8779ee 100644 --- a/src/ScoreKeeper.cpp +++ b/src/ScoreKeeper.cpp @@ -15,18 +15,16 @@ void ScoreKeeper::GetScoreOfLastTapInRow( const NoteData &nd, int iRow, { PlayerNumber pn = m_pPlayerState->m_PlayerNumber; int iNum = 0; - + for( int track = 0; track < nd.GetNumTracks(); ++track ) { const TapNote &tn = nd.GetTapNote( track, iRow ); - - if( tn.pn != PLAYER_INVALID && tn.pn != pn ) - continue; + if( tn.type != TapNote::tap && tn.type != TapNote::hold_head ) continue; ++iNum; } - tnsOut = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow, pn ).result.tns; + tnsOut = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow ).result.tns; iNumTapsInRowOut = iNum; } diff --git a/src/ScoreKeeper.h b/src/ScoreKeeper.h index dababe4433..c3fca1d813 100644 --- a/src/ScoreKeeper.h +++ b/src/ScoreKeeper.h @@ -49,15 +49,15 @@ public: virtual void Update( float fDelta ) { } /* 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 OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ) { }; // 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; - virtual void HandleHoldActiveSeconds( float fMusicSecondsHeld ) = 0; + virtual void HandleTapScore( const TapNote &tn ) { } + virtual void HandleTapRowScore( const NoteData &nd, int iRow ) { } + virtual void HandleHoldScore( const TapNote &tn ) { } + virtual void HandleHoldActiveSeconds( float fMusicSecondsHeld ) { } virtual void HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow ) { } - virtual void HandleTapScoreNone() = 0; + virtual void HandleTapScoreNone() { } protected: void GetScoreOfLastTapInRow( const NoteData &nd, int iRow, TapNoteScore &tnsOut, int &iNumTapsInRowOut ); diff --git a/src/ScoreKeeperNormal.cpp b/src/ScoreKeeperNormal.cpp index 31d45426a9..9609621412 100644 --- a/src/ScoreKeeperNormal.cpp +++ b/src/ScoreKeeperNormal.cpp @@ -619,14 +619,11 @@ void ScoreKeeperNormal::GetRowCounts( const NoteData &nd, int iRow, int &iNumHitContinueCombo, int &iNumHitMaintainCombo, int &iNumBreakCombo ) { - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; iNumHitContinueCombo = iNumHitMaintainCombo = iNumBreakCombo = 0; for( int track = 0; track < nd.GetNumTracks(); ++track ) { const TapNote &tn = nd.GetTapNote( track, iRow ); - if( tn.pn != PLAYER_INVALID && tn.pn != pn ) - continue; if( tn.type != TapNote::tap && tn.type != TapNote::hold_head && tn.type != TapNote::lift ) continue; TapNoteScore tns = tn.result.tns; @@ -650,7 +647,7 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow ) m_iNumNotesHitThisRow = iNumTapsInRow; - TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow, m_pPlayerState->m_PlayerNumber ).result.tns; + TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow ).result.tns; HandleTapNoteScoreInternal( scoreOfLastTap, TNS_W1 ); HandleComboInternal( iNumHitContinueCombo, iNumHitMaintainCombo, iNumBreakCombo ); @@ -672,9 +669,7 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow ) } #endif //DEBUG - // // Toasty combo - // switch( scoreOfLastTap ) { case TNS_W1: @@ -698,7 +693,7 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow ) // TODO: Remove indexing with PlayerNumber PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - float offset = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow, pn ).result.fTapNoteOffset; + float offset = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow ).result.fTapNoteOffset; NSMAN->ReportScore( pn, scoreOfLastTap, m_pPlayerStageStats->m_iScore, m_pPlayerStageStats->m_iCurCombo, offset ); diff --git a/src/ScoreKeeperNormal.h b/src/ScoreKeeperNormal.h index 3dd9913123..24cf8b6904 100644 --- a/src/ScoreKeeperNormal.h +++ b/src/ScoreKeeperNormal.h @@ -65,7 +65,6 @@ class ScoreKeeperNormal: public ScoreKeeper virtual void AddTapScore( TapNoteScore tns ); virtual void AddHoldScore( HoldNoteScore hns ); virtual void AddTapRowScore( TapNoteScore tns, const NoteData &nd, int iRow ); - virtual void HandleTapScoreNone(); /* Configuration: */ /* Score after each tap will be rounded to the nearest m_iRoundTo; 1 to do nothing. */ @@ -88,6 +87,7 @@ public: void HandleHoldScore( const TapNote &tn ); void HandleHoldActiveSeconds( float fMusicSecondsHeld ) {}; void HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow ); + void HandleTapScoreNone(); // This must be calculated using only cached radar values so that we can // do it quickly. diff --git a/src/ScoreKeeperShared.cpp b/src/ScoreKeeperShared.cpp index 3851ab3b51..2830b43d8f 100644 --- a/src/ScoreKeeperShared.cpp +++ b/src/ScoreKeeperShared.cpp @@ -1,29 +1,92 @@ #include "global.h" #include "ScoreKeeperShared.h" +#include "RageLog.h" #include "GameState.h" -#include "StatsManager.h" -#include "NoteDataUtil.h" -#include "NoteData.h" #include "PlayerState.h" +/* In Routine, we have two Players, but the master one handles all of the scoring. The other + * one will just receive misses for everything, and shouldn't do anything. */ ScoreKeeperShared::ScoreKeeperShared( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ) : ScoreKeeperNormal( pPlayerState, pPlayerStageStats ) { } -void ScoreKeeperShared::OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ) +void ScoreKeeperShared::Load( + const vector &apSongs, + const vector &apSteps, + const vector &asModifiers ) { - vector vParts; - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - - NoteDataUtil::SplitCompositeNoteData( *pNoteData, vParts ); - ScoreKeeperNormal::OnNextSong( iSongInCourseIndex, pSteps, &vParts[pn] ); + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + return; + ScoreKeeperNormal::Load( apSongs, apSteps, asModifiers ); } -#undef CALL +// These ScoreKeepers don't get to draw. +void ScoreKeeperShared::DrawPrimitives() +{ + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + return; + ScoreKeeperNormal::DrawPrimitives(); +} + +void ScoreKeeperShared::Update( float fDelta ) +{ + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + return; + ScoreKeeperNormal::Update( fDelta ); +} + +void ScoreKeeperShared::OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ) +{ + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + return; + ScoreKeeperNormal::OnNextSong( iSongInCourseIndex, pSteps, pNoteData ); +} + +void ScoreKeeperShared::HandleTapScore( const TapNote &tn ) +{ + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + return; + ScoreKeeperNormal::HandleTapScore( tn ); +} + +void ScoreKeeperShared::HandleTapRowScore( const NoteData &nd, int iRow ) +{ + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + return; + ScoreKeeperNormal::HandleTapRowScore( nd, iRow ); +} + +void ScoreKeeperShared::HandleHoldScore( const TapNote &tn ) +{ + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + return; + ScoreKeeperNormal::HandleHoldScore( tn ); +} + +void ScoreKeeperShared::HandleHoldActiveSeconds( float fMusicSecondsHeld ) +{ + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + return; + ScoreKeeperNormal::HandleHoldActiveSeconds( fMusicSecondsHeld ); +} + +void ScoreKeeperShared::HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow ) +{ + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + return; + ScoreKeeperNormal::HandleHoldCheckpointScore( nd, iRow, iNumHoldsHeldThisRow, iNumHoldsMissedThisRow ); +} + +void ScoreKeeperShared::HandleTapScoreNone() +{ + if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) + return; + ScoreKeeperNormal::HandleTapScoreNone(); +} /* - * (c) 2006 Steve Checkoway + * (c) 2006-2010 Steve Checkoway, Glenn Maynard * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a diff --git a/src/ScoreKeeperShared.h b/src/ScoreKeeperShared.h index 2dadccab0b..f34fb19874 100644 --- a/src/ScoreKeeperShared.h +++ b/src/ScoreKeeperShared.h @@ -9,7 +9,21 @@ class ScoreKeeperShared : public ScoreKeeperNormal public: ScoreKeeperShared( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ); - void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); + virtual void Load( + const vector &apSongs, + const vector &apSteps, + const vector &asModifiers ); + + virtual void DrawPrimitives(); + virtual void Update( float fDelta ); + + virtual void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); + virtual void HandleTapScore( const TapNote &tn ); + virtual void HandleTapRowScore( const NoteData &nd, int iRow ); + virtual void HandleHoldScore( const TapNote &tn ); + virtual void HandleHoldActiveSeconds( float fMusicSecondsHeld ); + virtual void HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow ); + virtual void HandleTapScoreNone(); }; #endif diff --git a/src/ScreenGameplayShared.cpp b/src/ScreenGameplayShared.cpp index 403c9acf98..9426beaf5a 100644 --- a/src/ScreenGameplayShared.cpp +++ b/src/ScreenGameplayShared.cpp @@ -4,24 +4,21 @@ #include "Player.h" #include "NoteDataUtil.h" #include "NoteDataWithScoring.h" -#include "ActiveAttackList.h" -#include "ScoreDisplayNormal.h" -#include "ScoreKeeperShared.h" #include "Song.h" +#include "StatsManager.h" REGISTER_SCREEN_CLASS( ScreenGameplayShared ); void ScreenGameplayShared::FillPlayerInfo( vector &vPlayerInfoOut ) { - PlayerNumber mpn = GAMESTATE->m_MasterPlayerNumber; - vPlayerInfoOut.resize( NUM_PLAYERS ); - PlayerInfo &mpi = vPlayerInfoOut[mpn]; - FOREACH_PlayerNumber( pn ) - { - PlayerInfo &pi = vPlayerInfoOut[pn]; - pi.Load( pn, MultiPlayer_Invalid, pn == mpn, Difficulty_Invalid ); - pi.m_pPlayer = new Player( mpi.m_NoteData, pn == mpn ); - } + const PlayerNumber master = GAMESTATE->m_MasterPlayerNumber; + const PlayerNumber other = (master == PLAYER_1? PLAYER_2:PLAYER_1); + + /* The master player is where all of the real work takes place. The other player exists + * only so we have a place to split stats out into at the end. */ + vPlayerInfoOut.resize( 2 ); + vPlayerInfoOut[0].Load( master, MultiPlayer_Invalid, true, Difficulty_Invalid ); + vPlayerInfoOut[1].Load( other, MultiPlayer_Invalid, false, Difficulty_Invalid ); } PlayerInfo &ScreenGameplayShared::GetPlayerInfoForInput( const InputEventPlus& iep ) @@ -29,32 +26,6 @@ PlayerInfo &ScreenGameplayShared::GetPlayerInfoForInput( const InputEventPlus& i return m_vPlayerInfo[GAMESTATE->m_MasterPlayerNumber]; } -void ScreenGameplayShared::SaveStats() -{ - vector vParts; - PlayerNumber mpn = GAMESTATE->m_MasterPlayerNumber; - float fMusicLen = GAMESTATE->m_pCurSong->m_fMusicLengthSeconds; - - NoteDataUtil::SplitCompositeNoteData( m_vPlayerInfo[mpn].m_pPlayer->GetNoteData(), vParts ); - for( size_t i = 0; i < min(vParts.size(), m_vPlayerInfo.size()); ++i ) - { - PlayerInfo &pi = m_vPlayerInfo[i]; - - if( !pi.IsEnabled() ) - continue; - NoteData &nd = vParts[i]; - RadarValues rv; - PlayerStageStats &pss = *pi.GetPlayerStageStats(); - - NoteDataUtil::CalculateRadarValues( nd, fMusicLen, rv ); - pss.m_radarPossible += rv; - - NoteDataWithScoring::GetActualRadarValues( nd, pss, fMusicLen, rv ); - pss.m_radarActual += rv; - } -} - - /* * (c) 2006 Steve Checkoway * All rights reserved. diff --git a/src/ScreenGameplayShared.h b/src/ScreenGameplayShared.h index 69a5fa0d28..792bafc67a 100644 --- a/src/ScreenGameplayShared.h +++ b/src/ScreenGameplayShared.h @@ -8,7 +8,6 @@ class ScreenGameplayShared : public ScreenGameplay protected: virtual void FillPlayerInfo( vector &vPlayerInfoOut ); virtual PlayerInfo &GetPlayerInfoForInput( const InputEventPlus& iep ); - virtual void SaveStats(); }; #endif