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
+5 -4
View File
@@ -11,6 +11,7 @@
#include "CodeDetector.h"
#include "ScreenDimensions.h"
#include "Style.h"
#include "PlayerState.h"
#define PREV_SCREEN THEME->GetMetric ("ScreenPlayerOptions","PrevScreen")
@@ -123,8 +124,8 @@ void ScreenPlayerOptions::Input( const DeviceInput& DeviceI, const InputEventTyp
SOUND->PlayOnce( THEME->GetPathToS("ScreenPlayerOptions cancel all") );
// apply the game default mods, but not the Profile saved mods
GAMESTATE->m_PlayerOptions[pn].Init();
GAMESTATE->m_PlayerOptions[pn].FromString( PREFSMAN->m_sDefaultModifiers );
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.Init();
GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.FromString( PREFSMAN->m_sDefaultModifiers );
UtilCommand( m_sprCancelAll[pn], m_sName, "Show" );
@@ -176,7 +177,7 @@ void ScreenPlayerOptions::UpdateDisqualified()
FOREACH_PlayerNumber( p )
{
po[p] = GAMESTATE->m_PlayerOptions[p];
po[p] = GAMESTATE->m_pPlayerState[p]->m_PlayerOptions;
}
// export the currently selection options, which will fill GAMESTATE->m_PlayerOptions
@@ -189,7 +190,7 @@ void ScreenPlayerOptions::UpdateDisqualified()
m_sprDisqualify[p]->SetHidden( !bIsHandicap );
// restore previous player options in case the user escapes back after this
GAMESTATE->m_PlayerOptions[p] = po[p];
GAMESTATE->m_pPlayerState[p]->m_PlayerOptions = po[p];
}
}