From 8db5d63e1ea9d252b877f2846c8ea7814488de84 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Mon, 17 Jul 2006 01:03:30 +0000 Subject: [PATCH] This is almost completely a ScoreKeeperNormal now. Perhaps this should be put in SKNormal and this calls can be removed. --- stepmania/src/ScoreKeeperShared.cpp | 60 +++-------------------------- stepmania/src/ScoreKeeperShared.h | 15 ++------ 2 files changed, 8 insertions(+), 67 deletions(-) diff --git a/stepmania/src/ScoreKeeperShared.cpp b/stepmania/src/ScoreKeeperShared.cpp index a013d060bd..1e489ff757 100644 --- a/stepmania/src/ScoreKeeperShared.cpp +++ b/stepmania/src/ScoreKeeperShared.cpp @@ -1,75 +1,25 @@ #include "global.h" #include "ScoreKeeperShared.h" -#include "ScoreKeeperNormal.h" #include "GameState.h" #include "StatsManager.h" #include "NoteDataUtil.h" #include "NoteData.h" +#include "PlayerState.h" -ScoreKeeperShared::ScoreKeeperShared() : ScoreKeeper( NULL, NULL ) +ScoreKeeperShared::ScoreKeeperShared( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ) : + ScoreKeeperNormal( pPlayerState, pPlayerStageStats ) { - FOREACH_PlayerNumber( pn ) - { - PlayerState *pPS = GAMESTATE->m_pPlayerState[pn]; - PlayerStageStats *pPSS = &STATSMAN->m_CurStageStats.m_player[pn]; - - m_pScoreKeepers[pn] = new ScoreKeeperNormal( pPS, pPSS ); - } -} - -ScoreKeeperShared::~ScoreKeeperShared() -{ - FOREACH_PlayerNumber( pn ) - delete m_pScoreKeepers[pn]; -} - -#define CALL( fun ) FOREACH_PlayerNumber( pn ) m_pScoreKeepers[pn]->fun -void ScoreKeeperShared::Load( const vector &apSongs, const vector &apSteps, - const vector &asModifiers ) -{ - CALL( Load(apSongs, apSteps, asModifiers) ); -} - -void ScoreKeeperShared::DrawPrimitives() -{ - CALL( DrawPrimitives() ); -} - -void ScoreKeeperShared::Update( float fDelta ) -{ - CALL( Update(fDelta) ); } void ScoreKeeperShared::OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ) { vector vParts; + PlayerNumber pn = m_pPlayerState->m_PlayerNumber; NoteDataUtil::SplitCompositeNoteData( *pNoteData, vParts ); - CALL( OnNextSong(iSongInCourseIndex, pSteps, &vParts[pn]) ); + ScoreKeeperNormal::OnNextSong( iSongInCourseIndex, pSteps, &vParts[pn] ); } -void ScoreKeeperShared::HandleTapScore( const TapNote &tn ) -{ - DEBUG_ASSERT( tn.pn != PLAYER_INVALID ); - if( tn.pn == PLAYER_INVALID ) - CALL( HandleTapScore(tn) ); - else - m_pScoreKeepers[tn.pn]->HandleTapScore( tn ); -} - -void ScoreKeeperShared::HandleTapRowScore( const NoteData &nd, int row ) -{ - CALL( HandleTapRowScore(nd, row) ); -} - -void ScoreKeeperShared::HandleHoldScore( const TapNote &tn ) -{ - DEBUG_ASSERT( tn.pn != PLAYER_INVALID ); - if( tn.pn == PLAYER_INVALID ) - CALL( HandleHoldScore(tn) ); - else - m_pScoreKeepers[tn.pn]->HandleHoldScore( tn ); -} #undef CALL /* diff --git a/stepmania/src/ScoreKeeperShared.h b/stepmania/src/ScoreKeeperShared.h index f7fdaa44a3..e2c4f5819c 100644 --- a/stepmania/src/ScoreKeeperShared.h +++ b/stepmania/src/ScoreKeeperShared.h @@ -1,24 +1,15 @@ #ifndef SCORE_KEEPER_SHARED_H #define SCORE_KEEPER_SHARED_H -#include "ScoreKeeper.h" +#include "ScoreKeeperNormal.h" #include "PlayerNumber.h" -class ScoreKeeperShared : public ScoreKeeper +class ScoreKeeperShared : public ScoreKeeperNormal { - ScoreKeeper *m_pScoreKeepers[NUM_PLAYERS]; public: - ScoreKeeperShared(); - ~ScoreKeeperShared(); + ScoreKeeperShared( PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ); - void Load( const vector &apSongs, const vector &apSteps, - const vector &asModifiers ); - void DrawPrimitives(); - void Update( float fDelta ); void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); - void HandleTapScore( const TapNote &tn ); - void HandleTapRowScore( const NoteData &nd, int row ); - void HandleHoldScore( const TapNote &tn ); }; #endif