From 1abc266591438db48646315aabe955dab244b9a3 Mon Sep 17 00:00:00 2001 From: poco0317 Date: Fri, 21 Dec 2018 20:57:30 -0600 Subject: [PATCH] Widely remove the dependency on NUM_PLAYERS This breaks some stuff. Experimental change. --- src/ArrowEffects.cpp | 24 +- src/AutoKeysounds.cpp | 41 +- src/AutoKeysounds.h | 6 +- src/Background.cpp | 27 +- src/CodeDetector.cpp | 6 +- src/DancingCharacters.cpp | 89 ++--- src/DancingCharacters.h | 26 +- src/DifficultyList.cpp | 40 +- src/DifficultyList.h | 4 +- src/DownloadManager.cpp | 4 +- src/DualScrollBar.cpp | 38 +- src/DualScrollBar.h | 4 +- src/FilterManager.cpp | 12 +- src/FilterManager.h | 2 +- src/Foreground.cpp | 2 +- src/GameCommand.cpp | 26 +- src/GameConstantsAndTypes.cpp | 4 +- src/GameConstantsAndTypes.h | 2 +- src/GameManager.cpp | 568 ++++++++++++++-------------- src/GameState.cpp | 173 ++++----- src/GameState.h | 12 +- src/GameplayAssist.cpp | 4 +- src/HighScore.cpp | 2 +- src/ModIconRow.cpp | 2 +- src/MusicWheel.cpp | 43 +-- src/MusicWheelItem.cpp | 30 +- src/MusicWheelItem.h | 2 +- src/NetworkSyncManager.cpp | 26 +- src/NoteField.cpp | 6 +- src/OptionRow.cpp | 133 ++++--- src/OptionRow.h | 18 +- src/OptionRowHandler.cpp | 62 +-- src/OptionRowHandler.h | 4 +- src/OptionsList.cpp | 14 +- src/Player.cpp | 14 +- src/PlayerStageStats.cpp | 2 +- src/PlayerState.cpp | 4 +- src/Profile.cpp | 4 +- src/ProfileManager.cpp | 68 ++-- src/ProfileManager.h | 13 +- src/ReceptorArrowRow.cpp | 4 +- src/ScoreKeeperNormal.cpp | 6 +- src/ScreenDebugOverlay.cpp | 4 +- src/ScreenEvaluation.cpp | 142 +++---- src/ScreenEvaluation.h | 2 +- src/ScreenGameplay.cpp | 104 +++-- src/ScreenGameplaySyncMachine.cpp | 4 +- src/ScreenNetSelectMusic.cpp | 16 +- src/ScreenOptions.cpp | 117 +++--- src/ScreenOptions.h | 16 +- src/ScreenOptionsManageProfiles.cpp | 6 +- src/ScreenOptionsMaster.cpp | 10 +- src/ScreenPlayerOptions.cpp | 30 +- src/ScreenPlayerOptions.h | 4 +- src/ScreenSelectMaster.cpp | 197 +++++----- src/ScreenSelectMaster.h | 12 +- src/ScreenSelectMusic.cpp | 207 +++++----- src/ScreenSelectMusic.h | 11 +- src/ScreenSelectProfile.cpp | 22 +- src/ScreenSelectProfile.h | 4 +- src/ScreenSongOptions.cpp | 2 +- src/ScreenSyncOverlay.cpp | 7 +- src/ScreenSystemLayer.cpp | 2 +- src/SongUtil.cpp | 10 +- src/StageStats.cpp | 75 ++-- src/StageStats.h | 2 +- src/StatsManager.cpp | 34 +- src/StepsDisplay.cpp | 4 +- src/Style.cpp | 12 +- src/Style.h | 2 +- src/XMLProfile.cpp | 2 +- 71 files changed, 1283 insertions(+), 1348 deletions(-) diff --git a/src/ArrowEffects.cpp b/src/ArrowEffects.cpp index e11638f426..6b28c03731 100644 --- a/src/ArrowEffects.cpp +++ b/src/ArrowEffects.cpp @@ -128,7 +128,7 @@ struct PerPlayerData float m_fBeatFactor; float m_fExpandSeconds; }; -PerPlayerData g_EffectData[NUM_PLAYERS]; +PerPlayerData g_EffectData; } // namespace; void @@ -140,17 +140,17 @@ ArrowEffects::Update() FOREACH_EnabledPlayer(pn) { const Style* pStyle = GAMESTATE->GetCurrentStyle(pn); - const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo[pn]; + const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo; const SongPosition& position = GAMESTATE->m_bIsUsingStepTiming - ? GAMESTATE->m_pPlayerState[pn]->m_Position + ? GAMESTATE->m_pPlayerState->m_Position : GAMESTATE->m_Position; - const float field_zoom = GAMESTATE->m_pPlayerState[pn]->m_NotefieldZoom; - const float* effects = GAMESTATE->m_pPlayerState[pn] + const float field_zoom = GAMESTATE->m_pPlayerState->m_NotefieldZoom; + const float* effects = GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .m_fEffects; - PerPlayerData& data = g_EffectData[pn]; + PerPlayerData& data = g_EffectData; if (!position.m_bFreeze || !position.m_bDelay) { data.m_fExpandSeconds += fTime - fLastTime; @@ -350,7 +350,7 @@ ArrowEffects::GetYOffset(const PlayerState* pPlayerState, float fSongBeat = position.m_fSongBeatVisible; PlayerNumber pn = pPlayerState->m_PlayerNumber; - Steps* pCurSteps = GAMESTATE->m_pCurSteps[pn]; + Steps* pCurSteps = GAMESTATE->m_pCurSteps; /* Usually, fTimeSpacing is 0 or 1, in which case we use entirely beat * spacing or entirely time spacing (respectively). Occasionally, we tween @@ -455,7 +455,7 @@ ArrowEffects::GetYOffset(const PlayerState* pPlayerState, if (fAccels[PlayerOptions::ACCEL_EXPAND] != 0) { // TODO: Don't index by PlayerNumber. - PerPlayerData& data = g_EffectData[pPlayerState->m_PlayerNumber]; + PerPlayerData& data = g_EffectData; float fExpandMultiplier = SCALE( RageFastCos(data.m_fExpandSeconds * EXPAND_MULTIPLIER_FREQUENCY), @@ -524,7 +524,7 @@ ArrowEffects::GetYPos(int iCol, // Doing the math with a precalculated result of 0 should be faster than // checking whether tipsy is on. -Kyz // TODO: Don't index by PlayerNumber. - PerPlayerData& data = g_EffectData[curr_options->m_pn]; + PerPlayerData& data = g_EffectData; f += fEffects[PlayerOptions::EFFECT_TIPSY] * data.m_tipsy_result[iCol]; // In beware's DDR Extreme-focused fork of StepMania 3.9, this value is @@ -545,7 +545,7 @@ ArrowEffects::GetYOffsetFromYPos(int iCol, // Doing the math with a precalculated result of 0 should be faster than // checking whether tipsy is on. -Kyz // TODO: Don't index by PlayerNumber. - PerPlayerData& data = g_EffectData[curr_options->m_pn]; + PerPlayerData& data = g_EffectData; f += fEffects[PlayerOptions::EFFECT_TIPSY] * data.m_tipsy_offset_result[iCol]; @@ -572,8 +572,8 @@ ArrowEffects::GetXPos(const PlayerState* pPlayerState, // TODO: Don't index by PlayerNumber. const Style::ColumnInfo* pCols = - pStyle->m_ColumnInfo[pPlayerState->m_PlayerNumber]; - PerPlayerData& data = g_EffectData[pPlayerState->m_PlayerNumber]; + pStyle->m_ColumnInfo; + PerPlayerData& data = g_EffectData; if (fEffects[PlayerOptions::EFFECT_TORNADO] != 0) { const float fRealPixelOffset = diff --git a/src/AutoKeysounds.cpp b/src/AutoKeysounds.cpp index 94fc24fe3f..6047bc0e61 100644 --- a/src/AutoKeysounds.cpp +++ b/src/AutoKeysounds.cpp @@ -37,7 +37,7 @@ void AutoKeysounds::Load(PlayerNumber pn, const NoteData& ndAutoKeysoundsOnly) { - m_ndAutoKeysoundsOnly[pn] = ndAutoKeysoundsOnly; + m_ndAutoKeysoundsOnly = ndAutoKeysoundsOnly; } void @@ -53,7 +53,7 @@ AutoKeysounds::LoadAutoplaySoundsInto(RageSoundReader_Chain* pChain) * Add all current autoplay sounds in both players to the chain. */ int iNumTracks = - m_ndAutoKeysoundsOnly[GAMESTATE->GetMasterPlayerNumber()].GetNumTracks(); + m_ndAutoKeysoundsOnly.GetNumTracks(); for (int t = 0; t < iNumTracks; t++) { int iRow = -1; for (;;) { @@ -62,14 +62,14 @@ AutoKeysounds::LoadAutoplaySoundsInto(RageSoundReader_Chain* pChain) FOREACH_EnabledPlayer(pn) { // XXX Hack. Enabled players need not have their own note data. - if (t >= m_ndAutoKeysoundsOnly[pn].GetNumTracks()) + if (t >= m_ndAutoKeysoundsOnly.GetNumTracks()) continue; int iNextRowForPlayer = iRow; /* XXX: If a BMS file only has one tap note per track, * this will prevent any keysounds from loading. * This leads to failure later on. * We need a better way to prevent this. */ - if (m_ndAutoKeysoundsOnly[pn].GetNextTapNoteRowForTrack( + if (m_ndAutoKeysoundsOnly.GetNextTapNoteRowForTrack( t, iNextRowForPlayer)) iNextRow = min(iNextRow, iNextRowForPlayer); } @@ -78,21 +78,20 @@ AutoKeysounds::LoadAutoplaySoundsInto(RageSoundReader_Chain* pChain) break; iRow = iNextRow; - TapNote tn[NUM_PLAYERS]; - FOREACH_EnabledPlayer(pn) tn[pn] = - m_ndAutoKeysoundsOnly[pn].GetTapNote(t, iRow); + TapNote tn; + tn = m_ndAutoKeysoundsOnly.GetTapNote(t, iRow); FOREACH_EnabledPlayer(pn) { - if (tn[pn] == TAP_EMPTY) + if (tn == TAP_EMPTY) continue; - ASSERT(tn[pn].type == TapNoteType_AutoKeysound); - if (tn[pn].iKeysoundIndex >= 0) { + ASSERT(tn.type == TapNoteType_AutoKeysound); + if (tn.iKeysoundIndex >= 0) { RString sKeysoundFilePath = - sSongDir + pSong->m_vsKeysoundFile[tn[pn].iKeysoundIndex]; + sSongDir + pSong->m_vsKeysoundFile[tn.iKeysoundIndex]; float fSeconds = - GAMESTATE->m_pCurSteps[pn] + GAMESTATE->m_pCurSteps ->GetTimingData() ->WhereUAtBroNoOffset(NoteRowToBeat(iRow)) + SOUNDMAN->GetPlayLatency(); @@ -124,7 +123,7 @@ AutoKeysounds::LoadTracks(const Song* pSong, vector vsMusicFile; const RString sMusicPath = - GAMESTATE->m_pCurSteps[GAMESTATE->GetMasterPlayerNumber()] + GAMESTATE->m_pCurSteps ->GetMusicPath(); if (!sMusicPath.empty()) @@ -195,7 +194,7 @@ AutoKeysounds::FinishLoading() Song* pSong = GAMESTATE->m_pCurSong; vector apSounds; - LoadTracks(pSong, m_pSharedSound, m_pPlayerSounds[0]); + LoadTracks(pSong, m_pSharedSound, m_pPlayerSounds); // Load autoplay sounds, if any. { @@ -223,13 +222,13 @@ AutoKeysounds::FinishLoading() m_pSharedSound = new RageSoundReader_Pan(m_pSharedSound); apSounds.push_back(m_pSharedSound); - if (m_pPlayerSounds[0] != nullptr) { - m_pPlayerSounds[0] = - new RageSoundReader_PitchChange(m_pPlayerSounds[0]); - m_pPlayerSounds[0] = - new RageSoundReader_PostBuffering(m_pPlayerSounds[0]); - m_pPlayerSounds[0] = new RageSoundReader_Pan(m_pPlayerSounds[0]); - apSounds.push_back(m_pPlayerSounds[0]); + if (m_pPlayerSounds != nullptr) { + m_pPlayerSounds = + new RageSoundReader_PitchChange(m_pPlayerSounds); + m_pPlayerSounds = + new RageSoundReader_PostBuffering(m_pPlayerSounds); + m_pPlayerSounds = new RageSoundReader_Pan(m_pPlayerSounds); + apSounds.push_back(m_pPlayerSounds); } if (apSounds.size() > 1) { diff --git a/src/AutoKeysounds.h b/src/AutoKeysounds.h index e3999b0fa6..ca725de7b9 100644 --- a/src/AutoKeysounds.h +++ b/src/AutoKeysounds.h @@ -23,7 +23,7 @@ class AutoKeysounds { if (pn == PLAYER_INVALID) return NULL; - return m_pPlayerSounds[pn]; + return m_pPlayerSounds; } protected: @@ -32,11 +32,11 @@ class AutoKeysounds RageSoundReader*& pGlobal, RageSoundReader*& pPlayer1); - NoteData m_ndAutoKeysoundsOnly[NUM_PLAYERS]; + NoteData m_ndAutoKeysoundsOnly; vector m_vKeysounds; RageSound m_sSound; RageSoundReader* m_pChain; // owned by m_sSound - RageSoundReader* m_pPlayerSounds[NUM_PLAYERS]; // owned by m_sSound + RageSoundReader* m_pPlayerSounds; // owned by m_sSound RageSoundReader* m_pSharedSound; // owned by m_sSound }; diff --git a/src/Background.cpp b/src/Background.cpp index f65b9a9d3c..b5253358bf 100644 --- a/src/Background.cpp +++ b/src/Background.cpp @@ -63,7 +63,7 @@ class BrightnessOverlay : public ActorFrame void Set(float fBrightness); private: - Quad m_quadBGBrightness[NUM_PLAYERS]; + Quad m_quadBGBrightness; Quad m_quadBGBrightnessFade; }; @@ -938,7 +938,7 @@ bool BackgroundImpl::IsDangerAllVisible() { // The players are never in danger in FAIL_OFF. - if (GAMESTATE->GetPlayerFailType(GAMESTATE->m_pPlayerState[PLAYER_1]) == + if (GAMESTATE->GetPlayerFailType(GAMESTATE->m_pPlayerState) == FailType_Off) return false; if (!g_bShowDanger) return false; @@ -956,17 +956,12 @@ BrightnessOverlay::BrightnessOverlay() float fQuadWidth = (RIGHT_EDGE - LEFT_EDGE) / 2; fQuadWidth -= g_fBackgroundCenterWidth / 2; - m_quadBGBrightness[0].StretchTo( RectF(LEFT_EDGE,TOP_EDGE,LEFT_EDGE+fQuadWidth,BOTTOM_EDGE) ); + m_quadBGBrightness.StretchTo( RectF(LEFT_EDGE,TOP_EDGE,LEFT_EDGE+fQuadWidth,BOTTOM_EDGE) ); m_quadBGBrightnessFade.StretchTo( RectF(LEFT_EDGE+fQuadWidth,TOP_EDGE,RIGHT_EDGE-fQuadWidth,BOTTOM_EDGE) ); - //m_quadBGBrightness[1].StretchTo( RectF(RIGHT_EDGE-fQuadWidth,TOP_EDGE,RIGHT_EDGE,BOTTOM_EDGE) ); - - m_quadBGBrightness[0].SetName("BrightnessOverlay"); - ActorUtil::LoadAllCommands(m_quadBGBrightness[0], "Background"); - this->AddChild(&m_quadBGBrightness[0]); - - //m_quadBGBrightness[1].SetName( "BrightnessOverlay" ); - //ActorUtil::LoadAllCommands( m_quadBGBrightness[1], "Background" ); - //this->AddChild( &m_quadBGBrightness[1] ); + + m_quadBGBrightness.SetName("BrightnessOverlay"); + ActorUtil::LoadAllCommands(m_quadBGBrightness, "Background"); + this->AddChild(&m_quadBGBrightness); m_quadBGBrightnessFade.SetName("BrightnessOverlay"); ActorUtil::LoadAllCommands(m_quadBGBrightnessFade, "Background"); @@ -988,8 +983,8 @@ BrightnessOverlay::Update(float fDeltaTime) void BrightnessOverlay::SetActualBrightness() { - float fLeftBrightness = 1-GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetCurrent().m_fCover; - float fRightBrightness = 1-GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetCurrent().m_fCover; + float fLeftBrightness = 1-GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent().m_fCover; + float fRightBrightness = 1-GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent().m_fCover; float fBaseBGBrightness = g_fBGBrightness; @@ -1011,7 +1006,7 @@ BrightnessOverlay::SetActualBrightness() RageColor LeftColor = GetBrightnessColor(fLeftBrightness); RageColor RightColor = GetBrightnessColor(fRightBrightness); - m_quadBGBrightness[PLAYER_1].SetDiffuse( LeftColor ); + m_quadBGBrightness.SetDiffuse( LeftColor ); m_quadBGBrightnessFade.SetDiffuseLeftEdge( LeftColor ); m_quadBGBrightnessFade.SetDiffuseRightEdge( RightColor ); } @@ -1021,7 +1016,7 @@ BrightnessOverlay::Set(float fBrightness) { RageColor c = GetBrightnessColor(fBrightness); - m_quadBGBrightness[PLAYER_1].SetDiffuse(c); + m_quadBGBrightness.SetDiffuse(c); m_quadBGBrightnessFade.SetDiffuse(c); } diff --git a/src/CodeDetector.cpp b/src/CodeDetector.cpp index a5a9ac3ac9..199eafe706 100644 --- a/src/CodeDetector.cpp +++ b/src/CodeDetector.cpp @@ -171,7 +171,7 @@ CodeDetector::ChangeScrollSpeed(GameController controller, bool bIncrement) // opt = PlayerOptions // setup PlayerNumber pn = INPUTMAPPER->ControllerToPlayerNumber( controller ); - PlayerOptions po = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred(); + PlayerOptions po = GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred(); /* what this code seems to be doing is: * 1) getting the Speed line from the theme @@ -235,7 +235,7 @@ CodeDetector::DetectAndAdjustMusicOptions(GameController controller) auto code = static_cast(c); PlayerOptions po = - GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred(); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred(); if (EnteredCode(controller, code)) { switch (code) { @@ -282,7 +282,7 @@ CodeDetector::DetectAndAdjustMusicOptions(GameController controller) break; } - GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.Assign( + GAMESTATE->m_pPlayerState->m_PlayerOptions.Assign( ModsLevel_Preferred, po); return true; // don't check any more diff --git a/src/DancingCharacters.cpp b/src/DancingCharacters.cpp index c1902fe7c6..80ef177bd7 100644 --- a/src/DancingCharacters.cpp +++ b/src/DancingCharacters.cpp @@ -47,19 +47,17 @@ const float CAMERA_STILL_HEIGHT_VARIANCE = 5.f; const float CAMERA_STILL_LOOK_AT_HEIGHT = -10.f; const float MODEL_X_ONE_PLAYER = 0; -const float MODEL_X_TWO_PLAYERS[NUM_PLAYERS] = { 0 }; -const float MODEL_ROTATIONY_TWO_PLAYERS[NUM_PLAYERS] = { 0 }; DancingCharacters::DancingCharacters() { PlayerNumber p = PLAYER_1; - m_pCharacter[p] = new Model; - m_2DIdleTimer[p].SetZero(); - m_i2DAnimState[p] = AS2D_IDLE; // start on idle state + m_pCharacter = new Model; + m_2DIdleTimer.SetZero(); + m_i2DAnimState = AS2D_IDLE; // start on idle state if (!GAMESTATE->IsPlayerEnabled(p)) return; - Character* pChar = GAMESTATE->m_pCurCharacters[p]; + Character* pChar = GAMESTATE->m_pCurCharacters; if (pChar == nullptr) return; @@ -70,91 +68,88 @@ DancingCharacters::DancingCharacters() 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.Load(sCurrentAnim); + m_bgIdle->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)); + m_bgMiss.Load(sCurrentAnim); + m_bgMiss->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)); + m_bgGood.Load(sCurrentAnim); + m_bgGood->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)); + m_bgGreat.Load(sCurrentAnim); + m_bgGreat->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)); + m_bgFever.Load(sCurrentAnim); + m_bgFever->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)); + m_bgFail.Load(sCurrentAnim); + m_bgFail->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)); + m_bgWin.Load(sCurrentAnim); + m_bgWin->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)); + m_bgWinFever.Load(sCurrentAnim); + m_bgWinFever->SetXY(DC_X(p), DC_Y(p)); } 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->SetX(MODEL_X_ONE_PLAYER); - m_pCharacter[p]->LoadMilkshapeAscii(pChar->GetModelPath()); - m_pCharacter[p]->LoadMilkshapeAsciiBones("rest", + m_pCharacter->LoadMilkshapeAscii(pChar->GetModelPath()); + m_pCharacter->LoadMilkshapeAsciiBones("rest", pChar->GetRestAnimationPath()); - m_pCharacter[p]->LoadMilkshapeAsciiBones( + m_pCharacter->LoadMilkshapeAsciiBones( "warmup", pChar->GetWarmUpAnimationPath()); - m_pCharacter[p]->LoadMilkshapeAsciiBones( + m_pCharacter->LoadMilkshapeAsciiBones( "dance", pChar->GetDanceAnimationPath()); - m_pCharacter[p]->SetCullMode(CULL_NONE); // many of the models floating + m_pCharacter->SetCullMode(CULL_NONE); // many of the models floating // around have the vertex order // flipped - m_pCharacter[p]->RunCommands(pChar->m_cmdInit); + m_pCharacter->RunCommands(pChar->m_cmdInit); } DancingCharacters::~DancingCharacters() { - delete m_pCharacter[PLAYER_1]; + delete m_pCharacter; } void @@ -174,7 +169,7 @@ DancingCharacters::LoadNextSong() m_fThisCameraEndBeat = GAMESTATE->m_pCurSong->GetFirstBeat(); if (GAMESTATE->IsPlayerEnabled(PLAYER_1)) - m_pCharacter[PLAYER_1]->PlayAnimation("rest"); + m_pCharacter->PlayAnimation("rest"); } int @@ -201,14 +196,14 @@ DancingCharacters::Update(float fDelta) fUpdateScale *= GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; if (GAMESTATE->IsPlayerEnabled(PLAYER_1)) - m_pCharacter[PLAYER_1]->Update(fDelta * fUpdateScale); + m_pCharacter->Update(fDelta * fUpdateScale); } static bool bWasGameplayStarting = false; bool bGameplayStarting = GAMESTATE->m_bGameplayLeadIn; if (!bWasGameplayStarting && bGameplayStarting) { if (GAMESTATE->IsPlayerEnabled(PLAYER_1)) - m_pCharacter[PLAYER_1]->PlayAnimation("warmup"); + m_pCharacter->PlayAnimation("warmup"); } bWasGameplayStarting = bGameplayStarting; @@ -216,7 +211,7 @@ DancingCharacters::Update(float fDelta) float firstBeat = GAMESTATE->m_pCurSong->GetFirstBeat(); float fThisBeat = GAMESTATE->m_Position.m_fSongBeat; if (fLastBeat < firstBeat && fThisBeat >= firstBeat) { - m_pCharacter[PLAYER_1]->PlayAnimation("dance"); + m_pCharacter->PlayAnimation("dance"); } fLastBeat = fThisBeat; @@ -267,11 +262,10 @@ DancingCharacters::Update(float fDelta) /* // is there any of this still around? This block of code is _ugly_. -Colby // update any 2D stuff - PlayerNumber p = PLAYER_1; - if( m_bgIdle[p].IsLoaded() ) + if( m_bgIdle.IsLoaded() ) { - if( m_bgIdle[p].IsLoaded() && m_i2DAnimState[p] == AS2D_IDLE ) - m_bgIdle[p]->Update( fDelta ); + if( m_bgIdle.IsLoaded() && m_i2DAnimState[p] == AS2D_IDLE ) + m_bgIdle->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 ) @@ -314,7 +308,7 @@ DancingCharacters::Change2DAnimState(PlayerNumber pn, int iState) ASSERT(pn < NUM_PLAYERS); ASSERT(iState < AS2D_MAXSTATES); - m_i2DAnimState[pn] = iState; + m_i2DAnimState = iState; } void @@ -347,7 +341,7 @@ DancingCharacters::DrawPrimitives() FOREACH_EnabledPlayer(p) { - bool bFailed = STATSMAN->m_CurStageStats.m_player[p].m_bFailed; + bool bFailed = STATSMAN->m_CurStageStats.m_player.m_bFailed; bool bDanger = m_bDrawDangerLight; DISPLAY->SetLighting(true); @@ -365,14 +359,14 @@ DancingCharacters::DrawPrimitives() 0, ambient, diffuse, specular, RageVector3(-3, -7.5f, +9)); if (PREFSMAN->m_bCelShadeModels) { - m_pCharacter[p]->DrawCelShaded(); + m_pCharacter->DrawCelShaded(); DISPLAY->SetLightOff(0); DISPLAY->SetLighting(false); continue; } - m_pCharacter[p]->Draw(); + m_pCharacter->Draw(); DISPLAY->SetLightOff(0); DISPLAY->SetLighting(false); @@ -384,9 +378,8 @@ DancingCharacters::DrawPrimitives() // Ugly! -Colby // now draw any potential 2D stuff { - PlayerNumber p = PLAYER_1; - if(m_bgIdle[p].IsLoaded() && m_i2DAnimState[p] == AS2D_IDLE) - m_bgIdle[p]->Draw(); + if(m_bgIdle.IsLoaded() && m_i2DAnimState[p] == AS2D_IDLE) + m_bgIdle->Draw(); if(m_bgMiss[p].IsLoaded() && m_i2DAnimState[p] == AS2D_MISS) m_bgMiss[p]->Draw(); if(m_bgGood[p].IsLoaded() && m_i2DAnimState[p] == AS2D_GOOD) diff --git a/src/DancingCharacters.h b/src/DancingCharacters.h index b31f18ad25..890de2d36a 100644 --- a/src/DancingCharacters.h +++ b/src/DancingCharacters.h @@ -1,4 +1,4 @@ -#ifndef DancingCharacters_H +#ifndef DancingCharacters_H #define DancingCharacters_H #include "ActorFrame.h" @@ -38,7 +38,7 @@ class DancingCharacters : public ActorFrame void Change2DAnimState(PlayerNumber pn, int iState); protected: - Model* m_pCharacter[NUM_PLAYERS]; + Model* m_pCharacter; /** @brief How far away is the camera from the dancer? */ float m_CameraDistance{ 0 }; @@ -50,19 +50,19 @@ class DancingCharacters : public ActorFrame float m_fThisCameraStartBeat{ 0 }; float m_fThisCameraEndBeat{ 0 }; - bool m_bHas2DElements[NUM_PLAYERS]; + bool m_bHas2DElements; - AutoActor m_bgIdle[NUM_PLAYERS]; - AutoActor m_bgMiss[NUM_PLAYERS]; - AutoActor m_bgGood[NUM_PLAYERS]; - AutoActor m_bgGreat[NUM_PLAYERS]; - AutoActor m_bgFever[NUM_PLAYERS]; - AutoActor m_bgFail[NUM_PLAYERS]; - AutoActor m_bgWin[NUM_PLAYERS]; - AutoActor m_bgWinFever[NUM_PLAYERS]; - RageTimer m_2DIdleTimer[NUM_PLAYERS]; + AutoActor m_bgIdle; + AutoActor m_bgMiss; + AutoActor m_bgGood; + AutoActor m_bgGreat; + AutoActor m_bgFever; + AutoActor m_bgFail; + AutoActor m_bgWin; + AutoActor m_bgWinFever; + RageTimer m_2DIdleTimer; - int m_i2DAnimState[NUM_PLAYERS]; + int m_i2DAnimState; }; #endif diff --git a/src/DifficultyList.cpp b/src/DifficultyList.cpp index 9fdb1eebce..6b522bc48d 100644 --- a/src/DifficultyList.cpp +++ b/src/DifficultyList.cpp @@ -54,7 +54,7 @@ StepsDisplayList::LoadFromNode(const XNode* pNode) ActorUtil::GetWhere(pNode).c_str(), PLAYER_1 + 1); } else { - m_Cursors[PLAYER_1].LoadActorFromNode(pChild, this); + m_Cursors.LoadActorFromNode(pChild, this); } /* Hack: we need to tween cursors both up to down (cursor motion) and @@ -71,9 +71,9 @@ StepsDisplayList::LoadFromNode(const XNode* pNode) 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]); + m_CursorFrames.LoadFromNode(pChild); + m_CursorFrames.AddChild(m_Cursors); + this->AddChild(&m_CursorFrames); } for (unsigned m = 0; m < m_Lines.size(); ++m) { @@ -95,11 +95,11 @@ StepsDisplayList::GetCurrentRowIndex(PlayerNumber pn) const for (unsigned i = 0; i < m_Rows.size(); i++) { const Row& row = m_Rows[i]; - if (GAMESTATE->m_pCurSteps[pn] == NULL) { + if (GAMESTATE->m_pCurSteps == NULL) { if (row.m_dc == ClosestDifficulty) return i; } else { - if (GAMESTATE->m_pCurSteps[pn].Get() == row.m_Steps) + if (GAMESTATE->m_pCurSteps.Get() == row.m_Steps) return i; } } @@ -111,8 +111,7 @@ StepsDisplayList::GetCurrentRowIndex(PlayerNumber pn) const void StepsDisplayList::UpdatePositions() { - int iCurrentRow[NUM_PLAYERS]; - FOREACH_HumanPlayer(p) iCurrentRow[p] = GetCurrentRowIndex(p); + int iCurrentRow= GetCurrentRowIndex(PLAYER_1); const int total = NUM_SHOWN_ITEMS; const int halfsize = total / 2; @@ -120,7 +119,7 @@ StepsDisplayList::UpdatePositions() 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. - int P1Choice = iCurrentRow[PLAYER_1]; + int P1Choice = iCurrentRow; vector& Rows = m_Rows; @@ -230,17 +229,14 @@ StepsDisplayList::PositionItems() m_Lines[m].m_Meter.SetDiffuseAlpha(fDiffuseAlpha); } - FOREACH_HumanPlayer(pn) - { - int iCurrentRow = GetCurrentRowIndex(pn); + int iCurrentRow = GetCurrentRowIndex(PLAYER_1); - float fY = 0; - if (iCurrentRow < (int)m_Rows.size()) - fY = m_Rows[iCurrentRow].m_fY; + float fY = 0; + if (iCurrentRow < (int)m_Rows.size()) + fY = m_Rows[iCurrentRow].m_fY; - m_CursorFrames[pn].PlayCommand("Change"); - m_CursorFrames[pn].SetY(fY); - } + m_CursorFrames.PlayCommand("Change"); + m_CursorFrames.SetY(fY); } void @@ -303,7 +299,7 @@ StepsDisplayList::HideRows() void StepsDisplayList::TweenOnScreen() { - FOREACH_HumanPlayer(pn) ON_COMMAND(m_Cursors[pn]); + ON_COMMAND(m_Cursors); for (int m = 0; m < MAX_METERS; ++m) ON_COMMAND(m_Lines[m].m_Meter); @@ -318,7 +314,7 @@ StepsDisplayList::TweenOnScreen() HideRows(); PositionItems(); - FOREACH_HumanPlayer(pn) COMMAND(m_Cursors[pn], "TweenOn"); + COMMAND(m_Cursors, "TweenOn"); } void @@ -336,7 +332,7 @@ StepsDisplayList::Show() HideRows(); PositionItems(); - FOREACH_HumanPlayer(pn) COMMAND(m_Cursors[pn], "Show"); + COMMAND(m_Cursors, "Show"); } void @@ -345,7 +341,7 @@ StepsDisplayList::Hide() m_bShown = false; PositionItems(); - FOREACH_HumanPlayer(pn) COMMAND(m_Cursors[pn], "Hide"); + COMMAND(m_Cursors, "Hide"); } void diff --git a/src/DifficultyList.h b/src/DifficultyList.h index b6c2e3aa37..76bb5fd058 100644 --- a/src/DifficultyList.h +++ b/src/DifficultyList.h @@ -39,8 +39,8 @@ class StepsDisplayList : public ActorFrame ThemeMetric CAPITALIZE_DIFFICULTY_NAMES; ThemeMetric MOVE_COMMAND; - AutoActor m_Cursors[NUM_PLAYERS]; - ActorFrame m_CursorFrames[NUM_PLAYERS]; // contains Cursor so that color can + AutoActor m_Cursors; + ActorFrame m_CursorFrames; // contains Cursor so that color can // fade independent of other tweens struct Line diff --git a/src/DownloadManager.cpp b/src/DownloadManager.cpp index b667fc66c2..c65b2f9577 100644 --- a/src/DownloadManager.cpp +++ b/src/DownloadManager.cpp @@ -1900,9 +1900,9 @@ DownloadManager::OnLogin() DLMAN->UploadScores(); DLMAN->UpdateOnlineScoreReplayData(); } - if (GAMESTATE->m_pCurSteps[PLAYER_1] != nullptr) + if (GAMESTATE->m_pCurSteps != nullptr) DLMAN->RequestChartLeaderBoard( - GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey()); + GAMESTATE->m_pCurSteps->GetChartKey()); MESSAGEMAN->Broadcast("Login"); DLMAN->loggingIn = false; } diff --git a/src/DualScrollBar.cpp b/src/DualScrollBar.cpp index 7dd00e8ef8..b74095cf97 100644 --- a/src/DualScrollBar.cpp +++ b/src/DualScrollBar.cpp @@ -12,21 +12,21 @@ DualScrollBar::DualScrollBar() void DualScrollBar::Load(const RString& sType) { - m_sprScrollThumbUnderHalf[PLAYER_1].Load( + m_sprScrollThumbUnderHalf.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]); + m_sprScrollThumbUnderHalf->SetName(ssprintf("ThumbP%i", PLAYER_1 + 1)); + this->AddChild(m_sprScrollThumbUnderHalf); - m_sprScrollThumbOverHalf[PLAYER_1].Load( + m_sprScrollThumbOverHalf.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_sprScrollThumbOverHalf->SetName(ssprintf("ThumbP%i", PLAYER_1 + 1)); + this->AddChild(m_sprScrollThumbOverHalf); - m_sprScrollThumbUnderHalf[0]->SetCropLeft(.5f); - m_sprScrollThumbUnderHalf[1]->SetCropRight(.5f); + m_sprScrollThumbUnderHalf->SetCropLeft(.5f); + m_sprScrollThumbUnderHalf->SetCropRight(.5f); - m_sprScrollThumbOverHalf[0]->SetCropRight(.5f); - m_sprScrollThumbOverHalf[1]->SetCropLeft(.5f); + m_sprScrollThumbOverHalf->SetCropRight(.5f); + m_sprScrollThumbOverHalf->SetCropLeft(.5f); SetPercentage(PLAYER_1, 0); @@ -36,25 +36,25 @@ DualScrollBar::Load(const RString& sType) void DualScrollBar::EnablePlayer(PlayerNumber pn, bool on) { - m_sprScrollThumbUnderHalf[pn]->SetVisible(on); - m_sprScrollThumbOverHalf[pn]->SetVisible(on); + m_sprScrollThumbUnderHalf->SetVisible(on); + m_sprScrollThumbOverHalf->SetVisible(on); } void DualScrollBar::SetPercentage(PlayerNumber pn, float fPercent) { const float bottom = - m_fBarHeight / 2 - m_sprScrollThumbUnderHalf[pn]->GetZoomedHeight() / 2; + m_fBarHeight / 2 - m_sprScrollThumbUnderHalf->GetZoomedHeight() / 2; const float top = -bottom; /* Position both thumbs. */ - m_sprScrollThumbUnderHalf[pn]->StopTweening(); - m_sprScrollThumbUnderHalf[pn]->BeginTweening(m_fBarTime); - m_sprScrollThumbUnderHalf[pn]->SetY(SCALE(fPercent, 0, 1, top, bottom)); + m_sprScrollThumbUnderHalf->StopTweening(); + m_sprScrollThumbUnderHalf->BeginTweening(m_fBarTime); + m_sprScrollThumbUnderHalf->SetY(SCALE(fPercent, 0, 1, top, bottom)); - m_sprScrollThumbOverHalf[pn]->StopTweening(); - m_sprScrollThumbOverHalf[pn]->BeginTweening(m_fBarTime); - m_sprScrollThumbOverHalf[pn]->SetY(SCALE(fPercent, 0, 1, top, bottom)); + m_sprScrollThumbOverHalf->StopTweening(); + m_sprScrollThumbOverHalf->BeginTweening(m_fBarTime); + m_sprScrollThumbOverHalf->SetY(SCALE(fPercent, 0, 1, top, bottom)); } /* diff --git a/src/DualScrollBar.h b/src/DualScrollBar.h index 2fa3c89ba5..f1e0696713 100644 --- a/src/DualScrollBar.h +++ b/src/DualScrollBar.h @@ -21,8 +21,8 @@ class DualScrollBar : public ActorFrame float m_fBarHeight; float m_fBarTime; - AutoActor m_sprScrollThumbOverHalf[NUM_PLAYERS]; - AutoActor m_sprScrollThumbUnderHalf[NUM_PLAYERS]; + AutoActor m_sprScrollThumbOverHalf; + AutoActor m_sprScrollThumbUnderHalf; }; #endif diff --git a/src/FilterManager.cpp b/src/FilterManager.cpp index b9dd41f40a..991f6da72d 100644 --- a/src/FilterManager.cpp +++ b/src/FilterManager.cpp @@ -9,8 +9,8 @@ FilterManager::FilterManager() // filter stuff - mina ZERO(SSFilterLowerBounds); ZERO(SSFilterUpperBounds); - m_pPlayerState[PLAYER_1] = new PlayerState; - m_pPlayerState[PLAYER_1]->SetPlayerNumber(PLAYER_1); + m_pPlayerState = new PlayerState; + m_pPlayerState->SetPlayerNumber(PLAYER_1); // Register with Lua. { @@ -24,7 +24,7 @@ FilterManager::FilterManager() FilterManager::~FilterManager() { - SAFE_DELETE(m_pPlayerState[PLAYER_1]); + SAFE_DELETE(m_pPlayerState); // Unregister with Lua. LUA->UnsetGlobal("FILTERMAN"); @@ -113,7 +113,7 @@ class LunaFilterManager : public Luna static int SetMaxFilterRate(T* p, lua_State* L) { float mfr = FArg(1); - auto loot = p->m_pPlayerState[0]; + auto loot = p->m_pPlayerState; CLAMP(mfr, loot->wtFFF, 3.f); p->MaxFilterRate = mfr; return 0; @@ -127,13 +127,13 @@ class LunaFilterManager : public Luna { float mfr = FArg(1); CLAMP(mfr, 0.7f, p->MaxFilterRate); - auto loot = p->m_pPlayerState[0]; + auto loot = p->m_pPlayerState; loot->wtFFF = mfr; return 0; } static int GetMinFilterRate(T* p, lua_State* L) { - auto loot = p->m_pPlayerState[0]; + auto loot = p->m_pPlayerState; lua_pushnumber(L, loot->wtFFF); return 1; } diff --git a/src/FilterManager.h b/src/FilterManager.h index 34f4d5dc54..b287b8003f 100644 --- a/src/FilterManager.h +++ b/src/FilterManager.h @@ -11,7 +11,7 @@ class FilterManager FilterManager(); ~FilterManager(); - PlayerState* m_pPlayerState[NUM_PLAYERS]; + PlayerState* m_pPlayerState; float SSFilterLowerBounds[NUM_Skillset + 1]; float SSFilterUpperBounds[NUM_Skillset + 1]; diff --git a/src/Foreground.cpp b/src/Foreground.cpp index 706894ca8a..817e0d99a3 100644 --- a/src/Foreground.cpp +++ b/src/Foreground.cpp @@ -45,7 +45,7 @@ Foreground::LoadFromSong(const Song* pSong) if (DoesFileExist(sLuaFile)) { LOG->Warn("Mod map detected, invalidating sequential assumption."); TimingData* td = - GAMESTATE->m_pCurSteps[GAMESTATE->GetMasterPlayerNumber()] + GAMESTATE->m_pCurSteps ->GetTimingData(); td->InvalidateSequentialAssmption(); diff --git a/src/GameCommand.cpp b/src/GameCommand.cpp index ad067af82d..9d189af00f 100644 --- a/src/GameCommand.cpp +++ b/src/GameCommand.cpp @@ -81,9 +81,7 @@ GameCommand::DescribesCurrentMode(PlayerNumber pn) const // doesn't match the difficulty of m_pCurSteps. if (m_pSteps == NULL && m_dc != Difficulty_Invalid) { // Why is this checking for all players? - FOREACH_HumanPlayer( - human) if (GAMESTATE->m_PreferredDifficulty[human] != - m_dc) return false; + if (GAMESTATE->m_PreferredDifficulty != m_dc) return false; } if (m_sAnnouncer != "" && m_sAnnouncer != ANNOUNCER->GetCurAnnouncerName()) @@ -91,24 +89,24 @@ GameCommand::DescribesCurrentMode(PlayerNumber pn) const if (m_sPreferredModifiers != "") { PlayerOptions po = - GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred(); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred(); SongOptions so = GAMESTATE->m_SongOptions.GetPreferred(); po.FromString(m_sPreferredModifiers); so.FromString(m_sPreferredModifiers); - if (po != GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred()) + if (po != GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred()) return false; if (so != GAMESTATE->m_SongOptions.GetPreferred()) return false; } if (m_sStageModifiers != "") { PlayerOptions po = - GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetStage(); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetStage(); SongOptions so = GAMESTATE->m_SongOptions.GetStage(); po.FromString(m_sStageModifiers); so.FromString(m_sStageModifiers); - if (po != GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetStage()) + if (po != GAMESTATE->m_pPlayerState->m_PlayerOptions.GetStage()) return false; if (so != GAMESTATE->m_SongOptions.GetStage()) return false; @@ -116,10 +114,10 @@ GameCommand::DescribesCurrentMode(PlayerNumber pn) const if (m_pSong && GAMESTATE->m_pCurSong.Get() != m_pSong) return false; - if (m_pSteps && GAMESTATE->m_pCurSteps[pn].Get() != m_pSteps) + if (m_pSteps && GAMESTATE->m_pCurSteps.Get() != m_pSteps) return false; if ((m_pCharacter != nullptr) && - GAMESTATE->m_pCurCharacters[pn] != m_pCharacter) + GAMESTATE->m_pCurCharacters != m_pCharacter) return false; if (!m_sSongGroup.empty() && GAMESTATE->m_sPreferredSongGroup != m_sSongGroup) @@ -482,7 +480,7 @@ GameCommand::ApplySelf(const vector& vpns) const } if (m_dc != Difficulty_Invalid) FOREACH_CONST(PlayerNumber, vpns, pn) - GAMESTATE->m_PreferredDifficulty[*pn].Set(m_dc); + GAMESTATE->m_PreferredDifficulty.Set(m_dc); if (m_sAnnouncer != "") ANNOUNCER->SwitchAnnouncer(m_sAnnouncer); if (m_sPreferredModifiers != "") @@ -511,11 +509,9 @@ GameCommand::ApplySelf(const vector& vpns) const GAMESTATE->m_pPreferredSong = m_pSong; } if (m_pSteps) - FOREACH_CONST(PlayerNumber, vpns, pn) - GAMESTATE->m_pCurSteps[*pn].Set(m_pSteps); + GAMESTATE->m_pCurSteps.Set(m_pSteps); if (m_pCharacter) - FOREACH_CONST(PlayerNumber, vpns, pn) - GAMESTATE->m_pCurCharacters[*pn] = m_pCharacter; + GAMESTATE->m_pCurCharacters = m_pCharacter; for (map::const_iterator i = m_SetEnv.begin(); i != m_SetEnv.end(); i++) { @@ -566,7 +562,7 @@ GameCommand::ApplySelf(const vector& vpns) const // applying options affects only the current stage PlayerOptions po; GAMESTATE->GetDefaultPlayerOptions(po); - GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.Assign( + GAMESTATE->m_pPlayerState->m_PlayerOptions.Assign( ModsLevel_Stage, po); SongOptions so; diff --git a/src/GameConstantsAndTypes.cpp b/src/GameConstantsAndTypes.cpp index ade2d64ea7..2dbe29b01c 100644 --- a/src/GameConstantsAndTypes.cpp +++ b/src/GameConstantsAndTypes.cpp @@ -13,6 +13,7 @@ RString StepsTypeToString(StepsType st); +// This was formerly used to fill in RANKING_TO_FILL_IN_MARKER when it was a vector of RStrings. -poco static vector GenerateRankingToFillInMarker() { @@ -20,8 +21,7 @@ GenerateRankingToFillInMarker() vRankings.push_back(ssprintf("#P%d#", PLAYER_1 + 1)); return vRankings; } -extern const vector RANKING_TO_FILL_IN_MARKER( - GenerateRankingToFillInMarker()); +extern const RString RANKING_TO_FILL_IN_MARKER("#P1#"); extern const RString GROUP_ALL = "---Group All---"; diff --git a/src/GameConstantsAndTypes.h b/src/GameConstantsAndTypes.h index 6081d7b02f..86c6e4d350 100644 --- a/src/GameConstantsAndTypes.h +++ b/src/GameConstantsAndTypes.h @@ -373,7 +373,7 @@ const RString& ProfileSlotToString(ProfileSlot ps); LuaDeclareType(ProfileSlot); -extern const vector RANKING_TO_FILL_IN_MARKER; +extern const RString RANKING_TO_FILL_IN_MARKER; inline bool IsRankingToFillIn(const RString& sName) { diff --git a/src/GameManager.cpp b/src/GameManager.cpp index cb4be27f30..27bde2cc03 100644 --- a/src/GameManager.cpp +++ b/src/GameManager.cpp @@ -151,13 +151,13 @@ static const Style g_Style_Dance_Single = StepsType_dance_single, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 4, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_3, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_4, +DANCE_COL_SPACING*1.5f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_3, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_4, +DANCE_COL_SPACING*1.5f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] { 0, 3, 2, 1, Style::END_MAPPING }, @@ -179,17 +179,17 @@ static const Style g_Style_Dance_Double = StepsType_dance_double, // m_StepsType StyleType_OnePlayerTwoSides, // m_StyleType 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -DANCE_COL_SPACING*3.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_3, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_4, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_5, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_6, +DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_7, +DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_8, +DANCE_COL_SPACING*3.5f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] { 0, 3, 2, 1, Style::END_MAPPING }, @@ -212,15 +212,15 @@ static const Style g_Style_Dance_Solo = { StepsType_dance_solo, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 6, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_COL_SPACING*2.5f, NULL }, - { TRACK_2, -DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_3, -DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_4, +DANCE_COL_SPACING*0.5f, NULL }, - { TRACK_5, +DANCE_COL_SPACING*1.5f, NULL }, - { TRACK_6, +DANCE_COL_SPACING*2.5f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -DANCE_COL_SPACING*2.5f, NULL }, + { TRACK_2, -DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_3, -DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_4, +DANCE_COL_SPACING*0.5f, NULL }, + { TRACK_5, +DANCE_COL_SPACING*1.5f, NULL }, + { TRACK_6, +DANCE_COL_SPACING*2.5f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] { 0, 5, 3, 2, 1, 4, Style::END_MAPPING }, @@ -242,12 +242,12 @@ static const Style g_Style_Dance_ThreePanel = StepsType_dance_threepanel, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 3, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DANCE_COL_SPACING*1.0f, NULL }, - { TRACK_2, +DANCE_COL_SPACING*0.0f, NULL }, - { TRACK_3, +DANCE_COL_SPACING*1.0f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -DANCE_COL_SPACING*1.0f, NULL }, + { TRACK_2, +DANCE_COL_SPACING*0.0f, NULL }, + { TRACK_3, +DANCE_COL_SPACING*1.0f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] // 4 3 5 @@ -339,14 +339,14 @@ static const Style g_Style_Pump_Single = { StepsType_pump_single, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, - { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, - { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, - { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -PUMP_COL_SPACING*2.0f, NULL }, + { TRACK_2, -PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_3, +PUMP_COL_SPACING*0.0f, NULL }, + { TRACK_4, +PUMP_COL_SPACING*1.0f, NULL }, + { TRACK_5, +PUMP_COL_SPACING*2.0f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -369,15 +369,15 @@ static const Style g_Style_Pump_HalfDouble = StepsType_pump_halfdouble, // m_StepsType StyleType_OnePlayerTwoSides, // m_StyleType 6, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -PUMP_COL_SPACING*2.5f-4, NULL }, - { TRACK_2, -PUMP_COL_SPACING*1.5f-4, NULL }, - { TRACK_3, -PUMP_COL_SPACING*0.5f-4, NULL }, - { TRACK_4, +PUMP_COL_SPACING*0.5f+4, NULL }, - { TRACK_5, +PUMP_COL_SPACING*1.5f+4, NULL }, - { TRACK_6, +PUMP_COL_SPACING*2.5f+4, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -PUMP_COL_SPACING*2.5f-4, NULL }, + { TRACK_2, -PUMP_COL_SPACING*1.5f-4, NULL }, + { TRACK_3, -PUMP_COL_SPACING*0.5f-4, NULL }, + { TRACK_4, +PUMP_COL_SPACING*0.5f+4, NULL }, + { TRACK_5, +PUMP_COL_SPACING*1.5f+4, NULL }, + { TRACK_6, +PUMP_COL_SPACING*2.5f+4, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] { Style::NO_MAPPING, 1, 0, Style::NO_MAPPING, 2, Style::END_MAPPING }, @@ -400,19 +400,19 @@ static const Style g_Style_Pump_Double = StepsType_pump_double, // m_StepsType StyleType_OnePlayerTwoSides, // m_StyleType 10, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -PUMP_COL_SPACING*4.5f-4, NULL }, - { TRACK_2, -PUMP_COL_SPACING*3.5f-4, NULL }, - { TRACK_3, -PUMP_COL_SPACING*2.5f-4, NULL }, - { TRACK_4, -PUMP_COL_SPACING*1.5f-4, NULL }, - { TRACK_5, -PUMP_COL_SPACING*0.5f-4, NULL }, - { TRACK_6, +PUMP_COL_SPACING*0.5f+4, NULL }, - { TRACK_7, +PUMP_COL_SPACING*1.5f+4, NULL }, - { TRACK_8, +PUMP_COL_SPACING*2.5f+4, NULL }, - { TRACK_9, +PUMP_COL_SPACING*3.5f+4, NULL }, - { TRACK_10, +PUMP_COL_SPACING*4.5f+4, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -PUMP_COL_SPACING*4.5f-4, NULL }, + { TRACK_2, -PUMP_COL_SPACING*3.5f-4, NULL }, + { TRACK_3, -PUMP_COL_SPACING*2.5f-4, NULL }, + { TRACK_4, -PUMP_COL_SPACING*1.5f-4, NULL }, + { TRACK_5, -PUMP_COL_SPACING*0.5f-4, NULL }, + { TRACK_6, +PUMP_COL_SPACING*0.5f+4, NULL }, + { TRACK_7, +PUMP_COL_SPACING*1.5f+4, NULL }, + { TRACK_8, +PUMP_COL_SPACING*2.5f+4, NULL }, + { TRACK_9, +PUMP_COL_SPACING*3.5f+4, NULL }, + { TRACK_10, +PUMP_COL_SPACING*4.5f+4, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -490,16 +490,16 @@ static const Style g_Style_KB7_Single = { StepsType_kb7_single, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 7, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -KB7_COL_SPACING*3.0f, NULL }, - { TRACK_2, -KB7_COL_SPACING*2.0f, NULL }, - { TRACK_3, -KB7_COL_SPACING*1.0f, NULL }, - { TRACK_4, +KB7_COL_SPACING*0.0f, NULL }, - { TRACK_5, +KB7_COL_SPACING*1.0f, NULL }, - { TRACK_6, +KB7_COL_SPACING*2.0f, NULL }, - { TRACK_7, +KB7_COL_SPACING*3.0f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -KB7_COL_SPACING*3.0f, NULL }, + { TRACK_2, -KB7_COL_SPACING*2.0f, NULL }, + { TRACK_3, -KB7_COL_SPACING*1.0f, NULL }, + { TRACK_4, +KB7_COL_SPACING*0.0f, NULL }, + { TRACK_5, +KB7_COL_SPACING*1.0f, NULL }, + { TRACK_6, +KB7_COL_SPACING*2.0f, NULL }, + { TRACK_7, +KB7_COL_SPACING*3.0f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -577,14 +577,14 @@ static const Style g_Style_Ez2_Single = { StepsType_ez2_single, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -EZ2_COL_SPACING*2.0f, NULL }, - { TRACK_2, -EZ2_COL_SPACING*1.0f, NULL }, - { TRACK_3, +EZ2_COL_SPACING*0.0f, NULL }, - { TRACK_4, +EZ2_COL_SPACING*1.0f, NULL }, - { TRACK_5, +EZ2_COL_SPACING*2.0f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -EZ2_COL_SPACING*2.0f, NULL }, + { TRACK_2, -EZ2_COL_SPACING*1.0f, NULL }, + { TRACK_3, +EZ2_COL_SPACING*0.0f, NULL }, + { TRACK_4, +EZ2_COL_SPACING*1.0f, NULL }, + { TRACK_5, +EZ2_COL_SPACING*2.0f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -614,16 +614,16 @@ static const Style g_Style_Ez2_Real = StepsType_ez2_real, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 7, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, NULL }, - { TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, NULL }, - { TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, NULL }, - { TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, NULL }, - { TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, NULL }, - { TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, NULL }, - { TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -EZ2_REAL_COL_SPACING*2.3f, NULL }, + { TRACK_2, -EZ2_REAL_COL_SPACING*1.6f, NULL }, + { TRACK_3, -EZ2_REAL_COL_SPACING*0.9f, NULL }, + { TRACK_4, +EZ2_REAL_COL_SPACING*0.0f, NULL }, + { TRACK_5, +EZ2_REAL_COL_SPACING*0.9f, NULL }, + { TRACK_6, +EZ2_REAL_COL_SPACING*1.6f, NULL }, + { TRACK_7, +EZ2_REAL_COL_SPACING*2.3f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -655,19 +655,19 @@ static const Style g_Style_Ez2_Double = StepsType_ez2_double, // m_StepsType StyleType_OnePlayerTwoSides, // m_StyleType 10, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -EZ2_COL_SPACING*4.5f, NULL }, - { TRACK_2, -EZ2_COL_SPACING*3.5f, NULL }, - { TRACK_3, -EZ2_COL_SPACING*2.5f, NULL }, - { TRACK_4, -EZ2_COL_SPACING*1.5f, NULL }, - { TRACK_5, -EZ2_COL_SPACING*0.5f, NULL }, - { TRACK_6, +EZ2_COL_SPACING*0.5f, NULL }, - { TRACK_7, +EZ2_COL_SPACING*1.5f, NULL }, - { TRACK_8, +EZ2_COL_SPACING*2.5f, NULL }, - { TRACK_9, +EZ2_COL_SPACING*3.5f, NULL }, - { TRACK_10, +EZ2_COL_SPACING*4.5f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -EZ2_COL_SPACING*4.5f, NULL }, + { TRACK_2, -EZ2_COL_SPACING*3.5f, NULL }, + { TRACK_3, -EZ2_COL_SPACING*2.5f, NULL }, + { TRACK_4, -EZ2_COL_SPACING*1.5f, NULL }, + { TRACK_5, -EZ2_COL_SPACING*0.5f, NULL }, + { TRACK_6, +EZ2_COL_SPACING*0.5f, NULL }, + { TRACK_7, +EZ2_COL_SPACING*1.5f, NULL }, + { TRACK_8, +EZ2_COL_SPACING*2.5f, NULL }, + { TRACK_9, +EZ2_COL_SPACING*3.5f, NULL }, + { TRACK_10, +EZ2_COL_SPACING*4.5f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -761,14 +761,14 @@ static const Style g_Style_Para_Single = { StepsType_para_single, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -PARA_COL_SPACING*2.0f, NULL }, - { TRACK_2, -PARA_COL_SPACING*1.0f, NULL }, - { TRACK_3, +PARA_COL_SPACING*0.0f, NULL }, - { TRACK_4, +PARA_COL_SPACING*1.0f, NULL }, - { TRACK_5, +PARA_COL_SPACING*2.0f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -PARA_COL_SPACING*2.0f, NULL }, + { TRACK_2, -PARA_COL_SPACING*1.0f, NULL }, + { TRACK_3, +PARA_COL_SPACING*0.0f, NULL }, + { TRACK_4, +PARA_COL_SPACING*1.0f, NULL }, + { TRACK_5, +PARA_COL_SPACING*2.0f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -842,17 +842,17 @@ static const Style g_Style_DS3DDX_Single = { StepsType_ds3ddx_single, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -DS3DDX_COL_SPACING*3.0f, NULL }, - { TRACK_2, -DS3DDX_COL_SPACING*2.0f, NULL }, - { TRACK_3, -DS3DDX_COL_SPACING*1.0f, NULL }, - { TRACK_4, -DS3DDX_COL_SPACING*0.0f, NULL }, - { TRACK_5, +DS3DDX_COL_SPACING*0.0f, NULL }, - { TRACK_6, +DS3DDX_COL_SPACING*1.0f, NULL }, - { TRACK_7, +DS3DDX_COL_SPACING*2.0f, NULL }, - { TRACK_8, +DS3DDX_COL_SPACING*3.0f , NULL}, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -DS3DDX_COL_SPACING*3.0f, NULL }, + { TRACK_2, -DS3DDX_COL_SPACING*2.0f, NULL }, + { TRACK_3, -DS3DDX_COL_SPACING*1.0f, NULL }, + { TRACK_4, -DS3DDX_COL_SPACING*0.0f, NULL }, + { TRACK_5, +DS3DDX_COL_SPACING*0.0f, NULL }, + { TRACK_6, +DS3DDX_COL_SPACING*1.0f, NULL }, + { TRACK_7, +DS3DDX_COL_SPACING*2.0f, NULL }, + { TRACK_8, +DS3DDX_COL_SPACING*3.0f , NULL}, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -931,15 +931,15 @@ static const Style g_Style_Beat_Single5 = StepsType_beat_single5, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 6, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_2, -BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_3, -BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_4, +BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_5, +BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_6, +BEAT_COL_SPACING*3.0f, "scratch" }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_2, -BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_3, -BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_4, +BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_5, +BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_6, +BEAT_COL_SPACING*3.0f, "scratch" }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] { 0, 1, 2, 3, 4, Style::NO_MAPPING, Style::NO_MAPPING, 5, 5, Style::END_MAPPING }, @@ -962,21 +962,21 @@ static const Style g_Style_Beat_Double5 = StepsType_beat_double5, // m_StepsType StyleType_OnePlayerTwoSides, // m_StyleType 12, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -BEAT_COL_SPACING*6.0f, NULL }, - { TRACK_2, -BEAT_COL_SPACING*5.0f, NULL }, - { TRACK_3, -BEAT_COL_SPACING*4.0f, NULL }, - { TRACK_4, -BEAT_COL_SPACING*3.0f, NULL }, - { TRACK_5, -BEAT_COL_SPACING*2.0f, NULL }, - { TRACK_6, -BEAT_COL_SPACING*1.5f, "scratch" }, - { TRACK_7, +BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_8, +BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_9, +BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_10, +BEAT_COL_SPACING*3.5f, NULL }, - { TRACK_11, +BEAT_COL_SPACING*4.5f, NULL }, - { TRACK_12, +BEAT_COL_SPACING*6.0f, "scratch" }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -BEAT_COL_SPACING*6.0f, NULL }, + { TRACK_2, -BEAT_COL_SPACING*5.0f, NULL }, + { TRACK_3, -BEAT_COL_SPACING*4.0f, NULL }, + { TRACK_4, -BEAT_COL_SPACING*3.0f, NULL }, + { TRACK_5, -BEAT_COL_SPACING*2.0f, NULL }, + { TRACK_6, -BEAT_COL_SPACING*1.5f, "scratch" }, + { TRACK_7, +BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_8, +BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_9, +BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_10, +BEAT_COL_SPACING*3.5f, NULL }, + { TRACK_11, +BEAT_COL_SPACING*4.5f, NULL }, + { TRACK_12, +BEAT_COL_SPACING*6.0f, "scratch" }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] { 0, 1, 2, 3, 4, Style::NO_MAPPING, Style::NO_MAPPING, 5, 5, Style::END_MAPPING }, @@ -999,17 +999,17 @@ static const Style g_Style_Beat_Single7 = StepsType_beat_single7, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_8, -BEAT_COL_SPACING*3.5f, "scratch" }, - { TRACK_1, -BEAT_COL_SPACING*2.0f, NULL }, - { TRACK_2, -BEAT_COL_SPACING*1.0f, NULL }, - { TRACK_3, -BEAT_COL_SPACING*0.0f, NULL }, - { TRACK_4, +BEAT_COL_SPACING*1.0f, NULL }, - { TRACK_5, +BEAT_COL_SPACING*2.0f, NULL }, - { TRACK_6, +BEAT_COL_SPACING*3.0f, NULL }, - { TRACK_7, +BEAT_COL_SPACING*4.0f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_8, -BEAT_COL_SPACING*3.5f, "scratch" }, + { TRACK_1, -BEAT_COL_SPACING*2.0f, NULL }, + { TRACK_2, -BEAT_COL_SPACING*1.0f, NULL }, + { TRACK_3, -BEAT_COL_SPACING*0.0f, NULL }, + { TRACK_4, +BEAT_COL_SPACING*1.0f, NULL }, + { TRACK_5, +BEAT_COL_SPACING*2.0f, NULL }, + { TRACK_6, +BEAT_COL_SPACING*3.0f, NULL }, + { TRACK_7, +BEAT_COL_SPACING*4.0f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -1033,25 +1033,25 @@ static const Style g_Style_Beat_Double7 = StepsType_beat_double7, // m_StepsType StyleType_OnePlayerTwoSides, // m_StyleType 16, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_8, -BEAT_COL_SPACING*8.0f, "scratch" }, - { TRACK_1, -BEAT_COL_SPACING*6.5f, NULL }, - { TRACK_2, -BEAT_COL_SPACING*5.5f, NULL }, - { TRACK_3, -BEAT_COL_SPACING*4.5f, NULL }, - { TRACK_4, -BEAT_COL_SPACING*3.5f, NULL }, - { TRACK_5, -BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_6, -BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_7, -BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_9, +BEAT_COL_SPACING*0.5f, NULL }, - { TRACK_10, +BEAT_COL_SPACING*1.5f, NULL }, - { TRACK_11, +BEAT_COL_SPACING*2.5f, NULL }, - { TRACK_12, +BEAT_COL_SPACING*3.5f, NULL }, - { TRACK_13, +BEAT_COL_SPACING*4.5f, NULL }, - { TRACK_14, +BEAT_COL_SPACING*5.5f, NULL }, - { TRACK_15, +BEAT_COL_SPACING*6.5f, NULL }, - { TRACK_16, +BEAT_COL_SPACING*8.0f, "scratch" }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_8, -BEAT_COL_SPACING*8.0f, "scratch" }, + { TRACK_1, -BEAT_COL_SPACING*6.5f, NULL }, + { TRACK_2, -BEAT_COL_SPACING*5.5f, NULL }, + { TRACK_3, -BEAT_COL_SPACING*4.5f, NULL }, + { TRACK_4, -BEAT_COL_SPACING*3.5f, NULL }, + { TRACK_5, -BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_6, -BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_7, -BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_9, +BEAT_COL_SPACING*0.5f, NULL }, + { TRACK_10, +BEAT_COL_SPACING*1.5f, NULL }, + { TRACK_11, +BEAT_COL_SPACING*2.5f, NULL }, + { TRACK_12, +BEAT_COL_SPACING*3.5f, NULL }, + { TRACK_13, +BEAT_COL_SPACING*4.5f, NULL }, + { TRACK_14, +BEAT_COL_SPACING*5.5f, NULL }, + { TRACK_15, +BEAT_COL_SPACING*6.5f, NULL }, + { TRACK_16, +BEAT_COL_SPACING*8.0f, "scratch" }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -1139,13 +1139,13 @@ static const Style g_Style_Maniax_Single = { StepsType_maniax_single, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 4, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -MANIAX_COL_SPACING*1.5f, NULL }, - { TRACK_2, -MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_3, +MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_4, +MANIAX_COL_SPACING*1.5f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -MANIAX_COL_SPACING*1.5f, NULL }, + { TRACK_2, -MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_3, +MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_4, +MANIAX_COL_SPACING*1.5f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -1169,17 +1169,17 @@ static const Style g_Style_Maniax_Double = StepsType_maniax_double, // m_StepsType StyleType_OnePlayerTwoSides, // m_StyleType 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -MANIAX_COL_SPACING*3.5f, NULL }, - { TRACK_2, -MANIAX_COL_SPACING*2.5f, NULL }, - { TRACK_3, -MANIAX_COL_SPACING*1.5f, NULL }, - { TRACK_4, -MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_5, +MANIAX_COL_SPACING*0.5f, NULL }, - { TRACK_6, +MANIAX_COL_SPACING*1.5f, NULL }, - { TRACK_7, +MANIAX_COL_SPACING*2.5f, NULL }, - { TRACK_8, +MANIAX_COL_SPACING*3.5f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -MANIAX_COL_SPACING*3.5f, NULL }, + { TRACK_2, -MANIAX_COL_SPACING*2.5f, NULL }, + { TRACK_3, -MANIAX_COL_SPACING*1.5f, NULL }, + { TRACK_4, -MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_5, +MANIAX_COL_SPACING*0.5f, NULL }, + { TRACK_6, +MANIAX_COL_SPACING*1.5f, NULL }, + { TRACK_7, +MANIAX_COL_SPACING*2.5f, NULL }, + { TRACK_8, +MANIAX_COL_SPACING*3.5f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -1259,13 +1259,13 @@ static const Style g_Style_Techno_Single4 = StepsType_techno_single4, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 4, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_3, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_4, +TECHNO_COL_SPACING*1.5f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_3, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_4, +TECHNO_COL_SPACING*1.5f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -1289,14 +1289,14 @@ static const Style g_Style_Techno_Single5 = StepsType_techno_single5, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_COL_SPACING*2.0f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*1.0f, NULL }, - { TRACK_3, +TECHNO_COL_SPACING*0.0f, NULL }, - { TRACK_4, +TECHNO_COL_SPACING*1.0f, NULL }, - { TRACK_5, +TECHNO_COL_SPACING*2.0f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -TECHNO_COL_SPACING*2.0f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*1.0f, NULL }, + { TRACK_3, +TECHNO_COL_SPACING*0.0f, NULL }, + { TRACK_4, +TECHNO_COL_SPACING*1.0f, NULL }, + { TRACK_5, +TECHNO_COL_SPACING*2.0f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -1338,17 +1338,17 @@ static const Style g_Style_Techno_Single8 = StepsType_techno_single8, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_3, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_4, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_5, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_6, +TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_7, +TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_8, +TECHNO_COL_SPACING*3.5f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_3, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_4, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_5, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_6, +TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_7, +TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_8, +TECHNO_COL_SPACING*3.5f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -1372,17 +1372,17 @@ static const Style g_Style_Techno_Double4 = StepsType_techno_double4, // m_StepsType StyleType_OnePlayerTwoSides, // m_StyleType 8, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_3, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_4, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_5, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_6, +TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_7, +TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_8, +TECHNO_COL_SPACING*3.5f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_3, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_4, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_5, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_6, +TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_7, +TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_8, +TECHNO_COL_SPACING*3.5f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -1406,19 +1406,19 @@ static const Style g_Style_Techno_Double5 = { StepsType_techno_double5, // m_StepsType StyleType_OnePlayerTwoSides, // m_StyleType 10, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_COL_SPACING*4.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_3, -TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_4, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_5, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_6, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_7, +TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_8, +TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_9, +TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_10, +TECHNO_COL_SPACING*4.5f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -TECHNO_COL_SPACING*4.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_3, -TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_4, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_5, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_6, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_7, +TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_8, +TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_9, +TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_10, +TECHNO_COL_SPACING*4.5f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -1459,25 +1459,25 @@ static const Style g_Style_Techno_Double8 = { StepsType_techno_double8, // m_StepsType StyleType_OnePlayerTwoSides, // m_StyleType 16, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -TECHNO_COL_SPACING*7.5f, NULL }, - { TRACK_2, -TECHNO_COL_SPACING*6.5f, NULL }, - { TRACK_3, -TECHNO_COL_SPACING*5.5f, NULL }, - { TRACK_4, -TECHNO_COL_SPACING*4.5f, NULL }, - { TRACK_5, -TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_6, -TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_7, -TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_8, -TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_9, +TECHNO_COL_SPACING*0.5f, NULL }, - { TRACK_10, +TECHNO_COL_SPACING*1.5f, NULL }, - { TRACK_11, +TECHNO_COL_SPACING*2.5f, NULL }, - { TRACK_12, +TECHNO_COL_SPACING*3.5f, NULL }, - { TRACK_13, +TECHNO_COL_SPACING*4.5f, NULL }, - { TRACK_14, +TECHNO_COL_SPACING*5.5f, NULL }, - { TRACK_15, +TECHNO_COL_SPACING*6.5f, NULL }, - { TRACK_16, +TECHNO_COL_SPACING*7.5f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -TECHNO_COL_SPACING*7.5f, NULL }, + { TRACK_2, -TECHNO_COL_SPACING*6.5f, NULL }, + { TRACK_3, -TECHNO_COL_SPACING*5.5f, NULL }, + { TRACK_4, -TECHNO_COL_SPACING*4.5f, NULL }, + { TRACK_5, -TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_6, -TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_7, -TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_8, -TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_9, +TECHNO_COL_SPACING*0.5f, NULL }, + { TRACK_10, +TECHNO_COL_SPACING*1.5f, NULL }, + { TRACK_11, +TECHNO_COL_SPACING*2.5f, NULL }, + { TRACK_12, +TECHNO_COL_SPACING*3.5f, NULL }, + { TRACK_13, +TECHNO_COL_SPACING*4.5f, NULL }, + { TRACK_14, +TECHNO_COL_SPACING*5.5f, NULL }, + { TRACK_15, +TECHNO_COL_SPACING*6.5f, NULL }, + { TRACK_16, +TECHNO_COL_SPACING*7.5f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -1581,14 +1581,14 @@ static const Style g_Style_Popn_Five = { StepsType_popn_five, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 5, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -POPN5_COL_SPACING*2.0f, NULL }, - { TRACK_2, -POPN5_COL_SPACING*1.0f, NULL }, - { TRACK_3, +POPN5_COL_SPACING*0.0f, NULL }, - { TRACK_4, +POPN5_COL_SPACING*1.0f, NULL }, - { TRACK_5, +POPN5_COL_SPACING*2.0f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -POPN5_COL_SPACING*2.0f, NULL }, + { TRACK_2, -POPN5_COL_SPACING*1.0f, NULL }, + { TRACK_3, +POPN5_COL_SPACING*0.0f, NULL }, + { TRACK_4, +POPN5_COL_SPACING*1.0f, NULL }, + { TRACK_5, +POPN5_COL_SPACING*2.0f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] @@ -1626,18 +1626,18 @@ static const Style g_Style_Popn_Nine = { StepsType_popn_nine, // m_StepsType StyleType_OnePlayerOneSide, // m_StyleType 9, // m_iColsPerPlayer - { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; - { // PLAYER_1 - { TRACK_1, -POPN9_COL_SPACING*4.0f, NULL }, - { TRACK_2, -POPN9_COL_SPACING*3.0f, NULL }, - { TRACK_3, -POPN9_COL_SPACING*2.0f, NULL }, - { TRACK_4, -POPN9_COL_SPACING*1.0f, NULL }, - { TRACK_5, +POPN9_COL_SPACING*0.0f, NULL }, - { TRACK_6, +POPN9_COL_SPACING*1.0f, NULL }, - { TRACK_7, +POPN9_COL_SPACING*2.0f, NULL }, - { TRACK_8, +POPN9_COL_SPACING*3.0f, NULL }, - { TRACK_9, +POPN9_COL_SPACING*4.0f, NULL }, - }, + { // m_ColumnInfo[MAX_COLS_PER_PLAYER]; + // PLAYER_1 + { TRACK_1, -POPN9_COL_SPACING*4.0f, NULL }, + { TRACK_2, -POPN9_COL_SPACING*3.0f, NULL }, + { TRACK_3, -POPN9_COL_SPACING*2.0f, NULL }, + { TRACK_4, -POPN9_COL_SPACING*1.0f, NULL }, + { TRACK_5, +POPN9_COL_SPACING*0.0f, NULL }, + { TRACK_6, +POPN9_COL_SPACING*1.0f, NULL }, + { TRACK_7, +POPN9_COL_SPACING*2.0f, NULL }, + { TRACK_8, +POPN9_COL_SPACING*3.0f, NULL }, + { TRACK_9, +POPN9_COL_SPACING*4.0f, NULL }, + }, { // m_iInputColumn[NUM_GameController][NUM_GameButton] diff --git a/src/GameState.cpp b/src/GameState.cpp index f1a20ed841..3dea907d60 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -114,10 +114,10 @@ GameState::GameState() m_PlayMode.Set( PlayMode_Invalid); // used by IsPlayerEnabled before the first screen - m_bSideIsJoined[PLAYER_1] = false; // used by GetNumSidesJoined before the first screen + m_bSideIsJoined = false; // used by GetNumSidesJoined before the first screen - m_pPlayerState[PLAYER_1] = new PlayerState; - m_pPlayerState[PLAYER_1]->SetPlayerNumber(PLAYER_1); + m_pPlayerState = new PlayerState; + m_pPlayerState->SetPlayerNumber(PLAYER_1); FOREACH_MultiPlayer(p) { m_pMultiPlayerState[p] = new PlayerState; @@ -149,7 +149,7 @@ GameState::~GameState() // Unregister with Lua. LUA->UnsetGlobal("GAMESTATE"); - SAFE_DELETE(m_pPlayerState[PLAYER_1]); + SAFE_DELETE(m_pPlayerState); FOREACH_MultiPlayer(p) SAFE_DELETE(m_pMultiPlayerState[p]); SAFE_DELETE(m_Environment); @@ -224,10 +224,10 @@ void GameState::ResetPlayer(PlayerNumber pn) { m_PreferredStepsType.Set(StepsType_Invalid); - m_PreferredDifficulty[pn].Set(Difficulty_Invalid); - m_iPlayerStageTokens[pn] = 0; - m_pCurSteps[pn].Set(NULL); - m_pPlayerState[pn]->Reset(); + m_PreferredDifficulty.Set(Difficulty_Invalid); + m_iPlayerStageTokens = 0; + m_pCurSteps.Set(NULL); + m_pPlayerState->Reset(); PROFILEMAN->UnloadProfile(pn); ResetPlayerOptions(pn); } @@ -237,7 +237,7 @@ GameState::ResetPlayerOptions(PlayerNumber pn) { PlayerOptions po; GetDefaultPlayerOptions(po); - m_pPlayerState[pn]->m_PlayerOptions.Assign(ModsLevel_Preferred, po); + m_pPlayerState->m_PlayerOptions.Assign(ModsLevel_Preferred, po); } void @@ -301,7 +301,7 @@ void GameState::JoinPlayer(PlayerNumber pn) { pn = PLAYER_1; - m_bSideIsJoined[pn] = true; + m_bSideIsJoined = true; this->SetMasterPlayerNumber(pn); if (GetNumSidesJoined() == 1) @@ -321,8 +321,8 @@ GameState::UnjoinPlayer(PlayerNumber pn) /* Unjoin STATSMAN first, so steps used by this player are released * and can be released by PROFILEMAN. */ STATSMAN->UnjoinPlayer(pn); - m_bSideIsJoined[pn] = false; - m_iPlayerStageTokens[pn] = 0; + m_bSideIsJoined = false; + m_iPlayerStageTokens = 0; ResetPlayer(pn); @@ -364,7 +364,7 @@ JoinInputInternal(PlayerNumber pn) return false; // If this side is already in, don't re-join. - if (GAMESTATE->m_bSideIsJoined[pn]) + if (GAMESTATE->m_bSideIsJoined) return false; GAMESTATE->JoinPlayer(pn); @@ -455,7 +455,7 @@ GameState::SavePlayerProfile(PlayerNumber pn) // AutoplayCPU should not save scores. -aj // xxx: this MAY cause issues with Multiplayer. However, without a working // Multiplayer build, we'll never know. -aj - if (m_pPlayerState[pn]->m_PlayerController != PC_HUMAN) + if (m_pPlayerState->m_PlayerController != PC_HUMAN) return; PROFILEMAN->SaveProfile(pn); @@ -525,9 +525,9 @@ GameState::BeginStage() AdjustSync::ResetOriginalSyncData(); if (!ARE_STAGE_PLAYER_MODS_FORCED) { - ModsGroup& po = m_pPlayerState[PLAYER_1]->m_PlayerOptions; + ModsGroup& po = m_pPlayerState->m_PlayerOptions; po.Assign(ModsLevel_Stage, - m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetPreferred()); + m_pPlayerState->m_PlayerOptions.GetPreferred()); } if (!ARE_STAGE_SONG_MODS_FORCED) m_SongOptions.Assign(ModsLevel_Stage, m_SongOptions.GetPreferred()); @@ -541,18 +541,18 @@ GameState::BeginStage() // only do this check with human players, assume CPU players (Rave) // always have tokens. -aj (this could probably be moved below, even.) if (!IsEventMode() && !IsCpuPlayer(p)) { - if (m_iPlayerStageTokens[p] < m_iNumStagesOfThisSong) { + if (m_iPlayerStageTokens < m_iNumStagesOfThisSong) { LuaHelpers::ReportScriptErrorFmt( "Player %d only has %d stage tokens, but needs %d.", p, - m_iPlayerStageTokens[p], + m_iPlayerStageTokens, m_iNumStagesOfThisSong); } } - m_iPlayerStageTokens[p] -= m_iNumStagesOfThisSong; + m_iPlayerStageTokens -= m_iNumStagesOfThisSong; } FOREACH_HumanPlayer(pn) if (CurrentOptionsDisqualifyPlayer(pn)) - STATSMAN->m_CurStageStats.m_player[pn] + STATSMAN->m_CurStageStats.m_player .m_bDisqualified = true; m_sStageGUID = CryptManager::GenerateRandomUUID(); } @@ -560,7 +560,7 @@ GameState::BeginStage() void GameState::CancelStage() { - FOREACH_EnabledPlayer(p) m_iPlayerStageTokens[p] += m_iNumStagesOfThisSong; + m_iPlayerStageTokens += m_iNumStagesOfThisSong; m_iNumStagesOfThisSong = 0; ResetStageStatistics(); } @@ -600,7 +600,7 @@ GameState::FinishStage() { Profile* pProfile = PROFILEMAN->GetProfile(p); pProfile->m_iCurrentCombo = - STATSMAN->m_CurStageStats.m_player[p].m_iCurCombo; + STATSMAN->m_CurStageStats.m_player.m_iCurCombo; } } @@ -620,7 +620,7 @@ GameState::LoadCurrentSettingsFromProfile(PlayerNumber pn) * set it off. However, don't reset modifiers that aren't saved by the * profile, so we don't ignore unsaved modifiers when a profile is in * use. */ - PO_GROUP_CALL(m_pPlayerState[pn]->m_PlayerOptions, + PO_GROUP_CALL(m_pPlayerState->m_PlayerOptions, ModsLevel_Preferred, ResetSavedPrefs); ApplyPreferredModifiers(pn, sModifiers); @@ -631,7 +631,7 @@ GameState::LoadCurrentSettingsFromProfile(PlayerNumber pn) pProfile->m_SortOrder != SortOrder_Invalid) m_PreferredSortOrder = pProfile->m_SortOrder; if (pProfile->m_LastDifficulty != Difficulty_Invalid) - m_PreferredDifficulty[pn].Set(pProfile->m_LastDifficulty); + m_PreferredDifficulty.Set(pProfile->m_LastDifficulty); // Only set the PreferredStepsType if it wasn't already set by a GameCommand // (or by an earlier profile) if (m_PreferredStepsType == StepsType_Invalid && @@ -651,11 +651,11 @@ GameState::SaveCurrentSettingsToProfile(PlayerNumber pn) pProfile->SetDefaultModifiers( m_pCurGame, - m_pPlayerState[pn]->m_PlayerOptions.GetPreferred().GetSavedPrefsString()); + m_pPlayerState->m_PlayerOptions.GetPreferred().GetSavedPrefsString()); if (IsSongSort(m_PreferredSortOrder)) pProfile->m_SortOrder = m_PreferredSortOrder; - if (m_PreferredDifficulty[pn] != Difficulty_Invalid) - pProfile->m_LastDifficulty = m_PreferredDifficulty[pn]; + if (m_PreferredDifficulty != Difficulty_Invalid) + pProfile->m_LastDifficulty = m_PreferredDifficulty; if (m_PreferredStepsType != StepsType_Invalid) pProfile->m_LastStepsType = m_PreferredStepsType; if (m_pPreferredSong) @@ -679,7 +679,7 @@ GameState::CanSafelyEnterGameplay(RString& reason) return false; } - Steps const* steps = m_pCurSteps[pn]; + Steps const* steps = m_pCurSteps; if (steps == NULL) { reason = ssprintf("Steps for player %d is NULL.", pn + 1); return false; @@ -721,8 +721,8 @@ GameState::SetCompatibleStylesForPlayers() FOREACH_EnabledPlayer(pn) { StepsType st = StepsType_Invalid; - if (m_pCurSteps[pn] != NULL) { - st = m_pCurSteps[pn]->m_StepsType; + if (m_pCurSteps != NULL) { + st = m_pCurSteps->m_StepsType; } else { vector vst; GAMEMAN->GetStepsTypesForGame(m_pCurGame, vst); @@ -737,7 +737,7 @@ GameState::SetCompatibleStylesForPlayers() void GameState::ForceOtherPlayersToCompatibleSteps(PlayerNumber main) { - Steps* steps_to_match = m_pCurSteps[main].Get(); + Steps* steps_to_match = m_pCurSteps.Get(); if (steps_to_match == NULL) { return; } @@ -750,7 +750,7 @@ void GameState::ForceOtherPlayersToCompatibleSteps(PlayerNumber main) RString music_to_match = steps_to_match->GetMusicFile(); FOREACH_EnabledPlayer(pn) { - Steps* pn_steps = m_pCurSteps[pn].Get(); + Steps* pn_steps = m_pCurSteps.Get(); bool match_failed = pn_steps == NULL; if (steps_to_match != pn_steps && pn_steps != NULL) { StyleType pn_styletype = @@ -765,7 +765,7 @@ void GameState::ForceOtherPlayersToCompatibleSteps(PlayerNumber main) } } if (match_failed) { - m_pCurSteps[pn].Set(steps_to_match); + m_pCurSteps.Set(steps_to_match); } } } @@ -775,7 +775,7 @@ GameState::Update(float fDelta) { m_SongOptions.Update(fDelta); - m_pPlayerState[PLAYER_1]->Update(fDelta); + m_pPlayerState->Update(fDelta); } void @@ -799,7 +799,7 @@ GameState::ResetMusicStatistics() Actor::SetBGMTime(0, 0, 0, 0); - m_pPlayerState[PLAYER_1]->m_Position.Reset(); + m_pPlayerState->m_Position.Reset(); } void @@ -807,7 +807,7 @@ GameState::ResetStageStatistics() { StageStats OldStats = STATSMAN->m_CurStageStats; STATSMAN->m_CurStageStats = StageStats(); - m_pPlayerState[PLAYER_1]->m_HealthState = HealthState_Alive; + m_pPlayerState->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. @@ -843,13 +843,13 @@ GameState::UpdateSongPosition(float fPositionSeconds, FOREACH_EnabledPlayer(pn) { - if (m_pCurSteps[pn]) { - m_pPlayerState[pn]->m_Position.UpdateSongPosition( - fPositionSeconds, *m_pCurSteps[pn]->GetTimingData(), timestamp); + if (m_pCurSteps) { + m_pPlayerState->m_Position.UpdateSongPosition( + fPositionSeconds, *m_pCurSteps->GetTimingData(), timestamp); Actor::SetPlayerBGMBeat( pn, - m_pPlayerState[pn]->m_Position.m_fSongBeatVisible, - m_pPlayerState[pn]->m_Position.m_fSongBeatNoOffset); + m_pPlayerState->m_Position.m_fSongBeatVisible, + m_pPlayerState->m_Position.m_fSongBeatNoOffset); } } Actor::SetBGMTime(GAMESTATE->m_Position.m_fMusicSecondsVisible, @@ -877,7 +877,7 @@ int GameState::GetNumSidesJoined() const { int iNumSidesJoined = 0; - if (m_bSideIsJoined[PLAYER_1]) + if (m_bSideIsJoined) iNumSidesJoined++; // left side, and right side return iNumSidesJoined; } @@ -895,7 +895,7 @@ GameState::GetCourseSongIndex() const FAIL_M("At least one MultiPlayer must be joined."); } else { - return STATSMAN->m_CurStageStats.m_player[this->GetMasterPlayerNumber()] + return STATSMAN->m_CurStageStats.m_player .m_iSongsPlayed - 1; } @@ -1037,7 +1037,7 @@ GameState::IsHumanPlayer(PlayerNumber pn) const if (GetCurrentGame()->m_PlayersHaveSeparateStyles) { if (GetCurrentStyle(pn) == NULL) // no style chosen { - return m_bSideIsJoined[pn]; + return m_bSideIsJoined; } else { StyleType type = GetCurrentStyle(pn)->m_StyleType; switch( type ) @@ -1052,7 +1052,7 @@ GameState::IsHumanPlayer(PlayerNumber pn) const } if (GetCurrentStyle(pn) == NULL) // no style chosen { - return m_bSideIsJoined[pn]; // only allow input from sides that have + return m_bSideIsJoined; // only allow input from sides that have // already joined } @@ -1132,7 +1132,7 @@ GameState::ResetToDefaultSongOptions(ModsLevel l) void GameState::ApplyPreferredModifiers(PlayerNumber pn, const RString& sModifiers) { - m_pPlayerState[pn]->m_PlayerOptions.FromString(ModsLevel_Preferred, + m_pPlayerState->m_PlayerOptions.FromString(ModsLevel_Preferred, sModifiers); m_SongOptions.FromString(ModsLevel_Preferred, sModifiers); } @@ -1140,7 +1140,7 @@ GameState::ApplyPreferredModifiers(PlayerNumber pn, const RString& sModifiers) void GameState::ApplyStageModifiers(PlayerNumber pn, const RString& sModifiers) { - m_pPlayerState[pn]->m_PlayerOptions.FromString(ModsLevel_Stage, sModifiers); + m_pPlayerState->m_PlayerOptions.FromString(ModsLevel_Stage, sModifiers); m_SongOptions.FromString(ModsLevel_Stage, sModifiers); } @@ -1154,11 +1154,11 @@ GameState::CurrentOptionsDisqualifyPlayer(PlayerNumber pn) return false; const PlayerOptions& po = - m_pPlayerState[pn]->m_PlayerOptions.GetPreferred(); + m_pPlayerState->m_PlayerOptions.GetPreferred(); // Check the stored player options for disqualify. Don't disqualify because // of mods that were forced. - return po.IsEasierForSongAndSteps(m_pCurSong, m_pCurSteps[pn], pn); + return po.IsEasierForSongAndSteps(m_pCurSong, m_pCurSteps, pn); } /* reset noteskins (?) @@ -1173,7 +1173,7 @@ GameState::GetAllUsedNoteSkins(vector& out) const FOREACH_EnabledPlayer(pn) { out.push_back( - m_pPlayerState[pn]->m_PlayerOptions.GetCurrent().m_sNoteSkin); + m_pPlayerState->m_PlayerOptions.GetCurrent().m_sNoteSkin); } // Remove duplicates. @@ -1185,7 +1185,7 @@ void GameState::AddStageToPlayer(PlayerNumber pn) { // Add one stage more to player (bonus) -cerbo - ++m_iPlayerStageTokens[pn]; + ++m_iPlayerStageTokens; } bool @@ -1234,16 +1234,14 @@ GameState::ShowW1() const bool GameState::AllAreInDangerOrWorse() const { - FOREACH_EnabledPlayer(p) if (m_pPlayerState[p]->m_HealthState < - HealthState_Danger) return false; + if (m_pPlayerState->m_HealthState < HealthState_Danger) return false; return true; } bool GameState::OneIsHot() const { - FOREACH_EnabledPlayer(p) if (m_pPlayerState[p]->m_HealthState == - HealthState_Hot) return true; + if (m_pPlayerState->m_HealthState == HealthState_Hot) return true; return false; } @@ -1251,7 +1249,7 @@ GameState::OneIsHot() const int GameState::GetNumCols(int pn) { - return m_pPlayerState[pn]->GetNumCols(); + return m_pPlayerState->GetNumCols(); } bool @@ -1267,11 +1265,11 @@ GameState::ChangePreferredDifficultyAndStepsType(PlayerNumber pn, Difficulty dc, StepsType st) { - m_PreferredDifficulty[pn].Set(dc); + m_PreferredDifficulty.Set(dc); m_PreferredStepsType.Set(st); if (DifficultiesLocked()) - if (PLAYER_1 != pn) m_PreferredDifficulty[PLAYER_1].Set( - m_PreferredDifficulty[pn]); + if (PLAYER_1 != pn) m_PreferredDifficulty.Set( + m_PreferredDifficulty); return true; } @@ -1295,7 +1293,7 @@ GameState::ChangePreferredDifficulty(PlayerNumber pn, int dir) break; // found } } - m_PreferredDifficulty[pn].Set(d); + m_PreferredDifficulty.Set(d); return true; } @@ -1312,7 +1310,7 @@ GameState::GetClosestShownDifficulty(PlayerNumber pn) const int iClosestDist = -1; FOREACH_CONST(Difficulty, v, dc) { - int iDist = m_PreferredDifficulty[pn] - *dc; + int iDist = m_PreferredDifficulty - *dc; if (iDist < 0) continue; if (iClosestDist != -1 && iDist > iClosestDist) @@ -1328,16 +1326,14 @@ Difficulty GameState::GetEasiestStepsDifficulty() const { Difficulty dc = Difficulty_Invalid; - FOREACH_HumanPlayer(p) - { - if (m_pCurSteps[p] == NULL) { - LuaHelpers::ReportScriptErrorFmt( - "GetEasiestStepsDifficulty called but p%i hasn't chosen notes", - p + 1); - continue; - } - dc = min(dc, m_pCurSteps[p]->GetDifficulty()); + + if (m_pCurSteps == NULL) { + LuaHelpers::ReportScriptErrorFmt( + "GetEasiestStepsDifficulty called but p%i hasn't chosen notes", + PLAYER_1 + 1); } + + dc = min(dc, m_pCurSteps->GetDifficulty()); return dc; } @@ -1345,16 +1341,12 @@ Difficulty GameState::GetHardestStepsDifficulty() const { Difficulty dc = Difficulty_Beginner; - FOREACH_HumanPlayer(p) - { - if (m_pCurSteps[p] == NULL) { - LuaHelpers::ReportScriptErrorFmt( - "GetHardestStepsDifficulty called but p%i hasn't chosen notes", - p + 1); - continue; - } - dc = max(dc, m_pCurSteps[p]->GetDifficulty()); + if (m_pCurSteps == NULL) { + LuaHelpers::ReportScriptErrorFmt( + "GetHardestStepsDifficulty called but p%i hasn't chosen notes", + PLAYER_1 + 1); } + dc = max(dc, m_pCurSteps->GetDifficulty()); return dc; } @@ -1373,12 +1365,12 @@ GameState::IsEventMode() const bool GameState::PlayerIsUsingModifier(PlayerNumber pn, const RString& sModifier) { - PlayerOptions po = m_pPlayerState[pn]->m_PlayerOptions.GetCurrent(); + PlayerOptions po = m_pPlayerState->m_PlayerOptions.GetCurrent(); SongOptions so = m_SongOptions.GetCurrent(); po.FromString(sModifier); so.FromString(sModifier); - return po == m_pPlayerState[pn]->m_PlayerOptions.GetCurrent() && + return po == m_pPlayerState->m_PlayerOptions.GetCurrent() && so == m_SongOptions.GetCurrent(); } @@ -1503,7 +1495,7 @@ class LunaGameState : public Luna static int GetPlayerState(T* p, lua_State* L) { PlayerNumber pn = PLAYER_1; - p->m_pPlayerState[pn]->PushSelf(L); + p->m_pPlayerState->PushSelf(L); return 1; } static int GetMultiPlayerState(T* p, lua_State* L) @@ -1572,7 +1564,7 @@ class LunaGameState : public Luna static int GetCurrentSteps(T* p, lua_State* L) { PlayerNumber pn = PLAYER_1; - Steps* pSteps = p->m_pCurSteps[pn]; + Steps* pSteps = p->m_pCurSteps; if (pSteps) { pSteps->PushSelf(L); } else { @@ -1584,11 +1576,11 @@ class LunaGameState : public Luna { PlayerNumber pn = PLAYER_1; if (lua_isnil(L, 2)) { - p->m_pCurSteps[pn].Set(NULL); + p->m_pCurSteps.Set(NULL); } else { Steps* pS = Luna::check(L, 2); SetCompatibleStyleOrError(p, L, pS->m_StepsType, pn); - p->m_pCurSteps[pn].Set(pS); + p->m_pCurSteps.Set(pS); p->ForceOtherPlayersToCompatibleSteps(pn); } COMMON_RETURN_SELF; @@ -1623,13 +1615,12 @@ class LunaGameState : public Luna } static int SetPreferredDifficulty(T* p, lua_State* L) { - PlayerNumber pn = PLAYER_1; Difficulty dc = Enum::Check(L, 2); - p->m_PreferredDifficulty[pn].Set(dc); + p->m_PreferredDifficulty.Set(dc); COMMON_RETURN_SELF; } DEFINE_METHOD(GetPreferredDifficulty, - m_PreferredDifficulty[PLAYER_1]) + m_PreferredDifficulty) DEFINE_METHOD(GetPlayMode, m_PlayMode) DEFINE_METHOD(GetSortOrder, m_SortOrder) DEFINE_METHOD(GetCurrentStageIndex, m_iCurrentStageIndex) @@ -1649,7 +1640,7 @@ class LunaGameState : public Luna DEFINE_METHOD(GetLastGameplayDuration, m_DanceDuration) DEFINE_METHOD(GetGameplayLeadIn, m_bGameplayLeadIn) DEFINE_METHOD(IsSideJoined, - m_bSideIsJoined[PLAYER_1]) + m_bSideIsJoined) DEFINE_METHOD(PlayersCanJoin, PlayersCanJoin()) DEFINE_METHOD(GetNumSidesJoined, GetNumSidesJoined()) DEFINE_METHOD(GetSongOptionsString, m_SongOptions.GetCurrent().GetString()) @@ -1731,7 +1722,7 @@ class LunaGameState : public Luna vector vpStepsToShow; FOREACH_HumanPlayer(p) { - const Steps* pSteps = GAMESTATE->m_pCurSteps[p]; + const Steps* pSteps = GAMESTATE->m_pCurSteps; if (pSteps == NULL) return 0; bool bAlreadyAdded = @@ -1834,7 +1825,7 @@ class LunaGameState : public Luna static int GetCharacter(T* p, lua_State* L) { - p->m_pCurCharacters[PLAYER_1]->PushSelf(L); + p->m_pCurCharacters->PushSelf(L); return 1; } static int SetCharacter(T* p, lua_State* L) { COMMON_RETURN_SELF; } diff --git a/src/GameState.h b/src/GameState.h index eb1fecb3f3..018d998f38 100644 --- a/src/GameState.h +++ b/src/GameState.h @@ -96,7 +96,7 @@ class GameState /** @brief Determine which side is joined. * * The left side is player 1, and the right side is player 2. */ - bool m_bSideIsJoined[NUM_PLAYERS]; // left side, right side + bool m_bSideIsJoined; // left side, right side MultiPlayerStatus m_MultiPlayerStatus[NUM_MultiPlayer]; BroadcastOnChange m_PlayMode; // many screens display different info depending on this value @@ -178,7 +178,7 @@ class GameState BroadcastOnChange m_sPreferredSongGroup; // GROUP_ALL denotes no preferred group bool m_bFailTypeWasExplicitlySet; // true if FailType was changed in the song options screen BroadcastOnChange m_PreferredStepsType; - BroadcastOnChange1D m_PreferredDifficulty; + BroadcastOnChange m_PreferredDifficulty; BroadcastOnChange m_SortOrder; // set by MusicWheel SortOrder m_PreferredSortOrder; // used by MusicWheel @@ -196,7 +196,7 @@ class GameState * @brief The number of stages available for the players. * * This resets whenever a player joins or continues. */ - int m_iPlayerStageTokens[NUM_PLAYERS]; + int m_iPlayerStageTokens; // This is necessary so that IsFinalStageForEveryHumanPlayer knows to // adjust for the current song cost. bool m_AdjustTokensBySongCostForFinalStageCheck; @@ -229,7 +229,7 @@ class GameState BroadcastOnChangePtr m_pCurSong; // The last Song that the user manually changed to. Song* m_pPreferredSong; - BroadcastOnChangePtr1D m_pCurSteps; + BroadcastOnChangePtr m_pCurSteps; // Music statistics: SongPosition m_Position; @@ -284,12 +284,12 @@ class GameState FailType GetPlayerFailType(const PlayerState* pPlayerState) const; // character stuff - Character* m_pCurCharacters[NUM_PLAYERS]; + Character* m_pCurCharacters; int GetNumSidesJoined() const; // PlayerState /** @brief Allow access to each player's PlayerState. */ - PlayerState* m_pPlayerState[NUM_PLAYERS]; + PlayerState* m_pPlayerState; PlayerState* m_pMultiPlayerState[NUM_MultiPlayer]; int GetNumCols(int pn); diff --git a/src/GameplayAssist.cpp b/src/GameplayAssist.cpp index 04ec98c112..c02388124a 100644 --- a/src/GameplayAssist.cpp +++ b/src/GameplayAssist.cpp @@ -37,7 +37,7 @@ GameplayAssist::PlayTicks(const NoteData& nd, const PlayerState* ps) * sound early enough for it to come out on time; the actual precise timing * is handled by SetStartTime. */ SongPosition& position = - GAMESTATE->m_pPlayerState[ps->m_PlayerNumber]->m_Position; + GAMESTATE->m_pPlayerState->m_Position; float fPositionSeconds = position.m_fMusicSeconds; // float fPositionSeconds = GAMESTATE->m_Position.m_fMusicSeconds; @@ -45,7 +45,7 @@ GameplayAssist::PlayTicks(const NoteData& nd, const PlayerState* ps) static_cast(CommonMetrics::TICK_EARLY_SECONDS) + 0.250f; const TimingData& timing = - *GAMESTATE->m_pCurSteps[ps->m_PlayerNumber]->GetTimingData(); + *GAMESTATE->m_pCurSteps->GetTimingData(); const float fSongBeat = timing.GetBeatFromElapsedTimeNoOffset(fPositionSeconds); diff --git a/src/HighScore.cpp b/src/HighScore.cpp index ea2f8ba713..43e6836a42 100644 --- a/src/HighScore.cpp +++ b/src/HighScore.cpp @@ -1622,7 +1622,7 @@ class LunaHighScore : public Luna { bool bIsFillInMarker = false; bIsFillInMarker |= - p->GetName() == RANKING_TO_FILL_IN_MARKER[PLAYER_1]; + p->GetName() == RANKING_TO_FILL_IN_MARKER; lua_pushboolean(L, static_cast(bIsFillInMarker)); return 1; } diff --git a/src/ModIconRow.cpp b/src/ModIconRow.cpp index c0d0a8ba08..2e058e8d59 100644 --- a/src/ModIconRow.cpp +++ b/src/ModIconRow.cpp @@ -141,7 +141,7 @@ ModIconRow::SetFromGameState() PlayerNumber pn = m_pn; RString sOptions = - GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetStage().GetString(); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetStage().GetString(); vector vsOptions; split(sOptions, ", ", vsOptions, true); diff --git a/src/MusicWheel.cpp b/src/MusicWheel.cpp index f40007d025..109706395d 100644 --- a/src/MusicWheel.cpp +++ b/src/MusicWheel.cpp @@ -379,8 +379,8 @@ MusicWheel::GetSongList(vector& arraySongs, SortOrder so) break; case SORT_POPULARITY: // todo: make this work -poco - //apAllSongs = SONGMAN->GetPopularSongs(); - //break; + // apAllSongs = SONGMAN->GetPopularSongs(); + // break; case SORT_GROUP: // if we're not using sections with a preferred song group, and // there is a group to load, only load those songs. -aj @@ -601,7 +601,7 @@ MusicWheel::FilterBySkillsets(vector& inv) if (lb > 0.f || ub > 0.f) { // if either bound is active, // continue to evaluation float currate = FILTERMAN->MaxFilterRate + 0.1f; - float minrate = FILTERMAN->m_pPlayerState[0]->wtFFF; + float minrate = FILTERMAN->m_pPlayerState->wtFFF; do { currate = currate - 0.1f; if (FILTERMAN->HighestSkillsetsOnly) @@ -655,7 +655,7 @@ MusicWheel::FilterBySkillsets(vector& inv) if (lb > 0.f || ub > 0.f) { bool localaddsong; float currate = FILTERMAN->MaxFilterRate + 0.1f; - float minrate = FILTERMAN->m_pPlayerState[0]->wtFFF; + float minrate = FILTERMAN->m_pPlayerState->wtFFF; bool toiletpaper = false; do { localaddsong = true; @@ -1080,8 +1080,6 @@ MusicWheel::FilterWheelItemDatas(vector& aUnFilteredDatas, --filteredSize; } - - // If we've filtered all items, insert a dummy. if (aFilteredData.empty()) aFilteredData.emplace_back(new MusicWheelItemData( @@ -1122,7 +1120,7 @@ MusicWheel::UpdateSwitch() GAMESTATE->m_SortOrder, st, dc)) { ASSERT(dc != Difficulty_Invalid); if (GAMESTATE->IsPlayerEnabled(PLAYER_1)) - GAMESTATE->m_PreferredDifficulty[PLAYER_1].Set(dc); + GAMESTATE->m_PreferredDifficulty.Set(dc); } SCREENMAN->PostMessageToTopScreen(SM_SongChanged, 0); @@ -1532,20 +1530,21 @@ MusicWheel::GetPreferredSelectionForRandomOrPortal() // probe to find a song that has the preferred // difficulties of each player vector vDifficultiesToRequire; - FOREACH_HumanPlayer(p) - { - if (GAMESTATE->m_PreferredDifficulty[p] == Difficulty_Invalid) - continue; // skip - - // TRICKY: Don't require that edits be present if perferred - // difficulty is Difficulty_Edit. Otherwise, players could use this - // to set up a 100% chance of getting a particular locked song by - // having a single edit for a locked song. - if (GAMESTATE->m_PreferredDifficulty[p] == Difficulty_Edit) - continue; // skip - - vDifficultiesToRequire.emplace_back( - GAMESTATE->m_PreferredDifficulty[p]); + + if (GAMESTATE->m_PreferredDifficulty == Difficulty_Invalid) { + // skip + } + + // TRICKY: Don't require that edits be present if perferred + // difficulty is Difficulty_Edit. Otherwise, players could use this + // to set up a 100% chance of getting a particular locked song by + // having a single edit for a locked song. + else if (GAMESTATE->m_PreferredDifficulty == Difficulty_Edit) { + // skip + } + else { + + vDifficultiesToRequire.emplace_back(GAMESTATE->m_PreferredDifficulty); } RString sPreferredGroup = m_sExpandedSectionName; @@ -1574,8 +1573,6 @@ MusicWheel::GetPreferredSelectionForRandomOrPortal() wid[iSelection]->m_sText != sPreferredGroup) continue; - - FOREACH(Difficulty, vDifficultiesToRequire, d) { if (!pSong->HasStepsTypeAndDifficulty(st, *d)) { diff --git a/src/MusicWheelItem.cpp b/src/MusicWheelItem.cpp index d2bfac6382..87f24a338c 100644 --- a/src/MusicWheelItem.cpp +++ b/src/MusicWheelItem.cpp @@ -89,11 +89,11 @@ MusicWheelItem::MusicWheelItem(RString sType) m_pTextSectionCount->PlayCommand("On"); this->AddChild(m_pTextSectionCount); - m_pGradeDisplay[PLAYER_1].Load(THEME->GetPathG(sType, "grades")); - m_pGradeDisplay[PLAYER_1]->SetName( + m_pGradeDisplay.Load(THEME->GetPathG(sType, "grades")); + m_pGradeDisplay->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->AddChild(m_pGradeDisplay); + LOAD_ALL_COMMANDS_AND_SET_XY(m_pGradeDisplay); this->SubscribeToMessage(Message_CurrentStepsP1Changed); this->SubscribeToMessage(Message_CurrentStepsP2Changed); @@ -135,8 +135,8 @@ MusicWheelItem::MusicWheelItem(const MusicWheelItem& cpy) m_pTextSectionCount = new BitmapText(*cpy.m_pTextSectionCount); this->AddChild(m_pTextSectionCount); - m_pGradeDisplay[PLAYER_1] = cpy.m_pGradeDisplay[PLAYER_1]; - this->AddChild(m_pGradeDisplay[PLAYER_1]); + m_pGradeDisplay = cpy.m_pGradeDisplay; + this->AddChild(m_pGradeDisplay); } @@ -168,7 +168,7 @@ MusicWheelItem::LoadFromWheelItemData(const WheelItemBaseData* pData, if (m_pText[i]) m_pText[i]->SetVisible(false); m_pTextSectionCount->SetVisible(false); - m_pGradeDisplay[PLAYER_1]->SetVisible(false); + m_pGradeDisplay->SetVisible(false); // Fill these in below RString sDisplayName, sTranslitName; @@ -268,16 +268,16 @@ MusicWheelItem::RefreshGrades() return; // LoadFromWheelItemData() hasn't been called yet. FOREACH_HumanPlayer(p) { - m_pGradeDisplay[p]->SetVisible(false); + m_pGradeDisplay->SetVisible(false); if (pWID->m_pSong == NULL) continue; Difficulty dc; - if (GAMESTATE->m_pCurSteps[p]) - dc = GAMESTATE->m_pCurSteps[p]->GetDifficulty(); + if (GAMESTATE->m_pCurSteps) + dc = GAMESTATE->m_pCurSteps->GetDifficulty(); else - dc = GAMESTATE->m_PreferredDifficulty[p]; + dc = GAMESTATE->m_PreferredDifficulty; ProfileSlot ps; if (PROFILEMAN->IsPersistentProfile(p)) @@ -286,12 +286,12 @@ MusicWheelItem::RefreshGrades() continue; StepsType st; - if (GAMESTATE->m_pCurSteps[p]) - st = GAMESTATE->m_pCurSteps[p]->m_StepsType; + if (GAMESTATE->m_pCurSteps) + st = GAMESTATE->m_pCurSteps->m_StepsType; else st = GAMESTATE->GetCurrentStyle(PLAYER_INVALID)->m_StepsType; - m_pGradeDisplay[p]->SetVisible(true); + m_pGradeDisplay->SetVisible(true); HighScoreList* BestpHSL = NULL; Grade gradeBest = Grade_Invalid; @@ -346,7 +346,7 @@ MusicWheelItem::RefreshGrades() msg.SetParam("Difficulty", DifficultyToString(dcBest)); msg.SetParam("NumTimesPlayed", 0); } - m_pGradeDisplay[p]->HandleMessage(msg); + m_pGradeDisplay->HandleMessage(msg); } } diff --git a/src/MusicWheelItem.h b/src/MusicWheelItem.h index 98dbf986fc..67bd489a4d 100644 --- a/src/MusicWheelItem.h +++ b/src/MusicWheelItem.h @@ -53,7 +53,7 @@ class MusicWheelItem : public WheelItemBase TextBanner m_TextBanner; // used by Type_Song instead of m_pText BitmapText* m_pText[NUM_MusicWheelItemType]; BitmapText* m_pTextSectionCount; - AutoActor m_pGradeDisplay[NUM_PLAYERS]; + AutoActor m_pGradeDisplay; }; struct MusicWheelItemData : public WheelItemBaseData diff --git a/src/NetworkSyncManager.cpp b/src/NetworkSyncManager.cpp index a91a4193d6..bade9a2a7b 100644 --- a/src/NetworkSyncManager.cpp +++ b/src/NetworkSyncManager.cpp @@ -1239,8 +1239,8 @@ ETTProtocol::ReportHighScore(HighScore* hs, PlayerStageStats& pss) payload["ng"] = hs->GetHoldNoteScore(HNS_Missed); payload["chartkey"] = hs->GetChartKey(); payload["rate"] = hs->GetMusicRate(); - if (GAMESTATE->m_pPlayerState[PLAYER_1] != nullptr) - payload["options"] = GAMESTATE->m_pPlayerState[PLAYER_1] + if (GAMESTATE->m_pPlayerState != nullptr) + payload["options"] = GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .GetString(); auto chart = SONGMAN->GetStepsByChartkey(hs->GetChartKey()); @@ -1386,8 +1386,8 @@ ETTProtocol::SelectUserSong(NetworkSyncManager* n, Song* song) return; if (song == n->song) { if (GAMESTATE->m_pCurSong == nullptr || - GAMESTATE->m_pCurSteps[PLAYER_1] == nullptr || - GAMESTATE->m_pPlayerState[PLAYER_1] == nullptr) + GAMESTATE->m_pCurSteps == nullptr || + GAMESTATE->m_pPlayerState == nullptr) return; json startChart; startChart["type"] = ettClientMessageMap[ettpc_startchart]; @@ -1397,10 +1397,10 @@ ETTProtocol::SelectUserSong(NetworkSyncManager* n, Song* song) payload["artist"] = GAMESTATE->m_pCurSong->m_sArtist; payload["filehash"] = GAMESTATE->m_pCurSong->GetFileHash(); payload["difficulty"] = - DifficultyToString(GAMESTATE->m_pCurSteps[PLAYER_1]->GetDifficulty()); - payload["meter"] = GAMESTATE->m_pCurSteps[PLAYER_1]->GetMeter(); - payload["chartkey"] = GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey(); - payload["options"] = GAMESTATE->m_pPlayerState[PLAYER_1] + DifficultyToString(GAMESTATE->m_pCurSteps->GetDifficulty()); + payload["meter"] = GAMESTATE->m_pCurSteps->GetMeter(); + payload["chartkey"] = GAMESTATE->m_pCurSteps->GetChartKey(); + payload["options"] = GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .GetString(); payload["rate"] = static_cast( @@ -1408,7 +1408,7 @@ ETTProtocol::SelectUserSong(NetworkSyncManager* n, Song* song) startChart["id"] = msgId++; Send(startChart); } else { - if (GAMESTATE->m_pCurSteps[PLAYER_1] == nullptr) + if (GAMESTATE->m_pCurSteps == nullptr) return; json selectChart; selectChart["type"] = ettClientMessageMap[ettpc_selectchart]; @@ -1418,11 +1418,11 @@ ETTProtocol::SelectUserSong(NetworkSyncManager* n, Song* song) payload["artist"] = n->m_sArtist.c_str(); payload["filehash"] = song->GetFileHash().c_str(); payload["chartkey"] = - GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey().c_str(); + GAMESTATE->m_pCurSteps->GetChartKey().c_str(); payload["difficulty"] = - DifficultyToString(GAMESTATE->m_pCurSteps[PLAYER_1]->GetDifficulty()); - payload["meter"] = GAMESTATE->m_pCurSteps[PLAYER_1]->GetMeter(); - payload["options"] = GAMESTATE->m_pPlayerState[PLAYER_1] + DifficultyToString(GAMESTATE->m_pCurSteps->GetDifficulty()); + payload["meter"] = GAMESTATE->m_pCurSteps->GetMeter(); + payload["options"] = GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .GetString(); payload["rate"] = static_cast( diff --git a/src/NoteField.cpp b/src/NoteField.cpp index b0e229cabd..623dc7d44a 100644 --- a/src/NoteField.cpp +++ b/src/NoteField.cpp @@ -181,7 +181,7 @@ NoteField::CacheAllUsedNoteSkins() FOREACH_EnabledPlayer(pn) { - RString sNoteSkinLower = GAMESTATE->m_pPlayerState[pn] + RString sNoteSkinLower = GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .m_sNoteSkin; NOTESKIN->ValidateNoteSkinName(sNoteSkinLower); @@ -282,14 +282,14 @@ NoteField::ensure_note_displays_have_skin() memset(m_pDisplays, 0, sizeof(m_pDisplays)); FOREACH_EnabledPlayer(pn) { - sNoteSkinLower = GAMESTATE->m_pPlayerState[pn] + sNoteSkinLower = GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .m_sNoteSkin; // XXX: Re-setup sNoteSkinLower. Unsure if inserting the skin again is // needed. if (sNoteSkinLower.empty()) { - sNoteSkinLower = GAMESTATE->m_pPlayerState[pn] + sNoteSkinLower = GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .m_sNoteSkin; diff --git a/src/OptionRow.cpp b/src/OptionRow.cpp index f3b2039d0a..b5605c309f 100644 --- a/src/OptionRow.cpp +++ b/src/OptionRow.cpp @@ -43,7 +43,7 @@ OptionRow::OptionRow(const OptionRowType* pSource) m_pHand = NULL; m_textTitle = NULL; - ZERO(m_ModIcons); + m_ModIcons = false; Clear(); this->AddChild(&m_Frame); @@ -61,11 +61,11 @@ OptionRow::Clear() { ActorFrame::RemoveAllChildren(); - m_vbSelected[PLAYER_1].clear(); + m_vbSelected.clear(); m_Frame.DeleteAllChildren(); m_textItems.clear(); - m_Underline[PLAYER_1].clear(); + m_Underline.clear(); if (m_pHand != NULL) { FOREACH_CONST(RString, m_pHand->m_vsReloadRowMessages, m) @@ -74,8 +74,8 @@ OptionRow::Clear() SAFE_DELETE(m_pHand); m_bFirstItemGoesDown = false; - ZERO(m_bRowHasFocus); - ZERO(m_iChoiceInRowWithFocus); + m_bRowHasFocus = false; + m_iChoiceInRowWithFocus = false; } void @@ -104,7 +104,7 @@ OptionRowType::Load(const RString& sMetricsGroup, Actor* pParent) ActorUtil::LoadAllCommands(m_textItem, sMetricsGroup); if (SHOW_UNDERLINES) { - m_Underline[PLAYER_1].Load( + m_Underline.Load( "OptionsUnderline" + PlayerNumberToString(PLAYER_1), false); } @@ -164,10 +164,10 @@ 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()); - m_vbSelected[PLAYER_1].erase(m_vbSelected[PLAYER_1].begin()); + m_vbSelected.erase(m_vbSelected.begin()); } - vector& vbSelected = m_vbSelected[PLAYER_1]; + vector& vbSelected = m_vbSelected; vbSelected.resize(0); vbSelected.resize(m_pHand->m_Def.m_vsChoices.size(), false); @@ -179,7 +179,7 @@ OptionRow::ChoicesChanged(RowType type, bool reset_focus) if (m_bFirstItemGoesDown) { m_pHand->m_Def.m_vsChoices.insert(m_pHand->m_Def.m_vsChoices.begin(), NEXT_ROW_NAME); - m_vbSelected[PLAYER_1].insert(m_vbSelected[PLAYER_1].begin(), false); + m_vbSelected.insert(m_vbSelected.begin(), false); } InitText(type); @@ -234,7 +234,7 @@ OptionRow::InitText(RowType type) * options. Delete the old ones. */ m_Frame.DeleteAllChildren(); m_textItems.clear(); - m_Underline[PLAYER_1].clear(); + m_Underline.clear(); m_textTitle = new BitmapText(m_pParentType->m_textTitle); m_Frame.AddChild(m_textTitle); @@ -247,11 +247,11 @@ OptionRow::InitText(RowType type) switch (m_RowType) { case RowType_Normal: { - 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_ModIcons = new ModIcon(m_pParentType->m_ModIcon); + m_ModIcons->SetDrawOrder(-1); // under title + m_ModIcons->PlayCommand("On"); - m_Frame.AddChild(m_ModIcons[PLAYER_1]); + m_Frame.AddChild(m_ModIcons); GameCommand gc; SetModIcon(PLAYER_1, "", gc); @@ -315,8 +315,8 @@ OptionRow::InitText(RowType type) 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); + new OptionsCursor(m_pParentType->m_Underline); + m_Underline.push_back(pCursor); int iWidth, iX, iY; GetWidthXY(PLAYER_1, 0, iWidth, iX, iY); @@ -346,8 +346,8 @@ OptionRow::InitText(RowType type) // init underlines if (m_pParentType->SHOW_UNDERLINES) { OptionsCursor* ul = - new OptionsCursor(m_pParentType->m_Underline[PLAYER_1]); - m_Underline[PLAYER_1].push_back(ul); + new OptionsCursor(m_pParentType->m_Underline); + m_Underline.push_back(ul); ul->SetX(fX); ul->SetBarWidth(static_cast(fItemWidth)); } @@ -363,8 +363,8 @@ OptionRow::InitText(RowType type) for (unsigned c = 0; c < m_textItems.size(); c++) m_Frame.AddChild(m_textItems[c]); - for (unsigned c = 0; c < m_Underline[PLAYER_1].size(); c++) - m_Frame.AddChild(m_Underline[PLAYER_1][c]); + for (unsigned c = 0; c < m_Underline.size(); c++) + m_Frame.AddChild(m_Underline[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. @@ -390,8 +390,8 @@ OptionRow::AfterImportOptions(PlayerNumber pn) // Hide underlines for disabled players. if (!GAMESTATE->IsHumanPlayer(pn)) - for (unsigned c = 0; c < m_Underline[pn].size(); c++) - m_Underline[pn][c]->SetVisible(false); + for (unsigned c = 0; c < m_Underline.size(); c++) + m_Underline[c]->SetVisible(false); // Make all selections the same if bOneChoiceForAllPlayers. // Hack: we only import active players, so if only player 2 is imported, @@ -400,7 +400,7 @@ OptionRow::AfterImportOptions(PlayerNumber pn) PlayerNumber pnCopyFrom = GAMESTATE->GetMasterPlayerNumber(); if (GAMESTATE->GetMasterPlayerNumber() == PLAYER_INVALID) pnCopyFrom = PLAYER_1; - m_vbSelected[PLAYER_1] = m_vbSelected[pnCopyFrom]; + m_vbSelected = m_vbSelected; // haha this doesnt do anything -poco } switch (m_pHand->m_Def.m_selectType) { @@ -408,8 +408,8 @@ OptionRow::AfterImportOptions(PlayerNumber pn) // Make sure the row actually has a selection. int iSelection = GetOneSelection(pn, true); if (iSelection == -1) { - ASSERT(!m_vbSelected[pn].empty()); - m_vbSelected[pn][0] = true; + ASSERT(!m_vbSelected.empty()); + m_vbSelected[0] = true; } } default: @@ -424,7 +424,7 @@ OptionRow::AfterImportOptions(PlayerNumber pn) void OptionRow::PositionUnderlines(PlayerNumber pn) { - vector& vpUnderlines = m_Underline[pn]; + vector& vpUnderlines = m_Underline; if (vpUnderlines.empty()) return; @@ -445,7 +445,7 @@ OptionRow::PositionUnderlines(PlayerNumber pn) m_pHand->m_Def.m_vEnabledForPlayers.end(); if (!m_pHand->m_Def.m_bOneChoiceForAllPlayers) { - if (m_bRowHasFocus[pn]) + if (m_bRowHasFocus) fAlpha = m_pParentType->COLOR_SELECTED.GetValue().a; else if (bRowEnabled) fAlpha = m_pParentType->COLOR_NOT_SELECTED.GetValue().a; @@ -463,12 +463,12 @@ OptionRow::PositionUnderlines(PlayerNumber pn) // only set alpha, in case a theme tries to color underlines. -aj ul.SetDiffuseAlpha(fAlpha); - ASSERT(m_vbSelected[pnTakeSelectedFrom].size() == + ASSERT(m_vbSelected.size() == m_pHand->m_Def.m_vsChoices.size()); bool bSelected = (iChoiceWithFocus == -1) ? false - : m_vbSelected[pnTakeSelectedFrom][iChoiceWithFocus]; + : m_vbSelected[iChoiceWithFocus]; bool bVisible = bSelected && GAMESTATE->IsHumanPlayer(pn); ul.BeginTweening(m_pParentType->TWEEN_SECONDS); @@ -480,7 +480,7 @@ OptionRow::PositionUnderlines(PlayerNumber pn) void OptionRow::PositionIcons(PlayerNumber pn) { - ModIcon* pIcon = m_ModIcons[pn]; + ModIcon* pIcon = m_ModIcons; if (pIcon == NULL) return; @@ -494,7 +494,7 @@ OptionRow::UpdateText(PlayerNumber p) switch (m_pHand->m_Def.m_layoutType) { case LAYOUT_SHOW_ONE_IN_ROW: { unsigned pn = m_pHand->m_Def.m_bOneChoiceForAllPlayers ? 0 : p; - int iChoiceWithFocus = m_iChoiceInRowWithFocus[pn]; + int iChoiceWithFocus = m_iChoiceInRowWithFocus; if (iChoiceWithFocus == -1) break; @@ -515,7 +515,7 @@ OptionRow::UpdateText(PlayerNumber p) void OptionRow::SetRowHasFocus(PlayerNumber pn, bool bRowHasFocus) { - m_bRowHasFocus[pn] = bRowHasFocus; + m_bRowHasFocus = bRowHasFocus; } void @@ -533,12 +533,10 @@ void OptionRow::UpdateEnabledDisabled() { bool bThisRowHasFocusByAny = false; - FOREACH_HumanPlayer(p) bThisRowHasFocusByAny |= - static_cast(m_bRowHasFocus[p]); + bThisRowHasFocusByAny |= static_cast(m_bRowHasFocus); bool bThisRowHasFocusByAll = true; - FOREACH_HumanPlayer(p) bThisRowHasFocusByAll &= - static_cast(m_bRowHasFocus[p]); + bThisRowHasFocusByAll &= static_cast(m_bRowHasFocus); bool bRowEnabled = !m_pHand->m_Def.m_vEnabledForPlayers.empty(); @@ -564,13 +562,10 @@ OptionRow::UpdateEnabledDisabled() for (unsigned j = 0; j < m_textItems.size(); j++) { bool bThisItemHasFocusByAny = false; - FOREACH_HumanPlayer(p) - { - if (m_bRowHasFocus[p]) { - if ((int)j == GetChoiceInRowWithFocus(p)) { - bThisItemHasFocusByAny = true; - break; - } + if (m_bRowHasFocus) { + if ((int)j == GetChoiceInRowWithFocus(PLAYER_1)) { + bThisItemHasFocusByAny = true; + break; } } @@ -599,7 +594,7 @@ OptionRow::UpdateEnabledDisabled() m_pHand->m_Def.m_vEnabledForPlayers.end(); if (!m_pHand->m_Def.m_bOneChoiceForAllPlayers) { - if (m_bRowHasFocus[pn]) + if (m_bRowHasFocus) color = m_pParentType->COLOR_SELECTED; else if (bRowEnabled) color = m_pParentType->COLOR_NOT_SELECTED; @@ -636,8 +631,8 @@ OptionRow::SetModIcon(PlayerNumber pn, const RString& sText, GameCommand& gc) msg.SetParam("GameCommand", &gc); msg.SetParam("Text", sText); m_sprFrame->HandleMessage(msg); - if (m_ModIcons[pn] != NULL) - m_ModIcons[pn]->Set(sText); + if (m_ModIcons != NULL) + m_ModIcons->Set(sText); } const BitmapText& @@ -682,8 +677,8 @@ OptionRow::GetWidthXY(PlayerNumber pn, int OptionRow::GetOneSelection(PlayerNumber pn, bool bAllowFail) const { - for (unsigned i = 0; i < m_vbSelected[pn].size(); i++) - if (m_vbSelected[pn][i]) + for (unsigned i = 0; i < m_vbSelected.size(); i++) + if (m_vbSelected[i]) return i; ASSERT( @@ -700,7 +695,7 @@ OptionRow::GetOneSharedSelection(bool bAllowFail) const void OptionRow::SetOneSelection(PlayerNumber pn, int iChoice) { - vector& vb = m_vbSelected[pn]; + vector& vb = m_vbSelected; if (vb.empty()) return; FOREACH(bool, vb, b) @@ -733,7 +728,7 @@ OptionRow::GetChoiceInRowWithFocus(PlayerNumber pn) const pn = PLAYER_1; if (m_pHand->m_Def.m_vsChoices.empty()) return -1; - int iChoice = m_iChoiceInRowWithFocus[pn]; + int iChoice = m_iChoiceInRowWithFocus; return iChoice; } @@ -749,7 +744,7 @@ OptionRow::SetChoiceInRowWithFocus(PlayerNumber pn, int iChoice) if (m_pHand->m_Def.m_bOneChoiceForAllPlayers) pn = PLAYER_1; ASSERT(iChoice >= 0 && iChoice < (int)m_pHand->m_Def.m_vsChoices.size()); - m_iChoiceInRowWithFocus[pn] = iChoice; + m_iChoiceInRowWithFocus = iChoice; UpdateText(pn); // PositionUnderlines( pn ); @@ -780,7 +775,7 @@ OptionRow::GetSelected(PlayerNumber pn, int iChoice) const { if (m_pHand->m_Def.m_bOneChoiceForAllPlayers) pn = PLAYER_1; - return m_vbSelected[pn][iChoice]; + return m_vbSelected[iChoice]; } const OptionRowDefinition& @@ -800,7 +795,7 @@ OptionRow::SetSelected(PlayerNumber pn, int iChoice, bool b) { if (m_pHand->m_Def.m_bOneChoiceForAllPlayers) pn = PLAYER_1; - m_vbSelected[pn][iChoice] = b; + m_vbSelected[iChoice] = b; return NotifyHandlerOfSelection(pn, iChoice); } @@ -840,7 +835,7 @@ OptionRow::Reload() /* if( m_pHand->m_Def.m_bExportOnChange ) { - bool bRowHasFocus[NUM_PLAYERS]; + bool bRowHasFocus; ZERO( bRowHasFocus ); ExportOptions( vpns, bRowHasFocus ); } @@ -870,7 +865,7 @@ OptionRow::Reload() /* if( m_pHand->m_Def.m_bExportOnChange ) { - bool bRowHasFocus[NUM_PLAYERS]; + bool bRowHasFocus; ZERO( bRowHasFocus ); ExportOptions( vpns, bRowHasFocus ); } @@ -910,11 +905,11 @@ OptionRow::ImportOptions(const vector& vpns) { PlayerNumber p = *iter; - FOREACH(bool, m_vbSelected[p], b) + FOREACH(bool, m_vbSelected, b) *b = false; - ASSERT(m_vbSelected[p].size() == m_pHand->m_Def.m_vsChoices.size()); - ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED(m_vbSelected[p]); + ASSERT(m_vbSelected.size() == m_pHand->m_Def.m_vsChoices.size()); + ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED(m_vbSelected); } m_pHand->ImportOption(this, vpns, m_vbSelected); @@ -923,15 +918,15 @@ OptionRow::ImportOptions(const vector& vpns) { PlayerNumber p = *iter; - INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED(m_vbSelected[p]); + INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED(m_vbSelected); VerifySelected( - m_pHand->m_Def.m_selectType, m_vbSelected[p], m_pHand->m_Def.m_sName); + m_pHand->m_Def.m_selectType, m_vbSelected, m_pHand->m_Def.m_sName); } } int OptionRow::ExportOptions(const vector& vpns, - bool bRowHasFocus[NUM_PLAYERS]) + bool bRowHasFocus) { ASSERT(m_pHand->m_Def.m_vsChoices.size() > 0); @@ -940,18 +935,18 @@ OptionRow::ExportOptions(const vector& vpns, FOREACH_CONST(PlayerNumber, vpns, iter) { PlayerNumber p = *iter; - bool bFocus = bRowHasFocus[p]; + bool bFocus = bRowHasFocus; VerifySelected( - m_pHand->m_Def.m_selectType, m_vbSelected[p], m_pHand->m_Def.m_sName); - ASSERT(m_vbSelected[p].size() == m_pHand->m_Def.m_vsChoices.size()); - ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED(m_vbSelected[p]); + m_pHand->m_Def.m_selectType, m_vbSelected, m_pHand->m_Def.m_sName); + ASSERT(m_vbSelected.size() == m_pHand->m_Def.m_vsChoices.size()); + ERASE_ONE_BOOL_AT_FRONT_IF_NEEDED(m_vbSelected); // SELECT_NONE rows get exported if they have focus when the user // presses Start. int iChoice = GetChoiceInRowWithFocus(p); if (m_pHand->m_Def.m_selectType == SELECT_NONE && bFocus) - m_vbSelected[p][iChoice] = true; + m_vbSelected[iChoice] = true; } iChangeMask |= m_pHand->ExportOption(vpns, m_vbSelected); @@ -959,13 +954,13 @@ OptionRow::ExportOptions(const vector& vpns, FOREACH_CONST(PlayerNumber, vpns, iter) { PlayerNumber p = *iter; - bool bFocus = bRowHasFocus[p]; + bool bFocus = bRowHasFocus; int iChoice = GetChoiceInRowWithFocus(p); if (m_pHand->m_Def.m_selectType == SELECT_NONE && bFocus) - m_vbSelected[p][iChoice] = false; + m_vbSelected[iChoice] = false; - INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED(m_vbSelected[p]); + INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED(m_vbSelected); } return iChangeMask; diff --git a/src/OptionRow.h b/src/OptionRow.h index 838a52c388..c3ebe2d94e 100644 --- a/src/OptionRow.h +++ b/src/OptionRow.h @@ -1,4 +1,4 @@ -/* OptionRow - One line in ScreenOptions. */ +/* OptionRow - One line in ScreenOptions. */ #ifndef OptionRow_H #define OptionRow_H @@ -28,7 +28,7 @@ class OptionRowType RString m_sMetricsGroup; BitmapText m_textItem; - OptionsCursor m_Underline[NUM_PLAYERS]; + OptionsCursor m_Underline; AutoActor m_sprFrame; BitmapText m_textTitle; ModIcon m_ModIcon; @@ -66,7 +66,7 @@ class OptionRow : public ActorFrame void ImportOptions(const vector& vpns); int ExportOptions(const vector& vpns, - bool bRowHasFocus[NUM_PLAYERS]); + bool bRowHasFocus); enum RowType { @@ -83,7 +83,7 @@ class OptionRow : public ActorFrame void PositionUnderlines(PlayerNumber pn); void PositionIcons(PlayerNumber pn); void UpdateText(PlayerNumber pn); - bool GetRowHasFocus(PlayerNumber pn) const { return m_bRowHasFocus[pn]; } + bool GetRowHasFocus(PlayerNumber pn) const { return m_bRowHasFocus; } void SetRowHasFocus(PlayerNumber pn, bool bRowHasFocus); void UpdateEnabledDisabled(); @@ -144,21 +144,21 @@ class OptionRow : public ActorFrame vector m_textItems; // size depends on m_bRowIsLong and which players are joined - vector m_Underline[NUM_PLAYERS]; // size depends on + vector m_Underline; // size depends on // m_bRowIsLong and which // players are joined Actor* m_sprFrame; BitmapText* m_textTitle; - ModIcon* m_ModIcons[NUM_PLAYERS]; + ModIcon* m_ModIcons; bool m_bFirstItemGoesDown; - bool m_bRowHasFocus[NUM_PLAYERS]; + bool m_bRowHasFocus; - int m_iChoiceInRowWithFocus[NUM_PLAYERS]; // this choice has input focus + int m_iChoiceInRowWithFocus; // this choice has input focus // Only one will true at a time if m_pHand->m_Def.bMultiSelect vector - m_vbSelected[NUM_PLAYERS]; // size = m_pHand->m_Def.choices.size() + m_vbSelected; // size = m_pHand->m_Def.choices.size() Actor::TweenState m_tsDestination; // this should approach m_tsDestination. public: diff --git a/src/OptionRowHandler.cpp b/src/OptionRowHandler.cpp index e8f9c1a9a9..d5232e9fcd 100644 --- a/src/OptionRowHandler.cpp +++ b/src/OptionRowHandler.cpp @@ -1,4 +1,4 @@ -#include "global.h" +#include "global.h" #include "Character.h" #include "CharacterManager.h" #include "CommonMetrics.h" @@ -264,12 +264,12 @@ class OptionRowHandlerList : public OptionRowHandler } void ImportOption(OptionRow* pRow, const vector& vpns, - vector vbSelectedOut[NUM_PLAYERS]) const override + vector vbSelectedOut) const override { FOREACH_CONST(PlayerNumber, vpns, pn) { PlayerNumber p = *pn; - vector& vbSelOut = vbSelectedOut[p]; + vector& vbSelOut = vbSelectedOut; bool bUseFallbackOption = true; @@ -326,12 +326,12 @@ class OptionRowHandlerList : public OptionRowHandler } int ExportOption(const vector& vpns, - const vector vbSelected[NUM_PLAYERS]) const override + const vector vbSelected) const override { FOREACH_CONST(PlayerNumber, vpns, pn) { PlayerNumber p = *pn; - const vector& vbSel = vbSelected[p]; + const vector& vbSel = vbSelected; m_Default.Apply(p); for (unsigned i = 0; i < vbSel.size(); i++) { @@ -525,14 +525,14 @@ class OptionRowHandlerSteps : public OptionRowHandler CHECK_BLANK_ARG; if (sParam == "EditSteps") { - m_ppStepsToFill = &GAMESTATE->m_pCurSteps[0]; - m_pDifficultyToFill = &GAMESTATE->m_PreferredDifficulty[0]; + m_ppStepsToFill = &GAMESTATE->m_pCurSteps; + m_pDifficultyToFill = &GAMESTATE->m_PreferredDifficulty; m_vsReloadRowMessages.push_back( MessageIDToString(Message_EditStepsTypeChanged)); } else if (sParam == "EditSourceSteps") { m_vsReloadRowMessages.push_back( MessageIDToString(Message_EditSourceStepsTypeChanged)); - if (GAMESTATE->m_pCurSteps[0].Get() != NULL) + if (GAMESTATE->m_pCurSteps.Get() != NULL) m_Def.m_vEnabledForPlayers.clear(); // hide row } else { ROW_INVALID_IF( @@ -595,12 +595,12 @@ class OptionRowHandlerSteps : public OptionRowHandler } void ImportOption(OptionRow* pRow, const vector& vpns, - vector vbSelectedOut[NUM_PLAYERS]) const override + vector vbSelectedOut) const override { FOREACH_CONST(PlayerNumber, vpns, pn) { PlayerNumber p = *pn; - vector& vbSelOut = vbSelectedOut[p]; + vector& vbSelOut = vbSelectedOut; ASSERT(m_vSteps.size() == vbSelOut.size()); @@ -618,7 +618,7 @@ class OptionRowHandlerSteps : public OptionRowHandler FOREACH_CONST(Difficulty, m_vDifficulties, d) { unsigned i = d - m_vDifficulties.begin(); - if (*d == GAMESTATE->m_PreferredDifficulty[p]) { + if (*d == GAMESTATE->m_PreferredDifficulty) { vbSelOut[i] = true; matched = true; vector v; @@ -635,12 +635,12 @@ class OptionRowHandlerSteps : public OptionRowHandler } } int ExportOption(const vector& vpns, - const vector vbSelected[NUM_PLAYERS]) const override + const vector vbSelected) const override { FOREACH_CONST(PlayerNumber, vpns, pn) { PlayerNumber p = *pn; - const vector& vbSel = vbSelected[p]; + const vector& vbSel = vbSelected; int index = OptionRowHandlerUtil::GetOneSelection(vbSel); Difficulty dc = m_vDifficulties[index]; @@ -1097,7 +1097,7 @@ class OptionRowHandlerLua : public OptionRowHandler void ImportOption(OptionRow* pRow, const vector& vpns, - vector vbSelectedOut[NUM_PLAYERS]) const override + vector vbSelectedOut) const override { if (!m_TableIsSane) { return; @@ -1109,7 +1109,7 @@ class OptionRowHandlerLua : public OptionRowHandler FOREACH_CONST(PlayerNumber, vpns, pn) { PlayerNumber p = *pn; - vector& vbSelOut = vbSelectedOut[p]; + vector& vbSelOut = vbSelectedOut; /* Evaluate the LoadSelections(self,array,pn) function, where * array is a table representing vbSelectedOut. */ @@ -1156,7 +1156,7 @@ class OptionRowHandlerLua : public OptionRowHandler LUA->Release(L); } int ExportOption(const vector& vpns, - const vector vbSelected[NUM_PLAYERS]) const override + const vector vbSelected) const override { if (!m_TableIsSane) { return 0; @@ -1168,7 +1168,7 @@ class OptionRowHandlerLua : public OptionRowHandler FOREACH_CONST(PlayerNumber, vpns, pn) { PlayerNumber p = *pn; - const vector& vbSel = vbSelected[p]; + const vector& vbSel = vbSelected; /* Evaluate SaveSelections(self,array,pn) function, where array is * a table representing vbSelectedOut. */ @@ -1293,26 +1293,26 @@ class OptionRowHandlerConfig : public OptionRowHandler } void ImportOption(OptionRow*, const vector& vpns, - vector vbSelectedOut[NUM_PLAYERS]) const override + vector vbSelectedOut) const override { FOREACH_CONST(PlayerNumber, vpns, pn) { PlayerNumber p = *pn; - vector& vbSelOut = vbSelectedOut[p]; + vector& vbSelOut = vbSelectedOut; int iSelection = m_pOpt->Get(); OptionRowHandlerUtil::SelectExactlyOne(iSelection, vbSelOut); } } int ExportOption(const vector& vpns, - const vector vbSelected[NUM_PLAYERS]) const override + const vector vbSelected) const override { bool bChanged = false; FOREACH_CONST(PlayerNumber, vpns, pn) { PlayerNumber p = *pn; - const vector& vbSel = vbSelected[p]; + const vector& vbSel = vbSelected; int iSel = OptionRowHandlerUtil::GetOneSelection(vbSel); @@ -1361,7 +1361,7 @@ class OptionRowHandlerStepsType : public OptionRowHandler MessageIDToString(Message_CurrentStepsP1Changed)); m_vsReloadRowMessages.push_back( MessageIDToString(Message_EditStepsTypeChanged)); - if (GAMESTATE->m_pCurSteps[0].Get() != NULL) + if (GAMESTATE->m_pCurSteps.Get() != NULL) m_Def.m_vEnabledForPlayers.clear(); // hide row } else { ROW_INVALID_IF( @@ -1391,15 +1391,15 @@ class OptionRowHandlerStepsType : public OptionRowHandler void ImportOption(OptionRow* pRow, const vector& vpns, - vector vbSelectedOut[NUM_PLAYERS]) const override + vector vbSelectedOut) const override { FOREACH_CONST(PlayerNumber, vpns, pn) { PlayerNumber p = *pn; - vector& vbSelOut = vbSelectedOut[p]; + vector& vbSelOut = vbSelectedOut; - if (GAMESTATE->m_pCurSteps[0]) { - StepsType st = GAMESTATE->m_pCurSteps[0]->m_StepsType; + if (GAMESTATE->m_pCurSteps) { + StepsType st = GAMESTATE->m_pCurSteps->m_StepsType; vector::const_iterator iter = find( m_vStepsTypesToShow.begin(), m_vStepsTypesToShow.end(), st); if (iter != m_vStepsTypesToShow.end()) { @@ -1412,12 +1412,12 @@ class OptionRowHandlerStepsType : public OptionRowHandler } } int ExportOption(const vector& vpns, - const vector vbSelected[NUM_PLAYERS]) const override + const vector vbSelected) const override { FOREACH_CONST(PlayerNumber, vpns, pn) { PlayerNumber p = *pn; - const vector& vbSel = vbSelected[p]; + const vector& vbSel = vbSelected; int index = OptionRowHandlerUtil::GetOneSelection(vbSel); m_pstToFill->Set(m_vStepsTypesToShow[index]); @@ -1458,13 +1458,13 @@ class OptionRowHandlerGameCommand : public OptionRowHandler } void ImportOption(OptionRow* pRow, const vector& vpns, - vector vbSelectedOut[NUM_PLAYERS]) const override + vector vbSelectedOut) const override { } int ExportOption(const vector& vpns, - const vector vbSelected[NUM_PLAYERS]) const override + const vector vbSelected) const override { - if( vbSelected[PLAYER_1][0] ) + if( vbSelected[0] ) m_gc.ApplyToAllPlayers(); return 0; } diff --git a/src/OptionRowHandler.h b/src/OptionRowHandler.h index 538bfe77c1..6bd64069a9 100644 --- a/src/OptionRowHandler.h +++ b/src/OptionRowHandler.h @@ -217,12 +217,12 @@ class OptionRowHandler virtual int GetDefaultOption() const { return -1; } virtual void ImportOption(OptionRow*, const vector&, - vector vbSelectedOut[NUM_PLAYERS]) const + vector vbSelectedOut) const { } // Returns an OPT mask. virtual int ExportOption(const vector&, - const vector vbSelected[NUM_PLAYERS]) const + const vector vbSelected) const { return 0; } diff --git a/src/OptionsList.cpp b/src/OptionsList.cpp index 7d2ad48908..22a6bacb6d 100644 --- a/src/OptionsList.cpp +++ b/src/OptionsList.cpp @@ -1,4 +1,4 @@ -#include "global.h" +#include "global.h" #include "GameState.h" #include "InputEventPlus.h" #include "InputMapper.h" @@ -522,13 +522,13 @@ OptionsList::TweenOnCurrentRow(bool bForward) void OptionsList::ImportRow(const RString& sRow) { - vector aSelections[NUM_PLAYERS]; + vector aSelections; vector vpns; vpns.push_back(m_pn); OptionRowHandler* pHandler = m_Rows[sRow]; - aSelections[m_pn].resize(pHandler->m_Def.m_vsChoices.size()); + aSelections.resize(pHandler->m_Def.m_vsChoices.size()); pHandler->ImportOption(NULL, vpns, aSelections); - m_bSelections[sRow] = aSelections[m_pn]; + m_bSelections[sRow] = aSelections; if (m_setTopMenus.find(sRow) != m_setTopMenus.end()) fill(m_bSelections[sRow].begin(), m_bSelections[sRow].end(), false); @@ -540,8 +540,8 @@ OptionsList::ExportRow(const RString& sRow) if (m_setTopMenus.find(sRow) != m_setTopMenus.end()) return; - vector aSelections[NUM_PLAYERS]; - aSelections[m_pn] = m_bSelections[sRow]; + vector aSelections; + aSelections = m_bSelections[sRow]; vector vpns; vpns.push_back(m_pn); @@ -683,7 +683,7 @@ OptionsList::Start() pHandler->GetIconTextAndGameCommand( m_iMenuStackSelection, sIconText, gc); if (gc.m_sName == RESET_ROW) { - GAMESTATE->m_pPlayerState[m_pn]->ResetToDefaultPlayerOptions( + GAMESTATE->m_pPlayerState->ResetToDefaultPlayerOptions( ModsLevel_Preferred); GAMESTATE->ResetToDefaultSongOptions(ModsLevel_Preferred); diff --git a/src/Player.cpp b/src/Player.cpp index f5506389ad..d9513265ff 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -630,7 +630,7 @@ Player::Load() // m_pScore->Init( pn ); // Mina garbage - Mina - m_Timing = GAMESTATE->m_pCurSteps[pn]->GetTimingData(); + m_Timing = GAMESTATE->m_pCurSteps->GetTimingData(); m_Timing->NegStopAndBPMCheck(); int lastRow = m_NoteData.GetLastRow(); m_Timing->BuildAndGetEtar(lastRow); @@ -649,11 +649,11 @@ Player::Load() m_pPlayerStageStats->filehadnegbpms = true; // check before nomines transform - if (GAMESTATE->m_pCurSteps[pn]->GetRadarValues()[RadarCategory_Mines] > 0) + if (GAMESTATE->m_pCurSteps->GetRadarValues()[RadarCategory_Mines] > 0) m_pPlayerStageStats->filegotmines = true; - if (GAMESTATE->m_pCurSteps[pn]->GetRadarValues()[RadarCategory_Holds] > 0 || - GAMESTATE->m_pCurSteps[pn]->GetRadarValues()[RadarCategory_Rolls] > 0) + if (GAMESTATE->m_pCurSteps->GetRadarValues()[RadarCategory_Holds] > 0 || + GAMESTATE->m_pCurSteps->GetRadarValues()[RadarCategory_Rolls] > 0) m_pPlayerStageStats->filegotholds = true; // check for lua script load (technically this is redundant a little with @@ -662,7 +662,7 @@ Player::Load() m_pPlayerStageStats->luascriptwasloaded = true; const HighScore* pb = SCOREMAN->GetChartPBAt( - GAMESTATE->m_pCurSteps[pn]->GetChartKey(), + GAMESTATE->m_pCurSteps->GetChartKey(), GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate); if (pb != nullptr) wifescorepersonalbest = pb->GetWifeScore(); @@ -1997,7 +1997,7 @@ Player::Step(int col, float fSongBeat = m_pPlayerState->m_Position.m_fSongBeat; - if (GAMESTATE->m_pCurSteps[m_pPlayerState->m_PlayerNumber]) + if (GAMESTATE->m_pCurSteps) fSongBeat = m_Timing->GetBeatFromElapsedTime(fPositionSeconds); const int iSongRow = row == -1 ? BeatToNoteRow(fSongBeat) : row; @@ -2521,7 +2521,7 @@ Player::StepReplay(int col, float fSongBeat = m_pPlayerState->m_Position.m_fSongBeat; - if (GAMESTATE->m_pCurSteps[m_pPlayerState->m_PlayerNumber]) + if (GAMESTATE->m_pCurSteps) fSongBeat = m_Timing->GetBeatFromElapsedTime(fPositionSeconds); const int iSongRow = row == -1 ? BeatToNoteRow(fSongBeat) : row; diff --git a/src/PlayerStageStats.cpp b/src/PlayerStageStats.cpp index de2193f5cc..f4530a8b37 100644 --- a/src/PlayerStageStats.cpp +++ b/src/PlayerStageStats.cpp @@ -363,7 +363,7 @@ PlayerStageStats::GetMaxWifeScore() const vector PlayerStageStats::CalcSSR(float ssrpercent) const { - Steps* steps = GAMESTATE->m_pCurSteps[PLAYER_1]; + Steps* steps = GAMESTATE->m_pCurSteps; float musicrate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; return MinaSDCalc(serializednd, steps->GetNoteData().GetNumTracks(), diff --git a/src/PlayerState.cpp b/src/PlayerState.cpp index 132b709ac1..1bf90928d3 100644 --- a/src/PlayerState.cpp +++ b/src/PlayerState.cpp @@ -1,4 +1,4 @@ -#include "global.h" +#include "global.h" #include "GameState.h" #include "PlayerState.h" #include "RadarValues.h" @@ -64,7 +64,7 @@ PlayerState::GetDisplayedPosition() const const TimingData& PlayerState::GetDisplayedTiming() const { - Steps* steps = GAMESTATE->m_pCurSteps[m_PlayerNumber]; + Steps* steps = GAMESTATE->m_pCurSteps; if (steps == NULL) return GAMESTATE->m_pCurSong->m_SongTiming; return *steps->GetTimingData(); diff --git a/src/Profile.cpp b/src/Profile.cpp index a8776e3349..5d19075380 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -1783,8 +1783,8 @@ class LunaProfile : public Luna { bool o = false; - if (GAMESTATE->m_pCurSteps[PLAYER_1]) { - const string& ck = GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey(); + if (GAMESTATE->m_pCurSteps) { + const string& ck = GAMESTATE->m_pCurSteps->GetChartKey(); if (p->PermaMirrorCharts.count(ck)) o = true; diff --git a/src/ProfileManager.cpp b/src/ProfileManager.cpp index 49a68c8f00..eb454138c7 100644 --- a/src/ProfileManager.cpp +++ b/src/ProfileManager.cpp @@ -101,10 +101,10 @@ ProfileManager::~ProfileManager() void ProfileManager::Init(LoadingWindow* ld) { - m_bLastLoadWasTamperedOrCorrupt[PLAYER_1] = false; - m_bLastLoadWasFromLastGood[PLAYER_1] = false; - m_bNeedToBackUpLastLoad[PLAYER_1] = false; - m_bNewProfile[PLAYER_1] = false; + m_bLastLoadWasTamperedOrCorrupt = false; + m_bLastLoadWasFromLastGood = false; + m_bNeedToBackUpLastLoad = false; + m_bNewProfile = false; RefreshLocalProfilesFromDisk(ld); @@ -132,7 +132,7 @@ ProfileManager::Init(LoadingWindow* ld) } if (!g_vLocalProfile.empty()) - m_sProfileDir[PLAYER_1] = g_vLocalProfile[0].sDir; + m_sProfileDir = g_vLocalProfile[0].sDir; dummy = new Profile; } @@ -151,23 +151,23 @@ ProfileManager::LoadProfile(PlayerNumber pn, const RString& sProfileDir) ASSERT(!sProfileDir.empty()); ASSERT(sProfileDir.Right(1) == "/"); - m_sProfileDir[pn] = sProfileDir; - m_bLastLoadWasFromLastGood[pn] = false; - m_bNeedToBackUpLastLoad[pn] = false; + m_sProfileDir = sProfileDir; + m_bLastLoadWasFromLastGood = false; + m_bNeedToBackUpLastLoad = false; // Try to load the original, non-backup data. ProfileLoadResult lr = GetProfile(pn)->LoadAllFromDir( - m_sProfileDir[pn], PREFSMAN->m_bSignProfileData, NULL); + m_sProfileDir, PREFSMAN->m_bSignProfileData, NULL); - RString sBackupDir = m_sProfileDir[pn] + LAST_GOOD_SUBDIR; + RString sBackupDir = m_sProfileDir + LAST_GOOD_SUBDIR; if (lr == ProfileLoadResult_Success) { /* Next time the profile is written, move this good profile into * LastGood. */ - m_bNeedToBackUpLastLoad[pn] = true; + m_bNeedToBackUpLastLoad = true; } - m_bLastLoadWasTamperedOrCorrupt[pn] = + m_bLastLoadWasTamperedOrCorrupt = lr == ProfileLoadResult_FailedTampered; // @@ -176,7 +176,7 @@ ProfileManager::LoadProfile(PlayerNumber pn, const RString& sProfileDir) if (lr == ProfileLoadResult_FailedTampered) { lr = GetProfile(pn)->LoadAllFromDir( sBackupDir, PREFSMAN->m_bSignProfileData, NULL); - m_bLastLoadWasFromLastGood[pn] = lr == ProfileLoadResult_Success; + m_bLastLoadWasFromLastGood = lr == ProfileLoadResult_Success; /* If the LastGood profile doesn't exist at all, and the actual profile * was failed_tampered, then the error should be failed_tampered and not @@ -199,19 +199,19 @@ ProfileManager::LoadLocalProfileFromMachine(PlayerNumber pn) { RString sProfileID = m_sDefaultLocalProfileID[pn]; if (sProfileID.empty()) { - m_sProfileDir[pn] = ""; + m_sProfileDir = ""; return false; } - m_sProfileDir[pn] = LocalProfileIDToDir(sProfileID); - m_bLastLoadWasFromLastGood[pn] = false; + m_sProfileDir = LocalProfileIDToDir(sProfileID); + m_bLastLoadWasFromLastGood = false; if (GetLocalProfile(sProfileID) == NULL) { - m_sProfileDir[pn] = ""; + m_sProfileDir = ""; return false; } - GetProfile(pn)->LoadCustomFunction(m_sProfileDir[pn]); + GetProfile(pn)->LoadCustomFunction(m_sProfileDir); return true; } @@ -228,7 +228,7 @@ ProfileManager::LoadFirstAvailableProfile(PlayerNumber pn, bool bLoadEdits) bool ProfileManager::SaveProfile(PlayerNumber pn) const { - if (m_sProfileDir[pn].empty()) + if (m_sProfileDir.empty()) return false; /* @@ -238,13 +238,13 @@ ProfileManager::SaveProfile(PlayerNumber pn) const * if we save the profile more than once, we haven't re-validated the * newly written data.) */ - if (m_bNeedToBackUpLastLoad[pn]) { - m_bNeedToBackUpLastLoad[pn] = false; - RString sBackupDir = m_sProfileDir[pn] + LAST_GOOD_SUBDIR; - Profile::MoveBackupToDir(m_sProfileDir[pn], sBackupDir); + if (m_bNeedToBackUpLastLoad) { + m_bNeedToBackUpLastLoad = false; + RString sBackupDir = m_sProfileDir + LAST_GOOD_SUBDIR; + Profile::MoveBackupToDir(m_sProfileDir, sBackupDir); } - bool b = GetProfile(pn)->SaveAllToDir(m_sProfileDir[pn], + bool b = GetProfile(pn)->SaveAllToDir(m_sProfileDir, PREFSMAN->m_bSignProfileData); return b; @@ -263,16 +263,16 @@ ProfileManager::SaveLocalProfile(const RString& sProfileID) void ProfileManager::UnloadProfile(PlayerNumber pn) { - if (m_sProfileDir[pn].empty()) { + if (m_sProfileDir.empty()) { // Don't bother unloading a profile that wasn't loaded in the first // place. Saves us an expensive and pointless trip through all the // songs. return; } - m_sProfileDir[pn] = ""; - m_bLastLoadWasTamperedOrCorrupt[pn] = false; - m_bLastLoadWasFromLastGood[pn] = false; - m_bNeedToBackUpLastLoad[pn] = false; + m_sProfileDir = ""; + m_bLastLoadWasTamperedOrCorrupt = false; + m_bLastLoadWasFromLastGood = false; + m_bNeedToBackUpLastLoad = false; SONGMAN->FreeAllLoadedFromProfile(static_cast(pn)); } @@ -280,7 +280,7 @@ const Profile* ProfileManager::GetProfile(PlayerNumber pn) const { - RString sProfileID = LocalProfileDirToID(m_sProfileDir[PLAYER_1]); + RString sProfileID = LocalProfileDirToID(m_sProfileDir); return GetLocalProfile(sProfileID); } @@ -534,13 +534,13 @@ ProfileManager::DeleteLocalProfile(const RString& sProfileID) bool ProfileManager::LastLoadWasTamperedOrCorrupt(PlayerNumber pn) const { - return !m_sProfileDir[pn].empty() && m_bLastLoadWasTamperedOrCorrupt[pn]; + return !m_sProfileDir.empty() && m_bLastLoadWasTamperedOrCorrupt; } bool ProfileManager::LastLoadWasFromLastGood(PlayerNumber pn) const { - return !m_sProfileDir[pn].empty() && m_bLastLoadWasFromLastGood[pn]; + return !m_sProfileDir.empty() && m_bLastLoadWasFromLastGood; } const RString& @@ -549,7 +549,7 @@ ProfileManager::GetProfileDir(ProfileSlot slot) const switch (slot) { case ProfileSlot_Player1: case ProfileSlot_Player2: - return m_sProfileDir[slot]; + return m_sProfileDir; default: FAIL_M("Invalid profile slot chosen: unable to get the directory!"); } @@ -692,7 +692,7 @@ ProfileManager::AddStepsScore(const Song* pSong, else hs.SetName("EVNT"); } else { - hs.SetName(RANKING_TO_FILL_IN_MARKER[pn]); + hs.SetName(RANKING_TO_FILL_IN_MARKER); } // diff --git a/src/ProfileManager.h b/src/ProfileManager.h index 5385abe4a3..b958c951d3 100644 --- a/src/ProfileManager.h +++ b/src/ProfileManager.h @@ -74,7 +74,7 @@ class ProfileManager bool IsPersistentProfile(PlayerNumber pn) const { - return !m_sProfileDir[pn].empty(); + return !m_sProfileDir.empty(); } bool IsPersistentProfile(ProfileSlot slot) const; @@ -121,22 +121,21 @@ class ProfileManager // Directory that contains the profile. Either on local machine or // on a memory card. - RString m_sProfileDir[NUM_PLAYERS]; + RString m_sProfileDir; RString m_stats_prefix; Profile* dummy; - bool m_bLastLoadWasTamperedOrCorrupt[NUM_PLAYERS]; // true if Stats.xml was + bool m_bLastLoadWasTamperedOrCorrupt; // true if Stats.xml was // present, but failed to // load (probably because // of a signature // failure) - bool m_bLastLoadWasFromLastGood - [NUM_PLAYERS]; // if true, then + bool m_bLastLoadWasFromLastGood; // if true, then // m_bLastLoadWasTamperedOrCorrupt // is also true - mutable bool m_bNeedToBackUpLastLoad[NUM_PLAYERS]; // if true, back up + mutable bool m_bNeedToBackUpLastLoad; // if true, back up // profile on next save - bool m_bNewProfile[NUM_PLAYERS]; + bool m_bNewProfile; }; extern ProfileManager* diff --git a/src/ReceptorArrowRow.cpp b/src/ReceptorArrowRow.cpp index 7b589ba399..c95d2fb393 100644 --- a/src/ReceptorArrowRow.cpp +++ b/src/ReceptorArrowRow.cpp @@ -90,9 +90,9 @@ ReceptorArrowRow::Update(float fDeltaTime) const Style* style = GAMESTATE->GetCurrentStyle(m_pPlayerState->m_PlayerNumber); m_ReceptorArrow[c]->SetX( - style->m_ColumnInfo[m_pPlayerState->m_PlayerNumber][c].fXOffset); + style->m_ColumnInfo[c].fXOffset); m_OverlayReceptorArrow[c]->SetX( - style->m_ColumnInfo[m_pPlayerState->m_PlayerNumber][c].fXOffset); + style->m_ColumnInfo[c].fXOffset); } } } diff --git a/src/ScoreKeeperNormal.cpp b/src/ScoreKeeperNormal.cpp index eaef54ef37..4efdaf8d67 100644 --- a/src/ScoreKeeperNormal.cpp +++ b/src/ScoreKeeperNormal.cpp @@ -465,7 +465,7 @@ ScoreKeeperNormal::HandleTapNoteScoreInternal(const NoteData& nd, // update judged row totals. Respect Combo segments here. TimingData& td = - *GAMESTATE->m_pCurSteps[m_pPlayerState->m_PlayerNumber]->GetTimingData(); + *GAMESTATE->m_pCurSteps->GetTimingData(); ComboSegment* cs = td.GetComboSegmentAtRow(row); if (tns == TNS_CheckpointHit || tns >= m_MinScoreToContinueCombo) { m_pPlayerStageStats->m_iTapNoteScores[tns] += cs->GetCombo(); @@ -493,7 +493,7 @@ ScoreKeeperNormal::HandleComboInternal(int iNumHitContinueCombo, m_pPlayerStageStats->m_iCurMissCombo = 0; } TimingData& td = - *GAMESTATE->m_pCurSteps[m_pPlayerState->m_PlayerNumber]->GetTimingData(); + *GAMESTATE->m_pCurSteps->GetTimingData(); if (iNumBreakCombo == 0) { int multiplier = (iRow == -1 ? 1 : td.GetComboSegmentAtRow(iRow)->GetCombo()); @@ -516,7 +516,7 @@ ScoreKeeperNormal::HandleRowComboInternal(TapNoteScore tns, iNumTapsInRow = min(iNumTapsInRow, 1); } TimingData& td = - *GAMESTATE->m_pCurSteps[m_pPlayerState->m_PlayerNumber]->GetTimingData(); + *GAMESTATE->m_pCurSteps->GetTimingData(); if (tns >= m_MinScoreToContinueCombo) { m_pPlayerStageStats->m_iCurMissCombo = 0; int multiplier = diff --git a/src/ScreenDebugOverlay.cpp b/src/ScreenDebugOverlay.cpp index 98530d5148..258a78d07b 100644 --- a/src/ScreenDebugOverlay.cpp +++ b/src/ScreenDebugOverlay.cpp @@ -652,7 +652,7 @@ class DebugLineAutoplay : public IDebugLine { ASSERT(GAMESTATE->GetMasterPlayerNumber() != PLAYER_INVALID); PlayerController pc = - GAMESTATE->m_pPlayerState[GAMESTATE->GetMasterPlayerNumber()] + GAMESTATE->m_pPlayerState ->m_PlayerController; bool bHoldingShift = INPUTFILTER->IsBeingPressed( @@ -664,7 +664,7 @@ class DebugLineAutoplay : public IDebugLine pc = (pc == PC_AUTOPLAY) ? PC_HUMAN : PC_AUTOPLAY; if (GamePreferences::m_AutoPlay != PC_REPLAY) GamePreferences::m_AutoPlay.Set(pc); - FOREACH_HumanPlayer(p) GAMESTATE->m_pPlayerState[p] + GAMESTATE->m_pPlayerState ->m_PlayerController = GamePreferences::m_AutoPlay; FOREACH_MultiPlayer(p) GAMESTATE->m_pMultiPlayerState[p] ->m_PlayerController = GamePreferences::m_AutoPlay; diff --git a/src/ScreenEvaluation.cpp b/src/ScreenEvaluation.cpp index 75bb862d0e..c28c7f643f 100644 --- a/src/ScreenEvaluation.cpp +++ b/src/ScreenEvaluation.cpp @@ -77,11 +77,11 @@ ScreenEvaluation::Init() ss.m_vpPlayedSongs.push_back(GAMESTATE->m_pCurSong); ss.m_vpPossibleSongs.push_back(GAMESTATE->m_pCurSong); GAMESTATE->m_iCurrentStageIndex = 0; - GAMESTATE->m_iPlayerStageTokens[PLAYER_1] = 1; + GAMESTATE->m_iPlayerStageTokens = 1; - ss.m_player[PLAYER_1].m_pStyle = GAMESTATE->GetCurrentStyle(PLAYER_1); + ss.m_player.m_pStyle = GAMESTATE->GetCurrentStyle(PLAYER_1); if (RandomInt(2)) - PO_GROUP_ASSIGN_N(GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, + PO_GROUP_ASSIGN_N(GAMESTATE->m_pPlayerState->m_PlayerOptions, ModsLevel_Stage, m_bTransforms, PlayerOptions::TRANSFORM_ECHO, @@ -90,61 +90,61 @@ ScreenEvaluation::Init() GAMESTATE->m_SongOptions, ModsLevel_Stage, m_fMusicRate, 1.1f); GAMESTATE->JoinPlayer(PLAYER_1); - GAMESTATE->m_pCurSteps[PLAYER_1].Set( + GAMESTATE->m_pCurSteps.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; + ss.m_player.m_vpPossibleSteps.push_back( + GAMESTATE->m_pCurSteps); + ss.m_player.m_iStepsPlayed = 1; - PO_GROUP_ASSIGN(GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, + PO_GROUP_ASSIGN(GAMESTATE->m_pPlayerState->m_PlayerOptions, ModsLevel_Stage, m_fScrollSpeed, 2.0f); - PO_GROUP_CALL(GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions, + PO_GROUP_CALL(GAMESTATE->m_pPlayerState->m_PlayerOptions, ModsLevel_Stage, ChooseRandomModifiers); for( float f = 0; f < 100.0f; f += 1.0f ) { float fP1 = fmodf(f/100*4+.3f,1); - ss.m_player[PLAYER_1].SetLifeRecordAt( fP1, f ); + ss.m_player.SetLifeRecordAt( fP1, f ); } float fSeconds = GAMESTATE->m_pCurSong->GetStepsSeconds(); - ss.m_player[PLAYER_1].m_iActualDancePoints = RandomInt(3); - ss.m_player[PLAYER_1].m_iPossibleDancePoints = 2; + ss.m_player.m_iActualDancePoints = RandomInt(3); + ss.m_player.m_iPossibleDancePoints = 2; if (RandomInt(2)) - ss.m_player[PLAYER_1].m_iCurCombo = RandomInt(15000); + ss.m_player.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); + ss.m_player.m_iCurCombo = 0; + ss.m_player.UpdateComboList(0, true); + + ss.m_player.m_iCurCombo += 50; + ss.m_player.UpdateComboList(0.10f * fSeconds, false); + + ss.m_player.m_iCurCombo = 0; + ss.m_player.UpdateComboList(0.15f * fSeconds, false); + ss.m_player.m_iCurCombo = 1; + ss.m_player.UpdateComboList(0.25f * fSeconds, false); + ss.m_player.m_iCurCombo = 50; + ss.m_player.UpdateComboList(0.35f * fSeconds, false); + ss.m_player.m_iCurCombo = 0; + ss.m_player.UpdateComboList(0.45f * fSeconds, false); + ss.m_player.m_iCurCombo = 1; + ss.m_player.UpdateComboList(0.50f * fSeconds, false); + ss.m_player.m_iCurCombo = 100; + ss.m_player.UpdateComboList(1.00f * fSeconds, false); if (RandomInt(5) == 0) { - ss.m_player[PLAYER_1].m_bFailed = true; + ss.m_player.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 = + ss.m_player.m_iTapNoteScores[TNS_W1] = RandomInt(3); + ss.m_player.m_iTapNoteScores[TNS_W2] = RandomInt(3); + ss.m_player.m_iTapNoteScores[TNS_W3] = RandomInt(3); + ss.m_player.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; + ss.m_player.m_fLifeRemainingSeconds = randomf(90, 580); + ss.m_player.m_iScore = random_up_to(900 * 1000 * 1000); + ss.m_player.m_iPersonalHighScoreIndex = (random_up_to(3)) - 1; + ss.m_player.m_iMachineHighScoreIndex = (random_up_to(3)) - 1; FOREACH_ENUM(RadarCategory, rc) { @@ -157,10 +157,10 @@ ScreenEvaluation::Init() case RadarCategory_Rolls: case RadarCategory_Lifts: case RadarCategory_Fakes: - ss.m_player[PLAYER_1].m_radarPossible[rc] = + ss.m_player.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])); + ss.m_player.m_radarActual[rc] = random_up_to( + static_cast(ss.m_player.m_radarPossible[rc])); break; default: break; @@ -179,14 +179,14 @@ ScreenEvaluation::Init() } m_pStageStats = &STATSMAN->m_vPlayedStageStats.back(); - ZERO(m_bSavedScreenshot); + m_bSavedScreenshot = false; // update persistent statistics if (GamePreferences::m_AutoPlay == PC_REPLAY) { - m_pStageStats->m_player[PLAYER_1].m_HighScore.SetRadarValues( - m_pStageStats->m_player[PLAYER_1].m_radarActual); + m_pStageStats->m_player.m_HighScore.SetRadarValues( + m_pStageStats->m_player.m_radarActual); } else if (GamePreferences::m_AutoPlay != PC_REPLAY) { m_pStageStats->FinalizeScores(true); } @@ -195,9 +195,9 @@ ScreenEvaluation::Init() ScreenWithMenuElements::Init(); // Calculate grades - Grade grade[NUM_PLAYERS]; + Grade grade; - grade[PLAYER_1] = Grade_Failed; + grade = Grade_Failed; // load sounds m_soundStart.Load(THEME->GetPathS(m_sName, "start")); @@ -209,26 +209,26 @@ ScreenEvaluation::Init() 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)) { + if ((m_pStageStats->m_player.m_iMachineHighScoreIndex == 0 || + m_pStageStats->m_player.m_iPersonalHighScoreIndex == 0)) { bOneHasNewTopRecord = true; } - if (m_pStageStats->m_player[PLAYER_1].FullComboOfScore(TNS_W4)) + if (m_pStageStats->m_player.FullComboOfScore(TNS_W4)) bOneHasFullW4Combo = true; - if (m_pStageStats->m_player[PLAYER_1].FullComboOfScore(TNS_W3)) + if (m_pStageStats->m_player.FullComboOfScore(TNS_W3)) bOneHasFullW3Combo = true; - if (m_pStageStats->m_player[PLAYER_1].FullComboOfScore(TNS_W2)) + if (m_pStageStats->m_player.FullComboOfScore(TNS_W2)) bOneHasFullW2Combo = true; - if (m_pStageStats->m_player[PLAYER_1].FullComboOfScore(TNS_W1)) + if (m_pStageStats->m_player.FullComboOfScore(TNS_W1)) bOneHasFullW1Combo = true; } Grade best_grade = Grade_NoData; - best_grade = min(best_grade, grade[PLAYER_1]); + best_grade = min(best_grade, grade); if (bOneHasNewTopRecord && ANNOUNCER->HasSoundsFor("evaluation new record")) { @@ -277,7 +277,7 @@ ScreenEvaluation::Input(const InputEventPlus& input) // Otherwise, you can tap away at the screenshot button without // holding shift. if (bHoldingShift && PROFILEMAN->IsPersistentProfile(pn)) { - if (!m_bSavedScreenshot[pn]) { + if (!m_bSavedScreenshot) { Profile* pProfile = PROFILEMAN->GetProfile(pn); sDir = PROFILEMAN->GetProfileDir((ProfileSlot)pn) + "Screenshots/"; @@ -287,7 +287,7 @@ ScreenEvaluation::Input(const InputEventPlus& input) RString sPath = sDir + sFileName; const HighScore& hs = - m_pStageStats->m_player[pn].m_HighScore; + m_pStageStats->m_player.m_HighScore; Screenshot screenshot; screenshot.sFileName = sFileName; screenshot.sMD5 = @@ -295,7 +295,7 @@ ScreenEvaluation::Input(const InputEventPlus& input) screenshot.highScore = hs; pProfile->AddScreenshot(screenshot); } - m_bSavedScreenshot[pn] = true; + m_bSavedScreenshot = true; } } else { sDir = "Screenshots/"; @@ -341,28 +341,28 @@ void ScreenEvaluation::HandleMenuStart() { StepsID stepsid; - stepsid.FromSteps(GAMESTATE->m_pCurSteps[PLAYER_1]); + stepsid.FromSteps(GAMESTATE->m_pCurSteps); SongID songid; songid.FromSong(GAMESTATE->m_pCurSong); if (GAMEMAN->m_bResetModifiers) { float oldRate = GAMEMAN->m_fPreviousRate; const RString mods = GAMEMAN->m_sModsToReset; /* // Reset mods - GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetSong().FromString("clearall"); - GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetCurrent().FromString("clearall"); - GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetPreferred().FromString("clearall"); - GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetSong().FromString(mods); - GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetCurrent().FromString(mods); - GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetPreferred().FromString(mods); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetSong().FromString("clearall"); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent().FromString("clearall"); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred().FromString("clearall"); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetSong().FromString(mods); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent().FromString(mods); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred().FromString(mods); */ FailType failreset = GAMEMAN->m_iPreviousFail; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .m_FailType = failreset; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .m_FailType = failreset; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .m_FailType = failreset; GAMESTATE->m_SongOptions.GetSong().m_fMusicRate = oldRate; @@ -372,13 +372,13 @@ ScreenEvaluation::HandleMenuStart() const vector oldturns = GAMEMAN->m_vTurnsToReset; if (GAMEMAN->m_bResetTurns) { - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .ResetModsToStringVector(oldturns); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .ResetModsToStringVector(oldturns); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .ResetModsToStringVector(oldturns); GAMEMAN->m_bResetTurns = false; diff --git a/src/ScreenEvaluation.h b/src/ScreenEvaluation.h index ae37598a6b..4cb1d55bd8 100644 --- a/src/ScreenEvaluation.h +++ b/src/ScreenEvaluation.h @@ -41,7 +41,7 @@ class ScreenEvaluation : public ScreenWithMenuElements RageSound m_soundStart; // sound played if the player passes or fails /** @brief Did a player save a screenshot of their score? */ - bool m_bSavedScreenshot[NUM_PLAYERS]; + bool m_bSavedScreenshot; }; #endif diff --git a/src/ScreenGameplay.cpp b/src/ScreenGameplay.cpp index 5cbfe5ae07..e29bd95ab4 100644 --- a/src/ScreenGameplay.cpp +++ b/src/ScreenGameplay.cpp @@ -142,7 +142,7 @@ PlayerInfo::Load(PlayerNumber pn, if (IsMultiPlayer()) { pPlayerState->m_PlayerOptions = - GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions; + GAMESTATE->m_pPlayerState->m_PlayerOptions; } } @@ -159,7 +159,7 @@ PlayerInfo::LoadDummyP1(int iDummyIndex, int iAddToDifficulty) m_pPlayer = new Player(m_NoteData, true); // PlayerOptions needs to be set now so that we load the correct NoteSkin. - m_PlayerStateDummy = *GAMESTATE->m_pPlayerState[PLAYER_1]; + m_PlayerStateDummy = *GAMESTATE->m_pPlayerState; } PlayerInfo::~PlayerInfo() @@ -181,7 +181,7 @@ PlayerInfo::GetPlayerState() return IsMultiPlayer() ? GAMESTATE ->m_pMultiPlayerState[GetPlayerStateAndStageStatsIndex()] - : GAMESTATE->m_pPlayerState[GetPlayerStateAndStageStatsIndex()]; + : GAMESTATE->m_pPlayerState; } PlayerStageStats* @@ -192,7 +192,7 @@ PlayerInfo::GetPlayerStageStats() if (m_bIsDummy || IsMultiPlayer()) return &m_PlayerStageStatsDummy; return &STATSMAN->m_CurStageStats - .m_player[GetPlayerStateAndStageStatsIndex()]; + .m_player; } bool @@ -371,19 +371,18 @@ ScreenGameplay::Init() FOREACH_PotentialCpuPlayer(p) { PlayerNumber human_pn = GAMESTATE->GetFirstHumanPlayer(); - GAMESTATE->m_pCurSteps[p].Set(GAMESTATE->m_pCurSteps[human_pn]); + GAMESTATE->m_pCurSteps.Set(GAMESTATE->m_pCurSteps); if (GAMESTATE->GetCurrentGame()->m_PlayersHaveSeparateStyles) { GAMESTATE->SetCurrentStyle(GAMESTATE->GetCurrentStyle(human_pn), p); } } - FOREACH_EnabledPlayer(p) - ASSERT(GAMESTATE->m_pCurSteps[p].Get() != NULL); + ASSERT(GAMESTATE->m_pCurSteps.Get() != NULL); STATSMAN->m_CurStageStats.m_playMode = GAMESTATE->m_PlayMode; - STATSMAN->m_CurStageStats.m_player[PLAYER_1].m_pStyle = + STATSMAN->m_CurStageStats.m_player.m_pStyle = GAMESTATE->GetCurrentStyle(PLAYER_1); FOREACH_MultiPlayer(pn) { @@ -572,7 +571,7 @@ ScreenGameplay::InitSongQueues() m_apSongsQueue.push_back(GAMESTATE->m_pCurSong); FOREACH_EnabledPlayerInfo(m_vPlayerInfo, pi) { - Steps* pSteps = GAMESTATE->m_pCurSteps[pi->GetStepsAndTrailIndex()]; + Steps* pSteps = GAMESTATE->m_pCurSteps; pi->m_vpStepsQueue.push_back(pSteps); } @@ -663,7 +662,7 @@ ScreenGameplay::SetupSong(int iSongIndex) pi->GetPlayerState()->m_fLastDrawnBeat = -100; Steps* pSteps = pi->m_vpStepsQueue[iSongIndex]; - GAMESTATE->m_pCurSteps[pi->GetStepsAndTrailIndex()].Set(pSteps); + GAMESTATE->m_pCurSteps.Set(pSteps); NoteData originalNoteData; pSteps->GetNoteData(originalNoteData); @@ -782,10 +781,10 @@ ScreenGameplay::LoadNextSong() Song* pSong = GAMESTATE->m_pCurSong; FOREACH_EnabledPlayerInfo(m_vPlayerInfo, pi) { - Steps* pSteps = GAMESTATE->m_pCurSteps[pi->GetStepsAndTrailIndex()]; + Steps* pSteps = GAMESTATE->m_pCurSteps; ++pi->GetPlayerStageStats()->m_iStepsPlayed; - ASSERT(GAMESTATE->m_pCurSteps[pi->GetStepsAndTrailIndex()] != NULL); + ASSERT(GAMESTATE->m_pCurSteps != NULL); if (pi->m_ptextStepsDescription) pi->m_ptextStepsDescription->SetText(pSteps->GetDescription()); @@ -965,11 +964,9 @@ ScreenGameplay::StartPlayingSong(float fMinTimeToNotes, float fMinTimeToMusic) ASSERT(GAMESTATE->m_Position.m_fMusicSeconds > -4000); /* make sure the "fake timer" code doesn't trigger */ - FOREACH_EnabledPlayer(pn) - { - if (GAMESTATE->m_pCurSteps[pn]) { - GAMESTATE->m_pCurSteps[pn]->GetTimingData()->PrepareLookup(); - } + + if (GAMESTATE->m_pCurSteps) { + GAMESTATE->m_pCurSteps->GetTimingData()->PrepareLookup(); } } @@ -1405,35 +1402,35 @@ ScreenGameplay::Update(float fDeltaTime) float oldRate = GAMEMAN->m_fPreviousRate; const RString mods = GAMEMAN->m_sModsToReset; /* - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .FromString("clearall"); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .FromString("clearall"); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .FromString("clearall"); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .FromString(mods); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .FromString(mods); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .FromString(mods); */ const vector oldturns = GAMEMAN->m_vTurnsToReset; if (GAMEMAN->m_bResetTurns) { - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .ResetModsToStringVector(oldturns); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .ResetModsToStringVector(oldturns); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .ResetModsToStringVector(oldturns); GAMEMAN->m_bResetTurns = false; @@ -1446,13 +1443,13 @@ ScreenGameplay::Update(float fDeltaTime) GAMESTATE->m_SongOptions.GetPreferred() .m_fMusicRate = oldRate; FailType failreset = GAMEMAN->m_iPreviousFail; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .m_FailType = failreset; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .m_FailType = failreset; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .m_FailType = failreset; GAMEMAN->m_bResetModifiers = false; @@ -1573,7 +1570,7 @@ ScreenGameplay::SendCrossedMessages() PlayerNumber pn = PLAYER_INVALID; FOREACH_EnabledPlayerNumberInfo(m_vPlayerInfo, pi) { - if (GAMESTATE->m_pCurSteps[pi->m_pn]->GetDifficulty() == + if (GAMESTATE->m_pCurSteps->GetDifficulty() == Difficulty_Beginner) { pn = pi->m_pn; break; @@ -1760,35 +1757,35 @@ ScreenGameplay::Input(const InputEventPlus& input) float oldRate = GAMEMAN->m_fPreviousRate; const RString mods = GAMEMAN->m_sModsToReset; /* - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .FromString("clearall"); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .FromString("clearall"); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .FromString("clearall"); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .FromString(mods); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .FromString(mods); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .FromString(mods); */ const vector oldturns = GAMEMAN->m_vTurnsToReset; if (GAMEMAN->m_bResetTurns) { - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .ResetModsToStringVector(oldturns); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .ResetModsToStringVector(oldturns); - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .ResetModsToStringVector(oldturns); GAMEMAN->m_bResetTurns = false; @@ -1801,13 +1798,13 @@ ScreenGameplay::Input(const InputEventPlus& input) GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate = oldRate; FailType failreset = GAMEMAN->m_iPreviousFail; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .m_FailType = failreset; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .m_FailType = failreset; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .m_FailType = failreset; GAMEMAN->m_bResetModifiers = false; @@ -1883,7 +1880,7 @@ ScreenGameplay::Input(const InputEventPlus& input) ResetGiveUpTimers(true); if (GamePreferences::m_AutoPlay == PC_HUMAN && - GAMESTATE->m_pPlayerState[input.pn] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .m_fPlayerAutoPlay == 0) { PlayerInfo& pi = GetPlayerInfoForInput(input); @@ -1942,7 +1939,7 @@ ScreenGameplay::SaveStats() PlayerNumber pn = pi->m_pn; GAMESTATE->SetProcessedTimingData( - GAMESTATE->m_pCurSteps[pn]->GetTimingData()); + GAMESTATE->m_pCurSteps->GetTimingData()); NoteDataUtil::CalculateRadarValues(nd, fMusicLen, rv); pss.m_radarPossible += rv; NoteDataWithScoring::GetActualRadarValues(nd, pss, fMusicLen, rv); @@ -1968,11 +1965,8 @@ void ScreenGameplay::SongFinished() { - FOREACH_EnabledPlayer(pn) - { - if (GAMESTATE->m_pCurSteps[pn]) { - GAMESTATE->m_pCurSteps[pn]->GetTimingData()->ReleaseLookup(); - } + if (GAMESTATE->m_pCurSteps) { + GAMESTATE->m_pCurSteps->GetTimingData()->ReleaseLookup(); } AdjustSync::HandleSongEnd(); SaveStats(); // Let subclasses save the stats. @@ -1988,7 +1982,7 @@ ScreenGameplay::StageFinished(bool bBackedOut) // If all players failed, kill. if (STATSMAN->m_CurStageStats.AllFailed()) { - FOREACH_HumanPlayer(p) GAMESTATE->m_iPlayerStageTokens[p] = 0; + GAMESTATE->m_iPlayerStageTokens = 0; } STATSMAN->m_CurStageStats.FinalizeScores(false); @@ -2099,7 +2093,7 @@ ScreenGameplay::HandleScreenMessage(const ScreenMessage SM) GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate = ratesqueue[0]; - STATSMAN->m_CurStageStats.m_player[PLAYER_1].InternalInit(); + STATSMAN->m_CurStageStats.m_player.InternalInit(); } playlistscorekeys.emplace_back( STATSMAN->m_CurStageStats.mostrecentscorekey); @@ -2384,7 +2378,7 @@ ScreenGameplay::SaveReplay() // steps information StepsID stepsID; - stepsID.FromSteps(GAMESTATE->m_pCurSteps[pn]); + stepsID.FromSteps(GAMESTATE->m_pCurSteps); XNode* pStepsInfoNode = stepsID.CreateNode(); // hashing = argh // pStepsInfoNode->AppendChild("StepsHash", @@ -2532,7 +2526,7 @@ ScreenGameplay::SetSongPosition(float newPositionSeconds) } else { // Restart the file to make sure nothing weird is going on ReloadCurrentSong(); - STATSMAN->m_CurStageStats.m_player[PLAYER_1].InternalInit(); + STATSMAN->m_CurStageStats.m_player.InternalInit(); } // Go @@ -2573,7 +2567,7 @@ ScreenGameplay::ToggleReplayPause() // Restart the stage, technically (This will cause a lot of lag if there // are a lot of notes.) ReloadCurrentSong(); - STATSMAN->m_CurStageStats.m_player[PLAYER_1].InternalInit(); + STATSMAN->m_CurStageStats.m_player.InternalInit(); PlayerAI::SetScoreData(PlayerAI::pScoreData); PlayerAI::SetUpExactTapMap(PlayerAI::pReplayTiming); @@ -2709,7 +2703,7 @@ class LunaScreenGameplay : public Luna { PlayerNumber pn = PLAYER_1; float rate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; - float bps = GAMESTATE->m_pPlayerState[pn]->m_Position.m_fCurBPS; + float bps = GAMESTATE->m_pPlayerState->m_Position.m_fCurBPS; float true_bps = rate * bps; lua_pushnumber(L, true_bps); return 1; diff --git a/src/ScreenGameplaySyncMachine.cpp b/src/ScreenGameplaySyncMachine.cpp index e419155335..8e07719cdf 100644 --- a/src/ScreenGameplaySyncMachine.cpp +++ b/src/ScreenGameplaySyncMachine.cpp @@ -45,7 +45,7 @@ ScreenGameplaySyncMachine::Init() ASSERT_M(vpSteps.size() > 0, "No playable steps for ScreenGameplaySyncMachine"); Steps* pSteps = vpSteps[0]; - GAMESTATE->m_pCurSteps[GAMESTATE->GetFirstHumanPlayer()].Set(pSteps); + GAMESTATE->m_pCurSteps.Set(pSteps); GamePreferences::m_AutoPlay.Set(PC_HUMAN); @@ -105,7 +105,7 @@ ScreenGameplaySyncMachine::HandleScreenMessage(const ScreenMessage SM) ScreenGameplayNormal::HandleScreenMessage(SM); if (SM == SM_GoToPrevScreen || SM == SM_GoToNextScreen) { - GAMESTATE->m_pCurSteps[PLAYER_1].Set(NULL); + GAMESTATE->m_pCurSteps.Set(NULL); GAMESTATE->m_PlayMode.Set(PlayMode_Invalid); GAMESTATE->SetCurrentStyle(NULL, PLAYER_INVALID); GAMESTATE->m_pCurSong.Set(NULL); diff --git a/src/ScreenNetSelectMusic.cpp b/src/ScreenNetSelectMusic.cpp index 37c0817cd3..7e7c90e694 100644 --- a/src/ScreenNetSelectMusic.cpp +++ b/src/ScreenNetSelectMusic.cpp @@ -98,8 +98,8 @@ SelectSongUsingNSMAN(ScreenNetSelectMusic* s, bool start) if (NSMAN->song != nullptr) { GAMESTATE->m_pCurSong.Set(NSMAN->song); if (NSMAN->steps != nullptr) { - GAMESTATE->m_pCurSteps[PLAYER_1].Set(NSMAN->steps); - GAMESTATE->m_PreferredDifficulty[PLAYER_1].Set( + GAMESTATE->m_pCurSteps.Set(NSMAN->steps); + GAMESTATE->m_PreferredDifficulty.Set( NSMAN->steps->GetDifficulty()); } if (!m_MusicWheel.SelectSong(NSMAN->song)) { @@ -137,8 +137,8 @@ ScreenNetSelectMusic::HandleScreenMessage(const ScreenMessage SM) if (NSMAN->song != nullptr) { GAMESTATE->m_pCurSong.Set(NSMAN->song); if (NSMAN->steps != nullptr) { - GAMESTATE->m_pCurSteps[PLAYER_1].Set(NSMAN->steps); - GAMESTATE->m_PreferredDifficulty[PLAYER_1].Set( + GAMESTATE->m_pCurSteps.Set(NSMAN->steps); + GAMESTATE->m_PreferredDifficulty.Set( NSMAN->steps->GetDifficulty()); } if (!m_MusicWheel.SelectSong(NSMAN->song)) { @@ -265,12 +265,12 @@ ScreenNetSelectMusic::SelectCurrent() if (pSong == NULL) return false; - if (static_cast(m_vpSteps.size()) <= m_iSelection[PLAYER_1]) + if (static_cast(m_vpSteps.size()) <= m_iSelection) return false; GAMESTATE->m_pCurSong.Set(pSong); - Steps* pSteps = m_vpSteps[m_iSelection[PLAYER_1]]; - GAMESTATE->m_pCurSteps[PLAYER_1].Set(pSteps); - GAMESTATE->m_PreferredDifficulty[PLAYER_1].Set(pSteps->GetDifficulty()); + Steps* pSteps = m_vpSteps[m_iSelection]; + GAMESTATE->m_pCurSteps.Set(pSteps); + GAMESTATE->m_PreferredDifficulty.Set(pSteps->GetDifficulty()); if (NSMAN->useSMserver) { NSMAN->m_sArtist = pSong->GetTranslitArtist(); diff --git a/src/ScreenOptions.cpp b/src/ScreenOptions.cpp index 6ce98634fb..0727e45653 100644 --- a/src/ScreenOptions.cpp +++ b/src/ScreenOptions.cpp @@ -138,30 +138,30 @@ ScreenOptions::Init() m_frameContainer.AddChild(m_sprPage); // init line highlights - m_sprLineHighlight[PLAYER_1].Load( + m_sprLineHighlight.Load( THEME->GetPathG(m_sName, ssprintf("LineHighlight P%d", PLAYER_1 + 1))); - m_sprLineHighlight[PLAYER_1]->SetName( + m_sprLineHighlight->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]); + m_sprLineHighlight->SetX(LINE_HIGHLIGHT_X); + LOAD_ALL_COMMANDS(m_sprLineHighlight); + m_frameContainer.AddChild(m_sprLineHighlight); // init cursors - m_Cursor[PLAYER_1].Load("OptionsCursor" + PlayerNumberToString(PLAYER_1), + m_Cursor.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]); + m_Cursor.SetName("Cursor"); + LOAD_ALL_COMMANDS(m_Cursor); + m_frameContainer.AddChild(&m_Cursor); switch (m_InputMode) { case INPUTMODE_INDIVIDUAL: - m_textExplanation[PLAYER_1].LoadFromFont( + m_textExplanation.LoadFromFont( THEME->GetPathF(m_sName, "explanation")); - m_textExplanation[PLAYER_1].SetDrawOrder(2); - m_textExplanation[PLAYER_1].SetName("Explanation" + + m_textExplanation.SetDrawOrder(2); + m_textExplanation.SetName("Explanation" + PlayerNumberToString(PLAYER_1)); - LOAD_ALL_COMMANDS_AND_SET_XY(m_textExplanation[PLAYER_1]); - m_frameContainer.AddChild(&m_textExplanation[PLAYER_1]); + LOAD_ALL_COMMANDS_AND_SET_XY(m_textExplanation); + m_frameContainer.AddChild(&m_textExplanation); break; case INPUTMODE_SHARE_CURSOR: m_textExplanationTogether.LoadFromFont( @@ -269,22 +269,22 @@ ScreenOptions::RestartOptions() pRow->AfterImportOptions(PLAYER_1); } - m_iCurrentRow[PLAYER_1] = -1; - m_iFocusX[PLAYER_1] = -1; - m_bWasOnExit[PLAYER_1] = false; + m_iCurrentRow = -1; + m_iFocusX = -1; + m_bWasOnExit = 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(PLAYER_1)) { - m_iCurrentRow[PLAYER_1] = r; + m_iCurrentRow = r; break; } } // Hide the highlight if no rows are enabled. - m_sprLineHighlight[PLAYER_1]->SetVisible( - m_iCurrentRow[PLAYER_1] != -1 && GAMESTATE->IsHumanPlayer(PLAYER_1)); + m_sprLineHighlight->SetVisible( + m_iCurrentRow != -1 && GAMESTATE->IsHumanPlayer(PLAYER_1)); CHECKPOINT_M("About to get the rows positioned right."); @@ -308,12 +308,12 @@ ScreenOptions::BeginScreen() RestartOptions(); - m_bGotAtLeastOneStartPressed[PLAYER_1] = false; + m_bGotAtLeastOneStartPressed = false; ON_COMMAND(m_frameContainer); - m_Cursor[PLAYER_1].SetVisible(GAMESTATE->IsHumanPlayer(PLAYER_1)); - ON_COMMAND(m_Cursor[PLAYER_1]); + m_Cursor.SetVisible(GAMESTATE->IsHumanPlayer(PLAYER_1)); + ON_COMMAND(m_Cursor); this->SortByDrawOrder(); } @@ -415,7 +415,7 @@ ScreenOptions::PositionCursor(PlayerNumber pn) { // Set the position of the cursor showing the current option the user is // changing. - const int iRow = m_iCurrentRow[pn]; + const int iRow = m_iCurrentRow; if (iRow == -1) return; @@ -430,7 +430,7 @@ ScreenOptions::PositionCursor(PlayerNumber pn) int iWidth, iX, iY; GetWidthXY(pn, iRow, iChoiceWithFocus, iWidth, iX, iY); - OptionsCursor& cursor = m_Cursor[pn]; + OptionsCursor& cursor = m_Cursor; cursor.SetBarWidth(iWidth); cursor.SetXY(static_cast(iX), static_cast(iY)); bool bCanGoLeft = iChoiceWithFocus > 0; @@ -445,7 +445,7 @@ ScreenOptions::TweenCursor(PlayerNumber pn) { // Set the position of the cursor showing the current option the user is // changing. - const int iRow = m_iCurrentRow[pn]; + const int iRow = m_iCurrentRow; ASSERT_M(iRow >= 0 && iRow < (int)m_pRows.size(), ssprintf("%i < %i", iRow, (int)m_pRows.size())); @@ -455,7 +455,7 @@ ScreenOptions::TweenCursor(PlayerNumber pn) int iWidth, iX, iY; GetWidthXY(pn, iRow, iChoiceWithFocus, iWidth, iX, iY); - OptionsCursor& cursor = m_Cursor[pn]; + OptionsCursor& cursor = m_Cursor; if (cursor.GetDestX() != static_cast(iX) || cursor.GetDestY() != static_cast(iY) || cursor.GetBarWidth() != iWidth) { @@ -486,7 +486,7 @@ ScreenOptions::TweenCursor(PlayerNumber pn) if (row.GetRowType() == OptionRow::RowType_Exit) COMMAND(m_sprLineHighlight[pn], "ChangeToExit"); - m_sprLineHighlight[pn]->SetY(static_cast(iY)); + m_sprLineHighlight->SetY(static_cast(iY)); } } @@ -589,7 +589,7 @@ ScreenOptions::PositionRows(bool bTween) int first_start, first_end, second_start, second_end; // Choices for the player. - int P1Choice = m_iCurrentRow[PLAYER_1]; + int P1Choice = m_iCurrentRow; vector Rows(m_pRows); OptionRow* pSeparateExitRow = NULL; @@ -699,7 +699,7 @@ ScreenOptions::AfterChangeValueOrRow(PlayerNumber pn) if (!GAMESTATE->IsHumanPlayer(pn)) return; - const int iCurRow = m_iCurrentRow[pn]; + const int iCurRow = m_iCurrentRow; if (iCurRow == -1) return; @@ -733,8 +733,8 @@ ScreenOptions::AfterChangeValueOrRow(PlayerNumber pn) 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; + if (m_bWasOnExit != bExitSelected) { + m_bWasOnExit = bExitSelected; COMMAND(m_sprMore, ssprintf("Exit%sP%i", bExitSelected ? "Selected" : "Unselected", @@ -746,7 +746,7 @@ ScreenOptions::AfterChangeValueOrRow(PlayerNumber pn) BitmapText* pText = NULL; switch (m_InputMode) { case INPUTMODE_INDIVIDUAL: - pText = &m_textExplanation[pn]; + pText = &m_textExplanation; break; default: // case INPUTMODE_SHARE_CURSOR: @@ -770,11 +770,8 @@ ScreenOptions::MenuBack(const InputEventPlus&) bool ScreenOptions::AllAreOnLastRow() const { - FOREACH_HumanPlayer(p) - { - if (m_iCurrentRow[p] != (int)(m_pRows.size() - 1)) - return false; - } + if (m_iCurrentRow != (int)(m_pRows.size() - 1)) + return false; return true; } @@ -784,12 +781,12 @@ ScreenOptions::MenuStart(const InputEventPlus& input) PlayerNumber pn = input.pn; switch (input.type) { case IET_FIRST_PRESS: - m_bGotAtLeastOneStartPressed[pn] = true; + m_bGotAtLeastOneStartPressed = true; break; case IET_RELEASE: return false; // ignore default: // repeat type - if (!m_bGotAtLeastOneStartPressed[pn]) + if (!m_bGotAtLeastOneStartPressed) return false; // don't allow repeat break; } @@ -821,7 +818,7 @@ ScreenOptions::ProcessMenuStart(const InputEventPlus& input) { PlayerNumber pn = input.pn; - int iCurRow = m_iCurrentRow[pn]; + int iCurRow = m_iCurrentRow; if (iCurRow < 0) { // this shouldn't be happening, but it is, so we need to bail out. -aj @@ -908,7 +905,7 @@ ScreenOptions::ProcessMenuStart(const InputEventPlus& input) if (row.GetFirstItemGoesDown() && row.GoToFirstOnStart()) { // move to the first choice in the row - ChangeValueInRowRelative(m_iCurrentRow[pn], + ChangeValueInRowRelative(m_iCurrentRow, pn, -row.GetChoiceInRowWithFocus(pn), input.type != IET_FIRST_PRESS); @@ -923,7 +920,7 @@ ScreenOptions::ProcessMenuStart(const InputEventPlus& input) MenuDown(input); break; case NAV_THREE_KEY_ALT: - ChangeValueInRowRelative(m_iCurrentRow[input.pn], + ChangeValueInRowRelative(m_iCurrentRow, input.pn, +1, input.type != IET_FIRST_PRESS); @@ -939,14 +936,14 @@ ScreenOptions::ProcessMenuStart(const InputEventPlus& input) if (row.GetFirstItemGoesDown()) ChangeValueInRowRelative( - m_iCurrentRow[pn], + m_iCurrentRow, pn, -row.GetChoiceInRowWithFocus(pn), input.type != IET_FIRST_PRESS); // move to the first choice else ChangeValueInRowRelative( - m_iCurrentRow[pn], pn, 0, input.type != IET_FIRST_PRESS); + m_iCurrentRow, pn, 0, input.type != IET_FIRST_PRESS); break; } case NAV_THREE_KEY_MENU: @@ -967,22 +964,22 @@ void ScreenOptions::StoreFocus(PlayerNumber pn) { // Long rows always put us in the center, so don't update the focus. - int iCurrentRow = m_iCurrentRow[pn]; + int iCurrentRow = m_iCurrentRow; const OptionRow& row = *m_pRows[iCurrentRow]; if (row.GetRowDef().m_layoutType == LAYOUT_SHOW_ONE_IN_ROW) return; int iWidth, iY; GetWidthXY(pn, - m_iCurrentRow[pn], + m_iCurrentRow, row.GetChoiceInRowWithFocus(pn), iWidth, - m_iFocusX[pn], + m_iFocusX, iY); LOG->Trace("cur selection %ix%i @ %i", - m_iCurrentRow[pn], + m_iCurrentRow, row.GetChoiceInRowWithFocus(pn), - m_iFocusX[pn]); + m_iFocusX); } bool @@ -1167,7 +1164,7 @@ ScreenOptions::MoveRowRelative(PlayerNumber pn, int iDir, bool bRepeat) ASSERT(m_pRows.size() != 0); for (int r = 1; r < (int)m_pRows.size(); r++) { int iDelta = r * iDir; - iDest = m_iCurrentRow[pn] + iDelta; + iDest = m_iCurrentRow + iDelta; wrap(iDest, m_pRows.size()); OptionRow& row = *m_pRows[iDest]; @@ -1181,9 +1178,9 @@ ScreenOptions::MoveRowRelative(PlayerNumber pn, int iDir, bool bRepeat) return false; if (bRepeat) { // Don't wrap on repeating inputs. - if (iDir > 0 && iDest < m_iCurrentRow[pn]) + if (iDir > 0 && iDest < m_iCurrentRow) return false; - if (iDir < 0 && iDest > m_iCurrentRow[pn]) + if (iDir < 0 && iDest > m_iCurrentRow) return false; } @@ -1193,7 +1190,7 @@ ScreenOptions::MoveRowRelative(PlayerNumber pn, int iDir, bool bRepeat) void ScreenOptions::AfterChangeRow(PlayerNumber pn) { - const int iRow = m_iCurrentRow[pn]; + const int iRow = m_iCurrentRow; if (iRow != -1) { // In FIVE_KEY, keep the selection in the row near the focus. OptionRow& row = *m_pRows[iRow]; @@ -1203,8 +1200,8 @@ ScreenOptions::AfterChangeRow(PlayerNumber pn) int iSelectionDist = -1; for (unsigned i = 0; i < row.GetTextItemsSize(); ++i) { int iWidth, iX, iY; - GetWidthXY(pn, m_iCurrentRow[pn], i, iWidth, iX, iY); - const int iDist = abs(iX - m_iFocusX[pn]); + GetWidthXY(pn, m_iCurrentRow, i, iWidth, iX, iY); + const int iDist = abs(iX - m_iFocusX); if (iSelectionDist == -1 || iDist < iSelectionDist) { iSelectionDist = iDist; row.SetChoiceInRowWithFocus(pn, i); @@ -1233,14 +1230,14 @@ ScreenOptions::MoveRowAbsolute(PlayerNumber pn, int iRow) bool bChanged = false; if (m_InputMode == INPUTMODE_INDIVIDUAL && PLAYER_1 != pn) { } // skip - else if (m_iCurrentRow[PLAYER_1] == iRow) + else if (m_iCurrentRow == iRow) { // also skip } else { - m_iCurrentRow[PLAYER_1] = iRow; + m_iCurrentRow = iRow; AfterChangeRow(PLAYER_1); bChanged = true; @@ -1263,7 +1260,7 @@ ScreenOptions::MenuLeft(const InputEventPlus& input) MenuUpDown(input, -1); else ChangeValueInRowRelative( - m_iCurrentRow[input.pn], input.pn, -1, input.type != IET_FIRST_PRESS); + m_iCurrentRow, input.pn, -1, input.type != IET_FIRST_PRESS); PlayerNumber pn = input.pn; MESSAGEMAN->Broadcast(static_cast(Message_MenuLeftP1 + pn)); @@ -1277,7 +1274,7 @@ ScreenOptions::MenuRight(const InputEventPlus& input) MenuUpDown(input, +1); else ChangeValueInRowRelative( - m_iCurrentRow[input.pn], input.pn, +1, input.type != IET_FIRST_PRESS); + m_iCurrentRow, input.pn, +1, input.type != IET_FIRST_PRESS); PlayerNumber pn = input.pn; MESSAGEMAN->Broadcast(static_cast(Message_MenuRightP1 + pn)); diff --git a/src/ScreenOptions.h b/src/ScreenOptions.h index ff58c5e611..f91511c1a9 100644 --- a/src/ScreenOptions.h +++ b/src/ScreenOptions.h @@ -110,7 +110,7 @@ class ScreenOptions : public ScreenWithMenuElements int GetCurrentRow(PlayerNumber pn = PLAYER_1) const { - return m_iCurrentRow[pn]; + return m_iCurrentRow; } bool AllAreOnLastRow() const; OptionRow* GetRow(int iRow) const { return m_pRows[iRow]; } @@ -133,7 +133,7 @@ class ScreenOptions : public ScreenWithMenuElements /** @brief Map menu lines to m_OptionRow entries. */ vector m_pRows; /** @brief The current row each player is on. */ - int m_iCurrentRow[NUM_PLAYERS]; + int m_iCurrentRow; OptionRowType m_OptionRowTypeNormal; OptionRowType m_OptionRowTypeExit; @@ -141,8 +141,8 @@ class ScreenOptions : public ScreenWithMenuElements Navigation m_OptionsNavigation; InputMode m_InputMode; - int m_iFocusX[NUM_PLAYERS]; - bool m_bWasOnExit[NUM_PLAYERS]; + int m_iFocusX; + bool m_bWasOnExit; /** @brief True if at least one player pressed Start after selecting the * song. @@ -150,16 +150,16 @@ class ScreenOptions : public ScreenWithMenuElements * TRICKY: People hold Start to get to PlayerOptions, then the repeat events * cause them to zip to the bottom. So, ignore Start repeat events until * we've seen one first pressed event. */ - bool m_bGotAtLeastOneStartPressed[NUM_PLAYERS]; + bool m_bGotAtLeastOneStartPressed; // actors ActorFrame m_frameContainer; AutoActor m_sprPage; - OptionsCursor m_Cursor[NUM_PLAYERS]; - AutoActor m_sprLineHighlight[NUM_PLAYERS]; + OptionsCursor m_Cursor; + AutoActor m_sprLineHighlight; - BitmapText m_textExplanation[NUM_PLAYERS]; + BitmapText m_textExplanation; BitmapText m_textExplanationTogether; DualScrollBar m_ScrollBar; AutoActor m_sprMore; diff --git a/src/ScreenOptionsManageProfiles.cpp b/src/ScreenOptionsManageProfiles.cpp index 0b401cc27c..b5cd83a698 100644 --- a/src/ScreenOptionsManageProfiles.cpp +++ b/src/ScreenOptionsManageProfiles.cpp @@ -187,7 +187,7 @@ void ScreenOptionsManageProfiles::HandleScreenMessage(const ScreenMessage SM) { if (SM == SM_GoToNextScreen) { - int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; + int iCurRow = m_iCurrentRow; OptionRow& row = *m_pRows[iCurRow]; if (row.GetRowType() == OptionRow::RowType_Exit) { this->HandleScreenMessage(SM_GoToPrevScreen); @@ -376,7 +376,7 @@ ScreenOptionsManageProfiles::ProcessMenuStart(const InputEventPlus&) if (IsTransitioning()) return; - int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; + int iCurRow = m_iCurrentRow; OptionRow& row = *m_pRows[iCurRow]; if (SHOW_CREATE_NEW && iCurRow == 0) // "create new" @@ -435,7 +435,7 @@ ScreenOptionsManageProfiles::ExportOptions( int ScreenOptionsManageProfiles::GetLocalProfileIndexWithFocus() const { - int iCurRow = m_iCurrentRow[GAMESTATE->GetMasterPlayerNumber()]; + int iCurRow = m_iCurrentRow; OptionRow& row = *m_pRows[iCurRow]; if (SHOW_CREATE_NEW && iCurRow == 0) // "create new" diff --git a/src/ScreenOptionsMaster.cpp b/src/ScreenOptionsMaster.cpp index 9a430d9721..5a4aa782e5 100644 --- a/src/ScreenOptionsMaster.cpp +++ b/src/ScreenOptionsMaster.cpp @@ -89,13 +89,9 @@ ScreenOptionsMaster::ExportOptions(int r, const vector& vpns) CHECKPOINT_M(ssprintf("%i/%i", r, static_cast(m_pRows.size()))); OptionRow& row = *m_pRows[r]; - bool bRowHasFocus[NUM_PLAYERS]; - ZERO(bRowHasFocus); - FOREACH_CONST(PlayerNumber, vpns, p) - { - int iCurRow = m_iCurrentRow[*p]; - bRowHasFocus[*p] = iCurRow == r; - } + bool bRowHasFocus = false; + int iCurRow = m_iCurrentRow; + bRowHasFocus = iCurRow == r; m_iChangeMask |= row.ExportOptions(vpns, bRowHasFocus); } diff --git a/src/ScreenPlayerOptions.cpp b/src/ScreenPlayerOptions.cpp index 373fca9fbf..e0da79d4d3 100644 --- a/src/ScreenPlayerOptions.cpp +++ b/src/ScreenPlayerOptions.cpp @@ -20,13 +20,13 @@ void ScreenPlayerOptions::Init() { ScreenOptionsMaster::Init(); - 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( + m_sprDisqualify.Load(THEME->GetPathG(m_sName, "disqualify")); + m_sprDisqualify->SetName(ssprintf("DisqualifyP%i", PLAYER_1 + 1)); + LOAD_ALL_COMMANDS_AND_SET_XY(m_sprDisqualify); + m_sprDisqualify->SetVisible( false); // unhide later if handicapping options are discovered - m_sprDisqualify[PLAYER_1]->SetDrawOrder(2); - m_frameContainer.AddChild(m_sprDisqualify[PLAYER_1]); + m_sprDisqualify->SetDrawOrder(2); + m_frameContainer.AddChild(m_sprDisqualify); m_bAskOptionsMessage = PREFSMAN->m_ShowSongOptions == Maybe_ASK; @@ -35,7 +35,7 @@ ScreenPlayerOptions::Init() SOUND->PlayOnceFromDir(ANNOUNCER->GetPathTo("player options intro")); - m_bRowCausesDisqualified[PLAYER_1].resize(m_pRows.size(), false); + m_bRowCausesDisqualified.resize(m_pRows.size(), false); } void @@ -72,7 +72,7 @@ ScreenPlayerOptions::Input(const InputEventPlus& input) CodeDetector::EnteredCode(input.GameI.controller, CODE_CANCEL_ALL_PLAYER_OPTIONS)) { // apply the game default mods, but not the Profile saved mods - GAMESTATE->m_pPlayerState[pn]->ResetToDefaultPlayerOptions( + GAMESTATE->m_pPlayerState->ResetToDefaultPlayerOptions( ModsLevel_Preferred); MESSAGEMAN->Broadcast(ssprintf("CancelAllP%i", pn + 1)); @@ -93,7 +93,7 @@ ScreenPlayerOptions::Input(const InputEventPlus& input) // UGLY: Update m_Disqualified whenever Start is pressed if (GAMESTATE->IsHumanPlayer(pn) && input.MenuI == GAME_BUTTON_START) { - int row = m_iCurrentRow[pn]; + int row = m_iCurrentRow; UpdateDisqualified(row, pn); } return bHandled; @@ -121,32 +121,32 @@ ScreenPlayerOptions::UpdateDisqualified(int row, PlayerNumber pn) // save original player options PlayerOptions poOrig = - GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetPreferred(); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred(); // Find out if the current row when exported causes disqualification. // Exporting the row will fill GAMESTATE->m_PlayerOptions. - PO_GROUP_CALL(GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions, + PO_GROUP_CALL(GAMESTATE->m_pPlayerState->m_PlayerOptions, ModsLevel_Preferred, Init); vector v; v.push_back(pn); ExportOptions(row, v); bool bRowCausesDisqualified = GAMESTATE->CurrentOptionsDisqualifyPlayer(pn); - m_bRowCausesDisqualified[pn][row] = bRowCausesDisqualified; + m_bRowCausesDisqualified[row] = bRowCausesDisqualified; // Update disqualified graphic bool bDisqualified = false; - FOREACH_CONST(bool, m_bRowCausesDisqualified[pn], b) + FOREACH_CONST(bool, m_bRowCausesDisqualified, b) { if (*b) { bDisqualified = true; break; } } - m_sprDisqualify[pn]->SetVisible(bDisqualified); + m_sprDisqualify->SetVisible(bDisqualified); // restore previous player options in case the user escapes back after this - GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.Assign(ModsLevel_Preferred, + GAMESTATE->m_pPlayerState->m_PlayerOptions.Assign(ModsLevel_Preferred, poOrig); } diff --git a/src/ScreenPlayerOptions.h b/src/ScreenPlayerOptions.h index 604633585e..4c8d6af767 100644 --- a/src/ScreenPlayerOptions.h +++ b/src/ScreenPlayerOptions.h @@ -19,7 +19,7 @@ class ScreenPlayerOptions : public ScreenOptionsMaster void PushSelf(lua_State* L) override; private: - vector m_bRowCausesDisqualified[NUM_PLAYERS]; + vector m_bRowCausesDisqualified; void UpdateDisqualified(int row, PlayerNumber pn); bool m_bAcceptedChoices; @@ -27,7 +27,7 @@ class ScreenPlayerOptions : public ScreenOptionsMaster bool m_bAskOptionsMessage; // show if the current selections will disqualify a high score - AutoActor m_sprDisqualify[NUM_PLAYERS]; + AutoActor m_sprDisqualify; }; #endif diff --git a/src/ScreenSelectMaster.cpp b/src/ScreenSelectMaster.cpp index 3d6ad45159..09349675c0 100644 --- a/src/ScreenSelectMaster.cpp +++ b/src/ScreenSelectMaster.cpp @@ -50,9 +50,9 @@ REGISTER_SCREEN_CLASS(ScreenSelectMaster); ScreenSelectMaster::ScreenSelectMaster() { - ZERO(m_iChoice); - ZERO(m_bChosen); - ZERO(m_bDoubleChoice); + m_iChoice = 0; + m_bChosen = false; + m_bDoubleChoice = false; } void @@ -103,18 +103,17 @@ ScreenSelectMaster::Init() FOREACH(PlayerNumber, vpns, p) { RString sElement = "Cursor" + PLAYER_APPEND_NO_SPACE(*p); - m_sprCursor[*p].Load(THEME->GetPathG(m_sName, sElement)); + m_sprCursor.Load(THEME->GetPathG(m_sName, sElement)); sElement.Replace(" ", ""); - m_sprCursor[*p]->SetName(sElement); - this->AddChild(m_sprCursor[*p]); - LOAD_ALL_COMMANDS(m_sprCursor[*p]); + m_sprCursor->SetName(sElement); + this->AddChild(m_sprCursor); + LOAD_ALL_COMMANDS(m_sprCursor); } } // Resize vectors depending on how many choices there are m_vsprIcon.resize(m_aGameCommands.size()); - FOREACH(PlayerNumber, vpns, p) - m_vsprScroll[*p].resize(m_aGameCommands.size()); + m_vsprScroll.resize(m_aGameCommands.size()); vector positions; bool positions_set_by_lua = false; @@ -220,14 +219,14 @@ ScreenSelectMaster::Init() if (!SHARED_SELECTION) vs.push_back(PLAYER_APPEND_NO_SPACE(*p)); RString sElement = join(" ", vs); - m_vsprScroll[*p][c].Load(THEME->GetPathG(m_sName, sElement)); + m_vsprScroll[c].Load(THEME->GetPathG(m_sName, sElement)); RString sName = "Scroll" "Choice" + mc.m_sName; if (!SHARED_SELECTION) sName += PLAYER_APPEND_NO_SPACE(*p); - m_vsprScroll[*p][c]->SetName(sName); - m_Scroller[*p].AddChild(m_vsprScroll[*p][c]); + m_vsprScroll[c]->SetName(sName); + m_Scroller.AddChild(m_vsprScroll[c]); } } } @@ -236,15 +235,15 @@ ScreenSelectMaster::Init() if (SHOW_SCROLLER) { FOREACH(PlayerNumber, vpns, p) { - m_Scroller[*p].SetLoop(LOOP_SCROLLER); - m_Scroller[*p].SetNumItemsToDraw(SCROLLER_NUM_ITEMS_TO_DRAW); - m_Scroller[*p].Load2(); - m_Scroller[*p].SetTransformFromReference(SCROLLER_TRANSFORM); - m_Scroller[*p].SetSecondsPerItem(SCROLLER_SECONDS_PER_ITEM); - m_Scroller[*p].SetNumSubdivisions(SCROLLER_SUBDIVISIONS); - m_Scroller[*p].SetName("Scroller" + PLAYER_APPEND_NO_SPACE(*p)); - LOAD_ALL_COMMANDS_AND_SET_XY(m_Scroller[*p]); - this->AddChild(&m_Scroller[*p]); + m_Scroller.SetLoop(LOOP_SCROLLER); + m_Scroller.SetNumItemsToDraw(SCROLLER_NUM_ITEMS_TO_DRAW); + m_Scroller.Load2(); + m_Scroller.SetTransformFromReference(SCROLLER_TRANSFORM); + m_Scroller.SetSecondsPerItem(SCROLLER_SECONDS_PER_ITEM); + m_Scroller.SetNumSubdivisions(SCROLLER_SUBDIVISIONS); + m_Scroller.SetName("Scroller" + PLAYER_APPEND_NO_SPACE(*p)); + LOAD_ALL_COMMANDS_AND_SET_XY(m_Scroller); + this->AddChild(&m_Scroller); } } @@ -343,21 +342,21 @@ ScreenSelectMaster::BeginScreen() } } - 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; + m_iChoice = (iDefaultChoice != -1) ? iDefaultChoice : 0; + CLAMP(m_iChoice, 0, (int)m_aGameCommands.size() - 1); + m_bChosen = false; + m_bDoubleChoice = false; if (!SHARED_SELECTION) { if (GAMESTATE->IsHumanPlayer(PLAYER_1)) {} else { if (SHOW_CURSOR) { - if (m_sprCursor[PLAYER_1]) - m_sprCursor[PLAYER_1]->SetVisible(false); + if (m_sprCursor) + m_sprCursor->SetVisible(false); } if (SHOW_SCROLLER) - m_Scroller[PLAYER_1].SetVisible(false); + m_Scroller.SetVisible(false); } } @@ -379,7 +378,7 @@ ScreenSelectMaster::HandleScreenMessage(const ScreenMessage SM) GetActiveElementPlayerNumbers(vpns); if (SM == SM_PlayPostSwitchPage) { - int iNewChoice = m_iChoice[GAMESTATE->GetMasterPlayerNumber()]; + int iNewChoice = m_iChoice; Page newPage = GetPage(iNewChoice); Message msg("PostSwitchPage"); @@ -387,14 +386,14 @@ ScreenSelectMaster::HandleScreenMessage(const ScreenMessage SM) if (SHOW_CURSOR) { FOREACH(PlayerNumber, vpns, p) - m_sprCursor[*p]->HandleMessage(msg); + m_sprCursor->HandleMessage(msg); } if (SHOW_SCROLLER) { FOREACH(PlayerNumber, vpns, p) { - int iChoice = m_iChoice[*p]; - m_vsprScroll[*p][iChoice]->HandleMessage(msg); + int iChoice = m_iChoice; + m_vsprScroll[iChoice]->HandleMessage(msg); } } MESSAGEMAN->Broadcast(msg); @@ -405,7 +404,7 @@ ScreenSelectMaster::HandleScreenMessage(const ScreenMessage SM) FOREACH_HumanPlayer(p) { m_bDoubleChoiceNoSound = true; - m_bDoubleChoice[p] = true; + m_bDoubleChoice = true; InputEventPlus iep; iep.pn = p; MenuStart(iep); @@ -427,7 +426,7 @@ ScreenSelectMaster::HandleMessage(const Message& msg) int ScreenSelectMaster::GetSelectionIndex(PlayerNumber pn) { - return m_iChoice[pn]; + return m_iChoice; } void @@ -436,8 +435,8 @@ ScreenSelectMaster::UpdateSelectableChoices() vector vpns; GetActiveElementPlayerNumbers(vpns); int first_playable = -1; - bool on_unplayable[NUM_PLAYERS]; - on_unplayable[PLAYER_1] = false; + bool on_unplayable; + on_unplayable = false; for (unsigned c = 0; c < m_aGameCommands.size(); c++) { RString command = "Enabled"; @@ -454,19 +453,19 @@ ScreenSelectMaster::UpdateSelectableChoices() FOREACH(PlayerNumber, vpns, p) { - if (disabled && m_iChoice[*p] == c) { - on_unplayable[*p] = true; + if (disabled && m_iChoice == c) { + on_unplayable = true; } - if (m_vsprScroll[*p][c].IsLoaded()) { - m_vsprScroll[*p][c]->PlayCommand(command); + if (m_vsprScroll[c].IsLoaded()) { + m_vsprScroll[c]->PlayCommand(command); } } } FOREACH(PlayerNumber, vpns, pn) { - if (on_unplayable[*pn] && first_playable != -1) { + if (on_unplayable && first_playable != -1) { ChangeSelection(*pn, - first_playable < m_iChoice[*pn] ? MenuDir_Left + first_playable < m_iChoice ? MenuDir_Left : MenuDir_Right, first_playable); } @@ -478,7 +477,7 @@ ScreenSelectMaster::UpdateSelectableChoices() FOREACH_HumanPlayer(p) { if (!m_aGameCommands.empty() && - !m_aGameCommands[m_iChoice[p]].IsPlayable()) + !m_aGameCommands[m_iChoice].IsPlayable()) Move(p, MenuDir_Auto); } } @@ -499,7 +498,7 @@ ScreenSelectMaster::Move(PlayerNumber pn, MenuDir dir) if (!AnyOptionsArePlayable()) return false; - int iSwitchToIndex = m_iChoice[pn]; + int iSwitchToIndex = m_iChoice; set seen; do { @@ -526,7 +525,7 @@ bool ScreenSelectMaster::MenuLeft(const InputEventPlus& input) { PlayerNumber pn = input.pn; - if (m_fLockInputSecs > 0 || m_bChosen[pn]) + if (m_fLockInputSecs > 0 || m_bChosen) return false; if (input.type == IET_RELEASE) return false; @@ -544,7 +543,7 @@ ScreenSelectMaster::MenuLeft(const InputEventPlus& input) // if they use double select if (DOUBLE_PRESS_TO_SELECT) { - m_bDoubleChoice[pn] = false; // player has cancelled their selection + m_bDoubleChoice = false; // player has cancelled their selection } return true; } @@ -555,7 +554,7 @@ bool ScreenSelectMaster::MenuRight(const InputEventPlus& input) { PlayerNumber pn = input.pn; - if (m_fLockInputSecs > 0 || m_bChosen[pn]) + if (m_fLockInputSecs > 0 || m_bChosen) return false; if (input.type == IET_RELEASE) return false; @@ -573,7 +572,7 @@ ScreenSelectMaster::MenuRight(const InputEventPlus& input) // if they use double select if (DOUBLE_PRESS_TO_SELECT) { - m_bDoubleChoice[pn] = false; // player has cancelled their selection + m_bDoubleChoice = false; // player has cancelled their selection } return true; } @@ -584,7 +583,7 @@ bool ScreenSelectMaster::MenuUp(const InputEventPlus& input) { PlayerNumber pn = input.pn; - if (m_fLockInputSecs > 0 || m_bChosen[pn]) + if (m_fLockInputSecs > 0 || m_bChosen) return false; if (input.type == IET_RELEASE) return false; @@ -602,7 +601,7 @@ ScreenSelectMaster::MenuUp(const InputEventPlus& input) // if they use double select if (DOUBLE_PRESS_TO_SELECT) { - m_bDoubleChoice[pn] = false; // player has cancelled their selection + m_bDoubleChoice = false; // player has cancelled their selection } return true; } @@ -613,7 +612,7 @@ bool ScreenSelectMaster::MenuDown(const InputEventPlus& input) { PlayerNumber pn = input.pn; - if (m_fLockInputSecs > 0 || m_bChosen[pn]) + if (m_fLockInputSecs > 0 || m_bChosen) return false; if (input.type == IET_RELEASE) return false; @@ -631,7 +630,7 @@ ScreenSelectMaster::MenuDown(const InputEventPlus& input) // if they use double select if (DOUBLE_PRESS_TO_SELECT) { - m_bDoubleChoice[pn] = false; // player has cancelled their selection + m_bDoubleChoice = false; // player has cancelled their selection } return true; } @@ -641,15 +640,15 @@ ScreenSelectMaster::MenuDown(const InputEventPlus& input) bool ScreenSelectMaster::ChangePage(int iNewChoice) { - Page oldPage = GetPage(m_iChoice[GAMESTATE->GetMasterPlayerNumber()]); + Page oldPage = GetPage(m_iChoice); Page newPage = GetPage(iNewChoice); // If anyone has already chosen, don't allow changing of pages - if (GAMESTATE->IsHumanPlayer(PLAYER_1) && m_bChosen[PLAYER_1]) + if (GAMESTATE->IsHumanPlayer(PLAYER_1) && m_bChosen) return false; // change both players - m_iChoice[PLAYER_1] = iNewChoice; + m_iChoice = iNewChoice; const RString sIconAndExplanationCommand = ssprintf("SwitchToPage%d", newPage + 1); @@ -675,12 +674,12 @@ ScreenSelectMaster::ChangePage(int iNewChoice) { if (GAMESTATE->IsHumanPlayer(*p)) { if (SHOW_CURSOR) { - m_sprCursor[*p]->HandleMessage(msg); - m_sprCursor[*p]->SetXY(GetCursorX(*p), GetCursorY(*p)); + m_sprCursor->HandleMessage(msg); + m_sprCursor->SetXY(GetCursorX(*p), GetCursorY(*p)); } if (SHOW_SCROLLER) - m_vsprScroll[*p][m_iChoice[*p]]->HandleMessage(msg); + m_vsprScroll[m_iChoice]->HandleMessage(msg); } } @@ -703,11 +702,11 @@ ScreenSelectMaster::ChangeSelection(PlayerNumber pn, MenuDir dir, int iNewChoice) { - if (iNewChoice == m_iChoice[pn]) + if (iNewChoice == m_iChoice) return false; // already there Page page = GetPage(iNewChoice); - if (GetPage(m_iChoice[pn]) != page) { + if (GetPage(m_iChoice) != page) { return ChangePage(iNewChoice); } @@ -722,8 +721,8 @@ ScreenSelectMaster::ChangeSelection(PlayerNumber pn, FOREACH(PlayerNumber, vpns, p) { - const int iOldChoice = m_iChoice[*p]; - m_iChoice[*p] = iNewChoice; + const int iOldChoice = m_iChoice; + m_iChoice = iNewChoice; if (SHOW_ICON) { /* XXX: If !SharedPreviewAndCursor, this is incorrect. (Nothing uses @@ -735,14 +734,14 @@ ScreenSelectMaster::ChangeSelection(PlayerNumber pn, { if (p2 == *p) continue; - bOldStillHasFocus |= m_iChoice[p2] == iOldChoice; - bNewAlreadyHadFocus |= m_iChoice[p2] == iNewChoice; + bOldStillHasFocus |= m_iChoice == iOldChoice; + bNewAlreadyHadFocus |= m_iChoice == iNewChoice; } if (DOUBLE_PRESS_TO_SELECT) { // this player is currently on a single press, which they are // cancelling - if (m_bDoubleChoice[pn]) { + if (m_bDoubleChoice) { if (!bOldStillHasFocus) m_vsprIcon[iOldChoice]->PlayCommand( "LostSelectedLoseFocus"); @@ -766,18 +765,18 @@ ScreenSelectMaster::ChangeSelection(PlayerNumber pn, if (SHOW_CURSOR) { if (GAMESTATE->IsHumanPlayer(*p)) { - m_sprCursor[*p]->PlayCommand("Change"); - m_sprCursor[*p]->SetXY(GetCursorX(*p), GetCursorY(*p)); + m_sprCursor->PlayCommand("Change"); + m_sprCursor->SetXY(GetCursorX(*p), GetCursorY(*p)); } } if (SHOW_SCROLLER) { ActorScroller& scroller = - (SHARED_SELECTION || page != PAGE_1 ? m_Scroller[0] - : m_Scroller[*p]); + (SHARED_SELECTION || page != PAGE_1 ? m_Scroller + : m_Scroller); vector& vScroll = - (SHARED_SELECTION || page != PAGE_1 ? m_vsprScroll[0] - : m_vsprScroll[*p]); + (SHARED_SELECTION || page != PAGE_1 ? m_vsprScroll + : m_vsprScroll); if (WRAP_SCROLLER) { // HACK: We can't tell from the option orders whether or not we @@ -802,7 +801,7 @@ ScreenSelectMaster::ChangeSelection(PlayerNumber pn, if (DOUBLE_PRESS_TO_SELECT) { // this player is currently on a single press, which they are // cancelling - if (m_bDoubleChoice[pn]) { + if (m_bDoubleChoice) { vScroll[iOldChoice]->PlayCommand("LostSelectedLoseFocus"); vScroll[iNewChoice]->PlayCommand("LostSelectedGainFocus"); } else // the player hasn't made any selections yet @@ -840,19 +839,19 @@ ScreenSelectMaster::Page ScreenSelectMaster::GetCurrentPage() const { // Both players are guaranteed to be on the same page. - return GetPage(m_iChoice[GetSharedPlayer()]); + return GetPage(m_iChoice); } float ScreenSelectMaster::DoMenuStart(PlayerNumber pn) { - if (m_bChosen[pn]) + if (m_bChosen) return 0; bool bAnyChosen = false; - bAnyChosen |= m_bChosen[PLAYER_1]; + bAnyChosen |= m_bChosen; - m_bChosen[pn] = true; + m_bChosen = true; this->PlayCommand("MadeChoice" + PlayerNumberToString(pn)); @@ -868,9 +867,9 @@ ScreenSelectMaster::DoMenuStart(PlayerNumber pn) } } if (SHOW_CURSOR) { - if (m_sprCursor[pn] != NULL) { - m_sprCursor[pn]->PlayCommand("Choose"); - fSecs = max(fSecs, m_sprCursor[pn]->GetTweenTimeLeft()); + if (m_sprCursor != NULL) { + m_sprCursor->PlayCommand("Choose"); + fSecs = max(fSecs, m_sprCursor->GetTweenTimeLeft()); } } @@ -890,10 +889,10 @@ ScreenSelectMaster::MenuStart(const InputEventPlus& input) // Return if any player has chosen FOREACH_EnabledPlayer(p) { - if (m_bChosen[p]) + if (m_bChosen) return false; } - } else if (m_bChosen[pn]) + } else if (m_bChosen) // Return if this player has already chosen return false; @@ -901,14 +900,14 @@ ScreenSelectMaster::MenuStart(const InputEventPlus& input) return false; // double press is enabled and the player hasn't made their first press - if (DOUBLE_PRESS_TO_SELECT && !m_bDoubleChoice[pn]) { + if (DOUBLE_PRESS_TO_SELECT && !m_bDoubleChoice) { m_soundStart.PlayCopy(true); - m_bDoubleChoice[pn] = true; + m_bDoubleChoice = true; if (SHOW_SCROLLER) { vector& vScroll = - SHARED_SELECTION ? m_vsprScroll[0] : m_vsprScroll[pn]; - vScroll[m_iChoice[pn]]->PlayCommand("InitialSelection"); + SHARED_SELECTION ? m_vsprScroll : m_vsprScroll; + vScroll[m_iChoice]->PlayCommand("InitialSelection"); } return true; @@ -919,7 +918,7 @@ ScreenSelectMaster::MenuStart(const InputEventPlus& input) // choices were all invalid or didn't load or similar. -Kyz GameCommand* mc = &empty_mc; if (!m_aGameCommands.empty()) { - mc = &(m_aGameCommands[m_iChoice[pn]]); + mc = &(m_aGameCommands[m_iChoice]); } /* If no options are playable, then we're just waiting for one to become @@ -954,13 +953,13 @@ ScreenSelectMaster::MenuStart(const InputEventPlus& input) // too. FOREACH_EnabledPlayer(p) { - ASSERT(!m_bChosen[p]); + ASSERT(!m_bChosen); fSecs = max(fSecs, DoMenuStart(p)); } } else { fSecs = max(fSecs, DoMenuStart(pn)); // check to see if everyone has chosen - FOREACH_HumanPlayer(p) bAllDone &= m_bChosen[p]; + FOREACH_HumanPlayer(p) bAllDone &= m_bChosen; } if (bAllDone) { @@ -989,7 +988,7 @@ ScreenSelectMaster::TweenOnScreen() if (SHOW_ICON) { for (unsigned c = 0; c < m_aGameCommands.size(); c++) { - m_vsprIcon[c]->PlayCommand((int(c) == m_iChoice[0]) ? "GainFocus" + m_vsprIcon[c]->PlayCommand((int(c) == m_iChoice) ? "GainFocus" : "LoseFocus"); m_vsprIcon[c]->FinishTweening(); } @@ -1001,13 +1000,13 @@ ScreenSelectMaster::TweenOnScreen() // Play Gain/LoseFocus before playing the on command. // Gain/Lose will often stop tweening, which ruins the OnCommand. for (unsigned c = 0; c < m_aGameCommands.size(); c++) { - m_vsprScroll[*p][c]->PlayCommand( - int(c) == m_iChoice[*p] ? "GainFocus" : "LoseFocus"); - m_vsprScroll[*p][c]->FinishTweening(); + m_vsprScroll[c]->PlayCommand( + int(c) == m_iChoice ? "GainFocus" : "LoseFocus"); + m_vsprScroll[c]->FinishTweening(); } - m_Scroller[*p].SetCurrentAndDestinationItem( - static_cast(m_iChoice[*p])); + m_Scroller.SetCurrentAndDestinationItem( + static_cast(m_iChoice)); } } @@ -1017,7 +1016,7 @@ ScreenSelectMaster::TweenOnScreen() FOREACH(PlayerNumber, vpns, p) { if (GAMESTATE->IsHumanPlayer(*p)) - m_sprCursor[*p]->SetXY(GetCursorX(*p), GetCursorY(*p)); + m_sprCursor->SetXY(GetCursorX(*p), GetCursorY(*p)); } } @@ -1039,7 +1038,7 @@ ScreenSelectMaster::TweenOffScreen() bool bSelectedByEitherPlayer = false; FOREACH(PlayerNumber, vpns, p) { - if (m_iChoice[*p] == (int)c) + if (m_iChoice == (int)c) bSelectedByEitherPlayer = true; } @@ -1049,7 +1048,7 @@ ScreenSelectMaster::TweenOffScreen() if (SHOW_SCROLLER) { FOREACH(PlayerNumber, vpns, p) - m_vsprScroll[*p][c]->PlayCommand( + m_vsprScroll[c]->PlayCommand( bSelectedByEitherPlayer ? "OffFocused" : "OffUnfocused"); } } @@ -1060,7 +1059,7 @@ ScreenSelectMaster::TweenOffScreen() float ScreenSelectMaster::GetCursorX(PlayerNumber pn) { - int iChoice = m_iChoice[pn]; + int iChoice = m_iChoice; AutoActor& spr = m_vsprIcon[iChoice]; return spr->GetDestX() + CURSOR_OFFSET_X_FROM_ICON.GetValue(pn); } @@ -1068,7 +1067,7 @@ ScreenSelectMaster::GetCursorX(PlayerNumber pn) float ScreenSelectMaster::GetCursorY(PlayerNumber pn) { - int iChoice = m_iChoice[pn]; + int iChoice = m_iChoice; AutoActor& spr = m_vsprIcon[iChoice]; return spr->GetDestY() + CURSOR_OFFSET_Y_FROM_ICON.GetValue(pn); } diff --git a/src/ScreenSelectMaster.h b/src/ScreenSelectMaster.h index ba604364ac..e795c041a8 100644 --- a/src/ScreenSelectMaster.h +++ b/src/ScreenSelectMaster.h @@ -110,20 +110,20 @@ class ScreenSelectMaster : public ScreenSelect vector m_vsprIcon; // preview is per-player, per-choice piece - vector m_vsprScroll[NUM_PLAYERS]; + vector m_vsprScroll; - ActorScroller m_Scroller[NUM_PLAYERS]; + ActorScroller m_Scroller; // cursor is the per-player, shared by all choices - AutoActor m_sprCursor[NUM_PLAYERS]; + AutoActor m_sprCursor; RageSound m_soundChange; RandomSample m_soundDifficult; RageSound m_soundStart; - int m_iChoice[NUM_PLAYERS]; - bool m_bChosen[NUM_PLAYERS]; - bool m_bDoubleChoice[NUM_PLAYERS]; + int m_iChoice; + bool m_bChosen; + bool m_bDoubleChoice; bool m_bDoubleChoiceNoSound; GameButton m_TrackingRepeatingInput; diff --git a/src/ScreenSelectMusic.cpp b/src/ScreenSelectMusic.cpp index 84be0c5c16..4548cf4d9e 100644 --- a/src/ScreenSelectMusic.cpp +++ b/src/ScreenSelectMusic.cpp @@ -89,8 +89,8 @@ ScreenSelectMusic::Init() } if (GamePreferences::m_AutoPlay == PC_REPLAY) GamePreferences::m_AutoPlay.Set(PC_HUMAN); - if (GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController == PC_REPLAY) - GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_HUMAN; + if (GAMESTATE->m_pPlayerState->m_PlayerController == PC_REPLAY) + GAMESTATE->m_pPlayerState->m_PlayerController = PC_HUMAN; IDLE_COMMENT_SECONDS.Load(m_sName, "IdleCommentSeconds"); SAMPLE_MUSIC_DELAY_INIT.Load(m_sName, "SampleMusicDelayInit"); @@ -146,8 +146,8 @@ ScreenSelectMusic::Init() INPUTMAPPER->GetInputScheme()->ButtonNameToIndex( THEME->GetMetric(m_sName, "NextGroupButton")); } - m_bSelectIsDown[PLAYER_1] = false; // used by UpdateSelectButton - m_bAcceptSelectRelease[PLAYER_1] = false; + m_bSelectIsDown = false; // used by UpdateSelectButton + m_bAcceptSelectRelease = false; ScreenWithMenuElements::Init(); @@ -173,11 +173,11 @@ ScreenSelectMusic::Init() this->AddChild(&m_MusicWheel); if (USE_OPTIONS_LIST) { - 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.SetName("OptionsList" + PlayerNumberToString(PLAYER_1)); + m_OptionsList.Load("OptionsList", PLAYER_1); + m_OptionsList.SetDrawOrder(100); + ActorUtil::LoadAllCommands(m_OptionsList, m_sName); + this->AddChild(&m_OptionsList); } RageSoundLoadParams SoundParams; @@ -240,13 +240,13 @@ ScreenSelectMusic::BeginScreen() m_MusicWheel.BeginScreen(); m_SelectionState = SelectionState_SelectingSong; - ZERO(m_bStepsChosen); + m_bStepsChosen = false; m_bGoToOptions = false; m_bAllowOptionsMenu = m_bAllowOptionsMenuRepeat = false; - ZERO(m_iSelection); + m_iSelection = 0; if (USE_OPTIONS_LIST) - m_OptionsList[PLAYER_1].Reset(); + m_OptionsList.Reset(); AfterMusicChange(); @@ -256,9 +256,9 @@ ScreenSelectMusic::BeginScreen() GAMESTATE->isplaylistcourse = false; SONGMAN->playlistcourse = ""; } - if (GAMESTATE->m_pCurSteps[PLAYER_1] != nullptr) + if (GAMESTATE->m_pCurSteps != nullptr) DLMAN->RequestChartLeaderBoard( - GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey()); + GAMESTATE->m_pCurSteps->GetChartKey()); ScreenWithMenuElements::BeginScreen(); } @@ -444,18 +444,18 @@ ScreenSelectMusic::Input(const InputEventPlus& input) if (!fav_me_biatch->IsFavorited()) { fav_me_biatch->SetFavorited(true); pProfile->AddToFavorites( - GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey()); + GAMESTATE->m_pCurSteps->GetChartKey()); DLMAN->AddFavorite( - GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey()); + GAMESTATE->m_pCurSteps->GetChartKey()); pProfile->allplaylists.erase("Favorites"); SONGMAN->MakePlaylistFromFavorites( pProfile->FavoritedCharts, pProfile->allplaylists); } else { fav_me_biatch->SetFavorited(false); pProfile->RemoveFromFavorites( - GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey()); + GAMESTATE->m_pCurSteps->GetChartKey()); DLMAN->RemoveFavorite( - GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey()); + GAMESTATE->m_pCurSteps->GetChartKey()); } DLMAN->RefreshFavourites(); Message msg("FavoritesUpdated"); @@ -473,11 +473,11 @@ ScreenSelectMusic::Input(const InputEventPlus& input) if (!alwaysmirrorsmh->IsPermaMirror()) { alwaysmirrorsmh->SetPermaMirror(true); pProfile->AddToPermaMirror( - GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey()); + GAMESTATE->m_pCurSteps->GetChartKey()); } else { alwaysmirrorsmh->SetPermaMirror(false); pProfile->RemoveFromPermaMirror( - GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey()); + GAMESTATE->m_pCurSteps->GetChartKey()); } Message msg("FavoritesUpdated"); MESSAGEMAN->Broadcast(msg); @@ -486,9 +486,9 @@ ScreenSelectMusic::Input(const InputEventPlus& input) } } else if (bHoldingCtrl && c == 'G' && m_MusicWheel.IsSettled() && input.type == IET_FIRST_PRESS && - GAMESTATE->m_pCurSteps[PLAYER_1] != nullptr) { + GAMESTATE->m_pCurSteps != nullptr) { Profile* pProfile = PROFILEMAN->GetProfile(PLAYER_1); - pProfile->AddGoal(GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey()); + pProfile->AddGoal(GAMESTATE->m_pCurSteps->GetChartKey()); Song* asonglol = m_MusicWheel.GetSelectedSong(); if (!asonglol) return true; @@ -513,12 +513,12 @@ ScreenSelectMusic::Input(const InputEventPlus& input) return true; } else if (bHoldingCtrl && c == 'A' && m_MusicWheel.IsSettled() && input.type == IET_FIRST_PRESS && - GAMESTATE->m_pCurSteps[PLAYER_1] != nullptr) { + GAMESTATE->m_pCurSteps != nullptr) { if (SONGMAN->GetPlaylists().empty()) return true; SONGMAN->GetPlaylists()[SONGMAN->activeplaylist].AddChart( - GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey()); + GAMESTATE->m_pCurSteps->GetChartKey()); MESSAGEMAN->Broadcast("DisplaySinglePlaylist"); SCREENMAN->SystemMessage( ssprintf("Added chart: %s to playlist: %s", @@ -566,17 +566,17 @@ ScreenSelectMusic::Input(const InputEventPlus& input) // Handle unselect steps // xxx: select button could conflict with OptionsList here -aj if (m_SelectionState == SelectionState_SelectingSteps && - m_bStepsChosen[input.pn] && input.MenuI == GAME_BUTTON_SELECT && + m_bStepsChosen && input.MenuI == GAME_BUTTON_SELECT && input.type == IET_FIRST_PRESS) { Message msg("StepsUnchosen"); msg.SetParam("Player", input.pn); MESSAGEMAN->Broadcast(msg); - m_bStepsChosen[input.pn] = false; + m_bStepsChosen = false; return true; } if (m_SelectionState == SelectionState_Finalized || - m_bStepsChosen[input.pn]) + m_bStepsChosen) return false; // ignore if (USE_PLAYER_SELECT_MENU) { @@ -590,37 +590,37 @@ ScreenSelectMusic::Input(const InputEventPlus& input) if (USE_OPTIONS_LIST) { PlayerNumber pn = input.pn; if (pn != PLAYER_INVALID) { - if (m_OptionsList[pn].IsOpened()) { - return m_OptionsList[pn].Input(input); + if (m_OptionsList.IsOpened()) { + return m_OptionsList.Input(input); } else { if (input.type == IET_RELEASE && input.MenuI == GAME_BUTTON_SELECT && - m_bAcceptSelectRelease[pn]) - m_OptionsList[pn].Open(); + m_bAcceptSelectRelease) + m_OptionsList.Open(); } } } if (input.MenuI == GAME_BUTTON_SELECT && input.type != IET_REPEAT) - m_bAcceptSelectRelease[input.pn] = (input.type == IET_FIRST_PRESS); + m_bAcceptSelectRelease = (input.type == IET_FIRST_PRESS); if (SELECT_MENU_AVAILABLE && input.MenuI == GAME_BUTTON_SELECT && input.type != IET_REPEAT) UpdateSelectButton(input.pn, input.type == IET_FIRST_PRESS); - if (SELECT_MENU_AVAILABLE && m_bSelectIsDown[input.pn]) { + if (SELECT_MENU_AVAILABLE && m_bSelectIsDown) { if (input.type == IET_FIRST_PRESS && SELECT_MENU_CHANGES_DIFFICULTY) { switch (input.MenuI) { case GAME_BUTTON_LEFT: ChangeSteps(input.pn, -1); - m_bAcceptSelectRelease[input.pn] = false; + m_bAcceptSelectRelease = false; break; case GAME_BUTTON_RIGHT: ChangeSteps(input.pn, +1); - m_bAcceptSelectRelease[input.pn] = false; + m_bAcceptSelectRelease = false; break; case GAME_BUTTON_START: - m_bAcceptSelectRelease[input.pn] = false; + m_bAcceptSelectRelease = false; if (MODE_MENU_AVAILABLE) m_MusicWheel.NextSort(); else @@ -638,12 +638,12 @@ ScreenSelectMusic::Input(const InputEventPlus& input) "Button", GameButtonToString(INPUTMAPPER->GetInputScheme(), input.MenuI)); MESSAGEMAN->Broadcast(msg); - m_bAcceptSelectRelease[input.pn] = false; + m_bAcceptSelectRelease = false; } if (input.type == IET_FIRST_PRESS) g_CanOpenOptionsList.Touch(); if (g_CanOpenOptionsList.Ago() > OPTIONS_LIST_TIMEOUT) - m_bAcceptSelectRelease[input.pn] = false; + m_bAcceptSelectRelease = false; return true; } @@ -661,7 +661,7 @@ ScreenSelectMusic::Input(const InputEventPlus& input) FOREACH_HumanPlayer(p) { - if (m_OptionsList[p].IsOpened()) + if (m_OptionsList.IsOpened()) continue; if (SELECT_MENU_AVAILABLE && INPUTMAPPER->IsBeingPressed(GAME_BUTTON_SELECT, p)) @@ -752,7 +752,7 @@ ScreenSelectMusic::Input(const InputEventPlus& input) } if (m_SelectionState == SelectionState_SelectingSteps && - input.type == IET_FIRST_PRESS && !m_bStepsChosen[input.pn]) { + input.type == IET_FIRST_PRESS && !m_bStepsChosen) { if (input.MenuI == m_GameButtonNextSong || input.MenuI == m_GameButtonPreviousSong) { if (input.MenuI == m_GameButtonPreviousSong) { @@ -772,7 +772,7 @@ ScreenSelectMusic::Input(const InputEventPlus& input) msg.SetParam("Player", input.pn); MESSAGEMAN->Broadcast(msg); // unset all steps - m_bStepsChosen[PLAYER_1] = false; + m_bStepsChosen = false; m_SelectionState = SelectionState_SelectingSong; } } @@ -840,8 +840,8 @@ ScreenSelectMusic::UpdateSelectButton(PlayerNumber pn, bool bSelectIsDown) if (!SELECT_MENU_AVAILABLE || !CanChangeSong()) bSelectIsDown = false; - if (m_bSelectIsDown[pn] != bSelectIsDown) { - m_bSelectIsDown[pn] = bSelectIsDown; + if (m_bSelectIsDown != bSelectIsDown) { + m_bSelectIsDown = bSelectIsDown; Message msg(bSelectIsDown ? "SelectMenuOpened" : "SelectMenuClosed"); msg.SetParam("Player", pn); MESSAGEMAN->Broadcast(msg); @@ -856,17 +856,17 @@ ScreenSelectMusic::ChangeSteps(PlayerNumber pn, int dir) ASSERT(GAMESTATE->IsHumanPlayer(pn)); if (GAMESTATE->m_pCurSong) { - m_iSelection[pn] += dir; + m_iSelection += dir; if (WRAP_CHANGE_STEPS) { - wrap(m_iSelection[pn], m_vpSteps.size()); + wrap(m_iSelection, m_vpSteps.size()); } else { - if (CLAMP(m_iSelection[pn], 0, m_vpSteps.size() - 1)) + if (CLAMP(m_iSelection, 0, m_vpSteps.size() - 1)) return; } // the user explicity switched difficulties. Update the preferred // Difficulty and StepsType - Steps* pSteps = m_vpSteps[m_iSelection[pn]]; + Steps* pSteps = m_vpSteps[m_iSelection]; GAMESTATE->ChangePreferredDifficultyAndStepsType( pn, pSteps->GetDifficulty(), pSteps->m_StepsType); } else { @@ -885,7 +885,7 @@ ScreenSelectMusic::ChangeSteps(PlayerNumber pn, int dir) FOREACH_HumanPlayer(p) { if (pn == p || GAMESTATE->DifficultiesLocked()) { - m_iSelection[p] = m_iSelection[pn]; + m_iSelection = m_iSelection; vpns.push_back(p); } } @@ -918,8 +918,7 @@ ScreenSelectMusic::HandleMessage(const Message& msg) // TODO: Invalidate the CurSteps only if they are no longer playable. // That way, after music change will clamp to the nearest in the // StepsDisplayList. - GAMESTATE->m_pCurSteps[master_pn].SetWithoutBroadcast(NULL); - GAMESTATE->m_pCurSteps[PLAYER_1].SetWithoutBroadcast(NULL); + GAMESTATE->m_pCurSteps.SetWithoutBroadcast(NULL); /* If a course is selected, it may no longer be playable. * Let MusicWheel know about the late join. */ @@ -940,11 +939,11 @@ ScreenSelectMusic::HandleMessage(const Message& msg) // can avoid it } - m_iSelection[pn] = iSel; + m_iSelection = iSel; Steps* pSteps = - m_vpSteps.empty() ? nullptr : m_vpSteps[m_iSelection[pn]]; + m_vpSteps.empty() ? nullptr : m_vpSteps[m_iSelection]; - GAMESTATE->m_pCurSteps[pn].Set(pSteps); + GAMESTATE->m_pCurSteps.Set(pSteps); } ScreenWithMenuElements::HandleMessage(msg); @@ -1061,13 +1060,10 @@ ScreenSelectMusic::SelectCurrent(PlayerNumber pn) const bool bIsNew = PROFILEMAN->IsSongNew(m_MusicWheel.GetSelectedSong()); bool bIsHard = false; - FOREACH_HumanPlayer(p) - { - if (GAMESTATE->m_pCurSteps[p] && - GAMESTATE->m_pCurSteps[p]->GetMeter() >= - HARD_COMMENT_METER) - bIsHard = true; - } + if (GAMESTATE->m_pCurSteps && + GAMESTATE->m_pCurSteps->GetMeter() >= + HARD_COMMENT_METER) + bIsHard = true; // See if this song is a repeat. // If we're in event mode, only check the last five songs. @@ -1108,14 +1104,14 @@ ScreenSelectMusic::SelectCurrent(PlayerNumber pn) if (p == pn) continue; bAllOtherHumanPlayersDone &= - static_cast(m_bStepsChosen[p]); + static_cast(m_bStepsChosen); } bool bAllPlayersDoneSelectingSteps = bInitiatedByMenuTimer || bAllOtherHumanPlayersDone; if (!bAllPlayersDoneSelectingSteps) { - m_bStepsChosen[pn] = true; + m_bStepsChosen = true; m_soundStart.Play(true); // impldiff: Pump it Up Pro uses "StepsSelected". -aj @@ -1127,8 +1123,8 @@ ScreenSelectMusic::SelectCurrent(PlayerNumber pn) } break; } if (m_SelectionState == SelectionState_SelectingSteps) { - if (m_OptionsList[PLAYER_1].IsOpened()) - m_OptionsList[PLAYER_1].Close(); + if (m_OptionsList.IsOpened()) + m_OptionsList.Close(); } UpdateSelectButton(PLAYER_1, false); @@ -1150,8 +1146,8 @@ ScreenSelectMusic::SelectCurrent(PlayerNumber pn) FOREACH_HumanPlayer(p) { - if (!m_bStepsChosen[p]) { - m_bStepsChosen[p] = true; + if (!m_bStepsChosen) { + m_bStepsChosen = true; // Don't play start sound. We play it again below on finalized // m_soundStart.Play(true); @@ -1206,13 +1202,13 @@ ScreenSelectMusic::AfterStepsOrTrailChange(const vector& vpns) ASSERT(GAMESTATE->IsHumanPlayer(pn)); if (GAMESTATE->m_pCurSong) { - CLAMP(m_iSelection[pn], 0, m_vpSteps.size() - 1); + CLAMP(m_iSelection, 0, m_vpSteps.size() - 1); Song* pSong = GAMESTATE->m_pCurSong; Steps* pSteps = - m_vpSteps.empty() ? nullptr : m_vpSteps[m_iSelection[pn]]; + m_vpSteps.empty() ? nullptr : m_vpSteps[m_iSelection]; - GAMESTATE->m_pCurSteps[pn].Set(pSteps); + GAMESTATE->m_pCurSteps.Set(pSteps); if (pSteps != nullptr) GAMESTATE->SetCompatibleStyle(pSteps->m_StepsType, pn); @@ -1240,20 +1236,20 @@ ScreenSelectMusic::SwitchToPreferredDifficulty() // Find the closest match to the user's preferred difficulty and // StepsType. int iCurDifference = -1; - int& iSelection = m_iSelection[pn]; + int& iSelection = m_iSelection; FOREACH_CONST(Steps*, m_vpSteps, s) { int i = s - m_vpSteps.begin(); // If the current steps are listed, use them. - if (GAMESTATE->m_pCurSteps[pn] == *s) { + if (GAMESTATE->m_pCurSteps == *s) { iSelection = i; break; } - if (GAMESTATE->m_PreferredDifficulty[pn] != Difficulty_Invalid) { + if (GAMESTATE->m_PreferredDifficulty != Difficulty_Invalid) { int iDifficultyDifference = abs( - (*s)->GetDifficulty() - GAMESTATE->m_PreferredDifficulty[pn]); + (*s)->GetDifficulty() - GAMESTATE->m_PreferredDifficulty); int iStepsTypeDifference = 0; if (GAMESTATE->m_PreferredStepsType != StepsType_Invalid) iStepsTypeDifference = @@ -1272,8 +1268,7 @@ ScreenSelectMusic::SwitchToPreferredDifficulty() } if (GAMESTATE->DifficultiesLocked()) { - FOREACH_HumanPlayer(p) m_iSelection[p] = - m_iSelection[GAMESTATE->GetMasterPlayerNumber()]; + m_iSelection = m_iSelection; } } @@ -1285,7 +1280,7 @@ ScreenSelectMusic::AfterMusicChange() if (pSong != nullptr) GAMESTATE->m_pPreferredSong = pSong; else { - GAMESTATE->m_pCurSteps[PLAYER_1].Set(nullptr); + GAMESTATE->m_pCurSteps.Set(nullptr); if (m_pPreviewNoteField) { m_pPreviewNoteField->SetVisible(false); // if previewnotefield is active and we are moving out of a pack @@ -1322,7 +1317,7 @@ ScreenSelectMusic::AfterMusicChange() case WheelItemDataType_Roulette: case WheelItemDataType_Random: case WheelItemDataType_Custom: - m_iSelection[PLAYER_1] = -1; + m_iSelection = -1; if (SAMPLE_MUSIC_PREVIEW_MODE == SampleMusicPreviewMode_LastSong) { // HACK: Make random music work in LastSong mode. -aj if (m_sSampleMusicToPlay == m_sRandomMusicPath) { @@ -1450,7 +1445,7 @@ ScreenSelectMusic::OpenOptionsList(PlayerNumber pn) { if (pn != PLAYER_INVALID) { m_MusicWheel.Move(0); - m_OptionsList[pn].Open(); + m_OptionsList.Open(); } } @@ -1463,7 +1458,7 @@ ScreenSelectMusic::can_open_options_list(PlayerNumber pn) if (pn >= NUM_PLAYERS) { return false; } - if (m_OptionsList[pn].IsOpened()) { + if (m_OptionsList.IsOpened()) { return false; } return true; @@ -1481,7 +1476,7 @@ ScreenSelectMusic::GeneratePreviewNoteField() if (m_pPreviewNoteField != nullptr) return; auto song = GAMESTATE->m_pCurSong; - Steps* steps = GAMESTATE->m_pCurSteps[PLAYER_1]; + Steps* steps = GAMESTATE->m_pCurSteps; if (song && steps) { steps->GetNoteData(m_PreviewNoteData); @@ -1497,7 +1492,7 @@ ScreenSelectMusic::GeneratePreviewNoteField() m_pPreviewNoteField->SetName( "NoteField"); // Use this to get the ActorFrame from the Screen Children - m_pPreviewNoteField->Init(GAMESTATE->m_pPlayerState[PLAYER_1], 100); + m_pPreviewNoteField->Init(GAMESTATE->m_pPlayerState, 100); m_pPreviewNoteField->Load(&m_PreviewNoteData, 0, 800); } @@ -1621,10 +1616,10 @@ class LunaScreenSelectMusic : public Luna noterows.empty()) { // if we have noterows from newer uploads, just // use them -mina GAMESTATE->SetProcessedTimingData( - GAMESTATE->m_pCurSteps[PLAYER_1]->GetTimingData()); - auto* td = GAMESTATE->m_pCurSteps[PLAYER_1]->GetTimingData(); + GAMESTATE->m_pCurSteps->GetTimingData()); + auto* td = GAMESTATE->m_pCurSteps->GetTimingData(); // vector ihatemylife; - auto nd = GAMESTATE->m_pCurSteps[PLAYER_1]->GetNoteData(); + auto nd = GAMESTATE->m_pCurSteps->GetNoteData(); auto nerv = nd.BuildAndGetNerv(); /* functionally dead code, may be removed -poco if (!hs->GetChordCohesion()) { @@ -1669,7 +1664,7 @@ class LunaScreenSelectMusic : public Luna PlayerAI::SetScoreData(hs); // prepare old mods to return to - const RString oldMods = GAMESTATE->m_pPlayerState[PLAYER_1] + const RString oldMods = GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .GetString(); @@ -1687,9 +1682,9 @@ class LunaScreenSelectMusic : public Luna /* CHECKPOINT_M("Setting mods for Replay Viewing."); RString mods = hs->GetModifiers(); - GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetSong().FromString(mods); - GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetCurrent().FromString(mods); - GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetPreferred().FromString(mods); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetSong().FromString(mods); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent().FromString(mods); + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred().FromString(mods); CHECKPOINT_M("Replay mods set."); */ @@ -1697,44 +1692,44 @@ class LunaScreenSelectMusic : public Luna // Also get ready to reset the turn mods to what they were before RString mods = hs->GetModifiers(); vector oldTurns; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .GetTurnMods(oldTurns); if (mods.find("Mirror") != mods.npos) { - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .m_bTurns[PlayerOptions::TURN_MIRROR] = true; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .m_bTurns[PlayerOptions::TURN_MIRROR] = true; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .m_bTurns[PlayerOptions::TURN_MIRROR] = true; } else { - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .m_bTurns[PlayerOptions::TURN_MIRROR] = false; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .m_bTurns[PlayerOptions::TURN_MIRROR] = false; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .m_bTurns[PlayerOptions::TURN_MIRROR] = false; } GAMEMAN->m_bResetTurns = true; GAMEMAN->m_vTurnsToReset = oldTurns; - GAMEMAN->m_iPreviousFail = GAMESTATE->m_pPlayerState[PLAYER_1] + GAMEMAN->m_iPreviousFail = GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .m_FailType; // REALLY BAD way to set fail off for a replay - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .m_FailType = FailType_Off; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetCurrent() .m_FailType = FailType_Off; - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetPreferred() .m_FailType = FailType_Off; @@ -1742,7 +1737,7 @@ class LunaScreenSelectMusic : public Luna LOG->Trace("Viewing replay for score key %s", hs->GetScoreKey().c_str()); GamePreferences::m_AutoPlay.Set(PC_REPLAY); - GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_REPLAY; + GAMESTATE->m_pPlayerState->m_PlayerController = PC_REPLAY; p->SelectCurrent(PLAYER_1); // set mods back to what they were before @@ -1766,7 +1761,7 @@ class LunaScreenSelectMusic : public Luna StageStats ss; RadarValues rv; NoteData nd; - Steps* steps = GAMESTATE->m_pCurSteps[PLAYER_1]; + Steps* steps = GAMESTATE->m_pCurSteps; steps->GetNoteData(nd); float songlength = GAMESTATE->m_pCurSong->m_fMusicLengthSeconds; ss.Init(); @@ -1776,7 +1771,7 @@ class LunaScreenSelectMusic : public Luna score->LoadReplayData(); PlayerAI::SetScoreData(score); - auto& pss = ss.m_player[0]; + auto& pss = ss.m_player; pss.m_HighScore = *score; pss.CurWifeScore = score->GetWifeScore(); pss.m_fWifeScore = score->GetWifeScore(); @@ -1788,7 +1783,7 @@ class LunaScreenSelectMusic : public Luna pss.m_iSongsPassed = 1; pss.m_iSongsPlayed = 1; GAMESTATE->SetProcessedTimingData( - GAMESTATE->m_pCurSteps[PLAYER_1]->GetTimingData()); + GAMESTATE->m_pCurSteps->GetTimingData()); NoteDataUtil::CalculateRadarValues(nd, songlength, rv); pss.m_radarPossible += rv; RadarValues realRV; @@ -1816,7 +1811,7 @@ class LunaScreenSelectMusic : public Luna GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate = scoreRate; MESSAGEMAN->Broadcast("RateChanged"); - GAMEMAN->m_iPreviousFail = GAMESTATE->m_pPlayerState[PLAYER_1] + GAMEMAN->m_iPreviousFail = GAMESTATE->m_pPlayerState ->m_PlayerOptions.GetSong() .m_FailType; @@ -1835,7 +1830,7 @@ class LunaScreenSelectMusic : public Luna // This will return the Preview Notefield if it is successful. static int CreatePreviewNoteField(T* p, lua_State* L) { - float helloiamafloat = GAMESTATE->m_pPlayerState[PLAYER_1] + float helloiamafloat = GAMESTATE->m_pPlayerState ->GetDisplayedPosition() .m_fMusicSeconds; p->GeneratePreviewNoteField(); @@ -1882,7 +1877,7 @@ class LunaScreenSelectMusic : public Luna static int GetPreviewNoteFieldMusicPosition(T* p, lua_State* L) { lua_pushnumber(L, - GAMESTATE->m_pPlayerState[PLAYER_1] + GAMESTATE->m_pPlayerState ->GetDisplayedPosition() .m_fMusicSeconds); return 1; diff --git a/src/ScreenSelectMusic.h b/src/ScreenSelectMusic.h index f767db763f..b1bd4f73d8 100644 --- a/src/ScreenSelectMusic.h +++ b/src/ScreenSelectMusic.h @@ -93,7 +93,7 @@ class ScreenSelectMusic : public ScreenWithMenuElements bool DetectCodes(const InputEventPlus& input); vector m_vpSteps; - int m_iSelection[NUM_PLAYERS]; + int m_iSelection; RageTimer m_timerIdleComment; ThemeMetric IDLE_COMMENT_SECONDS; @@ -154,18 +154,17 @@ class ScreenSelectMusic : public ScreenWithMenuElements RString m_sFallbackCDTitlePath; MusicWheel m_MusicWheel; - OptionsList m_OptionsList[NUM_PLAYERS]; + OptionsList m_OptionsList; SelectionState m_SelectionState; - bool - m_bStepsChosen[NUM_PLAYERS]; // only used in SelectionState_SelectingSteps + bool m_bStepsChosen; // only used in SelectionState_SelectingSteps bool m_bGoToOptions; RString m_sSampleMusicToPlay; TimingData* m_pSampleMusicTimingData; float m_fSampleStartSeconds, m_fSampleLengthSeconds; bool m_bAllowOptionsMenu, m_bAllowOptionsMenuRepeat; - bool m_bSelectIsDown[NUM_PLAYERS]; - bool m_bAcceptSelectRelease[NUM_PLAYERS]; + bool m_bSelectIsDown; + bool m_bAcceptSelectRelease; RageSound m_soundStart; RageSound m_soundDifficultyEasier; diff --git a/src/ScreenSelectProfile.cpp b/src/ScreenSelectProfile.cpp index c8fd923dc5..6271a315e0 100644 --- a/src/ScreenSelectProfile.cpp +++ b/src/ScreenSelectProfile.cpp @@ -11,7 +11,7 @@ void ScreenSelectProfile::Init() { // no selection initially - m_iSelectedProfiles[PLAYER_1] = -1; + m_iSelectedProfiles = -1; m_TrackingRepeatingInput = GameButton_Invalid; ScreenWithMenuElements::Init(); } @@ -132,11 +132,11 @@ ScreenSelectProfile::SetProfileIndex(PlayerNumber pn, int iProfileIndex) if (iProfileIndex == -2) { // GAMESTATE->UnjoinPlayer takes care of unloading the profile. GAMESTATE->UnjoinPlayer(pn); - m_iSelectedProfiles[pn] = -1; + m_iSelectedProfiles = -1; return true; } - m_iSelectedProfiles[pn] = iProfileIndex; + m_iSelectedProfiles = iProfileIndex; return true; } @@ -149,27 +149,27 @@ ScreenSelectProfile::Finish() // if profile indexes are the same for both players if (GAMESTATE->GetNumPlayersEnabled() == 2 && - m_iSelectedProfiles[0] == m_iSelectedProfiles[1] && - m_iSelectedProfiles[0] > 0) + m_iSelectedProfiles == m_iSelectedProfiles && + m_iSelectedProfiles > 0) return false; int iUsedLocalProfiles = 0; int iUnselectedProfiles = 0; // not all players has made their choices - if (GAMESTATE->IsHumanPlayer(PLAYER_1) && (m_iSelectedProfiles[PLAYER_1] == -1)) + if (GAMESTATE->IsHumanPlayer(PLAYER_1) && (m_iSelectedProfiles == -1)) iUnselectedProfiles++; // card not ready - if (m_iSelectedProfiles[PLAYER_1] == 0) + if (m_iSelectedProfiles == 0) return false; // profile index too big - if (m_iSelectedProfiles[PLAYER_1] > PROFILEMAN->GetNumLocalProfiles()) + if (m_iSelectedProfiles > PROFILEMAN->GetNumLocalProfiles()) return false; // inc used profile count - if (m_iSelectedProfiles[PLAYER_1] > 0) + if (m_iSelectedProfiles > 0) iUsedLocalProfiles++; // this allows to continue if there is less local profiles than number of @@ -181,9 +181,9 @@ ScreenSelectProfile::Finish() // all ok - load profiles and go to next screen PROFILEMAN->UnloadProfile(PLAYER_1); - if (m_iSelectedProfiles[PLAYER_1] > 0) { + if (m_iSelectedProfiles > 0) { PROFILEMAN->m_sDefaultLocalProfileID[PLAYER_1].Set( - PROFILEMAN->GetLocalProfileIDFromIndex(m_iSelectedProfiles[PLAYER_1] - 1)); + PROFILEMAN->GetLocalProfileIDFromIndex(m_iSelectedProfiles - 1)); PROFILEMAN->LoadLocalProfileFromMachine(PLAYER_1); GAMESTATE->LoadCurrentSettingsFromProfile(PLAYER_1); } diff --git a/src/ScreenSelectProfile.h b/src/ScreenSelectProfile.h index 23bb36e621..b4d79fad66 100644 --- a/src/ScreenSelectProfile.h +++ b/src/ScreenSelectProfile.h @@ -22,11 +22,11 @@ class ScreenSelectProfile : public ScreenWithMenuElements // Lua void PushSelf(lua_State* L) override; bool SetProfileIndex(PlayerNumber pn, int iProfileIndex); - int GetProfileIndex(PlayerNumber pn) { return m_iSelectedProfiles[pn]; } + int GetProfileIndex(PlayerNumber pn) { return m_iSelectedProfiles; } bool Finish(); protected: - int m_iSelectedProfiles[NUM_PLAYERS]; + int m_iSelectedProfiles; }; #endif diff --git a/src/ScreenSongOptions.cpp b/src/ScreenSongOptions.cpp index b3b69b4b0f..12faecf7ae 100644 --- a/src/ScreenSongOptions.cpp +++ b/src/ScreenSongOptions.cpp @@ -25,7 +25,7 @@ void ScreenSongOptions::ExportOptions(int iRow, const vector& vpns) { PlayerNumber pn = GAMESTATE->GetMasterPlayerNumber(); - PlayerState* pPS = GAMESTATE->m_pPlayerState[pn]; + PlayerState* pPS = GAMESTATE->m_pPlayerState; const FailType ft = pPS->m_PlayerOptions.GetPreferred().m_FailType; ScreenOptionsMaster::ExportOptions(iRow, vpns); diff --git a/src/ScreenSyncOverlay.cpp b/src/ScreenSyncOverlay.cpp index 751367fc91..972d55175d 100644 --- a/src/ScreenSyncOverlay.cpp +++ b/src/ScreenSyncOverlay.cpp @@ -213,11 +213,8 @@ ScreenSyncOverlay::Input(const InputEventPlus& input) // Release the lookup tables being used for the timing data because // changing the timing data invalidates them. -Kyz if (a != Action_Invalid) { - FOREACH_EnabledPlayer(pn) - { - if (GAMESTATE->m_pCurSteps[pn]) { - GAMESTATE->m_pCurSteps[pn]->GetTimingData()->ReleaseLookup(); - } + if (GAMESTATE->m_pCurSteps) { + GAMESTATE->m_pCurSteps->GetTimingData()->ReleaseLookup(); } } diff --git a/src/ScreenSystemLayer.cpp b/src/ScreenSystemLayer.cpp index b10e45f0f5..c378cbac31 100644 --- a/src/ScreenSystemLayer.cpp +++ b/src/ScreenSystemLayer.cpp @@ -44,7 +44,7 @@ GetCreditsMessage(PlayerNumber pn) SCREENMAN->GetTopScreen()->GetScreenType() == system_menu) bShowCreditsMessage = true; else - bShowCreditsMessage = !GAMESTATE->m_bSideIsJoined[pn]; + bShowCreditsMessage = !GAMESTATE->m_bSideIsJoined; if (!bShowCreditsMessage) { const Profile* pProfile = PROFILEMAN->GetProfile(pn); diff --git a/src/SongUtil.cpp b/src/SongUtil.cpp index d7d7425a61..21e4b6623f 100644 --- a/src/SongUtil.cpp +++ b/src/SongUtil.cpp @@ -854,7 +854,7 @@ bool SongUtil::ValidateCurrentEditStepsDescription(const RString& sAnswer, RString& sErrorOut) { - Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1]; + Steps* pSteps = GAMESTATE->m_pCurSteps; Song* pSong = pSteps->m_pSong; ASSERT(pSteps->IsAnEdit()); @@ -897,7 +897,7 @@ SongUtil::ValidateCurrentStepsDescription(const RString& sAnswer, /* Don't allow duplicate edit names within the same StepsType; edit names * uniquely identify the edit. */ - Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1]; + Steps* pSteps = GAMESTATE->m_pCurSteps; // If unchanged: if (pSteps->GetDescription() == sAnswer) @@ -926,7 +926,7 @@ SongUtil::ValidateCurrentStepsChartName(const RString& answer, RString& error) /* Don't allow duplicate title names within the same StepsType. * We need some way of identifying the unique charts. */ - Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1]; + Steps* pSteps = GAMESTATE->m_pCurSteps; if (pSteps->GetChartName() == answer) return true; @@ -949,7 +949,7 @@ SongUtil::ValidateCurrentStepsCredit(const RString& sAnswer, RString& sErrorOut) if (sAnswer.empty()) return true; - Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1]; + Steps* pSteps = GAMESTATE->m_pCurSteps; // If unchanged: if (pSteps->GetCredit() == sAnswer) return true; @@ -995,7 +995,7 @@ SongUtil::ValidateCurrentStepsMusic(const RString& answer, RString& error) { if (answer.empty()) return true; - Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1]; + Steps* pSteps = GAMESTATE->m_pCurSteps; RString real_file = pSteps->GetMusicFile(); pSteps->SetMusicFile(answer); RString path = pSteps->GetMusicPath(); diff --git a/src/StageStats.cpp b/src/StageStats.cpp index 97660ed3b9..91715a58e3 100644 --- a/src/StageStats.cpp +++ b/src/StageStats.cpp @@ -302,7 +302,7 @@ StageStats::StageStats() m_fGameplaySeconds = 0; m_fStepsSeconds = 0; m_fMusicRate = 1; - m_player[PLAYER_1].Init(PLAYER_1); + m_player.Init(PLAYER_1); FOREACH_MultiPlayer(pn) { m_multiPlayer[pn].Init(pn); } } @@ -317,23 +317,23 @@ StageStats::AssertValid(PlayerNumber pn) const { ASSERT(m_vpPlayedSongs.size() != 0); ASSERT(m_vpPossibleSongs.size() != 0); - ASSERT(m_player[pn].m_iStepsPlayed > 0); - ASSERT(m_player[pn].m_vpPossibleSteps.size() != 0); - ASSERT(m_player[pn].m_vpPossibleSteps[0] != NULL); + ASSERT(m_player.m_iStepsPlayed > 0); + ASSERT(m_player.m_vpPossibleSteps.size() != 0); + ASSERT(m_player.m_vpPossibleSteps[0] != NULL); ASSERT_M(m_playMode < NUM_PlayMode, ssprintf("playmode %i", m_playMode)); - ASSERT_M(m_player[pn].m_vpPossibleSteps[0]->GetDifficulty() < + ASSERT_M(m_player.m_vpPossibleSteps[0]->GetDifficulty() < NUM_Difficulty, ssprintf("Invalid Difficulty %i", - m_player[pn].m_vpPossibleSteps[0]->GetDifficulty())); - ASSERT_M((int)m_vpPlayedSongs.size() == m_player[pn].m_iStepsPlayed, + m_player.m_vpPossibleSteps[0]->GetDifficulty())); + ASSERT_M((int)m_vpPlayedSongs.size() == m_player.m_iStepsPlayed, ssprintf("%i Songs Played != %i Steps Played for player %i", (int)m_vpPlayedSongs.size(), - (int)m_player[pn].m_iStepsPlayed, + (int)m_player.m_iStepsPlayed, pn)); - ASSERT_M(m_vpPossibleSongs.size() == m_player[pn].m_vpPossibleSteps.size(), + ASSERT_M(m_vpPossibleSongs.size() == m_player.m_vpPossibleSteps.size(), ssprintf("%i Possible Songs != %i Possible Steps for player %i", (int)m_vpPossibleSongs.size(), - (int)m_player[pn].m_vpPossibleSteps.size(), + (int)m_player.m_vpPossibleSteps.size(), pn)); } @@ -345,12 +345,12 @@ StageStats::AssertValid(MultiPlayer pn) const ASSERT(m_multiPlayer[pn].m_vpPossibleSteps.size() != 0); ASSERT(m_multiPlayer[pn].m_vpPossibleSteps[0] != NULL); ASSERT_M(m_playMode < NUM_PlayMode, ssprintf("playmode %i", m_playMode)); - ASSERT_M(m_player[pn].m_vpPossibleSteps[0]->GetDifficulty() < + ASSERT_M(m_player.m_vpPossibleSteps[0]->GetDifficulty() < NUM_Difficulty, ssprintf("difficulty %i", - m_player[pn].m_vpPossibleSteps[0]->GetDifficulty())); - ASSERT((int)m_vpPlayedSongs.size() == m_player[pn].m_iStepsPlayed); - ASSERT(m_vpPossibleSongs.size() == m_player[pn].m_vpPossibleSteps.size()); + m_player.m_vpPossibleSteps[0]->GetDifficulty())); + ASSERT((int)m_vpPlayedSongs.size() == m_player.m_iStepsPlayed); + ASSERT(m_vpPossibleSongs.size() == m_player.m_vpPossibleSteps.size()); } int @@ -362,7 +362,7 @@ StageStats::GetAverageMeter(PlayerNumber pn) const int iTotalMeter = 0; for (unsigned i = 0; i < m_vpPlayedSongs.size(); i++) { - const Steps* pSteps = m_player[pn].m_vpPossibleSteps[i]; + const Steps* pSteps = m_player.m_vpPossibleSteps[i]; iTotalMeter += pSteps->GetMeter(); } return iTotalMeter / m_vpPlayedSongs.size(); // round down @@ -385,20 +385,20 @@ StageStats::AddStats(const StageStats& other) m_fGameplaySeconds += other.m_fGameplaySeconds; m_fStepsSeconds += other.m_fStepsSeconds; - FOREACH_EnabledPlayer(p) m_player[p].AddStats(other.m_player[p]); + m_player.AddStats(other.m_player); } bool StageStats::OnePassed() const { - FOREACH_EnabledPlayer(p) if (!m_player[p].m_bFailed) return true; + if (!m_player.m_bFailed) return true; return false; } bool StageStats::AllFailed() const { - FOREACH_EnabledPlayer(p) if (!m_player[p].m_bFailed) return false; + if (!m_player.m_bFailed) return false; return true; } @@ -418,7 +418,7 @@ DetermineScoreEligibility(const PlayerStageStats& pss, const PlayerState& ps) { // 4k only - if (GAMESTATE->m_pCurSteps[ps.m_PlayerNumber]->m_StepsType != + if (GAMESTATE->m_pCurSteps->m_StepsType != StepsType_dance_single) return false; @@ -509,7 +509,7 @@ FillInHighScore(const PlayerStageStats& pss, HighScore hs; hs.SetName(sRankingToFillInMarker); - auto chartKey = GAMESTATE->m_pCurSteps[ps.m_PlayerNumber]->GetChartKey(); + auto chartKey = GAMESTATE->m_pCurSteps->GetChartKey(); hs.SetChartKey(chartKey); hs.SetGrade(pss.GetGrade()); hs.SetMachineGuid(getSystemUniqueId()); @@ -604,8 +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() != "") { - m_player[PLAYER_1].m_iPersonalHighScoreIndex = 0; - m_player[PLAYER_1].m_iMachineHighScoreIndex = 0; + m_player.m_iPersonalHighScoreIndex = 0; + m_player.m_iMachineHighScoreIndex = 0; } // don't save scores if the player chose not to @@ -618,16 +618,13 @@ StageStats::FinalizeScores(bool bSummary) // whether or not to save scores when the stage was failed depends on if // this is a course or not... it's handled below in the switch. - FOREACH_HumanPlayer(p) - { - RString sPlayerGuid = PROFILEMAN->IsPersistentProfile(p) - ? PROFILEMAN->GetProfile(p)->m_sGuid - : RString(""); - m_player[p].m_HighScore = FillInHighScore(m_player[p], - *GAMESTATE->m_pPlayerState[p], - RANKING_TO_FILL_IN_MARKER[p], + RString sPlayerGuid = PROFILEMAN->IsPersistentProfile(PLAYER_1) + ? PROFILEMAN->GetProfile(PLAYER_1)->m_sGuid + : RString(""); + m_player.m_HighScore = FillInHighScore(m_player, + *GAMESTATE->m_pPlayerState, + RANKING_TO_FILL_IN_MARKER, sPlayerGuid); - } FOREACH_EnabledMultiPlayer(mp) { RString sPlayerGuid = "00000000-0000-0000-0000-000000000000"; // FIXME @@ -638,9 +635,9 @@ StageStats::FinalizeScores(bool bSummary) sPlayerGuid); } - HighScore& hs = m_player[PLAYER_1].m_HighScore; + HighScore& hs = m_player.m_HighScore; - const Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1]; + const Steps* pSteps = GAMESTATE->m_pCurSteps; ASSERT(pSteps != NULL); Profile* zzz = PROFILEMAN->GetProfile(PLAYER_1); @@ -672,20 +669,20 @@ StageStats::FinalizeScores(bool bSummary) auto steps = SONGMAN->GetStepsByChartkey(hs.GetChartKey()); auto td = steps->GetTimingData(); hs.timeStamps = td->ConvertReplayNoteRowsToTimestamps( - m_player[PLAYER_1].GetNoteRowVector(), hs.GetMusicRate()); + m_player.GetNoteRowVector(), hs.GetMusicRate()); DLMAN->UploadScoreWithReplayData(&hs); hs.timeStamps.clear(); hs.timeStamps.shrink_to_fit(); } if (NSMAN->isSMOnline) - NSMAN->ReportHighScore(&hs, m_player[PLAYER_1]); - if (m_player[PLAYER_1].m_fWifeScore > 0.f) { + NSMAN->ReportHighScore(&hs, m_player); + if (m_player.m_fWifeScore > 0.f) { bool writesuccess = hs.WriteReplayData(); if (writesuccess) hs.UnloadReplayData(); } - zzz->SetAnyAchievedGoals(GAMESTATE->m_pCurSteps[PLAYER_1]->GetChartKey(), + zzz->SetAnyAchievedGoals(GAMESTATE->m_pCurSteps->GetChartKey(), GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate, hs); mostrecentscorekey = hs.GetScoreKey(); @@ -705,7 +702,7 @@ unsigned int StageStats::GetMinimumMissCombo() const { unsigned int iMin = INT_MAX; - FOREACH_HumanPlayer(p) iMin = min(iMin, m_player[p].m_iCurMissCombo); + iMin = min(iMin, m_player.m_iCurMissCombo); return iMin; } @@ -718,7 +715,7 @@ class LunaStageStats : public Luna public: static int GetPlayerStageStats(T* p, lua_State* L) { - p->m_player[PLAYER_1].PushSelf(L); + p->m_player.PushSelf(L); return 1; } static int GetMultiPlayerStageStats(T* p, lua_State* L) diff --git a/src/StageStats.h b/src/StageStats.h index b6599755db..08763c0efd 100644 --- a/src/StageStats.h +++ b/src/StageStats.h @@ -64,7 +64,7 @@ class StageStats // Total number of seconds between first beat and last beat for every song. float GetTotalPossibleStepsSeconds() const; - PlayerStageStats m_player[NUM_PLAYERS]; + PlayerStageStats m_player; PlayerStageStats m_multiPlayer[NUM_MultiPlayer]; void FinalizeScores(bool bSummary); diff --git a/src/StatsManager.cpp b/src/StatsManager.cpp index 4256336661..58c04c1bc5 100644 --- a/src/StatsManager.cpp +++ b/src/StatsManager.cpp @@ -75,8 +75,8 @@ AccumPlayedStageStats(const vector& vss) FOREACH_EnabledPlayer(p) { for (int r = 0; r < RadarCategory_TapsAndHolds; r++) { - ssreturn.m_player[p].m_radarPossible[r] /= uNumSongs; - ssreturn.m_player[p].m_radarActual[r] /= uNumSongs; + ssreturn.m_player.m_radarPossible[r] /= uNumSongs; + ssreturn.m_player.m_radarActual[r] /= uNumSongs; } } FOREACH_EnabledMultiPlayer(p) @@ -127,19 +127,19 @@ StatsManager::CommitStatsToProfiles(const StageStats* pSS) FOREACH_HumanPlayer(pn) { int iNumTapsAndHolds = - (int)pSS->m_player[pn].m_radarActual[RadarCategory_TapsAndHolds]; + (int)pSS->m_player.m_radarActual[RadarCategory_TapsAndHolds]; int iNumJumps = - (int)pSS->m_player[pn].m_radarActual[RadarCategory_Jumps]; + (int)pSS->m_player.m_radarActual[RadarCategory_Jumps]; int iNumHolds = - (int)pSS->m_player[pn].m_radarActual[RadarCategory_Holds]; + (int)pSS->m_player.m_radarActual[RadarCategory_Holds]; int iNumRolls = - (int)pSS->m_player[pn].m_radarActual[RadarCategory_Rolls]; + (int)pSS->m_player.m_radarActual[RadarCategory_Rolls]; int iNumMines = - (int)pSS->m_player[pn].m_radarActual[RadarCategory_Mines]; + (int)pSS->m_player.m_radarActual[RadarCategory_Mines]; int iNumHands = - (int)pSS->m_player[pn].m_radarActual[RadarCategory_Hands]; + (int)pSS->m_player.m_radarActual[RadarCategory_Hands]; int iNumLifts = - (int)pSS->m_player[pn].m_radarActual[RadarCategory_Lifts]; + (int)pSS->m_player.m_radarActual[RadarCategory_Lifts]; PROFILEMAN->AddStepTotals(pn, iNumTapsAndHolds, iNumJumps, @@ -179,12 +179,12 @@ StatsManager::UnjoinPlayer(PlayerNumber pn) * purge any m_vPlayedStageStats that no longer have any player data because * all of the players that were playing at the time have been unjoined. */ FOREACH(StageStats, m_vPlayedStageStats, ss) - ss->m_player[pn] = PlayerStageStats(); + ss->m_player = PlayerStageStats(); for (int i = 0; i < (int)m_vPlayedStageStats.size(); ++i) { StageStats& ss = m_vPlayedStageStats[i]; bool bIsActive = false; - if (ss.m_player[PLAYER_1].m_bJoined) bIsActive = true; + if (ss.m_player.m_bJoined) bIsActive = true; FOREACH_MultiPlayer(mp) if (ss.m_multiPlayer[mp].m_bJoined) bIsActive = true; if (bIsActive) @@ -199,7 +199,7 @@ void StatsManager::GetStepsInUse(set& apInUseOut) const { for (int i = 0; i < (int)m_vPlayedStageStats.size(); ++i) { - const PlayerStageStats& pss = m_vPlayedStageStats[i].m_player[PLAYER_1]; + const PlayerStageStats& pss = m_vPlayedStageStats[i].m_player; apInUseOut.insert(pss.m_vpPossibleSteps.begin(), pss.m_vpPossibleSteps.end()); @@ -261,7 +261,7 @@ class LunaStatsManager : public Luna else { StageStats stats; p->GetFinalEvalStageStats(stats); - lua_pushnumber(L, stats.m_player[pn].GetGrade()); + lua_pushnumber(L, stats.m_player.GetGrade()); } return 1; } @@ -275,7 +275,7 @@ class LunaStatsManager : public Luna { Grade g = NUM_Grade; FOREACH_EnabledPlayer(pn) g = - min(g, STATSMAN->m_CurStageStats.m_player[pn].GetGrade()); + min(g, STATSMAN->m_CurStageStats.m_player.GetGrade()); lua_pushnumber(L, g); return 1; } @@ -284,7 +284,7 @@ class LunaStatsManager : public Luna { Grade g = Grade_Tier01; FOREACH_EnabledPlayer(pn) g = - max(g, STATSMAN->m_CurStageStats.m_player[pn].GetGrade()); + max(g, STATSMAN->m_CurStageStats.m_player.GetGrade()); lua_pushnumber(L, g); return 1; } @@ -300,7 +300,7 @@ class LunaStatsManager : public Luna bool bPlayerFailedOneStage = false; FOREACH_CONST(StageStats, STATSMAN->m_vPlayedStageStats, ss) { - if (ss->m_player[p].m_bFailed) { + if (ss->m_player.m_bFailed) { bPlayerFailedOneStage = true; break; } @@ -309,7 +309,7 @@ class LunaStatsManager : public Luna if (bPlayerFailedOneStage) continue; - top_grade = min(top_grade, stats.m_player[p].GetGrade()); + top_grade = min(top_grade, stats.m_player.GetGrade()); } Enum::Push(L, top_grade); diff --git a/src/StepsDisplay.cpp b/src/StepsDisplay.cpp index 5edef85dd7..209d6fcb5e 100644 --- a/src/StepsDisplay.cpp +++ b/src/StepsDisplay.cpp @@ -123,12 +123,12 @@ StepsDisplay::Load(const RString& sMetricsGroup, void StepsDisplay::SetFromGameState(PlayerNumber pn) { - const Steps* pSteps = GAMESTATE->m_pCurSteps[pn]; + const Steps* pSteps = GAMESTATE->m_pCurSteps; if (pSteps != nullptr) SetFromSteps(pSteps); else SetFromStepsTypeAndMeterAndDifficultyAndCourseType( - StepsType_Invalid, 0, GAMESTATE->m_PreferredDifficulty[pn]); + StepsType_Invalid, 0, GAMESTATE->m_PreferredDifficulty); } void diff --git a/src/Style.cpp b/src/Style.cpp index 8548479bdc..6bfee16f35 100644 --- a/src/Style.cpp +++ b/src/Style.cpp @@ -41,7 +41,7 @@ Style::GetTransformedNoteDataForStyle(PlayerNumber pn, int iNewToOriginalTrack[MAX_COLS_PER_PLAYER]; for (int col = 0; col < m_iColsPerPlayer; col++) { - ColumnInfo colInfo = m_ColumnInfo[pn][col]; + ColumnInfo colInfo = m_ColumnInfo[col]; iNewToOriginalTrack[col] = colInfo.track; } @@ -115,8 +115,8 @@ Style::GetMinAndMaxColX(PlayerNumber pn, float& fMixXOut, float& fMaxXOut) const fMixXOut = FLT_MAX; fMaxXOut = FLT_MIN; for (int i = 0; i < m_iColsPerPlayer; i++) { - fMixXOut = min(fMixXOut, m_ColumnInfo[pn][i].fXOffset); - fMaxXOut = max(fMaxXOut, m_ColumnInfo[pn][i].fXOffset); + fMixXOut = min(fMixXOut, m_ColumnInfo[i].fXOffset); + fMaxXOut = max(fMaxXOut, m_ColumnInfo[i].fXOffset); } } @@ -134,7 +134,7 @@ Style::GetWidth(PlayerNumber pn) const RString Style::ColToButtonName(int iCol) const { - const char* pzColumnName = m_ColumnInfo[PLAYER_1][iCol].pzName; + const char* pzColumnName = m_ColumnInfo[iCol].pzName; if (pzColumnName != NULL) return pzColumnName; @@ -187,9 +187,9 @@ class LunaStyle : public Luna