From 3eec4d2406c22a4e7e7573e895a8cb653b328e98 Mon Sep 17 00:00:00 2001 From: Grateful Forest <168700820+gratefulforest@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:02:20 +1030 Subject: [PATCH] jak1: fix high fps ripples + frozen ripples (#4067) Have done some custom ripples so thought I could fix this. At first I scaled ripple speeds before realizing that wouldn't work if you change FPS mid-game. Instead I found the delta increment is there as a variable, and just scaled that increment directly. I followed the same convention used everywhere; just multiply by `DISPLAY_FPS_RATIO`. That was the easy bit, the hard part was a second, unrelated issue, whether you scale the delta or not, which is on level entry at high fps, it shows no water movement at all. I saw the delta was always being created at 0.0 on high FPS, and saw the delta was computed nowhere in GOAL, only mips2c. I found inspiration from [this patch](https://github.com/open-goal/jak-project/blob/5ac5b6aae8f8058e76a27cd14d37db6c0b4d5821/goal_src/jak1/engine/common-obs/ropebridge.gc#L605-L611), where the time ratio is changed to 60 FPS temporarily. However, fixing the time ratio still created 0.0 deltas, and no matter what I did, it always created 0.0 deltas. I was about to give up, thinking there's no way to scale the mips2c deltas. However, I found out why it was giving 0.0 deltas, which is on high FPS, the video-mode is neither `pal` or `ntsc`, but `custom`, and the misps2c code uses settings for `pal` or `ntsc`. To include support for high FPS, I temporarily change it to `ntsc`, and only apply this at the wave table creation when `custom`. --- goal_src/jak1/engine/gfx/foreground/ripple.gc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/goal_src/jak1/engine/gfx/foreground/ripple.gc b/goal_src/jak1/engine/gfx/foreground/ripple.gc index b80606ac11..70e1795ebc 100644 --- a/goal_src/jak1/engine/gfx/foreground/ripple.gc +++ b/goal_src/jak1/engine/gfx/foreground/ripple.gc @@ -44,7 +44,7 @@ (when (!= f0-1 0.0) (dotimes (v1-4 (-> arg0 count)) (let ((a1-4 (-> arg0 wave v1-4))) - (+! (-> a1-4 offs) (* f0-1 (-> a1-4 delta))) + (+! (-> a1-4 offs) (* f0-1 (* DISPLAY_FPS_RATIO (-> a1-4 delta)))) ;; changed for high fps (set! (-> a1-4 offs) (the float (logand (the int (-> a1-4 offs)) #xffff))))) (set! (-> arg0 frame-save) (the-as uint (-> *display* integral-frame-counter))))) 0 @@ -66,7 +66,11 @@ (when (-> s4-0 gp-0 waveform) (let ((s3-0 gp-0) (s2-0 (-> s4-0 gp-0 waveform))) - (ripple-create-wave-table (the-as ripple-wave-set s2-0)) + ;; og:preserve-this changed for high fps, use ntsc for table + (protect ((-> *setting-control* current video-mode)) + (when (= (-> *setting-control* current video-mode) 'custom) + (set! (-> *setting-control* current video-mode) 'ntsc)) + (ripple-create-wave-table (the-as ripple-wave-set s2-0))) (while (!= s3-0 s5-0) (when (= s2-0 (-> s4-0 s3-0 waveform)) (ripple-apply-wave-table (-> s4-0 s3-0 effect))