Files
itgmania212121/stepmania/Themes/default/Scripts/Branches.lua
T

226 lines
7.0 KiB
Lua
Raw Normal View History

2005-02-09 10:02:09 +00:00
function ScreenTitleBranch()
-- Don't show the title menu (says "Press Start") if there are 0 credits
-- and inserted and CoinMode is pay.
if GAMESTATE:GetCoinsNeededToJoin() > GAMESTATE:GetCoins() then
return THEME:GetMetric( "Common", "InitialScreen" )
end
2005-05-20 18:03:41 +00:00
if GAMESTATE:GetCoinMode() == COIN_MODE_HOME then return "ScreenTitleMenu" end
2005-02-09 10:02:09 +00:00
return "ScreenTitleJoin"
end
function ScreenCautionBranch()
2005-05-28 08:08:11 +00:00
if PREFSMAN:GetPreference("ShowCaution") then return "ScreenCaution" end
2005-02-09 10:02:09 +00:00
return "ScreenSelectStyle"
end
2005-01-20 18:29:20 +00:00
function SongSelectionScreen()
if PlayModeName() == "Nonstop" then return "ScreenSelectCourseNonstop" end
if PlayModeName() == "Oni" then return "ScreenSelectCourseOni" end
if PlayModeName() == "Endless" then return "ScreenSelectCourseEndless" end
2005-01-22 05:34:02 +00:00
if IsNetConnected() then ReportStyle() end
if IsNetSMOnline() then return SMOnlineScreen() end
2005-01-20 18:29:20 +00:00
if IsNetConnected() then return "ScreenNetSelectMusic" end
return "ScreenSelectMusic"
end
function SMOnlineScreen()
2005-05-29 01:34:33 +00:00
if not IsSMOnlineLoggedIn(PLAYER_1) and GAMESTATE:IsPlayerEnabled(PLAYER_1) then return "ScreenSMOnlineLogin" end
if not IsSMOnlineLoggedIn(PLAYER_2) and GAMESTATE:IsPlayerEnabled(PLAYER_2) then return "ScreenSMOnlineLogin" end
return "ScreenNetRoom"
end
2005-07-12 05:54:38 +00:00
function GetSelectMusicNext()
if SCREENMAN:GetTopScreen():GetGoToOptions() then
return SelectFirstOptionsScreen()
else
return "ScreenStage"
end
end
2005-02-09 10:02:09 +00:00
function SelectFirstOptionsScreen()
if PlayModeName() == "Rave" then return "ScreenRaveOptions" end
return "ScreenPlayerOptions"
end
2005-06-25 05:05:02 +00:00
function ScreenPlayerOptionsNext()
if SCREENMAN:GetTopScreen():GetGoToOptions() then
return "ScreenSongOptions"
else
return "ScreenStage"
end
end
2005-04-21 19:57:10 +00:00
function GetGameplayScreen()
2005-01-20 18:13:37 +00:00
if IsExtraStage() or IsExtraStage2() then return "ScreenGameplay" end
return "ScreenGameplay"
end
function SelectEvaluationScreen()
if IsNetConnected() then return "ScreenNetEvaluation" end
Mode = PlayModeName()
if( Mode == "Regular" ) then return "ScreenEvaluationStage" end
if( Mode == "Nonstop" ) then return "ScreenEvaluationNonstop" end
if( Mode == "Oni" ) then return "ScreenEvaluationOni" end
if( Mode == "Endless" ) then return "ScreenEvaluationEndless" end
if( Mode == "Rave" ) then return "ScreenEvaluationRave" end
if( Mode == "Battle" ) then return "ScreenEvaluationBattle" end
end
2005-01-20 18:29:20 +00:00
2005-07-12 21:48:46 +00:00
function GetTopScreenMetric( sElement )
local sClass = SCREENMAN:GetTopScreen():GetName();
return THEME:GetMetric( sClass, sElement )
end
function GetEvaluationNextScreen( sNextScreen, sFailedScreen, sEndScreen )
Trace( "GetEvaluationNextScreen: " .. sNextScreen .. ", " .. sFailedScreen .. ", " .. sEndScreen )
if GAMESTATE:IsEventMode() then
Trace( "IsEventMode" )
return sNextScreen
end
-- Not in event mode. If failed, go to the game over screen.
if STATSMAN:GetCurStageStats():AllFailed() then
Trace( "Failed" )
return sFailedScreen
end
local sType = GetTopScreenMetric( "Type" )
if sType == "stage" then
local bHasAnotherStage = GAMESTATE:HasEarnedExtraStage()
bHasAnotherStage = bHasAnotherStage or not
(GAMESTATE:IsFinalStage() or GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() )
if bHasAnotherStage then
Trace( "Another" )
return sNextScreen
end
end
Trace( "End" )
return sEndScreen
end
2005-02-09 10:02:09 +00:00
function ScreenEvaluationExitBranch()
if( IsNetSMOnline() ) then return "ScreenNetRoom" end
if( IsNetConnected() ) then return "ScreenNetSelectMusic" end
return "ScreenSelectMusic"
2005-01-20 18:29:20 +00:00
end
2005-02-09 10:02:09 +00:00
function ScreenBranchNetAfterEval()
if IsNetSMOnline() then return "ScreenSMOnlineSelectMusic" end
if IsNetConnected() then return "ScreenNetSelectMusic" end
return "ScreenSelectMusic"
end
2005-01-20 18:29:20 +00:00
function SelectEndingScreen()
2005-06-18 13:46:41 +00:00
if GetBestFinalGrade() >= GRADE_TIER03 then return "ScreenMusicScroll" end
2005-01-20 18:29:20 +00:00
return "ScreenCredits"
end
2005-01-30 02:45:01 +00:00
function IsEventMode()
2005-05-28 08:03:50 +00:00
return PREFSMAN:GetPreference( "EventMode" )
2005-01-30 02:45:01 +00:00
end
-- For "EvalOnFail", do:
-- function GetGameplayNextScreen() return SelectEvaluationScreen() end
function GetGameplayNextScreen()
Trace( "GetGameplayNextScreen: " )
2005-01-30 03:01:16 +00:00
local Passed = not AllFailed()
2005-05-20 03:25:38 +00:00
Trace( " Passed = "..tostring(Passed) )
Trace( " IsSyncDataChanged = "..tostring(GAMESTATE:IsSyncDataChanged()) )
2005-05-28 07:55:58 +00:00
Trace( " IsCourseMode = "..tostring(GAMESTATE:IsCourseMode()) )
2005-05-20 03:25:38 +00:00
Trace( " IsExtraStage = "..tostring(IsExtraStage()) )
Trace( " IsExtraStage2 = "..tostring(IsExtraStage2()) )
Trace( " Event mode = "..tostring(IsEventMode()) )
if GAMESTATE:IsSyncDataChanged() then
return "ScreenSaveSync"
2005-01-30 02:45:01 +00:00
end
2005-05-20 03:25:38 +00:00
2005-05-28 07:55:58 +00:00
if Passed or GAMESTATE:IsCourseMode() or
2005-01-30 02:45:01 +00:00
IsExtraStage() or IsExtraStage2()
then
Trace( "Go to evaluation screen" )
return SelectEvaluationScreen()
end
if IsEventMode() then
Trace( "Go to song selection screen" )
-- DeletePreparedScreens()
return SongSelectionScreen()
end
Trace( "ScreenGameOver" )
return "ScreenGameOver"
end
2005-05-30 01:42:59 +00:00
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
2005-04-23 01:41:42 +00:00
function OptionsMenuAvailable()
2005-04-23 02:33:48 +00:00
if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then return false end
return true
2005-04-23 01:41:42 +00:00
end
2005-04-27 04:26:06 +00:00
function ModeMenuAvailable()
local PickExtraStage = PREFSMAN:GetPreference( "PickExtraStage" )
if (GAMESTATE:IsExtraStage() and not PickExtraStage) or GAMESTATE:IsExtraStage2() then
return false
end
return true
end
-- (c) 2005 Glenn Maynard, Chris Danford
-- All rights reserved.
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the
-- "Software"), to deal in the Software without restriction, including
-- without limitation the rights to use, copy, modify, merge, publish,
-- distribute, and/or sell copies of the Software, and to permit persons to
-- whom the Software is furnished to do so, provided that the above
-- copyright notice(s) and this permission notice appear in all copies of
-- the Software and that both the above copyright notice(s) and this
-- permission notice appear in supporting documentation.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
-- THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
-- INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
-- OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
-- OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.