[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 <xtvaser@gmail.com>
This commit is contained in:
SuperSamus
2025-06-02 00:50:33 +02:00
committed by GitHub
parent 23262ce269
commit 5522c3d500
3 changed files with 24 additions and 11 deletions
+6 -5
View File
@@ -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))
+9 -3
View File
@@ -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)))))
)
)
)
+9 -3
View File
@@ -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)))))
)
)
)