load from PlayerState and PlayerStageStats, not PlayerNumber and looking up in GameState
This commit is contained in:
@@ -856,10 +856,10 @@ void BackgroundImpl::Update( float fDeltaTime )
|
|||||||
|
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
{
|
{
|
||||||
if( GAMESTATE->IsPlayerInDanger(p) )
|
if( GAMESTATE->IsPlayerInDanger(GAMESTATE->m_pPlayerState[p]) )
|
||||||
m_DangerPlayer[p].Update( fDeltaTime );
|
m_DangerPlayer[p].Update( fDeltaTime );
|
||||||
|
|
||||||
if( GAMESTATE->IsPlayerDead(p) )
|
if( GAMESTATE->IsPlayerDead(GAMESTATE->m_pPlayerState[p]) )
|
||||||
m_DeadPlayer[p].Update( fDeltaTime );
|
m_DeadPlayer[p].Update( fDeltaTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -907,9 +907,9 @@ void BackgroundImpl::DrawPrimitives()
|
|||||||
|
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
{
|
{
|
||||||
if( GAMESTATE->IsPlayerInDanger(p) )
|
if( GAMESTATE->IsPlayerInDanger(GAMESTATE->m_pPlayerState[p]) )
|
||||||
m_DangerPlayer[p].Draw();
|
m_DangerPlayer[p].Draw();
|
||||||
if( GAMESTATE->IsPlayerDead(p) )
|
if( GAMESTATE->IsPlayerDead(GAMESTATE->m_pPlayerState[p]) )
|
||||||
m_DeadPlayer[p].Draw();
|
m_DeadPlayer[p].Draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -929,7 +929,7 @@ void BackgroundImpl::GetLoadedBackgroundChanges( vector<BackgroundChange> *pBack
|
|||||||
bool BackgroundImpl::IsDangerAllVisible()
|
bool BackgroundImpl::IsDangerAllVisible()
|
||||||
{
|
{
|
||||||
FOREACH_PlayerNumber( p )
|
FOREACH_PlayerNumber( p )
|
||||||
if( GAMESTATE->GetPlayerFailType(p) == SongOptions::FAIL_OFF )
|
if( GAMESTATE->GetPlayerFailType(GAMESTATE->m_pPlayerState[p]) == SongOptions::FAIL_OFF )
|
||||||
return false;
|
return false;
|
||||||
if( !PREFSMAN->m_bShowDanger )
|
if( !PREFSMAN->m_bShowDanger )
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -15,13 +15,14 @@ ThemeMetric<int> PERCENT_TOTAL_SIZE ( "PercentageDisplay", "PercentTotalSize" )
|
|||||||
|
|
||||||
PercentageDisplay::PercentageDisplay()
|
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_pPlayerState = pPlayerState;
|
||||||
m_pSource = pSource;
|
m_pPlayerStageStats = pPlayerStageStats;
|
||||||
m_bAutoRefresh = bAutoRefresh;
|
m_bAutoRefresh = bAutoRefresh;
|
||||||
m_Last = -1;
|
m_Last = -1;
|
||||||
m_LastMax = -1;
|
m_LastMax = -1;
|
||||||
@@ -32,9 +33,9 @@ void PercentageDisplay::Load( PlayerNumber pn, PlayerStageStats* pSource, const
|
|||||||
|
|
||||||
|
|
||||||
if( PREFSMAN->m_bDancePointsForOni )
|
if( PREFSMAN->m_bDancePointsForOni )
|
||||||
m_textPercent.SetName( ssprintf("DancePointsP%i", pn+1) );
|
m_textPercent.SetName( "DancePoints" + PlayerNumberToString(m_pPlayerState->m_PlayerNumber) );
|
||||||
else
|
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") );
|
m_textPercent.LoadFromFont( THEME->GetPathF(sMetricsGroup,"text") );
|
||||||
ActorUtil::SetXYAndOnCommand( m_textPercent, sMetricsGroup );
|
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 )
|
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") );
|
m_textPercentRemainder.LoadFromFont( THEME->GetPathF(sMetricsGroup,"remainder") );
|
||||||
ActorUtil::SetXYAndOnCommand( m_textPercentRemainder, sMetricsGroup );
|
ActorUtil::SetXYAndOnCommand( m_textPercentRemainder, sMetricsGroup );
|
||||||
ASSERT( m_textPercentRemainder.HasCommand("Off") );
|
ASSERT( m_textPercentRemainder.HasCommand("Off") );
|
||||||
@@ -71,8 +72,8 @@ void PercentageDisplay::Update( float fDeltaTime )
|
|||||||
|
|
||||||
void PercentageDisplay::Refresh()
|
void PercentageDisplay::Refresh()
|
||||||
{
|
{
|
||||||
const int iActualDancePoints = m_pSource->iActualDancePoints;
|
const int iActualDancePoints = m_pPlayerStageStats->iActualDancePoints;
|
||||||
const int iCurPossibleDancePoints = m_pSource->iCurPossibleDancePoints;
|
const int iCurPossibleDancePoints = m_pPlayerStageStats->iCurPossibleDancePoints;
|
||||||
|
|
||||||
if( iActualDancePoints == m_Last && iCurPossibleDancePoints == m_LastMax )
|
if( iActualDancePoints == m_Last && iCurPossibleDancePoints == m_LastMax )
|
||||||
return;
|
return;
|
||||||
@@ -88,12 +89,12 @@ void PercentageDisplay::Refresh()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
float fPercentDancePoints = m_pSource->GetPercentDancePoints();
|
float fPercentDancePoints = m_pPlayerStageStats->GetPercentDancePoints();
|
||||||
float fCurMaxPercentDancePoints = m_pSource->GetCurMaxPercentDancePoints();
|
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:
|
case PlayerOptions::SCORING_ADD:
|
||||||
// nothing to do
|
// nothing to do
|
||||||
|
|||||||
@@ -9,13 +9,13 @@
|
|||||||
#include "StageStats.h"
|
#include "StageStats.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
|
||||||
struct PlayerState;
|
class PlayerState;
|
||||||
|
|
||||||
class PercentageDisplay: public ActorFrame
|
class PercentageDisplay: public ActorFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PercentageDisplay();
|
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 Update( float fDeltaTime );
|
||||||
void TweenOffScreen();
|
void TweenOffScreen();
|
||||||
|
|
||||||
@@ -27,8 +27,8 @@ private:
|
|||||||
ThemeMetric<bool> APPLY_SCORE_DISPLAY_OPTIONS;
|
ThemeMetric<bool> APPLY_SCORE_DISPLAY_OPTIONS;
|
||||||
|
|
||||||
void Refresh();
|
void Refresh();
|
||||||
PlayerNumber m_PlayerNumber;
|
const PlayerState *m_pPlayerState;
|
||||||
PlayerStageStats *m_pSource;
|
const PlayerStageStats *m_pPlayerStageStats;
|
||||||
bool m_bAutoRefresh;
|
bool m_bAutoRefresh;
|
||||||
int m_Last;
|
int m_Last;
|
||||||
int m_LastMax;
|
int m_LastMax;
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ void ScreenEvaluation::Init()
|
|||||||
/* Use "ScreenEvaluation Percent" for the [metric set], but position and
|
/* Use "ScreenEvaluation Percent" for the [metric set], but position and
|
||||||
* tween it with "PercentP1X", etc. */
|
* tween it with "PercentP1X", etc. */
|
||||||
m_Percent[p].SetName( ssprintf("PercentP%d",p+1) );
|
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] );
|
SET_XY_AND_ON_COMMAND( m_Percent[p] );
|
||||||
this->AddChild( &m_Percent[p] );
|
this->AddChild( &m_Percent[p] );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "CharacterManager.h"
|
#include "CharacterManager.h"
|
||||||
|
#include "StatsManager.h"
|
||||||
|
|
||||||
static const ThemeMetric<CString> STEPFILE ("ScreenHowToPlay","Stepfile");
|
static const ThemeMetric<CString> STEPFILE ("ScreenHowToPlay","Stepfile");
|
||||||
static const ThemeMetric<int> NUM_PERFECTS ("ScreenHowToPlay","NumPerfects");
|
static const ThemeMetric<int> NUM_PERFECTS ("ScreenHowToPlay","NumPerfects");
|
||||||
@@ -125,7 +126,7 @@ void ScreenHowToPlay::Init()
|
|||||||
{
|
{
|
||||||
m_pLifeMeterBar = new LifeMeterBar;
|
m_pLifeMeterBar = new LifeMeterBar;
|
||||||
m_pLifeMeterBar->SetName("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 );
|
SET_XY_AND_ON_COMMAND( m_pLifeMeterBar );
|
||||||
m_pLifeMeterBar->FillForHowToPlay( NUM_PERFECTS, NUM_MISSES );
|
m_pLifeMeterBar->FillForHowToPlay( NUM_PERFECTS, NUM_MISSES );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user