mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 00:57:44 -04:00
g/j2: allow customizing the speedrunner menu bind (#3386)
The bind carried forward from Jak 1 is annoying -- R1 shoots the gun. Allow the user to use whatever button combination they want by modifying it in the `pc-settings` file. ```clj (controller-led-status? 1360729) (speedrunner-mode-custom-bind 4098) ```
This commit is contained in:
parent
7ae1b4bf1c
commit
7c223b1873
|
@ -151,32 +151,52 @@
|
|||
(none)))
|
||||
|
||||
(defmethod draw! ((this speedrun-menu))
|
||||
;; handle opening and closing the menu
|
||||
;; 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)))
|
||||
(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) (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))
|
||||
((= *master-mode* 'menu)
|
||||
(set-master-mode 'game)
|
||||
(set! (-> this draw-menu?) #f)))
|
||||
(cpad-clear! 0 l1 r1)
|
||||
;; Track whether or not the menu was opened with start or select...
|
||||
(cond
|
||||
((cpad-hold? 0 select)
|
||||
(cpad-clear! 0 select)
|
||||
(set! (-> this opened-with-start?) #f))
|
||||
((cpad-hold? 0 start)
|
||||
(cpad-clear! 0 start)
|
||||
(set! (-> this opened-with-start?) #t)))
|
||||
(set! (-> this ignore-menu-toggle?) #t))
|
||||
(cond
|
||||
((!= (-> *pc-settings* speedrunner-mode-custom-bind) 0)
|
||||
;; the user has let go of the keybind completely or partially, allow the bind to trigger again
|
||||
(when (and (-> this ignore-menu-toggle?)
|
||||
(!= (cpad-hold 0)
|
||||
(logior (cpad-hold 0) (-> *pc-settings* speedrunner-mode-custom-bind))))
|
||||
(set! (-> this ignore-menu-toggle?) #f))
|
||||
;; bind handler
|
||||
(when (and (not (-> this ignore-menu-toggle?))
|
||||
(= (cpad-hold 0)
|
||||
(logior (cpad-hold 0) (-> *pc-settings* speedrunner-mode-custom-bind))))
|
||||
(cond
|
||||
((= *master-mode* 'game)
|
||||
(set-master-mode 'menu)
|
||||
(set! (-> this draw-menu?) #t))
|
||||
((= *master-mode* 'menu)
|
||||
(set-master-mode 'game)
|
||||
(set! (-> this draw-menu?) #f)))
|
||||
(logclear! (cpad-hold 0) (-> *pc-settings* speedrunner-mode-custom-bind))
|
||||
(logclear! (cpad-pressed 0) (-> *pc-settings* speedrunner-mode-custom-bind))
|
||||
(set! (-> this ignore-menu-toggle?) #t)))
|
||||
(else
|
||||
(when (and (-> this ignore-menu-toggle?)
|
||||
(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) (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))
|
||||
((= *master-mode* 'menu)
|
||||
(set-master-mode 'game)
|
||||
(set! (-> this draw-menu?) #f)))
|
||||
(cpad-clear! 0 l1 r1)
|
||||
(cond
|
||||
((cpad-hold? 0 select)
|
||||
(cpad-clear! 0 select)
|
||||
(set! (-> this opened-with-start?) #f))
|
||||
((cpad-hold? 0 start)
|
||||
(cpad-clear! 0 start)
|
||||
(set! (-> this opened-with-start?) #t)))
|
||||
(set! (-> this ignore-menu-toggle?) #t))))
|
||||
;; render the menu
|
||||
(when (-> this draw-menu?)
|
||||
;; handle any inputs for within the menu
|
||||
(cond
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
(fast-airlock? symbol)
|
||||
(fast-elevator? symbol)
|
||||
(fast-progress? symbol)
|
||||
|
||||
|
||||
(stats statistics)
|
||||
|
||||
;; gfx
|
||||
|
@ -100,6 +100,7 @@
|
|||
|
||||
;; other
|
||||
(controller-led-status? symbol)
|
||||
(speedrunner-mode-custom-bind uint32)
|
||||
|
||||
(text-language pc-language) ;; language for game text
|
||||
)
|
||||
|
@ -144,7 +145,8 @@
|
|||
(false! (-> obj fast-progress?))
|
||||
(true! (-> obj smooth-minimap?))
|
||||
(false! (-> obj hires-clouds?))
|
||||
|
||||
(set! (-> obj speedrunner-mode-custom-bind) 0)
|
||||
|
||||
(cond
|
||||
((and (= *default-territory* GAME_TERRITORY_SCEE) (= (-> obj text-language) (pc-language english)))
|
||||
(set! (-> obj text-language) (pc-language uk-english))
|
||||
|
@ -172,7 +174,7 @@
|
|||
(clear-all! (-> obj music-unlocked))
|
||||
(dotimes (i 6)
|
||||
(set! (-> obj flava-unlocked i) #f))
|
||||
|
||||
|
||||
(set! (-> obj stats) *statistics*)
|
||||
0)
|
||||
|
||||
|
@ -265,7 +267,7 @@
|
|||
:hijack-speech-chance 0.45
|
||||
|
||||
:sewer-valve-target-seconds 75
|
||||
|
||||
|
||||
:kill-civvie-target 40
|
||||
:kill-car-target 20
|
||||
))
|
||||
|
|
|
@ -734,6 +734,7 @@
|
|||
(("hires-clouds?") (set! (-> obj hires-clouds?) (file-stream-read-symbol file)))
|
||||
(("text-language") (set! (-> obj text-language) (the-as pc-language (file-stream-read-int file))))
|
||||
(("controller-led-status?") (set! (-> obj controller-led-status?) (file-stream-read-symbol file)))
|
||||
(("speedrunner-mode-custom-bind") (set! (-> obj speedrunner-mode-custom-bind) (file-stream-read-int file)))
|
||||
(("cheats") (set! (-> obj cheats) (the-as pc-cheats (file-stream-read-int file))))
|
||||
(("cheats-revealed") (set! (-> obj cheats-revealed) (the-as pc-cheats (file-stream-read-int file))))
|
||||
(("cheats-purchased") (set! (-> obj cheats-purchased) (the-as pc-cheats (file-stream-read-int file))))
|
||||
|
@ -783,7 +784,8 @@
|
|||
(format file " (smooth-minimap? ~A)~%" (-> obj smooth-minimap?))
|
||||
(format file " (hires-clouds? ~A)~%" (-> obj hires-clouds?))
|
||||
(format file " (text-language ~D)~%" (-> obj text-language))
|
||||
(format file " (controller-led-status? ~D)~%" (-> obj controller-led-status?))
|
||||
(format file " (controller-led-status? ~A)~%" (-> obj controller-led-status?))
|
||||
(format file " (speedrunner-mode-custom-bind ~D)~%" (-> obj speedrunner-mode-custom-bind))
|
||||
(format file " (cheats #x~x)~%" (-> obj cheats))
|
||||
(format file " (cheats-revealed #x~x)~%" (-> obj cheats-revealed))
|
||||
(format file " (cheats-purchased #x~x)~%" (-> obj cheats-purchased))
|
||||
|
|
Loading…
Reference in a new issue