Skip to content

Commit

Permalink
g/jak2: allow L1 + R1 + Start to open speedrun menu as well (#3131)
Browse files Browse the repository at this point in the history
  • Loading branch information
xTVaser authored Nov 3, 2023
1 parent a0e998a commit fff3a85
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
3 changes: 2 additions & 1 deletion goal_src/jak2/pc/features/speedruns-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 20 additions & 9 deletions goal_src/jak2/pc/features/speedruns.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fff3a85

Please sign in to comment.