From 50e168f9fe737a3dc7e5781e4595ccb5ab21a191 Mon Sep 17 00:00:00 2001 From: poco0317 Date: Wed, 19 Dec 2018 00:56:05 -0600 Subject: [PATCH] Remove almost every usage of Foreach_playernumber for removing player_2 --- src/Background.cpp | 5 +- src/DancingCharacters.cpp | 256 ++++++++++++++-------------- src/DifficultyList.cpp | 72 ++++---- src/DualScrollBar.cpp | 24 +-- src/FilterManager.cpp | 10 +- src/GameCommand.cpp | 15 +- src/GameConstantsAndTypes.cpp | 3 +- src/GameState.cpp | 52 +++--- src/HighScore.cpp | 4 +- src/MusicWheel.cpp | 5 +- src/MusicWheelItem.cpp | 24 +-- src/NoteDisplay.cpp | 5 +- src/OptionRow.cpp | 124 ++++++-------- src/OptionRowHandler.h | 8 +- src/ProfileManager.cpp | 12 +- src/ScreenEvaluation.cpp | 204 +++++++++++----------- src/ScreenGameplay.cpp | 7 +- src/ScreenGameplayNormal.cpp | 4 +- src/ScreenGameplaySyncMachine.cpp | 2 +- src/ScreenMiniMenu.cpp | 2 +- src/ScreenOptions.cpp | 174 ++++++++----------- src/ScreenOptionsManageProfiles.cpp | 9 +- src/ScreenOptionsMaster.cpp | 2 +- src/ScreenPlayerOptions.cpp | 23 +-- src/ScreenSMOnlineLogin.cpp | 19 +-- src/ScreenSelectMaster.cpp | 45 +++-- src/ScreenSelectMusic.cpp | 43 ++--- src/ScreenSelectProfile.cpp | 52 +++--- src/StageStats.cpp | 9 +- src/StatsManager.cpp | 11 +- 30 files changed, 534 insertions(+), 691 deletions(-) diff --git a/src/Background.cpp b/src/Background.cpp index 59eecaf74b..fd9cc6742e 100644 --- a/src/Background.cpp +++ b/src/Background.cpp @@ -938,8 +938,7 @@ bool BackgroundImpl::IsDangerAllVisible() { // The players are never in danger in FAIL_OFF. - FOREACH_PlayerNumber( - p) if (GAMESTATE->GetPlayerFailType(GAMESTATE->m_pPlayerState[p]) == + if (GAMESTATE->GetPlayerFailType(GAMESTATE->m_pPlayerState[PLAYER_1]) == FailType_Off) return false; if (!g_bShowDanger) return false; @@ -1027,7 +1026,7 @@ BrightnessOverlay::Set(float fBrightness) { RageColor c = GetBrightnessColor(fBrightness); - FOREACH_PlayerNumber(pn) m_quadBGBrightness[pn].SetDiffuse(c); + m_quadBGBrightness[PLAYER_1].SetDiffuse(c); m_quadBGBrightnessFade.SetDiffuse(c); } diff --git a/src/DancingCharacters.cpp b/src/DancingCharacters.cpp index 16cbd12861..c1902fe7c6 100644 --- a/src/DancingCharacters.cpp +++ b/src/DancingCharacters.cpp @@ -52,111 +52,109 @@ const float MODEL_ROTATIONY_TWO_PLAYERS[NUM_PLAYERS] = { 0 }; DancingCharacters::DancingCharacters() { - FOREACH_PlayerNumber(p) + PlayerNumber p = PLAYER_1; + m_pCharacter[p] = new Model; + m_2DIdleTimer[p].SetZero(); + m_i2DAnimState[p] = AS2D_IDLE; // start on idle state + if (!GAMESTATE->IsPlayerEnabled(p)) + return; + + Character* pChar = GAMESTATE->m_pCurCharacters[p]; + if (pChar == nullptr) + return; + + // load in any potential 2D stuff + RString sCharacterDirectory = pChar->m_sCharDir; + RString sCurrentAnim; + sCurrentAnim = sCharacterDirectory + "2DIdle"; + if (DoesFileExist(sCurrentAnim + + "/BGAnimation.ini")) // check 2D Idle BGAnim exists { - m_pCharacter[p] = new Model; - m_2DIdleTimer[p].SetZero(); - m_i2DAnimState[p] = AS2D_IDLE; // start on idle state - if (!GAMESTATE->IsPlayerEnabled(p)) - continue; - - Character* pChar = GAMESTATE->m_pCurCharacters[p]; - if (pChar == nullptr) - continue; - - // load in any potential 2D stuff - RString sCharacterDirectory = pChar->m_sCharDir; - RString sCurrentAnim; - sCurrentAnim = sCharacterDirectory + "2DIdle"; - if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists - { - m_bgIdle[p].Load(sCurrentAnim); - m_bgIdle[p]->SetXY(DC_X(p), DC_Y(p)); - } + m_bgIdle[p].Load(sCurrentAnim); + m_bgIdle[p]->SetXY(DC_X(p), DC_Y(p)); + } - sCurrentAnim = sCharacterDirectory + "2DMiss"; - if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists - { - m_bgMiss[p].Load(sCurrentAnim); - m_bgMiss[p]->SetXY(DC_X(p), DC_Y(p)); - } + sCurrentAnim = sCharacterDirectory + "2DMiss"; + if (DoesFileExist(sCurrentAnim + + "/BGAnimation.ini")) // check 2D Idle BGAnim exists + { + m_bgMiss[p].Load(sCurrentAnim); + m_bgMiss[p]->SetXY(DC_X(p), DC_Y(p)); + } - sCurrentAnim = sCharacterDirectory + "2DGood"; - if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists - { - m_bgGood[p].Load(sCurrentAnim); - m_bgGood[p]->SetXY(DC_X(p), DC_Y(p)); - } + sCurrentAnim = sCharacterDirectory + "2DGood"; + if (DoesFileExist(sCurrentAnim + + "/BGAnimation.ini")) // check 2D Idle BGAnim exists + { + m_bgGood[p].Load(sCurrentAnim); + m_bgGood[p]->SetXY(DC_X(p), DC_Y(p)); + } - sCurrentAnim = sCharacterDirectory + "2DGreat"; - if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists - { - m_bgGreat[p].Load(sCurrentAnim); - m_bgGreat[p]->SetXY(DC_X(p), DC_Y(p)); - } + sCurrentAnim = sCharacterDirectory + "2DGreat"; + if (DoesFileExist(sCurrentAnim + + "/BGAnimation.ini")) // check 2D Idle BGAnim exists + { + m_bgGreat[p].Load(sCurrentAnim); + m_bgGreat[p]->SetXY(DC_X(p), DC_Y(p)); + } - sCurrentAnim = sCharacterDirectory + "2DFever"; - if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists - { - m_bgFever[p].Load(sCurrentAnim); - m_bgFever[p]->SetXY(DC_X(p), DC_Y(p)); - } + sCurrentAnim = sCharacterDirectory + "2DFever"; + if (DoesFileExist(sCurrentAnim + + "/BGAnimation.ini")) // check 2D Idle BGAnim exists + { + m_bgFever[p].Load(sCurrentAnim); + m_bgFever[p]->SetXY(DC_X(p), DC_Y(p)); + } - sCurrentAnim = sCharacterDirectory + "2DFail"; - if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists - { - m_bgFail[p].Load(sCurrentAnim); - m_bgFail[p]->SetXY(DC_X(p), DC_Y(p)); - } + sCurrentAnim = sCharacterDirectory + "2DFail"; + if (DoesFileExist(sCurrentAnim + + "/BGAnimation.ini")) // check 2D Idle BGAnim exists + { + m_bgFail[p].Load(sCurrentAnim); + m_bgFail[p]->SetXY(DC_X(p), DC_Y(p)); + } - sCurrentAnim = sCharacterDirectory + "2DWin"; - if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists - { - m_bgWin[p].Load(sCurrentAnim); - m_bgWin[p]->SetXY(DC_X(p), DC_Y(p)); - } + sCurrentAnim = sCharacterDirectory + "2DWin"; + if (DoesFileExist(sCurrentAnim + + "/BGAnimation.ini")) // check 2D Idle BGAnim exists + { + m_bgWin[p].Load(sCurrentAnim); + m_bgWin[p]->SetXY(DC_X(p), DC_Y(p)); + } - sCurrentAnim = sCharacterDirectory + "2DWinFever"; - if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists - { - m_bgWinFever[p].Load(sCurrentAnim); - m_bgWinFever[p]->SetXY(DC_X(p), DC_Y(p)); - } + sCurrentAnim = sCharacterDirectory + "2DWinFever"; + if (DoesFileExist(sCurrentAnim + + "/BGAnimation.ini")) // check 2D Idle BGAnim exists + { + m_bgWinFever[p].Load(sCurrentAnim); + m_bgWinFever[p]->SetXY(DC_X(p), DC_Y(p)); + } - if (pChar->GetModelPath().empty()) - continue; + if (pChar->GetModelPath().empty()) + return; - if (GAMESTATE->GetNumPlayersEnabled() == 2) - m_pCharacter[p]->SetX(MODEL_X_TWO_PLAYERS[p]); - else - m_pCharacter[p]->SetX(MODEL_X_ONE_PLAYER); - - m_pCharacter[p]->LoadMilkshapeAscii(pChar->GetModelPath()); - m_pCharacter[p]->LoadMilkshapeAsciiBones("rest", - pChar->GetRestAnimationPath()); - m_pCharacter[p]->LoadMilkshapeAsciiBones( - "warmup", pChar->GetWarmUpAnimationPath()); - m_pCharacter[p]->LoadMilkshapeAsciiBones( - "dance", pChar->GetDanceAnimationPath()); - m_pCharacter[p]->SetCullMode(CULL_NONE); // many of the models floating - // around have the vertex order - // flipped - - m_pCharacter[p]->RunCommands(pChar->m_cmdInit); - } + if (GAMESTATE->GetNumPlayersEnabled() == 2) + m_pCharacter[p]->SetX(MODEL_X_TWO_PLAYERS[p]); + else + m_pCharacter[p]->SetX(MODEL_X_ONE_PLAYER); + + m_pCharacter[p]->LoadMilkshapeAscii(pChar->GetModelPath()); + m_pCharacter[p]->LoadMilkshapeAsciiBones("rest", + pChar->GetRestAnimationPath()); + m_pCharacter[p]->LoadMilkshapeAsciiBones( + "warmup", pChar->GetWarmUpAnimationPath()); + m_pCharacter[p]->LoadMilkshapeAsciiBones( + "dance", pChar->GetDanceAnimationPath()); + m_pCharacter[p]->SetCullMode(CULL_NONE); // many of the models floating + // around have the vertex order + // flipped + + m_pCharacter[p]->RunCommands(pChar->m_cmdInit); } DancingCharacters::~DancingCharacters() { - FOREACH_PlayerNumber(p) delete m_pCharacter[p]; + delete m_pCharacter[PLAYER_1]; } void @@ -175,8 +173,8 @@ DancingCharacters::LoadNextSong() ASSERT(GAMESTATE->m_pCurSong != NULL); m_fThisCameraEndBeat = GAMESTATE->m_pCurSong->GetFirstBeat(); - FOREACH_PlayerNumber(p) if (GAMESTATE->IsPlayerEnabled(p)) m_pCharacter[p] - ->PlayAnimation("rest"); + if (GAMESTATE->IsPlayerEnabled(PLAYER_1)) + m_pCharacter[PLAYER_1]->PlayAnimation("rest"); } int @@ -202,19 +200,15 @@ DancingCharacters::Update(float fDelta) * at a very low music rate. */ fUpdateScale *= GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; - FOREACH_PlayerNumber(p) - { - if (GAMESTATE->IsPlayerEnabled(p)) - m_pCharacter[p]->Update(fDelta * fUpdateScale); - } + if (GAMESTATE->IsPlayerEnabled(PLAYER_1)) + m_pCharacter[PLAYER_1]->Update(fDelta * fUpdateScale); } static bool bWasGameplayStarting = false; bool bGameplayStarting = GAMESTATE->m_bGameplayLeadIn; if (!bWasGameplayStarting && bGameplayStarting) { - FOREACH_PlayerNumber(p) if (GAMESTATE->IsPlayerEnabled(p)) - m_pCharacter[p] - ->PlayAnimation("warmup"); + if (GAMESTATE->IsPlayerEnabled(PLAYER_1)) + m_pCharacter[PLAYER_1]->PlayAnimation("warmup"); } bWasGameplayStarting = bGameplayStarting; @@ -222,7 +216,7 @@ DancingCharacters::Update(float fDelta) float firstBeat = GAMESTATE->m_pCurSong->GetFirstBeat(); float fThisBeat = GAMESTATE->m_Position.m_fSongBeat; if (fLastBeat < firstBeat && fThisBeat >= firstBeat) { - FOREACH_PlayerNumber(p) m_pCharacter[p]->PlayAnimation("dance"); + m_pCharacter[PLAYER_1]->PlayAnimation("dance"); } fLastBeat = fThisBeat; @@ -273,42 +267,40 @@ DancingCharacters::Update(float fDelta) /* // is there any of this still around? This block of code is _ugly_. -Colby // update any 2D stuff - FOREACH_PlayerNumber( p ) + PlayerNumber p = PLAYER_1; + if( m_bgIdle[p].IsLoaded() ) { - if( m_bgIdle[p].IsLoaded() ) - { - if( m_bgIdle[p].IsLoaded() && m_i2DAnimState[p] == AS2D_IDLE ) - m_bgIdle[p]->Update( fDelta ); - if( m_bgMiss[p].IsLoaded() && m_i2DAnimState[p] == AS2D_MISS ) - m_bgMiss[p]->Update( fDelta ); - if( m_bgGood[p].IsLoaded() && m_i2DAnimState[p] == AS2D_GOOD ) - m_bgGood[p]->Update( fDelta ); - if( m_bgGreat[p].IsLoaded() && m_i2DAnimState[p] == AS2D_GREAT ) - m_bgGreat[p]->Update( fDelta ); - if( m_bgFever[p].IsLoaded() && m_i2DAnimState[p] == AS2D_FEVER ) - m_bgFever[p]->Update( fDelta ); - if( m_bgFail[p].IsLoaded() && m_i2DAnimState[p] == AS2D_FAIL ) - m_bgFail[p]->Update( fDelta ); - if( m_bgWin[p].IsLoaded() && m_i2DAnimState[p] == AS2D_WIN ) - m_bgWin[p]->Update( fDelta ); - if( m_bgWinFever[p].IsLoaded() && m_i2DAnimState[p] == AS2D_WINFEVER + if( m_bgIdle[p].IsLoaded() && m_i2DAnimState[p] == AS2D_IDLE ) + m_bgIdle[p]->Update( fDelta ); + if( m_bgMiss[p].IsLoaded() && m_i2DAnimState[p] == AS2D_MISS ) + m_bgMiss[p]->Update( fDelta ); + if( m_bgGood[p].IsLoaded() && m_i2DAnimState[p] == AS2D_GOOD ) + m_bgGood[p]->Update( fDelta ); + if( m_bgGreat[p].IsLoaded() && m_i2DAnimState[p] == AS2D_GREAT ) + m_bgGreat[p]->Update( fDelta ); + if( m_bgFever[p].IsLoaded() && m_i2DAnimState[p] == AS2D_FEVER ) + m_bgFever[p]->Update( fDelta ); + if( m_bgFail[p].IsLoaded() && m_i2DAnimState[p] == AS2D_FAIL ) + m_bgFail[p]->Update( fDelta ); + if( m_bgWin[p].IsLoaded() && m_i2DAnimState[p] == AS2D_WIN ) + m_bgWin[p]->Update( fDelta ); + if( m_bgWinFever[p].IsLoaded() && m_i2DAnimState[p] == AS2D_WINFEVER ) m_bgWinFever[p]->Update(fDelta); - if(m_i2DAnimState[p] != AS2D_IDLE) // if we're not in idle state, + if(m_i2DAnimState[p] != AS2D_IDLE) // if we're not in idle state, start a timer to return us to idle - { - // never return to idle state if we have failed / passed (i.e. + { + // never return to idle state if we have failed / passed (i.e. completed) the song if(m_i2DAnimState[p] != AS2D_WINFEVER && m_i2DAnimState[p] != AS2D_FAIL && m_i2DAnimState[p] != AS2D_WIN) - { - if(m_2DIdleTimer[p].IsZero()) - m_2DIdleTimer[p].Touch(); - if(!m_2DIdleTimer[p].IsZero() && m_2DIdleTimer[p].Ago() + { + if(m_2DIdleTimer[p].IsZero()) + m_2DIdleTimer[p].Touch(); + if(!m_2DIdleTimer[p].IsZero() && m_2DIdleTimer[p].Ago() > 1.0f) - { - m_2DIdleTimer[p].SetZero(); - m_i2DAnimState[p] = AS2D_IDLE; - } + { + m_2DIdleTimer[p].SetZero(); + m_i2DAnimState[p] = AS2D_IDLE; } } } @@ -391,8 +383,8 @@ DancingCharacters::DrawPrimitives() /* // Ugly! -Colby // now draw any potential 2D stuff - FOREACH_PlayerNumber( p ) { + PlayerNumber p = PLAYER_1; if(m_bgIdle[p].IsLoaded() && m_i2DAnimState[p] == AS2D_IDLE) m_bgIdle[p]->Draw(); if(m_bgMiss[p].IsLoaded() && m_i2DAnimState[p] == AS2D_MISS) diff --git a/src/DifficultyList.cpp b/src/DifficultyList.cpp index 13981b1478..12b128f6bd 100644 --- a/src/DifficultyList.cpp +++ b/src/DifficultyList.cpp @@ -23,12 +23,8 @@ REGISTER_ACTOR_CLASS(StepsDisplayList); StepsDisplayList::StepsDisplayList() { m_bShown = true; - - FOREACH_ENUM(PlayerNumber, pn) - { - SubscribeToMessage((MessageID)(Message_CurrentStepsP1Changed + pn)); - SubscribeToMessage((MessageID)(Message_CurrentTrailP1Changed + pn)); - } + SubscribeToMessage((MessageID)(Message_CurrentStepsP1Changed + PLAYER_1)); + SubscribeToMessage((MessageID)(Message_CurrentTrailP1Changed + PLAYER_1)); } StepsDisplayList::~StepsDisplayList() = default; @@ -51,36 +47,33 @@ StepsDisplayList::LoadFromNode(const XNode* pNode) m_Lines.resize(MAX_METERS); m_CurSong = NULL; - FOREACH_ENUM(PlayerNumber, pn) - { - const XNode* pChild = pNode->GetChild(ssprintf("CursorP%i", pn + 1)); - if (pChild == NULL) { - LuaHelpers::ReportScriptErrorFmt( - "%s: StepsDisplayList: missing the node \"CursorP%d\"", - ActorUtil::GetWhere(pNode).c_str(), - pn + 1); - } else { - m_Cursors[pn].LoadActorFromNode(pChild, this); - } + const XNode* pChild = pNode->GetChild(ssprintf("CursorP%i", PLAYER_1 + 1)); + if (pChild == NULL) { + LuaHelpers::ReportScriptErrorFmt( + "%s: StepsDisplayList: missing the node \"CursorP%d\"", + ActorUtil::GetWhere(pNode).c_str(), + PLAYER_1 + 1); + } else { + m_Cursors[PLAYER_1].LoadActorFromNode(pChild, this); + } - /* Hack: we need to tween cursors both up to down (cursor motion) and - * visible to invisible (fading). Cursor motion needs to stoptweening, - * so multiple motions don't queue and look unresponsive. However, that - * stoptweening interrupts fading, resulting in the cursor remaining - * invisible or partially invisible. So, do them in separate tweening - * stacks. This means the Cursor command can't change diffuse colors; I - * think we do need a diffuse color stack ... */ - pChild = pNode->GetChild(ssprintf("CursorP%iFrame", pn + 1)); - if (pChild == NULL) { - LuaHelpers::ReportScriptErrorFmt( - "%s: StepsDisplayList: missing the node \"CursorP%dFrame\"", - ActorUtil::GetWhere(pNode).c_str(), - pn + 1); - } else { - m_CursorFrames[pn].LoadFromNode(pChild); - m_CursorFrames[pn].AddChild(m_Cursors[pn]); - this->AddChild(&m_CursorFrames[pn]); - } + /* Hack: we need to tween cursors both up to down (cursor motion) and + * visible to invisible (fading). Cursor motion needs to stoptweening, + * so multiple motions don't queue and look unresponsive. However, that + * stoptweening interrupts fading, resulting in the cursor remaining + * invisible or partially invisible. So, do them in separate tweening + * stacks. This means the Cursor command can't change diffuse colors; I + * think we do need a diffuse color stack ... */ + pChild = pNode->GetChild(ssprintf("CursorP%iFrame", PLAYER_1 + 1)); + if (pChild == NULL) { + LuaHelpers::ReportScriptErrorFmt( + "%s: StepsDisplayList: missing the node \"CursorP%dFrame\"", + ActorUtil::GetWhere(pNode).c_str(), + PLAYER_1 + 1); + } else { + m_CursorFrames[PLAYER_1].LoadFromNode(pChild); + m_CursorFrames[PLAYER_1].AddChild(m_Cursors[PLAYER_1]); + this->AddChild(&m_CursorFrames[PLAYER_1]); } for (unsigned m = 0; m < m_Lines.size(); ++m) { @@ -359,12 +352,9 @@ StepsDisplayList::Hide() void StepsDisplayList::HandleMessage(const Message& msg) { - FOREACH_ENUM(PlayerNumber, pn) - { - if (msg.GetName() == - MessageIDToString((MessageID)(Message_CurrentStepsP1Changed + pn))) - SetFromGameState(); - } + if (msg.GetName() == + MessageIDToString((MessageID)(Message_CurrentStepsP1Changed + PLAYER_1))) + SetFromGameState(); ActorFrame::HandleMessage(msg); } diff --git a/src/DualScrollBar.cpp b/src/DualScrollBar.cpp index 4229d5c07d..7dd00e8ef8 100644 --- a/src/DualScrollBar.cpp +++ b/src/DualScrollBar.cpp @@ -12,21 +12,15 @@ DualScrollBar::DualScrollBar() void DualScrollBar::Load(const RString& sType) { - FOREACH_PlayerNumber(pn) - { - m_sprScrollThumbUnderHalf[pn].Load( - THEME->GetPathG(sType, ssprintf("thumb p%i", pn + 1))); - m_sprScrollThumbUnderHalf[pn]->SetName(ssprintf("ThumbP%i", pn + 1)); - this->AddChild(m_sprScrollThumbUnderHalf[pn]); - } + m_sprScrollThumbUnderHalf[PLAYER_1].Load( + THEME->GetPathG(sType, ssprintf("thumb p%i", PLAYER_1 + 1))); + m_sprScrollThumbUnderHalf[PLAYER_1]->SetName(ssprintf("ThumbP%i", PLAYER_1 + 1)); + this->AddChild(m_sprScrollThumbUnderHalf[PLAYER_1]); - FOREACH_PlayerNumber(pn) - { - m_sprScrollThumbOverHalf[pn].Load( - THEME->GetPathG(sType, ssprintf("thumb p%i", pn + 1))); - m_sprScrollThumbOverHalf[pn]->SetName(ssprintf("ThumbP%i", pn + 1)); - this->AddChild(m_sprScrollThumbOverHalf[pn]); - } + m_sprScrollThumbOverHalf[PLAYER_1].Load( + THEME->GetPathG(sType, ssprintf("thumb p%i", PLAYER_1 + 1))); + m_sprScrollThumbOverHalf[PLAYER_1]->SetName(ssprintf("ThumbP%i", PLAYER_1 + 1)); + this->AddChild(m_sprScrollThumbOverHalf[PLAYER_1]); m_sprScrollThumbUnderHalf[0]->SetCropLeft(.5f); m_sprScrollThumbUnderHalf[1]->SetCropRight(.5f); @@ -34,7 +28,7 @@ DualScrollBar::Load(const RString& sType) m_sprScrollThumbOverHalf[0]->SetCropRight(.5f); m_sprScrollThumbOverHalf[1]->SetCropLeft(.5f); - FOREACH_PlayerNumber(pn) SetPercentage(pn, 0); + SetPercentage(PLAYER_1, 0); FinishTweening(); } diff --git a/src/FilterManager.cpp b/src/FilterManager.cpp index 523c57f751..b9dd41f40a 100644 --- a/src/FilterManager.cpp +++ b/src/FilterManager.cpp @@ -9,12 +9,8 @@ FilterManager::FilterManager() // filter stuff - mina ZERO(SSFilterLowerBounds); ZERO(SSFilterUpperBounds); - - FOREACH_PlayerNumber(p) - { - m_pPlayerState[p] = new PlayerState; - m_pPlayerState[p]->SetPlayerNumber(p); - } + m_pPlayerState[PLAYER_1] = new PlayerState; + m_pPlayerState[PLAYER_1]->SetPlayerNumber(PLAYER_1); // Register with Lua. { @@ -28,7 +24,7 @@ FilterManager::FilterManager() FilterManager::~FilterManager() { - FOREACH_PlayerNumber(p) SAFE_DELETE(m_pPlayerState[p]); + SAFE_DELETE(m_pPlayerState[PLAYER_1]); // Unregister with Lua. LUA->UnsetGlobal("FILTERMAN"); diff --git a/src/GameCommand.cpp b/src/GameCommand.cpp index b84982e738..ad067af82d 100644 --- a/src/GameCommand.cpp +++ b/src/GameCommand.cpp @@ -1,4 +1,4 @@ -#include "global.h" +#include "global.h" #include "AnnouncerManager.h" #include "Foreach.h" #include "GameCommand.h" @@ -425,7 +425,7 @@ GameCommand::ApplyToAllPlayers() const { vector vpns; - FOREACH_PlayerNumber(pn) vpns.push_back(pn); + vpns.push_back(PLAYER_1); Apply(vpns); } @@ -564,13 +564,10 @@ GameCommand::ApplySelf(const vector& vpns) const if (m_bApplyDefaultOptions) { // applying options affects only the current stage - FOREACH_PlayerNumber(p) - { - PlayerOptions po; - GAMESTATE->GetDefaultPlayerOptions(po); - GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.Assign( - ModsLevel_Stage, po); - } + PlayerOptions po; + GAMESTATE->GetDefaultPlayerOptions(po); + GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.Assign( + ModsLevel_Stage, po); SongOptions so; GAMESTATE->GetDefaultSongOptions(so); diff --git a/src/GameConstantsAndTypes.cpp b/src/GameConstantsAndTypes.cpp index 36da15c8b0..ade2d64ea7 100644 --- a/src/GameConstantsAndTypes.cpp +++ b/src/GameConstantsAndTypes.cpp @@ -17,8 +17,7 @@ static vector GenerateRankingToFillInMarker() { vector vRankings; - FOREACH_ENUM(PlayerNumber, pn) - vRankings.push_back(ssprintf("#P%d#", pn + 1)); + vRankings.push_back(ssprintf("#P%d#", PLAYER_1 + 1)); return vRankings; } extern const vector RANKING_TO_FILL_IN_MARKER( diff --git a/src/GameState.cpp b/src/GameState.cpp index ad3f39f234..f1a20ed841 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -105,7 +105,7 @@ GameState::GameState() g_pImpl = new GameStateImpl; m_pCurStyle.Set(NULL); - FOREACH_PlayerNumber(rpn) { m_SeparatedStyles[rpn] = NULL; } + m_SeparatedStyles[PLAYER_1] = NULL; m_pCurGame.Set(NULL); m_timeGameStarted.SetZero(); @@ -114,14 +114,10 @@ GameState::GameState() m_PlayMode.Set( PlayMode_Invalid); // used by IsPlayerEnabled before the first screen - FOREACH_PlayerNumber(p) m_bSideIsJoined[p] = - false; // used by GetNumSidesJoined before the first screen + m_bSideIsJoined[PLAYER_1] = false; // used by GetNumSidesJoined before the first screen - FOREACH_PlayerNumber(p) - { - m_pPlayerState[p] = new PlayerState; - m_pPlayerState[p]->SetPlayerNumber(p); - } + m_pPlayerState[PLAYER_1] = new PlayerState; + m_pPlayerState[PLAYER_1]->SetPlayerNumber(PLAYER_1); FOREACH_MultiPlayer(p) { m_pMultiPlayerState[p] = new PlayerState; @@ -153,7 +149,7 @@ GameState::~GameState() // Unregister with Lua. LUA->UnsetGlobal("GAMESTATE"); - FOREACH_PlayerNumber(p) SAFE_DELETE(m_pPlayerState[p]); + SAFE_DELETE(m_pPlayerState[PLAYER_1]); FOREACH_MultiPlayer(p) SAFE_DELETE(m_pMultiPlayerState[p]); SAFE_DELETE(m_Environment); @@ -250,7 +246,7 @@ GameState::Reset() this->SetMasterPlayerNumber( PLAYER_INVALID); // must initialize for UnjoinPlayer - FOREACH_PlayerNumber(pn) UnjoinPlayer(pn); + UnjoinPlayer(PLAYER_1); ASSERT(THEME != NULL); @@ -392,11 +388,8 @@ bool GameState::JoinPlayers() { bool bJoined = false; - FOREACH_PlayerNumber(pn) - { - if (JoinInputInternal(pn)) - bJoined = true; - } + if (JoinInputInternal(PLAYER_1)) + bJoined = true; return bJoined; } @@ -532,12 +525,9 @@ GameState::BeginStage() AdjustSync::ResetOriginalSyncData(); if (!ARE_STAGE_PLAYER_MODS_FORCED) { - FOREACH_PlayerNumber(p) - { - ModsGroup& po = m_pPlayerState[p]->m_PlayerOptions; - po.Assign(ModsLevel_Stage, - m_pPlayerState[p]->m_PlayerOptions.GetPreferred()); - } + ModsGroup& po = m_pPlayerState[PLAYER_1]->m_PlayerOptions; + po.Assign(ModsLevel_Stage, + m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetPreferred()); } if (!ARE_STAGE_SONG_MODS_FORCED) m_SongOptions.Assign(ModsLevel_Stage, m_SongOptions.GetPreferred()); @@ -785,7 +775,7 @@ GameState::Update(float fDelta) { m_SongOptions.Update(fDelta); - FOREACH_PlayerNumber(p) m_pPlayerState[p]->Update(fDelta); + m_pPlayerState[PLAYER_1]->Update(fDelta); } void @@ -809,7 +799,7 @@ GameState::ResetMusicStatistics() Actor::SetBGMTime(0, 0, 0, 0); - FOREACH_PlayerNumber(p) { m_pPlayerState[p]->m_Position.Reset(); } + m_pPlayerState[PLAYER_1]->m_Position.Reset(); } void @@ -817,10 +807,7 @@ GameState::ResetStageStatistics() { StageStats OldStats = STATSMAN->m_CurStageStats; STATSMAN->m_CurStageStats = StageStats(); - FOREACH_PlayerNumber( p ) - { - m_pPlayerState[p]->m_HealthState = HealthState_Alive; - } + m_pPlayerState[PLAYER_1]->m_HealthState = HealthState_Alive; // Reset the round seed. Do this here and not in FinishStage so that players // get new shuffle patterns if they Back out of gameplay and play again. @@ -890,8 +877,8 @@ int GameState::GetNumSidesJoined() const { int iNumSidesJoined = 0; - FOREACH_PlayerNumber(p) if (m_bSideIsJoined[p]) - iNumSidesJoined++; // left side, and right side + if (m_bSideIsJoined[PLAYER_1]) + iNumSidesJoined++; // left side, and right side return iNumSidesJoined; } @@ -970,7 +957,7 @@ GameState::SetCurrentStyle(const Style* style, PlayerNumber pn) m_pCurStyle.Set(style); } else { if (pn == PLAYER_INVALID) { - FOREACH_PlayerNumber(rpn) { m_SeparatedStyles[rpn] = style; } + m_SeparatedStyles[PLAYER_1] = style; } else { m_SeparatedStyles[pn] = style; } @@ -1098,7 +1085,8 @@ GameState::GetFirstHumanPlayer() const PlayerNumber GameState::GetFirstDisabledPlayer() const { - FOREACH_PlayerNumber(pn) if (!IsPlayerEnabled(pn)) return pn; + if (!IsPlayerEnabled(PLAYER_1)) + return PLAYER_1; return PLAYER_INVALID; } @@ -1282,7 +1270,7 @@ GameState::ChangePreferredDifficultyAndStepsType(PlayerNumber pn, m_PreferredDifficulty[pn].Set(dc); m_PreferredStepsType.Set(st); if (DifficultiesLocked()) - FOREACH_PlayerNumber(p) if (p != pn) m_PreferredDifficulty[p].Set( + if (PLAYER_1 != pn) m_PreferredDifficulty[PLAYER_1].Set( m_PreferredDifficulty[pn]); return true; diff --git a/src/HighScore.cpp b/src/HighScore.cpp index e267be7c68..ea2f8ba713 100644 --- a/src/HighScore.cpp +++ b/src/HighScore.cpp @@ -1621,8 +1621,8 @@ class LunaHighScore : public Luna static int IsFillInMarker(T* p, lua_State* L) { bool bIsFillInMarker = false; - FOREACH_PlayerNumber(pn) bIsFillInMarker |= - p->GetName() == RANKING_TO_FILL_IN_MARKER[pn]; + bIsFillInMarker |= + p->GetName() == RANKING_TO_FILL_IN_MARKER[PLAYER_1]; lua_pushboolean(L, static_cast(bIsFillInMarker)); return 1; } diff --git a/src/MusicWheel.cpp b/src/MusicWheel.cpp index f765f881a0..f40007d025 100644 --- a/src/MusicWheel.cpp +++ b/src/MusicWheel.cpp @@ -1121,9 +1121,8 @@ MusicWheel::UpdateSwitch() if (SongUtil::GetStepsTypeAndDifficultyFromSortOrder( GAMESTATE->m_SortOrder, st, dc)) { ASSERT(dc != Difficulty_Invalid); - FOREACH_PlayerNumber(p) if (GAMESTATE->IsPlayerEnabled(p)) - GAMESTATE->m_PreferredDifficulty[p] - .Set(dc); + if (GAMESTATE->IsPlayerEnabled(PLAYER_1)) + GAMESTATE->m_PreferredDifficulty[PLAYER_1].Set(dc); } SCREENMAN->PostMessageToTopScreen(SM_SongChanged, 0); diff --git a/src/MusicWheelItem.cpp b/src/MusicWheelItem.cpp index d887872d1d..d2bfac6382 100644 --- a/src/MusicWheelItem.cpp +++ b/src/MusicWheelItem.cpp @@ -89,14 +89,11 @@ MusicWheelItem::MusicWheelItem(RString sType) m_pTextSectionCount->PlayCommand("On"); this->AddChild(m_pTextSectionCount); - FOREACH_PlayerNumber(p) - { - m_pGradeDisplay[p].Load(THEME->GetPathG(sType, "grades")); - m_pGradeDisplay[p]->SetName( - ssprintf("GradeP%d", static_cast(p + 1))); - this->AddChild(m_pGradeDisplay[p]); - LOAD_ALL_COMMANDS_AND_SET_XY(m_pGradeDisplay[p]); - } + m_pGradeDisplay[PLAYER_1].Load(THEME->GetPathG(sType, "grades")); + m_pGradeDisplay[PLAYER_1]->SetName( + ssprintf("GradeP%d", static_cast(PLAYER_1 + 1))); + this->AddChild(m_pGradeDisplay[PLAYER_1]); + LOAD_ALL_COMMANDS_AND_SET_XY(m_pGradeDisplay[PLAYER_1]); this->SubscribeToMessage(Message_CurrentStepsP1Changed); this->SubscribeToMessage(Message_CurrentStepsP2Changed); @@ -138,12 +135,9 @@ MusicWheelItem::MusicWheelItem(const MusicWheelItem& cpy) m_pTextSectionCount = new BitmapText(*cpy.m_pTextSectionCount); this->AddChild(m_pTextSectionCount); - - FOREACH_PlayerNumber(p) - { - m_pGradeDisplay[p] = cpy.m_pGradeDisplay[p]; - this->AddChild(m_pGradeDisplay[p]); - } + m_pGradeDisplay[PLAYER_1] = cpy.m_pGradeDisplay[PLAYER_1]; + this->AddChild(m_pGradeDisplay[PLAYER_1]); + } MusicWheelItem::~MusicWheelItem() @@ -174,7 +168,7 @@ MusicWheelItem::LoadFromWheelItemData(const WheelItemBaseData* pData, if (m_pText[i]) m_pText[i]->SetVisible(false); m_pTextSectionCount->SetVisible(false); - FOREACH_PlayerNumber(p) m_pGradeDisplay[p]->SetVisible(false); + m_pGradeDisplay[PLAYER_1]->SetVisible(false); // Fill these in below RString sDisplayName, sTranslitName; diff --git a/src/NoteDisplay.cpp b/src/NoteDisplay.cpp index 6cf12baeb8..34a27c6b6a 100644 --- a/src/NoteDisplay.cpp +++ b/src/NoteDisplay.cpp @@ -1934,10 +1934,7 @@ NoteColumnRenderer::DrawPrimitives() *m_field_render_args, m_column_render_args, (tap_set)[pn]); \ } #define DRAW_TAP_SET(tap_set, draw_func) \ - FOREACH_PlayerNumber(pn) \ - { \ - DTS_INNER(pn, tap_set, draw_func, m_displays[pn]); \ - } + DTS_INNER(PLAYER_1, tap_set, draw_func, m_displays[PLAYER_1]); DRAW_TAP_SET(holds, DrawHoldsInRange); DTS_INNER( PLAYER_INVALID, holds, DrawHoldsInRange, m_displays[PLAYER_INVALID]); diff --git a/src/OptionRow.cpp b/src/OptionRow.cpp index 946db565b9..f3b2039d0a 100644 --- a/src/OptionRow.cpp +++ b/src/OptionRow.cpp @@ -61,11 +61,11 @@ OptionRow::Clear() { ActorFrame::RemoveAllChildren(); - FOREACH_PlayerNumber(p) m_vbSelected[p].clear(); + m_vbSelected[PLAYER_1].clear(); m_Frame.DeleteAllChildren(); m_textItems.clear(); - FOREACH_PlayerNumber(p) m_Underline[p].clear(); + m_Underline[PLAYER_1].clear(); if (m_pHand != NULL) { FOREACH_CONST(RString, m_pHand->m_vsReloadRowMessages, m) @@ -104,8 +104,8 @@ OptionRowType::Load(const RString& sMetricsGroup, Actor* pParent) ActorUtil::LoadAllCommands(m_textItem, sMetricsGroup); if (SHOW_UNDERLINES) { - FOREACH_PlayerNumber(p) m_Underline[p].Load( - "OptionsUnderline" + PlayerNumberToString(p), false); + m_Underline[PLAYER_1].Load( + "OptionsUnderline" + PlayerNumberToString(PLAYER_1), false); } m_textTitle.LoadFromFont(THEME->GetPathF(sMetricsGroup, "title")); @@ -164,26 +164,22 @@ OptionRow::ChoicesChanged(RowType type, bool reset_focus) // Remove the NextRow marker before reloading choices if (m_pHand->m_Def.m_vsChoices[0] == NEXT_ROW_NAME) { m_pHand->m_Def.m_vsChoices.erase(m_pHand->m_Def.m_vsChoices.begin()); - FOREACH_PlayerNumber(p) m_vbSelected[p].erase(m_vbSelected[p].begin()); + m_vbSelected[PLAYER_1].erase(m_vbSelected[PLAYER_1].begin()); } - FOREACH_PlayerNumber(p) - { - vector& vbSelected = m_vbSelected[p]; - vbSelected.resize(0); - vbSelected.resize(m_pHand->m_Def.m_vsChoices.size(), false); + vector& vbSelected = m_vbSelected[PLAYER_1]; + vbSelected.resize(0); + vbSelected.resize(m_pHand->m_Def.m_vsChoices.size(), false); - // set select the first item if a SELECT_ONE row - if (vbSelected.size() && m_pHand->m_Def.m_selectType == SELECT_ONE) - vbSelected[0] = true; - } + // set select the first item if a SELECT_ONE row + if (vbSelected.size() && m_pHand->m_Def.m_selectType == SELECT_ONE) + vbSelected[0] = true; // TRICKY: Insert a down arrow as the first choice in the row. if (m_bFirstItemGoesDown) { m_pHand->m_Def.m_vsChoices.insert(m_pHand->m_Def.m_vsChoices.begin(), NEXT_ROW_NAME); - FOREACH_PlayerNumber(p) m_vbSelected[p].insert(m_vbSelected[p].begin(), - false); + m_vbSelected[PLAYER_1].insert(m_vbSelected[PLAYER_1].begin(), false); } InitText(type); @@ -192,7 +188,7 @@ OptionRow::ChoicesChanged(RowType type, bool reset_focus) // focus. if (reset_focus) { // When choices change, the old focus position is meaningless; reset it. - FOREACH_PlayerNumber(p) SetChoiceInRowWithFocus(p, 0); + SetChoiceInRowWithFocus(PLAYER_1, 0); } m_textTitle->SetText(GetRowTitle()); @@ -238,7 +234,7 @@ OptionRow::InitText(RowType type) * options. Delete the old ones. */ m_Frame.DeleteAllChildren(); m_textItems.clear(); - FOREACH_PlayerNumber(p) m_Underline[p].clear(); + m_Underline[PLAYER_1].clear(); m_textTitle = new BitmapText(m_pParentType->m_textTitle); m_Frame.AddChild(m_textTitle); @@ -250,18 +246,17 @@ OptionRow::InitText(RowType type) if (m_pParentType->SHOW_MOD_ICONS) { switch (m_RowType) { case RowType_Normal: - FOREACH_PlayerNumber(p) - { - m_ModIcons[p] = new ModIcon(m_pParentType->m_ModIcon); - m_ModIcons[p]->SetDrawOrder(-1); // under title - m_ModIcons[p]->PlayCommand("On"); + { + m_ModIcons[PLAYER_1] = new ModIcon(m_pParentType->m_ModIcon); + m_ModIcons[PLAYER_1]->SetDrawOrder(-1); // under title + m_ModIcons[PLAYER_1]->PlayCommand("On"); - m_Frame.AddChild(m_ModIcons[p]); + m_Frame.AddChild(m_ModIcons[PLAYER_1]); - GameCommand gc; - SetModIcon(p, "", gc); - } + GameCommand gc; + SetModIcon(PLAYER_1, "", gc); break; + } case RowType_Exit: break; } @@ -300,40 +295,36 @@ OptionRow::InitText(RowType type) // load m_textItems switch (m_pHand->m_Def.m_layoutType) { - case LAYOUT_SHOW_ONE_IN_ROW: - // init text - FOREACH_PlayerNumber(p) - { - BitmapText* pText = new BitmapText(m_pParentType->m_textItem); - m_textItems.push_back(pText); + case LAYOUT_SHOW_ONE_IN_ROW: { // init text + BitmapText* pText = new BitmapText(m_pParentType->m_textItem); + m_textItems.push_back(pText); - pText->PlayCommand("On"); + pText->PlayCommand("On"); - if (m_pHand->m_Def.m_bOneChoiceForAllPlayers) { - pText->SetX(m_pParentType->ITEMS_LONG_ROW_SHARED_X); - break; // only initialize one item since it's shared - } else { - pText->SetX(m_pParentType->ITEMS_LONG_ROW_X.GetValue(p)); - } + if (m_pHand->m_Def.m_bOneChoiceForAllPlayers) { + pText->SetX(m_pParentType->ITEMS_LONG_ROW_SHARED_X); + break; // only initialize one item since it's shared + } else { + pText->SetX(m_pParentType->ITEMS_LONG_ROW_X.GetValue(PLAYER_1)); + } - // Set the text now, so SetWidthXY below is correct. - UpdateText(p); + // Set the text now, so SetWidthXY below is correct. + UpdateText(PLAYER_1); - // init underlines - if (m_pParentType->SHOW_UNDERLINES && - GetRowType() != OptionRow::RowType_Exit) { - OptionsCursor* pCursor = - new OptionsCursor(m_pParentType->m_Underline[p]); - m_Underline[p].push_back(pCursor); - - int iWidth, iX, iY; - GetWidthXY(p, 0, iWidth, iX, iY); - pCursor->SetX(float(iX)); - pCursor->SetBarWidth(iWidth); - } + // init underlines + if (m_pParentType->SHOW_UNDERLINES && + GetRowType() != OptionRow::RowType_Exit) { + OptionsCursor* pCursor = + new OptionsCursor(m_pParentType->m_Underline[PLAYER_1]); + m_Underline[PLAYER_1].push_back(pCursor); + + int iWidth, iX, iY; + GetWidthXY(PLAYER_1, 0, iWidth, iX, iY); + pCursor->SetX(float(iX)); + pCursor->SetBarWidth(iWidth); } break; - + } case LAYOUT_SHOW_ALL_IN_ROW: { float fX = m_pParentType->ITEMS_START_X; for (unsigned c = 0; c < m_pHand->m_Def.m_vsChoices.size(); c++) { @@ -354,14 +345,11 @@ OptionRow::InitText(RowType type) // init underlines if (m_pParentType->SHOW_UNDERLINES) { - FOREACH_PlayerNumber(p) - { - OptionsCursor* ul = - new OptionsCursor(m_pParentType->m_Underline[p]); - m_Underline[p].push_back(ul); - ul->SetX(fX); - ul->SetBarWidth(static_cast(fItemWidth)); - } + OptionsCursor* ul = + new OptionsCursor(m_pParentType->m_Underline[PLAYER_1]); + m_Underline[PLAYER_1].push_back(ul); + ul->SetX(fX); + ul->SetBarWidth(static_cast(fItemWidth)); } fX += fItemWidth / 2 + m_pParentType->ITEMS_GAP_X * fBaseZoom; @@ -375,8 +363,8 @@ OptionRow::InitText(RowType type) for (unsigned c = 0; c < m_textItems.size(); c++) m_Frame.AddChild(m_textItems[c]); - FOREACH_PlayerNumber(p) for (unsigned c = 0; c < m_Underline[p].size(); c++) - m_Frame.AddChild(m_Underline[p][c]); + for (unsigned c = 0; c < m_Underline[PLAYER_1].size(); c++) + m_Frame.AddChild(m_Underline[PLAYER_1][c]); // This is set in OptionRow::AfterImportOptions, so if we're reused with a // different song selected, SHOW_BPM_IN_SPEED_TITLE will show the new BPM. @@ -412,7 +400,7 @@ OptionRow::AfterImportOptions(PlayerNumber pn) PlayerNumber pnCopyFrom = GAMESTATE->GetMasterPlayerNumber(); if (GAMESTATE->GetMasterPlayerNumber() == PLAYER_INVALID) pnCopyFrom = PLAYER_1; - FOREACH_PlayerNumber(p) m_vbSelected[p] = m_vbSelected[pnCopyFrom]; + m_vbSelected[PLAYER_1] = m_vbSelected[pnCopyFrom]; } switch (m_pHand->m_Def.m_selectType) { @@ -724,7 +712,7 @@ OptionRow::SetOneSelection(PlayerNumber pn, int iChoice) void OptionRow::SetOneSharedSelection(int iChoice) { - FOREACH_PlayerNumber(pn) SetOneSelection(pn, iChoice); + SetOneSelection(PLAYER_1, iChoice); } void @@ -826,7 +814,7 @@ OptionRow::NotifyHandlerOfSelection(PlayerNumber pn, int choice) vector vpns; FOREACH_HumanPlayer(p) vpns.push_back(p); ImportOptions(vpns); - FOREACH_PlayerNumber(p) { PositionUnderlines(p); } + PositionUnderlines(PLAYER_1); UpdateEnabledDisabled(); } return changed; diff --git a/src/OptionRowHandler.h b/src/OptionRowHandler.h index 6da686490e..538bfe77c1 100644 --- a/src/OptionRowHandler.h +++ b/src/OptionRowHandler.h @@ -1,4 +1,4 @@ -#ifndef OptionRowHandler_H +#ifndef OptionRowHandler_H #define OptionRowHandler_H #include "GameCommand.h" @@ -90,7 +90,7 @@ struct OptionRowDefinition , m_vEnabledForPlayers() { - FOREACH_PlayerNumber(pn) m_vEnabledForPlayers.insert(pn); + m_vEnabledForPlayers.insert(PLAYER_1); } void Init() { @@ -101,7 +101,7 @@ struct OptionRowDefinition m_layoutType = LAYOUT_SHOW_ALL_IN_ROW; m_vsChoices.clear(); m_vEnabledForPlayers.clear(); - FOREACH_PlayerNumber(pn) m_vEnabledForPlayers.insert(pn); + m_vEnabledForPlayers.insert(PLAYER_1); m_iDefault = -1; m_bExportOnChange = false; m_bAllowThemeItems = true; @@ -139,7 +139,7 @@ struct OptionRowDefinition , m_vEnabledForPlayers() { - FOREACH_PlayerNumber(pn) m_vEnabledForPlayers.insert(pn); + m_vEnabledForPlayers.insert(PLAYER_1); #define PUSH(c) \ if (c) \ diff --git a/src/ProfileManager.cpp b/src/ProfileManager.cpp index 01a28be3be..49a68c8f00 100644 --- a/src/ProfileManager.cpp +++ b/src/ProfileManager.cpp @@ -101,14 +101,10 @@ ProfileManager::~ProfileManager() void ProfileManager::Init(LoadingWindow* ld) { - - FOREACH_PlayerNumber(p) - { - m_bLastLoadWasTamperedOrCorrupt[p] = false; - m_bLastLoadWasFromLastGood[p] = false; - m_bNeedToBackUpLastLoad[p] = false; - m_bNewProfile[p] = false; - } + m_bLastLoadWasTamperedOrCorrupt[PLAYER_1] = false; + m_bLastLoadWasFromLastGood[PLAYER_1] = false; + m_bNeedToBackUpLastLoad[PLAYER_1] = false; + m_bNewProfile[PLAYER_1] = false; RefreshLocalProfilesFromDisk(ld); diff --git a/src/ScreenEvaluation.cpp b/src/ScreenEvaluation.cpp index 0e4997a14f..cb6c4dd396 100644 --- a/src/ScreenEvaluation.cpp +++ b/src/ScreenEvaluation.cpp @@ -78,36 +78,32 @@ ScreenEvaluation::Init() ss.m_vpPlayedSongs.push_back(GAMESTATE->m_pCurSong); ss.m_vpPossibleSongs.push_back(GAMESTATE->m_pCurSong); GAMESTATE->m_iCurrentStageIndex = 0; - FOREACH_ENUM(PlayerNumber, p) - GAMESTATE->m_iPlayerStageTokens[p] = 1; - - FOREACH_PlayerNumber(p) - { - ss.m_player[p].m_pStyle = GAMESTATE->GetCurrentStyle(p); - if (RandomInt(2)) - PO_GROUP_ASSIGN_N(GAMESTATE->m_pPlayerState[p]->m_PlayerOptions, - ModsLevel_Stage, - m_bTransforms, - PlayerOptions::TRANSFORM_ECHO, - true); // show "disqualified" - SO_GROUP_ASSIGN( - GAMESTATE->m_SongOptions, ModsLevel_Stage, m_fMusicRate, 1.1f); - - GAMESTATE->JoinPlayer(p); - GAMESTATE->m_pCurSteps[p].Set( - GAMESTATE->m_pCurSong->GetAllSteps()[0]); - ss.m_player[p].m_vpPossibleSteps.push_back( - GAMESTATE->m_pCurSteps[PLAYER_1]); - ss.m_player[p].m_iStepsPlayed = 1; - - PO_GROUP_ASSIGN(GAMESTATE->m_pPlayerState[p]->m_PlayerOptions, - ModsLevel_Stage, - m_fScrollSpeed, - 2.0f); - PO_GROUP_CALL(GAMESTATE->m_pPlayerState[p]->m_PlayerOptions, - ModsLevel_Stage, - ChooseRandomModifiers); - } + GAMESTATE->m_iPlayerStageTokens[PLAYER_1] = 1; + + ss.m_player[PLAYER_1].m_pStyle = GAMESTATE->GetCurrentStyle(PLAYER_1); + if (RandomInt(2)) + PO_GROUP_ASSIGN_N(GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, + ModsLevel_Stage, + m_bTransforms, + PlayerOptions::TRANSFORM_ECHO, + true); // show "disqualified" + SO_GROUP_ASSIGN( + GAMESTATE->m_SongOptions, ModsLevel_Stage, m_fMusicRate, 1.1f); + + GAMESTATE->JoinPlayer(PLAYER_1); + GAMESTATE->m_pCurSteps[PLAYER_1].Set( + GAMESTATE->m_pCurSong->GetAllSteps()[0]); + ss.m_player[PLAYER_1].m_vpPossibleSteps.push_back( + GAMESTATE->m_pCurSteps[PLAYER_1]); + ss.m_player[PLAYER_1].m_iStepsPlayed = 1; + + PO_GROUP_ASSIGN(GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, + ModsLevel_Stage, + m_fScrollSpeed, + 2.0f); + PO_GROUP_CALL(GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, + ModsLevel_Stage, + ChooseRandomModifiers); for( float f = 0; f < 100.0f; f += 1.0f ) { @@ -115,68 +111,64 @@ ScreenEvaluation::Init() ss.m_player[PLAYER_1].SetLifeRecordAt( fP1, f ); //ss.m_player[PLAYER_2].SetLifeRecordAt( 1-fP1, f ); } - - FOREACH_PlayerNumber(p) + float fSeconds = GAMESTATE->m_pCurSong->GetStepsSeconds(); + ss.m_player[PLAYER_1].m_iActualDancePoints = RandomInt(3); + ss.m_player[PLAYER_1].m_iPossibleDancePoints = 2; + if (RandomInt(2)) + ss.m_player[PLAYER_1].m_iCurCombo = RandomInt(15000); + else + ss.m_player[PLAYER_1].m_iCurCombo = 0; + ss.m_player[PLAYER_1].UpdateComboList(0, true); + + ss.m_player[PLAYER_1].m_iCurCombo += 50; + ss.m_player[PLAYER_1].UpdateComboList(0.10f * fSeconds, false); + + ss.m_player[PLAYER_1].m_iCurCombo = 0; + ss.m_player[PLAYER_1].UpdateComboList(0.15f * fSeconds, false); + ss.m_player[PLAYER_1].m_iCurCombo = 1; + ss.m_player[PLAYER_1].UpdateComboList(0.25f * fSeconds, false); + ss.m_player[PLAYER_1].m_iCurCombo = 50; + ss.m_player[PLAYER_1].UpdateComboList(0.35f * fSeconds, false); + ss.m_player[PLAYER_1].m_iCurCombo = 0; + ss.m_player[PLAYER_1].UpdateComboList(0.45f * fSeconds, false); + ss.m_player[PLAYER_1].m_iCurCombo = 1; + ss.m_player[PLAYER_1].UpdateComboList(0.50f * fSeconds, false); + ss.m_player[PLAYER_1].m_iCurCombo = 100; + ss.m_player[PLAYER_1].UpdateComboList(1.00f * fSeconds, false); + if (RandomInt(5) == 0) { + ss.m_player[PLAYER_1].m_bFailed = true; + } + ss.m_player[PLAYER_1].m_iTapNoteScores[TNS_W1] = RandomInt(3); + ss.m_player[PLAYER_1].m_iTapNoteScores[TNS_W2] = RandomInt(3); + ss.m_player[PLAYER_1].m_iTapNoteScores[TNS_W3] = RandomInt(3); + ss.m_player[PLAYER_1].m_iPossibleGradePoints = + 4 * ScoreKeeperNormal::TapNoteScoreToGradePoints(TNS_W1, false); + ss.m_player[PLAYER_1].m_fLifeRemainingSeconds = randomf(90, 580); + ss.m_player[PLAYER_1].m_iScore = random_up_to(900 * 1000 * 1000); + ss.m_player[PLAYER_1].m_iPersonalHighScoreIndex = (random_up_to(3)) - 1; + ss.m_player[PLAYER_1].m_iMachineHighScoreIndex = (random_up_to(3)) - 1; + + FOREACH_ENUM(RadarCategory, rc) { - float fSeconds = GAMESTATE->m_pCurSong->GetStepsSeconds(); - ss.m_player[p].m_iActualDancePoints = RandomInt(3); - ss.m_player[p].m_iPossibleDancePoints = 2; - if (RandomInt(2)) - ss.m_player[p].m_iCurCombo = RandomInt(15000); - else - ss.m_player[p].m_iCurCombo = 0; - ss.m_player[p].UpdateComboList(0, true); - - ss.m_player[p].m_iCurCombo += 50; - ss.m_player[p].UpdateComboList(0.10f * fSeconds, false); - - ss.m_player[p].m_iCurCombo = 0; - ss.m_player[p].UpdateComboList(0.15f * fSeconds, false); - ss.m_player[p].m_iCurCombo = 1; - ss.m_player[p].UpdateComboList(0.25f * fSeconds, false); - ss.m_player[p].m_iCurCombo = 50; - ss.m_player[p].UpdateComboList(0.35f * fSeconds, false); - ss.m_player[p].m_iCurCombo = 0; - ss.m_player[p].UpdateComboList(0.45f * fSeconds, false); - ss.m_player[p].m_iCurCombo = 1; - ss.m_player[p].UpdateComboList(0.50f * fSeconds, false); - ss.m_player[p].m_iCurCombo = 100; - ss.m_player[p].UpdateComboList(1.00f * fSeconds, false); - if (RandomInt(5) == 0) { - ss.m_player[p].m_bFailed = true; + switch (rc) { + case RadarCategory_TapsAndHolds: + case RadarCategory_Jumps: + case RadarCategory_Holds: + case RadarCategory_Mines: + case RadarCategory_Hands: + case RadarCategory_Rolls: + case RadarCategory_Lifts: + case RadarCategory_Fakes: + ss.m_player[PLAYER_1].m_radarPossible[rc] = + 1 + (random_up_to(200)); + ss.m_player[PLAYER_1].m_radarActual[rc] = random_up_to( + static_cast(ss.m_player[PLAYER_1].m_radarPossible[rc])); + break; + default: + break; } - ss.m_player[p].m_iTapNoteScores[TNS_W1] = RandomInt(3); - ss.m_player[p].m_iTapNoteScores[TNS_W2] = RandomInt(3); - ss.m_player[p].m_iTapNoteScores[TNS_W3] = RandomInt(3); - ss.m_player[p].m_iPossibleGradePoints = - 4 * ScoreKeeperNormal::TapNoteScoreToGradePoints(TNS_W1, false); - ss.m_player[p].m_fLifeRemainingSeconds = randomf(90, 580); - ss.m_player[p].m_iScore = random_up_to(900 * 1000 * 1000); - ss.m_player[p].m_iPersonalHighScoreIndex = (random_up_to(3)) - 1; - ss.m_player[p].m_iMachineHighScoreIndex = (random_up_to(3)) - 1; - - FOREACH_ENUM(RadarCategory, rc) - { - switch (rc) { - case RadarCategory_TapsAndHolds: - case RadarCategory_Jumps: - case RadarCategory_Holds: - case RadarCategory_Mines: - case RadarCategory_Hands: - case RadarCategory_Rolls: - case RadarCategory_Lifts: - case RadarCategory_Fakes: - ss.m_player[p].m_radarPossible[rc] = - 1 + (random_up_to(200)); - ss.m_player[p].m_radarActual[rc] = random_up_to( - static_cast(ss.m_player[p].m_radarPossible[rc])); - break; - default: - break; - } - ; // filled in by ScreenGameplay on start of notes - } + ; // filled in by ScreenGameplay on start of notes } } @@ -207,7 +199,7 @@ ScreenEvaluation::Init() // Calculate grades Grade grade[NUM_PLAYERS]; - FOREACH_PlayerNumber(p) { grade[p] = Grade_Failed; } + grade[PLAYER_1] = Grade_Failed; // load sounds m_soundStart.Load(THEME->GetPathS(m_sName, "start")); @@ -218,31 +210,27 @@ ScreenEvaluation::Init() bool bOneHasFullW2Combo = false; bool bOneHasFullW3Combo = false; bool bOneHasFullW4Combo = false; + if (GAMESTATE->IsPlayerEnabled(PLAYER_1)) { + if ((m_pStageStats->m_player[PLAYER_1].m_iMachineHighScoreIndex == 0 || + m_pStageStats->m_player[PLAYER_1].m_iPersonalHighScoreIndex == 0)) { + bOneHasNewTopRecord = true; + } - FOREACH_PlayerNumber(p) - { - if (GAMESTATE->IsPlayerEnabled(p)) { - if ((m_pStageStats->m_player[p].m_iMachineHighScoreIndex == 0 || - m_pStageStats->m_player[p].m_iPersonalHighScoreIndex == 0)) { - bOneHasNewTopRecord = true; - } - - if (m_pStageStats->m_player[p].FullComboOfScore(TNS_W4)) - bOneHasFullW4Combo = true; + if (m_pStageStats->m_player[PLAYER_1].FullComboOfScore(TNS_W4)) + bOneHasFullW4Combo = true; - if (m_pStageStats->m_player[p].FullComboOfScore(TNS_W3)) - bOneHasFullW3Combo = true; + if (m_pStageStats->m_player[PLAYER_1].FullComboOfScore(TNS_W3)) + bOneHasFullW3Combo = true; - if (m_pStageStats->m_player[p].FullComboOfScore(TNS_W2)) - bOneHasFullW2Combo = true; + if (m_pStageStats->m_player[PLAYER_1].FullComboOfScore(TNS_W2)) + bOneHasFullW2Combo = true; - if (m_pStageStats->m_player[p].FullComboOfScore(TNS_W1)) - bOneHasFullW1Combo = true; - } + if (m_pStageStats->m_player[PLAYER_1].FullComboOfScore(TNS_W1)) + bOneHasFullW1Combo = true; } Grade best_grade = Grade_NoData; - FOREACH_PlayerNumber(p) best_grade = min(best_grade, grade[p]); + best_grade = min(best_grade, grade[PLAYER_1]); if (bOneHasNewTopRecord && ANNOUNCER->HasSoundsFor("evaluation new record")) { diff --git a/src/ScreenGameplay.cpp b/src/ScreenGameplay.cpp index 3e7a2c786d..5cbfe5ae07 100644 --- a/src/ScreenGameplay.cpp +++ b/src/ScreenGameplay.cpp @@ -383,11 +383,8 @@ ScreenGameplay::Init() STATSMAN->m_CurStageStats.m_playMode = GAMESTATE->m_PlayMode; - FOREACH_PlayerNumber(pn) - { - STATSMAN->m_CurStageStats.m_player[pn].m_pStyle = - GAMESTATE->GetCurrentStyle(pn); - } + STATSMAN->m_CurStageStats.m_player[PLAYER_1].m_pStyle = + GAMESTATE->GetCurrentStyle(PLAYER_1); FOREACH_MultiPlayer(pn) { STATSMAN->m_CurStageStats.m_multiPlayer[pn].m_pStyle = diff --git a/src/ScreenGameplayNormal.cpp b/src/ScreenGameplayNormal.cpp index 16044d9bd5..95c541d829 100644 --- a/src/ScreenGameplayNormal.cpp +++ b/src/ScreenGameplayNormal.cpp @@ -8,8 +8,8 @@ void ScreenGameplayNormal::FillPlayerInfo(vector& vPlayerInfoOut) { vPlayerInfoOut.resize(NUM_PLAYERS); - FOREACH_PlayerNumber(p) vPlayerInfoOut[p].Load( - p, MultiPlayer_Invalid, true, Difficulty_Invalid); + vPlayerInfoOut[PLAYER_1].Load( + PLAYER_1, MultiPlayer_Invalid, true, Difficulty_Invalid); }; // lua end diff --git a/src/ScreenGameplaySyncMachine.cpp b/src/ScreenGameplaySyncMachine.cpp index ae52a5085c..e419155335 100644 --- a/src/ScreenGameplaySyncMachine.cpp +++ b/src/ScreenGameplaySyncMachine.cpp @@ -105,7 +105,7 @@ ScreenGameplaySyncMachine::HandleScreenMessage(const ScreenMessage SM) ScreenGameplayNormal::HandleScreenMessage(SM); if (SM == SM_GoToPrevScreen || SM == SM_GoToNextScreen) { - FOREACH_PlayerNumber(pn) { GAMESTATE->m_pCurSteps[pn].Set(NULL); } + GAMESTATE->m_pCurSteps[PLAYER_1].Set(NULL); GAMESTATE->m_PlayMode.Set(PlayMode_Invalid); GAMESTATE->SetCurrentStyle(NULL, PLAYER_INVALID); GAMESTATE->m_pCurSong.Set(NULL); diff --git a/src/ScreenMiniMenu.cpp b/src/ScreenMiniMenu.cpp index aec36cb5b0..e1f7ee33b3 100644 --- a/src/ScreenMiniMenu.cpp +++ b/src/ScreenMiniMenu.cpp @@ -111,7 +111,7 @@ ScreenMiniMenu::AfterChangeValueOrRow(PlayerNumber pn) ScreenOptions::AfterChangeValueOrRow(pn); vector vpns; - FOREACH_PlayerNumber(p) vpns.push_back(p); + vpns.push_back(PLAYER_1); for (unsigned i = 0; i < m_pRows.size(); i++) ExportOptions(i, vpns); diff --git a/src/ScreenOptions.cpp b/src/ScreenOptions.cpp index 13279cb5a0..aceaeb00ce 100644 --- a/src/ScreenOptions.cpp +++ b/src/ScreenOptions.cpp @@ -138,37 +138,30 @@ ScreenOptions::Init() m_frameContainer.AddChild(m_sprPage); // init line highlights - FOREACH_PlayerNumber(p) - { - m_sprLineHighlight[p].Load( - THEME->GetPathG(m_sName, ssprintf("LineHighlight P%d", p + 1))); - m_sprLineHighlight[p]->SetName(ssprintf("LineHighlightP%d", p + 1)); - m_sprLineHighlight[p]->SetX(LINE_HIGHLIGHT_X); - LOAD_ALL_COMMANDS(m_sprLineHighlight[p]); - m_frameContainer.AddChild(m_sprLineHighlight[p]); - } + m_sprLineHighlight[PLAYER_1].Load( + THEME->GetPathG(m_sName, ssprintf("LineHighlight P%d", PLAYER_1 + 1))); + m_sprLineHighlight[PLAYER_1]->SetName( + ssprintf("LineHighlightP%d", PLAYER_1 + 1)); + m_sprLineHighlight[PLAYER_1]->SetX(LINE_HIGHLIGHT_X); + LOAD_ALL_COMMANDS(m_sprLineHighlight[PLAYER_1]); + m_frameContainer.AddChild(m_sprLineHighlight[PLAYER_1]); // init cursors - FOREACH_PlayerNumber(p) - { - m_Cursor[p].Load("OptionsCursor" + PlayerNumberToString(p), true); - m_Cursor[p].SetName("Cursor"); - LOAD_ALL_COMMANDS(m_Cursor[p]); - m_frameContainer.AddChild(&m_Cursor[p]); - } + m_Cursor[PLAYER_1].Load("OptionsCursor" + PlayerNumberToString(PLAYER_1), + true); + m_Cursor[PLAYER_1].SetName("Cursor"); + LOAD_ALL_COMMANDS(m_Cursor[PLAYER_1]); + m_frameContainer.AddChild(&m_Cursor[PLAYER_1]); switch (m_InputMode) { case INPUTMODE_INDIVIDUAL: - FOREACH_PlayerNumber(p) - { - m_textExplanation[p].LoadFromFont( - THEME->GetPathF(m_sName, "explanation")); - m_textExplanation[p].SetDrawOrder(2); - m_textExplanation[p].SetName("Explanation" + - PlayerNumberToString(p)); - LOAD_ALL_COMMANDS_AND_SET_XY(m_textExplanation[p]); - m_frameContainer.AddChild(&m_textExplanation[p]); - } + m_textExplanation[PLAYER_1].LoadFromFont( + THEME->GetPathF(m_sName, "explanation")); + m_textExplanation[PLAYER_1].SetDrawOrder(2); + m_textExplanation[PLAYER_1].SetName("Explanation" + + PlayerNumberToString(PLAYER_1)); + LOAD_ALL_COMMANDS_AND_SET_XY(m_textExplanation[PLAYER_1]); + m_frameContainer.AddChild(&m_textExplanation[PLAYER_1]); break; case INPUTMODE_SHARE_CURSOR: m_textExplanationTogether.LoadFromFont( @@ -187,8 +180,7 @@ ScreenOptions::Init() m_ScrollBar.SetBarHeight(SCROLL_BAR_HEIGHT); m_ScrollBar.SetBarTime(SCROLL_BAR_TIME); m_ScrollBar.Load("DualScrollBar"); - FOREACH_PlayerNumber(p) - m_ScrollBar.EnablePlayer(p, GAMESTATE->IsHumanPlayer(p)); + m_ScrollBar.EnablePlayer(PLAYER_1, GAMESTATE->IsHumanPlayer(PLAYER_1)); LOAD_ALL_COMMANDS_AND_SET_XY(m_ScrollBar); m_ScrollBar.SetDrawOrder(2); m_frameContainer.AddChild(&m_ScrollBar); @@ -274,29 +266,26 @@ ScreenOptions::RestartOptions() this->ImportOptions(r, vpns); // HACK: Process disabled players, too, to hide inactive underlines. - FOREACH_PlayerNumber(p) pRow->AfterImportOptions(p); + pRow->AfterImportOptions(PLAYER_1); } - FOREACH_PlayerNumber(p) - { - m_iCurrentRow[p] = -1; - m_iFocusX[p] = -1; - m_bWasOnExit[p] = false; - - // put focus on the first enabled row - for (unsigned r = 0; r < m_pRows.size(); r++) { - const OptionRow& row = *m_pRows[r]; - if (row.GetRowDef().IsEnabledForPlayer(p)) { - m_iCurrentRow[p] = r; - break; - } - } + m_iCurrentRow[PLAYER_1] = -1; + m_iFocusX[PLAYER_1] = -1; + m_bWasOnExit[PLAYER_1] = false; - // Hide the highlight if no rows are enabled. - m_sprLineHighlight[p]->SetVisible(m_iCurrentRow[p] != -1 && - GAMESTATE->IsHumanPlayer(p)); + // put focus on the first enabled row + for (unsigned r = 0; r < m_pRows.size(); r++) { + const OptionRow& row = *m_pRows[r]; + if (row.GetRowDef().IsEnabledForPlayer(PLAYER_1)) { + m_iCurrentRow[PLAYER_1] = r; + break; + } } + // Hide the highlight if no rows are enabled. + m_sprLineHighlight[PLAYER_1]->SetVisible( + m_iCurrentRow[PLAYER_1] != -1 && GAMESTATE->IsHumanPlayer(PLAYER_1)); + CHECKPOINT_M("About to get the rows positioned right."); PositionRows(false); @@ -308,7 +297,7 @@ ScreenOptions::RestartOptions() PositionCursor(pn); } - FOREACH_PlayerNumber(p) { AfterChangeRow(p); } + AfterChangeRow(PLAYER_1); CHECKPOINT_M("Rows positioned."); } @@ -319,15 +308,12 @@ ScreenOptions::BeginScreen() RestartOptions(); - FOREACH_PlayerNumber(p) m_bGotAtLeastOneStartPressed[p] = false; + m_bGotAtLeastOneStartPressed[PLAYER_1] = false; ON_COMMAND(m_frameContainer); - FOREACH_PlayerNumber(p) - { - m_Cursor[p].SetVisible(GAMESTATE->IsHumanPlayer(p)); - ON_COMMAND(m_Cursor[p]); - } + m_Cursor[PLAYER_1].SetVisible(GAMESTATE->IsHumanPlayer(PLAYER_1)); + ON_COMMAND(m_Cursor[PLAYER_1]); this->SortByDrawOrder(); } @@ -602,9 +588,11 @@ ScreenOptions::PositionRows(bool bTween) int first_start, first_end, second_start, second_end; - // Choices for each player. If only one player is active, it's the same for both. + // Choices for each player. If only one player is active, it's the same for + // both. int P1Choice = m_iCurrentRow[PLAYER_1]; - //int P2Choice = GAMESTATE->IsHumanPlayer(PLAYER_2)? m_iCurrentRow[PLAYER_2]: m_iCurrentRow[PLAYER_1]; + // int P2Choice = GAMESTATE->IsHumanPlayer(PLAYER_2)? + // m_iCurrentRow[PLAYER_2]: m_iCurrentRow[PLAYER_1]; vector Rows(m_pRows); OptionRow* pSeparateExitRow = NULL; @@ -623,8 +611,7 @@ ScreenOptions::PositionRows(bool bTween) } const bool BothPlayersActivated = GAMESTATE->IsHumanPlayer(PLAYER_1); - if( m_InputMode == INPUTMODE_SHARE_CURSOR || !BothPlayersActivated ) - { + if (m_InputMode == INPUTMODE_SHARE_CURSOR || !BothPlayersActivated) { // Simply center the cursor. first_start = max(P1Choice - halfsize, 0); first_end = first_start + total; @@ -632,7 +619,7 @@ ScreenOptions::PositionRows(bool bTween) } else { // First half: const int earliest = P1Choice; - first_start = max( earliest - halfsize/2, 0 ); + first_start = max(earliest - halfsize / 2, 0); first_end = first_start + halfsize; // Second half: @@ -745,21 +732,17 @@ ScreenOptions::AfterChangeValueOrRow(PlayerNumber pn) // Update all players, since changing one player can move both cursors. FOREACH_HumanPlayer(p) TweenCursor(p); - - FOREACH_PlayerNumber(p) - { - OptionRow& row = *m_pRows[iCurRow]; - const bool bExitSelected = row.GetRowType() == OptionRow::RowType_Exit; - if (GAMESTATE->GetNumHumanPlayers() != 1 && p != pn) - continue; - if (m_bWasOnExit[p] != bExitSelected) { - m_bWasOnExit[p] = bExitSelected; - COMMAND(m_sprMore, - ssprintf("Exit%sP%i", - bExitSelected ? "Selected" : "Unselected", - p + 1)); - m_sprMore->PlayCommand(bExitSelected ? "GainFocus" : "LoseFocus"); - } + OptionRow& row = *m_pRows[iCurRow]; + const bool bExitSelected = row.GetRowType() == OptionRow::RowType_Exit; + if (GAMESTATE->GetNumHumanPlayers() != 1 && PLAYER_1 != pn) + return; + if (m_bWasOnExit[PLAYER_1] != bExitSelected) { + m_bWasOnExit[PLAYER_1] = bExitSelected; + COMMAND(m_sprMore, + ssprintf("Exit%sP%i", + bExitSelected ? "Selected" : "Unselected", + PLAYER_1 + 1)); + m_sprMore->PlayCommand(bExitSelected ? "GainFocus" : "LoseFocus"); } const RString text = GetExplanationText(iCurRow); @@ -1145,11 +1128,8 @@ ScreenOptions::ChangeValueInRowRelative(int iRow, } } - FOREACH_PlayerNumber(p) - { - if (!row.GetRowDef().m_bOneChoiceForAllPlayers && p != pn) - continue; - + if (!row.GetRowDef().m_bOneChoiceForAllPlayers && PLAYER_1 != pn) { + } else { if (m_OptionsNavigation == NAV_TOGGLE_THREE_KEY || m_OptionsNavigation == NAV_TOGGLE_FIVE_KEY) { ; // do nothing @@ -1157,7 +1137,7 @@ ScreenOptions::ChangeValueInRowRelative(int iRow, if (row.GetRowDef().m_selectType == SELECT_MULTIPLE) ; // do nothing. User must press Start to toggle the selection. else - row.SetOneSelection(p, iNewChoiceWithFocus); + row.SetOneSelection(PLAYER_1, iNewChoiceWithFocus); } } @@ -1254,25 +1234,25 @@ bool ScreenOptions::MoveRowAbsolute(PlayerNumber pn, int iRow) { bool bChanged = false; - FOREACH_PlayerNumber(p) + if (m_InputMode == INPUTMODE_INDIVIDUAL && PLAYER_1 != pn) { + } // skip + else if (m_iCurrentRow[PLAYER_1] == iRow) + { + // also skip + } + else { - if (m_InputMode == INPUTMODE_INDIVIDUAL && p != pn) - continue; // skip - - if (m_iCurrentRow[p] == iRow) - continue; - m_iCurrentRow[p] = iRow; + m_iCurrentRow[PLAYER_1] = iRow; - AfterChangeRow(p); + AfterChangeRow(PLAYER_1); bChanged = true; const OptionRow& row = *m_pRows[iRow]; Message msg("ChangeRow"); - msg.SetParam("PlayerNumber", p); - msg.SetParam("RowIndex", GetCurrentRow(p)); - msg.SetParam("ChangedToExit", - row.GetRowType() == OptionRow::RowType_Exit); + msg.SetParam("PlayerNumber", PLAYER_1); + msg.SetParam("RowIndex", GetCurrentRow(PLAYER_1)); + msg.SetParam("ChangedToExit", row.GetRowType() == OptionRow::RowType_Exit); MESSAGEMAN->Broadcast(msg); } @@ -1364,13 +1344,10 @@ ScreenOptions::MenuUpDown(const InputEventPlus& input, int iDir) /* void ScreenOptions::SetOptionRowFromName( const RString& nombre ) { - FOREACH_PlayerNumber( pn ) + for( unsigned i=0; iGetRowTitle() == nombre) && -m_pRows[i]->GetRowDef().IsEnabledForPlayer(p) ) MoveRowAbsolute(pn,i) - } + if( m_pRows[i]->GetRowTitle() == nombre) && +m_pRows[i]->GetRowDef().IsEnabledForPlayer(PLAYER_1) ) MoveRowAbsolute(PLAYER_1,i) } } */ @@ -1388,8 +1365,7 @@ class LunaScreenOptions : public Luna } static int FocusedItemEndsScreen(T* p, lua_State* L) { - lua_pushboolean( - L, p->FocusedItemEndsScreen(PLAYER_1)); + lua_pushboolean(L, p->FocusedItemEndsScreen(PLAYER_1)); return 1; } static int GetCurrentRowIndex(T* p, lua_State* L) diff --git a/src/ScreenOptionsManageProfiles.cpp b/src/ScreenOptionsManageProfiles.cpp index 193eb3daaa..dc4562d89d 100644 --- a/src/ScreenOptionsManageProfiles.cpp +++ b/src/ScreenOptionsManageProfiles.cpp @@ -141,9 +141,7 @@ ScreenOptionsManageProfiles::BeginScreen() def.m_sExplanationName = "Select Profile"; PlayerNumber pn = PLAYER_INVALID; - FOREACH_PlayerNumber( - p) if (*s == ProfileManager::m_sDefaultLocalProfileID[p].Get()) pn = - p; + if (*s == ProfileManager::m_sDefaultLocalProfileID[PLAYER_1].Get()) pn = PLAYER_1; if (pn != PLAYER_INVALID) def.m_vsChoices.push_back(PlayerNumberToLocalizedString(pn)); OptionRowHandlers.push_back(pHand); @@ -283,10 +281,9 @@ ScreenOptionsManageProfiles::HandleScreenMessage(const ScreenMessage SM) ScreenMiniMenu::s_iLastRowCode)); case ProfileAction_SetDefaultP1: case ProfileAction_SetDefaultP2: { - FOREACH_PlayerNumber( - p) if (ProfileManager::m_sDefaultLocalProfileID[p] + if (ProfileManager::m_sDefaultLocalProfileID[PLAYER_1] .Get() == GetLocalProfileIDWithFocus()) - ProfileManager::m_sDefaultLocalProfileID[p] + ProfileManager::m_sDefaultLocalProfileID[PLAYER_1] .Set(""); auto pn = diff --git a/src/ScreenOptionsMaster.cpp b/src/ScreenOptionsMaster.cpp index 5f71b0fbce..9a430d9721 100644 --- a/src/ScreenOptionsMaster.cpp +++ b/src/ScreenOptionsMaster.cpp @@ -37,7 +37,7 @@ ScreenOptionsMaster::Init() } if (FORCE_ALL_PLAYERS) { - FOREACH_PlayerNumber(pn) GAMESTATE->JoinPlayer(pn); + GAMESTATE->JoinPlayer(PLAYER_1); } if (NAVIGATION_MODE == "toggle") diff --git a/src/ScreenPlayerOptions.cpp b/src/ScreenPlayerOptions.cpp index e87c3e5c81..373fca9fbf 100644 --- a/src/ScreenPlayerOptions.cpp +++ b/src/ScreenPlayerOptions.cpp @@ -20,17 +20,13 @@ void ScreenPlayerOptions::Init() { ScreenOptionsMaster::Init(); - - FOREACH_PlayerNumber(p) - { - m_sprDisqualify[p].Load(THEME->GetPathG(m_sName, "disqualify")); - m_sprDisqualify[p]->SetName(ssprintf("DisqualifyP%i", p + 1)); - LOAD_ALL_COMMANDS_AND_SET_XY(m_sprDisqualify[p]); - m_sprDisqualify[p]->SetVisible( - false); // unhide later if handicapping options are discovered - m_sprDisqualify[p]->SetDrawOrder(2); - m_frameContainer.AddChild(m_sprDisqualify[p]); - } + m_sprDisqualify[PLAYER_1].Load(THEME->GetPathG(m_sName, "disqualify")); + m_sprDisqualify[PLAYER_1]->SetName(ssprintf("DisqualifyP%i", PLAYER_1 + 1)); + LOAD_ALL_COMMANDS_AND_SET_XY(m_sprDisqualify[PLAYER_1]); + m_sprDisqualify[PLAYER_1]->SetVisible( + false); // unhide later if handicapping options are discovered + m_sprDisqualify[PLAYER_1]->SetDrawOrder(2); + m_frameContainer.AddChild(m_sprDisqualify[PLAYER_1]); m_bAskOptionsMessage = PREFSMAN->m_ShowSongOptions == Maybe_ASK; @@ -39,14 +35,13 @@ ScreenPlayerOptions::Init() SOUND->PlayOnceFromDir(ANNOUNCER->GetPathTo("player options intro")); - FOREACH_PlayerNumber(p) m_bRowCausesDisqualified[p].resize(m_pRows.size(), - false); + m_bRowCausesDisqualified[PLAYER_1].resize(m_pRows.size(), false); } void ScreenPlayerOptions::BeginScreen() { - FOREACH_PlayerNumber(p) ON_COMMAND(m_sprDisqualify[p]); + ON_COMMAND(m_sprDisqualify[PLAYER_1]); ScreenOptionsMaster::BeginScreen(); diff --git a/src/ScreenSMOnlineLogin.cpp b/src/ScreenSMOnlineLogin.cpp index 0f37ea40b4..e5c8871751 100644 --- a/src/ScreenSMOnlineLogin.cpp +++ b/src/ScreenSMOnlineLogin.cpp @@ -41,7 +41,7 @@ ScreenSMOnlineLogin::Init() pHand->m_Def.m_bAllowThemeItems = false; pHand->m_Def.m_vEnabledForPlayers.clear(); - FOREACH_PlayerNumber(pn) pHand->m_Def.m_vEnabledForPlayers.insert(pn); + pHand->m_Def.m_vEnabledForPlayers.insert(PLAYER_1); PROFILEMAN->GetLocalProfileDisplayNames(pHand->m_Def.m_vsChoices); pHand->m_Def.m_vsChoices.emplace_back("Type Username"); @@ -66,16 +66,13 @@ ScreenSMOnlineLogin::ImportOptions(int iRow, const vector& vpns) vector vsProfiles; PROFILEMAN->GetLocalProfileIDs(vsProfiles); - FOREACH_PlayerNumber(pn) - { - vector::iterator iter = - find(vsProfiles.begin(), - vsProfiles.end(), - ProfileManager::m_sDefaultLocalProfileID[pn].Get()); - if (iter != vsProfiles.end()) - m_pRows[0]->SetOneSelection((PlayerNumber)pn, - iter - vsProfiles.begin()); - } + vector::iterator iter = + find(vsProfiles.begin(), + vsProfiles.end(), + ProfileManager::m_sDefaultLocalProfileID[PLAYER_1].Get()); + if (iter != vsProfiles.end()) + m_pRows[0]->SetOneSelection((PlayerNumber)PLAYER_1, + iter - vsProfiles.begin()); } break; } } diff --git a/src/ScreenSelectMaster.cpp b/src/ScreenSelectMaster.cpp index 571516a64d..3d6ad45159 100644 --- a/src/ScreenSelectMaster.cpp +++ b/src/ScreenSelectMaster.cpp @@ -343,24 +343,21 @@ ScreenSelectMaster::BeginScreen() } } - FOREACH_PlayerNumber(p) - { - m_iChoice[p] = (iDefaultChoice != -1) ? iDefaultChoice : 0; - CLAMP(m_iChoice[p], 0, (int)m_aGameCommands.size() - 1); - m_bChosen[p] = false; - m_bDoubleChoice[p] = false; - } + m_iChoice[PLAYER_1] = (iDefaultChoice != -1) ? iDefaultChoice : 0; + CLAMP(m_iChoice[PLAYER_1], 0, (int)m_aGameCommands.size() - 1); + m_bChosen[PLAYER_1] = false; + m_bDoubleChoice[PLAYER_1] = false; + if (!SHARED_SELECTION) { - FOREACH_ENUM(PlayerNumber, pn) + if (GAMESTATE->IsHumanPlayer(PLAYER_1)) + {} else { - if (GAMESTATE->IsHumanPlayer(pn)) - continue; - if (SHOW_CURSOR) { - if (m_sprCursor[pn]) - m_sprCursor[pn]->SetVisible(false); - } - if (SHOW_SCROLLER) - m_Scroller[pn].SetVisible(false); + if (SHOW_CURSOR) { + if (m_sprCursor[PLAYER_1]) + m_sprCursor[PLAYER_1]->SetVisible(false); + } + if (SHOW_SCROLLER) + m_Scroller[PLAYER_1].SetVisible(false); } } @@ -440,7 +437,7 @@ ScreenSelectMaster::UpdateSelectableChoices() GetActiveElementPlayerNumbers(vpns); int first_playable = -1; bool on_unplayable[NUM_PLAYERS]; - FOREACH_PlayerNumber(pn) { on_unplayable[pn] = false; } + on_unplayable[PLAYER_1] = false; for (unsigned c = 0; c < m_aGameCommands.size(); c++) { RString command = "Enabled"; @@ -648,14 +645,11 @@ ScreenSelectMaster::ChangePage(int iNewChoice) Page newPage = GetPage(iNewChoice); // If anyone has already chosen, don't allow changing of pages - FOREACH_PlayerNumber(p) - { - if (GAMESTATE->IsHumanPlayer(p) && m_bChosen[p]) - return false; - } + if (GAMESTATE->IsHumanPlayer(PLAYER_1) && m_bChosen[PLAYER_1]) + return false; // change both players - FOREACH_PlayerNumber(p) m_iChoice[p] = iNewChoice; + m_iChoice[PLAYER_1] = iNewChoice; const RString sIconAndExplanationCommand = ssprintf("SwitchToPage%d", newPage + 1); @@ -721,8 +715,7 @@ ScreenSelectMaster::ChangeSelection(PlayerNumber pn, if (SHARED_SELECTION || page != PAGE_1) { /* Set the new m_iChoice even for disabled players, since a player might * join on a SHARED_SELECTION after the cursor has been moved. */ - FOREACH_ENUM(PlayerNumber, p) - vpns.push_back(p); + vpns.push_back(PLAYER_1); } else { vpns.push_back(pn); } @@ -857,7 +850,7 @@ ScreenSelectMaster::DoMenuStart(PlayerNumber pn) return 0; bool bAnyChosen = false; - FOREACH_PlayerNumber(p) bAnyChosen |= m_bChosen[p]; + bAnyChosen |= m_bChosen[PLAYER_1]; m_bChosen[pn] = true; diff --git a/src/ScreenSelectMusic.cpp b/src/ScreenSelectMusic.cpp index 9da31c5d27..29fa56d943 100644 --- a/src/ScreenSelectMusic.cpp +++ b/src/ScreenSelectMusic.cpp @@ -146,12 +146,8 @@ ScreenSelectMusic::Init() INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric(m_sName, "NextGroupButton")); } - - FOREACH_ENUM(PlayerNumber, p) - { - m_bSelectIsDown[p] = false; // used by UpdateSelectButton - m_bAcceptSelectRelease[p] = false; - } + m_bSelectIsDown[PLAYER_1] = false; // used by UpdateSelectButton + m_bAcceptSelectRelease[PLAYER_1] = false; ScreenWithMenuElements::Init(); @@ -177,14 +173,11 @@ ScreenSelectMusic::Init() this->AddChild(&m_MusicWheel); if (USE_OPTIONS_LIST) { - FOREACH_PlayerNumber(p) - { - m_OptionsList[p].SetName("OptionsList" + PlayerNumberToString(p)); - m_OptionsList[p].Load("OptionsList", p); - m_OptionsList[p].SetDrawOrder(100); - ActorUtil::LoadAllCommands(m_OptionsList[p], m_sName); - this->AddChild(&m_OptionsList[p]); - } + m_OptionsList[PLAYER_1].SetName("OptionsList" + PlayerNumberToString(PLAYER_1)); + m_OptionsList[PLAYER_1].Load("OptionsList", PLAYER_1); + m_OptionsList[PLAYER_1].SetDrawOrder(100); + ActorUtil::LoadAllCommands(m_OptionsList[PLAYER_1], m_sName); + this->AddChild(&m_OptionsList[PLAYER_1]); /*m_OptionsList[PLAYER_1].Link(&m_OptionsList[PLAYER_2]); m_OptionsList[PLAYER_2].Link(&m_OptionsList[PLAYER_1]); */ @@ -256,7 +249,7 @@ ScreenSelectMusic::BeginScreen() ZERO(m_iSelection); if (USE_OPTIONS_LIST) - FOREACH_PlayerNumber(pn) m_OptionsList[pn].Reset(); + m_OptionsList[PLAYER_1].Reset(); AfterMusicChange(); @@ -782,8 +775,7 @@ ScreenSelectMusic::Input(const InputEventPlus& input) msg.SetParam("Player", input.pn); MESSAGEMAN->Broadcast(msg); // unset all steps - FOREACH_ENUM(PlayerNumber, p) - m_bStepsChosen[p] = false; + m_bStepsChosen[PLAYER_1] = false; m_SelectionState = SelectionState_SelectingSong; } } @@ -930,8 +922,7 @@ ScreenSelectMusic::HandleMessage(const Message& msg) // That way, after music change will clamp to the nearest in the // StepsDisplayList. GAMESTATE->m_pCurSteps[master_pn].SetWithoutBroadcast(NULL); - FOREACH_ENUM(PlayerNumber, p) - GAMESTATE->m_pCurSteps[p].SetWithoutBroadcast(NULL); + GAMESTATE->m_pCurSteps[PLAYER_1].SetWithoutBroadcast(NULL); /* If a course is selected, it may no longer be playable. * Let MusicWheel know about the late join. */ @@ -1138,15 +1129,11 @@ ScreenSelectMusic::SelectCurrent(PlayerNumber pn) } } break; } - - FOREACH_ENUM(PlayerNumber, p) - { - if (m_SelectionState == SelectionState_SelectingSteps) { - if (m_OptionsList[p].IsOpened()) - m_OptionsList[p].Close(); - } - UpdateSelectButton(p, false); + if (m_SelectionState == SelectionState_SelectingSteps) { + if (m_OptionsList[PLAYER_1].IsOpened()) + m_OptionsList[PLAYER_1].Close(); } + UpdateSelectButton(PLAYER_1, false); m_SelectionState = GetNextSelectionState(); Message msg("Start" + SelectionStateToString(m_SelectionState)); @@ -1338,7 +1325,7 @@ ScreenSelectMusic::AfterMusicChange() case WheelItemDataType_Roulette: case WheelItemDataType_Random: case WheelItemDataType_Custom: - FOREACH_PlayerNumber(p) m_iSelection[p] = -1; + m_iSelection[PLAYER_1] = -1; if (SAMPLE_MUSIC_PREVIEW_MODE == SampleMusicPreviewMode_LastSong) { // HACK: Make random music work in LastSong mode. -aj if (m_sSampleMusicToPlay == m_sRandomMusicPath) { diff --git a/src/ScreenSelectProfile.cpp b/src/ScreenSelectProfile.cpp index 27917b806f..c8fd923dc5 100644 --- a/src/ScreenSelectProfile.cpp +++ b/src/ScreenSelectProfile.cpp @@ -10,11 +10,8 @@ REGISTER_SCREEN_CLASS(ScreenSelectProfile); void ScreenSelectProfile::Init() { - FOREACH_PlayerNumber(p) - { - // no selection initially - m_iSelectedProfiles[p] = -1; - } + // no selection initially + m_iSelectedProfiles[PLAYER_1] = -1; m_TrackingRepeatingInput = GameButton_Invalid; ScreenWithMenuElements::Init(); } @@ -159,24 +156,21 @@ ScreenSelectProfile::Finish() int iUsedLocalProfiles = 0; int iUnselectedProfiles = 0; - FOREACH_PlayerNumber(p) - { - // not all players has made their choices - if (GAMESTATE->IsHumanPlayer(p) && (m_iSelectedProfiles[p] == -1)) - iUnselectedProfiles++; + // not all players has made their choices + if (GAMESTATE->IsHumanPlayer(PLAYER_1) && (m_iSelectedProfiles[PLAYER_1] == -1)) + iUnselectedProfiles++; - // card not ready - if (m_iSelectedProfiles[p] == 0) - return false; + // card not ready + if (m_iSelectedProfiles[PLAYER_1] == 0) + return false; - // profile index too big - if (m_iSelectedProfiles[p] > PROFILEMAN->GetNumLocalProfiles()) - return false; + // profile index too big + if (m_iSelectedProfiles[PLAYER_1] > PROFILEMAN->GetNumLocalProfiles()) + return false; - // inc used profile count - if (m_iSelectedProfiles[p] > 0) - iUsedLocalProfiles++; - } + // inc used profile count + if (m_iSelectedProfiles[PLAYER_1] > 0) + iUsedLocalProfiles++; // this allows to continue if there is less local profiles than number of // human players @@ -185,17 +179,13 @@ ScreenSelectProfile::Finish() return false; // all ok - load profiles and go to next screen - FOREACH_PlayerNumber(p) - { - PROFILEMAN->UnloadProfile(p); - - if (m_iSelectedProfiles[p] > 0) { - PROFILEMAN->m_sDefaultLocalProfileID[p].Set( - PROFILEMAN->GetLocalProfileIDFromIndex(m_iSelectedProfiles[p] - - 1)); - PROFILEMAN->LoadLocalProfileFromMachine(p); - GAMESTATE->LoadCurrentSettingsFromProfile(p); - } + PROFILEMAN->UnloadProfile(PLAYER_1); + + if (m_iSelectedProfiles[PLAYER_1] > 0) { + PROFILEMAN->m_sDefaultLocalProfileID[PLAYER_1].Set( + PROFILEMAN->GetLocalProfileIDFromIndex(m_iSelectedProfiles[PLAYER_1] - 1)); + PROFILEMAN->LoadLocalProfileFromMachine(PLAYER_1); + GAMESTATE->LoadCurrentSettingsFromProfile(PLAYER_1); } StartTransitioningScreen(SM_GoToNextScreen); return true; diff --git a/src/StageStats.cpp b/src/StageStats.cpp index 28c036ede4..97660ed3b9 100644 --- a/src/StageStats.cpp +++ b/src/StageStats.cpp @@ -302,7 +302,7 @@ StageStats::StageStats() m_fGameplaySeconds = 0; m_fStepsSeconds = 0; m_fMusicRate = 1; - FOREACH_PlayerNumber(pn) { m_player[pn].Init(pn); } + m_player[PLAYER_1].Init(PLAYER_1); FOREACH_MultiPlayer(pn) { m_multiPlayer[pn].Init(pn); } } @@ -604,11 +604,8 @@ StageStats::FinalizeScores(bool bSummary) SCOREMAN->camefromreplay = false; // if we're viewing an online replay this gets set to true -mina if (PREFSMAN->m_sTestInitialScreen.Get() != "") { - FOREACH_PlayerNumber(pn) - { - m_player[pn].m_iPersonalHighScoreIndex = 0; - m_player[pn].m_iMachineHighScoreIndex = 0; - } + m_player[PLAYER_1].m_iPersonalHighScoreIndex = 0; + m_player[PLAYER_1].m_iMachineHighScoreIndex = 0; } // don't save scores if the player chose not to diff --git a/src/StatsManager.cpp b/src/StatsManager.cpp index 476712dc99..4256336661 100644 --- a/src/StatsManager.cpp +++ b/src/StatsManager.cpp @@ -184,7 +184,7 @@ StatsManager::UnjoinPlayer(PlayerNumber pn) for (int i = 0; i < (int)m_vPlayedStageStats.size(); ++i) { StageStats& ss = m_vPlayedStageStats[i]; bool bIsActive = false; - FOREACH_PlayerNumber(p) if (ss.m_player[p].m_bJoined) bIsActive = true; + if (ss.m_player[PLAYER_1].m_bJoined) bIsActive = true; FOREACH_MultiPlayer(mp) if (ss.m_multiPlayer[mp].m_bJoined) bIsActive = true; if (bIsActive) @@ -199,12 +199,9 @@ void StatsManager::GetStepsInUse(set& apInUseOut) const { for (int i = 0; i < (int)m_vPlayedStageStats.size(); ++i) { - FOREACH_PlayerNumber(pn) - { - const PlayerStageStats& pss = m_vPlayedStageStats[i].m_player[pn]; - apInUseOut.insert(pss.m_vpPossibleSteps.begin(), - pss.m_vpPossibleSteps.end()); - } + const PlayerStageStats& pss = m_vPlayedStageStats[i].m_player[PLAYER_1]; + apInUseOut.insert(pss.m_vpPossibleSteps.begin(), + pss.m_vpPossibleSteps.end()); FOREACH_MultiPlayer(mp) {