From 20bb281e18aeec7da38f62fad34a93fbc49e54e5 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Tue, 23 Aug 2005 20:40:47 +0000 Subject: [PATCH] pass around a PlayerState and PlayerStageStats instead of PlayerNumber and looking things up in GameState --- stepmania/src/LifeMeter.h | 11 +++++++++-- stepmania/src/LifeMeterBar.cpp | 20 +++++++++++--------- stepmania/src/LifeMeterBar.h | 2 +- stepmania/src/LifeMeterBattery.cpp | 23 +++++++++++++---------- stepmania/src/LifeMeterBattery.h | 2 +- stepmania/src/LifeMeterTime.cpp | 24 ++++++++++++------------ stepmania/src/LifeMeterTime.h | 2 +- stepmania/src/ScoreDisplay.cpp | 6 ++++++ stepmania/src/ScoreDisplay.h | 8 +++++--- stepmania/src/ScoreDisplayBattle.cpp | 4 ++-- stepmania/src/ScoreDisplayBattle.h | 2 +- stepmania/src/ScoreDisplayLifeTime.cpp | 6 +++--- stepmania/src/ScoreDisplayLifeTime.h | 2 +- stepmania/src/ScoreDisplayNormal.cpp | 4 ++-- stepmania/src/ScoreDisplayNormal.h | 2 +- stepmania/src/ScoreDisplayOni.cpp | 4 ++-- stepmania/src/ScoreDisplayOni.h | 2 +- stepmania/src/ScoreDisplayPercentage.cpp | 8 +++++--- stepmania/src/ScoreDisplayPercentage.h | 2 +- stepmania/src/ScoreDisplayRave.cpp | 5 ++--- stepmania/src/ScoreDisplayRave.h | 2 +- 21 files changed, 81 insertions(+), 60 deletions(-) diff --git a/stepmania/src/LifeMeter.h b/stepmania/src/LifeMeter.h index 8ff82a88bd..f0d0f5f14d 100644 --- a/stepmania/src/LifeMeter.h +++ b/stepmania/src/LifeMeter.h @@ -5,6 +5,8 @@ #include "GameConstantsAndTypes.h" #include "ActorFrame.h" +class PlayerState; +class PlayerStageStats; class LifeMeter : public ActorFrame { @@ -12,7 +14,11 @@ public: LifeMeter() {}; virtual ~LifeMeter() {}; - virtual void Load( PlayerNumber pn ) { m_PlayerNumber = pn; } + virtual void Load( const PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ) + { + m_pPlayerState = pPlayerState; + m_pPlayerStageStats = pPlayerStageStats; + } virtual void OnLoadSong() {}; virtual void OnSongEnded() {}; /* Change life after receiving a tap note grade. This *is* called for @@ -30,7 +36,8 @@ public: virtual void ForceFail() = 0; protected: - PlayerNumber m_PlayerNumber; + const PlayerState *m_pPlayerState; + PlayerStageStats *m_pPlayerStageStats; }; diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index aecfdd726b..d66c02e4c9 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -100,15 +100,17 @@ LifeMeterBar::~LifeMeterBar() SAFE_DELETE( m_pStream ); } -void LifeMeterBar::Load( PlayerNumber pn ) +void LifeMeterBar::Load( const PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ) { - LifeMeter::Load( pn ); + LifeMeter::Load( pPlayerState, pPlayerStageStats ); + + PlayerNumber pn = pPlayerState->m_PlayerNumber; // Change life difficulty to really easy if merciful beginner on bool bMercifulBeginnerInEffect = GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR && - GAMESTATE->IsPlayerEnabled( pn ) && - GAMESTATE->m_pCurSteps[m_PlayerNumber]->GetDifficulty() == DIFFICULTY_BEGINNER && + GAMESTATE->IsPlayerEnabled( pPlayerState ) && + GAMESTATE->m_pCurSteps[pn]->GetDifficulty() == DIFFICULTY_BEGINNER && PREFSMAN->m_bMercifulBeginner; if( bMercifulBeginnerInEffect ) { @@ -247,7 +249,7 @@ void LifeMeterBar::ChangeLife( float fDeltaLife ) } /* If we've already failed, there's no point in letting them fill up the bar again. */ - if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailed ) + if( m_pPlayerStageStats->bFailed ) fDeltaLife = 0; switch( GAMESTATE->m_SongOptions.m_DrainType ) @@ -277,7 +279,7 @@ void LifeMeterBar::ChangeLife( float fDeltaLife ) AfterLifeChanged(); if( m_fLifePercentage <= FAIL_THRESHOLD ) - STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier = true; + m_pPlayerStageStats->bFailedEarlier = true; } void LifeMeterBar::AfterLifeChanged() @@ -287,9 +289,9 @@ void LifeMeterBar::AfterLifeChanged() bool LifeMeterBar::IsPastPassmark() const { - if( GAMESTATE->m_pPlayerState[m_PlayerNumber]->m_PlayerOptions.m_fPassmark > 0 ) + if( m_pPlayerState->m_PlayerOptions.m_fPassmark > 0 ) { - return m_fLifePercentage >= GAMESTATE->m_pPlayerState[m_PlayerNumber]->m_PlayerOptions.m_fPassmark; + return m_fLifePercentage >= m_pPlayerState->m_PlayerOptions.m_fPassmark; } else { @@ -326,7 +328,7 @@ void LifeMeterBar::Update( float fDeltaTime ) m_pStream->SetPassingAlpha( m_fPassingAlpha ); m_pStream->SetHotAlpha( m_fHotAlpha ); - if( m_fLifePercentage < DANGER_THRESHOLD && !GAMESTATE->IsPlayerDead(m_PlayerNumber) ) + if( m_fLifePercentage < DANGER_THRESHOLD && !GAMESTATE->IsPlayerDead(m_pPlayerState) ) m_quadDangerGlow.SetDiffuseAlpha( 1 ); else m_quadDangerGlow.SetDiffuseAlpha( 0 ); diff --git a/stepmania/src/LifeMeterBar.h b/stepmania/src/LifeMeterBar.h index 1b06fcc87b..f6562e7ad4 100644 --- a/stepmania/src/LifeMeterBar.h +++ b/stepmania/src/LifeMeterBar.h @@ -14,7 +14,7 @@ public: LifeMeterBar(); ~LifeMeterBar(); - virtual void Load( PlayerNumber pn ); + virtual void Load( const PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ); virtual void Update( float fDeltaTime ); virtual void DrawPrimitives(); diff --git a/stepmania/src/LifeMeterBattery.cpp b/stepmania/src/LifeMeterBattery.cpp index f5d538c9b4..f8cf40fc2a 100644 --- a/stepmania/src/LifeMeterBattery.cpp +++ b/stepmania/src/LifeMeterBattery.cpp @@ -3,7 +3,7 @@ #include "GameState.h" #include "ThemeManager.h" #include "Steps.h" -#include "StatsManager.h" +#include "PlayerState.h" const float BATTERY_X[NUM_PLAYERS] = { -92, +92 }; @@ -25,11 +25,11 @@ LifeMeterBattery::LifeMeterBattery() m_soundLoseLife.Load( THEME->GetPathS("LifeMeterBattery","lose"),true ); } -void LifeMeterBattery::Load( PlayerNumber pn ) +void LifeMeterBattery::Load( const PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ) { - LifeMeter::Load( pn ); + LifeMeter::Load( pPlayerState, pPlayerStageStats ); - bool bPlayerEnabled = GAMESTATE->IsPlayerEnabled(pn); + bool bPlayerEnabled = GAMESTATE->IsPlayerEnabled( pPlayerState ); m_sprFrame.Load( THEME->GetPathG("LifeMeterBattery","frame") ); this->AddChild( &m_sprFrame ); @@ -45,6 +45,8 @@ void LifeMeterBattery::Load( PlayerNumber pn ) if( bPlayerEnabled ) this->AddChild( &m_textNumLives ); + PlayerNumber pn = pPlayerState->m_PlayerNumber; + m_sprFrame.SetZoomX( pn==PLAYER_1 ? 1.0f : -1.0f ); m_sprBattery.SetZoomX( pn==PLAYER_1 ? 1.0f : -1.0f ); m_sprBattery.SetX( BATTERY_X[pn] ); @@ -53,7 +55,7 @@ void LifeMeterBattery::Load( PlayerNumber pn ) if( bPlayerEnabled ) { - m_Percent.Load( pn, &STATSMAN->m_CurStageStats.m_player[pn], "LifeMeterBattery Percent", true ); + m_Percent.Load( pPlayerState, pPlayerStageStats, "LifeMeterBattery Percent", true ); this->AddChild( &m_Percent ); } @@ -62,13 +64,14 @@ void LifeMeterBattery::Load( PlayerNumber pn ) void LifeMeterBattery::OnSongEnded() { - if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier ) + if( m_pPlayerStageStats->bFailedEarlier ) return; if( m_iLivesLeft < GAMESTATE->m_SongOptions.m_iBatteryLives ) { m_iTrailingLivesLeft = m_iLivesLeft; - m_iLivesLeft += ( GAMESTATE->m_pCurSteps[m_PlayerNumber]->GetMeter()>=8 ? 2 : 1 ); + PlayerNumber pn = m_pPlayerState->m_PlayerNumber; + m_iLivesLeft += ( GAMESTATE->m_pCurSteps[pn]->GetMeter()>=8 ? 2 : 1 ); m_iLivesLeft = min( m_iLivesLeft, GAMESTATE->m_SongOptions.m_iBatteryLives ); m_soundGainLife.Play(); } @@ -79,7 +82,7 @@ void LifeMeterBattery::OnSongEnded() void LifeMeterBattery::ChangeLife( TapNoteScore score ) { - if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier ) + if( m_pPlayerStageStats->bFailedEarlier ) return; switch( score ) @@ -107,7 +110,7 @@ void LifeMeterBattery::ChangeLife( TapNoteScore score ) ASSERT(0); } if( m_iLivesLeft == 0 ) - STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier = true; + m_pPlayerStageStats->bFailedEarlier = true; } void LifeMeterBattery::ChangeLife( HoldNoteScore score, TapNoteScore tscore ) @@ -145,7 +148,7 @@ bool LifeMeterBattery::IsHot() const bool LifeMeterBattery::IsFailing() const { - return STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier; + return m_pPlayerStageStats->bFailedEarlier; } float LifeMeterBattery::GetLife() const diff --git a/stepmania/src/LifeMeterBattery.h b/stepmania/src/LifeMeterBattery.h index 1df182142b..dde458731e 100644 --- a/stepmania/src/LifeMeterBattery.h +++ b/stepmania/src/LifeMeterBattery.h @@ -15,7 +15,7 @@ class LifeMeterBattery : public LifeMeter public: LifeMeterBattery(); - virtual void Load( PlayerNumber pn ); + virtual void Load( const PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ); virtual void Update( float fDeltaTime ); diff --git a/stepmania/src/LifeMeterTime.cpp b/stepmania/src/LifeMeterTime.cpp index 1dfffe0bbb..11b074c326 100644 --- a/stepmania/src/LifeMeterTime.cpp +++ b/stepmania/src/LifeMeterTime.cpp @@ -1,13 +1,13 @@ #include "global.h" #include "LifeMeterTime.h" -#include "GameState.h" #include "ThemeManager.h" #include "Steps.h" -#include "StatsManager.h" #include "ActorUtil.h" #include "Course.h" #include "PrefsManager.h" #include "StreamDisplay.h" +#include "GameState.h" +#include "StatsManager.h" const float FULL_LIFE_SECONDS = 1.5f*60; @@ -24,9 +24,9 @@ LifeMeterTime::LifeMeterTime() m_fLifeTotalLostSeconds = 0; } -void LifeMeterTime::Load( PlayerNumber pn ) +void LifeMeterTime::Load( const PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ) { - LifeMeter::Load( pn ); + LifeMeter::Load( pPlayerState, pPlayerStageStats ); const CString sType = "LifeMeterTime"; @@ -70,7 +70,7 @@ void LifeMeterTime::Load( PlayerNumber pn ) void LifeMeterTime::OnLoadSong() { - if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier ) + if( m_pPlayerStageStats->bFailedEarlier ) return; Course* pCourse = GAMESTATE->m_pCurCourse; @@ -85,7 +85,7 @@ void LifeMeterTime::OnLoadSong() void LifeMeterTime::ChangeLife( TapNoteScore tns ) { - if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier ) + if( m_pPlayerStageStats->bFailedEarlier ) return; float fMeterChange = 0; @@ -104,12 +104,12 @@ void LifeMeterTime::ChangeLife( TapNoteScore tns ) m_fLifeTotalLostSeconds -= fMeterChange; if( GetLifeSeconds() <= 0 ) - STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier = true; + m_pPlayerStageStats->bFailedEarlier = true; } void LifeMeterTime::ChangeLife( HoldNoteScore hns, TapNoteScore tns ) { - if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier ) + if( m_pPlayerStageStats->bFailedEarlier ) return; float fMeterChange = 0; @@ -123,7 +123,7 @@ void LifeMeterTime::ChangeLife( HoldNoteScore hns, TapNoteScore tns ) m_fLifeTotalLostSeconds -= fMeterChange; if( GetLifeSeconds() <= 0 ) - STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier = true; + m_pPlayerStageStats->bFailedEarlier = true; } void LifeMeterTime::OnDancePointsChange() @@ -143,7 +143,7 @@ bool LifeMeterTime::IsHot() const bool LifeMeterTime::IsFailing() const { - return STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier; + return m_pPlayerStageStats->bFailedEarlier; } void LifeMeterTime::Update( float fDeltaTime ) @@ -151,7 +151,7 @@ void LifeMeterTime::Update( float fDeltaTime ) // update current stage stats so ScoreDisplayLifeTime can show the right thing float fSecs = GetLifeSeconds(); fSecs = max( 0, fSecs ); - STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].fLifeRemainingSeconds = fSecs; + m_pPlayerStageStats->fLifeRemainingSeconds = fSecs; LifeMeter::Update( fDeltaTime ); @@ -160,7 +160,7 @@ void LifeMeterTime::Update( float fDeltaTime ) m_pStream->SetPassingAlpha( 0 ); m_pStream->SetHotAlpha( 0 ); - if( m_pStream->GetTrailingLifePercent() < DANGER_THRESHOLD && !GAMESTATE->IsPlayerDead(m_PlayerNumber) ) + if( m_pStream->GetTrailingLifePercent() < DANGER_THRESHOLD && !GAMESTATE->IsPlayerDead(m_pPlayerState) ) m_quadDangerGlow.SetDiffuseAlpha( 1 ); else m_quadDangerGlow.SetDiffuseAlpha( 0 ); diff --git a/stepmania/src/LifeMeterTime.h b/stepmania/src/LifeMeterTime.h index 1e024b30a4..fdc3c57fe4 100644 --- a/stepmania/src/LifeMeterTime.h +++ b/stepmania/src/LifeMeterTime.h @@ -18,7 +18,7 @@ class LifeMeterTime : public LifeMeter public: LifeMeterTime(); - virtual void Load( PlayerNumber pn ); + virtual void Load( const PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats ); virtual void Update( float fDeltaTime ); diff --git a/stepmania/src/ScoreDisplay.cpp b/stepmania/src/ScoreDisplay.cpp index 415b49fdf6..989636f01b 100644 --- a/stepmania/src/ScoreDisplay.cpp +++ b/stepmania/src/ScoreDisplay.cpp @@ -1,2 +1,8 @@ #include "global.h" #include "ScoreDisplay.h" + +void ScoreDisplay::Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ) +{ + m_pPlayerState = pPlayerState; + m_pPlayerStageStats = pPlayerStageStats; +} diff --git a/stepmania/src/ScoreDisplay.h b/stepmania/src/ScoreDisplay.h index 6c4251eff9..1e18549848 100644 --- a/stepmania/src/ScoreDisplay.h +++ b/stepmania/src/ScoreDisplay.h @@ -5,12 +5,13 @@ #include "ActorFrame.h" #include "GameConstantsAndTypes.h" -struct PlayerState; +class PlayerState; +class PlayerStageStats; class ScoreDisplay : public ActorFrame { public: - virtual void Init( const PlayerState* pPlayerState ) { m_pPlayerState = pPlayerState; } + virtual void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ); virtual void SetScore( int iNewScore ) {} virtual void OnLoadSong() {}; @@ -23,7 +24,8 @@ public: virtual void OnJudgment( HoldNoteScore score, TapNoteScore tscore ) {}; protected: - const PlayerState* m_pPlayerState; // needed to look up statistics in GAMESTATE + const PlayerState* m_pPlayerState; // needed to look up stats + const PlayerStageStats* m_pPlayerStageStats; // needed to look up stats }; #endif diff --git a/stepmania/src/ScoreDisplayBattle.cpp b/stepmania/src/ScoreDisplayBattle.cpp index 08c72fd166..c9cededc5a 100644 --- a/stepmania/src/ScoreDisplayBattle.cpp +++ b/stepmania/src/ScoreDisplayBattle.cpp @@ -32,9 +32,9 @@ ScoreDisplayBattle::ScoreDisplayBattle() m_TexturePreload.Load( asIconPaths[j] ); } -void ScoreDisplayBattle::Init( const PlayerState* pPlayerState ) +void ScoreDisplayBattle::Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ) { - ScoreDisplay::Init( pPlayerState ); + ScoreDisplay::Init( pPlayerState, pPlayerStageStats ); } void ScoreDisplayBattle::Update( float fDelta ) diff --git a/stepmania/src/ScoreDisplayBattle.h b/stepmania/src/ScoreDisplayBattle.h index ea146d4e4c..e8cab67c7c 100644 --- a/stepmania/src/ScoreDisplayBattle.h +++ b/stepmania/src/ScoreDisplayBattle.h @@ -13,7 +13,7 @@ class ScoreDisplayBattle : public ScoreDisplay { public: ScoreDisplayBattle(); - virtual void Init( const PlayerState* pPlayerState ); + virtual void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ); virtual void Update( float fDelta ); diff --git a/stepmania/src/ScoreDisplayLifeTime.cpp b/stepmania/src/ScoreDisplayLifeTime.cpp index 682b59b827..b283dd72ef 100644 --- a/stepmania/src/ScoreDisplayLifeTime.cpp +++ b/stepmania/src/ScoreDisplayLifeTime.cpp @@ -18,9 +18,9 @@ ScoreDisplayLifeTime::ScoreDisplayLifeTime() LOG->Trace( "ScoreDisplayLifeTime::ScoreDisplayLifeTime()" ); } -void ScoreDisplayLifeTime::Init( const PlayerState* pPlayerState ) +void ScoreDisplayLifeTime::Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ) { - ScoreDisplay::Init( pPlayerState ); + ScoreDisplay::Init( pPlayerState, pPlayerStageStats ); const CString sType = "ScoreDisplayLifeTime"; @@ -65,7 +65,7 @@ void ScoreDisplayLifeTime::Update( float fDelta ) { ScoreDisplay::Update( fDelta ); - float fSecs = STATSMAN->m_CurStageStats.m_player[m_pPlayerState->m_PlayerNumber].fLifeRemainingSeconds; + float fSecs = m_pPlayerStageStats->fLifeRemainingSeconds; CString s = SecondsToMSSMsMs(fSecs); m_textTimeRemaining.SetText( s ); diff --git a/stepmania/src/ScoreDisplayLifeTime.h b/stepmania/src/ScoreDisplayLifeTime.h index e6ca84d563..ea5963459b 100644 --- a/stepmania/src/ScoreDisplayLifeTime.h +++ b/stepmania/src/ScoreDisplayLifeTime.h @@ -12,7 +12,7 @@ class ScoreDisplayLifeTime : public ScoreDisplay public: ScoreDisplayLifeTime(); - virtual void Init( const PlayerState* pPlayerState ); + virtual void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ); virtual void Update( float fDelta ); diff --git a/stepmania/src/ScoreDisplayNormal.cpp b/stepmania/src/ScoreDisplayNormal.cpp index e7568327dd..1210595a77 100644 --- a/stepmania/src/ScoreDisplayNormal.cpp +++ b/stepmania/src/ScoreDisplayNormal.cpp @@ -24,9 +24,9 @@ ScoreDisplayNormal::ScoreDisplayNormal() this->AddChild( &m_text ); } -void ScoreDisplayNormal::Init( const PlayerState* pPlayerState ) +void ScoreDisplayNormal::Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ) { - ScoreDisplay::Init( pPlayerState ); + ScoreDisplay::Init( pPlayerState, pPlayerStageStats ); // TODO: Remove use of PlayerNumber. PlayerNumber pn = pPlayerState->m_PlayerNumber; diff --git a/stepmania/src/ScoreDisplayNormal.h b/stepmania/src/ScoreDisplayNormal.h index 1bdb5d5ea2..bb42004840 100644 --- a/stepmania/src/ScoreDisplayNormal.h +++ b/stepmania/src/ScoreDisplayNormal.h @@ -12,7 +12,7 @@ class ScoreDisplayNormal : public ScoreDisplay public: ScoreDisplayNormal(); - virtual void Init( const PlayerState* pPlayerState ); + virtual void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ); virtual void SetScore( int iNewScore ); virtual void SetText( CString s ) { m_text.SetText(s); } diff --git a/stepmania/src/ScoreDisplayOni.cpp b/stepmania/src/ScoreDisplayOni.cpp index 9c02c88dbc..7627f121b1 100644 --- a/stepmania/src/ScoreDisplayOni.cpp +++ b/stepmania/src/ScoreDisplayOni.cpp @@ -24,9 +24,9 @@ ScoreDisplayOni::ScoreDisplayOni() this->AddChild( &m_text ); } -void ScoreDisplayOni::Init( const PlayerState* pPlayerState ) +void ScoreDisplayOni::Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ) { - ScoreDisplay::Init( pPlayerState ); + ScoreDisplay::Init( pPlayerState, pPlayerStageStats ); // TODO: Remove use of PlayerNumber. PlayerNumber pn = pPlayerState->m_PlayerNumber; diff --git a/stepmania/src/ScoreDisplayOni.h b/stepmania/src/ScoreDisplayOni.h index f8de8e6cbe..a33925d8fb 100644 --- a/stepmania/src/ScoreDisplayOni.h +++ b/stepmania/src/ScoreDisplayOni.h @@ -12,7 +12,7 @@ class ScoreDisplayOni : public ScoreDisplay public: ScoreDisplayOni(); - virtual void Init( const PlayerState* pPlayerState ); + virtual void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ); virtual void Update( float fDelta ); diff --git a/stepmania/src/ScoreDisplayPercentage.cpp b/stepmania/src/ScoreDisplayPercentage.cpp index dccbce9422..ad38a2eefc 100644 --- a/stepmania/src/ScoreDisplayPercentage.cpp +++ b/stepmania/src/ScoreDisplayPercentage.cpp @@ -14,11 +14,13 @@ ScoreDisplayPercentage::ScoreDisplayPercentage() this->AddChild( &m_Percent ); } -void ScoreDisplayPercentage::Init( const PlayerState* pPlayerState ) +void ScoreDisplayPercentage::Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ) { + ScoreDisplay::Init( pPlayerState, pPlayerStageStats ); + m_Percent.Load( - pPlayerState->m_PlayerNumber, - &STATSMAN->m_CurStageStats.m_player[pPlayerState->m_PlayerNumber], + pPlayerState, + pPlayerStageStats, "ScoreDisplayPercentage Percent", true ); } diff --git a/stepmania/src/ScoreDisplayPercentage.h b/stepmania/src/ScoreDisplayPercentage.h index 955e81a5aa..cd52ddf570 100644 --- a/stepmania/src/ScoreDisplayPercentage.h +++ b/stepmania/src/ScoreDisplayPercentage.h @@ -11,7 +11,7 @@ class ScoreDisplayPercentage: public ScoreDisplay { public: ScoreDisplayPercentage(); - void Init( const PlayerState* pPlayerState ); + void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ); private: AutoActor m_sprFrame; diff --git a/stepmania/src/ScoreDisplayRave.cpp b/stepmania/src/ScoreDisplayRave.cpp index b0f0a83935..e37b6183fd 100644 --- a/stepmania/src/ScoreDisplayRave.cpp +++ b/stepmania/src/ScoreDisplayRave.cpp @@ -4,7 +4,6 @@ #include "RageLog.h" #include "PrefsManager.h" #include "RageLog.h" -#include "GameState.h" #include "ThemeManager.h" #include "ActorUtil.h" #include "PlayerState.h" @@ -34,9 +33,9 @@ ScoreDisplayRave::ScoreDisplayRave() this->AddChild( &m_textLevel ); } -void ScoreDisplayRave::Init( const PlayerState* pPlayerState ) +void ScoreDisplayRave::Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ) { - ScoreDisplay::Init( pPlayerState ); + ScoreDisplay::Init( pPlayerState, pPlayerStageStats ); PlayerNumber pn = pPlayerState->m_PlayerNumber; diff --git a/stepmania/src/ScoreDisplayRave.h b/stepmania/src/ScoreDisplayRave.h index 9630bbd964..9946395b59 100644 --- a/stepmania/src/ScoreDisplayRave.h +++ b/stepmania/src/ScoreDisplayRave.h @@ -13,7 +13,7 @@ class ScoreDisplayRave : public ScoreDisplay { public: ScoreDisplayRave(); - virtual void Init( const PlayerState* pPlayerState ); + virtual void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ); virtual void Update( float fDelta );