[game] fix flava triggering on nans (#1391)

* [game] fix flava triggering on nans

* fix build
This commit is contained in:
water111
2022-05-30 18:58:30 -04:00
committed by GitHub
parent 3b6200be95
commit a98ada98ec
+13 -12
View File
@@ -5,6 +5,17 @@
;; name in dgo: process-taskable
;; dgos: GAME, ENGINE
(defmacro is-nan-hack (flt)
`(and (< 0.0 ,flt) (< ,flt 0.0))
)
(defmacro less-than-hack (a b)
`(if (is-nan-hack ,a)
#f
(< ,a ,b)
)
)
;; DECOMP BEGINS
(defmethod dummy-52 process-taskable ((obj process-taskable))
@@ -160,7 +171,8 @@
)
(set! (-> s5-1 y) (* 4.0 (-> s5-1 y)))
(cond
((< (vector-length s5-1) 102400.0)
;; s5-1 can be nan on the first frame after something spawns
((less-than-hack (vector-length s5-1) 102400.0)
(when (not (-> obj have-flava))
(set! (-> obj have-flava) #t)
(set-setting! *setting-control* pp 'sound-flava #f 20.0 (the-as int (-> obj sound-flava)))
@@ -901,17 +913,6 @@
#t
)
(defmacro is-nan-hack (flt)
`(and (< 0.0 ,flt) (< ,flt 0.0))
)
(defmacro less-than-hack (a b)
`(if (is-nan-hack ,a)
#f
(< ,a ,b)
)
)
(defstate idle (process-taskable)
:virtual #t
:event