From 892e5a6c4940b1fd600d91b9548aeaa886cedd4e Mon Sep 17 00:00:00 2001 From: ManDude <7569514+ManDude@users.noreply.github.com> Date: Sun, 26 Jun 2022 02:26:48 +0100 Subject: [PATCH] fix fake vag clock and ocean with lag (#1558) * fix the fake vag clock * fix ocean in lag --- game/overlord/srpc.cpp | 3 ++- goal_src/engine/gfx/ocean/ocean.gc | 2 +- goal_src/engine/load/loader.gc | 21 +-------------------- goal_src/engine/target/target.gc | 2 +- 4 files changed, 5 insertions(+), 23 deletions(-) diff --git a/game/overlord/srpc.cpp b/game/overlord/srpc.cpp index 4db46bded8..d532b59fa1 100644 --- a/game/overlord/srpc.cpp +++ b/game/overlord/srpc.cpp @@ -14,6 +14,7 @@ #include "game/common/game_common_types.h" #include "game/common/loader_rpc_types.h" #include "game/common/player_rpc_types.h" +#include "game/graphics/gfx.h" #include "game/sce/iop.h" #include "game/sound/sndshim.h" @@ -459,7 +460,7 @@ s32 VBlank_Handler() { gFrameNum++; if (gFakeVAGClockRunning && !gFakeVAGClockPaused) { - gFakeVAGClock += 17; + gFakeVAGClock += (s32)(1024 / Gfx::g_global_settings.target_fps); } // We don't need this, our DMA's are instant diff --git a/goal_src/engine/gfx/ocean/ocean.gc b/goal_src/engine/gfx/ocean/ocean.gc index df2a991ca9..c4d21ded5a 100644 --- a/goal_src/engine/gfx/ocean/ocean.gc +++ b/goal_src/engine/gfx/ocean/ocean.gc @@ -616,7 +616,7 @@ (set! *ocean-verts* (the-as (inline-array vector) #f)) (let ((gp-0 (-> *display* frames (-> *display* on-screen) frame global-buf))) (set! *ocean-heights* (the-as ocean-wave-info (-> gp-0 base))) - (ocean-interp-wave *ocean-heights* (the uint (* (-> *display* time-adjust-ratio) (-> *display* integral-frame-counter)))) ;; changed for high fps + (ocean-interp-wave *ocean-heights* (the uint (* (/ (-> *display* time-factor) 5.0) (-> *display* integral-frame-counter)))) ;; changed for high fps (&+! (-> gp-0 base) 4096) (set! *ocean-verts* (the-as (inline-array vector) (-> gp-0 base))) (ocean-generate-verts *ocean-verts* *ocean-heights*) diff --git a/goal_src/engine/load/loader.gc b/goal_src/engine/load/loader.gc index c570c6faf5..62ffa223b8 100644 --- a/goal_src/engine/load/loader.gc +++ b/goal_src/engine/load/loader.gc @@ -966,26 +966,7 @@ (str-play-async (-> arg0 name) spool-sound) (set! (-> *art-control* active-stream) (-> arg0 name)) ) - ;; When running at higher than 60fps, Jak's idle animations are spedup but no other animations appear to be - ;; We couldn't figure out a simple way to detect these animations, so this is checking against the idle animation names - (let* ((f30-0 (* (if (and (or (= (-> *setting-control* current video-mode) '150fps) (= (-> *setting-control* current video-mode) '100fps)) - (or (string= (-> arg0 name) "eichar-ambient-1") - (string= (-> arg0 name) "eichar-ambient-2") - (string= (-> arg0 name) "eichar-ambient-3") - (string= (-> arg0 name) "eichar-ambient-4") - (string= (-> arg0 name) "fishermans-boat-ride-to-village1-alt") - (string= (-> arg0 name) "fishermans-boat-ride-to-village1") - (string= (-> arg0 name) "fishermans-boat-ride-to-misty") - (string= (-> arg0 name) "gondola-ride-up") - (string= (-> arg0 name) "gondola-ride-down") - (string= (-> arg0 name) "logo-loop") - (string= (-> arg0 name) "logo-intro-2") - ) - ) - (-> *display* time-adjust-ratio) - 1.0 - ) - 0.05859375 (-> s2-4 speed))) + (let* ((f30-0 (* 0.05859375 (-> s2-4 speed))) (f28-0 (+ sv-24 (/ (the float (+ (-> s2-4 data 0 length) -1)) f30-0))) ) (set! sv-72 (current-str-pos spool-sound)) diff --git a/goal_src/engine/target/target.gc b/goal_src/engine/target/target.gc index 4cf267028e..3d5ff6934f 100644 --- a/goal_src/engine/target/target.gc +++ b/goal_src/engine/target/target.gc @@ -569,7 +569,7 @@ (loop (ground-tween-update gp-0 (-> self control unknown-float61) (-> self control unknown-float62)) (suspend) - (ja :num! (loop! (-> *display* time-adjust-ratio))) ;; changed for high fps, fixes ambient wind on jak + (ja :num! (loop!)) (ja :chan 1 :num! (chan 0)) (ja :chan 2 :num! (chan 0)) (if (can-play-stance-amibent?)