g/jak2: allow L1 + R1 + Start to open speedrun menu as well (#3131)

This commit is contained in:
Tyler Wilding 2023-11-02 20:42:51 -04:00 committed by GitHub
parent a0e998afb3
commit fff3a85531
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 10 deletions

View file

@ -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

View file

@ -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