[jak3] Support dpad pacman controls (#4083)

Not sure if we really want this change in vanilla openGOAL, but I had it
working on a branch so figured I'd PR it.
This commit is contained in:
Matt Dallmeyer
2025-12-08 14:43:04 -08:00
committed by GitHub
parent 5681aa64a5
commit 512696b625
6 changed files with 75 additions and 14 deletions
+1
View File
@@ -10294,6 +10294,7 @@
(progress-controller-options-swap-r1-r2 #x134b)
(progress-controller-options-enable-trigger-effects #x134c)
(progress-misc-fix-projectile-focus #x134d)
(progress-controller-options-pacman-dpad #x134e)
)
;; ---text-h:text-id
@@ -245,5 +245,6 @@
"134a": "Pressure Sensitivity",
"134b": "Swap R1 and R2",
"134c": "Trigger Effects",
"134d": "Fix Projectile Focus"
"134d": "Fix Projectile Focus",
"134e": "Eco Grid (Pac-Man) D-Pad Controls"
}
+1
View File
@@ -1599,6 +1599,7 @@
(progress-controller-options-swap-r1-r2 #x134b)
(progress-controller-options-enable-trigger-effects #x134c)
(progress-misc-fix-projectile-focus #x134d)
(progress-controller-options-pacman-dpad #x134e)
)
;; ---text-id
+62 -13
View File
@@ -1485,21 +1485,70 @@
)
(defmethod power-game-method-40 ((this power-game) (arg0 int))
(let ((s3-0 (new 'stack-no-clear 'vector))
(gp-0 (new 'stack-no-clear 'vector))
;; og:preserve-this support dpad inputs for pacman
;; when enabled, dpad input will supercede stick input
(#cond
(PC_PORT
(cond
((and (-> *pc-settings* pacman-dpad?)
(or (and (= arg0 0) (or (cpad-pressed? 0 up) (cpad-hold? 0 up)))
(and (= arg0 1) (or (cpad-pressed? 0 right) (cpad-hold? 0 right)))
(and (= arg0 2) (or (cpad-pressed? 0 down) (cpad-hold? 0 down)))
(and (= arg0 3) (or (cpad-pressed? 0 left) (cpad-hold? 0 left)))
))
;; clear dpad inputs when we have a match
;; gives better control moving across 1 lane vs 2 lanes
(logclear!
(-> *cpad-list* cpads 0 button0-abs 0)
(pad-buttons up right down left)
)
(logclear!
(-> *cpad-list* cpads 0 button0-rel 0)
(pad-buttons up right down left)
)
;; allow moving with dpad (added in pc port)
#t
)
(else
;; allow moving with stick (original)
(let ((s3-0 (new 'stack-no-clear 'vector))
(gp-0 (new 'stack-no-clear 'vector))
)
(let ((s2-0 (new 'stack-no-clear 'matrix)))
(set! (-> s3-0 x) (sin (-> *cpad-list* cpads 0 stick0-dir)))
(set! (-> s3-0 y) 0.0)
(set! (-> s3-0 z) (cos (-> *cpad-list* cpads 0 stick0-dir)))
(set! (-> s3-0 w) 0.0)
(matrix-copy! s2-0 (matrix-local->world #t #f))
(vector-matrix*! s3-0 s3-0 s2-0)
(warp-vector-into-surface! gp-0 s3-0 *up-vector* s2-0)
)
(vector-float*! gp-0 gp-0 (-> *cpad-list* cpads 0 stick0-speed))
(let ((v1-8 (power-game-method-38 this (new 'stack-no-clear 'vector) arg0)))
(< 0.5 (vector-dot gp-0 v1-8))
)
)
)
)
(let ((s2-0 (new 'stack-no-clear 'matrix)))
(set! (-> s3-0 x) (sin (-> *cpad-list* cpads 0 stick0-dir)))
(set! (-> s3-0 y) 0.0)
(set! (-> s3-0 z) (cos (-> *cpad-list* cpads 0 stick0-dir)))
(set! (-> s3-0 w) 0.0)
(matrix-copy! s2-0 (matrix-local->world #t #f))
(vector-matrix*! s3-0 s3-0 s2-0)
(warp-vector-into-surface! gp-0 s3-0 *up-vector* s2-0)
)
(vector-float*! gp-0 gp-0 (-> *cpad-list* cpads 0 stick0-speed))
(let ((v1-8 (power-game-method-38 this (new 'stack-no-clear 'vector) arg0)))
(< 0.5 (vector-dot gp-0 v1-8))
(#t
(let ((s3-0 (new 'stack-no-clear 'vector))
(gp-0 (new 'stack-no-clear 'vector))
)
(let ((s2-0 (new 'stack-no-clear 'matrix)))
(set! (-> s3-0 x) (sin (-> *cpad-list* cpads 0 stick0-dir)))
(set! (-> s3-0 y) 0.0)
(set! (-> s3-0 z) (cos (-> *cpad-list* cpads 0 stick0-dir)))
(set! (-> s3-0 w) 0.0)
(matrix-copy! s2-0 (matrix-local->world #t #f))
(vector-matrix*! s3-0 s3-0 s2-0)
(warp-vector-into-surface! gp-0 s3-0 *up-vector* s2-0)
)
(vector-float*! gp-0 gp-0 (-> *cpad-list* cpads 0 stick0-speed))
(let ((v1-8 (power-game-method-38 this (new 'stack-no-clear 'vector) arg0)))
(< 0.5 (vector-dot gp-0 v1-8))
)
)
)
)
)
+1
View File
@@ -106,6 +106,7 @@
;; other
(controller-led-status? symbol)
(controller-swap-r1-r2? symbol)
(pacman-dpad? symbol)
(speedrunner-mode-custom-bind uint32)
(memcard-subtitles? symbol)
@@ -318,6 +318,14 @@ This gives us more freedom to write code how we want.
:falsey-text (text-id progress-off)
:get-value-fn (lambda () (pc-get-trigger-effects-enabled?))
:on-confirm (lambda ((val symbol)) (pc-set-trigger-effects-enabled! val)))
(new 'static 'menu-generic-boolean-option
:name (text-id progress-controller-options-pacman-dpad)
:truthy-text (text-id progress-on)
:falsey-text (text-id progress-off)
:get-value-fn (lambda () (-> *pc-settings* pacman-dpad?))
:on-confirm (lambda ((val symbol))
(set! (-> *pc-settings* pacman-dpad?) val)
(pc-settings-save)))
(new 'static 'menu-generic-confirm-option
:name (text-id progress-restore-defaults)
:on-confirm (lambda ((val symbol))