Move some player-specific data out of the bloated GameState class.

Have gameplay objects hold a PlayerState pointer instead of a PlayerNumber and indexing back into GameState.
This will simplify off-screen players (e.g. CPU ghosts, network replicated human players, >2 players using one NoteField)
This commit is contained in:
Chris Danford
2004-12-20 06:25:59 +00:00
parent 52545966e6
commit f840c014a9
70 changed files with 977 additions and 655 deletions
+7 -3
View File
@@ -8,6 +8,7 @@
#include "RageLog.h"
#include "RageUtil.h"
#include "Game.h"
#include "PlayerState.h"
ReceptorArrow::ReceptorArrow()
@@ -16,11 +17,14 @@ ReceptorArrow::ReceptorArrow()
StopAnimating();
}
bool ReceptorArrow::Load( CString NoteSkin, PlayerNumber pn, int iColNo )
bool ReceptorArrow::Load( CString NoteSkin, const PlayerState* pPlayerState, int iColNo )
{
m_PlayerNumber = pn;
m_pPlayerState = pPlayerState;
m_iColNo = iColNo;
// TODO: Remove use of PlayerNumber.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
NoteFieldMode &mode = g_NoteFieldMode[pn];
CString sButton = mode.GrayButtonNames[iColNo];
if( sButton == "" )
@@ -55,7 +59,7 @@ void ReceptorArrow::Update( float fDeltaTime )
ActorFrame::Update( fDeltaTime );
// update pressblock alignment based on scroll direction
bool bReverse = GAMESTATE->m_PlayerOptions[m_PlayerNumber].GetReversePercentForColumn(m_iColNo) > 0.5;
bool bReverse = m_pPlayerState->m_PlayerOptions.GetReversePercentForColumn(m_iColNo) > 0.5;
m_pPressBlock->SetVertAlign( bReverse ? Actor::align_bottom : Actor::align_top );
}