pass around a PlayerState and PlayerStageStats instead of PlayerNumber and looking things up in GameState
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
#include "ActorFrame.h"
|
#include "ActorFrame.h"
|
||||||
|
|
||||||
|
class PlayerState;
|
||||||
|
class PlayerStageStats;
|
||||||
|
|
||||||
class LifeMeter : public ActorFrame
|
class LifeMeter : public ActorFrame
|
||||||
{
|
{
|
||||||
@@ -12,7 +14,11 @@ public:
|
|||||||
LifeMeter() {};
|
LifeMeter() {};
|
||||||
virtual ~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 OnLoadSong() {};
|
||||||
virtual void OnSongEnded() {};
|
virtual void OnSongEnded() {};
|
||||||
/* Change life after receiving a tap note grade. This *is* called for
|
/* Change life after receiving a tap note grade. This *is* called for
|
||||||
@@ -30,7 +36,8 @@ public:
|
|||||||
virtual void ForceFail() = 0;
|
virtual void ForceFail() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PlayerNumber m_PlayerNumber;
|
const PlayerState *m_pPlayerState;
|
||||||
|
PlayerStageStats *m_pPlayerStageStats;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -100,15 +100,17 @@ LifeMeterBar::~LifeMeterBar()
|
|||||||
SAFE_DELETE( m_pStream );
|
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
|
// Change life difficulty to really easy if merciful beginner on
|
||||||
bool bMercifulBeginnerInEffect =
|
bool bMercifulBeginnerInEffect =
|
||||||
GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR &&
|
GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR &&
|
||||||
GAMESTATE->IsPlayerEnabled( pn ) &&
|
GAMESTATE->IsPlayerEnabled( pPlayerState ) &&
|
||||||
GAMESTATE->m_pCurSteps[m_PlayerNumber]->GetDifficulty() == DIFFICULTY_BEGINNER &&
|
GAMESTATE->m_pCurSteps[pn]->GetDifficulty() == DIFFICULTY_BEGINNER &&
|
||||||
PREFSMAN->m_bMercifulBeginner;
|
PREFSMAN->m_bMercifulBeginner;
|
||||||
if( bMercifulBeginnerInEffect )
|
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 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;
|
fDeltaLife = 0;
|
||||||
|
|
||||||
switch( GAMESTATE->m_SongOptions.m_DrainType )
|
switch( GAMESTATE->m_SongOptions.m_DrainType )
|
||||||
@@ -277,7 +279,7 @@ void LifeMeterBar::ChangeLife( float fDeltaLife )
|
|||||||
AfterLifeChanged();
|
AfterLifeChanged();
|
||||||
|
|
||||||
if( m_fLifePercentage <= FAIL_THRESHOLD )
|
if( m_fLifePercentage <= FAIL_THRESHOLD )
|
||||||
STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier = true;
|
m_pPlayerStageStats->bFailedEarlier = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LifeMeterBar::AfterLifeChanged()
|
void LifeMeterBar::AfterLifeChanged()
|
||||||
@@ -287,9 +289,9 @@ void LifeMeterBar::AfterLifeChanged()
|
|||||||
|
|
||||||
bool LifeMeterBar::IsPastPassmark() const
|
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
|
else
|
||||||
{
|
{
|
||||||
@@ -326,7 +328,7 @@ void LifeMeterBar::Update( float fDeltaTime )
|
|||||||
m_pStream->SetPassingAlpha( m_fPassingAlpha );
|
m_pStream->SetPassingAlpha( m_fPassingAlpha );
|
||||||
m_pStream->SetHotAlpha( m_fHotAlpha );
|
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 );
|
m_quadDangerGlow.SetDiffuseAlpha( 1 );
|
||||||
else
|
else
|
||||||
m_quadDangerGlow.SetDiffuseAlpha( 0 );
|
m_quadDangerGlow.SetDiffuseAlpha( 0 );
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public:
|
|||||||
LifeMeterBar();
|
LifeMeterBar();
|
||||||
~LifeMeterBar();
|
~LifeMeterBar();
|
||||||
|
|
||||||
virtual void Load( PlayerNumber pn );
|
virtual void Load( const PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats );
|
||||||
|
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "Steps.h"
|
#include "Steps.h"
|
||||||
#include "StatsManager.h"
|
#include "PlayerState.h"
|
||||||
|
|
||||||
|
|
||||||
const float BATTERY_X[NUM_PLAYERS] = { -92, +92 };
|
const float BATTERY_X[NUM_PLAYERS] = { -92, +92 };
|
||||||
@@ -25,11 +25,11 @@ LifeMeterBattery::LifeMeterBattery()
|
|||||||
m_soundLoseLife.Load( THEME->GetPathS("LifeMeterBattery","lose"),true );
|
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") );
|
m_sprFrame.Load( THEME->GetPathG("LifeMeterBattery","frame") );
|
||||||
this->AddChild( &m_sprFrame );
|
this->AddChild( &m_sprFrame );
|
||||||
@@ -45,6 +45,8 @@ void LifeMeterBattery::Load( PlayerNumber pn )
|
|||||||
if( bPlayerEnabled )
|
if( bPlayerEnabled )
|
||||||
this->AddChild( &m_textNumLives );
|
this->AddChild( &m_textNumLives );
|
||||||
|
|
||||||
|
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
m_sprFrame.SetZoomX( pn==PLAYER_1 ? 1.0f : -1.0f );
|
m_sprFrame.SetZoomX( pn==PLAYER_1 ? 1.0f : -1.0f );
|
||||||
m_sprBattery.SetZoomX( pn==PLAYER_1 ? 1.0f : -1.0f );
|
m_sprBattery.SetZoomX( pn==PLAYER_1 ? 1.0f : -1.0f );
|
||||||
m_sprBattery.SetX( BATTERY_X[pn] );
|
m_sprBattery.SetX( BATTERY_X[pn] );
|
||||||
@@ -53,7 +55,7 @@ void LifeMeterBattery::Load( PlayerNumber pn )
|
|||||||
|
|
||||||
if( bPlayerEnabled )
|
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 );
|
this->AddChild( &m_Percent );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,13 +64,14 @@ void LifeMeterBattery::Load( PlayerNumber pn )
|
|||||||
|
|
||||||
void LifeMeterBattery::OnSongEnded()
|
void LifeMeterBattery::OnSongEnded()
|
||||||
{
|
{
|
||||||
if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier )
|
if( m_pPlayerStageStats->bFailedEarlier )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( m_iLivesLeft < GAMESTATE->m_SongOptions.m_iBatteryLives )
|
if( m_iLivesLeft < GAMESTATE->m_SongOptions.m_iBatteryLives )
|
||||||
{
|
{
|
||||||
m_iTrailingLivesLeft = m_iLivesLeft;
|
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_iLivesLeft = min( m_iLivesLeft, GAMESTATE->m_SongOptions.m_iBatteryLives );
|
||||||
m_soundGainLife.Play();
|
m_soundGainLife.Play();
|
||||||
}
|
}
|
||||||
@@ -79,7 +82,7 @@ void LifeMeterBattery::OnSongEnded()
|
|||||||
|
|
||||||
void LifeMeterBattery::ChangeLife( TapNoteScore score )
|
void LifeMeterBattery::ChangeLife( TapNoteScore score )
|
||||||
{
|
{
|
||||||
if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier )
|
if( m_pPlayerStageStats->bFailedEarlier )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch( score )
|
switch( score )
|
||||||
@@ -107,7 +110,7 @@ void LifeMeterBattery::ChangeLife( TapNoteScore score )
|
|||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
if( m_iLivesLeft == 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 )
|
void LifeMeterBattery::ChangeLife( HoldNoteScore score, TapNoteScore tscore )
|
||||||
@@ -145,7 +148,7 @@ bool LifeMeterBattery::IsHot() const
|
|||||||
|
|
||||||
bool LifeMeterBattery::IsFailing() const
|
bool LifeMeterBattery::IsFailing() const
|
||||||
{
|
{
|
||||||
return STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier;
|
return m_pPlayerStageStats->bFailedEarlier;
|
||||||
}
|
}
|
||||||
|
|
||||||
float LifeMeterBattery::GetLife() const
|
float LifeMeterBattery::GetLife() const
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class LifeMeterBattery : public LifeMeter
|
|||||||
public:
|
public:
|
||||||
LifeMeterBattery();
|
LifeMeterBattery();
|
||||||
|
|
||||||
virtual void Load( PlayerNumber pn );
|
virtual void Load( const PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats );
|
||||||
|
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "LifeMeterTime.h"
|
#include "LifeMeterTime.h"
|
||||||
#include "GameState.h"
|
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "Steps.h"
|
#include "Steps.h"
|
||||||
#include "StatsManager.h"
|
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
#include "Course.h"
|
#include "Course.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "StreamDisplay.h"
|
#include "StreamDisplay.h"
|
||||||
|
#include "GameState.h"
|
||||||
|
#include "StatsManager.h"
|
||||||
|
|
||||||
const float FULL_LIFE_SECONDS = 1.5f*60;
|
const float FULL_LIFE_SECONDS = 1.5f*60;
|
||||||
|
|
||||||
@@ -24,9 +24,9 @@ LifeMeterTime::LifeMeterTime()
|
|||||||
m_fLifeTotalLostSeconds = 0;
|
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";
|
const CString sType = "LifeMeterTime";
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ void LifeMeterTime::Load( PlayerNumber pn )
|
|||||||
|
|
||||||
void LifeMeterTime::OnLoadSong()
|
void LifeMeterTime::OnLoadSong()
|
||||||
{
|
{
|
||||||
if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier )
|
if( m_pPlayerStageStats->bFailedEarlier )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Course* pCourse = GAMESTATE->m_pCurCourse;
|
Course* pCourse = GAMESTATE->m_pCurCourse;
|
||||||
@@ -85,7 +85,7 @@ void LifeMeterTime::OnLoadSong()
|
|||||||
|
|
||||||
void LifeMeterTime::ChangeLife( TapNoteScore tns )
|
void LifeMeterTime::ChangeLife( TapNoteScore tns )
|
||||||
{
|
{
|
||||||
if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier )
|
if( m_pPlayerStageStats->bFailedEarlier )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float fMeterChange = 0;
|
float fMeterChange = 0;
|
||||||
@@ -104,12 +104,12 @@ void LifeMeterTime::ChangeLife( TapNoteScore tns )
|
|||||||
m_fLifeTotalLostSeconds -= fMeterChange;
|
m_fLifeTotalLostSeconds -= fMeterChange;
|
||||||
|
|
||||||
if( GetLifeSeconds() <= 0 )
|
if( GetLifeSeconds() <= 0 )
|
||||||
STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier = true;
|
m_pPlayerStageStats->bFailedEarlier = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LifeMeterTime::ChangeLife( HoldNoteScore hns, TapNoteScore tns )
|
void LifeMeterTime::ChangeLife( HoldNoteScore hns, TapNoteScore tns )
|
||||||
{
|
{
|
||||||
if( STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier )
|
if( m_pPlayerStageStats->bFailedEarlier )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float fMeterChange = 0;
|
float fMeterChange = 0;
|
||||||
@@ -123,7 +123,7 @@ void LifeMeterTime::ChangeLife( HoldNoteScore hns, TapNoteScore tns )
|
|||||||
m_fLifeTotalLostSeconds -= fMeterChange;
|
m_fLifeTotalLostSeconds -= fMeterChange;
|
||||||
|
|
||||||
if( GetLifeSeconds() <= 0 )
|
if( GetLifeSeconds() <= 0 )
|
||||||
STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier = true;
|
m_pPlayerStageStats->bFailedEarlier = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LifeMeterTime::OnDancePointsChange()
|
void LifeMeterTime::OnDancePointsChange()
|
||||||
@@ -143,7 +143,7 @@ bool LifeMeterTime::IsHot() const
|
|||||||
|
|
||||||
bool LifeMeterTime::IsFailing() const
|
bool LifeMeterTime::IsFailing() const
|
||||||
{
|
{
|
||||||
return STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].bFailedEarlier;
|
return m_pPlayerStageStats->bFailedEarlier;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LifeMeterTime::Update( float fDeltaTime )
|
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
|
// update current stage stats so ScoreDisplayLifeTime can show the right thing
|
||||||
float fSecs = GetLifeSeconds();
|
float fSecs = GetLifeSeconds();
|
||||||
fSecs = max( 0, fSecs );
|
fSecs = max( 0, fSecs );
|
||||||
STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].fLifeRemainingSeconds = fSecs;
|
m_pPlayerStageStats->fLifeRemainingSeconds = fSecs;
|
||||||
|
|
||||||
LifeMeter::Update( fDeltaTime );
|
LifeMeter::Update( fDeltaTime );
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ void LifeMeterTime::Update( float fDeltaTime )
|
|||||||
m_pStream->SetPassingAlpha( 0 );
|
m_pStream->SetPassingAlpha( 0 );
|
||||||
m_pStream->SetHotAlpha( 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 );
|
m_quadDangerGlow.SetDiffuseAlpha( 1 );
|
||||||
else
|
else
|
||||||
m_quadDangerGlow.SetDiffuseAlpha( 0 );
|
m_quadDangerGlow.SetDiffuseAlpha( 0 );
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class LifeMeterTime : public LifeMeter
|
|||||||
public:
|
public:
|
||||||
LifeMeterTime();
|
LifeMeterTime();
|
||||||
|
|
||||||
virtual void Load( PlayerNumber pn );
|
virtual void Load( const PlayerState *pPlayerState, PlayerStageStats *pPlayerStageStats );
|
||||||
|
|
||||||
virtual void Update( float fDeltaTime );
|
virtual void Update( float fDeltaTime );
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,8 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "ScoreDisplay.h"
|
#include "ScoreDisplay.h"
|
||||||
|
|
||||||
|
void ScoreDisplay::Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats )
|
||||||
|
{
|
||||||
|
m_pPlayerState = pPlayerState;
|
||||||
|
m_pPlayerStageStats = pPlayerStageStats;
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,12 +5,13 @@
|
|||||||
#include "ActorFrame.h"
|
#include "ActorFrame.h"
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
|
|
||||||
struct PlayerState;
|
class PlayerState;
|
||||||
|
class PlayerStageStats;
|
||||||
|
|
||||||
class ScoreDisplay : public ActorFrame
|
class ScoreDisplay : public ActorFrame
|
||||||
{
|
{
|
||||||
public:
|
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 SetScore( int iNewScore ) {}
|
||||||
virtual void OnLoadSong() {};
|
virtual void OnLoadSong() {};
|
||||||
@@ -23,7 +24,8 @@ public:
|
|||||||
virtual void OnJudgment( HoldNoteScore score, TapNoteScore tscore ) {};
|
virtual void OnJudgment( HoldNoteScore score, TapNoteScore tscore ) {};
|
||||||
|
|
||||||
protected:
|
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
|
#endif
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ ScoreDisplayBattle::ScoreDisplayBattle()
|
|||||||
m_TexturePreload.Load( asIconPaths[j] );
|
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 )
|
void ScoreDisplayBattle::Update( float fDelta )
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class ScoreDisplayBattle : public ScoreDisplay
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScoreDisplayBattle();
|
ScoreDisplayBattle();
|
||||||
virtual void Init( const PlayerState* pPlayerState );
|
virtual void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats );
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
|
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ ScoreDisplayLifeTime::ScoreDisplayLifeTime()
|
|||||||
LOG->Trace( "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";
|
const CString sType = "ScoreDisplayLifeTime";
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ void ScoreDisplayLifeTime::Update( float fDelta )
|
|||||||
{
|
{
|
||||||
ScoreDisplay::Update( 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);
|
CString s = SecondsToMSSMsMs(fSecs);
|
||||||
m_textTimeRemaining.SetText( s );
|
m_textTimeRemaining.SetText( s );
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class ScoreDisplayLifeTime : public ScoreDisplay
|
|||||||
public:
|
public:
|
||||||
ScoreDisplayLifeTime();
|
ScoreDisplayLifeTime();
|
||||||
|
|
||||||
virtual void Init( const PlayerState* pPlayerState );
|
virtual void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats );
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ ScoreDisplayNormal::ScoreDisplayNormal()
|
|||||||
this->AddChild( &m_text );
|
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.
|
// TODO: Remove use of PlayerNumber.
|
||||||
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class ScoreDisplayNormal : public ScoreDisplay
|
|||||||
public:
|
public:
|
||||||
ScoreDisplayNormal();
|
ScoreDisplayNormal();
|
||||||
|
|
||||||
virtual void Init( const PlayerState* pPlayerState );
|
virtual void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats );
|
||||||
|
|
||||||
virtual void SetScore( int iNewScore );
|
virtual void SetScore( int iNewScore );
|
||||||
virtual void SetText( CString s ) { m_text.SetText(s); }
|
virtual void SetText( CString s ) { m_text.SetText(s); }
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ ScoreDisplayOni::ScoreDisplayOni()
|
|||||||
this->AddChild( &m_text );
|
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.
|
// TODO: Remove use of PlayerNumber.
|
||||||
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class ScoreDisplayOni : public ScoreDisplay
|
|||||||
public:
|
public:
|
||||||
ScoreDisplayOni();
|
ScoreDisplayOni();
|
||||||
|
|
||||||
virtual void Init( const PlayerState* pPlayerState );
|
virtual void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats );
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,13 @@ ScoreDisplayPercentage::ScoreDisplayPercentage()
|
|||||||
this->AddChild( &m_Percent );
|
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(
|
m_Percent.Load(
|
||||||
pPlayerState->m_PlayerNumber,
|
pPlayerState,
|
||||||
&STATSMAN->m_CurStageStats.m_player[pPlayerState->m_PlayerNumber],
|
pPlayerStageStats,
|
||||||
"ScoreDisplayPercentage Percent",
|
"ScoreDisplayPercentage Percent",
|
||||||
true );
|
true );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class ScoreDisplayPercentage: public ScoreDisplay
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScoreDisplayPercentage();
|
ScoreDisplayPercentage();
|
||||||
void Init( const PlayerState* pPlayerState );
|
void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AutoActor m_sprFrame;
|
AutoActor m_sprFrame;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "GameState.h"
|
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "ActorUtil.h"
|
#include "ActorUtil.h"
|
||||||
#include "PlayerState.h"
|
#include "PlayerState.h"
|
||||||
@@ -34,9 +33,9 @@ ScoreDisplayRave::ScoreDisplayRave()
|
|||||||
this->AddChild( &m_textLevel );
|
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;
|
PlayerNumber pn = pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class ScoreDisplayRave : public ScoreDisplay
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ScoreDisplayRave();
|
ScoreDisplayRave();
|
||||||
virtual void Init( const PlayerState* pPlayerState );
|
virtual void Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats );
|
||||||
|
|
||||||
virtual void Update( float fDelta );
|
virtual void Update( float fDelta );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user