simplify ScreenInstructions
This commit is contained in:
@@ -100,6 +100,37 @@ function GetGameplayNextScreen()
|
|||||||
return "ScreenGameOver"
|
return "ScreenGameOver"
|
||||||
end
|
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()
|
function OptionsMenuAvailable()
|
||||||
if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then return false end
|
if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then return false end
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -292,10 +292,10 @@ NextScreen1=ScreenSelectGroup
|
|||||||
NextScreen2=ScreenSelectGroup
|
NextScreen2=ScreenSelectGroup
|
||||||
NextScreen3=ScreenSelectGroup
|
NextScreen3=ScreenSelectGroup
|
||||||
NextScreen4=ScreenSelectGroup
|
NextScreen4=ScreenSelectGroup
|
||||||
NextScreen5=ScreenInstructions
|
NextScreen5=@GetScreenInstructions()
|
||||||
NextScreen6=ScreenInstructions
|
NextScreen6=@GetScreenInstructions()
|
||||||
NextScreen7=ScreenInstructions
|
NextScreen7=@GetScreenInstructions()
|
||||||
NextScreen8=ScreenInstructions
|
NextScreen8=@GetScreenInstructions()
|
||||||
PrevScreen=@ScreenTitleBranch()
|
PrevScreen=@ScreenTitleBranch()
|
||||||
LockInputSeconds=0.8
|
LockInputSeconds=0.8
|
||||||
SleepAfterChoiceSeconds=0.3
|
SleepAfterChoiceSeconds=0.3
|
||||||
@@ -400,7 +400,7 @@ DisabledColor=0.2,0.2,0.2,1
|
|||||||
|
|
||||||
[ScreenSelectGroup]
|
[ScreenSelectGroup]
|
||||||
Class=ScreenSelectGroup
|
Class=ScreenSelectGroup
|
||||||
NextScreen=ScreenInstructions
|
NextScreen=@GetScreenInstructions()
|
||||||
PrevScreen=@ScreenTitleBranch()
|
PrevScreen=@ScreenTitleBranch()
|
||||||
Fallback=ScreenWithMenuElements
|
Fallback=ScreenWithMenuElements
|
||||||
FrameX=SCREEN_CENTER_X-140
|
FrameX=SCREEN_CENTER_X-140
|
||||||
|
|||||||
@@ -1,44 +1,14 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "ScreenInstructions.h"
|
#include "ScreenInstructions.h"
|
||||||
#include "RageUtil.h"
|
|
||||||
#include "GameConstantsAndTypes.h"
|
|
||||||
#include "RageLog.h"
|
|
||||||
#include "GameState.h"
|
|
||||||
#include "PrefsManager.h"
|
|
||||||
|
|
||||||
|
|
||||||
REGISTER_SCREEN_CLASS( ScreenInstructions );
|
REGISTER_SCREEN_CLASS( ScreenInstructions );
|
||||||
ScreenInstructions::ScreenInstructions( CString sName ) : ScreenWithMenuElements( sName )
|
ScreenInstructions::ScreenInstructions( CString sName ) : ScreenWithMenuElements( sName )
|
||||||
{
|
{
|
||||||
LOG->Trace( "ScreenInstructions::ScreenInstructions()" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenInstructions::Init()
|
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();
|
ScreenWithMenuElements::Init();
|
||||||
|
|
||||||
this->SortByDrawOrder();
|
this->SortByDrawOrder();
|
||||||
|
|||||||
Reference in New Issue
Block a user