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

286 lines
8.9 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
2007-08-27 03:04:52 +00:00
-- inserted and CoinMode is pay.
if GAMESTATE:GetCoinsNeededToJoin() > GAMESTATE:GetCoins() then
return THEME:GetMetric( "Common", "InitialScreen" )
end
2006-09-26 21:36:34 +00:00
if GAMESTATE:GetCoinMode() == "CoinMode_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
return "ScreenSelectStyle2"
2005-02-09 10:02:09 +00:00
end
function ScreenSelectGroupBranch()
if PREFSMAN:GetPreference("ShowSelectGroup") then return "ScreenSelectGroup" end
return GetScreenInstructions()
end
2005-01-20 18:29:20 +00:00
function SongSelectionScreen()
2005-08-28 09:01:19 +00:00
local pm = GAMESTATE:GetPlayMode()
2006-08-14 07:32:36 +00:00
2006-09-26 03:06:00 +00:00
if pm ~= "PlayMode_Regular" and IsNetConnected() then
2006-08-14 07:32:36 +00:00
SCREENMAN:SystemMessage( THEME:GetString("NetworkSyncManager","Not Supported") )
return "ScreenSelectDifficulty"
end
2006-09-26 03:06:00 +00:00
if pm == "PlayMode_Nonstop" then return "ScreenSelectCourseNonstop" end
if pm == "PlayMode_Oni" then return "ScreenSelectCourseOni" end
if pm == "PlayMode_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 ScreenSelectMusicBranch()
if IsNetConnected() then ReportStyle() end
if IsNetSMOnline() then return SMOnlineScreen() end
if IsNetConnected() then return "ScreenNetSelectMusic" end
return "ScreenSelectMusic"
end
function NextNetworkScreen()
2006-11-24 14:35:41 +00:00
if IsNetConnected() then return "ScreenCaution" end
return "ScreenTitleMenu"
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()
2006-09-26 03:06:00 +00:00
if GAMESTATE:GetPlayMode() == "PlayMode_Rave" then return "ScreenRaveOptions" end
2005-02-09 10:02:09 +00:00
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()
local st = GAMESTATE:GetCurrentStyle():GetStyleType()
if st == "StyleType_TwoPlayersSharedSides" then return "ScreenGameplayShared" end
2005-01-20 18:13:37 +00:00
return "ScreenGameplay"
end
function SelectEvaluationScreen()
if IsNetConnected() then return "ScreenNetEvaluation" end
2005-08-28 09:01:19 +00:00
local pm = GAMESTATE:GetPlayMode()
if( GAMESTATE:GetMultiplayer() ) then return "ScreenEvaluationMultiplayer" end
2006-10-15 09:51:54 +00:00
if( pm == "PlayMode_Regular" ) then return "ScreenEvaluationStage" end
if( pm == "PlayMode_Nonstop" ) then return "ScreenEvaluationNonstop" end
if( pm == "PlayMode_Oni" ) then return "ScreenEvaluationOni" end
if( pm == "PlayMode_Endless" ) then return "ScreenEvaluationEndless" end
if( pm == "PlayMode_Rave" ) then return "ScreenEvaluationRave" end
if( pm == "PlayMode_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
2007-04-18 01:40:38 +00:00
local function GetEvaluationNextScreenInternal( sNextScreen, sFailedScreen, sEndScreen )
2005-07-12 21:48:46 +00:00
Trace( "GetEvaluationNextScreen: " .. sNextScreen .. ", " .. sFailedScreen .. ", " .. sEndScreen )
if GAMESTATE:IsEventMode() then
Trace( "IsEventMode" )
return sNextScreen
end
2006-08-06 02:56:56 +00:00
local bIsExtraStage = GAMESTATE:IsAnExtraStage()
2005-07-12 21:48:46 +00:00
-- Not in event mode. If failed, go to the game over screen.
if STATSMAN:GetCurStageStats():AllFailed() and not bIsExtraStage then
2005-07-12 21:48:46 +00:00
Trace( "Failed" )
return sFailedScreen
end
2006-10-14 08:04:57 +00:00
local sIsStage = not GetTopScreenMetric( "Summary" ) and not GAMESTATE:IsCourseMode()
2005-09-11 04:16:34 +00:00
if sIsStage then
2007-04-25 03:52:14 +00:00
local bLastStage = GAMESTATE:GetSmallestNumStagesLeftForAnyHumanPlayer() <= 0
if not bLastStage then
2005-07-12 21:48:46 +00:00
Trace( "Another" )
return sNextScreen
end
end
Trace( "End" )
return sEndScreen
end
2007-04-18 01:40:38 +00:00
function GetEvaluationSummaryNextScreen()
2007-04-18 02:17:17 +00:00
return GetEvaluationNextScreenInternal( "ScreenNameEntry", "ScreenProfileSave", "ScreenNameEntry" );
2007-04-18 01:40:38 +00:00
end
function GetEvaluationNextScreen()
if IsEventMode() then
return "ScreenProfileSave";
end
2007-04-18 01:40:38 +00:00
local sFailedScreen;
local sEndScreen;
local pm = GAMESTATE:GetPlayMode();
if pm == "PlayMode_Regular" or
pm == "PlayMode_Rave" then
2007-04-18 02:17:17 +00:00
sFailedScreen = "ScreenProfileSave";
2007-04-18 01:40:38 +00:00
sEndScreen = "ScreenEvaluationSummary";
elseif pm == "PlayMode_Nonstop" or
pm == "PlayMode_Oni" or
pm == "PlayMode_Endless" then
sFailedScreen = "ScreenNameEntry";
sEndScreen = "ScreenNameEntry";
else
assert(false);
end
local sNextScreen;
if IsNetSMOnline() then sNextScreen = "ScreenNetRoom"
elseif( IsNetConnected() ) then sNextScreen = "ScreenNetSelectMusic"
else sNextScreen = SongSelectionScreen(); end
return GetEvaluationNextScreenInternal( sNextScreen, sFailedScreen, sEndScreen );
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()
2007-04-18 02:17:17 +00:00
local bIsExtraStage = GAMESTATE:IsAnExtraStage()
if STATSMAN:GetCurStageStats():AllFailed() and not bIsExtraStage then
return "ScreenGameOver"
end
2006-10-05 20:51:13 +00:00
local grade = STATSMAN:GetBestFinalGrade()
if Grade:Compare( grade, "Grade_Tier03" ) >= 0 then return "ScreenMusicScroll" end
2005-01-20 18:29:20 +00:00
return "ScreenCredits"
end
function ScreenProfileSaveNextScreen()
if IsEventMode() then
return SongSelectionScreen();
end
return SelectEndingScreen();
end
2005-01-20 18:29:20 +00:00
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: " )
2006-10-01 03:48:07 +00:00
local Passed = not STATSMAN:GetCurStageStats():AllFailed()
2005-05-20 03:25:38 +00:00
Trace( " Passed = "..tostring(Passed) )
2005-05-28 07:55:58 +00:00
Trace( " IsCourseMode = "..tostring(GAMESTATE:IsCourseMode()) )
2006-03-18 22:15:26 +00:00
Trace( " IsExtraStage = "..tostring(GAMESTATE:IsExtraStage()) )
Trace( " IsExtraStage2 = "..tostring(GAMESTATE:IsExtraStage2()) )
2005-05-20 03:25:38 +00:00
Trace( " Event mode = "..tostring(IsEventMode()) )
2006-06-29 01:11:10 +00:00
return SelectEvaluationScreen()
-- if Passed or GAMESTATE:IsCourseMode() or
-- GAMESTATE:IsExtraStage() or GAMESTATE: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"
2005-01-30 02:45:01 +00:00
end
2005-05-30 01:42:59 +00:00
local function ShowScreenInstructions()
if not PREFSMAN:GetPreference("ShowInstructions") then
return false
end
2006-09-26 03:06:00 +00:00
if not GAMESTATE:GetPlayMode() then
2005-05-30 01:42:59 +00:00
Trace( "ShowScreenInstructions: called without PlayMode set" )
return true
end
2006-09-26 03:06:00 +00:00
if GAMESTATE:GetPlayMode() ~= "PlayMode_Regular" then
2005-05-30 01:42:59 +00:00
return true
end
2006-10-23 08:45:33 +00:00
for pn in ivalues(PlayerNumber) do
if Difficulty:Compare( GAMESTATE:GetPreferredDifficulty(pn), "Difficulty_Easy" ) <= 0 then
2005-05-30 01:42:59 +00:00
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()
2006-08-06 02:56:56 +00:00
if GAMESTATE:IsAnExtraStage() then return false end
2006-09-26 03:06:00 +00:00
if GAMESTATE:GetPlayMode() == "PlayMode_Oni" then return false end
2005-04-23 02:33:48 +00:00
return true
2005-04-23 01:41:42 +00:00
end
2005-04-27 04:26:06 +00:00
function ModeMenuAvailable()
2007-04-25 01:00:42 +00:00
if GAMESTATE:IsAnExtraStage() then
2005-04-27 04:26:06 +00:00
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.