From cfca85c464479a60393a3dc266df1c6aee695a9f Mon Sep 17 00:00:00 2001 From: Kyzentun Keeslala Date: Sun, 24 Jan 2016 20:16:56 -0700 Subject: [PATCH] Allow bringing up the pause menu with MenuLeft and MenuRight at the same time. --- Themes/default/Graphics/pause_menu.lua | 46 ++++++++++++++++++-------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/Themes/default/Graphics/pause_menu.lua b/Themes/default/Graphics/pause_menu.lua index f362218729..3bf08fde89 100644 --- a/Themes/default/Graphics/pause_menu.lua +++ b/Themes/default/Graphics/pause_menu.lua @@ -155,43 +155,63 @@ menu_actions.MenuRight= menu_actions.Right menu_actions.MenuUp= menu_actions.Up menu_actions.MenuDown= menu_actions.Down +local down_status= {} + +local function detect_lr_press() + return down_status.MenuLeft and down_status.MenuRight +end + +local function pause_and_show(pn) + 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 + local prompt_text= screen_gameplay:GetChild("Debug") + if prompt_text then + prompt_text:playcommand("TweenOff") + end + show_menu(pn) +end + local function input(event) local pn= event.PlayerNumber if not enabled_players[pn] then return end local button= event.GameButton if not button then return end - if event.type == "InputEventType_Release" then return end + if event.type == "InputEventType_Release" then + down_status[event.button]= false + return + end + down_status[event.button]= true if screen_gameplay:GetName() == "ScreenGameplaySyncMachine" then return end local is_paused= screen_gameplay:IsPaused() if is_paused then if menu_is_showing[pn] then if menu_actions[button] then menu_actions[button](pn) - return true + return end else - if pause_buttons[button] then + if pause_buttons[button] or detect_lr_press() then show_menu(pn) - return true + return end end else button= event.button if event.type ~= "InputEventType_FirstPress" then return end - if pause_buttons[button] then + if detect_lr_press() then + pause_and_show(pn) + elseif pause_buttons[button] then 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) + pause_and_show(pn) else pause_press_times[pn]= GetTimeSinceStart() end