From 0db7be55e6528f8a872d9961bbcdce2a7a22e1e4 Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Wed, 22 May 2024 17:27:00 +0200 Subject: [PATCH] jak3: sprite limit increase + add bsphere toggle for region faces (#3529) --- .../sprite/particles/sparticle-launcher.gc | 17 ++++++++- .../engine/gfx/sprite/particles/sparticle.gc | 5 +++ goal_src/jak3/engine/gfx/sprite/sprite-h.gc | 2 + goal_src/jak3/engine/gfx/sprite/sprite.gc | 16 ++++++++ goal_src/jak3/engine/level/region.gc | 38 ++++++++++++++----- 5 files changed, 67 insertions(+), 11 deletions(-) diff --git a/goal_src/jak3/engine/gfx/sprite/particles/sparticle-launcher.gc b/goal_src/jak3/engine/gfx/sprite/particles/sparticle-launcher.gc index 7179dd62de..3c107e4223 100644 --- a/goal_src/jak3/engine/gfx/sprite/particles/sparticle-launcher.gc +++ b/goal_src/jak3/engine/gfx/sprite/particles/sparticle-launcher.gc @@ -897,7 +897,16 @@ ) (add-debug-matrix *display-sprite-marks* (bucket-id debug) (-> this origin) (meters 2)) ) - (sphere-in-view-frustum? (the-as sphere s5-1)) + ;; og:preserve-this + ;; can we see it? + (#if (not PC_PORT) + (sphere-in-view-frustum? (the-as sphere s5-1)) + (if (-> *pc-settings* ps2-parts?) + ;; og:preserve-this launchers have larger bsphere if you have ps2 parts off + (sphere-in-view-frustum? (the-as sphere s5-1)) + (sphere-in-view-frustum? (the-as sphere (begin (*! (-> s5-1 w) 4.0) s5-1))) + ) + ) ) ) ) @@ -1205,6 +1214,12 @@ (if (nonzero? (-> this matrix)) (set! f30-0 0.0) ) + + ;; og:preserve-this if we have ps2 particles off, say we're at the camera + (with-pc + (if (not (-> *pc-settings* ps2-parts?)) + (set! f30-0 0.0))) + (let ((s2-1 (-> this length))) (b! #t cfg-102 :delay (nop!)) (label cfg-26) diff --git a/goal_src/jak3/engine/gfx/sprite/particles/sparticle.gc b/goal_src/jak3/engine/gfx/sprite/particles/sparticle.gc index 7dcd32e7ed..95aab61513 100644 --- a/goal_src/jak3/engine/gfx/sprite/particles/sparticle.gc +++ b/goal_src/jak3/engine/gfx/sprite/particles/sparticle.gc @@ -51,6 +51,11 @@ (arg3 pointer) (arg4 (inline-array adgif-shader)) ) + ;; og:preserve-this + (#when PC_BIG_MEMORY + (*! arg0 SPRITE_MAX_AMOUNT_MULT) + ; (*! arg1 SPRITE_MAX_AMOUNT_MULT) + ) (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (let* ((v1-3 (/ (+ arg0 63) 64)) (a0-2 (/ (+ arg1 63) 64)) diff --git a/goal_src/jak3/engine/gfx/sprite/sprite-h.gc b/goal_src/jak3/engine/gfx/sprite/sprite-h.gc index 3db780afe4..5b9936530e 100644 --- a/goal_src/jak3/engine/gfx/sprite/sprite-h.gc +++ b/goal_src/jak3/engine/gfx/sprite/sprite-h.gc @@ -10,6 +10,8 @@ (define-extern sprite-glow-init-engine (function dma-buffer none)) (define-extern sprite-glow-draw (function dma-buffer none)) +(#when PC_BIG_MEMORY (defconstant SPRITE_MAX_AMOUNT_MULT 12)) + ;; DECOMP BEGINS (deftype sprite-vec-data-2d (structure) diff --git a/goal_src/jak3/engine/gfx/sprite/sprite.gc b/goal_src/jak3/engine/gfx/sprite/sprite.gc index 1fbf64c999..e679c5d68a 100644 --- a/goal_src/jak3/engine/gfx/sprite/sprite.gc +++ b/goal_src/jak3/engine/gfx/sprite/sprite.gc @@ -80,6 +80,10 @@ The glow and distort renderers will pull sprites from here." (defmethod new sprite-aux-list ((allocation symbol) (type-to-make type) (arg0 int)) + ;; og:preserve-this + (#when PC_BIG_MEMORY + (*! arg0 SPRITE_MAX_AMOUNT_MULT)) + (let ((v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* arg0 16)))))) (set! (-> v0-0 num-entries) arg0) (set! (-> v0-0 entry) 0) @@ -335,6 +339,12 @@ The glow and distort renderers will pull sprites from here." (define sprite-vu1-block (new 'static 'vu-function #|:length #x37b :qlength #x1be|#)) (defmethod new sprite-array-2d ((allocation symbol) (type-to-make type) (arg0 int) (arg1 int)) + ;; og:preserve-this + (#when PC_BIG_MEMORY + (*! arg0 SPRITE_MAX_AMOUNT_MULT) + ; (*! arg1 SPRITE_MAX_AMOUNT_MULT) + ) + (let* ((v1-0 (+ arg0 arg1)) (s4-0 (* 3 v1-0)) (a2-3 (* 5 v1-0)) @@ -351,6 +361,12 @@ The glow and distort renderers will pull sprites from here." ) (defmethod new sprite-array-3d ((allocation symbol) (type-to-make type) (arg0 int) (arg1 int)) + ;; og:preserve-this + (#when PC_BIG_MEMORY + (*! arg0 SPRITE_MAX_AMOUNT_MULT) + ; (*! arg1 SPRITE_MAX_AMOUNT_MULT) + ) + (let* ((v1-0 (+ arg0 arg1)) (s4-0 (* 3 v1-0)) (a2-3 (* 5 v1-0)) diff --git a/goal_src/jak3/engine/level/region.gc b/goal_src/jak3/engine/level/region.gc index b658e2a088..3cc3e384b9 100644 --- a/goal_src/jak3/engine/level/region.gc +++ b/goal_src/jak3/engine/level/region.gc @@ -242,17 +242,35 @@ (t9-0 this arg0) ) ) - (let ((s5-0 (-> this bsphere))) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - s5-0 - (-> this data normal) - (meters 2) - (new 'static 'rgba :r #xff :g #xff :a #x80) + (#cond + (PC_PORT + (when *debug-region-show-bsphere* + (let ((s5-0 (-> this bsphere))) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + s5-0 + (-> this data normal) + (meters 2) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (add-debug-sphere #t (bucket-id debug) s5-0 (-> this bsphere w) (new 'static 'rgba :r #xff :a #x30)) + ) + ) ) - (add-debug-sphere #t (bucket-id debug) s5-0 (-> this bsphere w) (new 'static 'rgba :r #xff :a #x30)) - ) + (#t + (let ((s5-0 (-> this bsphere))) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + s5-0 + (-> this data normal) + (meters 2) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (add-debug-sphere #t (bucket-id debug) s5-0 (-> this bsphere w) (new 'static 'rgba :r #xff :a #x30)) + ) + )) (add-debug-bound (bucket-id debug) (-> this data points)