diff --git a/goal_src/jak2/engine/entity/entity.gc b/goal_src/jak2/engine/entity/entity.gc index b6e075434a..49751acfd8 100644 --- a/goal_src/jak2/engine/entity/entity.gc +++ b/goal_src/jak2/engine/entity/entity.gc @@ -2270,14 +2270,14 @@ (not (logtest? (-> sv-48 perm status) (entity-perm-status bit-9 bit-10))) (not (logtest? (-> sv-48 kill-mask) sv-32)) (or (-> s4-1 vis-info 0) (< (vector-vector-distance (-> sv-48 trans) sv-16) (-> sv-48 vis-dist))) - ;; og:preserve-this PC port note: added this extra check to fix level types being used after deloaded because of bad entity placement - (#if PC_PORT - (or (not (type-type? (-> sv-48 entity type) entity-actor)) (and (valid? (-> (the-as entity-actor (-> sv-48 entity)) etype) type "entity-type-check etype" #f *stdcon*) - (valid? (-> (the-as entity-actor (-> sv-48 entity)) etype symbol) symbol "entity-type-check symbol" #f *stdcon*) - (valid? (-> (the-as entity-actor (-> sv-48 entity)) etype symbol value) type "entity-type-check value" #f *stdcon*) - (= (-> (the-as entity-actor (-> sv-48 entity)) etype) (-> (the-as entity-actor (-> sv-48 entity)) etype symbol value)) - )) - #f) + ;; og:preserve-this PC port note: added this extra check to fix level types being used after deloaded because of bad entity placement + (#if PC_PORT + (or (not (type-type? (-> sv-48 entity type) entity-actor)) (and (valid? (-> (the-as entity-actor (-> sv-48 entity)) etype) type "entity-type-check etype" #f *stdcon*) + (valid? (-> (the-as entity-actor (-> sv-48 entity)) etype symbol) symbol "entity-type-check symbol" #f *stdcon*) + (valid? (-> (the-as entity-actor (-> sv-48 entity)) etype symbol value) type "entity-type-check value" #f *stdcon*) + (= (-> (the-as entity-actor (-> sv-48 entity)) etype) (-> (the-as entity-actor (-> sv-48 entity)) etype symbol value)) + )) + #f) ) (when (not (or (-> sv-48 process) (logtest? (-> sv-48 perm status) (entity-perm-status bit-0 dead)) s0-0)) (birth! (-> sv-48 entity)) diff --git a/goal_src/jak2/engine/ui/minimap.gc b/goal_src/jak2/engine/ui/minimap.gc index 811fa7a0ea..f36d21d494 100644 --- a/goal_src/jak2/engine/ui/minimap.gc +++ b/goal_src/jak2/engine/ui/minimap.gc @@ -1384,7 +1384,7 @@ (set! sv-220 (new 'stack-no-clear 'matrix)) (set! sv-224 (new 'stack-no-clear 'matrix)) (set! sv-228 (new 'stack-no-clear 'matrix)) - (set! (-> sv-216 quad) (-> (matrix-world->local #f #f) vector 2 quad)) + (set! (-> sv-216 quad) (-> (#if PC_PORT (if (-> *pc-settings* minimap-force-north) *matrix-minimap-north* (matrix-world->local #f #f)) (matrix-world->local #f #f)) vector 2 quad)) (set! (-> sv-216 y) 0.0) (vector-normalize! sv-216 1.0) (vector-z-quaternion! (the-as vector sv-220) (-> (the-as process-drawable sv-16) root quat)) @@ -1635,7 +1635,7 @@ (set! sv-228 (new 'stack-no-clear 'matrix)) (set! sv-232 (new 'stack-no-clear 'matrix)) (when sv-212 - (set! (-> sv-220 quad) (-> (matrix-world->local #f #f) vector 2 quad)) + (set! (-> sv-220 quad) (-> (#if PC_PORT (if (-> *pc-settings* minimap-force-north) *matrix-minimap-north* (matrix-world->local #f #f)) (matrix-world->local #f #f)) vector 2 quad)) (set! (-> sv-220 y) 0.0) (vector-normalize! sv-220 1.0) (vector-z-quaternion! (the-as vector sv-224) (-> (the-as process-drawable sv-16) root quat)) @@ -1784,7 +1784,7 @@ (set! sv-228 (new 'stack-no-clear 'matrix)) (set! sv-232 (new 'stack-no-clear 'matrix)) (when sv-212 - (set! (-> sv-220 quad) (-> (matrix-world->local #f #f) vector 2 quad)) + (set! (-> sv-220 quad) (-> (#if PC_PORT (if (-> *pc-settings* minimap-force-north) *matrix-minimap-north* (matrix-world->local #f #f)) (matrix-world->local #f #f)) vector 2 quad)) (set! (-> sv-220 y) 0.0) (vector-normalize! sv-220 1.0) (vector-z-quaternion! (the-as vector sv-224) (-> (the-as process-drawable sv-16) root quat)) @@ -1914,7 +1914,7 @@ (set! (-> (the-as (pointer uint128) s3-1) 1) (-> this draw2-tmpl quad 1)) (let ((s2-0 (new-stack-vector0))) (let ((s1-0 (new-stack-vector0))) - (set! (-> s1-0 quad) (-> (matrix-local->world #f #f) vector 2 quad)) + (set! (-> s1-0 quad) (-> (#if PC_PORT (if (-> *pc-settings* minimap-force-north) *matrix-minimap-north* (matrix-local->world #f #f)) (matrix-local->world #f #f)) vector 2 quad)) (set! (-> s1-0 y) 0.0) (vector-normalize! s1-0 1.0) (let ((v1-16 (-> arg0 mat))) @@ -2126,7 +2126,7 @@ (set! sv-52 v1-29) ) (set! sv-56 (target-pos 0)) - (set! (-> sv-52 quad 0) (-> (matrix-world->local #f #f) vector 2 quad)) + (set! (-> sv-52 quad 0) (-> (#if PC_PORT (if (-> *pc-settings* minimap-force-north) *matrix-minimap-north* (matrix-world->local #f #f)) (matrix-world->local #f #f)) vector 2 quad)) (set! (-> sv-52 vector 0 y) 0.0) (vector-normalize! (the-as vector sv-52) 1.0) (cond diff --git a/goal_src/jak2/pc/debug/default-menu-pc.gc b/goal_src/jak2/pc/debug/default-menu-pc.gc index 3b09a7818c..0c9ff1dd10 100644 --- a/goal_src/jak2/pc/debug/default-menu-pc.gc +++ b/goal_src/jak2/pc/debug/default-menu-pc.gc @@ -945,6 +945,10 @@ (flag "GAME_TERRITORY_SCEI" (the binteger GAME_TERRITORY_SCEI) dm-territory-pick-func) (flag "GAME_TERRITORY_SCEK" (the binteger GAME_TERRITORY_SCEK) dm-territory-pick-func) ) + (menu "Minimap" + (flag "Non-PS2 coordinates" #f ,(dm-lambda-boolean-flag (-> *pc-settings* smooth-minimap?))) + (flag "Always face north" #f ,(dm-lambda-boolean-flag (-> *pc-settings* minimap-force-north))) + ) (flag "V-sync" #f ,(dm-lambda-boolean-flag (-> *pc-settings* vsync?))) (flag "PS2 actor vis" #f ,(dm-lambda-boolean-flag (-> *pc-settings* ps2-actor-vis?))) (flag "Display actor counts" *display-actor-counts* dm-boolean-toggle-pick-func) diff --git a/goal_src/jak2/pc/pckernel-impl.gc b/goal_src/jak2/pc/pckernel-impl.gc index b87b03bd1e..db5f7fa05a 100644 --- a/goal_src/jak2/pc/pckernel-impl.gc +++ b/goal_src/jak2/pc/pckernel-impl.gc @@ -90,6 +90,7 @@ (fast-airlock? symbol) (fast-elevator? symbol) (fast-progress? symbol) + (minimap-force-north symbol) (stats statistics) @@ -112,6 +113,7 @@ ) (define *pc-settings* (the pc-settings-jak2 #f)) +(define *matrix-minimap-north* (quaternion->matrix (new 'static 'matrix) (quaternion-vector-angle! (new 'static 'quaternion) *y-vector* (degrees 180)))) ;; jak 2 discord rpc structure @@ -143,6 +145,7 @@ (true! (-> obj fast-elevator?)) (false! (-> obj fast-progress?)) (true! (-> obj smooth-minimap?)) + (false! (-> obj minimap-force-north)) (false! (-> obj hires-clouds?)) (set! (-> obj speedrunner-mode-custom-bind) 0) diff --git a/goal_src/jak2/pc/pckernel.gc b/goal_src/jak2/pc/pckernel.gc index ebbfe0e6ed..4465b16a31 100644 --- a/goal_src/jak2/pc/pckernel.gc +++ b/goal_src/jak2/pc/pckernel.gc @@ -746,6 +746,7 @@ (("fast-elevator?") (set! (-> obj fast-elevator?) (file-stream-read-symbol file))) (("fast-progress?") (set! (-> obj fast-progress?) (file-stream-read-symbol file))) (("smooth-minimap?") (set! (-> obj smooth-minimap?) (file-stream-read-symbol file))) + (("minimap-force-north") (set! (-> obj minimap-force-north) (file-stream-read-symbol file))) (("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))) @@ -797,6 +798,7 @@ (format file " (fast-elevator? ~A)~%" (-> obj fast-elevator?)) (format file " (fast-progress? ~A)~%" (-> obj fast-progress?)) (format file " (smooth-minimap? ~A)~%" (-> obj smooth-minimap?)) + (format file " (minimap-force-north ~A)~%" (-> obj minimap-force-north)) (format file " (hires-clouds? ~A)~%" (-> obj hires-clouds?)) (format file " (text-language ~D)~%" (-> obj text-language)) (format file " (controller-led-status? ~A)~%" (-> obj controller-led-status?)) diff --git a/goal_src/jak3/engine/draw/drawable.gc b/goal_src/jak3/engine/draw/drawable.gc index 1a8d8dc859..e3ec07f109 100644 --- a/goal_src/jak3/engine/draw/drawable.gc +++ b/goal_src/jak3/engine/draw/drawable.gc @@ -1190,7 +1190,10 @@ (cond ((>= (-> arg1 force-lod) 0) (set! s4-1 (-> arg1 force-lod)) - (if (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) f30-0) + ;; og:preserve-this force high lods + (if (#if (not PC_PORT) + (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) f30-0) + (and (-> *pc-settings* ps2-lod-dist?) (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) f30-0))) (return #f) ) ) @@ -1201,7 +1204,19 @@ ) ) ) - (if (and (< (-> arg1 lod-set lod s4-1 dist) f30-0) (< (-> arg1 force-lod) 0)) + ;; og:preserve-this lod hacks! + (with-pc + (when (not (-> *pc-settings* ps2-lod-dist?)) + (set! s4-1 (minmax (-> *pc-settings* lod-force-actor) 0 (-> arg1 lod-set max-lod))) + (when (> (-> arg1 force-lod) -1) + (set! s4-1 (-> arg1 force-lod)) + ) + ) + ) + (if (#if (not PC_PORT) + (and (< (-> arg1 lod-set lod s4-1 dist) f30-0) (< (-> arg1 force-lod) 0)) + (and (-> *pc-settings* ps2-lod-dist?) (< (-> arg1 lod-set lod s4-1 dist) f30-0) (< (-> arg1 force-lod) 0)) + ) (return #f) ) (let ((v1-49 (-> *level* level (-> arg1 level-index))) @@ -1246,8 +1261,16 @@ (return #f) ) (set! (-> pp clock) (-> sv-16 clock)) - (if (or (= s4-1 (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-control-status lod-set))) - (foreground-draw arg1 arg3 f30-0) + ;; og:preserve-this PC port note: we ALWAYS disable the envmap hack when a process-drawable has warp effect enabled + (when (or (= s4-1 (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-control-status lod-set))) + (protect ((-> *pc-settings* force-envmap?)) + (when (not (movie?)) + (dotimes (eff-i (-> arg1 mgeo header effect-count)) + (if (and (zero? (logand (ash 1 eff-i) (-> arg1 effect-mask))) + (logtest? (effect-bits cross-fade) (-> arg1 mgeo effect eff-i effect-bits))) + (false! (-> *pc-settings* force-envmap?))))) + (foreground-draw arg1 arg3 f30-0) + ) ) ) (when (and (< s4-1 (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-control-status math-skel))) @@ -2153,10 +2176,12 @@ (set! s3-0 (the uint (+ #x10000 s3-0))) ) - ;; track previous frame's run time. This is used to disable some extra effects if the game - ;; is close to lagging. We disable this. - ; (set! (-> arg0 frames s4-0 run-time) s3-0) - (set! (-> arg0 frames s4-0 run-time) 0) + ;; store the amount of ticks that the frame took. + ;; og:preserve-this + ;; PC PORT NOTE : the originaly game reads this field in places to check if frames are taking too long and avoid doing potentially laggy things. + ;; those numbers are hardcoded for 60fps, they would be a pain to adjust, and the effects in the pc port are negligible. + ;; so, we just pretend frames rendered in planck time. + (set! (-> arg0 frames s4-0 run-time) (#if PC_PORT 0 (the int s3-0))) ;; disable their vsync logic: ; (set! f30-1 (cond diff --git a/goal_src/jak3/engine/game/game-save.gc b/goal_src/jak3/engine/game/game-save.gc index 7d910b7a7b..f73535ca3c 100644 --- a/goal_src/jak3/engine/game/game-save.gc +++ b/goal_src/jak3/engine/game/game-save.gc @@ -2998,6 +2998,8 @@ (else (case *kernel-boot-message* (('play 'preview) + (#when PC_PORT + (pc-settings-save)) (auto-save-command 'auto-save 0 0 *default-pool* #f) ) ) diff --git a/goal_src/jak3/engine/game/main.gc b/goal_src/jak3/engine/game/main.gc index 58d4b16754..f82b522961 100644 --- a/goal_src/jak3/engine/game/main.gc +++ b/goal_src/jak3/engine/game/main.gc @@ -25,18 +25,43 @@ (defun letterbox ((arg0 bucket-id) (arg1 float)) "Draw letterbox" - (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) - arg0 - ) - (draw-sprite2d-xy-absolute s4-0 0 0 512 (the int (* 46.0 arg1)) (new 'static 'rgba :a #x80) #x3fffff) - (draw-sprite2d-xy-absolute - s4-0 - 0 - (- 416 (the int (* 46.0 arg1))) - 512 - (+ (the int (* 46.0 arg1)) 1) - (new 'static 'rgba :a #x80) - #x3fffff + (with-dma-buffer-add-bucket ((dma-buf (-> (current-frame) global-buf)) + arg0) + (#cond + ((not PC_PORT) + (draw-sprite2d-xy-absolute dma-buf 0 0 512 (the int (* 46.0 arg1)) (new 'static 'rgba :a #x80) #x3fffff) + (draw-sprite2d-xy-absolute dma-buf 0 (- 416 (the int (* 46.0 arg1))) 512 (+ (the int (* 46.0 arg1)) 1) (new 'static 'rgba :a #x80) #x3fffff) + ) + (#t + (if (-> *pc-settings* use-vis?) + ;; original game mode. dont do anything. + (begin + (draw-sprite2d-xy-absolute dma-buf 0 0 512 (the int (* 46.0 arg1)) (new 'static 'rgba :a #x80) #x3fffff) + (draw-sprite2d-xy-absolute dma-buf 0 (- 416 (the int (* 46.0 arg1))) 512 (+ (the int (* 46.0 arg1)) 1) (new 'static 'rgba :a #x80) #x3fffff)) + ;; native mode. force 16x9 letterboxing always. + (begin + (cond + ((< (-> *pc-settings* aspect-ratio) ASPECT_16X9) + ;; too tall. needs vertical letterboxing. + (let ((lbx-h (the int (* 208.0 (- 1.0 (/ (-> *pc-settings* aspect-ratio) ASPECT_16X9)))))) + (set! lbx-h (the int (* arg1 lbx-h))) + ;(format 0 "using new letterbox! size: ~D~%" lbx-h) + (draw-sprite2d-xy dma-buf 0 0 512 lbx-h (new 'static 'rgba :a #x80) #x3fffff) + (draw-sprite2d-xy dma-buf 0 (- 416 lbx-h) 512 lbx-h (new 'static 'rgba :a #x80) #x3fffff) + ) + ) + ((> (-> *pc-settings* aspect-ratio) ASPECT_16X9) + ;; too wide. needs horizontal letterboxing. + (let ((lbx-w (the int (* 256.0 (- 1.0 (/ ASPECT_16X9 (-> *pc-settings* aspect-ratio))))))) + ;(format 0 "using new pillarbox! size: ~D~%" lbx-w) + (draw-sprite2d-xy dma-buf 0 0 lbx-w 416 (new 'static 'rgba :a #x80) #x3fffff) + (draw-sprite2d-xy dma-buf (- 512 lbx-w) 0 lbx-w 416 (new 'static 'rgba :a #x80) #x3fffff) + ) + ) + ) + ) + ) + ) ) ) 0 diff --git a/goal_src/jak3/engine/gfx/math-camera.gc b/goal_src/jak3/engine/gfx/math-camera.gc index 9bb9d2f2c7..39ad9f0dcc 100644 --- a/goal_src/jak3/engine/gfx/math-camera.gc +++ b/goal_src/jak3/engine/gfx/math-camera.gc @@ -66,33 +66,32 @@ Without this corrector, the fogginess of the world would change as the FOV chang (set! (-> arg0 y-ratio) (* 0.75 (-> arg0 x-ratio))) (set! (-> arg0 y-ratio) (* 0.5625 (-> arg0 x-ratio))) ) - ;; TODO pckernel ;; og:preserve-this - ;; (with-pc - ;; (cond - ;; ((-> *pc-settings* use-vis?) - ;; ;; using game vis, cannot allow seeing more of the view - ;; ;; crops excess aspect ratio at the top and bottom - ;; ;(set! (-> arg0 y-ratio) (* (1/ (-> *pc-settings* aspect-ratio)) (-> arg0 x-ratio))) - ;; ) - ;; ((real-movie?) - ;; ;; this mess is just so that we can force the original 16x9 cropping during cutscenes. - ;; (if (<= (-> *pc-settings* aspect-ratio) ASPECT_16X9) - ;; (set! (-> arg0 y-ratio) (* (1/ (-> *pc-settings* aspect-ratio)) (-> arg0 x-ratio))) - ;; (begin - ;; (set! (-> arg0 y-ratio) (* (1/ ASPECT_16X9) (-> arg0 x-ratio))) - ;; (*! (-> arg0 x-ratio) (/ (-> *pc-settings* aspect-ratio) ASPECT_16X9)) - ;; ) - ;; ) - ;; ) - ;; (else - ;; ;; not using game vis, allow *extended* aspect ratios - ;; ;; there is no vertical cropping, and you can see more of the sides - ;; (set! (-> arg0 y-ratio) (* (1/ ASPECT_4X3) (-> arg0 x-ratio))) ;; same cropping as 4x3 - ;; (*! (-> arg0 x-ratio) (/ (-> *pc-settings* aspect-ratio) ASPECT_4X3)) ;; extend fov! shows more on the sides. - ;; ) - ;; ) - ;; ) + (with-pc + (cond + ((-> *pc-settings* use-vis?) + ;; using game vis, cannot allow seeing more of the view + ;; crops excess aspect ratio at the top and bottom + ;(set! (-> arg0 y-ratio) (* (1/ (-> *pc-settings* aspect-ratio)) (-> arg0 x-ratio))) + ) + ((real-movie?) + ;; this mess is just so that we can force the original 16x9 cropping during cutscenes. + (if (<= (-> *pc-settings* aspect-ratio) ASPECT_16X9) + (set! (-> arg0 y-ratio) (* (1/ (-> *pc-settings* aspect-ratio)) (-> arg0 x-ratio))) + (begin + (set! (-> arg0 y-ratio) (* (1/ ASPECT_16X9) (-> arg0 x-ratio))) + (*! (-> arg0 x-ratio) (/ (-> *pc-settings* aspect-ratio) ASPECT_16X9)) + ) + ) + ) + (else + ;; not using game vis, allow *extended* aspect ratios + ;; there is no vertical cropping, and you can see more of the sides + (set! (-> arg0 y-ratio) (* (1/ ASPECT_4X3) (-> arg0 x-ratio))) ;; same cropping as 4x3 + (*! (-> arg0 x-ratio) (/ (-> *pc-settings* aspect-ratio) ASPECT_4X3)) ;; extend fov! shows more on the sides. + ) + ) + ) (let ((f1-3 (-> arg0 x-ratio)) (f0-7 (-> arg0 y-ratio)) (v1-6 (-> arg0 cull-info)) diff --git a/goal_src/jak3/engine/ps2/pad.gc b/goal_src/jak3/engine/ps2/pad.gc index fe6244fbf8..3dae11b8ba 100644 --- a/goal_src/jak3/engine/ps2/pad.gc +++ b/goal_src/jak3/engine/ps2/pad.gc @@ -66,6 +66,18 @@ (define-extern get-real-current-time (function time-frame)) (define-extern get-current-language (function language-enum)) + +(#when PC_PORT + +;; redefined from C kernel +(defun scf-get-territory () + "redefined from C kernel for convenience" + (if (= (-> *pc-settings* territory) -1) + *default-territory* + (-> *pc-settings* territory)) + ) +) + ;; DECOMP BEGINS (deftype scf-time (structure) diff --git a/goal_src/jak3/engine/ui/minimap.gc b/goal_src/jak3/engine/ui/minimap.gc index 691446e1ac..8b068ccc4f 100644 --- a/goal_src/jak3/engine/ui/minimap.gc +++ b/goal_src/jak3/engine/ui/minimap.gc @@ -1578,7 +1578,8 @@ ) (let ((gp-0 *minimap*)) - (set! (-> gp-0 engine) (new 'global 'engine-minimap '*minimap* 64 connection-minimap)) + ;; og:preserve-this + (set! (-> gp-0 engine) (new 'global 'engine-minimap '*minimap* (#if PC_PORT 256 64) connection-minimap)) (countdown (v1-9 6) (set! (-> gp-0 trail v1-9 used-by) #f) ) @@ -2325,7 +2326,7 @@ (set! sv-220 (new 'stack-no-clear 'vector)) (set! sv-224 (new 'stack-no-clear 'matrix)) (set! sv-228 (new 'stack-no-clear 'matrix)) - (set! (-> sv-216 quad) (-> (matrix-world->local #f #f) fvec quad)) + (set! (-> sv-216 quad) (-> (#if PC_PORT (if (-> *pc-settings* minimap-force-north) *matrix-minimap-north* (matrix-world->local #f #f)) (matrix-world->local #f #f)) fvec quad)) (set! (-> sv-216 y) 0.0) (vector-normalize! sv-216 1.0) (vector-z-quaternion! sv-220 (-> (the-as process-drawable sv-16) root quat)) @@ -2611,7 +2612,7 @@ (set! sv-228 (new 'stack-no-clear 'matrix)) (set! sv-232 (new 'stack-no-clear 'matrix)) (when sv-212 - (set! (-> sv-220 quad) (-> (matrix-world->local #f #f) fvec quad)) + (set! (-> sv-220 quad) (-> (#if PC_PORT (if (-> *pc-settings* minimap-force-north) *matrix-minimap-north* (matrix-world->local #f #f)) (matrix-world->local #f #f)) fvec quad)) (set! (-> sv-220 y) 0.0) (vector-normalize! sv-220 1.0) (vector-z-quaternion! sv-224 (-> (the-as process-drawable sv-16) root quat)) @@ -2781,7 +2782,7 @@ (set! sv-228 (new 'stack-no-clear 'matrix)) (set! sv-232 (new 'stack-no-clear 'matrix)) (when sv-212 - (set! (-> sv-220 quad) (-> (matrix-world->local #f #f) fvec quad)) + (set! (-> sv-220 quad) (-> (#if PC_PORT (if (-> *pc-settings* minimap-force-north) *matrix-minimap-north* (matrix-world->local #f #f)) (matrix-world->local #f #f)) fvec quad)) (set! (-> sv-220 y) 0.0) (vector-normalize! sv-220 1.0) (vector-z-quaternion! sv-224 (-> (the-as process-drawable sv-16) root quat)) @@ -2935,12 +2936,13 @@ (texa (new 'static 'gs-texa :ta1 #x80)) ) (let ((s3-1 (-> s5-0 base))) - (let ((f30-0 (-> *video-params* relative-x-scale))) + ;; og:preserve-this this fixes minimap stretching at non-4x3 aspeect ratio + (let ((f30-0 (#if PC_PORT 1.0 (-> *video-params* relative-x-scale)))) (set! (-> (the-as (pointer uint128) s3-1) 0) (-> this draw2-tmpl dma-vif quad)) (set! (-> (the-as (pointer uint128) s3-1) 1) (-> this draw2-tmpl quad 1)) (let ((s2-0 (new-stack-vector0))) (let ((s1-0 (new-stack-vector0))) - (set! (-> s1-0 quad) (-> (matrix-local->world #f #f) fvec quad)) + (set! (-> s1-0 quad) (-> (#if PC_PORT (if (-> *pc-settings* minimap-force-north) *matrix-minimap-north* (matrix-local->world #f #f)) (matrix-local->world #f #f)) fvec quad)) (set! (-> s1-0 y) 0.0) (vector-normalize! s1-0 1.0) (let ((v1-16 (-> arg0 mat))) @@ -3236,12 +3238,13 @@ (set! sv-48 (new-stack-vector0)) (set! sv-52 (new-stack-vector0)) (set! sv-56 (target-pos 0)) - (set! (-> sv-52 quad) (-> (matrix-world->local #f #f) fvec quad)) + (set! (-> sv-52 quad) (-> (#if PC_PORT (if (-> *pc-settings* minimap-force-north) *matrix-minimap-north* (matrix-world->local #f #f)) (matrix-world->local #f #f)) fvec quad)) (set! (-> sv-52 y) 0.0) (vector-normalize! sv-52 1.0) (cond ((get-horizontal-flip-flag *blit-displays-work*) (let ((v1-57 (-> arg0 mat))) + ;; og:preserve-this (set! (-> v1-57 rvec x) (* (-> sv-52 z) (- f30-0))) (set! (-> v1-57 rvec y) 0.0) (set! (-> v1-57 rvec z) (- (-> sv-52 x))) @@ -3493,15 +3496,22 @@ ) (set! (-> arg0 corner 0 x) (the float (the int (- (-> s3-2 x) (* 0.5 f1-16))))) (set! (-> arg0 corner 0 z) (the float (the int (- (-> s3-2 z) (* 0.5 f0-53))))) + ;; og:preserve-this + (#when PC_PORT + ;; pc port note : don't align icons to PS2 framebuffer positions since + ;; it results in jagged motion on PC, since the framebuffer can be any size we want + (when (-> *pc-settings* smooth-minimap?) + (set! (-> arg0 corner 0 x) (- (-> s3-2 x) (* 0.5 f1-16))) + (set! (-> arg0 corner 0 z) (- (-> s3-2 z) (* 0.5 f0-53))) + ) + ) (set! (-> arg0 corner 1 x) (+ (-> arg0 corner 0 x) f1-16)) (set! (-> arg0 corner 1 z) (+ (-> arg0 corner 0 z) f0-53)) ) - ;; og:preserve-this (let* ((a3-1 (the int (+ (* (the-as uint 320) (-> arg1 class icon-xy x)) 8))) (t0-1 (the int (+ (* (the-as uint 320) (-> arg1 class icon-xy y)) 8))) - ;; adjusted: - (a1-65 (+ a3-1 300)) - (a2-14 (+ t0-1 300)) + (a1-65 (+ a3-1 312)) + (a2-14 (+ t0-1 312)) ) (set! (-> (the-as (pointer uint128) v1-122) 0) (-> this sprite-tmpl dma-vif quad)) (set! (-> (the-as (pointer uint128) v1-122) 1) (-> this sprite-tmpl quad 1)) @@ -3601,6 +3611,11 @@ (let ((s0-0 (new 'stack-no-clear 'vector)) (f30-0 (-> *video-params* relative-x-scale)) ) + ;; og:preserve-this correct the icons matrix so that it doesn't stretch horizontally + (#when PC_PORT + (/! (-> gp-0 mat vector 0 x) f30-0) + (/! (-> gp-0 mat vector 2 x) f30-0) + ) (when *target* (vector-z-quaternion! s0-0 (-> *target* control quat)) (vector-xz-normalize! s0-0 1.0) @@ -3694,6 +3709,11 @@ ) ) ) + ;; og:preserve-this revert widescreen correction done earlier + (#when PC_PORT + (*! (-> gp-0 mat vector 0 x) f30-0) + (*! (-> gp-0 mat vector 2 x) f30-0) + ) ) (if (not (paused?)) (+! (-> this goal-time) (* 14.0 (seconds-per-frame))) diff --git a/goal_src/jak3/pc/debug/default-menu-pc.gc b/goal_src/jak3/pc/debug/default-menu-pc.gc index 65a8123acb..5f76afe83e 100644 --- a/goal_src/jak3/pc/debug/default-menu-pc.gc +++ b/goal_src/jak3/pc/debug/default-menu-pc.gc @@ -937,6 +937,10 @@ (flag "GAME_TERRITORY_SCEI" (the binteger GAME_TERRITORY_SCEI) dm-territory-pick-func) (flag "GAME_TERRITORY_SCEK" (the binteger GAME_TERRITORY_SCEK) dm-territory-pick-func) ) + (menu "Minimap" + (flag "Non-PS2 coordinates" #f ,(dm-lambda-boolean-flag (-> *pc-settings* smooth-minimap?))) + (flag "Always face north" #f ,(dm-lambda-boolean-flag (-> *pc-settings* minimap-force-north))) + ) (flag "V-sync" #f ,(dm-lambda-boolean-flag (-> *pc-settings* vsync?))) (flag "PS2 actor vis" #f ,(dm-lambda-boolean-flag (-> *pc-settings* ps2-actor-vis?))) (flag "Display actor counts" *display-actor-counts* dm-boolean-toggle-pick-func) diff --git a/goal_src/jak3/pc/pckernel-impl.gc b/goal_src/jak3/pc/pckernel-impl.gc index f76953c91a..ca1e0c8845 100644 --- a/goal_src/jak3/pc/pckernel-impl.gc +++ b/goal_src/jak3/pc/pckernel-impl.gc @@ -88,6 +88,7 @@ (fast-airlock? symbol) (fast-elevator? symbol) (fast-progress? symbol) + (minimap-force-north symbol) ;(stats statistics) @@ -108,6 +109,7 @@ ) (define *pc-settings* (the pc-settings-jak3 #f)) +(define *matrix-minimap-north* (quaternion->matrix (new 'static 'matrix) (quaternion-vector-angle! (new 'static 'quaternion) *y-vector* (degrees 180)))) ;; jak 3 discord rpc structure @@ -139,6 +141,7 @@ (true! (-> obj fast-elevator?)) (false! (-> obj fast-progress?)) (true! (-> obj smooth-minimap?)) + (false! (-> obj minimap-force-north)) (false! (-> obj hires-clouds?)) (set! (-> obj speedrunner-mode-custom-bind) 0) 0) diff --git a/goal_src/jak3/pc/pckernel.gc b/goal_src/jak3/pc/pckernel.gc index a3d03284bf..3ad7ca8873 100644 --- a/goal_src/jak3/pc/pckernel.gc +++ b/goal_src/jak3/pc/pckernel.gc @@ -200,8 +200,7 @@ (define *led-fader-state* (new 'static 'led-fader-state :enable? #f)) (define *led-darkjak-color* (static-vector 0.5 0.0 0.5 1.0)) -(define *led-tomb-simon-off-color* (static-vector 0.0 0.0 0.0 1.0)) -(define *led-tomb-simon-color* (static-vector 0.0 0.0 0.0 1.0)) +(define *led-lightjak-color* (static-vector 0.0 0.0 1.0 1.0)) (define *led-wanted-flash-color* (static-vector 1.0 0.0 0.0 1.0)) @@ -349,8 +348,7 @@ (set-vector-xyz! (-> obj controller-led-color) 0.0 0.0 1.0) (when *target* - (let ((disable-fader? #t) - (simon-plat (the process #f))) + (let ((disable-fader? #t)) (when (-> obj controller-led-hp?) ;; flicker led according to hp. lower hp = faster and more intense flicker (cond @@ -378,13 +376,13 @@ ;; gun ((and (nonzero? (-> *target* gun)) (focus-test? *target* gun)) (case (-> *target* gun gun-type) - (((pickup-type eco-yellow)) + (((pickup-type gun-yellow-1) (pickup-type gun-yellow-2) (pickup-type gun-yellow-3)) (set-vector-xyz! (-> obj controller-led-color) 1.0 0.75 0.125)) - (((pickup-type eco-red)) + (((pickup-type gun-red-1) (pickup-type gun-red-2) (pickup-type gun-red-3)) (set-vector-xyz! (-> obj controller-led-color) 0.65 0.0 0.0)) - (((pickup-type eco-blue)) + (((pickup-type gun-blue-1) (pickup-type gun-blue-2) (pickup-type gun-blue-3)) (set-vector-xyz! (-> obj controller-led-color) 0.4375 0.8125 1.0)) - (((pickup-type eco-dark)) + (((pickup-type gun-dark-1) (pickup-type gun-dark-2) (pickup-type gun-dark-3)) (set-vector-xyz! (-> obj controller-led-color) 0.6875 0.6 0.78125)) ) ) @@ -401,6 +399,18 @@ (vector3-copy!! (-> obj controller-led-color) (-> *led-fader-state* cur-color)) ) + ;; lightjak + ((and (nonzero? (-> *target* lightjak)) (focus-test? *target* light)) + (vector-copy! (-> *led-fader-state* end-color) *led-lightjak-color*) + (set! disable-fader? #f) + (if (not (-> *led-fader-state* enable?)) + (enable *led-fader-state* (-> obj controller-led-color))) + (if (and (-> *target* next-state) (= (-> *target* next-state name) 'target-lightjak-get-off)) + (update *led-fader-state* 0.0 0.75) + (update *led-fader-state* 1.0 0.3)) + (vector3-copy!! (-> obj controller-led-color) (-> *led-fader-state* cur-color)) + ) + ;; indax ((focus-test? *target* indax) (set-vector-xyz! (-> obj controller-led-color) 1.0 0.5 0.0) @@ -597,6 +607,7 @@ (("fast-elevator?") (set! (-> obj fast-elevator?) (file-stream-read-symbol file))) (("fast-progress?") (set! (-> obj fast-progress?) (file-stream-read-symbol file))) (("smooth-minimap?") (set! (-> obj smooth-minimap?) (file-stream-read-symbol file))) + (("minimap-force-north") (set! (-> obj minimap-force-north) (file-stream-read-symbol file))) (("hires-clouds?") (set! (-> obj hires-clouds?) (file-stream-read-symbol 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))) @@ -647,6 +658,7 @@ (format file " (fast-elevator? ~A)~%" (-> obj fast-elevator?)) (format file " (fast-progress? ~A)~%" (-> obj fast-progress?)) (format file " (smooth-minimap? ~A)~%" (-> obj smooth-minimap?)) + (format file " (minimap-force-north ~A)~%" (-> obj minimap-force-north)) (format file " (hires-clouds? ~A)~%" (-> obj hires-clouds?)) (format file " (controller-led-status? ~A)~%" (-> obj controller-led-status?)) (format file " (speedrunner-mode-custom-bind ~D)~%" (-> obj speedrunner-mode-custom-bind))