[jak3] Support PC camera invert options (#4171)

Implement PC camera inversion toggles, for first/third
vertical/horizontal controls

Reuses vanilla placement of Camera Options menu (as opposed to under
Input Options like jak1/2)

fixes #4158
This commit is contained in:
Matt Dallmeyer
2026-04-03 23:26:36 -07:00
committed by GitHub
parent 64baff9614
commit fe8a664f52
12 changed files with 118 additions and 96 deletions
+4 -4
View File
@@ -10165,10 +10165,10 @@
(progress-cheats-suck-in-all-unlock #x126a)
(progress-cheats-fast-travel-unlock #x126b)
; (progress-camera-options #x1280)
; (progress-camera-options-first-horz #x1281)
; (progress-camera-options-first-vert #x1282)
; (progress-camera-options-third-horz #x1283)
; (progress-camera-options-third-vert #x1284)
(progress-camera-options-first-horz #x1281)
(progress-camera-options-first-vert #x1282)
(progress-camera-options-third-horz #x1283)
(progress-camera-options-third-vert #x1284)
(progress-normal #x1286)
(progress-inverted #x1287)
(progress-ps2-parts #x1288)
@@ -212,8 +212,8 @@
(when *camera-read-analog*
(let ((f28-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 leftx)) 128.0 48.0 110.0 -1.0))
(f30-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 lefty)) 128.0 48.0 110.0 -1.0))
(f24-0 (analog-input-horizontal-first (the-as int (-> *cpad-list* cpads arg3 rightx)) 128.0 48.0 110.0 -1.0)) ;; changed for pc port
(f26-0 (analog-input-vertical-first (the-as int (-> *cpad-list* cpads arg3 righty)) 128.0 48.0 110.0 -1.0)) ;; changed for pc port
(f24-0 (analog-input-horizontal-first (the-as int (-> *cpad-list* cpads arg3 rightx)) 128.0 48.0 110.0 -1.0)) ;; og:preserve-this changed for pc port
(f26-0 (analog-input-vertical-first (the-as int (-> *cpad-list* cpads arg3 righty)) 128.0 48.0 110.0 -1.0)) ;; og:preserve-this changed for pc port
)
(when *display-load-boundaries*
(when (and (!= arg3 1)
@@ -225,7 +225,7 @@
-1.0
)
)
(f24-0 (analog-input
(f24-0 (analog-input-horizontal-first ;; og:preserve-this
(the-as int (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 rightx))
128.0
48.0
@@ -233,7 +233,7 @@
-1.0
)
)
(f0-19 (analog-input
(f0-19 (analog-input-vertical-first ;; og:preserve-this
(the-as int (-> (the-as cpad-list (+ (* arg4 4) (the-as int *cpad-list*))) cpads 0 righty))
128.0
48.0
+35 -23
View File
@@ -514,7 +514,7 @@
(rot-speed (* DISPLAY_FPS_RATIO (-> *CAM_EYE-bank* rot-speed)))
)
(when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG)))
(let ((f30-0 (analog-input
(let ((f30-0 (analog-input-horizontal-first ;; og:preserve-this
(the-as int (+ (-> *cpad-list* cpads 0 rightx) -256 (-> *cpad-list* cpads 0 leftx)))
0.0
48.0
@@ -522,7 +522,7 @@
-1.0
)
)
(f0-0 (analog-input
(f0-0 (analog-input-vertical-first ;; og:preserve-this
(the-as int (+ (-> *cpad-list* cpads 0 righty) -256 (-> *cpad-list* cpads 0 lefty)))
0.0
48.0
@@ -531,9 +531,10 @@
)
)
)
(if (-> *camera* settings flip-vertical)
(set! f0-0 (- f0-0))
)
;; og:preserve-this
;; (if (-> *camera* settings flip-vertical)
;; (set! f0-0 (- f0-0))
;; )
;; og:preserve-this changed for high fps
(set! (-> s4-0 y) (- (-> s4-0 y) (* (- f30-0) rot-speed)))
(set! (-> s4-0 x) (- (-> s4-0 x) (* (- f0-0) rot-speed)))
@@ -947,22 +948,24 @@
(s4-0 (new 'stack-no-clear 'matrix))
)
(when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG)))
;; og:preserve-this
(let ((f24-0
(analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 32.0 110.0 (* 8192.0 (seconds-per-frame)))
(analog-input-horizontal-third (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 32.0 110.0 (* 8192.0 (seconds-per-frame)))
)
(f1-2
(analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 32.0 110.0 (* 8192.0 (seconds-per-frame)))
(analog-input-vertical-third (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 32.0 110.0 (* 8192.0 (seconds-per-frame)))
)
(s2-0 (new-stack-matrix0))
)
(let ((v1-15 (new 'stack-no-clear 'vector)))
0.0
(if (-> *camera* settings flip-horizontal)
(set! f24-0 (- f24-0))
)
(if (-> *camera* settings flip-vertical)
(set! f1-2 (- f1-2))
)
;; og:preserve-this
;; (if (-> *camera* settings flip-horizontal)
;; (set! f24-0 (- f24-0))
;; )
;; (if (-> *camera* settings flip-vertical)
;; (set! f1-2 (- f1-2))
;; )
(when (< (-> self max-angle-offset) 1820.4445)
(set! f24-0 0.0)
(set! f1-2 0.0)
@@ -2374,7 +2377,11 @@
(set! f0-0 (fmin arg1 (* 0.0125 (+ -160.0 (the float arg0)) arg1)))
)
)
(the-as float f0-0)
;; og:preserve-this
(#if PC_PORT
(* (if (-> *pc-settings* third-camera-v-inverted?) 1.0 -1.0) (the-as float f0-0))
(the-as float f0-0)
)
)
)
@@ -2560,7 +2567,8 @@
)
)
(when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG)))
(let ((f30-2 (analog-input
;; og:preserve-this
(let ((f30-2 (analog-input-horizontal-third
(the-as int (-> *cpad-list* cpads 0 rightx))
128.0
32.0
@@ -2590,9 +2598,10 @@
(let ((gp-3 (new-stack-vector0))
(s5-3 (new-stack-vector0))
)
(if (-> *camera* settings flip-horizontal)
(set! f30-2 (- f30-2))
)
;; og:preserve-this
;; (if (-> *camera* settings flip-horizontal)
;; (set! f30-2 (- f30-2))
;; )
(if (or (logtest? (cam-slave-options-u32 BLOCK_RIGHT_STICK) (-> self options))
(logtest? (-> *camera* settings master-options) (cam-master-options BLOCK_RIGHT_STICK))
)
@@ -3529,7 +3538,8 @@
)
(when (not (paused?))
(when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG)))
(let ((f0-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 32.0 110.0 0.05)))
;; og:preserve-this
(let ((f0-0 (analog-input-vertical-third (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 32.0 110.0 0.05)))
(cond
((< (* 0.05 (- 1.0 (-> self view-off-param))) f0-0)
(+! (-> self view-off-param) (* 0.05 (- 1.0 (-> self view-off-param))))
@@ -3550,17 +3560,19 @@
(lerp (-> *CAM_STICK-bank* min-z) (-> *CAM_STICK-bank* max-z) (-> self view-off-param))
)
(when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG)))
;; og:preserve-this
(let ((f0-16
(analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 32.0 110.0 (* 21845.334 (seconds-per-frame)))
(analog-input-horizontal-third (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 32.0 110.0 (* 21845.334 (seconds-per-frame)))
)
(gp-0 (new-stack-matrix0))
(s3-0 (new-stack-vector0))
(s5-0 (new-stack-vector0))
(s4-0 (new-stack-vector0))
)
(if (-> *camera* settings flip-horizontal)
(set! f0-16 (- f0-16))
)
;; og:preserve-this
;; (if (-> *camera* settings flip-horizontal)
;; (set! f0-16 (- f0-16))
;; )
(cond
((!= f0-16 0.0)
(matrix-axis-angle! gp-0 (-> *camera* local-down) f0-16)
@@ -2322,7 +2322,8 @@
(let ((s5-0 (new-stack-matrix0))
(gp-0 (vector-reset! (new 'stack-no-clear 'vector)))
)
(let* ((f0-0 (analog-input (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) 0.0 48.0 110.0 -1.0))
;; og:preserve-this
(let* ((f0-0 (analog-input-horizontal-third (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) 0.0 48.0 110.0 -1.0))
(f0-1 (* -546.13336 f0-0))
(f0-3 (fmin 546.13336 (fmax -546.13336 f0-1)))
)
@@ -2391,7 +2392,8 @@
(defbehavior cam-launcher-long-joystick camera-slave ()
(when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG)))
(let ((gp-0 (new-stack-matrix0)))
(let* ((f0-0 (analog-input (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) 0.0 48.0 110.0 -1.0))
;; og:preserve-this
(let* ((f0-0 (analog-input-horizontal-third (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) 0.0 48.0 110.0 -1.0))
(f0-1 (* -546.13336 f0-0))
(f0-3 (fmin 546.13336 (fmax -546.13336 f0-1)))
)
+7 -5
View File
@@ -502,15 +502,17 @@
(cond
((-> this enable-controls)
(when (>= (-> *camera-combiner* interp-val) 1.0)
;; og:preserve-this
(set! (-> this rotyvv)
(analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 32.0 110.0 (-> s5-0 roty-accel))
(analog-input-horizontal-first (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 32.0 110.0 (-> s5-0 roty-accel))
)
(set! (-> this rotxvv)
(analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 32.0 110.0 (-> s5-0 rotx-accel))
(analog-input-vertical-first (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 32.0 110.0 (-> s5-0 rotx-accel))
)
(if (-> *setting-control* cam-current flip-vertical)
(set! (-> this rotxvv) (- (-> this rotxvv)))
)
;; og:preserve-this
;; (if (-> *setting-control* cam-current flip-vertical)
;; (set! (-> this rotxvv) (- (-> this rotxvv)))
;; )
)
)
(else
+4 -4
View File
@@ -1456,10 +1456,10 @@
(progress-cheats-suck-in-all-unlock #x126a)
(progress-cheats-fast-travel-unlock #x126b)
; (progress-camera-options #x1280)
; (progress-camera-options-first-horz #x1281)
; (progress-camera-options-first-vert #x1282)
; (progress-camera-options-third-horz #x1283)
; (progress-camera-options-third-vert #x1284)
(progress-camera-options-first-horz #x1281)
(progress-camera-options-first-vert #x1282)
(progress-camera-options-third-horz #x1283)
(progress-camera-options-third-vert #x1284)
(progress-normal #x1286)
(progress-inverted #x1287)
(progress-ps2-parts #x1288)
@@ -1809,12 +1809,13 @@
(transform-point-vector! a0-6 (-> this aim-pos))
)
(let ((f30-0 -1.0))
(if (-> *setting-control* cam-current flip-vertical)
(set! f30-0 (* -1.0 f30-0))
)
(set! (-> this rotyv) (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 32.0 120.0 1.0))
;; og:preserve-this
;; (if (-> *setting-control* cam-current flip-vertical)
;; (set! f30-0 (* -1.0 f30-0))
;; )
(set! (-> this rotyv) (analog-input-horizontal-first (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 32.0 120.0 1.0))
(set! (-> this rotxv)
(* f30-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 32.0 120.0 1.0))
(* f30-0 (analog-input-vertical-first (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 32.0 120.0 1.0))
)
)
(let ((f0-4 0.6))
@@ -957,11 +957,12 @@
(local-vars (sv-64 quaternion) (sv-68 vector) (sv-72 vector) (sv-80 float))
(cond
(arg0
(set! (-> self rotyvv) (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 64.0 96.0 -163840.0))
(set! (-> self rotxvv) (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 32.0 110.0 -127431.11))
(if (-> *setting-control* cam-current flip-vertical)
(set! (-> self rotxvv) (- (-> self rotxvv)))
)
;; og:preserve-this
(set! (-> self rotyvv) (analog-input-horizontal-first (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 64.0 96.0 -163840.0))
(set! (-> self rotxvv) (analog-input-vertical-first (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 32.0 110.0 -127431.11))
;; (if (-> *setting-control* cam-current flip-vertical)
;; (set! (-> self rotxvv) (- (-> self rotxvv)))
;; )
)
(else
(set! (-> self rotyvv) 0.0)
@@ -362,11 +362,12 @@
(set! (-> this rotxvv) 0.0)
(when (and (-> this enable-controls) (not (-> this reset-facing)) *camera-combiner*)
(when (>= (-> *camera-combiner* interp-val) 1.0)
(set! (-> this rotyvv) (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 32.0 110.0 1.0))
(set! (-> this rotxvv) (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 32.0 110.0 1.0))
(if (-> *setting-control* cam-current flip-vertical)
(set! (-> this rotxvv) (- (-> this rotxvv)))
)
;; og:preserve-this
(set! (-> this rotyvv) (analog-input-horizontal-first (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 32.0 110.0 1.0))
(set! (-> this rotxvv) (analog-input-vertical-first (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 32.0 110.0 1.0))
;; (if (-> *setting-control* cam-current flip-vertical)
;; (set! (-> this rotxvv) (- (-> this rotxvv)))
;; )
(set! (-> this rotyvv) (* (-> this rotyvv) (fabs (-> this rotyvv)) (-> s5-0 roty-accel)))
(set! (-> this rotxvv) (* (-> this rotxvv) (fabs (-> this rotxvv)) (-> s5-0 rotx-accel)))
(set! f30-0 1.0)
+1 -1
View File
@@ -614,7 +614,7 @@
(set! (-> this current-options) *picture-options*)
)
(('camera-options)
(set! (-> this current-options) *camera-options*)
(set! (-> this current-options) *camera-options-pc*)
)
(('select-load 'select-save)
(set! (-> this current-options) *load-save-options*)
+41 -38
View File
@@ -200,48 +200,51 @@ This gives us more freedom to write code how we want.
)
)
(define *camera-options-pc*
(progress-new-generic-scrolling-page (text-id progress-camera-options)
(new 'static 'menu-generic-boolean-option
:name (text-id progress-camera-options-first-horz)
:truthy-text (text-id progress-normal)
:falsey-text (text-id progress-inverted)
:get-value-fn (lambda () (-> *pc-settings* first-camera-h-inverted?))
:on-confirm (lambda ((val symbol))
(set! (-> *pc-settings* first-camera-h-inverted?) val)
(pc-settings-save)))
(new 'static 'menu-generic-boolean-option
:name (text-id progress-camera-options-first-vert)
:truthy-text (text-id progress-normal)
:falsey-text (text-id progress-inverted)
:get-value-fn (lambda () (-> *pc-settings* first-camera-v-inverted?))
:on-confirm (lambda ((val symbol))
(set! (-> *pc-settings* first-camera-v-inverted?) val)
(pc-settings-save)))
(new 'static 'menu-generic-boolean-option
:name (text-id progress-camera-options-third-horz)
:truthy-text (text-id progress-normal)
:falsey-text (text-id progress-inverted)
:get-value-fn (lambda () (-> *pc-settings* third-camera-h-inverted?))
:on-confirm (lambda ((val symbol))
(set! (-> *pc-settings* third-camera-h-inverted?) val)
(pc-settings-save)))
(new 'static 'menu-generic-boolean-option
:name (text-id progress-camera-options-third-vert)
:truthy-text (text-id progress-normal)
:falsey-text (text-id progress-inverted)
:get-value-fn (lambda () (-> *pc-settings* third-camera-v-inverted?))
:on-confirm (lambda ((val symbol))
(set! (-> *pc-settings* third-camera-v-inverted?) val)
(pc-settings-save)))
(new 'static 'menu-generic-confirm-option
:name (text-id progress-restore-defaults)
:on-confirm (lambda ((val symbol))
(reset-camera *pc-settings* #t)
(pc-settings-save))))
)
;; TODO - this is a gross misuse of macros, instead if we want to hide a very small amount of options in one menu versus another
;; it's a clear indication of a missing feature (add a lambda that determines visibility, or just the use disabled one)
(defmacro game-options-pc-input-options ()
`(progress-new-generic-link-to-scrolling-page (text-id progress-menu-input-options)
; (progress-new-generic-link-to-scrolling-page (text-id progress-camera-options)
; (new 'static 'menu-generic-boolean-option
; :name (text-id progress-camera-options-first-horz)
; :truthy-text (text-id progress-normal)
; :falsey-text (text-id progress-inverted)
; :get-value-fn (lambda () (-> *pc-settings* first-camera-h-inverted?))
; :on-confirm (lambda ((val symbol))
; (set! (-> *pc-settings* first-camera-h-inverted?) val)
; (pc-settings-save)))
; (new 'static 'menu-generic-boolean-option
; :name (text-id progress-camera-options-first-vert)
; :truthy-text (text-id progress-normal)
; :falsey-text (text-id progress-inverted)
; :get-value-fn (lambda () (-> *pc-settings* first-camera-v-inverted?))
; :on-confirm (lambda ((val symbol))
; (set! (-> *pc-settings* first-camera-v-inverted?) val)
; (pc-settings-save)))
; (new 'static 'menu-generic-boolean-option
; :name (text-id progress-camera-options-third-horz)
; :truthy-text (text-id progress-normal)
; :falsey-text (text-id progress-inverted)
; :get-value-fn (lambda () (-> *pc-settings* third-camera-h-inverted?))
; :on-confirm (lambda ((val symbol))
; (set! (-> *pc-settings* third-camera-h-inverted?) val)
; (pc-settings-save)))
; (new 'static 'menu-generic-boolean-option
; :name (text-id progress-camera-options-third-vert)
; :truthy-text (text-id progress-normal)
; :falsey-text (text-id progress-inverted)
; :get-value-fn (lambda () (-> *pc-settings* third-camera-v-inverted?))
; :on-confirm (lambda ((val symbol))
; (set! (-> *pc-settings* third-camera-v-inverted?) val)
; (pc-settings-save)))
; (new 'static 'menu-generic-confirm-option
; :name (text-id progress-restore-defaults)
; :on-confirm (lambda ((val symbol))
; (reset-camera *pc-settings* #t)
; (pc-settings-save))))
(progress-new-generic-link-to-scrolling-page (text-id progress-menu-controller-options) :should-disable? (lambda () (<= (pc-get-controller-count) 0))
(new 'static 'menu-generic-carousel-option
:name (text-id progress-controller-options-select-controller)