simplify ScreenInstructions

This commit is contained in:
Glenn Maynard
2005-05-30 01:42:59 +00:00
parent c534c67252
commit ba1f9a18ee
3 changed files with 36 additions and 35 deletions
@@ -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
+5 -5
View File
@@ -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
-30
View File
@@ -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();