diff --git a/Themes/Til Death/metrics.ini b/Themes/Til Death/metrics.ini index 3d717dba15..227a904126 100644 --- a/Themes/Til Death/metrics.ini +++ b/Themes/Til Death/metrics.ini @@ -528,34 +528,7 @@ LifeP1X=50+128 LifeP1Y=10 LifeP1OnCommand=halign,0;draworder,101; -LifeP2X=SCREEN_WIDTH-50-128 -LifeP2Y=10 -LifeP2OnCommand=halign,1;zoomx,-1;draworder,101; - ScoreP1OnCommand=visible,false; -ScoreP2OnCommand=visible,false; - -# online scoreboard -# P1 is used when the only player is P2 -ScoreboardC1P1X=250 -ScoreboardC1P1Y=50 -ScoreboardC1P1OnCommand=zoom,0.4;strokecolor,Color("Outline");shadowlength,1 -ScoreboardC2P1X=190 -ScoreboardC2P1Y=50 -ScoreboardC2P1OnCommand=zoom,0.4;strokecolor,Color("Outline");shadowlength,1 -ScoreboardC3P1X=140 -ScoreboardC3P1Y=50 -ScoreboardC3P1OnCommand=zoom,0.4;strokecolor,Color("Outline");shadowlength,1 -# P2 is used when the only player is P1 -ScoreboardC1P2X=SCREEN_WIDTH-250 -ScoreboardC1P2Y=50 -ScoreboardC1P2OnCommand=zoom,0.4;strokecolor,Color("Outline");shadowlength,1 -ScoreboardC2P2X=SCREEN_WIDTH-190 -ScoreboardC2P2Y=50 -ScoreboardC2P2OnCommand=zoom,0.4;strokecolor,Color("Outline");shadowlength,1 -ScoreboardC3P2X=SCREEN_WIDTH-140 -ScoreboardC3P2Y=50 -ScoreboardC3P2OnCommand=zoom,0.4;strokecolor,Color("Outline");shadowlength,1 #From default [StreamDisplay] diff --git a/Themes/_fallback/base._ini b/Themes/_fallback/base._ini index 7835b2570d..6f6efb61cd 100644 --- a/Themes/_fallback/base._ini +++ b/Themes/_fallback/base._ini @@ -594,9 +594,6 @@ TimerSeconds=-1 UseAlternativeInput=false PlayerType="Player" PlayerInitCommand=y,SCREEN_CENTER_Y -StartGivesUp=true -BackGivesUp=false -FailOnMissCombo=-1 GivingUpGoesToPrevScreen=false GivingUpGoesToNextScreen=false InitialBackgroundBrightness=1 @@ -607,7 +604,6 @@ MusicFadeOutSeconds=0.5 OutTransitionLength=1.5 CourseTransitionLength=0.5 BeginFailedDelay=1.0 -AllowCenter1Player=true ScoreKeeperClass="ScoreKeeperNormal" SongBackgroundOnCommand= SongForegroundOnCommand= @@ -730,7 +726,6 @@ DebugOnCommand=wrapwidthpixels,SCREEN_WIDTH-50;strokecolor,color("#000000"); DebugOffCommand=stoptweening;linear,1/8;diffusealpha,0 SecondsBetweenComments=10 TickEarlySeconds=0.05 -ShowLifeMeterForDisabledPlayers=false PlayerP1OnCommand= PlayerP1OffCommand= PlayerP1OnePlayerOneSideX=math.floor(scale(0.25,0,1,SCREEN_LEFT,SCREEN_RIGHT)) diff --git a/Themes/_fallback/metrics.ini b/Themes/_fallback/metrics.ini index 5b36d14f96..1738b66e9d 100644 --- a/Themes/_fallback/metrics.ini +++ b/Themes/_fallback/metrics.ini @@ -2563,23 +2563,16 @@ NextScreen=Branch.AfterGameplay() PrevScreen=Branch.BackOutOfStageInformation() TimerSeconds=-1 # -ShowLifeMeterForDisabledPlayers=false InitialBackgroundBrightness=1.0 SecondsBetweenComments=10.0 ScoreKeeperClass=ScoreKeeperClass() -ForceImmediateFailForBattery=true TickEarlySeconds=0 # PlayerType="Player" # useful in some obscure situations where the theme resolution has been increased. PlayerInitCommand=y,SCREEN_CENTER_Y;zoom,(THEME:GetMetric("Common","ScreenHeight")/480) -StartGivesUp=true -BackGivesUp=false GiveUpSeconds=2.5 -# rage -AllowCenter1Player=true # -FailOnMissCombo=FailCombo() GivingUpGoesToPrevScreen=false GivingUpGoesToNextScreen=false SelectSkipsSong=true @@ -2614,60 +2607,18 @@ StepsDescriptionP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSid StepsDescriptionP1Y=SCREEN_CENTER_Y-24 StepsDescriptionP1OnCommand=visible,false StepsDescriptionP1OffCommand= -StepsDescriptionP2X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") -StepsDescriptionP2Y=SCREEN_CENTER_Y-24 -StepsDescriptionP2OnCommand=visible,false -StepsDescriptionP2OffCommand= # PlayerOptionsP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") PlayerOptionsP1Y=SCREEN_CENTER_Y+24 PlayerOptionsP1OnCommand=visible,false PlayerOptionsP1OffCommand= # -StepsDisplayP1X=SCREEN_CENTER_X-160 -StepsDisplayP1Y=SCREEN_BOTTOM-60 -StepsDisplayP1OnCommand=visible,false -StepsDisplayP1OffCommand= -# -SongOptionsX=SCREEN_CENTER_X -SongOptionsY=SCREEN_BOTTOM-32 -SongOptionsOnCommand=visible,false -SongOptionsOffCommand= -# DebugX=SCREEN_CENTER_X DebugY=SCREEN_BOTTOM-116 DebugOnCommand=zoom,0.75 DebugStartOnCommand=stoptweening;diffusealpha,0;sleep,0.2;linear,1/8;diffusealpha,1 DebugBackOnCommand=stoptweening;diffusealpha,0;linear,1/8;diffusealpha,1 DebugTweenOffCommand=stoptweening;linear,1/8;diffusealpha,0 -# -SongNumberFormat="%d" -SongNumberP1X=THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX") - 60 -SongNumberP1Y=SCREEN_TOP+24+7 -SongNumberP1OnCommand=visible,false -SongNumberP1OffCommand= - -# online scoreboard -# P1 is used when the only player is P2 -ScoreboardC1P1X=SCREEN_CENTER_X*0.25 -ScoreboardC1P1Y=SCREEN_CENTER_Y*0.45 -ScoreboardC1P1OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 -ScoreboardC2P1X=SCREEN_CENTER_X*0.5 -ScoreboardC2P1Y=SCREEN_CENTER_Y*0.45 -ScoreboardC2P1OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 -ScoreboardC3P1X=SCREEN_CENTER_X*0.75 -ScoreboardC3P1Y=SCREEN_CENTER_Y*0.45 -ScoreboardC3P1OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 -# P2 is used when the only player is P1 -ScoreboardC1P2X=SCREEN_CENTER_X*1.25 -ScoreboardC1P2Y=SCREEN_CENTER_Y*0.45 -ScoreboardC1P2OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 -ScoreboardC2P2X=SCREEN_CENTER_X*1.5 -ScoreboardC2P2Y=SCREEN_CENTER_Y*0.45 -ScoreboardC2P2OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 -ScoreboardC3P2X=SCREEN_CENTER_X*1.75 -ScoreboardC3P2Y=SCREEN_CENTER_Y*0.45 -ScoreboardC3P2OnCommand=zoom,0.825;strokecolor,Color("Outline");shadowlength,1 [ScreenEvaluation] Class="ScreenEvaluation" @@ -2882,22 +2833,15 @@ PrevScreen="ScreenOptionsInputSub" NextScreen="ScreenOptionsInputSub" PlayerType="PlayerSyncMachine" -#AllowCenter1Player=false SyncInfoOnCommand=x,PositionPerPlayer(GAMESTATE:GetMasterPlayerNumber(),SCREEN_CENTER_X+160,SCREEN_CENTER_X-160);y,SCREEN_CENTER_Y;zoom,0;decelerate,0.5;zoom,0.6 # hidden by default: LifeP1OnCommand=visible,false LifeP2OnCommand=visible,false ScoreP1OnCommand=visible,false -ScoreP2OnCommand=visible,false StageOnCommand=visible,false ScoreFrameOnCommand=visible,false LifeFrameOnCommand=visible,false -DifficultyP1OnCommand=visible,false -DifficultyP1ReverseOnCommand=visible,false -DifficultyP2OnCommand=visible,false -DifficultyP2ReverseOnCommand=visible,false -SongOptionsOnCommand=visible,false [PlayerSyncMachine] Fallback="Player" diff --git a/src/Etterna/Actor/Gameplay/ArrowEffects.cpp b/src/Etterna/Actor/Gameplay/ArrowEffects.cpp index d912276d5f..30d0c67cfa 100644 --- a/src/Etterna/Actor/Gameplay/ArrowEffects.cpp +++ b/src/Etterna/Actor/Gameplay/ArrowEffects.cpp @@ -137,167 +137,158 @@ ArrowEffects::Update() static float fLastTime = 0; float fTime = RageTimer::GetTimeSinceStartFast(); - FOREACH_EnabledPlayer(pn) - { - const Style* pStyle = GAMESTATE->GetCurrentStyle(pn); - const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo; - const SongPosition& position = GAMESTATE->m_bIsUsingStepTiming - ? GAMESTATE->m_pPlayerState->m_Position - : GAMESTATE->m_Position; - const float field_zoom = GAMESTATE->m_pPlayerState->m_NotefieldZoom; - const float* effects = - GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; + const Style* pStyle = GAMESTATE->GetCurrentStyle(PLAYER_1); + const Style::ColumnInfo* pCols = pStyle->m_ColumnInfo; + const SongPosition& position = GAMESTATE->m_bIsUsingStepTiming + ? GAMESTATE->m_pPlayerState->m_Position + : GAMESTATE->m_Position; + const float field_zoom = GAMESTATE->m_pPlayerState->m_NotefieldZoom; + const float* effects = + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent().m_fEffects; - PerPlayerData& data = g_EffectData; + PerPlayerData& data = g_EffectData; - if (!position.m_bFreeze || !position.m_bDelay) { - data.m_fExpandSeconds += fTime - fLastTime; - data.m_fExpandSeconds = fmodf(data.m_fExpandSeconds, PI * 2); - } + if (!position.m_bFreeze || !position.m_bDelay) { + data.m_fExpandSeconds += fTime - fLastTime; + data.m_fExpandSeconds = fmodf(data.m_fExpandSeconds, PI * 2); + } - // Update Tornado - if (effects[PlayerOptions::EFFECT_TORNADO] != 0) { - for (int iColNum = 0; iColNum < MAX_COLS_PER_PLAYER; ++iColNum) { - // TRICKY: Tornado is very unplayable in doubles, so use a - // smaller tornado width if there are many columns - - /* the below makes an assumption for dance mode. - * perhaps check if we are actually playing on singles without, - * say more than 6 columns. That would exclude IIDX, pop'n, and - * techno-8, all of which would be very hectic. - * certain non-singles modes (like halfdoubles 6cols) - * could possibly have tornado enabled. - * let's also take default resolution (640x480) into mind. -aj - */ - bool bWideField = pStyle->m_iColsPerPlayer > 4; - int iTornadoWidth = bWideField ? 2 : 3; - - int iStartCol = iColNum - iTornadoWidth; - int iEndCol = iColNum + iTornadoWidth; - CLAMP(iStartCol, 0, pStyle->m_iColsPerPlayer - 1); - CLAMP(iEndCol, 0, pStyle->m_iColsPerPlayer - 1); - - data.m_fMinTornadoX[iColNum] = FLT_MAX; - data.m_fMaxTornadoX[iColNum] = FLT_MIN; - - for (int i = iStartCol; i <= iEndCol; i++) { - data.m_fMinTornadoX[iColNum] = - min(data.m_fMinTornadoX[iColNum], - pCols[i].fXOffset * field_zoom); - data.m_fMaxTornadoX[iColNum] = - max(data.m_fMaxTornadoX[iColNum], - pCols[i].fXOffset * field_zoom); - } + // Update Tornado + if (effects[PlayerOptions::EFFECT_TORNADO] != 0) { + for (int iColNum = 0; iColNum < MAX_COLS_PER_PLAYER; ++iColNum) { + // TRICKY: Tornado is very unplayable in doubles, so use a + // smaller tornado width if there are many columns + + /* the below makes an assumption for dance mode. + * perhaps check if we are actually playing on singles without, + * say more than 6 columns. That would exclude IIDX, pop'n, and + * techno-8, all of which would be very hectic. + * certain non-singles modes (like halfdoubles 6cols) + * could possibly have tornado enabled. + * let's also take default resolution (640x480) into mind. -aj + */ + bool bWideField = pStyle->m_iColsPerPlayer > 4; + int iTornadoWidth = bWideField ? 2 : 3; + + int iStartCol = iColNum - iTornadoWidth; + int iEndCol = iColNum + iTornadoWidth; + CLAMP(iStartCol, 0, pStyle->m_iColsPerPlayer - 1); + CLAMP(iEndCol, 0, pStyle->m_iColsPerPlayer - 1); + + data.m_fMinTornadoX[iColNum] = FLT_MAX; + data.m_fMaxTornadoX[iColNum] = FLT_MIN; + + for (int i = iStartCol; i <= iEndCol; i++) { + data.m_fMinTornadoX[iColNum] = min( + data.m_fMinTornadoX[iColNum], pCols[i].fXOffset * field_zoom); + data.m_fMaxTornadoX[iColNum] = max( + data.m_fMaxTornadoX[iColNum], pCols[i].fXOffset * field_zoom); } } + } - // Update Invert - if (effects[PlayerOptions::EFFECT_INVERT] != 0) { - for (int iColNum = 0; iColNum < MAX_COLS_PER_PLAYER; ++iColNum) { - const int iNumCols = pStyle->m_iColsPerPlayer; - const int iNumSides = 1; - const int iNumColsPerSide = iNumCols / iNumSides; - const int iSideIndex = iColNum / iNumColsPerSide; - const int iColOnSide = iColNum % iNumColsPerSide; - - const int iColLeftOfMiddle = (iNumColsPerSide - 1) / 2; - const int iColRightOfMiddle = (iNumColsPerSide + 1) / 2; - - int iFirstColOnSide = -1; - int iLastColOnSide = -1; - if (iColOnSide <= iColLeftOfMiddle) { - iFirstColOnSide = 0; - iLastColOnSide = iColLeftOfMiddle; - } else if (iColOnSide >= iColRightOfMiddle) { - iFirstColOnSide = iColRightOfMiddle; - iLastColOnSide = iNumColsPerSide - 1; - } else { - iFirstColOnSide = iColOnSide / 2; - iLastColOnSide = iColOnSide / 2; - } - - // mirror - int iNewColOnSide; - if (iFirstColOnSide == iLastColOnSide) - iNewColOnSide = 0; - else - iNewColOnSide = SCALE(iColOnSide, - iFirstColOnSide, - iLastColOnSide, - iLastColOnSide, - iFirstColOnSide); - const int iNewCol = - iSideIndex * iNumColsPerSide + iNewColOnSide; - - const float fOldPixelOffset = pCols[iColNum].fXOffset; - const float fNewPixelOffset = pCols[iNewCol].fXOffset; - data.m_fInvertDistance[iColNum] = - fNewPixelOffset - fOldPixelOffset; + // Update Invert + if (effects[PlayerOptions::EFFECT_INVERT] != 0) { + for (int iColNum = 0; iColNum < MAX_COLS_PER_PLAYER; ++iColNum) { + const int iNumCols = pStyle->m_iColsPerPlayer; + const int iNumSides = 1; + const int iNumColsPerSide = iNumCols / iNumSides; + const int iSideIndex = iColNum / iNumColsPerSide; + const int iColOnSide = iColNum % iNumColsPerSide; + + const int iColLeftOfMiddle = (iNumColsPerSide - 1) / 2; + const int iColRightOfMiddle = (iNumColsPerSide + 1) / 2; + + int iFirstColOnSide = -1; + int iLastColOnSide = -1; + if (iColOnSide <= iColLeftOfMiddle) { + iFirstColOnSide = 0; + iLastColOnSide = iColLeftOfMiddle; + } else if (iColOnSide >= iColRightOfMiddle) { + iFirstColOnSide = iColRightOfMiddle; + iLastColOnSide = iNumColsPerSide - 1; + } else { + iFirstColOnSide = iColOnSide / 2; + iLastColOnSide = iColOnSide / 2; } - } - // Update Tipsy - if (effects[PlayerOptions::EFFECT_TIPSY] != 0) { - const float time = RageTimer::GetTimeSinceStartFast(); - const float time_times_timer = time * TIPSY_TIMER_FREQUENCY; - const float arrow_times_mag = ARROW_SIZE * TIPSY_ARROW_MAGNITUDE; - const float time_times_offset_timer = - time * TIPSY_OFFSET_TIMER_FREQUENCY; - const float arrow_times_offset_mag = - ARROW_SIZE * TIPSY_OFFSET_ARROW_MAGNITUDE; - for (int col = 0; col < MAX_COLS_PER_PLAYER; ++col) { - data.m_tipsy_result[col] = - RageFastCos(time_times_timer + - (col * TIPSY_COLUMN_FREQUENCY)) * - arrow_times_mag; - data.m_tipsy_offset_result[col] = - RageFastCos(time_times_offset_timer + - (col * TIPSY_OFFSET_COLUMN_FREQUENCY)) * - arrow_times_offset_mag; - } - } else { - for (float& col : data.m_tipsy_result) { - col = 0; - } + // mirror + int iNewColOnSide; + if (iFirstColOnSide == iLastColOnSide) + iNewColOnSide = 0; + else + iNewColOnSide = SCALE(iColOnSide, + iFirstColOnSide, + iLastColOnSide, + iLastColOnSide, + iFirstColOnSide); + const int iNewCol = iSideIndex * iNumColsPerSide + iNewColOnSide; + + const float fOldPixelOffset = pCols[iColNum].fXOffset; + const float fNewPixelOffset = pCols[iNewCol].fXOffset; + data.m_fInvertDistance[iColNum] = fNewPixelOffset - fOldPixelOffset; } + } - // Update Beat - if (effects[PlayerOptions::EFFECT_BEAT] != 0) { - do { - float fAccelTime = 0.2f, fTotalTime = 0.5f; - float fBeat = position.m_fSongBeatVisible + fAccelTime; - - const bool bEvenBeat = (static_cast(fBeat) % 2) != 0; - - data.m_fBeatFactor = 0; - if (fBeat < 0) - break; - - // -100.2 -> -0.2 -> 0.2 - fBeat -= truncf(fBeat); - fBeat += 1; - fBeat -= truncf(fBeat); - - if (fBeat >= fTotalTime) - break; - - if (fBeat < fAccelTime) { - data.m_fBeatFactor = - SCALE(fBeat, 0.0f, fAccelTime, 0.0f, 1.0f); - data.m_fBeatFactor *= data.m_fBeatFactor; - } else /* fBeat < fTotalTime */ { - data.m_fBeatFactor = - SCALE(fBeat, fAccelTime, fTotalTime, 1.0f, 0.0f); - data.m_fBeatFactor = - 1 - (1 - data.m_fBeatFactor) * (1 - data.m_fBeatFactor); - } - - if (bEvenBeat) - data.m_fBeatFactor *= -1; - data.m_fBeatFactor *= 20.0f; - } while (false); + // Update Tipsy + if (effects[PlayerOptions::EFFECT_TIPSY] != 0) { + const float time = RageTimer::GetTimeSinceStartFast(); + const float time_times_timer = time * TIPSY_TIMER_FREQUENCY; + const float arrow_times_mag = ARROW_SIZE * TIPSY_ARROW_MAGNITUDE; + const float time_times_offset_timer = + time * TIPSY_OFFSET_TIMER_FREQUENCY; + const float arrow_times_offset_mag = + ARROW_SIZE * TIPSY_OFFSET_ARROW_MAGNITUDE; + for (int col = 0; col < MAX_COLS_PER_PLAYER; ++col) { + data.m_tipsy_result[col] = + RageFastCos(time_times_timer + (col * TIPSY_COLUMN_FREQUENCY)) * + arrow_times_mag; + data.m_tipsy_offset_result[col] = + RageFastCos(time_times_offset_timer + + (col * TIPSY_OFFSET_COLUMN_FREQUENCY)) * + arrow_times_offset_mag; + } + } else { + for (float& col : data.m_tipsy_result) { + col = 0; } } + + // Update Beat + if (effects[PlayerOptions::EFFECT_BEAT] != 0) { + do { + float fAccelTime = 0.2f, fTotalTime = 0.5f; + float fBeat = position.m_fSongBeatVisible + fAccelTime; + + const bool bEvenBeat = (static_cast(fBeat) % 2) != 0; + + data.m_fBeatFactor = 0; + if (fBeat < 0) + break; + + // -100.2 -> -0.2 -> 0.2 + fBeat -= truncf(fBeat); + fBeat += 1; + fBeat -= truncf(fBeat); + + if (fBeat >= fTotalTime) + break; + + if (fBeat < fAccelTime) { + data.m_fBeatFactor = SCALE(fBeat, 0.0f, fAccelTime, 0.0f, 1.0f); + data.m_fBeatFactor *= data.m_fBeatFactor; + } else /* fBeat < fTotalTime */ { + data.m_fBeatFactor = + SCALE(fBeat, fAccelTime, fTotalTime, 1.0f, 0.0f); + data.m_fBeatFactor = + 1 - (1 - data.m_fBeatFactor) * (1 - data.m_fBeatFactor); + } + + if (bEvenBeat) + data.m_fBeatFactor *= -1; + data.m_fBeatFactor *= 20.0f; + } while (false); + } fLastTime = fTime; } diff --git a/src/Etterna/Actor/Gameplay/DancingCharacters.cpp b/src/Etterna/Actor/Gameplay/DancingCharacters.cpp index 29321adae1..aa12ed869b 100644 --- a/src/Etterna/Actor/Gameplay/DancingCharacters.cpp +++ b/src/Etterna/Actor/Gameplay/DancingCharacters.cpp @@ -66,7 +66,7 @@ DancingCharacters::DancingCharacters() std::string sCurrentAnim; sCurrentAnim = sCharacterDirectory + "2DIdle"; if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists + "/BGAnimation.ini")) // check 2D Idle BGAnim exists { m_bgIdle.Load(sCurrentAnim); m_bgIdle->SetXY(DC_X(p), DC_Y(p)); @@ -74,7 +74,7 @@ DancingCharacters::DancingCharacters() sCurrentAnim = sCharacterDirectory + "2DMiss"; if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists + "/BGAnimation.ini")) // check 2D Idle BGAnim exists { m_bgMiss.Load(sCurrentAnim); m_bgMiss->SetXY(DC_X(p), DC_Y(p)); @@ -82,7 +82,7 @@ DancingCharacters::DancingCharacters() sCurrentAnim = sCharacterDirectory + "2DGood"; if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists + "/BGAnimation.ini")) // check 2D Idle BGAnim exists { m_bgGood.Load(sCurrentAnim); m_bgGood->SetXY(DC_X(p), DC_Y(p)); @@ -90,7 +90,7 @@ DancingCharacters::DancingCharacters() sCurrentAnim = sCharacterDirectory + "2DGreat"; if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists + "/BGAnimation.ini")) // check 2D Idle BGAnim exists { m_bgGreat.Load(sCurrentAnim); m_bgGreat->SetXY(DC_X(p), DC_Y(p)); @@ -98,7 +98,7 @@ DancingCharacters::DancingCharacters() sCurrentAnim = sCharacterDirectory + "2DFever"; if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists + "/BGAnimation.ini")) // check 2D Idle BGAnim exists { m_bgFever.Load(sCurrentAnim); m_bgFever->SetXY(DC_X(p), DC_Y(p)); @@ -106,7 +106,7 @@ DancingCharacters::DancingCharacters() sCurrentAnim = sCharacterDirectory + "2DFail"; if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists + "/BGAnimation.ini")) // check 2D Idle BGAnim exists { m_bgFail.Load(sCurrentAnim); m_bgFail->SetXY(DC_X(p), DC_Y(p)); @@ -114,7 +114,7 @@ DancingCharacters::DancingCharacters() sCurrentAnim = sCharacterDirectory + "2DWin"; if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists + "/BGAnimation.ini")) // check 2D Idle BGAnim exists { m_bgWin.Load(sCurrentAnim); m_bgWin->SetXY(DC_X(p), DC_Y(p)); @@ -122,7 +122,7 @@ DancingCharacters::DancingCharacters() sCurrentAnim = sCharacterDirectory + "2DWinFever"; if (DoesFileExist(sCurrentAnim + - "/BGAnimation.ini")) // check 2D Idle BGAnim exists + "/BGAnimation.ini")) // check 2D Idle BGAnim exists { m_bgWinFever.Load(sCurrentAnim); m_bgWinFever->SetXY(DC_X(p), DC_Y(p)); @@ -135,14 +135,14 @@ DancingCharacters::DancingCharacters() m_pCharacter->LoadMilkshapeAscii(pChar->GetModelPath()); m_pCharacter->LoadMilkshapeAsciiBones("rest", - pChar->GetRestAnimationPath()); - m_pCharacter->LoadMilkshapeAsciiBones( - "warmup", pChar->GetWarmUpAnimationPath()); - m_pCharacter->LoadMilkshapeAsciiBones( - "dance", pChar->GetDanceAnimationPath()); + pChar->GetRestAnimationPath()); + m_pCharacter->LoadMilkshapeAsciiBones("warmup", + pChar->GetWarmUpAnimationPath()); + m_pCharacter->LoadMilkshapeAsciiBones("dance", + pChar->GetDanceAnimationPath()); m_pCharacter->SetCullMode(CULL_NONE); // many of the models floating - // around have the vertex order - // flipped + // around have the vertex order + // flipped m_pCharacter->RunCommands(pChar->m_cmdInit); } @@ -203,7 +203,7 @@ DancingCharacters::Update(float fDelta) bool bGameplayStarting = GAMESTATE->m_bGameplayLeadIn; if (!bWasGameplayStarting && bGameplayStarting) { if (GAMESTATE->IsPlayerEnabled(PLAYER_1)) - m_pCharacter->PlayAnimation("warmup"); + m_pCharacter->PlayAnimation("warmup"); } bWasGameplayStarting = bGameplayStarting; @@ -339,39 +339,32 @@ DancingCharacters::DrawPrimitives() DISPLAY->LoadLookAt(45, m_CameraPoint, m_LookAt, RageVector3(0, 1, 0)); - FOREACH_EnabledPlayer(p) - { - bool bFailed = STATSMAN->m_CurStageStats.m_player.m_bFailed; - bool bDanger = m_bDrawDangerLight; - - DISPLAY->SetLighting(true); - - RageColor ambient = bFailed - ? RageColor(0.2f, 0.1f, 0.1f, 1) - : (bDanger ? RageColor(0.4f, 0.1f, 0.1f, 1) - : RageColor(0.4f, 0.4f, 0.4f, 1)); - RageColor diffuse = bFailed - ? RageColor(0.4f, 0.1f, 0.1f, 1) - : (bDanger ? RageColor(0.8f, 0.1f, 0.1f, 1) - : RageColor(1, 0.95f, 0.925f, 1)); - RageColor specular = RageColor(0.8f, 0.8f, 0.8f, 1); - DISPLAY->SetLightDirectional( - 0, ambient, diffuse, specular, RageVector3(-3, -7.5f, +9)); - - if (PREFSMAN->m_bCelShadeModels) { - m_pCharacter->DrawCelShaded(); - - DISPLAY->SetLightOff(0); - DISPLAY->SetLighting(false); - continue; - } + bool bFailed = STATSMAN->m_CurStageStats.m_player.m_bFailed; + bool bDanger = m_bDrawDangerLight; + + DISPLAY->SetLighting(true); + + RageColor ambient = bFailed ? RageColor(0.2f, 0.1f, 0.1f, 1) + : (bDanger ? RageColor(0.4f, 0.1f, 0.1f, 1) + : RageColor(0.4f, 0.4f, 0.4f, 1)); + RageColor diffuse = bFailed ? RageColor(0.4f, 0.1f, 0.1f, 1) + : (bDanger ? RageColor(0.8f, 0.1f, 0.1f, 1) + : RageColor(1, 0.95f, 0.925f, 1)); + RageColor specular = RageColor(0.8f, 0.8f, 0.8f, 1); + DISPLAY->SetLightDirectional( + 0, ambient, diffuse, specular, RageVector3(-3, -7.5f, +9)); + + if (PREFSMAN->m_bCelShadeModels) { + m_pCharacter->DrawCelShaded(); + DISPLAY->SetLightOff(0); + DISPLAY->SetLighting(false); + } else { m_pCharacter->Draw(); DISPLAY->SetLightOff(0); DISPLAY->SetLighting(false); } - DISPLAY->CameraPopMatrix(); /* diff --git a/src/Etterna/Actor/Gameplay/NoteField.cpp b/src/Etterna/Actor/Gameplay/NoteField.cpp index 77103f23c7..cf125516d3 100644 --- a/src/Etterna/Actor/Gameplay/NoteField.cpp +++ b/src/Etterna/Actor/Gameplay/NoteField.cpp @@ -138,8 +138,10 @@ NoteField::UncacheNoteSkin(const RString& sNoteSkin_) void NoteField::CacheAllUsedNoteSkins() { - /* Cache all note skins that we might need for the whole song, course or battle - * play, so we don't have to load them later (such as between course songs). */ + /* Cache all note skins that we might need for the whole song, course or + * battle + * play, so we don't have to load them later (such as between course songs). + */ vector asSkinsLower; GAMESTATE->GetAllUsedNoteSkins(asSkinsLower); asSkinsLower.push_back( @@ -179,21 +181,17 @@ NoteField::CacheAllUsedNoteSkins() m_pCurDisplay = it->second; memset(m_pDisplays, 0, sizeof(m_pDisplays)); - FOREACH_EnabledPlayer(pn) - { - RString sNoteSkinLower = GAMESTATE->m_pPlayerState - ->m_PlayerOptions.GetCurrent() - .m_sNoteSkin; - NOTESKIN->ValidateNoteSkinName(sNoteSkinLower); - sNoteSkinLower.MakeLower(); - it = m_NoteDisplays.find(sNoteSkinLower); - ASSERT_M(it != m_NoteDisplays.end(), sNoteSkinLower); - m_pDisplays[pn] = it->second; - } + RString sNoteSkinLower = + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent().m_sNoteSkin; + NOTESKIN->ValidateNoteSkinName(sNoteSkinLower); + sNoteSkinLower.MakeLower(); + it = m_NoteDisplays.find(sNoteSkinLower); + ASSERT_M(it != m_NoteDisplays.end(), sNoteSkinLower); + m_pDisplays[PLAYER_1] = it->second; // I don't think this is needed? // It's done in Load -- Nick12 - //InitColumnRenderers(); + // InitColumnRenderers(); } void @@ -248,7 +246,6 @@ NoteField::Load(const NoteData* pNoteData, GAMESTATE->GetCurrentStyle(m_pPlayerState->m_PlayerNumber) ->m_iColsPerPlayer)); - ensure_note_displays_have_skin(); InitColumnRenderers(); } @@ -281,36 +278,32 @@ NoteField::ensure_note_displays_have_skin() if (it == m_NoteDisplays.end()) { CacheAllUsedNoteSkins(); it = m_NoteDisplays.find(sNoteSkinLower); - ASSERT_M(it != m_NoteDisplays.end(), - ssprintf("iterator != m_NoteDisplays.end() [sNoteSkinLower = %s]", - sNoteSkinLower.c_str())); + ASSERT_M( + it != m_NoteDisplays.end(), + ssprintf("iterator != m_NoteDisplays.end() [sNoteSkinLower = %s]", + sNoteSkinLower.c_str())); } memset(m_pDisplays, 0, sizeof(m_pDisplays)); - FOREACH_EnabledPlayer(pn) - { - sNoteSkinLower = GAMESTATE->m_pPlayerState - ->m_PlayerOptions.GetCurrent() - .m_sNoteSkin; + 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 - ->m_PlayerOptions.GetPreferred() - .m_sNoteSkin; + // XXX: Re-setup sNoteSkinLower. Unsure if inserting the skin again is + // needed. + if (sNoteSkinLower.empty()) { + sNoteSkinLower = + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred().m_sNoteSkin; - if (sNoteSkinLower.empty()) { - sNoteSkinLower = "default"; - } - m_NoteDisplays.insert( - pair(sNoteSkinLower, badIdea)); + if (sNoteSkinLower.empty()) { + sNoteSkinLower = "default"; } - - sNoteSkinLower.MakeLower(); - it = m_NoteDisplays.find(sNoteSkinLower); - ASSERT_M(it != m_NoteDisplays.end(), sNoteSkinLower); - m_pDisplays[pn] = it->second; + m_NoteDisplays.insert( + pair(sNoteSkinLower, badIdea)); } + + sNoteSkinLower.MakeLower(); + it = m_NoteDisplays.find(sNoteSkinLower); + ASSERT_M(it != m_NoteDisplays.end(), sNoteSkinLower); + m_pDisplays[PLAYER_1] = it->second; } void @@ -325,11 +318,8 @@ NoteField::InitColumnRenderers() GAMESTATE->GetCurrentStyle(m_pPlayerState->m_PlayerNumber) ->m_iColsPerPlayer); for (size_t ncr = 0; ncr < m_ColumnRenderers.size(); ++ncr) { - FOREACH_EnabledPlayer(pn) - { - m_ColumnRenderers[ncr].m_displays[pn] = - &(m_pDisplays[pn]->display[ncr]); - } + m_ColumnRenderers[ncr].m_displays[PLAYER_1] = + &(m_pDisplays[PLAYER_1]->display[ncr]); m_ColumnRenderers[ncr].m_displays[PLAYER_INVALID] = &(m_pCurDisplay->display[ncr]); m_ColumnRenderers[ncr].m_column = ncr; @@ -823,9 +813,8 @@ NoteField::DrawPrimitives() unsigned i = 0; // Draw beat bars - if( SHOW_BEAT_BARS && pTiming != NULL ) - { - const vector &tSigs = *segs[SEGMENT_TIME_SIG]; + if (SHOW_BEAT_BARS && pTiming != NULL) { + const vector& tSigs = *segs[SEGMENT_TIME_SIG]; int iMeasureIndex = 0; for (i = 0; i < tSigs.size(); i++) { const TimeSignatureSegment* ts = ToTimeSignature(tSigs[i]); @@ -864,9 +853,9 @@ NoteField::DrawPrimitives() } } - // Optimization is very important here because there are so many arrows to draw. - // Draw the arrows in order of column. This minimizes texture switches and - // lets us draw in big batches. + // Optimization is very important here because there are so many arrows to + // draw. Draw the arrows in order of column. This minimizes texture switches + // and lets us draw in big batches. const Style* pStyle = GAMESTATE->GetCurrentStyle(m_pPlayerState->m_PlayerNumber); diff --git a/src/Etterna/Actor/Gameplay/Player.cpp b/src/Etterna/Actor/Gameplay/Player.cpp index 0f011385cf..8628a74869 100644 --- a/src/Etterna/Actor/Gameplay/Player.cpp +++ b/src/Etterna/Actor/Gameplay/Player.cpp @@ -257,7 +257,6 @@ Player::Player(NoteData& nd, bool bVisibleParts) m_pLifeMeter = NULL; m_pPrimaryScoreKeeper = NULL; - m_pSecondaryScoreKeeper = NULL; m_pIterNeedsTapJudging = NULL; m_pIterNeedsHoldJudging = NULL; m_pIterUncrossedRows = NULL; @@ -299,8 +298,7 @@ Player::Init(const std::string& sType, PlayerState* pPlayerState, PlayerStageStats* pPlayerStageStats, LifeMeter* pLM, - ScoreKeeper* pPrimaryScoreKeeper, - ScoreKeeper* pSecondaryScoreKeeper) + ScoreKeeper* pPrimaryScoreKeeper) { GRAY_ARROWS_Y_STANDARD.Load(sType, "ReceptorArrowsYStandard"); @@ -330,30 +328,8 @@ Player::Init(const std::string& sType, TempCombo.SetName("Combo"); ActorUtil::LoadCommand(TempCombo, sType, "Transform"); - int iEnabledPlayerIndex = -1; - int iNumEnabledPlayers = 0; - if (GAMESTATE->m_bMultiplayer) { - FOREACH_EnabledMultiPlayer(p) - { - if (p == pPlayerState->m_mp) - iEnabledPlayerIndex = iNumEnabledPlayers; - iNumEnabledPlayers++; - } - } else { - FOREACH_EnabledPlayer(p) - { - if (p == pPlayerState->m_PlayerNumber) - iEnabledPlayerIndex = iNumEnabledPlayers; - iNumEnabledPlayers++; - } - } - - if (iNumEnabledPlayers == - 0) // hack for ScreenHowToPlay where no players are joined - { - iEnabledPlayerIndex = 0; - iNumEnabledPlayers = 1; - } + int iEnabledPlayerIndex = 0; + int iNumEnabledPlayers = 1; for (int i = 0; i < NUM_REVERSE; i++) { for (int j = 0; j < NUM_CENTERED; j++) { @@ -381,7 +357,6 @@ Player::Init(const std::string& sType, m_pPlayerStageStats = pPlayerStageStats; m_pLifeMeter = pLM; m_pPrimaryScoreKeeper = pPrimaryScoreKeeper; - m_pSecondaryScoreKeeper = pSecondaryScoreKeeper; m_iLastSeenCombo = 0; m_bSeenComboYet = false; @@ -1338,10 +1313,10 @@ Player::UpdateHoldNotes(int iSongRow, // give positive life in Step(), not here. // Decrease life - // Also clamp the roll decay window to the accepted "Judge 7" value for it. -poco + // Also clamp the roll decay window to the accepted "Judge 7" + // value for it. -poco fLife -= fDeltaTime / max(GetWindowSeconds(TW_Roll), 0.25f); - fLife = - max(fLife, 0); // clamp life + fLife = max(fLife, 0); // clamp life break; /* case TapNoteSubType_Mine: @@ -1360,9 +1335,6 @@ Player::UpdateHoldNotes(int iSongRow, if (m_pPrimaryScoreKeeper != nullptr) m_pPrimaryScoreKeeper->HandleHoldActiveSeconds( fSecondsActiveSinceLastUpdate); - if (m_pSecondaryScoreKeeper != nullptr) - m_pSecondaryScoreKeeper->HandleHoldActiveSeconds( - fSecondsActiveSinceLastUpdate); } // check for LetGo. If the head was missed completely, don't count an LetGo. @@ -1879,8 +1851,6 @@ Player::DoTapScoreNone() * avoided mines here. */ if (m_pPrimaryScoreKeeper != nullptr) m_pPrimaryScoreKeeper->HandleTapScoreNone(); - if (m_pSecondaryScoreKeeper != nullptr) - m_pSecondaryScoreKeeper->HandleTapScoreNone(); SendComboMessages(iOldCombo, iOldMissCombo); @@ -3226,16 +3196,15 @@ Player::UpdateTapNotesMissedOlderThan(float fMissIfOlderThanSeconds) * scores for avoided mines here. */ if (m_pPrimaryScoreKeeper) m_pPrimaryScoreKeeper->HandleTapScore(tn); - if (m_pSecondaryScoreKeeper) - m_pSecondaryScoreKeeper->HandleTapScore(tn); } else { tn.result.tns = TNS_Miss; // avoid scoring notes that get passed when seeking in pm // not sure how many rows grace time is needed (if any?) if (GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent() - .m_bPractice && iMissIfOlderThanThisRow - iter.Row() > 8) - tn.result.tns = TNS_None; + .m_bPractice && + iMissIfOlderThanThisRow - iter.Row() > 8) + tn.result.tns = TNS_None; if (GAMESTATE->CountNotesSeparately()) { SetJudgment(iter.Row(), iter.Track(), tn); HandleTapRowScore(iter.Row()); @@ -3344,8 +3313,6 @@ Player::UpdateJudgedRows(float fDeltaTime) // Make sure hit mines affect the dance points. if (m_pPrimaryScoreKeeper) m_pPrimaryScoreKeeper->HandleTapScore(tn); - if (m_pSecondaryScoreKeeper) - m_pSecondaryScoreKeeper->HandleTapScore(tn); tn.result.bHidden = true; } // If we hit the end of the loop, m_pIterUnjudgedMineRows needs to be @@ -3393,14 +3360,10 @@ Player::HandleTapRowScore(unsigned row) continue; if (m_pPrimaryScoreKeeper != nullptr) m_pPrimaryScoreKeeper->HandleTapScore(tn); - if (m_pSecondaryScoreKeeper != nullptr) - m_pSecondaryScoreKeeper->HandleTapScore(tn); } if (m_pPrimaryScoreKeeper != NULL) m_pPrimaryScoreKeeper->HandleTapRowScore(m_NoteData, row); - if (m_pSecondaryScoreKeeper != NULL) - m_pSecondaryScoreKeeper->HandleTapRowScore(m_NoteData, row); const unsigned int iCurCombo = m_pPlayerStageStats != nullptr ? m_pPlayerStageStats->m_iCurCombo : 0; @@ -3482,9 +3445,6 @@ Player::HandleHoldCheckpoint(int iRow, if (m_pPrimaryScoreKeeper != nullptr) m_pPrimaryScoreKeeper->HandleHoldCheckpointScore( m_NoteData, iRow, iNumHoldsHeldThisRow, iNumHoldsMissedThisRow); - if (m_pSecondaryScoreKeeper != nullptr) - m_pSecondaryScoreKeeper->HandleHoldCheckpointScore( - m_NoteData, iRow, iNumHoldsHeldThisRow, iNumHoldsMissedThisRow); if (iNumHoldsMissedThisRow == 0) { // added for http://ssc.ajworld.net/sm-ssc/bugtracker/view.php?id=16 -aj @@ -3536,8 +3496,6 @@ Player::HandleHoldScore(const TapNote& tn) if (m_pPrimaryScoreKeeper != nullptr) m_pPrimaryScoreKeeper->HandleHoldScore(tn); - if (m_pSecondaryScoreKeeper != nullptr) - m_pSecondaryScoreKeeper->HandleHoldScore(tn); ChangeLife(holdScore, tapScore); } diff --git a/src/Etterna/Actor/Gameplay/Player.h b/src/Etterna/Actor/Gameplay/Player.h index 91c43efc08..21e1fc0ae9 100644 --- a/src/Etterna/Actor/Gameplay/Player.h +++ b/src/Etterna/Actor/Gameplay/Player.h @@ -86,8 +86,7 @@ class Player : public ActorFrame PlayerState* pPlayerState, PlayerStageStats* pPlayerStageStats, LifeMeter* pLM, - ScoreKeeper* pPrimaryScoreKeeper, - ScoreKeeper* pSecondaryScoreKeeper); + ScoreKeeper* pPrimaryScoreKeeper); void Load(); void CrossedRows(int iLastRowCrossed, const std::chrono::steady_clock::time_point& now); @@ -252,7 +251,6 @@ class Player : public ActorFrame TapNoteScore m_LastTapNoteScore; LifeMeter* m_pLifeMeter; ScoreKeeper* m_pPrimaryScoreKeeper; - ScoreKeeper* m_pSecondaryScoreKeeper; int m_iFirstUncrossedRow; // used by hold checkpoints logic NoteData::all_tracks_iterator* m_pIterNeedsTapJudging; diff --git a/src/Etterna/Actor/Menus/MusicWheelItem.cpp b/src/Etterna/Actor/Menus/MusicWheelItem.cpp index 06d2117e07..e65d725a86 100644 --- a/src/Etterna/Actor/Menus/MusicWheelItem.cpp +++ b/src/Etterna/Actor/Menus/MusicWheelItem.cpp @@ -91,7 +91,7 @@ MusicWheelItem::MusicWheelItem(RString sType) m_pGradeDisplay.Load(THEME->GetPathG(sType, "grades")); m_pGradeDisplay->SetName( - ssprintf("GradeP%d", static_cast(PLAYER_1 + 1))); + ssprintf("GradeP%d", static_cast(PLAYER_1 + 1))); this->AddChild(m_pGradeDisplay); LOAD_ALL_COMMANDS_AND_SET_XY(m_pGradeDisplay); @@ -137,7 +137,6 @@ MusicWheelItem::MusicWheelItem(const MusicWheelItem& cpy) m_pGradeDisplay = cpy.m_pGradeDisplay; this->AddChild(m_pGradeDisplay); - } MusicWheelItem::~MusicWheelItem() @@ -266,88 +265,85 @@ MusicWheelItem::RefreshGrades() if (pWID == NULL) return; // LoadFromWheelItemData() hasn't been called yet. - FOREACH_HumanPlayer(p) - { - m_pGradeDisplay->SetVisible(false); - - if (pWID->m_pSong == NULL) - continue; - - Difficulty dc; - if (GAMESTATE->m_pCurSteps) - dc = GAMESTATE->m_pCurSteps->GetDifficulty(); - else - dc = GAMESTATE->m_PreferredDifficulty; - - ProfileSlot ps; - if (PROFILEMAN->IsPersistentProfile(p)) - ps = static_cast(p); - else - continue; + m_pGradeDisplay->SetVisible(false); - StepsType st; - if (GAMESTATE->m_pCurSteps) - st = GAMESTATE->m_pCurSteps->m_StepsType; - else - st = GAMESTATE->GetCurrentStyle(PLAYER_INVALID)->m_StepsType; - - m_pGradeDisplay->SetVisible(true); - - HighScoreList* BestpHSL = NULL; - Grade gradeBest = Grade_Invalid; - Difficulty dcBest = Difficulty_Invalid; - if (PROFILEMAN->IsPersistentProfile(ps)) { - if (pWID->m_pSong != nullptr) { - bool hasCurrentStyleSteps = false; - FOREACH_ENUM_N(Difficulty, 6, i) - { - Steps* pSteps = - SongUtil::GetStepsByDifficulty(pWID->m_pSong, st, i); - if (pSteps != NULL) { - hasCurrentStyleSteps = true; - Grade dcg = - SCOREMAN->GetBestGradeFor(pSteps->GetChartKey()); - if (gradeBest >= dcg) { - dcBest = i; - gradeBest = dcg; - } + if (pWID->m_pSong == NULL) + return; + + Difficulty dc; + if (GAMESTATE->m_pCurSteps) + dc = GAMESTATE->m_pCurSteps->GetDifficulty(); + else + dc = GAMESTATE->m_PreferredDifficulty; + + ProfileSlot ps; + if (PROFILEMAN->IsPersistentProfile(PLAYER_1)) + ps = static_cast(PLAYER_1); + else + return; + + StepsType st; + if (GAMESTATE->m_pCurSteps) + st = GAMESTATE->m_pCurSteps->m_StepsType; + else + st = GAMESTATE->GetCurrentStyle(PLAYER_INVALID)->m_StepsType; + + m_pGradeDisplay->SetVisible(true); + + HighScoreList* BestpHSL = NULL; + Grade gradeBest = Grade_Invalid; + Difficulty dcBest = Difficulty_Invalid; + if (PROFILEMAN->IsPersistentProfile(ps)) { + if (pWID->m_pSong != nullptr) { + bool hasCurrentStyleSteps = false; + FOREACH_ENUM_N(Difficulty, 6, i) + { + Steps* pSteps = + SongUtil::GetStepsByDifficulty(pWID->m_pSong, st, i); + if (pSteps != NULL) { + hasCurrentStyleSteps = true; + Grade dcg = + SCOREMAN->GetBestGradeFor(pSteps->GetChartKey()); + if (gradeBest >= dcg) { + dcBest = i; + gradeBest = dcg; } } - // If no grade was found for the current style/stepstype - if (!hasCurrentStyleSteps) { - // Get the best grade among all steps - auto& allSteps = pWID->m_pSong->GetAllSteps(); - for (auto& stepsPtr : allSteps) { - if (stepsPtr->m_StepsType == - st) // Skip already checked steps of type st - continue; - Grade dcg = - SCOREMAN->GetBestGradeFor(stepsPtr->GetChartKey()); - if (gradeBest >= dcg) { - dcBest = stepsPtr->GetDifficulty(); - gradeBest = dcg; - } + } + // If no grade was found for the current style/stepstype + if (!hasCurrentStyleSteps) { + // Get the best grade among all steps + auto& allSteps = pWID->m_pSong->GetAllSteps(); + for (auto& stepsPtr : allSteps) { + if (stepsPtr->m_StepsType == + st) // Skip already checked steps of type st + continue; + Grade dcg = + SCOREMAN->GetBestGradeFor(stepsPtr->GetChartKey()); + if (gradeBest >= dcg) { + dcBest = stepsPtr->GetDifficulty(); + gradeBest = dcg; } } } } + } - // still needs cleaning up -mina - Message msg("SetGrade"); - msg.SetParam("PlayerNumber", p); - if (pWID->m_pSong->IsFavorited()) - msg.SetParam("Favorited", 1); - if (pWID->m_pSong->IsPermaMirror()) - msg.SetParam("PermaMirror", 1); - if (pWID->m_pSong->HasGoal()) - msg.SetParam("HasGoal", 1); - if (gradeBest != Grade_Invalid || (BestpHSL != nullptr)) { - msg.SetParam("Grade", gradeBest); - msg.SetParam("Difficulty", DifficultyToString(dcBest)); - msg.SetParam("NumTimesPlayed", 0); - } - m_pGradeDisplay->HandleMessage(msg); + // still needs cleaning up -mina + Message msg("SetGrade"); + msg.SetParam("PlayerNumber", PLAYER_1); + if (pWID->m_pSong->IsFavorited()) + msg.SetParam("Favorited", 1); + if (pWID->m_pSong->IsPermaMirror()) + msg.SetParam("PermaMirror", 1); + if (pWID->m_pSong->HasGoal()) + msg.SetParam("HasGoal", 1); + if (gradeBest != Grade_Invalid || (BestpHSL != nullptr)) { + msg.SetParam("Grade", gradeBest); + msg.SetParam("Difficulty", DifficultyToString(dcBest)); + msg.SetParam("NumTimesPlayed", 0); } + m_pGradeDisplay->HandleMessage(msg); } void diff --git a/src/Etterna/Actor/Menus/OptionRow.cpp b/src/Etterna/Actor/Menus/OptionRow.cpp index c235d35d9e..181647b7f3 100644 --- a/src/Etterna/Actor/Menus/OptionRow.cpp +++ b/src/Etterna/Actor/Menus/OptionRow.cpp @@ -104,8 +104,8 @@ OptionRowType::Load(const RString& sMetricsGroup, Actor* pParent) ActorUtil::LoadAllCommands(m_textItem, sMetricsGroup); if (SHOW_UNDERLINES) { - m_Underline.Load( - "OptionsUnderline" + PlayerNumberToString(PLAYER_1), false); + m_Underline.Load("OptionsUnderline" + PlayerNumberToString(PLAYER_1), + false); } m_textTitle.LoadFromFont(THEME->GetPathF(sMetricsGroup, "title")); @@ -245,8 +245,7 @@ OptionRow::InitText(RowType type) if (m_pParentType->SHOW_MOD_ICONS) { switch (m_RowType) { - case RowType_Normal: - { + case RowType_Normal: { m_ModIcons = new ModIcon(m_pParentType->m_ModIcon); m_ModIcons->SetDrawOrder(-1); // under title m_ModIcons->PlayCommand("On"); @@ -315,7 +314,7 @@ OptionRow::InitText(RowType type) if (m_pParentType->SHOW_UNDERLINES && GetRowType() != OptionRow::RowType_Exit) { OptionsCursor* pCursor = - new OptionsCursor(m_pParentType->m_Underline); + new OptionsCursor(m_pParentType->m_Underline); m_Underline.push_back(pCursor); int iWidth, iX, iY; @@ -346,7 +345,7 @@ OptionRow::InitText(RowType type) // init underlines if (m_pParentType->SHOW_UNDERLINES) { OptionsCursor* ul = - new OptionsCursor(m_pParentType->m_Underline); + new OptionsCursor(m_pParentType->m_Underline); m_Underline.push_back(ul); ul->SetX(fX); ul->SetBarWidth(static_cast(fItemWidth)); @@ -364,7 +363,7 @@ 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.size(); c++) - m_Frame.AddChild(m_Underline[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. @@ -463,12 +462,10 @@ OptionRow::PositionUnderlines(PlayerNumber pn) // only set alpha, in case a theme tries to color underlines. -aj ul.SetDiffuseAlpha(fAlpha); - ASSERT(m_vbSelected.size() == - m_pHand->m_Def.m_vsChoices.size()); + ASSERT(m_vbSelected.size() == m_pHand->m_Def.m_vsChoices.size()); - bool bSelected = (iChoiceWithFocus == -1) - ? false - : m_vbSelected[iChoiceWithFocus]; + bool bSelected = + (iChoiceWithFocus == -1) ? false : m_vbSelected[iChoiceWithFocus]; bool bVisible = bSelected && GAMESTATE->IsHumanPlayer(pn); ul.BeginTweening(m_pParentType->TWEEN_SECONDS); @@ -570,9 +567,9 @@ OptionRow::UpdateEnabledDisabled() } // Logically dead code - //if (bThisItemHasFocusByAny) + // if (bThisItemHasFocusByAny) // m_textItems[j]->PlayCommand("GainFocus"); - //else + // else m_textItems[j]->PlayCommand("LoseFocus"); } @@ -589,22 +586,19 @@ OptionRow::UpdateEnabledDisabled() break; case LAYOUT_SHOW_ONE_IN_ROW: - FOREACH_HumanPlayer(pn) - { - bRowEnabled = m_pHand->m_Def.m_vEnabledForPlayers.find(pn) != - m_pHand->m_Def.m_vEnabledForPlayers.end(); - - if (!m_pHand->m_Def.m_bOneChoiceForAllPlayers) { - if (m_bRowHasFocus) - color = m_pParentType->COLOR_SELECTED; - else if (bRowEnabled) - color = m_pParentType->COLOR_NOT_SELECTED; - else - color = m_pParentType->COLOR_DISABLED; - } + bRowEnabled = m_pHand->m_Def.m_vEnabledForPlayers.find(PLAYER_1) != + m_pHand->m_Def.m_vEnabledForPlayers.end(); - unsigned item_no = - m_pHand->m_Def.m_bOneChoiceForAllPlayers ? 0 : pn; + if (!m_pHand->m_Def.m_bOneChoiceForAllPlayers) { + if (m_bRowHasFocus) + color = m_pParentType->COLOR_SELECTED; + else if (bRowEnabled) + color = m_pParentType->COLOR_NOT_SELECTED; + else + color = m_pParentType->COLOR_DISABLED; + } + { + unsigned item_no = 0; // If player_no is 2 and there is no player 1: item_no = min(item_no, m_textItems.size() - 1); @@ -844,13 +838,13 @@ OptionRow::Reload() ChoicesChanged(m_RowType); ImportOptions(PLAYER_1); - FOREACH_HumanPlayer(p) AfterImportOptions(p); + AfterImportOptions(PLAYER_1); // fall through } case OptionRowHandler::RELOAD_CHANGED_ENABLED: UpdateEnabledDisabled(); - FOREACH_HumanPlayer(pn) PositionUnderlines(pn); + PositionUnderlines(PLAYER_1); break; } @@ -906,12 +900,11 @@ OptionRow::ImportOptions(const PlayerNumber& vpns) INSERT_ONE_BOOL_AT_FRONT_IF_NEEDED(m_vbSelected); VerifySelected( - m_pHand->m_Def.m_selectType, m_vbSelected, m_pHand->m_Def.m_sName); + m_pHand->m_Def.m_selectType, m_vbSelected, m_pHand->m_Def.m_sName); } int -OptionRow::ExportOptions(const PlayerNumber& vpns, - bool bRowHasFocus) +OptionRow::ExportOptions(const PlayerNumber& vpns, bool bRowHasFocus) { ASSERT(m_pHand->m_Def.m_vsChoices.size() > 0); @@ -921,7 +914,7 @@ OptionRow::ExportOptions(const PlayerNumber& vpns, bool bFocus = bRowHasFocus; VerifySelected( - m_pHand->m_Def.m_selectType, m_vbSelected, m_pHand->m_Def.m_sName); + 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); @@ -950,8 +943,7 @@ class LunaOptionRow : public Luna DEFINE_METHOD(FirstItemGoesDown, GetFirstItemGoesDown()) static int GetChoiceInRowWithFocus(T* p, lua_State* L) { - lua_pushnumber( - L, p->GetChoiceInRowWithFocus()); + lua_pushnumber(L, p->GetChoiceInRowWithFocus()); return 1; } DEFINE_METHOD(GetLayoutType, GetHandler()->m_Def.m_layoutType) diff --git a/src/Etterna/Globals/StepMania.cpp b/src/Etterna/Globals/StepMania.cpp index 517602ed29..e9f34f4ad0 100644 --- a/src/Etterna/Globals/StepMania.cpp +++ b/src/Etterna/Globals/StepMania.cpp @@ -282,28 +282,28 @@ ShutdownGame() SAFE_DELETE(NSMAN); /* Delete INPUTMAN before the other INPUTFILTER handlers, or an input * driver may try to send a message to INPUTFILTER after we delete it. */ - SAFE_DELETE( INPUTMAN ); - SAFE_DELETE( INPUTQUEUE ); - SAFE_DELETE( INPUTMAPPER ); - SAFE_DELETE( INPUTFILTER ); - SAFE_DELETE( MODELMAN ); - SAFE_DELETE( PROFILEMAN ); // PROFILEMAN needs the songs still loaded - SAFE_DELETE( CHARMAN ); - SAFE_DELETE( CRYPTMAN ); - SAFE_DELETE( SONGMAN ); - SAFE_DELETE( IMAGECACHE ); - SAFE_DELETE( SONGINDEX ); - SAFE_DELETE( SOUND ); // uses GAMESTATE, PREFSMAN - SAFE_DELETE( PREFSMAN ); - SAFE_DELETE( GAMESTATE ); - SAFE_DELETE( GAMEMAN ); - SAFE_DELETE( NOTESKIN ); - SAFE_DELETE( THEME ); - SAFE_DELETE( ANNOUNCER ); - SAFE_DELETE( SOUNDMAN ); - SAFE_DELETE( FONT ); - SAFE_DELETE( TEXTUREMAN ); - SAFE_DELETE( DISPLAY ); + SAFE_DELETE(INPUTMAN); + SAFE_DELETE(INPUTQUEUE); + SAFE_DELETE(INPUTMAPPER); + SAFE_DELETE(INPUTFILTER); + SAFE_DELETE(MODELMAN); + SAFE_DELETE(PROFILEMAN); // PROFILEMAN needs the songs still loaded + SAFE_DELETE(CHARMAN); + SAFE_DELETE(CRYPTMAN); + SAFE_DELETE(SONGMAN); + SAFE_DELETE(IMAGECACHE); + SAFE_DELETE(SONGINDEX); + SAFE_DELETE(SOUND); // uses GAMESTATE, PREFSMAN + SAFE_DELETE(PREFSMAN); + SAFE_DELETE(GAMESTATE); + SAFE_DELETE(GAMEMAN); + SAFE_DELETE(NOTESKIN); + SAFE_DELETE(THEME); + SAFE_DELETE(ANNOUNCER); + SAFE_DELETE(SOUNDMAN); + SAFE_DELETE(FONT); + SAFE_DELETE(TEXTUREMAN); + SAFE_DELETE(DISPLAY); Dialog::Shutdown(); SAFE_DELETE(LOG); DLMAN.reset(); @@ -1212,7 +1212,7 @@ sm_main(int argc, char* argv[]) CRYPTMAN = new CryptManager; // need to do this before ProfileMan if (PREFSMAN->m_bSignProfileData) CRYPTMAN->GenerateGlobalKeys(); - CHARMAN = new CharacterManager; + CHARMAN = new CharacterManager; SCOREMAN = new ScoreManager; PROFILEMAN = new ProfileManager; PROFILEMAN->Init(pLoadingWindow); // must load after SONGMAN @@ -1533,26 +1533,6 @@ HandleInputEvents(float fDeltaTime) input.type = ieArray[i].type; swap(input.InputList, ieArray[i].m_ButtonState); - // hack for testing (MultiPlayer) with only one joystick - /* - if( input.DeviceI.IsJoystick() ) - { - if( INPUTFILTER->IsBeingPressed( - DeviceInput(DEVICE_KEYBOARD,KEY_LSHIFT) ) ) input.DeviceI.device = - (InputDevice)(input.DeviceI.device + 1); if( - INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD,KEY_LCTRL) ) ) - input.DeviceI.device = (InputDevice)(input.DeviceI.device + 2); - if( INPUTFILTER->IsBeingPressed( - DeviceInput(DEVICE_KEYBOARD,KEY_LALT) ) ) input.DeviceI.device = - (InputDevice)(input.DeviceI.device + 4); if( - INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD,KEY_RALT) ) ) - input.DeviceI.device = (InputDevice)(input.DeviceI.device + 8); - if( INPUTFILTER->IsBeingPressed( - DeviceInput(DEVICE_KEYBOARD,KEY_RCTRL) ) ) input.DeviceI.device = - (InputDevice)(input.DeviceI.device + 16); - } - */ - INPUTMAPPER->DeviceToGame(input.DeviceI, input.GameI); input.mp = MultiPlayer_Invalid; @@ -1567,11 +1547,6 @@ HandleInputEvents(float fDeltaTime) // LOG->Trace( "device %d, %d", diTemp.device, diTemp.button ); if (INPUTMAPPER->DeviceToGame(diTemp, gi)) { - if (GAMESTATE->m_bMultiplayer) { - input.GameI = gi; - // LOG->Trace( "game %d %d", input.GameI.controller, - // input.GameI.button ); - } input.mp = InputMapper::InputDeviceToMultiPlayer( input.DeviceI.device); @@ -1604,7 +1579,6 @@ HandleInputEvents(float fDeltaTime) if (HandleGlobalInputs(input)) continue; // skip - SCREENMAN->Input(input); } diff --git a/src/Etterna/Models/Misc/AutoKeysounds.cpp b/src/Etterna/Models/Misc/AutoKeysounds.cpp index 751775da83..aa66534d1b 100644 --- a/src/Etterna/Models/Misc/AutoKeysounds.cpp +++ b/src/Etterna/Models/Misc/AutoKeysounds.cpp @@ -52,18 +52,14 @@ AutoKeysounds::LoadAutoplaySoundsInto(RageSoundReader_Chain* pChain) /* * Add all current autoplay sounds in both players to the chain. */ - int iNumTracks = - m_ndAutoKeysoundsOnly.GetNumTracks(); + int iNumTracks = m_ndAutoKeysoundsOnly.GetNumTracks(); for (int t = 0; t < iNumTracks; t++) { int iRow = -1; for (;;) { /* Find the next row that either player has a note on. */ int iNextRow = INT_MAX; - FOREACH_EnabledPlayer(pn) - { - // XXX Hack. Enabled players need not have their own note data. - if (t >= m_ndAutoKeysoundsOnly.GetNumTracks()) - continue; + // XXX Hack. Enabled players need not have their own note data. + if (!(t >= m_ndAutoKeysoundsOnly.GetNumTracks())) { int iNextRowForPlayer = iRow; /* XXX: If a BMS file only has one tap note per track, * this will prevent any keysounds from loading. @@ -81,29 +77,21 @@ AutoKeysounds::LoadAutoplaySoundsInto(RageSoundReader_Chain* pChain) TapNote tn; tn = m_ndAutoKeysoundsOnly.GetTapNote(t, iRow); - FOREACH_EnabledPlayer(pn) - { - if (tn == TAP_EMPTY) - continue; - - ASSERT(tn.type == TapNoteType_AutoKeysound); - if (tn.iKeysoundIndex >= 0) { - RString sKeysoundFilePath = - sSongDir + pSong->m_vsKeysoundFile[tn.iKeysoundIndex]; - float fSeconds = - GAMESTATE->m_pCurSteps - ->GetTimingData() - ->WhereUAtBroNoOffset(NoteRowToBeat(iRow)) + - SOUNDMAN->GetPlayLatency(); - - float fPan = 0; - // If two players are playing, pan the keysounds to each - // player's respective side - if (GAMESTATE->GetNumPlayersEnabled() == 2) - fPan = (pn == PLAYER_1) ? -1.0f : +1.0f; - int iIndex = pChain->LoadSound(sKeysoundFilePath); - pChain->AddSound(iIndex, fSeconds, fPan); - } + if (tn == TAP_EMPTY) + continue; + + ASSERT(tn.type == TapNoteType_AutoKeysound); + if (tn.iKeysoundIndex >= 0) { + RString sKeysoundFilePath = + sSongDir + pSong->m_vsKeysoundFile[tn.iKeysoundIndex]; + float fSeconds = + GAMESTATE->m_pCurSteps->GetTimingData()->WhereUAtBroNoOffset( + NoteRowToBeat(iRow)) + + SOUNDMAN->GetPlayLatency(); + + float fPan = 0; + int iIndex = pChain->LoadSound(sKeysoundFilePath); + pChain->AddSound(iIndex, fSeconds, fPan); } } } @@ -122,9 +110,7 @@ AutoKeysounds::LoadTracks(const Song* pSong, pShared = nullptr; vector vsMusicFile; - const RString sMusicPath = - GAMESTATE->m_pCurSteps - ->GetMusicPath(); + const RString sMusicPath = GAMESTATE->m_pCurSteps->GetMusicPath(); if (!sMusicPath.empty()) vsMusicFile.push_back(sMusicPath); @@ -223,10 +209,8 @@ AutoKeysounds::FinishLoading() apSounds.push_back(m_pSharedSound); if (m_pPlayerSounds != nullptr) { - m_pPlayerSounds = - new RageSoundReader_PitchChange(m_pPlayerSounds); - m_pPlayerSounds = - new RageSoundReader_PostBuffering(m_pPlayerSounds); + 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); } diff --git a/src/Etterna/Models/Misc/GameCommand.cpp b/src/Etterna/Models/Misc/GameCommand.cpp index c96c98b23e..8c6f0c246d 100644 --- a/src/Etterna/Models/Misc/GameCommand.cpp +++ b/src/Etterna/Models/Misc/GameCommand.cpp @@ -64,7 +64,8 @@ CompareSongOptions(const SongOptions& so1, const SongOptions& so2); bool GameCommand::DescribesCurrentModeForAllPlayers() const { - FOREACH_HumanPlayer(pn) if (!DescribesCurrentMode(pn)) return false; + if (!DescribesCurrentMode(PLAYER_1)) + return false; return true; } @@ -81,7 +82,8 @@ 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? - if (GAMESTATE->m_PreferredDifficulty != m_dc) return false; + if (GAMESTATE->m_PreferredDifficulty != m_dc) + return false; } if (m_sAnnouncer != "" && m_sAnnouncer != ANNOUNCER->GetCurAnnouncerName()) @@ -469,13 +471,13 @@ GameCommand::ApplySelf(const vector& vpns) const GAMESTATE->GetMasterPlayerNumber()); // If only one side is joined and we picked a style that requires both // sides, join the other side. - switch( m_pStyle->m_StyleType ) - { - case StyleType_OnePlayerOneSide: - case StyleType_OnePlayerTwoSides: - break; - default: - LuaHelpers::ReportScriptError("Invalid StyleType: " + m_pStyle->m_StyleType); + switch (m_pStyle->m_StyleType) { + case StyleType_OnePlayerOneSide: + case StyleType_OnePlayerTwoSides: + break; + default: + LuaHelpers::ReportScriptError("Invalid StyleType: " + + m_pStyle->m_StyleType); } } if (m_dc != Difficulty_Invalid) @@ -562,8 +564,7 @@ GameCommand::ApplySelf(const vector& vpns) const // applying options affects only the current stage PlayerOptions po; GAMESTATE->GetDefaultPlayerOptions(po); - GAMESTATE->m_pPlayerState->m_PlayerOptions.Assign( - ModsLevel_Stage, po); + GAMESTATE->m_pPlayerState->m_PlayerOptions.Assign(ModsLevel_Stage, po); SongOptions so; GAMESTATE->GetDefaultSongOptions(so); diff --git a/src/Etterna/Models/Misc/OptionRowHandler.cpp b/src/Etterna/Models/Misc/OptionRowHandler.cpp index 8435b167d3..d341d7fb6d 100644 --- a/src/Etterna/Models/Misc/OptionRowHandler.cpp +++ b/src/Etterna/Models/Misc/OptionRowHandler.cpp @@ -278,9 +278,9 @@ class OptionRowHandlerList : public OptionRowHandler if (mc.IsZero()) { /* The entry has no effect. This is usually a default "none - * of the above" entry. It will always return true for - * DescribesCurrentMode(). It's only the selected choice if - * nothing else matches. */ + * of the above" entry. It will always return true for + * DescribesCurrentMode(). It's only the selected choice if + * nothing else matches. */ continue; } @@ -307,16 +307,15 @@ class OptionRowHandlerList : public OptionRowHandler int iFallbackOption = m_Def.m_iDefault; if (iFallbackOption == -1) { RString s = - ssprintf("No options in row \"list,%s\" were selected, " - "and no fallback row found; selected entry 0", - m_Def.m_sName.c_str()); + ssprintf("No options in row \"list,%s\" were selected, " + "and no fallback row found; selected entry 0", + m_Def.m_sName.c_str()); LOG->Warn("%s", s.c_str()); CHECKPOINT_M(s); iFallbackOption = 0; } - OptionRowHandlerUtil::SelectExactlyOne(iFallbackOption, - vbSelOut); + OptionRowHandlerUtil::SelectExactlyOne(iFallbackOption, vbSelOut); } VerifySelected(m_Def.m_selectType, vbSelOut, m_Def.m_sName); @@ -438,9 +437,10 @@ class OptionRowHandlerListSteps : public OptionRowHandlerList m_Def.m_vsChoices.clear(); m_aListEntries.clear(); - if(GAMESTATE->GetCurrentStyle(GAMESTATE->GetMasterPlayerNumber()) && GAMESTATE->m_pCurSong) // playing a song + if (GAMESTATE->GetCurrentStyle(GAMESTATE->GetMasterPlayerNumber()) && + GAMESTATE->m_pCurSong) // playing a song { - m_Def.m_layoutType = StringToLayoutType( STEPS_ROW_LAYOUT_TYPE ); + m_Def.m_layoutType = StringToLayoutType(STEPS_ROW_LAYOUT_TYPE); vector vpSteps; Song* pSong = GAMESTATE->m_pCurSong; @@ -598,12 +598,12 @@ class OptionRowHandlerSteps : public OptionRowHandler // look for matching steps vector::const_iterator iter = - find(m_vSteps.begin(), m_vSteps.end(), m_ppStepsToFill->Get()); + find(m_vSteps.begin(), m_vSteps.end(), m_ppStepsToFill->Get()); if (iter != m_vSteps.end()) { unsigned i = iter - m_vSteps.begin(); vbSelOut[i] = true; } else { - + // look for matching difficulty bool matched = false; if (m_pDifficultyToFill) { @@ -1097,7 +1097,7 @@ class OptionRowHandlerLua : public OptionRowHandler vector& vbSelOut = vbSelectedOut; /* Evaluate the LoadSelections(self,array,pn) function, where - * array is a table representing vbSelectedOut. */ + * array is a table representing vbSelectedOut. */ // All selections default to false. for (unsigned i = 0; i < vbSelOut.size(); ++i) @@ -1123,7 +1123,7 @@ class OptionRowHandlerLua : public OptionRowHandler LuaHelpers::Push(L, p); ASSERT(lua_gettop(L) == - 6); // vbSelectedOut, m_iLuaTable, function, self, arg, arg + 6); // vbSelectedOut, m_iLuaTable, function, self, arg, arg RString error = "LoadSelections: "; LuaHelpers::RunScriptOnStack(L, error, 3, 0, true); @@ -1153,7 +1153,7 @@ class OptionRowHandlerLua : public OptionRowHandler const vector& vbSel = vbSelected; /* Evaluate SaveSelections(self,array,pn) function, where array is - * a table representing vbSelectedOut. */ + * a table representing vbSelectedOut. */ vector vbSelectedCopy = vbSel; @@ -1177,7 +1177,7 @@ class OptionRowHandlerLua : public OptionRowHandler LuaHelpers::Push(L, p); ASSERT(lua_gettop(L) == - 6); // vbSelectedOut, m_iLuaTable, function, self, arg, arg + 6); // vbSelectedOut, m_iLuaTable, function, self, arg, arg RString error = "SaveSelections: "; LuaHelpers::RunScriptOnStack(L, error, 3, 0, true); @@ -1373,8 +1373,8 @@ class OptionRowHandlerStepsType : public OptionRowHandler if (GAMESTATE->m_pCurSteps) { StepsType st = GAMESTATE->m_pCurSteps->m_StepsType; - vector::const_iterator iter = find( - m_vStepsTypesToShow.begin(), m_vStepsTypesToShow.end(), st); + vector::const_iterator iter = + find(m_vStepsTypesToShow.begin(), m_vStepsTypesToShow.end(), st); if (iter != m_vStepsTypesToShow.end()) { unsigned i = iter - m_vStepsTypesToShow.begin(); vbSelOut[i] = true; @@ -1433,7 +1433,7 @@ class OptionRowHandlerGameCommand : public OptionRowHandler int ExportOption(const PlayerNumber& vpns, const vector& vbSelected) const override { - if( vbSelected[0] ) + if (vbSelected[0]) m_gc.ApplyToAllPlayers(); return 0; } @@ -1547,7 +1547,7 @@ OptionRowHandlerUtil::MakeSimple(const MenuRowDef& mr) pHand->m_Def.m_vEnabledForPlayers.clear(); if (mr.pfnEnabled != nullptr ? mr.pfnEnabled() : mr.bEnabled) { - FOREACH_EnabledPlayer(pn) pHand->m_Def.m_vEnabledForPlayers.insert(pn); + pHand->m_Def.m_vEnabledForPlayers.insert(PLAYER_1); } pHand->m_Def.m_bOneChoiceForAllPlayers = true; diff --git a/src/Etterna/Models/Misc/PlayerState.h b/src/Etterna/Models/Misc/PlayerState.h index 954d7f290e..a1ea8ca8d0 100644 --- a/src/Etterna/Models/Misc/PlayerState.h +++ b/src/Etterna/Models/Misc/PlayerState.h @@ -1,4 +1,4 @@ -/** @brief PlayerState - Holds per-player game state. */ +/** @brief PlayerState - Holds per-player game state. */ #ifndef PlayerState_H #define PlayerState_H @@ -49,8 +49,6 @@ class PlayerState PlayerNumber m_PlayerNumber; /** * @brief The MultiPlayer number assigned to this Player, typically 1-32. - * - * This is only used if GAMESTATE->m_bMultiplayer is true. */ MultiPlayer m_mp; diff --git a/src/Etterna/Models/Misc/StageStats.cpp b/src/Etterna/Models/Misc/StageStats.cpp index f54240fd5d..f43c72bfe3 100644 --- a/src/Etterna/Models/Misc/StageStats.cpp +++ b/src/Etterna/Models/Misc/StageStats.cpp @@ -321,8 +321,7 @@ StageStats::AssertValid(PlayerNumber pn) const 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.m_vpPossibleSteps[0]->GetDifficulty() < - NUM_Difficulty, + ASSERT_M(m_player.m_vpPossibleSteps[0]->GetDifficulty() < NUM_Difficulty, ssprintf("Invalid Difficulty %i", m_player.m_vpPossibleSteps[0]->GetDifficulty())); ASSERT_M((int)m_vpPlayedSongs.size() == m_player.m_iStepsPlayed, @@ -345,8 +344,7 @@ 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.m_vpPossibleSteps[0]->GetDifficulty() < - NUM_Difficulty, + ASSERT_M(m_player.m_vpPossibleSteps[0]->GetDifficulty() < NUM_Difficulty, ssprintf("difficulty %i", m_player.m_vpPossibleSteps[0]->GetDifficulty())); ASSERT((int)m_vpPlayedSongs.size() == m_player.m_iStepsPlayed); @@ -391,14 +389,16 @@ StageStats::AddStats(const StageStats& other) bool StageStats::OnePassed() const { - if (!m_player.m_bFailed) return true; + if (!m_player.m_bFailed) + return true; return false; } bool StageStats::AllFailed() const { - if (!m_player.m_bFailed) return false; + if (!m_player.m_bFailed) + return false; return true; } @@ -418,8 +418,7 @@ DetermineScoreEligibility(const PlayerStageStats& pss, const PlayerState& ps) { // 4k only - if (GAMESTATE->m_pCurSteps->m_StepsType != - StepsType_dance_single) + if (GAMESTATE->m_pCurSteps->m_StepsType != StepsType_dance_single) return false; // chord cohesion is invalid @@ -513,15 +512,15 @@ FillInHighScore(const PlayerStageStats& pss, hs.SetChartKey(chartKey); hs.SetGrade(pss.GetGrade()); hs.SetMachineGuid(getSystemUniqueId()); - hs.SetScore( pss.m_iScore ); - hs.SetPercentDP( pss.GetPercentDancePoints() ); - hs.SetWifeScore( pss.GetWifeScore()); - hs.SetWifePoints( pss.GetCurWifeScore()); - hs.SetMusicRate( GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate); - hs.SetJudgeScale( pss.GetTimingScale()); - hs.SetChordCohesion( GAMESTATE->CountNotesSeparately() ); - hs.SetAliveSeconds( pss.m_fAliveSeconds ); - hs.SetMaxCombo( pss.GetMaxCombo().m_cnt ); + hs.SetScore(pss.m_iScore); + hs.SetPercentDP(pss.GetPercentDancePoints()); + hs.SetWifeScore(pss.GetWifeScore()); + hs.SetWifePoints(pss.GetCurWifeScore()); + hs.SetMusicRate(GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate); + hs.SetJudgeScale(pss.GetTimingScale()); + hs.SetChordCohesion(GAMESTATE->CountNotesSeparately()); + hs.SetAliveSeconds(pss.m_fAliveSeconds); + hs.SetMaxCombo(pss.GetMaxCombo().m_cnt); vector asModifiers; { @@ -611,9 +610,7 @@ StageStats::FinalizeScores(bool bSummary) // don't save scores if the player chose not to // also don't save if in practice mode if (!GAMESTATE->m_SongOptions.GetCurrent().m_bSaveScore || - GAMESTATE->m_pPlayerState - ->m_PlayerOptions.GetCurrent() - .m_bPractice) + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent().m_bPractice) return; LOG->Trace("saving stats and high scores"); @@ -626,18 +623,9 @@ StageStats::FinalizeScores(bool bSummary) ? 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 - m_multiPlayer[mp].m_HighScore = - FillInHighScore(m_multiPlayer[mp], - *GAMESTATE->m_pMultiPlayerState[mp], - "", - sPlayerGuid); - } + *GAMESTATE->m_pPlayerState, + RANKING_TO_FILL_IN_MARKER, + sPlayerGuid); HighScore& hs = m_player.m_HighScore; @@ -769,8 +757,7 @@ class LunaStageStats : public Luna DEFINE_METHOD(GetStepsSeconds, m_fStepsSeconds) static int PlayerHasHighScore(T* p, lua_State* L) { - lua_pushboolean(L, - p->PlayerHasHighScore(PLAYER_1)); + lua_pushboolean(L, p->PlayerHasHighScore(PLAYER_1)); return 1; } diff --git a/src/Etterna/Models/Songs/SongUtil.cpp b/src/Etterna/Models/Songs/SongUtil.cpp index a51be262ce..49d1d699bd 100644 --- a/src/Etterna/Models/Songs/SongUtil.cpp +++ b/src/Etterna/Models/Songs/SongUtil.cpp @@ -322,19 +322,19 @@ CompareSongPointersBySortValueDescending(const Song* pSong1, const Song* pSong2) void SongUtil::MakeSortString(RString& s) { - s.MakeUpper(); + s.MakeUpper(); - // Make sure that non-alphanumeric strings are placed at the very end. - if (s.size() > 0) { - if (s[0] == '.') // like the song ".59" - s.erase(s.begin()); + // Make sure that non-alphanumeric strings are placed at the very end. + if (s.size() > 0) { + if (s[0] == '.') // like the song ".59" + s.erase(s.begin()); - if (s[0] == '#') - return; + if (s[0] == '#') + return; - if ((s[0] < 'A' || s[0] > 'Z') && (s[0] < '0' || s[0] > '9')) - s = char(126) + s; - } + if ((s[0] < 'A' || s[0] > 'Z') && (s[0] < '0' || s[0] > '9')) + s = char(126) + s; + } } RString @@ -729,12 +729,10 @@ SongUtil::SortSongPointerArrayBySectionName(vector& vpSongsInOut, val = "0"; else if (val == sOther) val = "2"; - else - { + else { MakeSortString(val); val = "1" + val; } - g_mapSongSortVal[vpSongsInOut[i]] = val; } @@ -1041,23 +1039,6 @@ SongUtil::GetPlayableStepsTypes(const Song* pSong, set& vOut) else vpPossibleStyles.push_back(GAMESTATE->GetCurrentStyle(PLAYER_INVALID)); - // Only allow OneSide Styles in Workout - if( GAMESTATE->m_bMultiplayer ) - { - for( int i=vpPossibleStyles.size()-1; i>=0; i-- ) - { - const Style *pStyle = vpPossibleStyles[i]; - switch( pStyle->m_StyleType ) - { - DEFAULT_FAIL( pStyle->m_StyleType ); - case StyleType_OnePlayerOneSide: - continue; - case StyleType_OnePlayerTwoSides: - break; - } - } - } - set vStepsTypes; FOREACH(const Style*, vpPossibleStyles, s) vStepsTypes.insert((*s)->m_StepsType); diff --git a/src/Etterna/Screen/Gameplay/ScreenGameplay.cpp b/src/Etterna/Screen/Gameplay/ScreenGameplay.cpp index eb13e3a0a4..64c07ebd7e 100644 --- a/src/Etterna/Screen/Gameplay/ScreenGameplay.cpp +++ b/src/Etterna/Screen/Gameplay/ScreenGameplay.cpp @@ -46,13 +46,9 @@ #include "Etterna/Models/Misc/ThemeMetric.h" #include "Etterna/FileTypes/XmlFile.h" #include "Etterna/FileTypes/XmlFileUtil.h" -#include "Etterna/Models/Misc/Profile.h" // for replay data stuff #include "Etterna/Singletons/DownloadManager.h" #include "Etterna/Singletons/ScoreManager.h" -// Defines -#define SHOW_LIFE_METER_FOR_DISABLED_PLAYERS \ - THEME->GetMetricB(m_sName, "ShowLifeMeterForDisabledPlayers") #define SONG_POSITION_METER_WIDTH \ THEME->GetMetricF(m_sName, "SongPositionMeterWidth") @@ -63,9 +59,6 @@ static ThemeMetric SECONDS_BETWEEN_COMMENTS("ScreenGameplay", "SecondsBetweenComments"); static ThemeMetric SCORE_KEEPER_CLASS("ScreenGameplay", "ScoreKeeperClass"); -static ThemeMetric FORCE_IMMEDIATE_FAIL_FOR_BATTERY( - "ScreenGameplay", - "ForceImmediateFailForBattery"); AutoScreenMessage(SM_PlayGo); @@ -81,24 +74,21 @@ AutoScreenMessage(SM_DoNextScreen); AutoScreenMessage(SM_StartHereWeGo); AutoScreenMessage(SM_StopHereWeGo); +// related to battle mode for triggering announcer stuff AutoScreenMessage(SM_BattleTrickLevel1); AutoScreenMessage(SM_BattleTrickLevel2); AutoScreenMessage(SM_BattleTrickLevel3); static Preference g_bCenter1Player("Center1Player", true); static Preference g_bShowLyrics("ShowLyrics", false); -static Preference g_fNetStartOffset("NetworkStartOffset", -3.0); PlayerInfo::PlayerInfo() : m_pn(PLAYER_INVALID) - , m_PlayerStateDummy() - , m_PlayerStageStatsDummy() , m_SoundEffectControl() , m_vpStepsQueue() , m_pLifeMeter(NULL) , m_ptextStepsDescription(NULL) , m_pPrimaryScoreKeeper(NULL) - , m_pSecondaryScoreKeeper(NULL) , m_ptextPlayerOptions(NULL) , m_NoteData() , m_pPlayer(NULL) @@ -145,28 +135,11 @@ PlayerInfo::Load(PlayerNumber pn, } } -void -PlayerInfo::LoadDummyP1(int iDummyIndex, int iAddToDifficulty) -{ - m_pn = PLAYER_1; - m_bPlayerEnabled = IsEnabled(); - m_bIsDummy = true; - m_iDummyIndex = iDummyIndex; - m_iAddToDifficulty = iAddToDifficulty; - - // don't init any of the scoring objects - 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; -} - PlayerInfo::~PlayerInfo() { SAFE_DELETE(m_pLifeMeter); SAFE_DELETE(m_ptextStepsDescription); SAFE_DELETE(m_pPrimaryScoreKeeper); - SAFE_DELETE(m_pSecondaryScoreKeeper); SAFE_DELETE(m_ptextPlayerOptions); SAFE_DELETE(m_pPlayer); SAFE_DELETE(m_pStepsDisplay); @@ -175,8 +148,6 @@ PlayerInfo::~PlayerInfo() PlayerState* PlayerInfo::GetPlayerState() { - if (m_bIsDummy) - return &m_PlayerStateDummy; return IsMultiPlayer() ? GAMESTATE ->m_pMultiPlayerState[GetPlayerStateAndStageStatsIndex()] @@ -186,10 +157,6 @@ PlayerInfo::GetPlayerState() PlayerStageStats* PlayerInfo::GetPlayerStageStats() { - // multiplayer chooses the PlayerStageStats with the highest score on - // StageFinalized - if (m_bIsDummy || IsMultiPlayer()) - return &m_PlayerStageStatsDummy; return &STATSMAN->m_CurStageStats.m_player; } @@ -238,12 +205,6 @@ ScreenGameplay::Init() MIN_SECONDS_TO_STEP.Load(m_sName, "MinSecondsToStep"); MIN_SECONDS_TO_MUSIC.Load(m_sName, "MinSecondsToMusic"); MIN_SECONDS_TO_STEP_NEXT_SONG.Load(m_sName, "MinSecondsToStepNextSong"); - START_GIVES_UP.Load(m_sName, "StartGivesUp"); - BACK_GIVES_UP.Load(m_sName, "BackGivesUp"); - SELECT_SKIPS_SONG.Load(m_sName, "SelectSkipsSong"); - GIVING_UP_GOES_TO_PREV_SCREEN.Load(m_sName, "GivingUpGoesToPrevScreen"); - FAIL_ON_MISS_COMBO.Load(m_sName, "FailOnMissCombo"); - ALLOW_CENTER_1_PLAYER.Load(m_sName, "AllowCenter1Player"); if (UseSongBackgroundAndForeground()) { m_pSongBackground = new Background; @@ -279,34 +240,17 @@ ScreenGameplay::Init() } } - FOREACH_PotentialCpuPlayer(p) - { - PlayerNumber human_pn = GAMESTATE->GetFirstHumanPlayer(); - GAMESTATE->m_pCurSteps.Set(GAMESTATE->m_pCurSteps); - if (GAMESTATE->GetCurrentGame()->m_PlayersHaveSeparateStyles) { - GAMESTATE->SetCurrentStyle(GAMESTATE->GetCurrentStyle(human_pn), p); - } - } - ASSERT(GAMESTATE->m_pCurSteps.Get() != NULL); STATSMAN->m_CurStageStats.m_playMode = GAMESTATE->m_PlayMode; STATSMAN->m_CurStageStats.m_player.m_pStyle = GAMESTATE->GetCurrentStyle(PLAYER_1); - FOREACH_MultiPlayer(pn) - { - STATSMAN->m_CurStageStats.m_multiPlayer[pn].m_pStyle = - GAMESTATE->GetCurrentStyle(PLAYER_INVALID); - } /* Record combo rollover. */ m_vPlayerInfo.GetPlayerStageStats()->UpdateComboList(0, true); m_DancingState = STATE_INTRO; - // Set this in LoadNextSong() - // m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS; - m_bZeroDeltaOnNextUpdate = false; if (m_pSongBackground != nullptr) { @@ -388,18 +332,14 @@ ScreenGameplay::Init() m_NextSong.SetDrawOrder(DRAW_ORDER_TRANSITIONS - 1); this->AddChild(&m_NextSong); - // Before the lifemeter loads, if Networking is required - // we need to wait, so that there is no Dead On Start issues. - // if you wait too long at the second checkpoint, you will - // appear dead when you begin your game. + // Multiplayer-specific gameplay check if (GAMESTATE->m_bPlayingMulti) NSMAN->StartRequest(0); // Add individual life meter switch (GAMESTATE->m_PlayMode) { case PLAY_MODE_REGULAR: - if (!GAMESTATE->IsPlayerEnabled(m_vPlayerInfo.m_pn) && - !SHOW_LIFE_METER_FOR_DISABLED_PLAYERS) + if (!GAMESTATE->IsPlayerEnabled(m_vPlayerInfo.m_pn)) break; m_vPlayerInfo.m_pLifeMeter = @@ -418,14 +358,8 @@ ScreenGameplay::Init() break; } + // For multi scoreboard; may be used in the future m_bShowScoreboard = false; - m_textSongOptions.LoadFromFont(THEME->GetPathF(m_sName, "song options")); - m_textSongOptions.SetShadowLength(0); - m_textSongOptions.SetName("SongOptions"); - LOAD_ALL_COMMANDS_AND_SET_XY(m_textSongOptions); - m_textSongOptions.SetText( - GAMESTATE->m_SongOptions.GetStage().GetLocalizedString()); - this->AddChild(&m_textSongOptions); if (g_bShowLyrics) { m_LyricDisplay.SetName("LyricDisplay"); @@ -463,8 +397,7 @@ ScreenGameplay::Init() m_vPlayerInfo.GetPlayerState(), m_vPlayerInfo.GetPlayerStageStats(), m_vPlayerInfo.m_pLifeMeter, - m_vPlayerInfo.m_pPrimaryScoreKeeper, - m_vPlayerInfo.m_pSecondaryScoreKeeper); + m_vPlayerInfo.m_pPrimaryScoreKeeper); // fill in m_apSongsQueue, m_vpStepsQueue, m_asModifiersQueue InitSongQueues(); @@ -481,9 +414,6 @@ ScreenGameplay::Init() if (m_vPlayerInfo.m_pPrimaryScoreKeeper) m_vPlayerInfo.m_pPrimaryScoreKeeper->Load(m_apSongsQueue, m_vPlayerInfo.m_vpStepsQueue); - if (m_vPlayerInfo.m_pSecondaryScoreKeeper) - m_vPlayerInfo.m_pSecondaryScoreKeeper->Load( - m_apSongsQueue, m_vPlayerInfo.m_vpStepsQueue); GAMESTATE->m_bGameplayLeadIn.Set(true); @@ -492,9 +422,7 @@ ScreenGameplay::Init() LoadNextSong(); m_GiveUpTimer.SetZero(); - m_SkipSongTimer.SetZero(); m_gave_up = false; - m_skipped_song = false; // Force FailOff in Practice Mode if (GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent().m_bPractice) { @@ -521,11 +449,7 @@ ScreenGameplay::Init() bool ScreenGameplay::Center1Player() const { - /* Perhaps this should be handled better by defining a new - * StyleType for ONE_PLAYER_ONE_CREDIT_AND_ONE_COMPUTER, - * but for now just ignore Center1Player when it's Battle or Rave - * Mode. This doesn't begin to address two-player solo (6 arrows) */ - return g_bCenter1Player && (bool)ALLOW_CENTER_1_PLAYER; + return g_bCenter1Player; } // fill in m_apSongsQueue, m_vpStepsQueue, m_asModifiersQueue @@ -549,32 +473,6 @@ ScreenGameplay::InitSongQueues() ratesqueue.emplace_back(ch->rate); } } - - if (GAMESTATE->m_bMultiplayer) { - for (int i = 0; i < static_cast(m_apSongsQueue.size()); i++) { - Song* pSong = m_apSongsQueue[i]; - Steps* pOldSteps = m_vPlayerInfo.m_vpStepsQueue[i]; - - vector vpSteps; - SongUtil::GetSteps(pSong, vpSteps, pOldSteps->m_StepsType); - StepsUtil::SortNotesArrayByDifficulty(vpSteps); - vector::iterator iter = - find(vpSteps.begin(), vpSteps.end(), pOldSteps); - int iIndexBase = 0; - if (iter != vpSteps.end()) { - iIndexBase = iter - vpSteps.begin(); - CLAMP(iIndexBase, - 0, - vpSteps.size() - GAMESTATE->m_iNumMultiplayerNoteFields); - } - - int iIndexToUse = iIndexBase + m_vPlayerInfo.m_iAddToDifficulty; - CLAMP(iIndexToUse, 0, vpSteps.size() - 1); - - Steps* pSteps = vpSteps[iIndexToUse]; - m_vPlayerInfo.m_vpStepsQueue[i] = pSteps; - } - } } ScreenGameplay::~ScreenGameplay() @@ -685,11 +583,6 @@ ScreenGameplay::LoadNextSong() m_vPlayerInfo.GetPlayerStageStats()->m_iSongsPlayed++; - if (GAMESTATE->m_bMultiplayer) { - FOREACH_ENUM(MultiPlayer, mp) - this->UpdateStageStats(mp); - } - int iPlaySongIndex = GAMESTATE->GetCourseSongIndex(); iPlaySongIndex %= m_apSongsQueue.size(); GAMESTATE->m_pCurSong.Set(m_apSongsQueue[iPlaySongIndex]); @@ -700,21 +593,6 @@ ScreenGameplay::LoadNextSong() STATSMAN->m_CurStageStats.m_vpPlayedSongs.push_back(GAMESTATE->m_pCurSong); - // Force immediate fail behavior changed to theme metric by Kyz. - if (FORCE_IMMEDIATE_FAIL_FOR_BATTERY) { - if (m_vPlayerInfo.GetPlayerState() - ->m_PlayerOptions.GetStage() - .m_LifeType == LifeType_Battery) { - PO_GROUP_ASSIGN(m_vPlayerInfo.GetPlayerState()->m_PlayerOptions, - ModsLevel_Song, - m_FailType, - FailType_Immediate); - } - } - - m_textSongOptions.SetText( - GAMESTATE->m_SongOptions.GetCurrent().GetString()); - SetupSong(iPlaySongIndex); Song* pSong = GAMESTATE->m_pCurSong; @@ -743,11 +621,6 @@ ScreenGameplay::LoadNextSong() GAMESTATE->GetCourseSongIndex(), pSteps, &m_vPlayerInfo.m_pPlayer->GetNoteData()); - if (m_vPlayerInfo.m_pSecondaryScoreKeeper) - m_vPlayerInfo.m_pSecondaryScoreKeeper->OnNextSong( - GAMESTATE->GetCourseSongIndex(), - pSteps, - &m_vPlayerInfo.m_pPlayer->GetNoteData()); // Don't mess with the PlayerController of the Dummy player if (!m_vPlayerInfo.m_bIsDummy) { @@ -954,7 +827,7 @@ ScreenGameplay::BeginScreen() SOUND->PlayOnceFromAnnouncer("gameplay intro"); // crowd cheer - // Tell multi to do its thing -poco + // Tell multi to do its thing (this really does nothing right now) -poco if (GAMESTATE->m_bPlayingMulti && NSMAN->useSMserver) { NSMAN->StartRequest(1); } @@ -1071,19 +944,16 @@ ScreenGameplay::Update(float fDeltaTime) m_AutoKeysounds.Update(fDeltaTime); + FailType failtype = + GAMESTATE->GetPlayerFailType(m_vPlayerInfo.GetPlayerState()); // update GameState HealthState HealthState& hs = m_vPlayerInfo.GetPlayerState()->m_HealthState; HealthState OldHealthState = hs; - if (GAMESTATE->GetPlayerFailType(m_vPlayerInfo.GetPlayerState()) != - FailType_Off && - m_vPlayerInfo.m_pLifeMeter && m_vPlayerInfo.m_pLifeMeter->IsFailing()) { + if (failtype != FailType_Off && m_vPlayerInfo.m_pLifeMeter->IsFailing()) { hs = HealthState_Dead; - } else if (m_vPlayerInfo.m_pLifeMeter && - m_vPlayerInfo.m_pLifeMeter->IsHot()) { + } else if (m_vPlayerInfo.m_pLifeMeter->IsHot()) { hs = HealthState_Hot; - } else if (GAMESTATE->GetPlayerFailType(m_vPlayerInfo.GetPlayerState()) != - FailType_Off && - m_vPlayerInfo.m_pLifeMeter && + } else if (failtype != FailType_Off && m_vPlayerInfo.m_pLifeMeter->IsInDanger()) { hs = HealthState_Danger; } else { @@ -1103,7 +973,7 @@ ScreenGameplay::Update(float fDeltaTime) { float fSpeed = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; RageSoundParams p = m_pSoundMusic->GetParams(); - if (fabsf(p.m_fSpeed - fSpeed) > 0.01f && fSpeed >= 0.0f) { + if (std::fabs(p.m_fSpeed - fSpeed) > 0.01f && fSpeed >= 0.0f) { p.m_fSpeed = fSpeed; m_pSoundMusic->SetParams(p); } @@ -1116,15 +986,12 @@ ScreenGameplay::Update(float fDeltaTime) * kill dead Oni players. */ PlayerNumber pn = m_vPlayerInfo.GetStepsAndTrailIndex(); - FailType ft = - GAMESTATE->GetPlayerFailType(m_vPlayerInfo.GetPlayerState()); LifeType lt = m_vPlayerInfo.GetPlayerState() ->m_PlayerOptions.GetStage() .m_LifeType; // check for individual fail - if (!m_vPlayerInfo.m_pLifeMeter == NULL && - !(ft == FailType_Off || ft == FailType_EndOfSong) && + if (!(failtype == FailType_Off || failtype == FailType_EndOfSong) && (m_vPlayerInfo.m_pLifeMeter->IsFailing() || m_vPlayerInfo.GetPlayerStageStats()->m_bFailed)) { @@ -1147,7 +1014,7 @@ ScreenGameplay::Update(float fDeltaTime) default: break; } - if (bAllowOniDie && ft == FailType_Immediate) { + if (bAllowOniDie && failtype == FailType_Immediate) { if (!STATSMAN->m_CurStageStats .AllFailed()) // if not the last one to fail { @@ -1157,11 +1024,9 @@ ScreenGameplay::Update(float fDeltaTime) } bool bAllFailed = true; - switch (ft) { + switch (failtype) { case FailType_Immediate: - if (m_vPlayerInfo.m_pLifeMeter == NULL || - (m_vPlayerInfo.m_pLifeMeter && - !m_vPlayerInfo.m_pLifeMeter->IsFailing())) + if (!m_vPlayerInfo.m_pLifeMeter->IsFailing()) bAllFailed = false; break; case FailType_ImmediateContinue: @@ -1218,65 +1083,14 @@ ScreenGameplay::Update(float fDeltaTime) this->PostScreenMessage(SM_NotesEnded, 0); } - DancingCharacters* pCharacter = NULL; - if (m_pSongBackground) - pCharacter = m_pSongBackground->GetDancingCharacters(); - if (pCharacter != NULL) { - TapNoteScore tns = - m_vPlayerInfo.m_pPlayer->GetLastTapNoteScore(); - - ANIM_STATES_2D state = AS2D_MISS; - - switch (tns) { - case TNS_W4: - case TNS_W3: - state = AS2D_GOOD; - break; - case TNS_W2: - case TNS_W1: - state = AS2D_GREAT; - break; - default: - state = AS2D_MISS; - break; - } - - if (state == AS2D_GREAT && - m_vPlayerInfo.GetPlayerState()->m_HealthState == - HealthState_Hot) - state = AS2D_FEVER; - - pCharacter->Change2DAnimState(m_vPlayerInfo.m_pn, state); - } - // update give up bool bGiveUpTimerFired = false; bGiveUpTimerFired = !m_GiveUpTimer.IsZero() && m_GiveUpTimer.Ago() > GIVE_UP_SECONDS; m_gave_up = bGiveUpTimerFired; - m_skipped_song = !m_SkipSongTimer.IsZero() && - m_SkipSongTimer.Ago() > GIVE_UP_SECONDS; - bool bAllHumanHaveBigMissCombo = true; - if (m_vPlayerInfo.GetPlayerState() - ->m_PlayerOptions.GetCurrent() - .m_FailType == FailType_Off || - m_vPlayerInfo.GetPlayerState()->m_HealthState < - HealthState_Dead) { - bAllHumanHaveBigMissCombo = false; - } - if (bAllHumanHaveBigMissCombo) // possible to get in here. - { - bAllHumanHaveBigMissCombo = - FAIL_ON_MISS_COMBO.GetValue() != -1 && - STATSMAN->m_CurStageStats.GetMinimumMissCombo() >= - (unsigned int)FAIL_ON_MISS_COMBO; - } - if (bGiveUpTimerFired || bAllHumanHaveBigMissCombo || - m_skipped_song) { + if (bGiveUpTimerFired) { STATSMAN->m_CurStageStats.m_bGaveUp = true; - m_vPlayerInfo.GetPlayerStageStats()->m_bFailed |= - bAllHumanHaveBigMissCombo; m_vPlayerInfo.GetPlayerStageStats()->m_bDisqualified |= bGiveUpTimerFired; // Don't disqualify if failing for miss // combo. The player should still be @@ -1285,74 +1099,67 @@ ScreenGameplay::Update(float fDeltaTime) m_vPlayerInfo.GetPlayerStageStats()->gaveuplikeadumbass |= m_gave_up; ResetGiveUpTimers(false); - if (GIVING_UP_GOES_TO_PREV_SCREEN && !m_skipped_song) { - if (GamePreferences::m_AutoPlay == PC_REPLAY || - GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent() - .m_bPractice) { - if (GAMEMAN->m_bResetModifiers) { - float oldRate = GAMEMAN->m_fPreviousRate; - const RString mods = GAMEMAN->m_sModsToReset; - /* - 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); - */ - const vector oldturns = - GAMEMAN->m_vTurnsToReset; - if (GAMEMAN->m_bResetTurns) { - GAMESTATE->m_pPlayerState->m_PlayerOptions - .GetSong() - .ResetModsToStringVector(oldturns); - GAMESTATE->m_pPlayerState->m_PlayerOptions - .GetCurrent() - .ResetModsToStringVector(oldturns); - GAMESTATE->m_pPlayerState->m_PlayerOptions - .GetPreferred() - .ResetModsToStringVector(oldturns); - GAMEMAN->m_bResetTurns = false; - GAMEMAN->m_vTurnsToReset.clear(); - } - GAMESTATE->m_SongOptions.GetSong().m_fMusicRate = - oldRate; - GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate = - oldRate; - GAMESTATE->m_SongOptions.GetPreferred() - .m_fMusicRate = oldRate; - FailType failreset = GAMEMAN->m_iPreviousFail; + if (GamePreferences::m_AutoPlay == PC_REPLAY || + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent() + .m_bPractice) { + if (GAMEMAN->m_bResetModifiers) { + float oldRate = GAMEMAN->m_fPreviousRate; + const RString mods = GAMEMAN->m_sModsToReset; + /* + 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); + */ + const vector oldturns = + GAMEMAN->m_vTurnsToReset; + if (GAMEMAN->m_bResetTurns) { GAMESTATE->m_pPlayerState->m_PlayerOptions.GetSong() - .m_FailType = failreset; + .ResetModsToStringVector(oldturns); GAMESTATE->m_pPlayerState->m_PlayerOptions .GetCurrent() - .m_FailType = failreset; + .ResetModsToStringVector(oldturns); GAMESTATE->m_pPlayerState->m_PlayerOptions .GetPreferred() - .m_FailType = failreset; - GAMEMAN->m_bResetModifiers = false; - GAMEMAN->m_sModsToReset = ""; - MESSAGEMAN->Broadcast("RateChanged"); + .ResetModsToStringVector(oldturns); + GAMEMAN->m_bResetTurns = false; + GAMEMAN->m_vTurnsToReset.clear(); } - GamePreferences::m_AutoPlay.Set(PC_HUMAN); + GAMESTATE->m_SongOptions.GetSong().m_fMusicRate = + oldRate; + GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate = + oldRate; + GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate = + oldRate; + FailType failreset = GAMEMAN->m_iPreviousFail; + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetSong() + .m_FailType = failreset; + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent() + .m_FailType = failreset; + GAMESTATE->m_pPlayerState->m_PlayerOptions + .GetPreferred() + .m_FailType = failreset; + GAMEMAN->m_bResetModifiers = false; + GAMEMAN->m_sModsToReset = ""; + MESSAGEMAN->Broadcast("RateChanged"); } - BeginBackingOutFromGameplay(); - } else { - m_pSoundMusic->StopPlaying(); - this->PostScreenMessage(SM_NotesEnded, 0); + GamePreferences::m_AutoPlay.Set(PC_HUMAN); } + BeginBackingOutFromGameplay(); return; } @@ -1383,6 +1190,8 @@ ScreenGameplay::Update(float fDeltaTime) PlayTicks(); SendCrossedMessages(); + /* + // Multiplayer Life & C++ Scoreboard Update Stuff. Useless for now. if (GAMESTATE->m_bPlayingMulti && NSMAN->useSMserver) { if (m_vPlayerInfo.m_pLifeMeter) NSMAN->m_playerLife = @@ -1395,6 +1204,8 @@ ScreenGameplay::Update(float fDeltaTime) m_Scoreboard[cn] .SetText(NSMAN->m_Scoreboard[cn]); } + */ + // ArrowEffects::Update call moved because having it happen once per // NoteField (which means twice in two player) seemed wasteful. -Kyz ArrowEffects::Update(); @@ -1556,16 +1367,6 @@ ScreenGameplay::AbortGiveUpText(bool show_abort_text) m_textDebug.SetDiffuse(RageColor(1, 1, 1, 0)); } -void -ScreenGameplay::AbortSkipSong(bool show_text) -{ - if (m_SkipSongTimer.IsZero()) { - return; - } - AbortGiveUpText(show_text); - m_SkipSongTimer.SetZero(); -} - void ScreenGameplay::AbortGiveUp(bool bShowText) { @@ -1579,7 +1380,6 @@ ScreenGameplay::AbortGiveUp(bool bShowText) void ScreenGameplay::ResetGiveUpTimers(bool show_text) { - AbortSkipSong(show_text); AbortGiveUp(show_text); } @@ -1601,12 +1401,10 @@ ScreenGameplay::Input(const InputEventPlus& input) bool bHoldingGiveUp = false; if (GAMESTATE->GetCurrentStyle(input.pn)->GameInputToColumn( input.GameI) == Column_Invalid) { - bHoldingGiveUp |= - (START_GIVES_UP && input.MenuI == GAME_BUTTON_START); - bHoldingGiveUp |= - (BACK_GIVES_UP && input.MenuI == GAME_BUTTON_BACK); + bHoldingGiveUp |= (input.MenuI == GAME_BUTTON_START); } + // Exiting gameplay by holding Start (Forced Fail) if (bHoldingGiveUp) { // No PREFSMAN->m_bDelayedEscape; always delayed. if (input.type == IET_RELEASE) { @@ -1621,12 +1419,11 @@ ScreenGameplay::Input(const InputEventPlus& input) return true; } - /* Only handle GAME_BUTTON_BACK as a regular BACK button if - * BACK_GIVES_UP is disabled. */ + // Exiting gameplay by pressing Back (Immediate Exit) bool bHoldingBack = false; if (GAMESTATE->GetCurrentStyle(input.pn)->GameInputToColumn( input.GameI) == Column_Invalid) { - bHoldingBack |= input.MenuI == GAME_BUTTON_BACK && !BACK_GIVES_UP; + bHoldingBack |= input.MenuI == GAME_BUTTON_BACK; } if (bHoldingBack) { @@ -1747,37 +1544,27 @@ ScreenGameplay::Input(const InputEventPlus& input) } } - if (GAMESTATE->m_bMultiplayer) { - if (input.mp != MultiPlayer_Invalid && - GAMESTATE->IsMultiPlayerEnabled(input.mp) && iCol != -1) { - if (input.mp == m_vPlayerInfo.m_mp) - m_vPlayerInfo.m_pPlayer->Step( - iCol, -1, input.DeviceI.ts, false, bRelease); - return true; - } - } else { - // handle a step or battle item activate - if (GAMESTATE->IsHumanPlayer(input.pn)) { - ResetGiveUpTimers(true); - - if (GamePreferences::m_AutoPlay == PC_HUMAN && - GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent() - .m_fPlayerAutoPlay == 0) { - - ASSERT(input.GameI.IsValid()); - - GameButtonType gbt = - GAMESTATE->m_pCurGame->GetPerButtonInfo(input.GameI.button) - ->m_gbt; - switch (gbt) { - case GameButtonType_Menu: - return false; - case GameButtonType_Step: - if (iCol != -1) - m_vPlayerInfo.m_pPlayer->Step( - iCol, -1, input.DeviceI.ts, false, bRelease); - return true; - } + // handle a step or battle item activate + if (GAMESTATE->IsHumanPlayer(input.pn)) { + ResetGiveUpTimers(true); + + if (GamePreferences::m_AutoPlay == PC_HUMAN && + GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent() + .m_fPlayerAutoPlay == 0) { + + ASSERT(input.GameI.IsValid()); + + GameButtonType gbt = + GAMESTATE->m_pCurGame->GetPerButtonInfo(input.GameI.button) + ->m_gbt; + switch (gbt) { + case GameButtonType_Menu: + return false; + case GameButtonType_Step: + if (iCol != -1) + m_vPlayerInfo.m_pPlayer->Step( + iCol, -1, input.DeviceI.ts, false, bRelease); + return true; } } } @@ -1949,11 +1736,10 @@ ScreenGameplay::HandleScreenMessage(const ScreenMessage SM) const bool bIsLastSong = m_apSongsQueue.size() == 1; LOG->Trace("bAllReallyFailed = %d " - "bIsLastSong = %d, m_gave_up = %d, m_skipped_song = %d", + "bIsLastSong = %d, m_gave_up = %d", bAllReallyFailed, bIsLastSong, - m_gave_up, - m_skipped_song); + m_gave_up); if (GAMESTATE->IsPlaylistCourse()) { m_apSongsQueue.erase(m_apSongsQueue.begin(), @@ -1979,7 +1765,7 @@ ScreenGameplay::HandleScreenMessage(const ScreenMessage SM) STATSMAN->m_CurStageStats.mostrecentscorekey); } - if (!bIsLastSong && m_skipped_song) { + if (!bIsLastSong) { // Load the next song in the course. HandleScreenMessage(SM_StartLoadingNextSong); return; @@ -2198,14 +1984,6 @@ ScreenGameplay::GetPlayerInfo(PlayerNumber pn) return NULL; } -PlayerInfo* -ScreenGameplay::GetDummyPlayerInfo(int iDummyIndex) -{ - if (m_vPlayerInfo.m_bIsDummy && m_vPlayerInfo.m_iDummyIndex == iDummyIndex) - return &m_vPlayerInfo; - return NULL; -} - void ScreenGameplay::SaveReplay() { @@ -2217,68 +1995,64 @@ ScreenGameplay::SaveReplay() * Add date played, machine played on, etc. * Hash of some stuff to validate data (see Profile) */ - FOREACH_HumanPlayer(pn) - { - Profile* pTempProfile = PROFILEMAN->GetProfile(pn); - - XNode* p = new XNode("ReplayData"); - // append version number (in case the format changes) - p->AppendAttr("Version", 0); - - // song information node - SongID songID; - songID.FromSong(GAMESTATE->m_pCurSong); - XNode* pSongInfoNode = songID.CreateNode(); - pSongInfoNode->AppendChild( - "Title", GAMESTATE->m_pCurSong->GetDisplayFullTitle()); - pSongInfoNode->AppendChild("Artist", - GAMESTATE->m_pCurSong->GetDisplayArtist()); - p->AppendChild(pSongInfoNode); - - // steps information - StepsID stepsID; - stepsID.FromSteps(GAMESTATE->m_pCurSteps); - XNode* pStepsInfoNode = stepsID.CreateNode(); - // hashing = argh - // pStepsInfoNode->AppendChild("StepsHash", - // stepsID.ToSteps(GAMESTATE->m_pCurSong,false)->GetHash()); - p->AppendChild(pStepsInfoNode); - - // player information node (rival data sup) - XNode* pPlayerInfoNode = new XNode("Player"); - pPlayerInfoNode->AppendChild("DisplayName", - pTempProfile->m_sDisplayName); - pPlayerInfoNode->AppendChild("Guid", pTempProfile->m_sGuid); - p->AppendChild(pPlayerInfoNode); - - // the timings. - p->AppendChild(m_vPlayerInfo.m_pPlayer->GetNoteData().CreateNode()); - - // Find a file name for the replay - vector files; - GetDirListing("Save/Replays/replay*", files, false, false); - sort(files.begin(), files.end()); - - // Files should be of the form "replay#####.xml". - int iIndex = 0; - - for (int i = files.size() - 1; i >= 0; --i) { - static Regex re("^replay([0-9]{5})\\....$"); - vector matches; - if (!re.Compare(files[i], matches)) - continue; - - ASSERT(matches.size() == 1); - iIndex = StringToInt(matches[0]) + 1; - break; - } - - RString sFileName = ssprintf("replay%05d.xml", iIndex); - - XmlFileUtil::SaveToFile(p, "Save/Replays/" + sFileName); - SAFE_DELETE(p); - return; - } + Profile* pTempProfile = PROFILEMAN->GetProfile(PLAYER_1); + + XNode* p = new XNode("ReplayData"); + // append version number (in case the format changes) + p->AppendAttr("Version", 0); + + // song information node + SongID songID; + songID.FromSong(GAMESTATE->m_pCurSong); + XNode* pSongInfoNode = songID.CreateNode(); + pSongInfoNode->AppendChild("Title", + GAMESTATE->m_pCurSong->GetDisplayFullTitle()); + pSongInfoNode->AppendChild("Artist", + GAMESTATE->m_pCurSong->GetDisplayArtist()); + p->AppendChild(pSongInfoNode); + + // steps information + StepsID stepsID; + stepsID.FromSteps(GAMESTATE->m_pCurSteps); + XNode* pStepsInfoNode = stepsID.CreateNode(); + // hashing = argh + // pStepsInfoNode->AppendChild("StepsHash", + // stepsID.ToSteps(GAMESTATE->m_pCurSong,false)->GetHash()); + p->AppendChild(pStepsInfoNode); + + // player information node (rival data sup) + XNode* pPlayerInfoNode = new XNode("Player"); + pPlayerInfoNode->AppendChild("DisplayName", pTempProfile->m_sDisplayName); + pPlayerInfoNode->AppendChild("Guid", pTempProfile->m_sGuid); + p->AppendChild(pPlayerInfoNode); + + // the timings. + p->AppendChild(m_vPlayerInfo.m_pPlayer->GetNoteData().CreateNode()); + + // Find a file name for the replay + vector files; + GetDirListing("Save/Replays/replay*", files, false, false); + sort(files.begin(), files.end()); + + // Files should be of the form "replay#####.xml". + int iIndex = 0; + + for (int i = files.size() - 1; i >= 0; --i) { + static Regex re("^replay([0-9]{5})\\....$"); + vector matches; + if (!re.Compare(files[i], matches)) + continue; + + ASSERT(matches.size() == 1); + iIndex = StringToInt(matches[0]) + 1; + break; + } + + RString sFileName = ssprintf("replay%05d.xml", iIndex); + + XmlFileUtil::SaveToFile(p, "Save/Replays/" + sFileName); + SAFE_DELETE(p); + return; } float @@ -2650,15 +2424,6 @@ class LunaScreenGameplay : public Luna pi->PushSelf(L); return 1; } - static int GetDummyPlayerInfo(T* p, lua_State* L) - { - int iDummyIndex = IArg(1); - PlayerInfo* pi = p->GetDummyPlayerInfo(iDummyIndex); - if (pi == NULL) - return 0; - pi->PushSelf(L); - return 1; - } static bool TurningPointsValid(lua_State* L, int index) { size_t size = lua_objlen(L, index); @@ -2793,7 +2558,6 @@ class LunaScreenGameplay : public Luna ADD_METHOD(Center1Player); ADD_METHOD(GetLifeMeter); ADD_METHOD(GetPlayerInfo); - ADD_METHOD(GetDummyPlayerInfo); // sm-ssc additions: ADD_METHOD(begin_backing_out); ADD_METHOD(GetTrueBPS); diff --git a/src/Etterna/Screen/Gameplay/ScreenGameplay.h b/src/Etterna/Screen/Gameplay/ScreenGameplay.h index ed011effa6..9081511319 100644 --- a/src/Etterna/Screen/Gameplay/ScreenGameplay.h +++ b/src/Etterna/Screen/Gameplay/ScreenGameplay.h @@ -38,7 +38,6 @@ class PlayerInfo MultiPlayer mp, bool bShowNoteField, int iAddToDifficulty); - void LoadDummyP1(int iDummyIndex, int iAddToDifficulty); /** * @brief Retrieve the player's state and stage stats index. @@ -68,7 +67,7 @@ class PlayerInfo RString GetName() const { if (m_bIsDummy) - return ssprintf("Dummy%d", m_iDummyIndex); + return ssprintf("PlayerInfoDummy"); if (IsMultiPlayer()) return MultiPlayerToString(m_mp); else @@ -83,11 +82,8 @@ class PlayerInfo /** @brief The present Player's multiplayer number. */ MultiPlayer m_mp{ MultiPlayer_Invalid }; bool m_bIsDummy{ false }; - int m_iDummyIndex{ 0 }; int m_iAddToDifficulty{ 0 }; // if > 0, use the Nth harder Steps bool m_bPlayerEnabled{ false }; // IsEnabled cache for iterators - PlayerState m_PlayerStateDummy; - PlayerStageStats m_PlayerStageStatsDummy; SoundEffectControl m_SoundEffectControl; /** @@ -102,8 +98,6 @@ class PlayerInfo BitmapText* m_ptextStepsDescription; /** @brief The primary ScoreKeeper for keeping track of the score. */ ScoreKeeper* m_pPrimaryScoreKeeper; - /** @brief The secondary ScoreKeeper. Formerly used in PLAY_MODE_RAVE. */ - ScoreKeeper* m_pSecondaryScoreKeeper; /** @brief The current PlayerOptions that are activated. */ BitmapText* m_ptextPlayerOptions; /** @brief The current attack modifiers that are in play for the moment. */ @@ -148,7 +142,6 @@ class ScreenGameplay : public ScreenWithMenuElements void PushSelf(lua_State* L) override; LifeMeter* GetLifeMeter(PlayerNumber pn); PlayerInfo* GetPlayerInfo(PlayerNumber pn); - PlayerInfo* GetDummyPlayerInfo(int iDummyIndex); void FailFadeRemovePlayer(PlayerInfo* pi); void FailFadeRemovePlayer(PlayerNumber pn); @@ -194,13 +187,6 @@ class ScreenGameplay : public ScreenWithMenuElements ThemeMetric MIN_SECONDS_TO_STEP; ThemeMetric MIN_SECONDS_TO_MUSIC; ThemeMetric MIN_SECONDS_TO_STEP_NEXT_SONG; - ThemeMetric START_GIVES_UP; - ThemeMetric BACK_GIVES_UP; - ThemeMetric SELECT_SKIPS_SONG; - ThemeMetric GIVING_UP_GOES_TO_PREV_SCREEN; - /** @brief The miss combo a player needs to fail out of a song. */ - ThemeMetric FAIL_ON_MISS_COMBO; - ThemeMetric ALLOW_CENTER_1_PLAYER; ThemeMetric SONG_NUMBER_FORMAT; void SetupSong(int iSongIndex); @@ -262,7 +248,6 @@ class ScreenGameplay : public ScreenWithMenuElements /** @brief Used between songs in a course to show the next song. */ Transition m_NextSong; - BitmapText m_textSongOptions; BitmapText m_Scoreboard[NUM_NSScoreBoardColumn]; // for NSMAN, so we can // have a scoreboard @@ -272,10 +257,7 @@ class ScreenGameplay : public ScreenWithMenuElements RageTimer m_GiveUpTimer; bool m_gave_up; - RageTimer m_SkipSongTimer; - bool m_skipped_song; void AbortGiveUpText(bool show_abort_text); - void AbortSkipSong(bool show_text); void AbortGiveUp(bool bShowText); void ResetGiveUpTimers(bool show_text); diff --git a/src/Etterna/Screen/Network/ScreenSMOnlineLogin.cpp b/src/Etterna/Screen/Network/ScreenSMOnlineLogin.cpp index d9596c937b..5e30033297 100644 --- a/src/Etterna/Screen/Network/ScreenSMOnlineLogin.cpp +++ b/src/Etterna/Screen/Network/ScreenSMOnlineLogin.cpp @@ -66,9 +66,9 @@ ScreenSMOnlineLogin::ImportOptions(int iRow, const PlayerNumber& vpns) PROFILEMAN->GetLocalProfileIDs(vsProfiles); vector::iterator iter = - find(vsProfiles.begin(), - vsProfiles.end(), - ProfileManager::m_sDefaultLocalProfileID[PLAYER_1].Get()); + find(vsProfiles.begin(), + vsProfiles.end(), + ProfileManager::m_sDefaultLocalProfileID[PLAYER_1].Get()); if (iter != vsProfiles.end()) m_pRows[0]->SetOneSelection((PlayerNumber)PLAYER_1, iter - vsProfiles.begin()); @@ -84,19 +84,16 @@ ScreenSMOnlineLogin::ExportOptions(int iRow, const PlayerNumber& vpns) vector vsProfiles; PROFILEMAN->GetLocalProfileIDs(vsProfiles); - FOREACH_EnabledPlayer(pn) - { - auto selection = m_pRows[0]->GetOneSelection(pn); - if (selection < - static_cast( - m_pRows[0]->GetHandler()->m_Def.m_vsChoices.size()) - - 1) { - ProfileManager::m_sDefaultLocalProfileID[pn].Set( - vsProfiles[selection]); - typeUsername = false; - } else - typeUsername = true; - } + auto selection = m_pRows[0]->GetOneSelection(PLAYER_1); + if (selection < + static_cast( + m_pRows[0]->GetHandler()->m_Def.m_vsChoices.size()) - + 1) { + ProfileManager::m_sDefaultLocalProfileID[PLAYER_1].Set( + vsProfiles[selection]); + typeUsername = false; + } else + typeUsername = true; } break; } } @@ -155,9 +152,10 @@ ScreenSMOnlineLogin::HandleScreenMessage(const ScreenMessage SM) } else { sLoginQuestion = "Enter username"; ScreenTextEntry::TextEntry(SM_UsernameDone, - NSMAN->loginResponse + "\n\n" + - sLoginQuestion, - "", 255); + NSMAN->loginResponse + "\n\n" + + sLoginQuestion, + "", + 255); } } } else if (SM == SM_GoToNextScreen) { @@ -166,10 +164,7 @@ ScreenSMOnlineLogin::HandleScreenMessage(const ScreenMessage SM) ExportOptions(r, GAMESTATE->GetMasterPlayerNumber()); PREFSMAN->SavePrefsToDisk(); - FOREACH_EnabledPlayer(pn) - { - PROFILEMAN->LoadLocalProfileFromMachine(pn); - } + PROFILEMAN->LoadLocalProfileFromMachine(PLAYER_1); if (GAMESTATE->IsPlayerEnabled((PlayerNumber)0) && GAMESTATE->IsPlayerEnabled((PlayerNumber)1) && @@ -192,9 +187,10 @@ ScreenSMOnlineLogin::HandleScreenMessage(const ScreenMessage SM) } else { sLoginQuestion = "Enter username"; ScreenTextEntry::TextEntry(SM_UsernameDone, - NSMAN->loginResponse + "\n\n" + - sLoginQuestion, - "", 255); + NSMAN->loginResponse + "\n\n" + + sLoginQuestion, + "", + 255); } } return; diff --git a/src/Etterna/Screen/Options/ScreenOptions.cpp b/src/Etterna/Screen/Options/ScreenOptions.cpp index 3e0c117740..d3a1580989 100644 --- a/src/Etterna/Screen/Options/ScreenOptions.cpp +++ b/src/Etterna/Screen/Options/ScreenOptions.cpp @@ -140,15 +140,13 @@ ScreenOptions::Init() // init line highlights m_sprLineHighlight.Load( THEME->GetPathG(m_sName, ssprintf("LineHighlight P%d", PLAYER_1 + 1))); - m_sprLineHighlight->SetName( - ssprintf("LineHighlightP%d", PLAYER_1 + 1)); + m_sprLineHighlight->SetName(ssprintf("LineHighlightP%d", PLAYER_1 + 1)); m_sprLineHighlight->SetX(LINE_HIGHLIGHT_X); LOAD_ALL_COMMANDS(m_sprLineHighlight); m_frameContainer.AddChild(m_sprLineHighlight); // init cursors - m_Cursor.Load("OptionsCursor" + PlayerNumberToString(PLAYER_1), - true); + m_Cursor.Load("OptionsCursor" + PlayerNumberToString(PLAYER_1), true); m_Cursor.SetName("Cursor"); LOAD_ALL_COMMANDS(m_Cursor); m_frameContainer.AddChild(&m_Cursor); @@ -159,7 +157,7 @@ ScreenOptions::Init() THEME->GetPathF(m_sName, "explanation")); m_textExplanation.SetDrawOrder(2); m_textExplanation.SetName("Explanation" + - PlayerNumberToString(PLAYER_1)); + PlayerNumberToString(PLAYER_1)); LOAD_ALL_COMMANDS_AND_SET_XY(m_textExplanation); m_frameContainer.AddChild(&m_textExplanation); break; @@ -281,19 +279,16 @@ ScreenOptions::RestartOptions() } // Hide the highlight if no rows are enabled. - m_sprLineHighlight->SetVisible( - m_iCurrentRow != -1 && GAMESTATE->IsHumanPlayer(PLAYER_1)); + m_sprLineHighlight->SetVisible(m_iCurrentRow != -1 && + GAMESTATE->IsHumanPlayer(PLAYER_1)); CHECKPOINT_M("About to get the rows positioned right."); PositionRows(false); - FOREACH_HumanPlayer(pn) - { - for (unsigned r = 0; r < m_pRows.size(); ++r) { - this->RefreshIcons(r, pn); - } - PositionCursor(pn); + for (unsigned r = 0; r < m_pRows.size(); ++r) { + this->RefreshIcons(r, PLAYER_1); } + PositionCursor(PLAYER_1); AfterChangeRow(PLAYER_1); CHECKPOINT_M("Rows positioned."); @@ -710,7 +705,7 @@ ScreenOptions::AfterChangeValueOrRow(PlayerNumber pn) /* After changing a value, position underlines. Do this for both * players, since underlines for both players will change with * m_bOneChoiceForAllPlayers. */ - FOREACH_HumanPlayer(p) m_pRows[r]->PositionUnderlines(p); + m_pRows[r]->PositionUnderlines(PLAYER_1); m_pRows[r]->PositionIcons(pn); m_pRows[r]->SetRowHasFocus( pn, GAMESTATE->IsHumanPlayer(pn) && iCurRow == (int)r); @@ -725,7 +720,7 @@ ScreenOptions::AfterChangeValueOrRow(PlayerNumber pn) } // Update all players, since changing one player can move both cursors. - FOREACH_HumanPlayer(p) TweenCursor(p); + TweenCursor(PLAYER_1); OptionRow& row = *m_pRows[iCurRow]; const bool bExitSelected = row.GetRowType() == OptionRow::RowType_Exit; if (GAMESTATE->GetNumHumanPlayers() != 1 && PLAYER_1 != pn) @@ -915,10 +910,8 @@ ScreenOptions::ProcessMenuStart(const InputEventPlus& input) MenuDown(input); break; case NAV_THREE_KEY_ALT: - ChangeValueInRowRelative(m_iCurrentRow, - input.pn, - +1, - input.type != IET_FIRST_PRESS); + ChangeValueInRowRelative( + m_iCurrentRow, input.pn, +1, input.type != IET_FIRST_PRESS); break; case NAV_TOGGLE_THREE_KEY: @@ -965,12 +958,8 @@ ScreenOptions::StoreFocus(PlayerNumber pn) return; int iWidth, iY; - GetWidthXY(pn, - m_iCurrentRow, - row.GetChoiceInRowWithFocus(), - iWidth, - m_iFocusX, - iY); + GetWidthXY( + pn, m_iCurrentRow, row.GetChoiceInRowWithFocus(), iWidth, m_iFocusX, iY); LOG->Trace("cur selection %ix%i @ %i", m_iCurrentRow, row.GetChoiceInRowWithFocus(), @@ -1109,11 +1098,8 @@ ScreenOptions::ChangeValueInRowRelative(int iRow, if (bForceFocusedChoiceTogether) { // lock focus together - FOREACH_HumanPlayer(p) - { - row.SetChoiceInRowWithFocus(p, iNewChoiceWithFocus); - StoreFocus(p); - } + row.SetChoiceInRowWithFocus(PLAYER_1, iNewChoiceWithFocus); + StoreFocus(PLAYER_1); } } @@ -1223,12 +1209,9 @@ ScreenOptions::MoveRowAbsolute(PlayerNumber pn, int iRow) bool bChanged = false; if (m_InputMode == INPUTMODE_INDIVIDUAL && PLAYER_1 != pn) { } // skip - else if (m_iCurrentRow == iRow) - { + else if (m_iCurrentRow == iRow) { // also skip - } - else - { + } else { m_iCurrentRow = iRow; @@ -1239,7 +1222,8 @@ ScreenOptions::MoveRowAbsolute(PlayerNumber pn, int iRow) Message msg("ChangeRow"); msg.SetParam("PlayerNumber", PLAYER_1); msg.SetParam("RowIndex", GetCurrentRow(PLAYER_1)); - msg.SetParam("ChangedToExit", row.GetRowType() == OptionRow::RowType_Exit); + msg.SetParam("ChangedToExit", + row.GetRowType() == OptionRow::RowType_Exit); MESSAGEMAN->Broadcast(msg); } @@ -1334,7 +1318,8 @@ void ScreenOptions::SetOptionRowFromName( const RString& nombre ) for( unsigned i=0; iGetRowTitle() == nombre) && -m_pRows[i]->GetRowDef().IsEnabledForPlayer(PLAYER_1) ) MoveRowAbsolute(PLAYER_1,i) +m_pRows[i]->GetRowDef().IsEnabledForPlayer(PLAYER_1) ) +MoveRowAbsolute(PLAYER_1,i) } } */ diff --git a/src/Etterna/Screen/Others/ScreenPlayerOptions.cpp b/src/Etterna/Screen/Others/ScreenPlayerOptions.cpp index a6304c7c72..9bed62646a 100644 --- a/src/Etterna/Screen/Others/ScreenPlayerOptions.cpp +++ b/src/Etterna/Screen/Others/ScreenPlayerOptions.cpp @@ -24,7 +24,7 @@ ScreenPlayerOptions::Init() 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 + false); // unhide later if handicapping options are discovered m_sprDisqualify->SetDrawOrder(2); m_frameContainer.AddChild(m_sprDisqualify); @@ -45,11 +45,8 @@ ScreenPlayerOptions::BeginScreen() ScreenOptionsMaster::BeginScreen(); - FOREACH_HumanPlayer(p) - { - for (unsigned r = 0; r < m_pRows.size(); r++) - UpdateDisqualified(r, p); - } + for (unsigned r = 0; r < m_pRows.size(); r++) + UpdateDisqualified(r, PLAYER_1); } bool @@ -123,9 +120,8 @@ ScreenPlayerOptions::UpdateDisqualified(int row, PlayerNumber pn) // Find out if the current row when exported causes disqualification. // Exporting the row will fill GAMESTATE->m_PlayerOptions. - PO_GROUP_CALL(GAMESTATE->m_pPlayerState->m_PlayerOptions, - ModsLevel_Preferred, - Init); + PO_GROUP_CALL( + GAMESTATE->m_pPlayerState->m_PlayerOptions, ModsLevel_Preferred, Init); ExportOptions(row, pn); bool bRowCausesDisqualified = GAMESTATE->CurrentOptionsDisqualifyPlayer(pn); @@ -143,7 +139,8 @@ ScreenPlayerOptions::UpdateDisqualified(int row, PlayerNumber pn) m_sprDisqualify->SetVisible(bDisqualified); // restore previous player options in case the user escapes back after this - GAMESTATE->m_pPlayerState->m_PlayerOptions.Assign(ModsLevel_Preferred, poOrig); + GAMESTATE->m_pPlayerState->m_PlayerOptions.Assign(ModsLevel_Preferred, + poOrig); } // lua start diff --git a/src/Etterna/Screen/Others/ScreenSelect.cpp b/src/Etterna/Screen/Others/ScreenSelect.cpp index 486b2dc34e..8f3b89ee6d 100644 --- a/src/Etterna/Screen/Others/ScreenSelect.cpp +++ b/src/Etterna/Screen/Others/ScreenSelect.cpp @@ -186,31 +186,12 @@ ScreenSelect::HandleScreenMessage(const ScreenMessage SM) ASSERT(GAMESTATE->GetMasterPlayerNumber() != PlayerNumber_Invalid); int iMastersIndex = this->GetSelectionIndex(GAMESTATE->GetMasterPlayerNumber()); - bool bAllPlayersChoseTheSame = true; - FOREACH_HumanPlayer(p) - { - if (this->GetSelectionIndex(p) != iMastersIndex) { - bAllPlayersChoseTheSame = false; - break; - } - } if (!m_aGameCommands.empty()) { - if (bAllPlayersChoseTheSame) { - const GameCommand& gc = m_aGameCommands[iMastersIndex]; - m_sNextScreen = gc.m_sScreen; - if (!gc.m_bInvalid) - gc.ApplyToAllPlayers(); - } else { - FOREACH_HumanPlayer(p) - { - int iIndex = this->GetSelectionIndex(p); - const GameCommand& gc = m_aGameCommands[iIndex]; - m_sNextScreen = gc.m_sScreen; - if (!gc.m_bInvalid) - gc.Apply(p); - } - } + const GameCommand& gc = m_aGameCommands[iMastersIndex]; + m_sNextScreen = gc.m_sScreen; + if (!gc.m_bInvalid) + gc.ApplyToAllPlayers(); } StopTimer(); diff --git a/src/Etterna/Screen/Others/ScreenWithMenuElements.cpp b/src/Etterna/Screen/Others/ScreenWithMenuElements.cpp index ad190da4a2..85fbdd3e61 100644 --- a/src/Etterna/Screen/Others/ScreenWithMenuElements.cpp +++ b/src/Etterna/Screen/Others/ScreenWithMenuElements.cpp @@ -124,12 +124,9 @@ void ScreenWithMenuElements::HandleScreenMessage(const ScreenMessage SM) { if (SM == SM_MenuTimer) { - FOREACH_HumanPlayer(p) - { - InputEventPlus iep; - iep.pn = p; - MenuStart(iep); - } + InputEventPlus iep; + iep.pn = PLAYER_1; + MenuStart(iep); } Screen::HandleScreenMessage(SM); diff --git a/src/Etterna/Singletons/GameState.cpp b/src/Etterna/Singletons/GameState.cpp index 5086ad5bb0..a3ae09fa69 100644 --- a/src/Etterna/Singletons/GameState.cpp +++ b/src/Etterna/Singletons/GameState.cpp @@ -38,16 +38,7 @@ class GameStateMessageHandler : public MessageSubscriber void HandleMessage(const Message& msg) override { if (msg.GetName() == "RefreshCreditText") { - RString sJoined; - FOREACH_HumanPlayer(pn) - { - if (sJoined != "") - sJoined += ", "; - sJoined += ssprintf("P%i", pn + 1); - } - - if (sJoined == "") - sJoined = "none"; + RString sJoined("P1"); if (PREFSMAN->m_verbose_log > 0) LOG->MapLog("JOINED", "Players joined: %s", sJoined.c_str()); @@ -114,7 +105,8 @@ GameState::GameState() m_PlayMode.Set( PlayMode_Invalid); // used by IsPlayerEnabled before the first screen - m_bSideIsJoined = false; // used by GetNumSidesJoined before the first screen + m_bSideIsJoined = + false; // used by GetNumSidesJoined before the first screen m_pPlayerState = new PlayerState; m_pPlayerState->SetPlayerNumber(PLAYER_1); @@ -255,14 +247,13 @@ GameState::Reset() FOREACH_MultiPlayer(p) m_MultiPlayerStatus[p] = MultiPlayerStatus_NotJoined; // m_iCoins = 0; // don't reset coin count! - m_bMultiplayer = false; m_iNumMultiplayerNoteFields = 1; *m_Environment = LuaTable(); m_sPreferredSongGroup.Set(GROUP_ALL); m_bFailTypeWasExplicitlySet = false; m_SortOrder.Set(SortOrder_Invalid); m_PreferredSortOrder = GetDefaultSort(); - m_PlayMode.Set( PlayMode_Invalid ); + m_PlayMode.Set(PlayMode_Invalid); m_iCurrentStageIndex = 0; m_bGameplayLeadIn.Set(false); @@ -327,18 +318,7 @@ GameState::UnjoinPlayer(PlayerNumber pn) ResetPlayer(pn); if (this->GetMasterPlayerNumber() == pn) { - // We can't use GetFirstHumanPlayer() because if both players were - // joined, GetFirstHumanPlayer() will always return PLAYER_1, even when - // PLAYER_1 is the player we're unjoining. - FOREACH_HumanPlayer(hp) - { - if (pn != hp) { - this->SetMasterPlayerNumber(hp); - } - } - if (this->GetMasterPlayerNumber() == pn) { - this->SetMasterPlayerNumber(PLAYER_INVALID); - } + this->SetMasterPlayerNumber(PLAYER_INVALID); } Message msg(MessageIDToString(Message_PlayerUnjoined)); @@ -420,30 +400,28 @@ GameState::BeginGame() void GameState::LoadProfiles(bool bLoadEdits) { - FOREACH_HumanPlayer(pn) - { - // If a profile is already loaded, this was already called. - if (PROFILEMAN->IsPersistentProfile(pn)) - continue; + // If a profile is already loaded, this was already called. + bool bPersistent = PROFILEMAN->IsPersistentProfile(PLAYER_1); + if (!bPersistent) + return; - bool bSuccess = PROFILEMAN->LoadFirstAvailableProfile( - pn, bLoadEdits); // load full profile + bool bSuccess = PROFILEMAN->LoadFirstAvailableProfile( + PLAYER_1, bLoadEdits); // load full profile - if (!bSuccess) - continue; + if (!bSuccess) + return; - LoadCurrentSettingsFromProfile(pn); + LoadCurrentSettingsFromProfile(PLAYER_1); - Profile* pPlayerProfile = PROFILEMAN->GetProfile(pn); - if (pPlayerProfile) - pPlayerProfile->m_iTotalSessions++; - } + Profile* pPlayerProfile = PROFILEMAN->GetProfile(PLAYER_1); + if (pPlayerProfile) + pPlayerProfile->m_iTotalSessions++; } void GameState::SavePlayerProfiles() { - FOREACH_HumanPlayer(pn) SavePlayerProfile(pn); + SavePlayerProfile(PLAYER_1); } void @@ -464,15 +442,12 @@ GameState::SavePlayerProfile(PlayerNumber pn) bool GameState::HaveProfileToLoad() { - FOREACH_HumanPlayer(pn) - { - // We won't load this profile if it's already loaded. - if (PROFILEMAN->IsPersistentProfile(pn)) - continue; + // We won't load this profile if it's already loaded. + if (PROFILEMAN->IsPersistentProfile(PLAYER_1)) + return false; - if (!PROFILEMAN->m_sDefaultLocalProfileID[pn].Get().empty()) - return true; - } + if (!PROFILEMAN->m_sDefaultLocalProfileID[PLAYER_1].Get().empty()) + return true; return false; } @@ -480,8 +455,8 @@ GameState::HaveProfileToLoad() bool GameState::HaveProfileToSave() { - FOREACH_HumanPlayer( - pn) if (PROFILEMAN->IsPersistentProfile(pn)) return true; + if (PROFILEMAN->IsPersistentProfile(PLAYER_1)) + return true; return false; } @@ -527,7 +502,7 @@ GameState::BeginStage() if (!ARE_STAGE_PLAYER_MODS_FORCED) { ModsGroup& po = m_pPlayerState->m_PlayerOptions; po.Assign(ModsLevel_Stage, - m_pPlayerState->m_PlayerOptions.GetPreferred()); + m_pPlayerState->m_PlayerOptions.GetPreferred()); } if (!ARE_STAGE_SONG_MODS_FORCED) m_SongOptions.Assign(ModsLevel_Stage, m_SongOptions.GetPreferred()); @@ -536,24 +511,21 @@ GameState::BeginStage() m_SongOptions.GetSong().m_fMusicRate; m_iNumStagesOfThisSong = GetNumStagesForCurrentSongAndStepsOrCourse(); ASSERT(m_iNumStagesOfThisSong != -1); - FOREACH_EnabledPlayer(p) - { - // 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 < m_iNumStagesOfThisSong) { - LuaHelpers::ReportScriptErrorFmt( - "Player %d only has %d stage tokens, but needs %d.", - p, - m_iPlayerStageTokens, - m_iNumStagesOfThisSong); - } + + // 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(PLAYER_1)) { + if (m_iPlayerStageTokens < m_iNumStagesOfThisSong) { + LuaHelpers::ReportScriptErrorFmt( + "Player %d only has %d stage tokens, but needs %d.", + PLAYER_1, + m_iPlayerStageTokens, + m_iNumStagesOfThisSong); } - m_iPlayerStageTokens -= m_iNumStagesOfThisSong; } - FOREACH_HumanPlayer(pn) if (CurrentOptionsDisqualifyPlayer(pn)) - STATSMAN->m_CurStageStats.m_player - .m_bDisqualified = true; + m_iPlayerStageTokens -= m_iNumStagesOfThisSong; + if (CurrentOptionsDisqualifyPlayer(PLAYER_1)) + STATSMAN->m_CurStageStats.m_player.m_bDisqualified = true; m_sStageGUID = CryptManager::GenerateRandomUUID(); } @@ -569,20 +541,15 @@ void GameState::CommitStageStats() { - STATSMAN->CommitStatsToProfiles(&STATSMAN->m_CurStageStats); - // Update TotalPlaySeconds. int iPlaySeconds = max(0, static_cast(m_timeGameStarted.GetDeltaTime())); - FOREACH_HumanPlayer(p) - { - Profile* pPlayerProfile = PROFILEMAN->GetProfile(p); - if (pPlayerProfile) - pPlayerProfile->m_iTotalSessionSeconds += iPlaySeconds; - } + Profile* pPlayerProfile = PROFILEMAN->GetProfile(PLAYER_1); + if (pPlayerProfile) + pPlayerProfile->m_iTotalSessionSeconds += iPlaySeconds; } /* Called by ScreenSelectMusic (etc). Increment the stage counter if we just @@ -596,12 +563,8 @@ GameState::FinishStage() m_iNumStagesOfThisSong = 0; // Save the current combo to the profiles (why not) - FOREACH_HumanPlayer(p) - { - Profile* pProfile = PROFILEMAN->GetProfile(p); - pProfile->m_iCurrentCombo = - STATSMAN->m_CurStageStats.m_player.m_iCurCombo; - } + Profile* pProfile = PROFILEMAN->GetProfile(PLAYER_1); + pProfile->m_iCurrentCombo = STATSMAN->m_CurStageStats.m_player.m_iCurCombo; } void @@ -671,44 +634,39 @@ GameState::CanSafelyEnterGameplay(RString& reason) return false; } - FOREACH_EnabledPlayer(pn) - { - Style const* style = GetCurrentStyle(pn); - if (style == NULL) { - reason = ssprintf("Style for player %d is NULL.", pn + 1); - return false; - } + Style const* style = GetCurrentStyle(PLAYER_1); + if (style == NULL) { + reason = ssprintf("Style for player %d is NULL.", PLAYER_1 + 1); + return false; + } - Steps const* steps = m_pCurSteps; - if (steps == NULL) { - reason = ssprintf("Steps for player %d is NULL.", pn + 1); - return false; - } - if (steps->m_StepsType != style->m_StepsType) { - reason = - ssprintf("Player %d StepsType %s for steps does not equal " - "StepsType %s for style.", - pn + 1, - GAMEMAN->GetStepsTypeInfo(steps->m_StepsType).szName, - GAMEMAN->GetStepsTypeInfo(style->m_StepsType).szName); - return false; - } - if (steps->m_pSong != m_pCurSong) { - reason = ssprintf( - "Steps for player %d are not for the current song.", pn + 1); - return false; - } - NoteData ndtemp; - steps->GetNoteData(ndtemp); - if (ndtemp.GetNumTracks() != style->m_iColsPerPlayer) { - reason = - ssprintf("Steps for player %d have %d columns, style has %d " - "columns.", - pn + 1, - ndtemp.GetNumTracks(), - style->m_iColsPerPlayer); - return false; - } + Steps const* steps = m_pCurSteps; + if (steps == NULL) { + reason = ssprintf("Steps for player %d is NULL.", PLAYER_1 + 1); + return false; + } + if (steps->m_StepsType != style->m_StepsType) { + reason = ssprintf("Player %d StepsType %s for steps does not equal " + "StepsType %s for style.", + PLAYER_1 + 1, + GAMEMAN->GetStepsTypeInfo(steps->m_StepsType).szName, + GAMEMAN->GetStepsTypeInfo(style->m_StepsType).szName); + return false; + } + if (steps->m_pSong != m_pCurSong) { + reason = ssprintf("Steps for player %d are not for the current song.", + PLAYER_1 + 1); + return false; + } + NoteData ndtemp; + steps->GetNoteData(ndtemp); + if (ndtemp.GetNumTracks() != style->m_iColsPerPlayer) { + reason = ssprintf("Steps for player %d have %d columns, style has %d " + "columns.", + PLAYER_1 + 1, + ndtemp.GetNumTracks(), + style->m_iColsPerPlayer); + return false; } return true; } @@ -718,24 +676,22 @@ GameState::SetCompatibleStylesForPlayers() { bool style_set = false; if (!style_set) { - FOREACH_EnabledPlayer(pn) - { - StepsType st = StepsType_Invalid; - if (m_pCurSteps != NULL) { - st = m_pCurSteps->m_StepsType; - } else { - vector vst; - GAMEMAN->GetStepsTypesForGame(m_pCurGame, vst); - st = vst[0]; - } - const Style* style = GAMEMAN->GetFirstCompatibleStyle( - m_pCurGame, GetNumSidesJoined(), st); - SetCurrentStyle(style, pn); + StepsType st = StepsType_Invalid; + if (m_pCurSteps != NULL) { + st = m_pCurSteps->m_StepsType; + } else { + vector vst; + GAMEMAN->GetStepsTypesForGame(m_pCurGame, vst); + st = vst[0]; } + const Style* style = + GAMEMAN->GetFirstCompatibleStyle(m_pCurGame, GetNumSidesJoined(), st); + SetCurrentStyle(style, PLAYER_1); } } -void GameState::ForceOtherPlayersToCompatibleSteps(PlayerNumber main) +void +GameState::ForceOtherPlayersToCompatibleSteps(PlayerNumber main) { Steps* steps_to_match = m_pCurSteps.Get(); if (steps_to_match == NULL) { @@ -748,26 +704,21 @@ void GameState::ForceOtherPlayersToCompatibleSteps(PlayerNumber main) GAMESTATE->GetCurrentGame(), num_players, steps_to_match->m_StepsType) ->m_StyleType; RString music_to_match = steps_to_match->GetMusicFile(); - FOREACH_EnabledPlayer(pn) - { - Steps* pn_steps = m_pCurSteps.Get(); - bool match_failed = pn_steps == NULL; - if (steps_to_match != pn_steps && pn_steps != NULL) { - StyleType pn_styletype = - GAMEMAN - ->GetFirstCompatibleStyle(GAMESTATE->GetCurrentGame(), - num_players, - pn_steps->m_StepsType) - ->m_StyleType; - if (music_to_match != pn_steps->GetMusicFile()) - { - match_failed = true; - } - } - if (match_failed) { - m_pCurSteps.Set(steps_to_match); + Steps* pn_steps = m_pCurSteps.Get(); + bool match_failed = pn_steps == NULL; + if (steps_to_match != pn_steps && pn_steps != NULL) { + StyleType pn_styletype = + GAMEMAN + ->GetFirstCompatibleStyle( + GAMESTATE->GetCurrentGame(), num_players, pn_steps->m_StepsType) + ->m_StyleType; + if (music_to_match != pn_steps->GetMusicFile()) { + match_failed = true; } } + if (match_failed) { + m_pCurSteps.Set(steps_to_match); + } } void @@ -841,16 +792,12 @@ GameState::UpdateSongPosition(float fPositionSeconds, m_Position.UpdateSongPosition(fPositionSeconds, timing, timestamp); - FOREACH_EnabledPlayer(pn) - { - if (m_pCurSteps) { - m_pPlayerState->m_Position.UpdateSongPosition( - fPositionSeconds, *m_pCurSteps->GetTimingData(), timestamp); - Actor::SetPlayerBGMBeat( - pn, - m_pPlayerState->m_Position.m_fSongBeatVisible, - m_pPlayerState->m_Position.m_fSongBeatNoOffset); - } + if (m_pCurSteps) { + m_pPlayerState->m_Position.UpdateSongPosition( + fPositionSeconds, *m_pCurSteps->GetTimingData(), timestamp); + Actor::SetPlayerBGMBeat(PLAYER_1, + m_pPlayerState->m_Position.m_fSongBeatVisible, + m_pPlayerState->m_Position.m_fSongBeatNoOffset); } Actor::SetBGMTime(GAMESTATE->m_Position.m_fMusicSecondsVisible, GAMESTATE->m_Position.m_fSongBeatVisible, @@ -860,10 +807,6 @@ GameState::UpdateSongPosition(float fPositionSeconds, // m_bFreeze = %f", m_fMusicSeconds, m_fSongBeat, m_fCurBPS, m_bFreeze ); } -/* -update player position code goes here - */ - float GameState::GetSongPercent(float beat) const { @@ -886,19 +829,7 @@ int GameState::GetCourseSongIndex() const { // iSongsPlayed includes the current song, so it's 1-based; subtract one. - if (GAMESTATE->m_bMultiplayer) { - FOREACH_EnabledMultiPlayer(mp) return STATSMAN->m_CurStageStats - .m_multiPlayer[mp] - .m_iSongsPlayed - - 1; - - FAIL_M("At least one MultiPlayer must be joined."); - - } else { - return STATSMAN->m_CurStageStats.m_player - .m_iSongsPlayed - - 1; - } + return STATSMAN->m_CurStageStats.m_player.m_iSongsPlayed - 1; } /* Hack: when we're loading a new course song, we want to display the new song * number, even though we haven't started that song yet. */ @@ -1023,9 +954,7 @@ GameState::IsPlayerEnabled(const PlayerState* pPlayerState) const int GameState::GetNumPlayersEnabled() const { - int count = 0; - FOREACH_EnabledPlayer(pn) count++; - return count; + return 1; } bool @@ -1040,8 +969,7 @@ GameState::IsHumanPlayer(PlayerNumber pn) const return m_bSideIsJoined; } else { StyleType type = GetCurrentStyle(pn)->m_StyleType; - switch( type ) - { + switch (type) { case StyleType_OnePlayerOneSide: case StyleType_OnePlayerTwoSides: return pn == this->GetMasterPlayerNumber(); @@ -1053,33 +981,29 @@ GameState::IsHumanPlayer(PlayerNumber pn) const if (GetCurrentStyle(pn) == NULL) // no style chosen { return m_bSideIsJoined; // only allow input from sides that have - // already joined + // already joined } StyleType type = GetCurrentStyle(pn)->m_StyleType; - switch( type ) - { - case StyleType_OnePlayerOneSide: - case StyleType_OnePlayerTwoSides: - return pn == this->GetMasterPlayerNumber(); - default: - FAIL_M(ssprintf("Invalid style type: %i", type)); + switch (type) { + case StyleType_OnePlayerOneSide: + case StyleType_OnePlayerTwoSides: + return pn == this->GetMasterPlayerNumber(); + default: + FAIL_M(ssprintf("Invalid style type: %i", type)); } } int GameState::GetNumHumanPlayers() const { - int count = 0; - FOREACH_HumanPlayer(pn) count++; - return count; + return 1; } PlayerNumber GameState::GetFirstHumanPlayer() const { - FOREACH_HumanPlayer(pn) return pn; - return PLAYER_INVALID; + return PLAYER_1; } PlayerNumber @@ -1099,7 +1023,6 @@ GameState::IsCpuPlayer(PlayerNumber pn) const bool GameState::AnyPlayersAreCpu() const { - FOREACH_CpuPlayer(pn) return true; return false; } @@ -1132,8 +1055,7 @@ GameState::ResetToDefaultSongOptions(ModsLevel l) void GameState::ApplyPreferredModifiers(PlayerNumber pn, const RString& sModifiers) { - m_pPlayerState->m_PlayerOptions.FromString(ModsLevel_Preferred, - sModifiers); + m_pPlayerState->m_PlayerOptions.FromString(ModsLevel_Preferred, sModifiers); m_SongOptions.FromString(ModsLevel_Preferred, sModifiers); } @@ -1150,32 +1072,18 @@ GameState::CurrentOptionsDisqualifyPlayer(PlayerNumber pn) if (!IsHumanPlayer(pn)) return false; - const PlayerOptions& po = - m_pPlayerState->m_PlayerOptions.GetPreferred(); + const PlayerOptions& po = 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); } -/* reset noteskins (?) - * GameState::ResetNoteSkins() - * GameState::ResetNoteSkinsForPlayer( PlayerNumber pn ) - * - */ - void GameState::GetAllUsedNoteSkins(vector& out) const { - FOREACH_EnabledPlayer(pn) - { - out.push_back( - m_pPlayerState->m_PlayerOptions.GetCurrent().m_sNoteSkin); - } - - // Remove duplicates. - sort(out.begin(), out.end()); - out.erase(unique(out.begin(), out.end()), out.end()); + // if this list returns multiple values, the values should be unique. + out.push_back(m_pPlayerState->m_PlayerOptions.GetCurrent().m_sNoteSkin); } void @@ -1231,18 +1139,19 @@ GameState::ShowW1() const bool GameState::AllAreInDangerOrWorse() const { - if (m_pPlayerState->m_HealthState < HealthState_Danger) return false; + if (m_pPlayerState->m_HealthState < HealthState_Danger) + return false; return true; } bool GameState::OneIsHot() const { - if (m_pPlayerState->m_HealthState == HealthState_Hot) return true; + if (m_pPlayerState->m_HealthState == HealthState_Hot) + return true; return false; } - int GameState::GetNumCols(int pn) { @@ -1265,8 +1174,8 @@ GameState::ChangePreferredDifficultyAndStepsType(PlayerNumber pn, m_PreferredDifficulty.Set(dc); m_PreferredStepsType.Set(st); if (DifficultiesLocked()) - if (PLAYER_1 != pn) m_PreferredDifficulty.Set( - m_PreferredDifficulty); + if (PLAYER_1 != pn) + m_PreferredDifficulty.Set(m_PreferredDifficulty); return true; } @@ -1326,8 +1235,8 @@ GameState::GetEasiestStepsDifficulty() const if (m_pCurSteps == NULL) { LuaHelpers::ReportScriptErrorFmt( - "GetEasiestStepsDifficulty called but p%i hasn't chosen notes", - PLAYER_1 + 1); + "GetEasiestStepsDifficulty called but p%i hasn't chosen notes", + PLAYER_1 + 1); } dc = min(dc, m_pCurSteps->GetDifficulty()); @@ -1340,8 +1249,8 @@ GameState::GetHardestStepsDifficulty() const Difficulty dc = Difficulty_Beginner; if (m_pCurSteps == NULL) { LuaHelpers::ReportScriptErrorFmt( - "GetHardestStepsDifficulty called but p%i hasn't chosen notes", - PLAYER_1 + 1); + "GetHardestStepsDifficulty called but p%i hasn't chosen notes", + PLAYER_1 + 1); } dc = max(dc, m_pCurSteps->GetDifficulty()); return dc; @@ -1469,18 +1378,10 @@ GameState::updateDiscordPresenceMenu(const RString& largeImageText) class LunaGameState : public Luna { public: - DEFINE_METHOD(IsPlayerEnabled, - IsPlayerEnabled(PLAYER_1)) + DEFINE_METHOD(IsPlayerEnabled, IsPlayerEnabled(PLAYER_1)) DEFINE_METHOD(IsHumanPlayer, IsHumanPlayer(PLAYER_1)) - DEFINE_METHOD(GetPlayerDisplayName, - GetPlayerDisplayName(PLAYER_1)) + DEFINE_METHOD(GetPlayerDisplayName, GetPlayerDisplayName(PLAYER_1)) DEFINE_METHOD(GetMasterPlayerNumber, GetMasterPlayerNumber()) - DEFINE_METHOD(GetMultiplayer, m_bMultiplayer) - static int SetMultiplayer(T* p, lua_State* L) - { - p->m_bMultiplayer = BArg(1); - COMMON_RETURN_SELF; - } DEFINE_METHOD(GetNumMultiplayerNoteFields, m_iNumMultiplayerNoteFields) DEFINE_METHOD(ShowW1, ShowW1()) @@ -1616,14 +1517,12 @@ class LunaGameState : public Luna p->m_PreferredDifficulty.Set(dc); COMMON_RETURN_SELF; } - DEFINE_METHOD(GetPreferredDifficulty, - m_PreferredDifficulty) + DEFINE_METHOD(GetPreferredDifficulty, m_PreferredDifficulty) DEFINE_METHOD(GetPlayMode, m_PlayMode) DEFINE_METHOD(GetSortOrder, m_SortOrder) DEFINE_METHOD(GetCurrentStageIndex, m_iCurrentStageIndex) DEFINE_METHOD(PlayerIsUsingModifier, - PlayerIsUsingModifier(PLAYER_1, - SArg(2))) + PlayerIsUsingModifier(PLAYER_1, SArg(2))) DEFINE_METHOD(GetLoadingCourseSongIndex, GetLoadingCourseSongIndex()) DEFINE_METHOD(GetEasiestStepsDifficulty, GetEasiestStepsDifficulty()) DEFINE_METHOD(GetHardestStepsDifficulty, GetHardestStepsDifficulty()) @@ -1636,8 +1535,7 @@ class LunaGameState : public Luna } DEFINE_METHOD(GetLastGameplayDuration, m_DanceDuration) DEFINE_METHOD(GetGameplayLeadIn, m_bGameplayLeadIn) - DEFINE_METHOD(IsSideJoined, - m_bSideIsJoined) + DEFINE_METHOD(IsSideJoined, m_bSideIsJoined) DEFINE_METHOD(PlayersCanJoin, PlayersCanJoin()) DEFINE_METHOD(GetNumSidesJoined, GetNumSidesJoined()) DEFINE_METHOD(GetSongOptionsString, m_SongOptions.GetCurrent().GetString()) @@ -1717,17 +1615,14 @@ class LunaGameState : public Luna // use a vector and not a set so that ordering is maintained vector vpStepsToShow; - FOREACH_HumanPlayer(p) - { - const Steps* pSteps = GAMESTATE->m_pCurSteps; - if (pSteps == NULL) - return 0; - bool bAlreadyAdded = - find(vpStepsToShow.begin(), vpStepsToShow.end(), pSteps) != - vpStepsToShow.end(); - if (!bAlreadyAdded) - vpStepsToShow.push_back(pSteps); - } + const Steps* pSteps = GAMESTATE->m_pCurSteps; + if (pSteps == NULL) + return 0; + bool bAlreadyAdded = + find(vpStepsToShow.begin(), vpStepsToShow.end(), pSteps) != + vpStepsToShow.end(); + if (!bAlreadyAdded) + vpStepsToShow.push_back(pSteps); for (unsigned i = 0; i < vpStepsToShow.size(); i++) { const Steps* pSteps = vpStepsToShow[i]; @@ -1751,11 +1646,7 @@ class LunaGameState : public Luna static int GetHumanPlayers(T* p, lua_State* L) { vector vHP; - FOREACH_HumanPlayer(pn) - { - if (pn == PLAYER_1) - vHP.push_back(pn); - } + vHP.push_back(PLAYER_1); LuaHelpers::CreateTableFromArray(vHP, L); return 1; @@ -1763,7 +1654,7 @@ class LunaGameState : public Luna static int GetEnabledPlayers(T*, lua_State* L) { vector vEP; - FOREACH_EnabledPlayer(pn) vEP.push_back(pn); + vEP.push_back(PLAYER_1); LuaHelpers::CreateTableFromArray(vEP, L); return 1; } @@ -1789,14 +1680,13 @@ class LunaGameState : public Luna LuaHelpers::Push(L, p->m_iGameSeed); return 1; } - static int JoinInput( T* p, lua_State *L ) + static int JoinInput(T* p, lua_State* L) { LuaHelpers::Push(L, p->m_iStageSeed); return 1; } static int SaveLocalData(T* p, lua_State* L) { COMMON_RETURN_SELF; } - static int Reset(T* p, lua_State* L) { p->Reset(); @@ -1840,9 +1730,7 @@ class LunaGameState : public Luna static int InsertCredit(T* p, lua_State* L) { COMMON_RETURN_SELF; } static int CurrentOptionsDisqualifyPlayer(T* p, lua_State* L) { - lua_pushboolean( - L, - p->CurrentOptionsDisqualifyPlayer(PLAYER_1)); + lua_pushboolean(L, p->CurrentOptionsDisqualifyPlayer(PLAYER_1)); return 1; } @@ -1917,7 +1805,7 @@ class LunaGameState : public Luna st == StyleType_OnePlayerTwoSides)) { luaL_error( L, "Too many sides joined for style %s", pStyle->m_szName); - } + } if (!AreStyleAndPlayModeCompatible(p, L, pStyle, p->m_PlayMode)) { COMMON_RETURN_SELF; @@ -1967,7 +1855,8 @@ class LunaGameState : public Luna static int SetAutoplay(T* p, lua_State* L) { // Don't allow disabling replay controlller - if (PC_REPLAY == p->m_pPlayerState->m_PlayerController || PC_REPLAY == GamePreferences::m_AutoPlay) + if (PC_REPLAY == p->m_pPlayerState->m_PlayerController || + PC_REPLAY == GamePreferences::m_AutoPlay) return 0; p->m_pPlayerState->m_PlayerController = BArg(1) ? PC_CPU : PC_HUMAN; GamePreferences::m_AutoPlay.Set(p->m_pPlayerState->m_PlayerController); @@ -1982,8 +1871,6 @@ class LunaGameState : public Luna ADD_METHOD(IsHumanPlayer); ADD_METHOD(GetPlayerDisplayName); ADD_METHOD(GetMasterPlayerNumber); - ADD_METHOD(GetMultiplayer); - ADD_METHOD(SetMultiplayer); ADD_METHOD(GetNumMultiplayerNoteFields); ADD_METHOD(SetNumMultiplayerNoteFields); ADD_METHOD(ShowW1); diff --git a/src/Etterna/Singletons/GameState.h b/src/Etterna/Singletons/GameState.h index c4bd234b27..55314880fd 100644 --- a/src/Etterna/Singletons/GameState.h +++ b/src/Etterna/Singletons/GameState.h @@ -102,7 +102,6 @@ class GameState m_PlayMode; // many screens display different info depending on this value bool m_bPlayingMulti = false; - bool m_bMultiplayer; int m_iNumMultiplayerNoteFields; bool DifficultiesLocked() const; bool ChangePreferredDifficultyAndStepsType(PlayerNumber pn, @@ -337,43 +336,6 @@ class GameState GameState& operator=(const GameState& rhs); }; -PlayerNumber -GetNextHumanPlayer(PlayerNumber pn); -PlayerNumber -GetNextEnabledPlayer(PlayerNumber pn); -PlayerNumber -GetNextCpuPlayer(PlayerNumber pn); -PlayerNumber -GetNextPotentialCpuPlayer(PlayerNumber pn); -MultiPlayer -GetNextEnabledMultiPlayer(MultiPlayer mp); - -/** @brief A foreach loop to act on each human Player. */ -#define FOREACH_HumanPlayer(pn) \ - for (PlayerNumber pn = GetNextHumanPlayer((PlayerNumber)-1); \ - (pn) != PLAYER_INVALID; \ - (pn) = GetNextHumanPlayer(pn)) -/** @brief A foreach loop to act on each enabled Player. */ -#define FOREACH_EnabledPlayer(pn) \ - for (PlayerNumber pn = GetNextEnabledPlayer((PlayerNumber)-1); \ - (pn) != PLAYER_INVALID; \ - (pn) = GetNextEnabledPlayer(pn)) -/** @brief A foreach loop to act on each CPU Player. */ -#define FOREACH_CpuPlayer(pn) \ - for (PlayerNumber pn = GetNextCpuPlayer((PlayerNumber)-1); \ - (pn) != PLAYER_INVALID; \ - (pn) = GetNextCpuPlayer(pn)) -/** @brief A foreach loop to act on each potential CPU Player. */ -#define FOREACH_PotentialCpuPlayer(pn) \ - for (PlayerNumber pn = GetNextPotentialCpuPlayer((PlayerNumber)-1); \ - (pn) != PLAYER_INVALID; \ - (pn) = GetNextPotentialCpuPlayer(pn)) -/** @brief A foreach loop to act on each Player in MultiPlayer. */ -#define FOREACH_EnabledMultiPlayer(mp) \ - for (MultiPlayer mp = GetNextEnabledMultiPlayer((MultiPlayer)-1); \ - (mp) != MultiPlayer_Invalid; \ - (mp) = GetNextEnabledMultiPlayer(mp)) - extern GameState* GAMESTATE; // global and accessible from anywhere in our program diff --git a/src/Etterna/Singletons/InputMapper.cpp b/src/Etterna/Singletons/InputMapper.cpp index 8aa17a4b57..f74195bba1 100644 --- a/src/Etterna/Singletons/InputMapper.cpp +++ b/src/Etterna/Singletons/InputMapper.cpp @@ -281,400 +281,451 @@ static const AutoMappings g_AutoMappings[] = { false), // R shoulder AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_START, false), AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_BACK, false)), - AutoMappings( - "dance", - "GamePad Pro USB ", // yes, there is a space at the end - "GamePad Pro USB", - AutoMappingEntry( 0, JOY_LEFT, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_RIGHT, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_UP, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_DOWN, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 1, JOY_BUTTON_1, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 1, JOY_BUTTON_3, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 1, JOY_BUTTON_4, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 1, JOY_BUTTON_2, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_5, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_6, DANCE_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_START, false ) - ), - AutoMappings( - "dance", - "SideWinder Game Pad USB version 1.0", - "SideWinder Game Pad USB", - AutoMappingEntry( 0, JOY_LEFT, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_RIGHT, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_UP, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_DOWN, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 1, JOY_BUTTON_4, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 1, JOY_BUTTON_2, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 1, JOY_BUTTON_5, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 1, JOY_BUTTON_1, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_START, false ) - ), - AutoMappings( - "dance", - "4 axis 12 button joystick with hat switch", - "Super Joy Box 5", - AutoMappingEntry( 0, JOY_LEFT, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_RIGHT, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_UP, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_DOWN, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 1, JOY_BUTTON_4, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 1, JOY_BUTTON_2, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 1, JOY_BUTTON_1, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 1, JOY_BUTTON_3, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_START, false ) - ), -/* AutoMappings( - - "dance", - "MP-8866 Dual USB Joypad", - "Super Dual Box (from Lik-Sang, 2004)", - //NEEDS_DANCE_PAD_MAPPING_CODE, - AutoMappingEntry( 0, JOY_LEFT, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_RIGHT, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_UP, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_DOWN, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 1, JOY_BUTTON_4, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 1, JOY_BUTTON_2, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 1, JOY_BUTTON_1, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 1, JOY_BUTTON_3, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_5, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_6, DANCE_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 1, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 1, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_START, false ), - ), -*/ - AutoMappings( - "dance", - "MP-8866 Dual USB Joypad", - "Super Dual Box (from DDRGame.com, Feb 2008)", - //NEEDS_DANCE_PAD_MAPPING_CODE, - AutoMappingEntry( 0, JOY_BUTTON_3, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_BUTTON_2, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_1, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_4, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_5, DANCE_BUTTON_DOWNLEFT, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_6, DANCE_BUTTON_DOWNRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_START, false ) - ), - AutoMappings( - "dance", - "NTPAD", - "NTPAD", - AutoMappingEntry( 0, JOY_BUTTON_13, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_15, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_16, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_BUTTON_14, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 1, JOY_BUTTON_1, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 1, JOY_BUTTON_3, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 1, JOY_BUTTON_4, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 1, JOY_BUTTON_2, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_5, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_6, DANCE_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 1, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 1, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_START, false ) - ), - AutoMappings( - "dance", - "Psx Gamepad", - "PSXPAD", - AutoMappingEntry( 0, JOY_LEFT, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_RIGHT, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_UP, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_DOWN, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 1, JOY_BUTTON_2, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 1, JOY_BUTTON_1, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 1, JOY_BUTTON_4, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 1, JOY_BUTTON_3, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_5, DANCE_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 1, JOY_BUTTON_8, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 1, JOY_BUTTON_6, DANCE_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_START, false ) - ), - AutoMappings( - "dance", - "XBOX Gamepad Plugin V0.01", - "X-Box gamepad", - AutoMappingEntry( 0, JOY_LEFT, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_RIGHT, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_UP, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_DOWN, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 1, JOY_BUTTON_1, DANCE_BUTTON_DOWN, false ), // A - AutoMappingEntry( 1, JOY_BUTTON_2, DANCE_BUTTON_RIGHT, false ), // B - AutoMappingEntry( 1, JOY_BUTTON_3, DANCE_BUTTON_LEFT, false ), // X - AutoMappingEntry( 1, JOY_BUTTON_4, DANCE_BUTTON_UP, false ), // Y - AutoMappingEntry( 0, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false ), // L shoulder - AutoMappingEntry( 0, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false ), // R shoulder - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_START, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_BACK, false ) - ), - AutoMappings( - "dance", - "0b43:0003", // The EMS USB2 doesn't provide a model string, so Linux - // just gives us the VendorID and ModelID in hex. - "EMS USB2", - // Player 1. - AutoMappingEntry( 0, JOY_BUTTON_16, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_14, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_13, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_BUTTON_15, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 1, JOY_BUTTON_4, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 1, JOY_BUTTON_2, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 1, JOY_BUTTON_1, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 1, JOY_BUTTON_3, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_SELECT, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_START, false ), - AutoMappingEntry( 0, JOY_BUTTON_5, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_6, GAME_BUTTON_COIN, false ) - // Player 2. - /*AutoMappingEntry( 0, JOY_BUTTON_32, DANCE_BUTTON_LEFT, true ), - AutoMappingEntry( 0, JOY_BUTTON_30, DANCE_BUTTON_RIGHT, true ), - AutoMappingEntry( 0, JOY_BUTTON_29, DANCE_BUTTON_UP, true ), - AutoMappingEntry( 0, JOY_BUTTON_31, DANCE_BUTTON_DOWN, true ), - AutoMappingEntry( 1, JOY_BUTTON_20, DANCE_BUTTON_LEFT, true ), - AutoMappingEntry( 1, JOY_BUTTON_18, DANCE_BUTTON_RIGHT, true ), - AutoMappingEntry( 1, JOY_BUTTON_17, DANCE_BUTTON_UP, true ), - AutoMappingEntry( 1, JOY_BUTTON_19, DANCE_BUTTON_DOWN, true ), - AutoMappingEntry( 0, JOY_BUTTON_23, DANCE_BUTTON_UPRIGHT, true ), - AutoMappingEntry( 0, JOY_BUTTON_24, DANCE_BUTTON_UPLEFT, true ), - AutoMappingEntry( 0, JOY_BUTTON_25, GAME_BUTTON_SELECT, true ), - AutoMappingEntry( 0, JOY_BUTTON_26, GAME_BUTTON_START, true ), - AutoMappingEntry( 0, JOY_BUTTON_21, GAME_BUTTON_BACK, true ), - AutoMappingEntry( 0, JOY_BUTTON_22, GAME_BUTTON_COIN, true )*/ - ), - AutoMappings( - "dance", - "Dance ", //Notice extra space at end - "LevelSix USB Pad (DDR638)", // "DDR638" is the model number of the pad - AutoMappingEntry( 0, JOY_BUTTON_1, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_BUTTON_2, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_3, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_4, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_7, DANCE_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_8, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_START, false ) - ), - AutoMappings( - "dance", - "SmartJoy PLUS Adapter", - "SmartJoy PLUS Adapter", - AutoMappingEntry( 0, JOY_LEFT, /* dpad L */ DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_RIGHT, /* dpad R */ DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_UP, /* dpad U */ DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_DOWN, /* dpad D */ DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 1, JOY_BUTTON_4, /* Square */ DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 1, JOY_BUTTON_2, /* Circle */ DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 1, JOY_BUTTON_1, /* Tri */ DANCE_BUTTON_UP, false ), - AutoMappingEntry( 1, JOY_BUTTON_3, /* X */ DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_7, /* L1 */ DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_8, /* R1 */ DANCE_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, /* Select */ GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, /* Start */ GAME_BUTTON_START, false ), - AutoMappingEntry( 0, JOY_BUTTON_5, /* R1 */ GAME_BUTTON_SELECT, false ), - AutoMappingEntry( 0, JOY_BUTTON_6, /* R2 */ GAME_BUTTON_COIN, false ) - ), - AutoMappings( - "dance", - "RedOctane USB Pad|XBOX DDR", // "RedOctane USB Pad" is Ignition 3s and newer Afterburners. "XBOX DDR" is older Afterburners. - "RedOctane Ignition 3 or Afterburner", - AutoMappingEntry( 0, JOY_BUTTON_1, /* dpad L */ DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_4, /* dpad R */ DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_3, /* dpad U */ DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_BUTTON_2, /* dpad D */ DANCE_BUTTON_DOWN, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_5, /* Tri */ GAME_BUTTON_BACK, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_6, /* Square */ GAME_BUTTON_BACK, false ), - //AutoMappingEntry{ 1, JOY_BUTTON_7, /* X */ GAME_BUTTON_START, false ), - AutoMappingEntry( 0, JOY_BUTTON_8, /* O */ GAME_BUTTON_START, false ), - AutoMappingEntry( 1, JOY_BUTTON_9, /* Start */ GAME_BUTTON_START, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, /* Sel */ GAME_BUTTON_BACK, false ) - ), - AutoMappings( - "dance", - "Joypad to USB converter", - "EMS Trio Linker", - AutoMappingEntry( 0, JOY_BUTTON_16, /* dpad L */ DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_14, /* dpad R */ DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_13, /* dpad U */ DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_BUTTON_15, /* dpad D */ DANCE_BUTTON_DOWN, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_5, /* Tri */ GAME_BUTTON_BACK, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_6, /* Square */ GAME_BUTTON_BACK, false ), - //AutoMappingEntry{ 1, JOY_BUTTON_7, /* X */ GAME_BUTTON_START, false ), - AutoMappingEntry( 0, JOY_BUTTON_2, /* O */ GAME_BUTTON_START, false ), - AutoMappingEntry( 1, JOY_BUTTON_10, /* Start */ GAME_BUTTON_START, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, /* Sel */ GAME_BUTTON_BACK, false ) - ), - AutoMappings( - "dance", - "Positive Gaming Impact USB pad", - "Positive Gaming Impact USB pad", - AutoMappingEntry( 0, JOY_BUTTON_1, /* dpad L */ DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_4, /* dpad R */ DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_3, /* dpad U */ DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_BUTTON_2, /* dpad D */ DANCE_BUTTON_DOWN, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_5, /* Tri */ GAME_BUTTON_BACK, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_6, /* Square */ GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_7, /* X */ DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_8, /* O */ DANCE_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 1, JOY_BUTTON_9, /* Start */ GAME_BUTTON_START, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, /* Sel */ GAME_BUTTON_BACK, false ) - ), - AutoMappings( - "dance", - "USB Dance Pad", - "DDRGame Energy Dance Pad", - AutoMappingEntry( 0, JOY_BUTTON_13, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_BUTTON_15, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_16, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_14, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_3, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_2, DANCE_BUTTON_UPRIGHT, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_1, DANCE_BUTTON_DOWNLEFT, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_4, DANCE_BUTTON_DOWNRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_START, false ) - ), - AutoMappings( - "dance", - "USB DancePad", - "D-Force Dance Pad", - AutoMappingEntry( 0, JOY_BUTTON_1, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_BUTTON_2, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_3, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_4, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_1, DANCE_BUTTON_DOWNLEFT, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_4, DANCE_BUTTON_DOWNRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_START, false ) - ), - AutoMappings( - "dance", - "Dual USB Vibration Joystick", - "PC Multi Hub Double Power Box 4", - AutoMappingEntry( 0, JOY_BUTTON_13, DANCE_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_BUTTON_15, DANCE_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_16, DANCE_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_14, DANCE_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_3, DANCE_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_2, DANCE_BUTTON_UPRIGHT, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_1, DANCE_BUTTON_DOWNLEFT, false ), - //AutoMappingEntry{ 0, JOY_BUTTON_4, DANCE_BUTTON_DOWNRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_START, false ) - ), - AutoMappings( - "dance", - "Controller \\(Harmonix Drum Kit for Xbox 360\\)", - "Rock Band drum controller (Xbox 360, Windows driver)", - AutoMappingEntry( 0, JOY_BUTTON_3, DANCE_BUTTON_UP, false ), // blue drum - AutoMappingEntry( 0, JOY_BUTTON_4, DANCE_BUTTON_DOWN, false ), // yellow drum - AutoMappingEntry( 0, JOY_BUTTON_2, DANCE_BUTTON_LEFT, false ), // red drum - AutoMappingEntry( 0, JOY_BUTTON_1, DANCE_BUTTON_RIGHT, false ), // green drum - AutoMappingEntry( 0, JOY_HAT_LEFT, GAME_BUTTON_MENULEFT, false ), // d-pad left - AutoMappingEntry( 0, JOY_HAT_RIGHT, GAME_BUTTON_MENURIGHT, false ), // d-pad right - AutoMappingEntry( 0, JOY_HAT_UP, GAME_BUTTON_MENUUP, false ), // d-pad up - AutoMappingEntry( 0, JOY_HAT_DOWN, GAME_BUTTON_MENUDOWN, false ), // d-pad down - AutoMappingEntry( 0, JOY_BUTTON_8, GAME_BUTTON_START, false ), // start button - AutoMappingEntry( 0, JOY_BUTTON_7, GAME_BUTTON_BACK, false ) // back button - ), - AutoMappings( - "pump", - "Pump USB", - "Pump USB pad", - AutoMappingEntry( 0, JOY_BUTTON_1, PUMP_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_2, PUMP_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_3, PUMP_BUTTON_CENTER, false ), - AutoMappingEntry( 0, JOY_BUTTON_4, PUMP_BUTTON_DOWNLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_5, PUMP_BUTTON_DOWNRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_6, GAME_BUTTON_BACK, false ) - /*AutoMappingEntry( 0, JOY_BUTTON_7, PUMP_BUTTON_UPLEFT, true ), - AutoMappingEntry( 0, JOY_BUTTON_8, PUMP_BUTTON_UPRIGHT, true ), - AutoMappingEntry( 0, JOY_BUTTON_9, PUMP_BUTTON_CENTER, true ), - AutoMappingEntry( 0, JOY_BUTTON_10, PUMP_BUTTON_DOWNLEFT, true ), - AutoMappingEntry( 0, JOY_BUTTON_11, PUMP_BUTTON_DOWNRIGHT, true )*/ - ), - AutoMappings( - "pump", - "GamePad Pro USB ", // yes, there is a space at the end - "GamePad Pro USB", - AutoMappingEntry( 0, JOY_BUTTON_5, PUMP_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_6, PUMP_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_7, PUMP_BUTTON_DOWNLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_8, PUMP_BUTTON_DOWNRIGHT, false ), - AutoMappingEntry( 0, JOY_LEFT, GAME_BUTTON_MENULEFT, false ), - AutoMappingEntry( 0, JOY_RIGHT, GAME_BUTTON_MENURIGHT, false ), - AutoMappingEntry( 0, JOY_UP, GAME_BUTTON_MENUUP, false ), - AutoMappingEntry( 0, JOY_DOWN, GAME_BUTTON_MENUDOWN, false ), - AutoMappingEntry( 1, JOY_BUTTON_1, PUMP_BUTTON_CENTER, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_START, false ) - ), - AutoMappings( - "pump", - "Controller \\(Harmonix Drum Kit for Xbox 360\\)", - "Rock Band drum controller (Xbox 360, Windows driver)", - AutoMappingEntry( 0, JOY_BUTTON_5, PUMP_BUTTON_CENTER, false ), // bass pedal - AutoMappingEntry( 0, JOY_BUTTON_3, PUMP_BUTTON_UPRIGHT, false ), // blue drum - AutoMappingEntry( 0, JOY_BUTTON_4, PUMP_BUTTON_UPLEFT, false ), // yellow drum - AutoMappingEntry( 0, JOY_BUTTON_2, PUMP_BUTTON_DOWNLEFT, false ), // red drum - AutoMappingEntry( 0, JOY_BUTTON_1, PUMP_BUTTON_DOWNRIGHT, false ), // green drum - AutoMappingEntry( 0, JOY_HAT_LEFT, GAME_BUTTON_MENULEFT, false ), // d-pad left - AutoMappingEntry( 0, JOY_HAT_RIGHT, GAME_BUTTON_MENURIGHT, false ), // d-pad right - AutoMappingEntry( 0, JOY_HAT_UP, GAME_BUTTON_MENUUP, false ), // d-pad up - AutoMappingEntry( 0, JOY_HAT_DOWN, GAME_BUTTON_MENUDOWN, false ), // d-pad down - AutoMappingEntry( 0, JOY_BUTTON_8, GAME_BUTTON_START, false ), // start button - AutoMappingEntry( 0, JOY_BUTTON_7, GAME_BUTTON_BACK, false ) // back button - ), - AutoMappings( - "para", - "ParaParaParadise Controller", - "ParaParaParadise Controller", - AutoMappingEntry( 0, JOY_BUTTON_5, PARA_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_4, PARA_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_3, PARA_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_BUTTON_2, PARA_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_1, PARA_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_START, false ), - AutoMappingEntry( 0, JOY_BUTTON_11, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_12, GAME_BUTTON_MENULEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_MENURIGHT, false ) + AutoMappings("dance", + "GamePad Pro USB ", // yes, there is a space at the end + "GamePad Pro USB", + AutoMappingEntry(0, JOY_LEFT, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_RIGHT, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_UP, DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_DOWN, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(1, JOY_BUTTON_1, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(1, JOY_BUTTON_3, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(1, JOY_BUTTON_4, DANCE_BUTTON_UP, false), + AutoMappingEntry(1, JOY_BUTTON_2, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(0, JOY_BUTTON_5, DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_6, DANCE_BUTTON_UPRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_START, false)), + AutoMappings("dance", + "SideWinder Game Pad USB version 1.0", + "SideWinder Game Pad USB", + AutoMappingEntry(0, JOY_LEFT, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_RIGHT, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_UP, DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_DOWN, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(1, JOY_BUTTON_4, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(1, JOY_BUTTON_2, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(1, JOY_BUTTON_5, DANCE_BUTTON_UP, false), + AutoMappingEntry(1, JOY_BUTTON_1, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(0, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_START, false)), + AutoMappings("dance", + "4 axis 12 button joystick with hat switch", + "Super Joy Box 5", + AutoMappingEntry(0, JOY_LEFT, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_RIGHT, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_UP, DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_DOWN, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(1, JOY_BUTTON_4, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(1, JOY_BUTTON_2, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(1, JOY_BUTTON_1, DANCE_BUTTON_UP, false), + AutoMappingEntry(1, JOY_BUTTON_3, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(0, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_START, false)), + /* AutoMappings( + + "dance", + "MP-8866 Dual USB Joypad", + "Super Dual Box (from Lik-Sang, 2004)", + //NEEDS_DANCE_PAD_MAPPING_CODE, + AutoMappingEntry( 0, JOY_LEFT, DANCE_BUTTON_LEFT, false ), + AutoMappingEntry( 0, JOY_RIGHT, DANCE_BUTTON_RIGHT, false ), + AutoMappingEntry( 0, JOY_UP, DANCE_BUTTON_UP, false ), + AutoMappingEntry( 0, JOY_DOWN, DANCE_BUTTON_DOWN, false ), + AutoMappingEntry( 1, JOY_BUTTON_4, DANCE_BUTTON_LEFT, false ), + AutoMappingEntry( 1, JOY_BUTTON_2, DANCE_BUTTON_RIGHT, false ), + AutoMappingEntry( 1, JOY_BUTTON_1, DANCE_BUTTON_UP, false ), + AutoMappingEntry( 1, JOY_BUTTON_3, DANCE_BUTTON_DOWN, false ), + AutoMappingEntry( 0, JOY_BUTTON_5, DANCE_BUTTON_UPLEFT, false + ), AutoMappingEntry( 0, JOY_BUTTON_6, DANCE_BUTTON_UPRIGHT, false + ), AutoMappingEntry( 1, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false + ), AutoMappingEntry( 1, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false + ), AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_BACK, false + ), AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_START, false ), - AutoMappings( - "techno", - "Dance ", //Notice the extra space at end - "LevelSix USB Pad (DDR638)", // "DDR638" is the model number of the pad - AutoMappingEntry( 0, JOY_BUTTON_1, TECHNO_BUTTON_UP, false ), - AutoMappingEntry( 0, JOY_BUTTON_2, TECHNO_BUTTON_DOWN, false ), - AutoMappingEntry( 0, JOY_BUTTON_3, TECHNO_BUTTON_LEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_4, TECHNO_BUTTON_RIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_5, TECHNO_BUTTON_DOWNRIGHT,false ), - AutoMappingEntry( 0, JOY_BUTTON_6, TECHNO_BUTTON_DOWNLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_7, TECHNO_BUTTON_UPRIGHT, false ), - AutoMappingEntry( 0, JOY_BUTTON_8, TECHNO_BUTTON_UPLEFT, false ), - AutoMappingEntry( 0, JOY_BUTTON_9, GAME_BUTTON_BACK, false ), - AutoMappingEntry( 0, JOY_BUTTON_10, GAME_BUTTON_START, false ) - ), + ), + */ + AutoMappings( + "dance", + "MP-8866 Dual USB Joypad", + "Super Dual Box (from DDRGame.com, Feb 2008)", + // NEEDS_DANCE_PAD_MAPPING_CODE, + AutoMappingEntry(0, JOY_BUTTON_3, DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_BUTTON_2, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(0, JOY_BUTTON_1, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_BUTTON_4, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false), + // AutoMappingEntry{ 0, JOY_BUTTON_5, DANCE_BUTTON_DOWNLEFT, false ), + // AutoMappingEntry{ 0, JOY_BUTTON_6, DANCE_BUTTON_DOWNRIGHT, false ), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_START, false)), + AutoMappings("dance", + "NTPAD", + "NTPAD", + AutoMappingEntry(0, JOY_BUTTON_13, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_BUTTON_15, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_16, DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_BUTTON_14, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(1, JOY_BUTTON_1, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(1, JOY_BUTTON_3, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(1, JOY_BUTTON_4, DANCE_BUTTON_UP, false), + AutoMappingEntry(1, JOY_BUTTON_2, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(0, JOY_BUTTON_5, DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_6, DANCE_BUTTON_UPRIGHT, false), + AutoMappingEntry(1, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(1, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_START, false)), + AutoMappings("dance", + "Psx Gamepad", + "PSXPAD", + AutoMappingEntry(0, JOY_LEFT, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_RIGHT, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_UP, DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_DOWN, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(1, JOY_BUTTON_2, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(1, JOY_BUTTON_1, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(1, JOY_BUTTON_4, DANCE_BUTTON_UP, false), + AutoMappingEntry(1, JOY_BUTTON_3, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(0, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_5, DANCE_BUTTON_UPRIGHT, false), + AutoMappingEntry(1, JOY_BUTTON_8, DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(1, JOY_BUTTON_6, DANCE_BUTTON_UPRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_START, false)), + AutoMappings( + "dance", + "XBOX Gamepad Plugin V0.01", + "X-Box gamepad", + AutoMappingEntry(0, JOY_LEFT, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_RIGHT, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_UP, DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_DOWN, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(1, JOY_BUTTON_1, DANCE_BUTTON_DOWN, false), // A + AutoMappingEntry(1, JOY_BUTTON_2, DANCE_BUTTON_RIGHT, false), // B + AutoMappingEntry(1, JOY_BUTTON_3, DANCE_BUTTON_LEFT, false), // X + AutoMappingEntry(1, JOY_BUTTON_4, DANCE_BUTTON_UP, false), // Y + AutoMappingEntry(0, + JOY_BUTTON_7, + DANCE_BUTTON_UPLEFT, + false), // L shoulder + AutoMappingEntry(0, + JOY_BUTTON_8, + DANCE_BUTTON_UPRIGHT, + false), // R shoulder + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_START, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_BACK, false)), + AutoMappings( + "dance", + "0b43:0003", // The EMS USB2 doesn't provide a model string, so Linux + // just gives us the VendorID and ModelID in hex. + "EMS USB2", + // Player 1. + AutoMappingEntry(0, JOY_BUTTON_16, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_BUTTON_14, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_13, DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_BUTTON_15, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(1, JOY_BUTTON_4, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(1, JOY_BUTTON_2, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(1, JOY_BUTTON_1, DANCE_BUTTON_UP, false), + AutoMappingEntry(1, JOY_BUTTON_3, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(0, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_SELECT, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_START, false), + AutoMappingEntry(0, JOY_BUTTON_5, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_6, GAME_BUTTON_COIN, false) + // Player 2. + /*AutoMappingEntry( 0, JOY_BUTTON_32, DANCE_BUTTON_LEFT, true ), + AutoMappingEntry( 0, JOY_BUTTON_30, DANCE_BUTTON_RIGHT, true ), + AutoMappingEntry( 0, JOY_BUTTON_29, DANCE_BUTTON_UP, true ), + AutoMappingEntry( 0, JOY_BUTTON_31, DANCE_BUTTON_DOWN, true ), + AutoMappingEntry( 1, JOY_BUTTON_20, DANCE_BUTTON_LEFT, true ), + AutoMappingEntry( 1, JOY_BUTTON_18, DANCE_BUTTON_RIGHT, true ), + AutoMappingEntry( 1, JOY_BUTTON_17, DANCE_BUTTON_UP, true ), + AutoMappingEntry( 1, JOY_BUTTON_19, DANCE_BUTTON_DOWN, true ), + AutoMappingEntry( 0, JOY_BUTTON_23, DANCE_BUTTON_UPRIGHT, true ), + AutoMappingEntry( 0, JOY_BUTTON_24, DANCE_BUTTON_UPLEFT, true ), + AutoMappingEntry( 0, JOY_BUTTON_25, GAME_BUTTON_SELECT, true ), + AutoMappingEntry( 0, JOY_BUTTON_26, GAME_BUTTON_START, true ), + AutoMappingEntry( 0, JOY_BUTTON_21, GAME_BUTTON_BACK, true ), + AutoMappingEntry( 0, JOY_BUTTON_22, GAME_BUTTON_COIN, true )*/ + ), + AutoMappings( + "dance", + "Dance ", // Notice extra space at end + "LevelSix USB Pad (DDR638)", // "DDR638" is the model number of the pad + AutoMappingEntry(0, JOY_BUTTON_1, DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_BUTTON_2, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(0, JOY_BUTTON_3, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_BUTTON_4, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_7, DANCE_BUTTON_UPRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_8, DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_START, false)), + AutoMappings( + "dance", + "SmartJoy PLUS Adapter", + "SmartJoy PLUS Adapter", + AutoMappingEntry(0, JOY_LEFT, /* dpad L */ DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_RIGHT, /* dpad R */ DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_UP, /* dpad U */ DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_DOWN, /* dpad D */ DANCE_BUTTON_DOWN, false), + AutoMappingEntry(1, JOY_BUTTON_4, /* Square */ DANCE_BUTTON_LEFT, false), + AutoMappingEntry(1, JOY_BUTTON_2, /* Circle */ DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(1, JOY_BUTTON_1, /* Tri */ DANCE_BUTTON_UP, false), + AutoMappingEntry(1, JOY_BUTTON_3, /* X */ DANCE_BUTTON_DOWN, false), + AutoMappingEntry(0, JOY_BUTTON_7, /* L1 */ DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_8, /* R1 */ DANCE_BUTTON_UPRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_10, /* Select */ GAME_BUTTON_BACK, false), + AutoMappingEntry(0, + JOY_BUTTON_9, + /* Start */ GAME_BUTTON_START, + false), + AutoMappingEntry(0, JOY_BUTTON_5, /* R1 */ GAME_BUTTON_SELECT, false), + AutoMappingEntry(0, JOY_BUTTON_6, /* R2 */ GAME_BUTTON_COIN, false)), + AutoMappings( + "dance", + "RedOctane USB Pad|XBOX DDR", // "RedOctane USB Pad" is Ignition 3s and + // newer Afterburners. "XBOX DDR" is older + // Afterburners. + "RedOctane Ignition 3 or Afterburner", + AutoMappingEntry(0, JOY_BUTTON_1, /* dpad L */ DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_BUTTON_4, /* dpad R */ DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_3, /* dpad U */ DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_BUTTON_2, /* dpad D */ DANCE_BUTTON_DOWN, false), + // AutoMappingEntry{ 0, JOY_BUTTON_5, /* Tri */ GAME_BUTTON_BACK, + // false ), AutoMappingEntry{ 0, JOY_BUTTON_6, /* Square */ + // GAME_BUTTON_BACK, false ), AutoMappingEntry{ 1, JOY_BUTTON_7, /* + // X + // */ GAME_BUTTON_START, false ), + AutoMappingEntry(0, JOY_BUTTON_8, /* O */ GAME_BUTTON_START, false), + AutoMappingEntry(1, + JOY_BUTTON_9, + /* Start */ GAME_BUTTON_START, + false), + AutoMappingEntry(0, JOY_BUTTON_10, /* Sel */ GAME_BUTTON_BACK, false)), + AutoMappings( + "dance", + "Joypad to USB converter", + "EMS Trio Linker", + AutoMappingEntry(0, JOY_BUTTON_16, /* dpad L */ DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, + JOY_BUTTON_14, + /* dpad R */ DANCE_BUTTON_RIGHT, + false), + AutoMappingEntry(0, JOY_BUTTON_13, /* dpad U */ DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_BUTTON_15, /* dpad D */ DANCE_BUTTON_DOWN, false), + // AutoMappingEntry{ 0, JOY_BUTTON_5, /* Tri */ GAME_BUTTON_BACK, + // false ), AutoMappingEntry{ 0, JOY_BUTTON_6, /* Square */ + // GAME_BUTTON_BACK, false ), AutoMappingEntry{ 1, JOY_BUTTON_7, /* + // X + // */ GAME_BUTTON_START, false ), + AutoMappingEntry(0, JOY_BUTTON_2, /* O */ GAME_BUTTON_START, false), + AutoMappingEntry(1, + JOY_BUTTON_10, + /* Start */ GAME_BUTTON_START, + false), + AutoMappingEntry(0, JOY_BUTTON_9, /* Sel */ GAME_BUTTON_BACK, false)), + AutoMappings( + "dance", + "Positive Gaming Impact USB pad", + "Positive Gaming Impact USB pad", + AutoMappingEntry(0, JOY_BUTTON_1, /* dpad L */ DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_BUTTON_4, /* dpad R */ DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_3, /* dpad U */ DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_BUTTON_2, /* dpad D */ DANCE_BUTTON_DOWN, false), + // AutoMappingEntry{ 0, JOY_BUTTON_5, /* Tri */ GAME_BUTTON_BACK, + // false ), AutoMappingEntry{ 0, JOY_BUTTON_6, /* Square */ + // GAME_BUTTON_BACK, false ), + AutoMappingEntry(0, JOY_BUTTON_7, /* X */ DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_8, /* O */ DANCE_BUTTON_UPRIGHT, false), + AutoMappingEntry(1, + JOY_BUTTON_9, + /* Start */ GAME_BUTTON_START, + false), + AutoMappingEntry(0, JOY_BUTTON_10, /* Sel */ GAME_BUTTON_BACK, false)), + AutoMappings( + "dance", + "USB Dance Pad", + "DDRGame Energy Dance Pad", + AutoMappingEntry(0, JOY_BUTTON_13, DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_BUTTON_15, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(0, JOY_BUTTON_16, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_BUTTON_14, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_3, DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_2, DANCE_BUTTON_UPRIGHT, false), + // AutoMappingEntry{ 0, JOY_BUTTON_1, DANCE_BUTTON_DOWNLEFT, false ), + // AutoMappingEntry{ 0, JOY_BUTTON_4, DANCE_BUTTON_DOWNRIGHT, false ), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_START, false)), + AutoMappings( + "dance", + "USB DancePad", + "D-Force Dance Pad", + AutoMappingEntry(0, JOY_BUTTON_1, DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_BUTTON_2, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(0, JOY_BUTTON_3, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_BUTTON_4, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_7, DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_8, DANCE_BUTTON_UPRIGHT, false), + // AutoMappingEntry{ 0, JOY_BUTTON_1, DANCE_BUTTON_DOWNLEFT, false ), + // AutoMappingEntry{ 0, JOY_BUTTON_4, DANCE_BUTTON_DOWNRIGHT, false ), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_START, false)), + AutoMappings( + "dance", + "Dual USB Vibration Joystick", + "PC Multi Hub Double Power Box 4", + AutoMappingEntry(0, JOY_BUTTON_13, DANCE_BUTTON_UP, false), + AutoMappingEntry(0, JOY_BUTTON_15, DANCE_BUTTON_DOWN, false), + AutoMappingEntry(0, JOY_BUTTON_16, DANCE_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_BUTTON_14, DANCE_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_3, DANCE_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_2, DANCE_BUTTON_UPRIGHT, false), + // AutoMappingEntry{ 0, JOY_BUTTON_1, DANCE_BUTTON_DOWNLEFT, false ), + // AutoMappingEntry{ 0, JOY_BUTTON_4, DANCE_BUTTON_DOWNRIGHT, false ), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_START, false)), + AutoMappings( + "dance", + "Controller \\(Harmonix Drum Kit for Xbox 360\\)", + "Rock Band drum controller (Xbox 360, Windows driver)", + AutoMappingEntry(0, JOY_BUTTON_3, DANCE_BUTTON_UP, false), // blue drum + AutoMappingEntry(0, + JOY_BUTTON_4, + DANCE_BUTTON_DOWN, + false), // yellow drum + AutoMappingEntry(0, JOY_BUTTON_2, DANCE_BUTTON_LEFT, false), // red drum + AutoMappingEntry(0, + JOY_BUTTON_1, + DANCE_BUTTON_RIGHT, + false), // green drum + AutoMappingEntry(0, + JOY_HAT_LEFT, + GAME_BUTTON_MENULEFT, + false), // d-pad left + AutoMappingEntry(0, + JOY_HAT_RIGHT, + GAME_BUTTON_MENURIGHT, + false), // d-pad right + AutoMappingEntry(0, JOY_HAT_UP, GAME_BUTTON_MENUUP, false), // d-pad up + AutoMappingEntry(0, + JOY_HAT_DOWN, + GAME_BUTTON_MENUDOWN, + false), // d-pad down + AutoMappingEntry(0, + JOY_BUTTON_8, + GAME_BUTTON_START, + false), // start button + AutoMappingEntry(0, JOY_BUTTON_7, GAME_BUTTON_BACK, false) // back button + ), + AutoMappings( + "pump", + "Pump USB", + "Pump USB pad", + AutoMappingEntry(0, JOY_BUTTON_1, PUMP_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_2, PUMP_BUTTON_UPRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_3, PUMP_BUTTON_CENTER, false), + AutoMappingEntry(0, JOY_BUTTON_4, PUMP_BUTTON_DOWNLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_5, PUMP_BUTTON_DOWNRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_6, GAME_BUTTON_BACK, false) + /*AutoMappingEntry( 0, JOY_BUTTON_7, PUMP_BUTTON_UPLEFT, true ), + AutoMappingEntry( 0, JOY_BUTTON_8, PUMP_BUTTON_UPRIGHT, true ), + AutoMappingEntry( 0, JOY_BUTTON_9, PUMP_BUTTON_CENTER, true ), + AutoMappingEntry( 0, JOY_BUTTON_10, PUMP_BUTTON_DOWNLEFT, true ), + AutoMappingEntry( 0, JOY_BUTTON_11, PUMP_BUTTON_DOWNRIGHT, true )*/ + ), + AutoMappings( + "pump", + "GamePad Pro USB ", // yes, there is a space at the end + "GamePad Pro USB", + AutoMappingEntry(0, JOY_BUTTON_5, PUMP_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_6, PUMP_BUTTON_UPRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_7, PUMP_BUTTON_DOWNLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_8, PUMP_BUTTON_DOWNRIGHT, false), + AutoMappingEntry(0, JOY_LEFT, GAME_BUTTON_MENULEFT, false), + AutoMappingEntry(0, JOY_RIGHT, GAME_BUTTON_MENURIGHT, false), + AutoMappingEntry(0, JOY_UP, GAME_BUTTON_MENUUP, false), + AutoMappingEntry(0, JOY_DOWN, GAME_BUTTON_MENUDOWN, false), + AutoMappingEntry(1, JOY_BUTTON_1, PUMP_BUTTON_CENTER, false), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_START, false)), + AutoMappings( + "pump", + "Controller \\(Harmonix Drum Kit for Xbox 360\\)", + "Rock Band drum controller (Xbox 360, Windows driver)", + AutoMappingEntry(0, + JOY_BUTTON_5, + PUMP_BUTTON_CENTER, + false), // bass pedal + AutoMappingEntry(0, + JOY_BUTTON_3, + PUMP_BUTTON_UPRIGHT, + false), // blue drum + AutoMappingEntry(0, + JOY_BUTTON_4, + PUMP_BUTTON_UPLEFT, + false), // yellow drum + AutoMappingEntry(0, + JOY_BUTTON_2, + PUMP_BUTTON_DOWNLEFT, + false), // red drum + AutoMappingEntry(0, + JOY_BUTTON_1, + PUMP_BUTTON_DOWNRIGHT, + false), // green drum + AutoMappingEntry(0, + JOY_HAT_LEFT, + GAME_BUTTON_MENULEFT, + false), // d-pad left + AutoMappingEntry(0, + JOY_HAT_RIGHT, + GAME_BUTTON_MENURIGHT, + false), // d-pad right + AutoMappingEntry(0, JOY_HAT_UP, GAME_BUTTON_MENUUP, false), // d-pad up + AutoMappingEntry(0, + JOY_HAT_DOWN, + GAME_BUTTON_MENUDOWN, + false), // d-pad down + AutoMappingEntry(0, + JOY_BUTTON_8, + GAME_BUTTON_START, + false), // start button + AutoMappingEntry(0, JOY_BUTTON_7, GAME_BUTTON_BACK, false) // back button + ), + AutoMappings( + "para", + "ParaParaParadise Controller", + "ParaParaParadise Controller", + AutoMappingEntry(0, JOY_BUTTON_5, PARA_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_BUTTON_4, PARA_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_3, PARA_BUTTON_UP, false), + AutoMappingEntry(0, JOY_BUTTON_2, PARA_BUTTON_UPRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_1, PARA_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_START, false), + AutoMappingEntry(0, JOY_BUTTON_11, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_12, GAME_BUTTON_MENULEFT, false), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_MENURIGHT, false)), + AutoMappings( + "techno", + "Dance ", // Notice the extra space at end + "LevelSix USB Pad (DDR638)", // "DDR638" is the model number of the pad + AutoMappingEntry(0, JOY_BUTTON_1, TECHNO_BUTTON_UP, false), + AutoMappingEntry(0, JOY_BUTTON_2, TECHNO_BUTTON_DOWN, false), + AutoMappingEntry(0, JOY_BUTTON_3, TECHNO_BUTTON_LEFT, false), + AutoMappingEntry(0, JOY_BUTTON_4, TECHNO_BUTTON_RIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_5, TECHNO_BUTTON_DOWNRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_6, TECHNO_BUTTON_DOWNLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_7, TECHNO_BUTTON_UPRIGHT, false), + AutoMappingEntry(0, JOY_BUTTON_8, TECHNO_BUTTON_UPLEFT, false), + AutoMappingEntry(0, JOY_BUTTON_9, GAME_BUTTON_BACK, false), + AutoMappingEntry(0, JOY_BUTTON_10, GAME_BUTTON_START, false)), }; void @@ -1083,8 +1134,8 @@ InputMapper::IsBeingPressed(const GameInput& GameI, DeviceInput DeviceI; if (GameToDevice(GameI, i, DeviceI)) { - if (mp != MultiPlayer_Invalid) - DeviceI.device = MultiPlayerToInputDevice(mp); + // if (mp != MultiPlayer_Invalid) + // DeviceI.device = MultiPlayerToInputDevice(mp); if (INPUTFILTER->IsBeingPressed(DeviceI, pButtonState)) return true; } diff --git a/src/Etterna/Singletons/StatsManager.cpp b/src/Etterna/Singletons/StatsManager.cpp index 99efd6691f..b8fe810c13 100644 --- a/src/Etterna/Singletons/StatsManager.cpp +++ b/src/Etterna/Singletons/StatsManager.cpp @@ -72,19 +72,9 @@ AccumPlayedStageStats(const vector& vss) * RadarCategory_TapsAndHolds and the rest, which are counters. */ // FIXME: Weight each song by the number of stages it took to account for // long, marathon. - FOREACH_EnabledPlayer(p) - { - for (int r = 0; r < RadarCategory_TapsAndHolds; r++) { - ssreturn.m_player.m_radarPossible[r] /= uNumSongs; - ssreturn.m_player.m_radarActual[r] /= uNumSongs; - } - } - FOREACH_EnabledMultiPlayer(p) - { - for (int r = 0; r < RadarCategory_TapsAndHolds; r++) { - ssreturn.m_multiPlayer[p].m_radarPossible[r] /= uNumSongs; - ssreturn.m_multiPlayer[p].m_radarActual[r] /= uNumSongs; - } + for (int r = 0; r < RadarCategory_TapsAndHolds; r++) { + ssreturn.m_player.m_radarPossible[r] /= uNumSongs; + ssreturn.m_player.m_radarActual[r] /= uNumSongs; } return ssreturn; } @@ -124,52 +114,25 @@ StatsManager::CommitStatsToProfiles(const StageStats* pSS) // Add step totals. Use radarActual, since the player might have failed // part way through the song, in which case we don't want to give credit for // the rest of the song. - FOREACH_HumanPlayer(pn) - { - int iNumTapsAndHolds = - (int)pSS->m_player.m_radarActual[RadarCategory_TapsAndHolds]; - int iNumJumps = - (int)pSS->m_player.m_radarActual[RadarCategory_Jumps]; - int iNumHolds = - (int)pSS->m_player.m_radarActual[RadarCategory_Holds]; - int iNumRolls = - (int)pSS->m_player.m_radarActual[RadarCategory_Rolls]; - int iNumMines = - (int)pSS->m_player.m_radarActual[RadarCategory_Mines]; - int iNumHands = - (int)pSS->m_player.m_radarActual[RadarCategory_Hands]; - int iNumLifts = - (int)pSS->m_player.m_radarActual[RadarCategory_Lifts]; - PROFILEMAN->AddStepTotals(pn, - iNumTapsAndHolds, - iNumJumps, - iNumHolds, - iNumRolls, - iNumMines, - iNumHands, - iNumLifts); - } + int iNumTapsAndHolds = + (int)pSS->m_player.m_radarActual[RadarCategory_TapsAndHolds]; + int iNumJumps = (int)pSS->m_player.m_radarActual[RadarCategory_Jumps]; + int iNumHolds = (int)pSS->m_player.m_radarActual[RadarCategory_Holds]; + int iNumRolls = (int)pSS->m_player.m_radarActual[RadarCategory_Rolls]; + int iNumMines = (int)pSS->m_player.m_radarActual[RadarCategory_Mines]; + int iNumHands = (int)pSS->m_player.m_radarActual[RadarCategory_Hands]; + int iNumLifts = (int)pSS->m_player.m_radarActual[RadarCategory_Lifts]; + PROFILEMAN->AddStepTotals(PLAYER_1, + iNumTapsAndHolds, + iNumJumps, + iNumHolds, + iNumRolls, + iNumMines, + iNumHands, + iNumLifts); // Update profile stats int iGameplaySeconds = (int)truncf(pSS->m_fGameplaySeconds); - - if (!GAMESTATE->m_bMultiplayer) // FIXME - { - FOREACH_HumanPlayer(pn) - { - Profile* pPlayerProfile = PROFILEMAN->GetProfile(pn); - if (pPlayerProfile != nullptr) { - pPlayerProfile->m_iTotalGameplaySeconds += iGameplaySeconds; - pPlayerProfile->m_iNumTotalSongsPlayed += - pSS->m_vpPlayedSongs.size(); - } - - if (pPlayerProfile != nullptr) { - LOG->Trace("Adding stats to player profile..."); - AddPlayerStatsToProfile(pPlayerProfile, *pSS, pn); - } - } - } } void @@ -184,7 +147,8 @@ StatsManager::UnjoinPlayer(PlayerNumber pn) for (int i = 0; i < (int)m_vPlayedStageStats.size(); ++i) { StageStats& ss = m_vPlayedStageStats[i]; bool bIsActive = false; - if (ss.m_player.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) @@ -201,7 +165,7 @@ StatsManager::GetStepsInUse(set& apInUseOut) const for (int i = 0; i < (int)m_vPlayedStageStats.size(); ++i) { const PlayerStageStats& pss = m_vPlayedStageStats[i].m_player; apInUseOut.insert(pss.m_vpPossibleSteps.begin(), - pss.m_vpPossibleSteps.end()); + pss.m_vpPossibleSteps.end()); FOREACH_MultiPlayer(mp) { @@ -274,8 +238,7 @@ class LunaStatsManager : public Luna static int GetBestGrade(T* p, lua_State* L) { Grade g = NUM_Grade; - FOREACH_EnabledPlayer(pn) g = - min(g, STATSMAN->m_CurStageStats.m_player.GetGrade()); + g = min(g, STATSMAN->m_CurStageStats.m_player.GetGrade()); lua_pushnumber(L, g); return 1; } @@ -283,8 +246,7 @@ class LunaStatsManager : public Luna static int GetWorstGrade(T* p, lua_State* L) { Grade g = Grade_Tier01; - FOREACH_EnabledPlayer(pn) g = - max(g, STATSMAN->m_CurStageStats.m_player.GetGrade()); + g = max(g, STATSMAN->m_CurStageStats.m_player.GetGrade()); lua_pushnumber(L, g); return 1; } @@ -294,24 +256,18 @@ class LunaStatsManager : public Luna Grade top_grade = Grade_Failed; StageStats stats; t->GetFinalEvalStageStats(stats); - FOREACH_HumanPlayer(p) + // If this player failed any stage, then their final grade is an F. + bool bPlayerFailedOneStage = false; + FOREACH_CONST(StageStats, STATSMAN->m_vPlayedStageStats, ss) { - // If this player failed any stage, then their final grade is an F. - bool bPlayerFailedOneStage = false; - FOREACH_CONST(StageStats, STATSMAN->m_vPlayedStageStats, ss) - { - if (ss->m_player.m_bFailed) { - bPlayerFailedOneStage = true; - break; - } + if (ss->m_player.m_bFailed) { + bPlayerFailedOneStage = true; + break; } - - if (bPlayerFailedOneStage) - continue; - - top_grade = min(top_grade, stats.m_player.GetGrade()); } + top_grade = min(top_grade, stats.m_player.GetGrade()); + Enum::Push(L, top_grade); return 1; }