jak2: fix warp effect for robotank and underb on other aspect ratios (#2574)

This commit is contained in:
Hat Kid
2023-04-29 17:03:13 +02:00
committed by GitHub
parent 8260920c2d
commit aff67d6bb7
2 changed files with 13 additions and 3 deletions
@@ -258,8 +258,10 @@
(s5-0 (new 'stack-no-clear 'vector))
(gp-0 (new 'stack-no-clear 'vector))
(f30-0 4096.0)
(ratio (* (-> *pc-settings* aspect-ratio-scale) 0.5))
)
(let ((f0-4 (* 0.00013563369 (tan (* 0.5 (-> *math-camera* fov))) f30-0)))
;; changed for PC port: scale effect based on aspect ratio
(let ((f0-4 (* 0.00013563369 (tan (* ratio (-> *math-camera* fov))) f30-0)))
(set-vector! (-> obj root scale) f0-4 f0-4 f0-4 1.0)
)
(set! (-> gp-0 quad) (-> (camera-pos) quad))
@@ -7,6 +7,9 @@
;; DECOMP BEGINS
;; added for PC port: ratio for warp effect interp and size
(define *underb-ratio* 0.5)
(deftype under-warp (process-drawable)
((interp float :offset-assert 200)
)
@@ -84,8 +87,13 @@
(s5-0 (new 'stack-no-clear 'vector))
(gp-0 (new 'stack-no-clear 'vector))
(f30-0 4096.0)
(ratio (* (-> *pc-settings* aspect-ratio-scale) 0.5))
)
(let ((f0-4 (* 0.00013563369 (tan (* 0.5 (-> *math-camera* fov))) f30-0)))
;; changed for PC port: resize warp effect based on aspect ratio
(set! *underb-ratio* ratio)
;; clamp interp if aspect ratio is too wide, effect becomes too subtle past 0.93 and completely stops at 1.0
(set! (-> obj interp) (if (> ratio 0.93) 0.93 ratio))
(let ((f0-4 (* 0.00013563369 (tan (* *underb-ratio* (-> *math-camera* fov))) f30-0)))
(set-vector! (-> obj root scale) f0-4 f0-4 f0-4 1.0)
)
(set! (-> gp-0 quad) (-> (camera-pos) quad))
@@ -119,7 +127,7 @@
(the-as skeleton-group (art-group-get-by-name *level* "skel-under-warp" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(set! (-> self interp) 0.5)
(set! (-> self interp) *underb-ratio*) ;; changed for PC port
(ja-channel-push! 2 (seconds 0.3))
(ja-no-eval :group! (-> self draw art-group data 2) :num! (loop!))
(let ((gp-2 (-> self skel root-channel 1)))