From a3f5682ce2f6777a63329ecfd4ce517c229e9589 Mon Sep 17 00:00:00 2001 From: Kyzentun Keeslala Date: Tue, 12 Jan 2016 17:37:00 -0700 Subject: [PATCH] Added Stop Course to pause menu. Hide foreground during pause menu. Changed GiveUpStartText, GiveUpBackText, and SkipSongText to tell the player to double tap for the menu. --- Themes/default/Graphics/pause_menu.lua | 34 +++++++++++++++++++++----- Themes/default/Languages/en.ini | 5 ++++ Themes/default/Scripts/04 Other.lua | 4 +++ Themes/default/metrics.ini | 5 +--- src/ScreenSelectMusic.cpp | 2 +- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/Themes/default/Graphics/pause_menu.lua b/Themes/default/Graphics/pause_menu.lua index 452460c79c..2ef2025dd3 100644 --- a/Themes/default/Graphics/pause_menu.lua +++ b/Themes/default/Graphics/pause_menu.lua @@ -1,7 +1,9 @@ gameplay_pause_count= 0 +course_stopped_by_pause_menu= false local pause_buttons= {Start= true, Select= true, Back= true} -local pause_double_tap_time= .5 +local pause_double_tap_time= 1 +local tap_debounce_time= .1 local pause_press_times= {} local screen_gameplay= false local menu_items= {[PLAYER_1]= {}, [PLAYER_2]= {}} @@ -16,6 +18,7 @@ if GAMESTATE:IsCourseMode() then "continue_playing", "skip_song", "forfeit_course", + "end_course", } end local menu_spacing= 32 @@ -95,6 +98,8 @@ local function close_menu(pn) end end if not stay_paused then + local fg= screen_gameplay:GetChild("SongForeground") + if fg then fg:visible(old_fg_visible) end screen_gameplay:PauseGame(false) end end @@ -115,6 +120,10 @@ local choice_actions= { forfeit_course= function(pn) backout(SelectMusicOrCourse()) end, + end_course= function(pn) + course_stopped_by_pause_menu= true + screen_gameplay:PostScreenMessage("SM_NotesEnded", 0) + end, } local menu_actions= { @@ -166,13 +175,26 @@ local function input(event) end end else + button= event.button if event.type ~= "InputEventType_FirstPress" then return end if pause_buttons[button] then - if pause_press_times[pn] and - GetTimeSinceStart() - pause_press_times[pn] <= pause_double_tap_time then - gameplay_pause_count= gameplay_pause_count + 1 - screen_gameplay:PauseGame(true) - show_menu(pn) + if GAMESTATE:GetCoinMode() == "CoinMode_Pay" then return end + if pause_press_times[pn] then + local time_since_press= GetTimeSinceStart() - pause_press_times[pn] + if time_since_press > tap_debounce_time then + if time_since_press <= pause_double_tap_time then + gameplay_pause_count= gameplay_pause_count + 1 + screen_gameplay:PauseGame(true) + local fg= screen_gameplay:GetChild("SongForeground") + if fg then + old_fg_visible= fg:GetVisible() + fg:visible(false) + end + show_menu(pn) + else + pause_press_times[pn]= GetTimeSinceStart() + end + end else pause_press_times[pn]= GetTimeSinceStart() end diff --git a/Themes/default/Languages/en.ini b/Themes/default/Languages/en.ini index 9d09ff9bf9..503e122ed9 100644 --- a/Themes/default/Languages/en.ini +++ b/Themes/default/Languages/en.ini @@ -83,10 +83,15 @@ Disqualified=Score will be disqualified! HelpText= [ScreenGameplay] +GiveUpAbortedText= +GiveUpStartText=Double tap &START; to access menu +GiveUpBackText=Double tap &BACK; to access menu +SkipSongText=Double tap &SELECT; to access menu HelpText= [PauseMenu] continue_playing=Continue Playing +end_course=End Course forfeit_course=Forfeit Course forfeit_song=Forfeit Song pause_count=Pause Count diff --git a/Themes/default/Scripts/04 Other.lua b/Themes/default/Scripts/04 Other.lua index 08b62237b8..80cabd8e7b 100644 --- a/Themes/default/Scripts/04 Other.lua +++ b/Themes/default/Scripts/04 Other.lua @@ -43,3 +43,7 @@ function thified_curstage_index(on_eval) return ToEnumShortString(cur_stage) end end + +function check_stop_course_early() + return course_stopped_by_pause_menu +end diff --git a/Themes/default/metrics.ini b/Themes/default/metrics.ini index 17f42c5fba..40dc94418b 100644 --- a/Themes/default/metrics.ini +++ b/Themes/default/metrics.ini @@ -1610,11 +1610,8 @@ ActiveAttackListP2OffCommand= # # Disable the normal start and select button actions to enable a custom pause # menu -GivingUpGoesToPrevScreen=false UnpauseWithStart=false -StartGivesUp=false -BackGivesUp=false -SelectSkipsSong=false +StopCourseEarly=check_stop_course_early() [ScreenGameplayShared] diff --git a/src/ScreenSelectMusic.cpp b/src/ScreenSelectMusic.cpp index 60254721b1..d98d2031ac 100644 --- a/src/ScreenSelectMusic.cpp +++ b/src/ScreenSelectMusic.cpp @@ -1859,7 +1859,7 @@ void ScreenSelectMusic::AfterMusicChange() case SampleMusicPreviewMode_LastSong: // fall through // play the sample music m_sSampleMusicToPlay = pSong->GetPreviewMusicPath(); - if(ActorUtil::GetFileType(m_sSampleMusicToPlay) != FT_Sound) + if(!m_sSampleMusicToPlay.empty() && ActorUtil::GetFileType(m_sSampleMusicToPlay) != FT_Sound) { LuaHelpers::ReportScriptErrorFmt("Music file %s for song is not a sound file, ignoring.", m_sSampleMusicToPlay.c_str()); m_sSampleMusicToPlay= "";