diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 78ca0cd311..6fa013f622 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -856,10 +856,10 @@ void BackgroundImpl::Update( float fDeltaTime ) FOREACH_PlayerNumber( p ) { - if( GAMESTATE->IsPlayerInDanger(p) ) + if( GAMESTATE->IsPlayerInDanger(GAMESTATE->m_pPlayerState[p]) ) m_DangerPlayer[p].Update( fDeltaTime ); - if( GAMESTATE->IsPlayerDead(p) ) + if( GAMESTATE->IsPlayerDead(GAMESTATE->m_pPlayerState[p]) ) m_DeadPlayer[p].Update( fDeltaTime ); } @@ -907,9 +907,9 @@ void BackgroundImpl::DrawPrimitives() FOREACH_PlayerNumber( p ) { - if( GAMESTATE->IsPlayerInDanger(p) ) + if( GAMESTATE->IsPlayerInDanger(GAMESTATE->m_pPlayerState[p]) ) m_DangerPlayer[p].Draw(); - if( GAMESTATE->IsPlayerDead(p) ) + if( GAMESTATE->IsPlayerDead(GAMESTATE->m_pPlayerState[p]) ) m_DeadPlayer[p].Draw(); } } @@ -929,7 +929,7 @@ void BackgroundImpl::GetLoadedBackgroundChanges( vector *pBack bool BackgroundImpl::IsDangerAllVisible() { FOREACH_PlayerNumber( p ) - if( GAMESTATE->GetPlayerFailType(p) == SongOptions::FAIL_OFF ) + if( GAMESTATE->GetPlayerFailType(GAMESTATE->m_pPlayerState[p]) == SongOptions::FAIL_OFF ) return false; if( !PREFSMAN->m_bShowDanger ) return false; diff --git a/stepmania/src/PercentageDisplay.cpp b/stepmania/src/PercentageDisplay.cpp index 7870c51521..2210b74e33 100644 --- a/stepmania/src/PercentageDisplay.cpp +++ b/stepmania/src/PercentageDisplay.cpp @@ -15,13 +15,14 @@ ThemeMetric PERCENT_TOTAL_SIZE ( "PercentageDisplay", "PercentTotalSize" ) PercentageDisplay::PercentageDisplay() { - m_pSource = NULL; + m_pPlayerState = NULL; + m_pPlayerStageStats = NULL; } -void PercentageDisplay::Load( PlayerNumber pn, PlayerStageStats* pSource, const CString &sMetricsGroup, bool bAutoRefresh ) +void PercentageDisplay::Load( const PlayerState *pPlayerState, const PlayerStageStats *pPlayerStageStats, const CString &sMetricsGroup, bool bAutoRefresh ) { - m_PlayerNumber = pn; - m_pSource = pSource; + m_pPlayerState = pPlayerState; + m_pPlayerStageStats = pPlayerStageStats; m_bAutoRefresh = bAutoRefresh; m_Last = -1; m_LastMax = -1; @@ -32,9 +33,9 @@ void PercentageDisplay::Load( PlayerNumber pn, PlayerStageStats* pSource, const if( PREFSMAN->m_bDancePointsForOni ) - m_textPercent.SetName( ssprintf("DancePointsP%i", pn+1) ); + m_textPercent.SetName( "DancePoints" + PlayerNumberToString(m_pPlayerState->m_PlayerNumber) ); else - m_textPercent.SetName( ssprintf("PercentP%i", pn+1) ); + m_textPercent.SetName( "Percent" + PlayerNumberToString(m_pPlayerState->m_PlayerNumber) ); m_textPercent.LoadFromFont( THEME->GetPathF(sMetricsGroup,"text") ); ActorUtil::SetXYAndOnCommand( m_textPercent, sMetricsGroup ); @@ -43,7 +44,7 @@ void PercentageDisplay::Load( PlayerNumber pn, PlayerStageStats* pSource, const if( !PREFSMAN->m_bDancePointsForOni && (bool)PERCENT_USE_REMAINDER ) { - m_textPercentRemainder.SetName( ssprintf("PercentRemainderP%d",pn+1) ); + m_textPercentRemainder.SetName( "PercentRemainder" + PlayerNumberToString(m_pPlayerState->m_PlayerNumber) ); m_textPercentRemainder.LoadFromFont( THEME->GetPathF(sMetricsGroup,"remainder") ); ActorUtil::SetXYAndOnCommand( m_textPercentRemainder, sMetricsGroup ); ASSERT( m_textPercentRemainder.HasCommand("Off") ); @@ -71,8 +72,8 @@ void PercentageDisplay::Update( float fDeltaTime ) void PercentageDisplay::Refresh() { - const int iActualDancePoints = m_pSource->iActualDancePoints; - const int iCurPossibleDancePoints = m_pSource->iCurPossibleDancePoints; + const int iActualDancePoints = m_pPlayerStageStats->iActualDancePoints; + const int iCurPossibleDancePoints = m_pPlayerStageStats->iCurPossibleDancePoints; if( iActualDancePoints == m_Last && iCurPossibleDancePoints == m_LastMax ) return; @@ -88,12 +89,12 @@ void PercentageDisplay::Refresh() } else { - float fPercentDancePoints = m_pSource->GetPercentDancePoints(); - float fCurMaxPercentDancePoints = m_pSource->GetCurMaxPercentDancePoints(); + float fPercentDancePoints = m_pPlayerStageStats->GetPercentDancePoints(); + float fCurMaxPercentDancePoints = m_pPlayerStageStats->GetCurMaxPercentDancePoints(); - if ( APPLY_SCORE_DISPLAY_OPTIONS ) + if( APPLY_SCORE_DISPLAY_OPTIONS ) { - switch( GAMESTATE->m_pPlayerState[m_PlayerNumber]->m_CurrentPlayerOptions.m_ScoreDisplay ) + switch( m_pPlayerState->m_CurrentPlayerOptions.m_ScoreDisplay ) { case PlayerOptions::SCORING_ADD: // nothing to do diff --git a/stepmania/src/PercentageDisplay.h b/stepmania/src/PercentageDisplay.h index b45334c2ab..8d27531c2f 100644 --- a/stepmania/src/PercentageDisplay.h +++ b/stepmania/src/PercentageDisplay.h @@ -9,13 +9,13 @@ #include "StageStats.h" #include "ThemeMetric.h" -struct PlayerState; +class PlayerState; class PercentageDisplay: public ActorFrame { public: PercentageDisplay(); - void Load( PlayerNumber pn, PlayerStageStats *pSource, const CString &sMetricsGroup, bool bAutoRefresh ); + void Load( const PlayerState *pPlayerState, const PlayerStageStats *pPlayerStageStats, const CString &sMetricsGroup, bool bAutoRefresh ); void Update( float fDeltaTime ); void TweenOffScreen(); @@ -27,8 +27,8 @@ private: ThemeMetric APPLY_SCORE_DISPLAY_OPTIONS; void Refresh(); - PlayerNumber m_PlayerNumber; - PlayerStageStats *m_pSource; + const PlayerState *m_pPlayerState; + const PlayerStageStats *m_pPlayerStageStats; bool m_bAutoRefresh; int m_Last; int m_LastMax; diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 3e9ff13403..efce033053 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -491,7 +491,7 @@ void ScreenEvaluation::Init() /* Use "ScreenEvaluation Percent" for the [metric set], but position and * tween it with "PercentP1X", etc. */ m_Percent[p].SetName( ssprintf("PercentP%d",p+1) ); - m_Percent[p].Load( p, &STATSMAN->m_CurStageStats.m_player[p], "ScreenEvaluation Percent", true ); + m_Percent[p].Load( GAMESTATE->m_pPlayerState[p], &STATSMAN->m_CurStageStats.m_player[p], "ScreenEvaluation Percent", true ); SET_XY_AND_ON_COMMAND( m_Percent[p] ); this->AddChild( &m_Percent[p] ); } diff --git a/stepmania/src/ScreenHowToPlay.cpp b/stepmania/src/ScreenHowToPlay.cpp index e27f1fd1d9..dbb871c14b 100644 --- a/stepmania/src/ScreenHowToPlay.cpp +++ b/stepmania/src/ScreenHowToPlay.cpp @@ -19,6 +19,7 @@ #include "ActorUtil.h" #include "PrefsManager.h" #include "CharacterManager.h" +#include "StatsManager.h" static const ThemeMetric STEPFILE ("ScreenHowToPlay","Stepfile"); static const ThemeMetric NUM_PERFECTS ("ScreenHowToPlay","NumPerfects"); @@ -125,7 +126,7 @@ void ScreenHowToPlay::Init() { m_pLifeMeterBar = new LifeMeterBar; m_pLifeMeterBar->SetName("LifeMeterBar"); - m_pLifeMeterBar->Load( PLAYER_1 ); + m_pLifeMeterBar->Load( GAMESTATE->m_pPlayerState[PLAYER_1], &STATSMAN->m_CurStageStats.m_player[PLAYER_1] ); SET_XY_AND_ON_COMMAND( m_pLifeMeterBar ); m_pLifeMeterBar->FillForHowToPlay( NUM_PERFECTS, NUM_MISSES ); }