From a80b4f1b97dc874ee19c28dd42e5258e66c1d7e4 Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Wed, 8 Nov 2023 23:34:58 +0100 Subject: [PATCH] jak2: some high fps fixes (#3177) --- goal_src/jak2/engine/gfx/foreground/foreground.gc | 3 ++- goal_src/jak2/engine/gfx/hw/display.gc | 2 ++ goal_src/jak2/engine/ui/hud-classes.gc | 3 ++- goal_src/jak2/engine/ui/minimap.gc | 3 ++- goal_src/jak2/levels/drill/ginsu.gc | 3 ++- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/goal_src/jak2/engine/gfx/foreground/foreground.gc b/goal_src/jak2/engine/gfx/foreground/foreground.gc index 4f723d421a2..45eb1f9afd4 100644 --- a/goal_src/jak2/engine/gfx/foreground/foreground.gc +++ b/goal_src/jak2/engine/gfx/foreground/foreground.gc @@ -311,7 +311,8 @@ ) ) (when (< v1-1 32) - (let* ((a3-1 (the-as int (-> pp clock integral-frame-counter))) + ;; og:preserve-this high fps fix + (let* ((a3-1 (the int (* DISPLAY_FPS_RATIO (-> pp clock integral-frame-counter)))) (a2-3 (-> a1-1 time-factor)) (t0-2 (+ (ash 1 a2-3) -1)) ) diff --git a/goal_src/jak2/engine/gfx/hw/display.gc b/goal_src/jak2/engine/gfx/hw/display.gc index 009ab481181..3a3a21dc1f0 100644 --- a/goal_src/jak2/engine/gfx/hw/display.gc +++ b/goal_src/jak2/engine/gfx/hw/display.gc @@ -10,6 +10,8 @@ ;(defconstant DMA_BUFFER_DEBUG_SIZE (* 8 1024 1024)) ;; 8M (defconstant DMA_BUFFER_DEBUG_SIZE (* 12 1024 1024)) ;; expand to 12M because we can +(defconstant DISPLAY_FPS_RATIO (/ (-> *display* time-factor) 5.0)) + ;; DECOMP BEGINS (defun get-current-time () diff --git a/goal_src/jak2/engine/ui/hud-classes.gc b/goal_src/jak2/engine/ui/hud-classes.gc index 7546b8a9eef..a37e3168f95 100644 --- a/goal_src/jak2/engine/ui/hud-classes.gc +++ b/goal_src/jak2/engine/ui/hud-classes.gc @@ -121,7 +121,8 @@ ) ) (when (not (paused?)) - (let ((v1-10 8)) + ;; og:preserve-this high fps fix + (let ((v1-10 (* DISPLAY_FPS_RATIO 8))) (if (and (< (-> this values 1 target) 270) (< 270 (+ (-> this values 1 target) v1-10))) (set! (-> this values 1 target) 270) ) diff --git a/goal_src/jak2/engine/ui/minimap.gc b/goal_src/jak2/engine/ui/minimap.gc index 0740391d12c..811fa7a0ea9 100644 --- a/goal_src/jak2/engine/ui/minimap.gc +++ b/goal_src/jak2/engine/ui/minimap.gc @@ -2429,7 +2429,8 @@ (if (or (logtest? (-> arg1 class flags) (minimap-flag frustum)) (logtest? (-> arg1 class flags) (minimap-flag racer)) (and (logtest? (-> arg1 class flags) (minimap-flag flash)) - (< (the-as int (logand (-> *display* base-clock integral-frame-counter) 15)) 8) + ;; og:preserve-this high fps fix + (< (the-as int (logand (the int (* DISPLAY_FPS_RATIO (-> *display* base-clock integral-frame-counter))) 15)) 8) ) ) (set! s2-0 #t) diff --git a/goal_src/jak2/levels/drill/ginsu.gc b/goal_src/jak2/levels/drill/ginsu.gc index 850eba8bd1d..2991c61e0e1 100644 --- a/goal_src/jak2/levels/drill/ginsu.gc +++ b/goal_src/jak2/levels/drill/ginsu.gc @@ -796,7 +796,8 @@ (ja :group! ginsu-idle-ja :num! min) ) (vector-seek! (-> self root scale) (new 'static 'vector :x 1.0 :y 1.0 :z 1.0) 0.02) - (+! (-> self path-pos) (/ 2048.0 (total-distance (-> self ambush-path)))) + ;; og:preserve-this high fps fix + (+! (-> self path-pos) (/ (* DISPLAY_FPS_RATIO 2048.0) (total-distance (-> self ambush-path)))) (let ((f30-1 (-> self path-pos))) (when (>= f30-1 1.0) (set! (-> self path-pos) 1.0)