From fff3a855316b8a9aed8e5053590f6692ed486d6a Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Thu, 2 Nov 2023 20:42:51 -0400 Subject: [PATCH] g/jak2: allow `L1 + R1 + Start` to open speedrun menu as well (#3131) --- goal_src/jak2/pc/features/speedruns-h.gc | 3 ++- goal_src/jak2/pc/features/speedruns.gc | 29 ++++++++++++++++-------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/goal_src/jak2/pc/features/speedruns-h.gc b/goal_src/jak2/pc/features/speedruns-h.gc index 6cc284b34..3c14fd218 100644 --- a/goal_src/jak2/pc/features/speedruns-h.gc +++ b/goal_src/jak2/pc/features/speedruns-h.gc @@ -34,7 +34,8 @@ (deftype speedrun-menu (process-drawable) ((popup-menu popup-menu) (draw-menu? symbol) - (ignore-menu-toggle? symbol)) + (ignore-menu-toggle? symbol) + (opened-with-start? symbol)) (:methods (draw! (_type_) none)) (:states diff --git a/goal_src/jak2/pc/features/speedruns.gc b/goal_src/jak2/pc/features/speedruns.gc index af58fde1a..92026fba8 100644 --- a/goal_src/jak2/pc/features/speedruns.gc +++ b/goal_src/jak2/pc/features/speedruns.gc @@ -94,6 +94,7 @@ (set! (-> *speedrun-menu* 0 popup-menu) *speedrun-popup-menu*) (set! (-> *speedrun-menu* 0 draw-menu?) #f) (set! (-> *speedrun-menu* 0 ignore-menu-toggle?) #f) + (set! (-> *speedrun-menu* 0 opened-with-start?) #f) (go idle) (none)) @@ -125,25 +126,35 @@ (defmethod draw! ((this speedrun-menu)) ;; handle opening and closing the menu - ;; allow the menu to be toggled again once one of the currents is released + ;; allow the menu to be toggled again once one of the current buttons are released (when (and (-> this ignore-menu-toggle?) - (or (not (cpad-hold? 0 l1)) (not (cpad-hold? 0 r1)) (not (cpad-hold? 0 select)))) + (or (not (cpad-hold? 0 l1)) (not (cpad-hold? 0 r1))) + (or (and (-> this opened-with-start?) (not (cpad-hold? 0 start))) + (and (not (-> this opened-with-start?)) (not (cpad-hold? 0 select))))) (set! (-> this ignore-menu-toggle?) #f)) - (when (and (cpad-hold? 0 l1) (cpad-hold? 0 r1) (cpad-hold? 0 select) + (when (and (cpad-hold? 0 l1) (cpad-hold? 0 r1) (or (cpad-hold? 0 select) (cpad-hold? 0 start)) (not (-> this ignore-menu-toggle?))) (cond ((= *master-mode* 'game) - (set-master-mode 'menu) - (set! (-> this draw-menu?) #t)) + (set-master-mode 'menu) + (set! (-> this draw-menu?) #t)) ((= *master-mode* 'menu) - (set-master-mode 'game) - (set! (-> this draw-menu?) #f))) + (set-master-mode 'game) + (set! (-> this draw-menu?) #f))) (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l1)) (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons l1)) (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons r1)) (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons r1)) - (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons select)) - (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons select)) + ;; Track whether or not the menu was opened with start or select... + (cond + ((cpad-hold? 0 select) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons select)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons select)) + (set! (-> this opened-with-start?) #f)) + ((cpad-hold? 0 start) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons start)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons start)) + (set! (-> this opened-with-start?) #t))) (set! (-> this ignore-menu-toggle?) #t)) (when (-> this draw-menu?) ;; handle any inputs for within the menu