From a1340dd1c09f4f89273da8c6ddd113c77bc027a8 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Wed, 22 Dec 2004 07:31:27 +0000 Subject: [PATCH] have gameplay objects access PlayerStageStats though a member pointer and not directly access g_CurStageStats. --- stepmania/src/Player.cpp | 85 ++++++++++++++++++++----------- stepmania/src/Player.h | 10 ++-- stepmania/src/ScoreKeeper.h | 4 +- stepmania/src/ScoreKeeperMAX2.cpp | 64 ++++++++++------------- stepmania/src/ScoreKeeperMAX2.h | 27 ++++++---- stepmania/src/ScoreKeeperRave.cpp | 3 +- stepmania/src/ScoreKeeperRave.h | 2 +- stepmania/src/ScreenEdit.cpp | 14 ++++- stepmania/src/ScreenGameplay.cpp | 14 +++-- stepmania/src/ScreenHowToPlay.cpp | 12 ++++- 10 files changed, 141 insertions(+), 94 deletions(-) diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index b61154a035..7694ae44a7 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -61,6 +61,7 @@ static const float StepSearchDistance = 1.0f; PlayerMinus::PlayerMinus() { m_pPlayerState = NULL; + m_pPlayerStageStats = NULL; m_fNoteFieldHeight = 0; m_pLifeMeter = NULL; @@ -92,6 +93,7 @@ PlayerMinus::~PlayerMinus() void PlayerMinus::Load( PlayerState* pPlayerState, const NoteData& noteData, + PlayerStageStats* pPlayerStageStats, LifeMeter* pLM, CombinedLifeMeter* pCombinedLM, ScoreDisplay* pScoreDisplay, @@ -104,6 +106,7 @@ void PlayerMinus::Load( m_iDCState = AS2D_IDLE; m_pPlayerState = pPlayerState; + m_pPlayerStageStats = pPlayerStageStats; m_pLifeMeter = pLM; m_pCombinedLifeMeter = pCombinedLM; m_pScoreDisplay = pScoreDisplay; @@ -127,7 +130,8 @@ void PlayerMinus::Load( // init steps m_NoteData.Init(); - bool bOniDead = GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && g_CurStageStats.m_player[pn].bFailed; + bool bOniDead = GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && + (m_pPlayerStageStats == NULL || m_pPlayerStageStats->bFailed); if( !bOniDead ) m_NoteData.CopyAll( noteData ); @@ -137,7 +141,8 @@ void PlayerMinus::Load( m_Judgment.StopTweening(); // m_Combo.Reset(); // don't reset combos between songs in a course! m_Combo.Init( pn ); - m_Combo.SetCombo( g_CurStageStats.m_player[pn].iCurCombo, g_CurStageStats.m_player[pn].iCurMissCombo ); // combo can persist between songs and games + if( m_pPlayerStageStats ) + m_Combo.SetCombo( m_pPlayerStageStats->iCurCombo, m_pPlayerStageStats->iCurMissCombo ); // combo can persist between songs and games m_AttackDisplay.Init( m_pPlayerState ); m_Judgment.Reset(); @@ -452,10 +457,8 @@ void PlayerMinus::Update( float fDeltaTime ) int ms_error = (hns == HNS_OK)? 0:MAX_PRO_TIMING_ERROR; - // TODO: Remove use of PlayerNumber. - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - - g_CurStageStats.m_player[pn].iTotalError += ms_error; + if( m_pPlayerStageStats ) + m_pPlayerStageStats->iTotalError += ms_error; if( hns == HNS_NG ) /* don't show a 0 for an OK */ m_ProTimingDisplay.SetJudgment( ms_error, TNS_MISS ); } @@ -697,15 +700,17 @@ int PlayerMinus::GetClosestNote( int col, float fBeat, float fMaxBeatsAhead, flo void PlayerMinus::Step( int col, RageTimer tm ) { - // TODO: Remove use of PlayerNumber. - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - - if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && g_CurStageStats.m_player[pn].bFailed ) // Oni dead + bool bOniDead = + GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && + m_pPlayerStageStats && + m_pPlayerStageStats->bFailed; + if( bOniDead ) return; // do nothing //LOG->Trace( "PlayerMinus::HandlePlayerStep()" ); - ASSERT( col >= 0 && col <= m_NoteData.GetNumTracks() ); + ASSERT_M( col >= 0 && col <= m_NoteData.GetNumTracks(), ssprintf("%i, %i", col, m_NoteData.GetNumTracks()) ); + float fPositionSeconds = GAMESTATE->m_fMusicSeconds; fPositionSeconds -= tm.Ago(); @@ -947,7 +952,8 @@ void PlayerMinus::Step( int col, RageTimer tm ) // TODO: Remove use of PlayerNumber. PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - g_CurStageStats.m_player[pn].iTotalError += ms_error; + if( m_pPlayerStageStats ) + m_pPlayerStageStats->iTotalError += ms_error; if (!m_pPlayerState->m_PlayerOptions.m_fBlind) m_ProTimingDisplay.SetJudgment( ms_error, score ); } @@ -1097,7 +1103,7 @@ void PlayerMinus::OnRowCompletelyJudged( int iIndexThatWasSteppedOn ) // TODO: Remove use of PlayerNumber. PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - bool bBright = g_CurStageStats.m_player[pn].iCurCombo>(int)BRIGHT_GHOST_COMBO_THRESHOLD; + bool bBright = m_pPlayerStageStats && m_pPlayerStageStats->iCurCombo>(int)BRIGHT_GHOST_COMBO_THRESHOLD; if( m_pNoteField ) m_pNoteField->DidTapNote( c, score, bBright ); } @@ -1160,8 +1166,11 @@ void PlayerMinus::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds ) // TODO: Remove use of PlayerNumber. PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - g_CurStageStats.m_player[pn].iTotalError += MAX_PRO_TIMING_ERROR; - m_ProTimingDisplay.SetJudgment( MAX_PRO_TIMING_ERROR, TNS_MISS ); + if( m_pPlayerStageStats ) + { + m_pPlayerStageStats->iTotalError += MAX_PRO_TIMING_ERROR; + m_ProTimingDisplay.SetJudgment( MAX_PRO_TIMING_ERROR, TNS_MISS ); + } } } @@ -1288,43 +1297,45 @@ void PlayerMinus::HandleTapRowScore( unsigned row ) if( NoCheating && m_pPlayerState->m_PlayerController == PC_AUTOPLAY ) return; - // TODO: Remove use of PlayerNumber. - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - /* Update miss combo, and handle "combo stopped" messages. */ - int &iCurCombo = g_CurStageStats.m_player[pn].iCurCombo; + int iDummy = 0; + int &iCurCombo = m_pPlayerStageStats ? m_pPlayerStageStats->iCurCombo : iDummy; switch( scoreOfLastTap ) { case TNS_MARVELOUS: case TNS_PERFECT: case TNS_GREAT: - g_CurStageStats.m_player[pn].iCurMissCombo = 0; + iCurCombo = 0; SCREENMAN->PostMessageToTopScreen( SM_MissComboAborted, 0 ); break; case TNS_MISS: - ++g_CurStageStats.m_player[pn].iCurMissCombo; + ++iCurCombo; m_iDCState = AS2D_MISS; // update dancing 2d characters that may have missed a note + case TNS_GOOD: case TNS_BOO: if( iCurCombo > 50 ) SCREENMAN->PostMessageToTopScreen( SM_ComboStopped, 0 ); - iCurCombo = 0; break; + default: ASSERT( 0 ); } /* The score keeper updates the hit combo. Remember the old combo for handling announcers. */ - const int iOldCombo = g_CurStageStats.m_player[pn].iCurCombo; + const int iOldCombo = 0; + if( m_pPlayerStageStats ) + m_pPlayerStageStats->iCurCombo; if(m_pPrimaryScoreKeeper) m_pPrimaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow ); if(m_pSecondaryScoreKeeper) m_pSecondaryScoreKeeper->HandleTapRowScore(scoreOfLastTap, iNumTapsInRow ); - m_Combo.SetCombo( g_CurStageStats.m_player[pn].iCurCombo, g_CurStageStats.m_player[pn].iCurMissCombo ); + if( m_pPlayerStageStats ) + m_Combo.SetCombo( m_pPlayerStageStats->iCurCombo, m_pPlayerStageStats->iCurMissCombo ); #define CROSSED( x ) (iOldCombo=x) if ( CROSSED(100) ) @@ -1352,13 +1363,18 @@ void PlayerMinus::HandleTapRowScore( unsigned row ) #undef CROSSED // new max combo - g_CurStageStats.m_player[pn].iMaxCombo = max(g_CurStageStats.m_player[pn].iMaxCombo, iCurCombo); + if( m_pPlayerStageStats ) + m_pPlayerStageStats->iMaxCombo = max(m_pPlayerStageStats->iMaxCombo, iCurCombo); /* Use the real current beat, not the beat we've been passed. That's because we * want to record the current life/combo to the current time; eg. if it's a MISS, * the beat we're registering is in the past, but the life is changing now. */ - g_CurStageStats.m_player[pn].UpdateComboList( g_CurStageStats.m_player[pn].fAliveSeconds, false ); + if( m_pPlayerStageStats ) + m_pPlayerStageStats->UpdateComboList( m_pPlayerStageStats->fAliveSeconds, false ); + // TODO: Remove use of PlayerNumber. + PlayerNumber pn = m_pPlayerState->m_PlayerNumber; + float life = -1; if( m_pLifeMeter ) { @@ -1371,12 +1387,15 @@ void PlayerMinus::HandleTapRowScore( unsigned row ) life = 1.0f - life; } if( life != -1 ) - g_CurStageStats.m_player[pn].SetLifeRecordAt( life, g_CurStageStats.m_player[pn].fAliveSeconds ); + if( m_pPlayerStageStats ) + m_pPlayerStageStats->SetLifeRecordAt( life, m_pPlayerStageStats->fAliveSeconds ); if (m_pScoreDisplay) - m_pScoreDisplay->SetScore(g_CurStageStats.m_player[pn].iScore); + if( m_pPlayerStageStats ) + m_pScoreDisplay->SetScore(m_pPlayerStageStats->iScore); if (m_pSecondaryScoreDisplay) - m_pSecondaryScoreDisplay->SetScore(g_CurStageStats.m_player[pn].iScore); + if( m_pPlayerStageStats ) + m_pSecondaryScoreDisplay->SetScore(m_pPlayerStageStats->iScore); if( m_pLifeMeter ) { m_pLifeMeter->ChangeLife( scoreOfLastTap ); @@ -1411,9 +1430,11 @@ void PlayerMinus::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScor PlayerNumber pn = m_pPlayerState->m_PlayerNumber; if (m_pScoreDisplay) - m_pScoreDisplay->SetScore(g_CurStageStats.m_player[pn].iScore); + if( m_pPlayerStageStats ) + m_pScoreDisplay->SetScore(m_pPlayerStageStats->iScore); if (m_pSecondaryScoreDisplay) - m_pSecondaryScoreDisplay->SetScore(g_CurStageStats.m_player[pn].iScore); + if( m_pPlayerStageStats ) + m_pSecondaryScoreDisplay->SetScore(m_pPlayerStageStats->iScore); if( m_pLifeMeter ) { @@ -1443,6 +1464,7 @@ void PlayerMinus::FadeToFail() void Player::Load( PlayerState* pPlayerState, const NoteData& noteData, + PlayerStageStats* pPlayerStageStats, LifeMeter* pLM, CombinedLifeMeter* pCombinedLM, ScoreDisplay* pScoreDisplay, @@ -1454,6 +1476,7 @@ void Player::Load( PlayerMinus::Load( pPlayerState, noteData, + pPlayerStageStats, pLM, pCombinedLM, pScoreDisplay, diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index bf0e732f63..67dc719cf1 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -3,12 +3,7 @@ #ifndef PLAYER_H #define PLAYER_H -#include "PrefsManager.h" // for GameplayStatistics -#include "Sprite.h" -#include "BitmapText.h" - #include "ActorFrame.h" -#include "RandomSample.h" #include "Judgment.h" #include "HoldJudgment.h" #include "Combo.h" @@ -25,10 +20,10 @@ class LifeMeter; class CombinedLifeMeter; class ScoreKeeper; class Inventory; +struct PlayerStageStats; #define SAMPLE_COUNT 16 - class PlayerMinus : public ActorFrame { public: @@ -41,6 +36,7 @@ public: void Load( PlayerState* pPlayerState, const NoteData& noteData, + PlayerStageStats* pPlayerStageStats, LifeMeter* pLM, CombinedLifeMeter* pCombinedLM, ScoreDisplay* pScoreDisplay, @@ -75,6 +71,7 @@ protected: int GetClosestNote( int col, float fBeat, float fMaxBeatsAhead, float fMaxBeatsBehind, bool bAllowGraded ) const; PlayerState* m_pPlayerState; + PlayerStageStats* m_pPlayerStageStats; float m_fNoteFieldHeight; float m_fOffset[SAMPLE_COUNT]; // for AutoSync @@ -117,6 +114,7 @@ public: void Load( PlayerState* pPlayerState, const NoteData& noteData, + PlayerStageStats* pPlayerStageStats, LifeMeter* pLM, CombinedLifeMeter* pCombinedLM, ScoreDisplay* pScoreDisplay, diff --git a/stepmania/src/ScoreKeeper.h b/stepmania/src/ScoreKeeper.h index f7e4ade22c..151d1de6f7 100644 --- a/stepmania/src/ScoreKeeper.h +++ b/stepmania/src/ScoreKeeper.h @@ -17,12 +17,14 @@ class NoteData; class Inventory; class Steps; struct PlayerState; +struct PlayerStageStats; class ScoreKeeper: public Actor { protected: PlayerState* m_pPlayerState; + PlayerStageStats* m_pPlayerStageStats; /* Common toggles that this class handles directly: */ @@ -31,7 +33,7 @@ protected: // bool Stats_DoublesCount; public: - ScoreKeeper(PlayerState* pPlayerState) { m_pPlayerState=pPlayerState; } + ScoreKeeper(PlayerState* pPlayerState,PlayerStageStats* pPlayerStageStats) { m_pPlayerState=pPlayerState; m_pPlayerStageStats=pPlayerStageStats; } virtual void DrawPrimitives() { } virtual void Update( float fDelta ) { } diff --git a/stepmania/src/ScoreKeeperMAX2.cpp b/stepmania/src/ScoreKeeperMAX2.cpp index 57c15bff2d..c045846721 100644 --- a/stepmania/src/ScoreKeeperMAX2.cpp +++ b/stepmania/src/ScoreKeeperMAX2.cpp @@ -17,8 +17,13 @@ #include "PlayerState.h" #include "Style.h" -ScoreKeeperMAX2::ScoreKeeperMAX2( const vector& apSongs, const vector& apSteps_, const vector &asModifiers, PlayerState* pPlayerState ): - ScoreKeeper(pPlayerState), apSteps(apSteps_) +ScoreKeeperMAX2::ScoreKeeperMAX2( + const vector& apSongs, + const vector& apSteps_, + const vector &asModifiers, + PlayerState* pPlayerState, + PlayerStageStats* pPlayerStageStats ): + ScoreKeeper(pPlayerState,pPlayerStageStats), apSteps(apSteps_) { ASSERT( apSongs.size() == apSteps_.size() ); ASSERT( apSongs.size() == asModifiers.size() ); @@ -63,12 +68,7 @@ ScoreKeeperMAX2::ScoreKeeperMAX2( const vector& apSongs, const vectorGetPossibleDancePoints( rvPre, rvPost ); } - // TODO: Move StageStats numbers into PlayerState. - { - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - g_CurStageStats.m_player[pn].iPossibleDancePoints = iTotalPossibleDancePoints; - } - + m_pPlayerStageStats->iPossibleDancePoints = iTotalPossibleDancePoints; m_iScoreRemainder = 0; m_iCurToastyCombo = 0; @@ -204,9 +204,7 @@ static int GetScore(int p, int B, int S, int n) void ScoreKeeperMAX2::AddScore( TapNoteScore score ) { - // TODO: Move StageStats numbers into PlayerState. - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - int &iScore = g_CurStageStats.m_player[pn].iScore; + int &iScore = m_pPlayerStageStats->iScore; /* http://www.aaroninjapan.com/ddr2.html @@ -266,7 +264,7 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score ) const int B = m_iMaxPossiblePoints/10; // Don't use a multiplier if the player has failed - if( g_CurStageStats.m_player[pn].bFailedEarlier ) + if( m_pPlayerStageStats->bFailedEarlier ) { iScore += p; // make score evenly divisible by 5 @@ -279,8 +277,8 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score ) else { iScore += GetScore(p, B, sum, m_iTapNotesHit); - const int &iCurrentCombo = g_CurStageStats.m_player[pn].iCurCombo; - g_CurStageStats.m_player[pn].iBonus += m_ComboBonusFactor[score] * iCurrentCombo; + const int &iCurrentCombo = m_pPlayerStageStats->iCurCombo; + m_pPlayerStageStats->iBonus += m_ComboBonusFactor[score] * iCurrentCombo; } /* Subtract the maximum this step could have been worth from the bonus. */ @@ -288,7 +286,7 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score ) if ( m_iTapNotesHit == m_iNumTapsAndHolds && score >= TNS_PERFECT ) { - if (!g_CurStageStats.m_player[pn].bFailedEarlier) + if (!m_pPlayerStageStats->bFailedEarlier) iScore += m_iPointBonus; if ( m_bIsLastSongInCourse ) { @@ -314,14 +312,11 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score ) void ScoreKeeperMAX2::HandleTapScore( TapNoteScore score ) { - // TODO: Move StageStats numbers into PlayerState. - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - if( score == TNS_HIT_MINE ) { if( m_pPlayerState->m_HealthState != PlayerState::DEAD ) - g_CurStageStats.m_player[pn].iActualDancePoints += TapNoteScoreToDancePoints( TNS_HIT_MINE ); - g_CurStageStats.m_player[pn].iTapNoteScores[TNS_HIT_MINE] += 1; + m_pPlayerStageStats->iActualDancePoints += TapNoteScoreToDancePoints( TNS_HIT_MINE ); + m_pPlayerStageStats->iTapNoteScores[TNS_HIT_MINE] += 1; } } @@ -329,14 +324,11 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa { ASSERT( iNumTapsInRow >= 1 ); - // TODO: Move StageStats numbers into PlayerState. - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - // Update dance points. if( m_pPlayerState->m_HealthState != PlayerState::DEAD ) - g_CurStageStats.m_player[pn].iActualDancePoints += TapNoteScoreToDancePoints( scoreOfLastTap ); + m_pPlayerStageStats->iActualDancePoints += TapNoteScoreToDancePoints( scoreOfLastTap ); // update judged row totals - g_CurStageStats.m_player[pn].iTapNoteScores[scoreOfLastTap] += 1; + m_pPlayerStageStats->iTapNoteScores[scoreOfLastTap] += 1; // // Regular combo @@ -367,7 +359,7 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa TapNoteScore MinScoreToContinueCombo = GAMESTATE->m_PlayMode == PLAY_MODE_ONI? TNS_PERFECT:TNS_GREAT; if( scoreOfLastTap >= MinScoreToContinueCombo ) - g_CurStageStats.m_player[pn].iCurCombo += ComboCountIfHit; + m_pPlayerStageStats->iCurCombo += ComboCountIfHit; AddScore( scoreOfLastTap ); // only score once per row @@ -408,32 +400,30 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa // TODO: Remove indexing with PlayerNumber + PlayerNumber pn = m_pPlayerState->m_PlayerNumber; NSMAN->ReportScore(pn, scoreOfLastTap, - g_CurStageStats.m_player[pn].iScore, - g_CurStageStats.m_player[pn].iCurCombo); + m_pPlayerStageStats->iScore, + m_pPlayerStageStats->iCurCombo); } void ScoreKeeperMAX2::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore ) { - // TODO: Move StageStats numbers into PlayerState. - PlayerNumber pn = m_pPlayerState->m_PlayerNumber; - // update dance points totals if( m_pPlayerState->m_HealthState != PlayerState::DEAD ) - g_CurStageStats.m_player[pn].iActualDancePoints += HoldNoteScoreToDancePoints( holdScore ); - g_CurStageStats.m_player[pn].iHoldNoteScores[holdScore] ++; + m_pPlayerStageStats->iActualDancePoints += HoldNoteScoreToDancePoints( holdScore ); + m_pPlayerStageStats->iHoldNoteScores[holdScore] ++; if( holdScore == HNS_OK ) AddScore( TNS_MARVELOUS ); + // TODO: Remove indexing with PlayerNumber + PlayerNumber pn = m_pPlayerState->m_PlayerNumber; NSMAN->ReportScore( pn, holdScore+7, - g_CurStageStats.m_player[pn].iScore, - g_CurStageStats.m_player[pn].iCurCombo ); - - + m_pPlayerStageStats->iScore, + m_pPlayerStageStats->iCurCombo ); } diff --git a/stepmania/src/ScoreKeeperMAX2.h b/stepmania/src/ScoreKeeperMAX2.h index 39ed80d4eb..431004d4c2 100644 --- a/stepmania/src/ScoreKeeperMAX2.h +++ b/stepmania/src/ScoreKeeperMAX2.h @@ -9,15 +9,15 @@ class Steps; class ScoreKeeperMAX2: public ScoreKeeper { - int m_iScoreRemainder; - int m_iMaxPossiblePoints; - int m_iTapNotesHit; // number of notes judged so far, needed by scoring + int m_iScoreRemainder; + int m_iMaxPossiblePoints; + int m_iTapNotesHit; // number of notes judged so far, needed by scoring - int m_iNumTapsAndHolds; - int m_iMaxScoreSoFar; // for nonstop scoring - int m_iPointBonus; // the difference to award at the end - int m_iCurToastyCombo; - bool m_bIsLastSongInCourse; + int m_iNumTapsAndHolds; + int m_iMaxScoreSoFar; // for nonstop scoring + int m_iPointBonus; // the difference to award at the end + int m_iCurToastyCombo; + bool m_bIsLastSongInCourse; const vector& apSteps; @@ -25,11 +25,16 @@ class ScoreKeeperMAX2: public ScoreKeeper /* Configuration: */ /* Score after each tap will be rounded to the nearest m_iRoundTo; 1 to do nothing. */ - int m_iRoundTo; - int m_ComboBonusFactor[NUM_TAP_NOTE_SCORES]; + int m_iRoundTo; + int m_ComboBonusFactor[NUM_TAP_NOTE_SCORES]; public: - ScoreKeeperMAX2( const vector& apSongs, const vector& apSteps, const vector &asModifiers, PlayerState* pPlayerState); + ScoreKeeperMAX2( + const vector& apSongs, + const vector& apSteps, + const vector &asModifiers, + PlayerState* pPlayerState, + PlayerStageStats* pPlayerStageStats ); // before a song plays (called multiple times if course) void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); diff --git a/stepmania/src/ScoreKeeperRave.cpp b/stepmania/src/ScoreKeeperRave.cpp index 9ee8ef2bd7..1950bfb84c 100644 --- a/stepmania/src/ScoreKeeperRave.cpp +++ b/stepmania/src/ScoreKeeperRave.cpp @@ -13,7 +13,8 @@ ThemeMetric ATTACK_DURATION_SECONDS ("ScoreKeeperRave","AttackDurationSeconds"); -ScoreKeeperRave::ScoreKeeperRave( PlayerState* pPlayerState ) : ScoreKeeper(pPlayerState) +ScoreKeeperRave::ScoreKeeperRave( PlayerState* pPlayerState, PlayerStageStats* pPlayerStageStats ) : + ScoreKeeper(pPlayerState,pPlayerStageStats) { } diff --git a/stepmania/src/ScoreKeeperRave.h b/stepmania/src/ScoreKeeperRave.h index 24cbf6c7be..0130aa4c0f 100644 --- a/stepmania/src/ScoreKeeperRave.h +++ b/stepmania/src/ScoreKeeperRave.h @@ -11,7 +11,7 @@ class ScoreKeeperRave : public ScoreKeeper { public: // Overrides - ScoreKeeperRave( PlayerState* pPlayerState ); + ScoreKeeperRave( PlayerState* pPlayerState, PlayerStageStats* pPlayerStageStats ); void Update( float fDelta ); void OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ); // before a song plays (called multiple times if course) void HandleTapScore( TapNoteScore score ); diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index cd86896355..5a5765c960 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -443,7 +443,17 @@ ScreenEdit::ScreenEdit( CString sName ) : Screen( sName ) /* XXX: Do we actually have to send real note data here, and to m_NoteFieldRecord? * (We load again on play/record.) */ - m_Player.Load( GAMESTATE->m_pPlayerState[PLAYER_1], noteData, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); + m_Player.Load( + GAMESTATE->m_pPlayerState[PLAYER_1], + noteData, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL ); GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_HUMAN; m_Player.SetXY( PLAYER_X, PLAYER_Y ); @@ -2095,7 +2105,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers ) SetupCourseAttacks(); - m_Player.Load( GAMESTATE->m_pPlayerState[PLAYER_1], m_NoteFieldEdit, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); + m_Player.Load( GAMESTATE->m_pPlayerState[PLAYER_1], m_NoteFieldEdit, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN; m_rectRecordBack.StopTweening(); diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index d16830d94b..9f8a67ebc7 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -253,7 +253,12 @@ void ScreenGameplay::Init() { case PrefsManager::SCORING_MAX2: case PrefsManager::SCORING_5TH: - m_pPrimaryScoreKeeper[p] = new ScoreKeeperMAX2( m_apSongsQueue, m_vpStepsQueue[p], m_asModifiersQueue[p], GAMESTATE->m_pPlayerState[p] ); + m_pPrimaryScoreKeeper[p] = new ScoreKeeperMAX2( + m_apSongsQueue, + m_vpStepsQueue[p], + m_asModifiersQueue[p], + GAMESTATE->m_pPlayerState[p], + &g_CurStageStats.m_player[p] ); break; default: ASSERT(0); } @@ -261,7 +266,9 @@ void ScreenGameplay::Init() switch( GAMESTATE->m_PlayMode ) { case PLAY_MODE_RAVE: - m_pSecondaryScoreKeeper[p] = new ScoreKeeperRave( GAMESTATE->m_pPlayerState[p] ); + m_pSecondaryScoreKeeper[p] = new ScoreKeeperRave( + GAMESTATE->m_pPlayerState[p], + &g_CurStageStats.m_player[p] ); break; } } @@ -820,6 +827,7 @@ void ScreenGameplay::SetupSong( PlayerNumber p, int iSongIndex ) m_Player[p].Load( GAMESTATE->m_pPlayerState[p], nd, + &g_CurStageStats.m_player[p], m_pLifeMeter[p], m_pCombinedLifeMeter, m_pPrimaryScoreDisplay[p], @@ -1755,7 +1763,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ } } - /* Nothing else cares about releases. */ + /* Nothing below cares about releases. */ if(type == IET_RELEASE) return; // Handle special keys to adjust the offset diff --git a/stepmania/src/ScreenHowToPlay.cpp b/stepmania/src/ScreenHowToPlay.cpp index 0791e1dfc9..23cb819d97 100644 --- a/stepmania/src/ScreenHowToPlay.cpp +++ b/stepmania/src/ScreenHowToPlay.cpp @@ -151,7 +151,17 @@ ScreenHowToPlay::ScreenHowToPlay( CString sName ) : ScreenAttract( sName ) GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_AUTOPLAY; m_pPlayer = new Player; - m_pPlayer->Load( GAMESTATE->m_pPlayerState[PLAYER_1], m_NoteData, m_pLifeMeterBar, NULL, NULL, NULL, NULL, NULL, NULL ); + m_pPlayer->Load( + GAMESTATE->m_pPlayerState[PLAYER_1], + m_NoteData, + NULL, + m_pLifeMeterBar, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL ); m_pPlayer->SetName( "Player" ); this->AddChild( m_pPlayer ); SET_XY_AND_ON_COMMAND( m_pPlayer );