diff --git a/stepmania/Themes/default/Scripts/Branches.lua b/stepmania/Themes/default/Scripts/Branches.lua index 6d8448f942..9e392830ff 100644 --- a/stepmania/Themes/default/Scripts/Branches.lua +++ b/stepmania/Themes/default/Scripts/Branches.lua @@ -100,6 +100,37 @@ function GetGameplayNextScreen() return "ScreenGameOver" end +local function ShowScreenInstructions() + if not PREFSMAN:GetPreference("ShowInstructions") then + return false + end + + if GAMESTATE:GetPlayMode() == PLAY_MODE_INVALID then + Trace( "ShowScreenInstructions: called without PlayMode set" ) + return true + end + + if GAMESTATE:GetPlayMode() ~= PLAY_MODE_REGULAR then + return true + end + + for pn = PLAYER_1,NUM_PLAYERS-1 do + if GAMESTATE:GetPreferredDifficulty(pn) <= DIFFICULTY_EASY then + return true + end + end + + return false +end + +function GetScreenInstructions() + if not ShowScreenInstructions() then + return THEME:GetMetric("ScreenInstructions","NextScreen") + else + return "ScreenInstructions" + end +end + function OptionsMenuAvailable() if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then return false end return true diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 04c87b455a..e4c691bd66 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -292,10 +292,10 @@ NextScreen1=ScreenSelectGroup NextScreen2=ScreenSelectGroup NextScreen3=ScreenSelectGroup NextScreen4=ScreenSelectGroup -NextScreen5=ScreenInstructions -NextScreen6=ScreenInstructions -NextScreen7=ScreenInstructions -NextScreen8=ScreenInstructions +NextScreen5=@GetScreenInstructions() +NextScreen6=@GetScreenInstructions() +NextScreen7=@GetScreenInstructions() +NextScreen8=@GetScreenInstructions() PrevScreen=@ScreenTitleBranch() LockInputSeconds=0.8 SleepAfterChoiceSeconds=0.3 @@ -400,7 +400,7 @@ DisabledColor=0.2,0.2,0.2,1 [ScreenSelectGroup] Class=ScreenSelectGroup -NextScreen=ScreenInstructions +NextScreen=@GetScreenInstructions() PrevScreen=@ScreenTitleBranch() Fallback=ScreenWithMenuElements FrameX=SCREEN_CENTER_X-140 diff --git a/stepmania/src/ScreenInstructions.cpp b/stepmania/src/ScreenInstructions.cpp index a521c243cc..e8e835eb4f 100644 --- a/stepmania/src/ScreenInstructions.cpp +++ b/stepmania/src/ScreenInstructions.cpp @@ -1,44 +1,14 @@ #include "global.h" #include "ScreenInstructions.h" -#include "RageUtil.h" -#include "GameConstantsAndTypes.h" -#include "RageLog.h" -#include "GameState.h" -#include "PrefsManager.h" REGISTER_SCREEN_CLASS( ScreenInstructions ); ScreenInstructions::ScreenInstructions( CString sName ) : ScreenWithMenuElements( sName ) { - LOG->Trace( "ScreenInstructions::ScreenInstructions()" ); } void ScreenInstructions::Init() { - // - // Skip this screen unless someone chose easy or beginner - // - if( !PREFSMAN->m_bShowInstructions ) - { - HandleScreenMessage( SM_GoToNextScreen ); - return; - } - if( GAMESTATE->m_PlayMode == PLAY_MODE_REGULAR ) - { - Difficulty easiestDifficulty = (Difficulty)(NUM_DIFFICULTIES-1); - FOREACH_HumanPlayer(p) - easiestDifficulty = min( easiestDifficulty, GAMESTATE->m_PreferredDifficulty[p].Get() ); - - if( easiestDifficulty > DIFFICULTY_EASY ) - { - HandleScreenMessage( SM_GoToNextScreen ); - return; - } - } - - if( GAMESTATE->m_PlayMode == PLAY_MODE_INVALID ) - RageException::Throw( "The PlayMode has not been set. A theme must set the PlayMode before showing ScreenInstructions." ); - ScreenWithMenuElements::Init(); this->SortByDrawOrder();