From 5522c3d500bf4a446ad84d63b587d65862b01fa0 Mon Sep 17 00:00:00 2001 From: SuperSamus <40663462+SuperSamus@users.noreply.github.com> Date: Mon, 2 Jun 2025 00:50:33 +0200 Subject: [PATCH] [high fps] fix blinking in all games (#3759) Fixes both interval and animation speed. (jak1 previously only had a fix for the former.) This should close #3518, and one of the issues of #1499. The solution is not the cleanest. The results are going to be wrong in case the FPS doesn't reach the maximum set. A better solution would be to make `random-time` a float, so that it can be subtracted by `time-adjust-ratio`, but I don't know if changing a type for this purpose is allowed here. Tell me if I should do that instead. Tested only on jak2. Co-authored-by: Tyler Wilding --- goal_src/jak1/engine/gfx/foreground/eye.gc | 11 ++++++----- goal_src/jak2/engine/gfx/foreground/eye.gc | 12 +++++++++--- goal_src/jak3/engine/gfx/foreground/eye.gc | 12 +++++++++--- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/goal_src/jak1/engine/gfx/foreground/eye.gc b/goal_src/jak1/engine/gfx/foreground/eye.gc index 6fa27af8ff..6a9bf87ae8 100644 --- a/goal_src/jak1/engine/gfx/foreground/eye.gc +++ b/goal_src/jak1/engine/gfx/foreground/eye.gc @@ -688,17 +688,18 @@ (cond ((and (>= (-> s5-3 left lid) 0.0) (>= (-> s5-3 right lid) 0.0)) (set! (-> s5-3 random-time) - (the int - (* (/ 1.0 (-> *display* time-adjust-ratio)) ;; og:preserve-this changed for high fps - (the-as uint 60)))) + (the int (* (1/ DISPLAY_FPS_RATIO) ;; og:preserve-this changed for high fps + (the-as uint 60)))) (set! (-> s5-3 blink) 0.0)) (else (+! (-> s5-3 random-time) -1) - (let ((v1-54 (-> s5-3 random-time))) + (let ((v1-54 (the int (* DISPLAY_FPS_RATIO (-> s5-3 random-time))))) ;; og:preserve-this changed for high fps (when (< v1-54 (the-as uint 10)) (set! (-> s5-3 blink) (-> *eye-work* blink-table v1-54)) (if (zero? v1-54) - (set! (-> s5-3 random-time) (the-as uint (the int (* (1/ DISPLAY_FPS_RATIO) (rand-vu-float-range 60.0 240.0))))))))))) + (set! (-> s5-3 random-time) (the-as uint (the int + (* (1/ DISPLAY_FPS_RATIO) ;; og:preserve-this changed for high fps + (rand-vu-float-range 60.0 240.0))))))))))) ;; pick between level and common eyes (cond ((>= (the-as uint 1) (-> s5-3 level)) diff --git a/goal_src/jak2/engine/gfx/foreground/eye.gc b/goal_src/jak2/engine/gfx/foreground/eye.gc index b937c4cf6f..4444597f9f 100644 --- a/goal_src/jak2/engine/gfx/foreground/eye.gc +++ b/goal_src/jak2/engine/gfx/foreground/eye.gc @@ -5,6 +5,8 @@ ;; name in dgo: eye ;; dgos: ENGINE, GAME +;; note: changed for high fps + ;; DECOMP BEGINS (define *eye-work* (new 'static 'eye-work @@ -1029,16 +1031,20 @@ (when (not (paused?)) (cond ((and (>= (-> s4-0 left lid) 0.0) (>= (-> s4-0 right lid) 0.0)) - (set! (-> s4-0 random-time) (the-as uint 60)) + (set! (-> s4-0 random-time) + (the int (* (1/ DISPLAY_FPS_RATIO) ;; og:preserve-this changed for high fps + (the-as uint 60)))) (set! (-> s4-0 blink) 0.0) ) (else (+! (-> s4-0 random-time) -1) - (let ((v1-22 (-> s4-0 random-time))) + (let ((v1-22 (the int (* DISPLAY_FPS_RATIO (-> s4-0 random-time))))) ;; og:preserve-this changed for high fps (when (< v1-22 (the-as uint 10)) (set! (-> s4-0 blink) (-> *eye-work* blink-table v1-22)) (if (zero? v1-22) - (set! (-> s4-0 random-time) (the-as uint (the int (rand-vu-float-range 60.0 240.0)))) + (set! (-> s4-0 random-time) (the-as uint (the int + (* (1/ DISPLAY_FPS_RATIO) ;; og:preserve-this changed for high fps + (rand-vu-float-range 60.0 240.0))))) ) ) ) diff --git a/goal_src/jak3/engine/gfx/foreground/eye.gc b/goal_src/jak3/engine/gfx/foreground/eye.gc index fd92bd5bc3..0114e8a9f0 100644 --- a/goal_src/jak3/engine/gfx/foreground/eye.gc +++ b/goal_src/jak3/engine/gfx/foreground/eye.gc @@ -5,6 +5,8 @@ ;; name in dgo: eye ;; dgos: GAME +;; note: changed for high fps + ;; DECOMP BEGINS ;; og:preserve-this @@ -717,16 +719,20 @@ (when (not (paused?)) (cond ((and (>= (-> s5-0 left lid) 0.0) (>= (-> s5-0 right lid) 0.0)) - (set! (-> s5-0 random-time) (the-as uint 60)) + (set! (-> s5-0 random-time) + (the int (* (1/ DISPLAY_FPS_RATIO) ;; og:preserve-this changed for high fps + (the-as uint 60)))) (set! (-> s5-0 blink) 0.0) ) (else (+! (-> s5-0 random-time) -1) - (let ((v1-19 (-> s5-0 random-time))) + (let ((v1-19 (the int (* DISPLAY_FPS_RATIO (-> s5-0 random-time))))) ;; og:preserve-this changed for high fps (when (< v1-19 (the-as uint 10)) (set! (-> s5-0 blink) (-> *eye-work* blink-table v1-19)) (if (zero? v1-19) - (set! (-> s5-0 random-time) (the-as uint (the int (rand-vu-float-range 60.0 240.0)))) + (set! (-> s5-0 random-time) (the-as uint (the int + (* (1/ DISPLAY_FPS_RATIO) ;; og:preserve-this changed for high fps + (rand-vu-float-range 60.0 240.0))))) ) ) )