Some respect for OOP. (MasterPlayerNumber)

This commit is contained in:
Jason Felds
2011-06-06 20:40:11 -04:00
parent 963cc9d4f1
commit 0a7b9ce170
33 changed files with 106 additions and 94 deletions
+2 -2
View File
@@ -49,7 +49,7 @@ void AutoKeysounds::LoadAutoplaySoundsInto( RageSoundReader_Chain *pChain )
* Add all current autoplay sounds in both players to the chain. If a sound is * Add all current autoplay sounds in both players to the chain. If a sound is
* common to both players, don't pan it; otherwise pan it to that player's side. * common to both players, don't pan it; otherwise pan it to that player's side.
*/ */
int iNumTracks = m_ndAutoKeysoundsOnly[GAMESTATE->m_MasterPlayerNumber].GetNumTracks(); int iNumTracks = m_ndAutoKeysoundsOnly[GAMESTATE->GetMasterPlayerNumber()].GetNumTracks();
for( int t = 0; t < iNumTracks; t++ ) for( int t = 0; t < iNumTracks; t++ )
{ {
int iRow = -1; int iRow = -1;
@@ -297,7 +297,7 @@ void AutoKeysounds::FinishLoading()
apSounds.push_back( m_pPlayerSounds[1] ); apSounds.push_back( m_pPlayerSounds[1] );
} }
if( GAMESTATE->GetNumPlayersEnabled() == 1 && GAMESTATE->m_MasterPlayerNumber == PLAYER_2 ) if( GAMESTATE->GetNumPlayersEnabled() == 1 && GAMESTATE->GetMasterPlayerNumber() == PLAYER_2 )
swap( m_pPlayerSounds[PLAYER_1], m_pPlayerSounds[PLAYER_2] ); swap( m_pPlayerSounds[PLAYER_1], m_pPlayerSounds[PLAYER_2] );
if( apSounds.size() > 1 ) if( apSounds.size() > 1 )
+2 -2
View File
@@ -42,9 +42,9 @@ void CourseContentsList::SetFromGameState()
{ {
RemoveAllChildren(); RemoveAllChildren();
if( GAMESTATE->m_MasterPlayerNumber == PlayerNumber_Invalid ) if( GAMESTATE->GetMasterPlayerNumber() == PlayerNumber_Invalid )
return; return;
const Trail *pMasterTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber]; const Trail *pMasterTrail = GAMESTATE->m_pCurTrail[GAMESTATE->GetMasterPlayerNumber()];
if( pMasterTrail == NULL ) if( pMasterTrail == NULL )
return; return;
unsigned uNumEntriesToShow = pMasterTrail->m_vEntries.size(); unsigned uNumEntriesToShow = pMasterTrail->m_vEntries.size();
+30 -20
View File
@@ -190,6 +190,16 @@ GameState::~GameState()
SAFE_DELETE( g_pImpl ); SAFE_DELETE( g_pImpl );
} }
PlayerNumber GameState::GetMasterPlayerNumber() const
{
return this->masterPlayerNumber;
}
void GameState::SetMasterPlayerNumber(const PlayerNumber p)
{
this->masterPlayerNumber = p;
}
void GameState::ApplyGameCommand( const RString &sCommand, PlayerNumber pn ) void GameState::ApplyGameCommand( const RString &sCommand, PlayerNumber pn )
{ {
GameCommand m; GameCommand m;
@@ -244,7 +254,7 @@ void GameState::ResetPlayer( PlayerNumber pn )
void GameState::Reset() void GameState::Reset()
{ {
m_MasterPlayerNumber = PLAYER_INVALID; // must initialize for UnjoinPlayer this->SetMasterPlayerNumber(PLAYER_INVALID); // must initialize for UnjoinPlayer
FOREACH_PlayerNumber( pn ) FOREACH_PlayerNumber( pn )
UnjoinPlayer( pn ); UnjoinPlayer( pn );
@@ -334,14 +344,14 @@ void GameState::JoinPlayer( PlayerNumber pn )
* give the new player the same number of stage tokens that the old player * give the new player the same number of stage tokens that the old player
* has. */ * has. */
if( GetCoinMode() == CoinMode_Pay && GetPremium() == Premium_2PlayersFor1Credit && GetNumSidesJoined() == 1 ) if( GetCoinMode() == CoinMode_Pay && GetPremium() == Premium_2PlayersFor1Credit && GetNumSidesJoined() == 1 )
m_iPlayerStageTokens[pn] = m_iPlayerStageTokens[m_MasterPlayerNumber]; m_iPlayerStageTokens[pn] = m_iPlayerStageTokens[this->GetMasterPlayerNumber()];
else else
m_iPlayerStageTokens[pn] = PREFSMAN->m_iSongsPerPlay; m_iPlayerStageTokens[pn] = PREFSMAN->m_iSongsPerPlay;
m_bSideIsJoined[pn] = true; m_bSideIsJoined[pn] = true;
if( m_MasterPlayerNumber == PLAYER_INVALID ) if( this->GetMasterPlayerNumber() == PLAYER_INVALID )
m_MasterPlayerNumber = pn; this->SetMasterPlayerNumber(pn);
// if first player to join, set start time // if first player to join, set start time
if( GetNumSidesJoined() == 1 ) if( GetNumSidesJoined() == 1 )
@@ -385,8 +395,8 @@ void GameState::UnjoinPlayer( PlayerNumber pn )
ResetPlayer( pn ); ResetPlayer( pn );
if( m_MasterPlayerNumber == pn ) if( this->GetMasterPlayerNumber() == pn )
m_MasterPlayerNumber = GetFirstHumanPlayer(); this->SetMasterPlayerNumber(GetFirstHumanPlayer());
/* Unjoin STATSMAN first, so steps used by this player are released /* Unjoin STATSMAN first, so steps used by this player are released
* and can be released by PROFILEMAN. */ * and can be released by PROFILEMAN. */
@@ -398,7 +408,7 @@ void GameState::UnjoinPlayer( PlayerNumber pn )
MESSAGEMAN->Broadcast( msg ); MESSAGEMAN->Broadcast( msg );
// If there are no players left, reset some non-player-specific stuff, too. // If there are no players left, reset some non-player-specific stuff, too.
if( m_MasterPlayerNumber == PLAYER_INVALID ) if( this->GetMasterPlayerNumber() == PLAYER_INVALID )
{ {
SongOptions so; SongOptions so;
GetDefaultSongOptions( so ); GetDefaultSongOptions( so );
@@ -635,8 +645,8 @@ int GameState::GetNumStagesForCurrentSongAndStepsOrCourse() const
if( pStyle == NULL ) if( pStyle == NULL )
{ {
const Steps *pSteps = NULL; const Steps *pSteps = NULL;
if( m_MasterPlayerNumber != PlayerNumber_Invalid ) if( this->GetMasterPlayerNumber() != PlayerNumber_Invalid )
pSteps = m_pCurSteps[m_MasterPlayerNumber]; pSteps = m_pCurSteps[this->GetMasterPlayerNumber()];
// Don't call GetFirstCompatibleStyle if numSidesJoined == 0. // Don't call GetFirstCompatibleStyle if numSidesJoined == 0.
// This happens because on SContinue when players are unjoined, // This happens because on SContinue when players are unjoined,
// pCurSteps will still be set while no players are joined. -Chris // pCurSteps will still be set while no players are joined. -Chris
@@ -994,9 +1004,9 @@ bool GameState::IsFinalStageForAnyHumanPlayer() const
bool GameState::IsAnExtraStage() const bool GameState::IsAnExtraStage() const
{ {
if( m_MasterPlayerNumber == PlayerNumber_Invalid ) if( this->GetMasterPlayerNumber() == PlayerNumber_Invalid )
return false; return false;
return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[m_MasterPlayerNumber] > 0; return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[this->GetMasterPlayerNumber()] > 0;
} }
static ThemeMetric<bool> LOCK_EXTRA_STAGE_SELECTION("GameState","LockExtraStageSelection"); static ThemeMetric<bool> LOCK_EXTRA_STAGE_SELECTION("GameState","LockExtraStageSelection");
@@ -1007,16 +1017,16 @@ bool GameState::IsAnExtraStageAndSelectionLocked() const
bool GameState::IsExtraStage() const bool GameState::IsExtraStage() const
{ {
if( m_MasterPlayerNumber == PlayerNumber_Invalid ) if( this->GetMasterPlayerNumber() == PlayerNumber_Invalid )
return false; return false;
return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[m_MasterPlayerNumber] == 1; return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[this->GetMasterPlayerNumber()] == 1;
} }
bool GameState::IsExtraStage2() const bool GameState::IsExtraStage2() const
{ {
if( m_MasterPlayerNumber == PlayerNumber_Invalid ) if( this->GetMasterPlayerNumber() == PlayerNumber_Invalid )
return false; return false;
return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[m_MasterPlayerNumber] == 2; return !IsEventMode() && !IsCourseMode() && m_iAwardedExtraStages[this->GetMasterPlayerNumber()] == 2;
} }
Stage GameState::GetCurrentStage() const Stage GameState::GetCurrentStage() const
@@ -1059,7 +1069,7 @@ int GameState::GetCourseSongIndex() const
} }
else else
{ {
return STATSMAN->m_CurStageStats.m_player[m_MasterPlayerNumber].m_iSongsPlayed-1; return STATSMAN->m_CurStageStats.m_player[this->GetMasterPlayerNumber()].m_iSongsPlayed-1;
} }
} }
@@ -1131,7 +1141,7 @@ void GameState::SetCurrentStyle( const Style *pStyle )
if( INPUTMAPPER ) if( INPUTMAPPER )
{ {
if( GetCurrentStyle() && GetCurrentStyle()->m_StyleType == StyleType_OnePlayerTwoSides ) if( GetCurrentStyle() && GetCurrentStyle()->m_StyleType == StyleType_OnePlayerTwoSides )
INPUTMAPPER->SetJoinControllers( m_MasterPlayerNumber ); INPUTMAPPER->SetJoinControllers( this->GetMasterPlayerNumber() );
else else
INPUTMAPPER->SetJoinControllers( PLAYER_INVALID ); INPUTMAPPER->SetJoinControllers( PLAYER_INVALID );
} }
@@ -1192,7 +1202,7 @@ bool GameState::IsHumanPlayer( PlayerNumber pn ) const
return true; return true;
case StyleType_OnePlayerOneSide: case StyleType_OnePlayerOneSide:
case StyleType_OnePlayerTwoSides: case StyleType_OnePlayerTwoSides:
return pn == m_MasterPlayerNumber; return pn == this->GetMasterPlayerNumber();
default: default:
ASSERT(0); // invalid style type ASSERT(0); // invalid style type
return false; return false;
@@ -1276,7 +1286,7 @@ EarnedExtraStage GameState::CalculateEarnedExtraStage() const
if( GetSmallestNumStagesLeftForAnyHumanPlayer() > 0 ) if( GetSmallestNumStagesLeftForAnyHumanPlayer() > 0 )
return EarnedExtraStage_No; return EarnedExtraStage_No;
if( m_iAwardedExtraStages[m_MasterPlayerNumber] >= 2 ) if( m_iAwardedExtraStages[this->GetMasterPlayerNumber()] >= 2 )
return EarnedExtraStage_No; return EarnedExtraStage_No;
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledPlayer( pn )
@@ -2124,7 +2134,7 @@ public:
DEFINE_METHOD( IsPlayerEnabled, IsPlayerEnabled(Enum::Check<PlayerNumber>(L, 1)) ) DEFINE_METHOD( IsPlayerEnabled, IsPlayerEnabled(Enum::Check<PlayerNumber>(L, 1)) )
DEFINE_METHOD( IsHumanPlayer, IsHumanPlayer(Enum::Check<PlayerNumber>(L, 1)) ) DEFINE_METHOD( IsHumanPlayer, IsHumanPlayer(Enum::Check<PlayerNumber>(L, 1)) )
DEFINE_METHOD( GetPlayerDisplayName, GetPlayerDisplayName(Enum::Check<PlayerNumber>(L, 1)) ) DEFINE_METHOD( GetPlayerDisplayName, GetPlayerDisplayName(Enum::Check<PlayerNumber>(L, 1)) )
DEFINE_METHOD( GetMasterPlayerNumber, m_MasterPlayerNumber ) DEFINE_METHOD( GetMasterPlayerNumber, GetMasterPlayerNumber() )
DEFINE_METHOD( GetMultiplayer, m_bMultiplayer ) DEFINE_METHOD( GetMultiplayer, m_bMultiplayer )
static int SetMultiplayer( T* p, lua_State *L ) static int SetMultiplayer( T* p, lua_State *L )
{ {
+8 -6
View File
@@ -35,6 +35,8 @@ class Trail;
/** @brief Holds game data that is not saved between sessions. */ /** @brief Holds game data that is not saved between sessions. */
class GameState class GameState
{ {
/** @brief The player number used with Styles where one player controls both sides. */
PlayerNumber masterPlayerNumber;
public: public:
/** @brief Set up the GameState with initial values. */ /** @brief Set up the GameState with initial values. */
GameState(); GameState();
@@ -91,8 +93,6 @@ public:
* to get one credit, only to have to put in another four coins to get * to get one credit, only to have to put in another four coins to get
* the three credits needed to begin the game. */ * the three credits needed to begin the game. */
BroadcastOnChange<int> m_iCoins; BroadcastOnChange<int> m_iCoins;
/** @brief The player number used with Styles where one player controls both sides. */
PlayerNumber m_MasterPlayerNumber;
bool m_bMultiplayer; bool m_bMultiplayer;
int m_iNumMultiplayerNoteFields; int m_iNumMultiplayerNoteFields;
bool DifficultiesLocked() const; bool DifficultiesLocked() const;
@@ -143,10 +143,12 @@ public:
/** /**
* @brief Retrieve the present master player number. * @brief Retrieve the present master player number.
* @return The master player number. */ * @return The master player number. */
PlayerNumber GetMasterPlayerNumber() const PlayerNumber GetMasterPlayerNumber() const;
{
return m_MasterPlayerNumber; /**
} * @brief Set the master player number.
* @param p the master player number. */
void SetMasterPlayerNumber(const PlayerNumber p);
bool IsCourseMode() const; bool IsCourseMode() const;
bool IsBattleMode() const; // not Rave bool IsBattleMode() const; // not Rave
+1 -1
View File
@@ -303,7 +303,7 @@ void NoteField::Update( float fDeltaTime )
// TODO: Remove use of PlayerNumber. // TODO: Remove use of PlayerNumber.
PlayerNumber pn = m_pPlayerState->m_PlayerNumber; PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
if( pn == GAMESTATE->m_MasterPlayerNumber ) if( pn == GAMESTATE->GetMasterPlayerNumber() )
NoteDisplay::Update( fDeltaTime ); NoteDisplay::Update( fDeltaTime );
} }
+3 -3
View File
@@ -196,7 +196,7 @@ RString OptionRow::GetRowTitle() const
if( GAMESTATE->m_pCurCourse ) if( GAMESTATE->m_pCurCourse )
{ {
const Trail* pTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber]; const Trail* pTrail = GAMESTATE->m_pCurTrail[GAMESTATE->GetMasterPlayerNumber()];
ASSERT( pTrail != NULL ); ASSERT( pTrail != NULL );
const int iNumCourseEntries = pTrail->m_vEntries.size(); const int iNumCourseEntries = pTrail->m_vEntries.size();
if( iNumCourseEntries > CommonMetrics::MAX_COURSE_ENTRIES_BEFORE_VARIOUS ) if( iNumCourseEntries > CommonMetrics::MAX_COURSE_ENTRIES_BEFORE_VARIOUS )
@@ -417,8 +417,8 @@ void OptionRow::AfterImportOptions( PlayerNumber pn )
// we need to copy p2 to p1, not p1 to p2. // we need to copy p2 to p1, not p1 to p2.
if( m_pHand->m_Def.m_bOneChoiceForAllPlayers ) if( m_pHand->m_Def.m_bOneChoiceForAllPlayers )
{ {
PlayerNumber pnCopyFrom = GAMESTATE->m_MasterPlayerNumber; PlayerNumber pnCopyFrom = GAMESTATE->GetMasterPlayerNumber();
if( GAMESTATE->m_MasterPlayerNumber == PLAYER_INVALID ) if( GAMESTATE->GetMasterPlayerNumber() == PLAYER_INVALID )
pnCopyFrom = PLAYER_1; pnCopyFrom = PLAYER_1;
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
m_vbSelected[p] = m_vbSelected[pnCopyFrom]; m_vbSelected[p] = m_vbSelected[pnCopyFrom];
+1 -1
View File
@@ -1375,7 +1375,7 @@ void Player::DrawPrimitives()
// May have both players in doubles (for battle play); only draw primary player. // May have both players in doubles (for battle play); only draw primary player.
if( GAMESTATE->GetCurrentStyle()->m_StyleType == StyleType_OnePlayerTwoSides && if( GAMESTATE->GetCurrentStyle()->m_StyleType == StyleType_OnePlayerTwoSides &&
pn != GAMESTATE->m_MasterPlayerNumber ) pn != GAMESTATE->GetMasterPlayerNumber() )
return; return;
// Draw these below everything else. // Draw these below everything else.
+1 -1
View File
@@ -162,7 +162,7 @@ void PlayerState::RebuildPlayerOptionsFromActiveAttacks()
so.FromString( m_ActiveAttacks[s].sModifiers ); so.FromString( m_ActiveAttacks[s].sModifiers );
} }
m_PlayerOptions.Assign( ModsLevel_Song, po ); m_PlayerOptions.Assign( ModsLevel_Song, po );
if( m_PlayerNumber == GAMESTATE->m_MasterPlayerNumber ) if( m_PlayerNumber == GAMESTATE->GetMasterPlayerNumber() )
GAMESTATE->m_SongOptions.Assign( ModsLevel_Song, so ); GAMESTATE->m_SongOptions.Assign( ModsLevel_Song, so );
int iSumOfAttackLevels = GetSumOfActiveAttackLevels(); int iSumOfAttackLevels = GetSumOfActiveAttackLevels();
+10 -10
View File
@@ -16,7 +16,7 @@ void ScoreKeeperShared::Load(
const vector<Steps*> &apSteps, const vector<Steps*> &apSteps,
const vector<AttackArray> &asModifiers ) const vector<AttackArray> &asModifiers )
{ {
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() )
return; return;
ScoreKeeperNormal::Load( apSongs, apSteps, asModifiers ); ScoreKeeperNormal::Load( apSongs, apSteps, asModifiers );
} }
@@ -24,63 +24,63 @@ void ScoreKeeperShared::Load(
// These ScoreKeepers don't get to draw. // These ScoreKeepers don't get to draw.
void ScoreKeeperShared::DrawPrimitives() void ScoreKeeperShared::DrawPrimitives()
{ {
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() )
return; return;
ScoreKeeperNormal::DrawPrimitives(); ScoreKeeperNormal::DrawPrimitives();
} }
void ScoreKeeperShared::Update( float fDelta ) void ScoreKeeperShared::Update( float fDelta )
{ {
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() )
return; return;
ScoreKeeperNormal::Update( fDelta ); ScoreKeeperNormal::Update( fDelta );
} }
void ScoreKeeperShared::OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData ) void ScoreKeeperShared::OnNextSong( int iSongInCourseIndex, const Steps* pSteps, const NoteData* pNoteData )
{ {
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() )
return; return;
ScoreKeeperNormal::OnNextSong( iSongInCourseIndex, pSteps, pNoteData ); ScoreKeeperNormal::OnNextSong( iSongInCourseIndex, pSteps, pNoteData );
} }
void ScoreKeeperShared::HandleTapScore( const TapNote &tn ) void ScoreKeeperShared::HandleTapScore( const TapNote &tn )
{ {
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() )
return; return;
ScoreKeeperNormal::HandleTapScore( tn ); ScoreKeeperNormal::HandleTapScore( tn );
} }
void ScoreKeeperShared::HandleTapRowScore( const NoteData &nd, int iRow ) void ScoreKeeperShared::HandleTapRowScore( const NoteData &nd, int iRow )
{ {
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() )
return; return;
ScoreKeeperNormal::HandleTapRowScore( nd, iRow ); ScoreKeeperNormal::HandleTapRowScore( nd, iRow );
} }
void ScoreKeeperShared::HandleHoldScore( const TapNote &tn ) void ScoreKeeperShared::HandleHoldScore( const TapNote &tn )
{ {
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() )
return; return;
ScoreKeeperNormal::HandleHoldScore( tn ); ScoreKeeperNormal::HandleHoldScore( tn );
} }
void ScoreKeeperShared::HandleHoldActiveSeconds( float fMusicSecondsHeld ) void ScoreKeeperShared::HandleHoldActiveSeconds( float fMusicSecondsHeld )
{ {
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() )
return; return;
ScoreKeeperNormal::HandleHoldActiveSeconds( fMusicSecondsHeld ); ScoreKeeperNormal::HandleHoldActiveSeconds( fMusicSecondsHeld );
} }
void ScoreKeeperShared::HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow ) void ScoreKeeperShared::HandleHoldCheckpointScore( const NoteData &nd, int iRow, int iNumHoldsHeldThisRow, int iNumHoldsMissedThisRow )
{ {
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() )
return; return;
ScoreKeeperNormal::HandleHoldCheckpointScore( nd, iRow, iNumHoldsHeldThisRow, iNumHoldsMissedThisRow ); ScoreKeeperNormal::HandleHoldCheckpointScore( nd, iRow, iNumHoldsHeldThisRow, iNumHoldsMissedThisRow );
} }
void ScoreKeeperShared::HandleTapScoreNone() void ScoreKeeperShared::HandleTapScoreNone()
{ {
if( m_pPlayerState->m_PlayerNumber != GAMESTATE->m_MasterPlayerNumber ) if( m_pPlayerState->m_PlayerNumber != GAMESTATE->GetMasterPlayerNumber() )
return; return;
ScoreKeeperNormal::HandleTapScoreNone(); ScoreKeeperNormal::HandleTapScoreNone();
} }
+3 -3
View File
@@ -598,8 +598,8 @@ class DebugLineAutoplay : public IDebugLine
virtual bool IsEnabled() { return GamePreferences::m_AutoPlay.Get() != PC_HUMAN; } virtual bool IsEnabled() { return GamePreferences::m_AutoPlay.Get() != PC_HUMAN; }
virtual void DoAndLog( RString &sMessageOut ) virtual void DoAndLog( RString &sMessageOut )
{ {
ASSERT( GAMESTATE->m_MasterPlayerNumber != PLAYER_INVALID ); ASSERT( GAMESTATE->GetMasterPlayerNumber() != PLAYER_INVALID );
PlayerController pc = GAMESTATE->m_pPlayerState[GAMESTATE->m_MasterPlayerNumber]->m_PlayerController; PlayerController pc = GAMESTATE->m_pPlayerState[GAMESTATE->GetMasterPlayerNumber()]->m_PlayerController;
bool bHoldingShift = bool bHoldingShift =
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) ) || INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) ) ||
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT) ); INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT) );
@@ -639,7 +639,7 @@ class DebugLineAssist : public IDebugLine
virtual bool IsEnabled() { return GAMESTATE->m_SongOptions.GetSong().m_bAssistClap || GAMESTATE->m_SongOptions.GetSong().m_bAssistMetronome; } virtual bool IsEnabled() { return GAMESTATE->m_SongOptions.GetSong().m_bAssistClap || GAMESTATE->m_SongOptions.GetSong().m_bAssistMetronome; }
virtual void DoAndLog( RString &sMessageOut ) virtual void DoAndLog( RString &sMessageOut )
{ {
ASSERT( GAMESTATE->m_MasterPlayerNumber != PLAYER_INVALID ); ASSERT( GAMESTATE->GetMasterPlayerNumber() != PLAYER_INVALID );
bool bHoldingShift = INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) ); bool bHoldingShift = INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) );
bool b; bool b;
if( bHoldingShift ) if( bHoldingShift )
+2 -2
View File
@@ -99,7 +99,7 @@ void ScreenEvaluation::Init()
ss.m_Stage = Stage_1st; ss.m_Stage = Stage_1st;
enum_add( ss.m_Stage, rand()%3 ); enum_add( ss.m_Stage, rand()%3 );
ss.m_EarnedExtraStage = (EarnedExtraStage)(rand() % NUM_EarnedExtraStage); ss.m_EarnedExtraStage = (EarnedExtraStage)(rand() % NUM_EarnedExtraStage);
GAMESTATE->m_MasterPlayerNumber = PLAYER_1; GAMESTATE->SetMasterPlayerNumber(PLAYER_1);
GAMESTATE->m_pCurSong.Set( SONGMAN->GetRandomSong() ); GAMESTATE->m_pCurSong.Set( SONGMAN->GetRandomSong() );
ss.m_vpPlayedSongs.push_back( GAMESTATE->m_pCurSong ); ss.m_vpPlayedSongs.push_back( GAMESTATE->m_pCurSong );
ss.m_vpPossibleSongs.push_back( GAMESTATE->m_pCurSong ); ss.m_vpPossibleSongs.push_back( GAMESTATE->m_pCurSong );
@@ -635,7 +635,7 @@ void ScreenEvaluation::Init()
{ {
case PLAY_MODE_BATTLE: case PLAY_MODE_BATTLE:
{ {
bool bWon = GAMESTATE->GetStageResult(GAMESTATE->m_MasterPlayerNumber) == RESULT_WIN; bool bWon = GAMESTATE->GetStageResult(GAMESTATE->GetMasterPlayerNumber()) == RESULT_WIN;
if( bWon ) if( bWon )
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("evaluation win") ); SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo("evaluation win") );
else else
+2 -2
View File
@@ -776,7 +776,7 @@ void ScreenGameplay::InitSongQueues()
ASSERT( pCourse ); ASSERT( pCourse );
m_apSongsQueue.clear(); m_apSongsQueue.clear();
PlayerNumber pnMaster = GAMESTATE->m_MasterPlayerNumber; PlayerNumber pnMaster = GAMESTATE->GetMasterPlayerNumber();
Trail *pTrail = GAMESTATE->m_pCurTrail[pnMaster]; Trail *pTrail = GAMESTATE->m_pCurTrail[pnMaster];
ASSERT( pTrail ); ASSERT( pTrail );
FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e ) FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e )
@@ -1227,7 +1227,7 @@ void ScreenGameplay::LoadNextSong()
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
{ {
RageSoundReader *pPlayerSound = m_AutoKeysounds.GetPlayerSound(pi->m_pn); RageSoundReader *pPlayerSound = m_AutoKeysounds.GetPlayerSound(pi->m_pn);
if( pPlayerSound == NULL && pi->m_pn == GAMESTATE->m_MasterPlayerNumber ) if( pPlayerSound == NULL && pi->m_pn == GAMESTATE->GetMasterPlayerNumber() )
pPlayerSound = m_AutoKeysounds.GetSharedSound(); pPlayerSound = m_AutoKeysounds.GetSharedSound();
pi->m_SoundEffectControl.SetSoundReader( pPlayerSound ); pi->m_SoundEffectControl.SetSoundReader( pPlayerSound );
} }
+2 -2
View File
@@ -11,7 +11,7 @@ REGISTER_SCREEN_CLASS( ScreenGameplayShared );
void ScreenGameplayShared::FillPlayerInfo( vector<PlayerInfo> &vPlayerInfoOut ) void ScreenGameplayShared::FillPlayerInfo( vector<PlayerInfo> &vPlayerInfoOut )
{ {
const PlayerNumber master = GAMESTATE->m_MasterPlayerNumber; const PlayerNumber master = GAMESTATE->GetMasterPlayerNumber();
const PlayerNumber other = (master == PLAYER_1? PLAYER_2:PLAYER_1); const PlayerNumber other = (master == PLAYER_1? PLAYER_2:PLAYER_1);
/* The master player is where all of the real work takes place. The other player exists /* The master player is where all of the real work takes place. The other player exists
@@ -23,7 +23,7 @@ void ScreenGameplayShared::FillPlayerInfo( vector<PlayerInfo> &vPlayerInfoOut )
PlayerInfo &ScreenGameplayShared::GetPlayerInfoForInput( const InputEventPlus& iep ) PlayerInfo &ScreenGameplayShared::GetPlayerInfoForInput( const InputEventPlus& iep )
{ {
return m_vPlayerInfo[GAMESTATE->m_MasterPlayerNumber]; return m_vPlayerInfo[GAMESTATE->GetMasterPlayerNumber()];
} }
/* /*
+1 -1
View File
@@ -172,7 +172,7 @@ void ScreenHowToPlay::Init()
// Don't show judgment // Don't show judgment
PO_GROUP_ASSIGN( GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, ModsLevel_Stage, m_fBlind, 1.0f ); PO_GROUP_ASSIGN( GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, ModsLevel_Stage, m_fBlind, 1.0f );
GAMESTATE->m_MasterPlayerNumber = PLAYER_1; GAMESTATE->SetMasterPlayerNumber(PLAYER_1);
GAMESTATE->m_bDemonstrationOrJukebox = true; GAMESTATE->m_bDemonstrationOrJukebox = true;
} }
+1 -1
View File
@@ -375,7 +375,7 @@ void ScreenInstallOverlay::Update( float fDeltaTime )
GAMEMAN->GetStylesForGame( GAMESTATE->m_pCurGame, vpStyle, false ); GAMEMAN->GetStylesForGame( GAMESTATE->m_pCurGame, vpStyle, false );
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR ); GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
GAMESTATE->m_bSideIsJoined[0] = true; GAMESTATE->m_bSideIsJoined[0] = true;
GAMESTATE->m_MasterPlayerNumber = PLAYER_1; GAMESTATE->SetMasterPlayerNumber(PLAYER_1);
GAMESTATE->m_pCurStyle.Set( vpStyle[0] ); GAMESTATE->m_pCurStyle.Set( vpStyle[0] );
GAMESTATE->m_pCurSong.Set( pSong ); GAMESTATE->m_pCurSong.Set( pSong );
GAMESTATE->m_pPreferredSong = pSong; GAMESTATE->m_pPreferredSong = pSong;
+1 -1
View File
@@ -179,7 +179,7 @@ void ScreenJukebox::Init()
// ASSERT( GAMESTATE->m_pCurSong ); // ASSERT( GAMESTATE->m_pCurSong );
GAMESTATE->m_MasterPlayerNumber = PLAYER_1; GAMESTATE->SetMasterPlayerNumber(PLAYER_1);
// choose some cool options // choose some cool options
int Benchmark = 0; int Benchmark = 0;
+1 -1
View File
@@ -107,7 +107,7 @@ void ScreenMiniMenu::AfterChangeValueOrRow( PlayerNumber pn )
OptionRow &optrow = *m_pRows[i]; OptionRow &optrow = *m_pRows[i];
optrow.GetRowDef().m_vEnabledForPlayers.clear(); optrow.GetRowDef().m_vEnabledForPlayers.clear();
if( mr.pfnEnabled() ) if( mr.pfnEnabled() )
optrow.GetRowDef().m_vEnabledForPlayers.insert( GAMESTATE->m_MasterPlayerNumber ); optrow.GetRowDef().m_vEnabledForPlayers.insert( GAMESTATE->GetMasterPlayerNumber() );
} }
m_pRows[i]->UpdateEnabledDisabled(); m_pRows[i]->UpdateEnabledDisabled();
} }
+1 -1
View File
@@ -118,7 +118,7 @@ ScreenNameEntry::ScreenNameEntry()
{ {
GAMESTATE->m_bSideIsJoined[PLAYER_1] = true; GAMESTATE->m_bSideIsJoined[PLAYER_1] = true;
GAMESTATE->m_bSideIsJoined[PLAYER_2] = true; GAMESTATE->m_bSideIsJoined[PLAYER_2] = true;
GAMESTATE->m_MasterPlayerNumber = PLAYER_1; GAMESTATE->SetMasterPlayerNumber(PLAYER_1);
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR ); GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
GAMESTATE->SetCurrentStyle( GAMEMAN->GameAndStringToStyle( GAMEMAN->GetDefaultGame(),"versus") ); GAMESTATE->SetCurrentStyle( GAMEMAN->GameAndStringToStyle( GAMEMAN->GetDefaultGame(),"versus") );
StageStats ss; StageStats ss;
+1 -1
View File
@@ -22,7 +22,7 @@ void ScreenNameEntryTraditional::Init()
{ {
GAMESTATE->m_bSideIsJoined[PLAYER_1] = true; GAMESTATE->m_bSideIsJoined[PLAYER_1] = true;
GAMESTATE->m_bSideIsJoined[PLAYER_2] = true; GAMESTATE->m_bSideIsJoined[PLAYER_2] = true;
GAMESTATE->m_MasterPlayerNumber = PLAYER_1; GAMESTATE->SetMasterPlayerNumber(PLAYER_1);
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR ); GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
GAMESTATE->SetCurrentStyle( GAMEMAN->GameAndStringToStyle( GAMEMAN->GetDefaultGame(),"versus") ); GAMESTATE->SetCurrentStyle( GAMEMAN->GameAndStringToStyle( GAMEMAN->GetDefaultGame(),"versus") );
for( int z = 0; z < 3; ++z ) for( int z = 0; z < 3; ++z )
+1 -1
View File
@@ -531,7 +531,7 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM )
return; // already transitioning return; // already transitioning
// If the selected option sets a screen, honor it. // If the selected option sets a screen, honor it.
RString sThisScreen = GetNextScreenForFocusedItem( GAMESTATE->m_MasterPlayerNumber ); RString sThisScreen = GetNextScreenForFocusedItem( GAMESTATE->GetMasterPlayerNumber() );
if( sThisScreen != "" ) if( sThisScreen != "" )
m_sNextScreen = sThisScreen; m_sNextScreen = sThisScreen;
+2 -2
View File
@@ -119,7 +119,7 @@ void ScreenOptionsCourseOverview::HandleScreenMessage( const ScreenMessage SM )
} }
else if( SM == SM_GoToNextScreen ) else if( SM == SM_GoToNextScreen )
{ {
int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
switch( iRow ) switch( iRow )
{ {
case CourseOverviewRow_Play: case CourseOverviewRow_Play:
@@ -191,7 +191,7 @@ void ScreenOptionsCourseOverview::ProcessMenuStart( const InputEventPlus &input
if( IsTransitioning() ) if( IsTransitioning() )
return; return;
int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
switch( iRow ) switch( iRow )
{ {
case CourseOverviewRow_Play: case CourseOverviewRow_Play:
+1 -1
View File
@@ -488,7 +488,7 @@ void ScreenOptionsEditCourse::ProcessMenuStart( const InputEventPlus &input )
if( IsTransitioning() ) if( IsTransitioning() )
return; return;
int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
unsigned iSongCount = GAMESTATE->m_pCurCourse->m_vEntries.size(); unsigned iSongCount = GAMESTATE->m_pCurCourse->m_vEntries.size();
+1 -1
View File
@@ -147,7 +147,7 @@ void ScreenOptionsExportPackage::ProcessMenuStart( const InputEventPlus &input )
if( IsTransitioning() ) if( IsTransitioning() )
return; return;
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit ) if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit )
{ {
ScreenOptions::ProcessMenuStart( input ); ScreenOptions::ProcessMenuStart( input );
+5 -5
View File
@@ -143,18 +143,18 @@ void ScreenOptionsManageCourses::BeginScreen()
if( iter != m_vpCourses.end() ) if( iter != m_vpCourses.end() )
{ {
iIndex = iter - m_vpCourses.begin(); iIndex = iter - m_vpCourses.begin();
this->MoveRowAbsolute( GAMESTATE->m_MasterPlayerNumber, 1 + iIndex ); this->MoveRowAbsolute( GAMESTATE->GetMasterPlayerNumber(), 1 + iIndex );
} }
} }
AfterChangeRow( GAMESTATE->m_MasterPlayerNumber ); AfterChangeRow( GAMESTATE->GetMasterPlayerNumber() );
} }
void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM ) void ScreenOptionsManageCourses::HandleScreenMessage( const ScreenMessage SM )
{ {
if( SM == SM_GoToNextScreen ) if( SM == SM_GoToNextScreen )
{ {
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
if( iCurRow == 0 ) // "create new" if( iCurRow == 0 ) // "create new"
{ {
@@ -218,7 +218,7 @@ void ScreenOptionsManageCourses::ProcessMenuStart( const InputEventPlus &input )
if( IsTransitioning() ) if( IsTransitioning() )
return; return;
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
if( iCurRow == 0 ) // "create new" if( iCurRow == 0 ) // "create new"
{ {
@@ -259,7 +259,7 @@ void ScreenOptionsManageCourses::ExportOptions( int iRow, const vector<PlayerNum
Course *ScreenOptionsManageCourses::GetCourseWithFocus() const Course *ScreenOptionsManageCourses::GetCourseWithFocus() const
{ {
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
if( iCurRow == 0 ) if( iCurRow == 0 )
return NULL; return NULL;
else if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit ) else if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit )
+3 -3
View File
@@ -125,7 +125,7 @@ void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM )
{ {
if( SM == SM_GoToNextScreen ) if( SM == SM_GoToNextScreen )
{ {
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
if( iCurRow == 0 ) // "create new" if( iCurRow == 0 ) // "create new"
{ {
@@ -245,7 +245,7 @@ void ScreenOptionsManageEditSteps::ProcessMenuStart( const InputEventPlus &input
if( IsTransitioning() ) if( IsTransitioning() )
return; return;
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
if( iCurRow == 0 ) // "create new" if( iCurRow == 0 ) // "create new"
{ {
@@ -292,7 +292,7 @@ void ScreenOptionsManageEditSteps::ExportOptions( int iRow, const vector<PlayerN
Steps *ScreenOptionsManageEditSteps::GetStepsWithFocus() const Steps *ScreenOptionsManageEditSteps::GetStepsWithFocus() const
{ {
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
if( iCurRow == 0 ) if( iCurRow == 0 )
return NULL; return NULL;
else if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit ) else if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit )
+3 -3
View File
@@ -167,7 +167,7 @@ void ScreenOptionsManageProfiles::HandleScreenMessage( const ScreenMessage SM )
{ {
if( SM == SM_GoToNextScreen ) if( SM == SM_GoToNextScreen )
{ {
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
OptionRow &row = *m_pRows[iCurRow]; OptionRow &row = *m_pRows[iCurRow];
if( row.GetRowType() == OptionRow::RowType_Exit ) if( row.GetRowType() == OptionRow::RowType_Exit )
{ {
@@ -337,7 +337,7 @@ void ScreenOptionsManageProfiles::ProcessMenuStart( const InputEventPlus &input
if( IsTransitioning() ) if( IsTransitioning() )
return; return;
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
OptionRow &row = *m_pRows[iCurRow]; OptionRow &row = *m_pRows[iCurRow];
if( SHOW_CREATE_NEW && iCurRow == 0 ) // "create new" if( SHOW_CREATE_NEW && iCurRow == 0 ) // "create new"
@@ -405,7 +405,7 @@ void ScreenOptionsManageProfiles::ExportOptions( int iRow, const vector<PlayerNu
int ScreenOptionsManageProfiles::GetLocalProfileIndexWithFocus() const int ScreenOptionsManageProfiles::GetLocalProfileIndexWithFocus() const
{ {
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
OptionRow &row = *m_pRows[iCurRow]; OptionRow &row = *m_pRows[iCurRow];
if( SHOW_CREATE_NEW && iCurRow == 0 ) // "create new" if( SHOW_CREATE_NEW && iCurRow == 0 ) // "create new"
+4 -4
View File
@@ -111,7 +111,7 @@ void ScreenOptionsMemoryCard::AfterChangeRow( PlayerNumber pn )
} }
else else
{ {
int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
m_textOsMountDir.SetText( m_CurrentUsbStorageDevices[iRow].sOsMountDir ); m_textOsMountDir.SetText( m_CurrentUsbStorageDevices[iRow].sOsMountDir );
} }
} }
@@ -124,7 +124,7 @@ void ScreenOptionsMemoryCard::HandleMessage( const Message &msg )
{ {
/* Remember the old mountpoint. */ /* Remember the old mountpoint. */
const vector<UsbStorageDevice> &v = m_CurrentUsbStorageDevices; const vector<UsbStorageDevice> &v = m_CurrentUsbStorageDevices;
int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
RString sOldMountPoint; RString sOldMountPoint;
if( iRow < int(v.size()) ) if( iRow < int(v.size()) )
{ {
@@ -158,7 +158,7 @@ void ScreenOptionsMemoryCard::ExportOptions( int iRow, const vector<PlayerNumber
if( row.GetRowType() == OptionRow::RowType_Exit ) if( row.GetRowType() == OptionRow::RowType_Exit )
return; return;
PlayerNumber pn = GAMESTATE->m_MasterPlayerNumber; PlayerNumber pn = GAMESTATE->GetMasterPlayerNumber();
if( m_iCurrentRow[pn] == iRow ) if( m_iCurrentRow[pn] == iRow )
{ {
const vector<UsbStorageDevice> &v = m_CurrentUsbStorageDevices; const vector<UsbStorageDevice> &v = m_CurrentUsbStorageDevices;
@@ -192,7 +192,7 @@ void ScreenOptionsMemoryCard::ProcessMenuStart( const InputEventPlus &input )
if( IsTransitioning() ) if( IsTransitioning() )
return; return;
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()];
const vector<UsbStorageDevice> &v = m_CurrentUsbStorageDevices; const vector<UsbStorageDevice> &v = m_CurrentUsbStorageDevices;
if( iCurRow < int(v.size()) ) // a card if( iCurRow < int(v.size()) ) // a card
+1 -1
View File
@@ -155,7 +155,7 @@ void ScreenSMOnlineLogin::HandleScreenMessage(const ScreenMessage SM)
{ {
LOG->Trace("[ScreenSMOnlineLogin::HandleScreenMessage] GoToNextScreen"); LOG->Trace("[ScreenSMOnlineLogin::HandleScreenMessage] GoToNextScreen");
vector<PlayerNumber> v; vector<PlayerNumber> v;
v.push_back( GAMESTATE->m_MasterPlayerNumber ); v.push_back( GAMESTATE->GetMasterPlayerNumber() );
for( unsigned r=0; r<m_pRows.size(); r++ ) for( unsigned r=0; r<m_pRows.size(); r++ )
ExportOptions( r, v ); ExportOptions( r, v );
+2 -2
View File
@@ -145,8 +145,8 @@ void ScreenSelect::HandleScreenMessage( const ScreenMessage SM )
* same choice, and if so, call ApplyToAll instead. * same choice, and if so, call ApplyToAll instead.
* TODO: Think of a better way to handle this. * TODO: Think of a better way to handle this.
*/ */
ASSERT( GAMESTATE->m_MasterPlayerNumber != PlayerNumber_Invalid ); ASSERT( GAMESTATE->GetMasterPlayerNumber() != PlayerNumber_Invalid );
int iMastersIndex = this->GetSelectionIndex( GAMESTATE->m_MasterPlayerNumber ); int iMastersIndex = this->GetSelectionIndex( GAMESTATE->GetMasterPlayerNumber() );
bool bAllPlayersChoseTheSame = true; bool bAllPlayersChoseTheSame = true;
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
{ {
+4 -4
View File
@@ -294,7 +294,7 @@ void ScreenSelectMaster::HandleScreenMessage( const ScreenMessage SM )
if( SM == SM_PlayPostSwitchPage ) if( SM == SM_PlayPostSwitchPage )
{ {
int iNewChoice = m_iChoice[ GAMESTATE->m_MasterPlayerNumber ]; int iNewChoice = m_iChoice[ GAMESTATE->GetMasterPlayerNumber() ];
Page newPage = GetPage( iNewChoice ); Page newPage = GetPage( iNewChoice );
Message msg("PostSwitchPage"); Message msg("PostSwitchPage");
@@ -516,7 +516,7 @@ void ScreenSelectMaster::MenuDown( const InputEventPlus &input )
bool ScreenSelectMaster::ChangePage( int iNewChoice ) bool ScreenSelectMaster::ChangePage( int iNewChoice )
{ {
Page oldPage = GetPage( m_iChoice[GAMESTATE->m_MasterPlayerNumber] ); Page oldPage = GetPage( m_iChoice[GAMESTATE->GetMasterPlayerNumber()] );
Page newPage = GetPage( iNewChoice ); Page newPage = GetPage( iNewChoice );
// If anyone has already chosen, don't allow changing of pages // If anyone has already chosen, don't allow changing of pages
@@ -710,8 +710,8 @@ bool ScreenSelectMaster::ChangeSelection( PlayerNumber pn, MenuDir dir, int iNew
PlayerNumber ScreenSelectMaster::GetSharedPlayer() PlayerNumber ScreenSelectMaster::GetSharedPlayer()
{ {
if( GAMESTATE->m_MasterPlayerNumber != PLAYER_INVALID ) if( GAMESTATE->GetMasterPlayerNumber() != PLAYER_INVALID )
return GAMESTATE->m_MasterPlayerNumber; return GAMESTATE->GetMasterPlayerNumber();
return PLAYER_1; return PLAYER_1;
} }
+4 -4
View File
@@ -68,7 +68,7 @@ void ScreenSelectMusic::Init()
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR ); GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
GAMESTATE->SetCurrentStyle( GAMEMAN->GameAndStringToStyle(GAMEMAN->GetDefaultGame(),"versus") ); GAMESTATE->SetCurrentStyle( GAMEMAN->GameAndStringToStyle(GAMEMAN->GetDefaultGame(),"versus") );
GAMESTATE->JoinPlayer( PLAYER_1 ); GAMESTATE->JoinPlayer( PLAYER_1 );
GAMESTATE->m_MasterPlayerNumber = PLAYER_1; GAMESTATE->SetMasterPlayerNumber(PLAYER_1);
} }
SAMPLE_MUSIC_DELAY_INIT.Load( m_sName, "SampleMusicDelayInit" ); SAMPLE_MUSIC_DELAY_INIT.Load( m_sName, "SampleMusicDelayInit" );
@@ -1020,7 +1020,7 @@ void ScreenSelectMusic::HandleMessage( const Message &msg )
// TODO: Invalidate the CurSteps only if they are no longer playable. // TODO: Invalidate the CurSteps only if they are no longer playable.
// That way, after music change will clamp to the nearest in the StepsDisplayList. // That way, after music change will clamp to the nearest in the StepsDisplayList.
GAMESTATE->m_pCurSteps[GAMESTATE->m_MasterPlayerNumber].SetWithoutBroadcast( NULL ); GAMESTATE->m_pCurSteps[GAMESTATE->GetMasterPlayerNumber()].SetWithoutBroadcast( NULL );
FOREACH_ENUM( PlayerNumber, p ) FOREACH_ENUM( PlayerNumber, p )
GAMESTATE->m_pCurSteps[p].SetWithoutBroadcast( NULL ); GAMESTATE->m_pCurSteps[p].SetWithoutBroadcast( NULL );
@@ -1392,7 +1392,7 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
if( pStyle == NULL ) if( pStyle == NULL )
{ {
StepsType stCurrent; StepsType stCurrent;
PlayerNumber pn = GAMESTATE->m_MasterPlayerNumber; PlayerNumber pn = GAMESTATE->GetMasterPlayerNumber();
if( GAMESTATE->IsCourseMode() ) if( GAMESTATE->IsCourseMode() )
{ {
ASSERT( GAMESTATE->m_pCurTrail[pn] ); ASSERT( GAMESTATE->m_pCurTrail[pn] );
@@ -1615,7 +1615,7 @@ void ScreenSelectMusic::SwitchToPreferredDifficulty()
if( GAMESTATE->DifficultiesLocked() ) if( GAMESTATE->DifficultiesLocked() )
{ {
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
m_iSelection[p] = m_iSelection[GAMESTATE->m_MasterPlayerNumber]; m_iSelection[p] = m_iSelection[GAMESTATE->GetMasterPlayerNumber()];
} }
} }
+1 -1
View File
@@ -23,7 +23,7 @@ void ScreenSongOptions::Init()
void ScreenSongOptions::ExportOptions( int iRow, const vector<PlayerNumber> &vpns ) void ScreenSongOptions::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
{ {
PlayerNumber pn = GAMESTATE->m_MasterPlayerNumber; PlayerNumber pn = GAMESTATE->GetMasterPlayerNumber();
PlayerState *pPS = GAMESTATE->m_pPlayerState[pn]; PlayerState *pPS = GAMESTATE->m_pPlayerState[pn];
const PlayerOptions::FailType ft = pPS->m_PlayerOptions.GetPreferred().m_FailType; const PlayerOptions::FailType ft = pPS->m_PlayerOptions.GetPreferred().m_FailType;
+1 -1
View File
@@ -275,7 +275,7 @@ void StatsManager::CommitStatsToProfiles( const StageStats *pSS )
{ {
if( pSS->m_multiPlayer[mp].m_HighScore.IsEmpty() ) if( pSS->m_multiPlayer[mp].m_HighScore.IsEmpty() )
continue; continue;
recent->AppendChild( MakeRecentScoreNode( *pSS, GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber], pSS->m_multiPlayer[mp], mp ) ); recent->AppendChild( MakeRecentScoreNode( *pSS, GAMESTATE->m_pCurTrail[GAMESTATE->GetMasterPlayerNumber()], pSS->m_multiPlayer[mp], mp ) );
} }
} }