Files
jak-project/test/decompiler/reference/jak2/engine/util/smush-control-h_REF.gc
T

137 lines
4.1 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type smush-control
(deftype smush-control (structure)
"This holds information about the current state of an object's smush."
((start-time time-frame)
(period float)
(duration float)
(amp float)
(damp-amp float)
(damp-period float)
(ticks float)
)
:pack-me
(:methods
(set-zero! (_type_) _type_)
(update! (_type_) float)
(get-no-update (_type_) float)
(activate! (_type_ float int int float float clock) _type_)
(nonzero-amplitude? (_type_) symbol)
(die-on-next-update! (_type_) _type_)
)
)
;; definition for method 3 of type smush-control
(defmethod inspect ((this smush-control))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'smush-control)
(format #t "~1Tstart-time: ~D~%" (-> this start-time))
(format #t "~1Tperiod: ~f~%" (-> this period))
(format #t "~1Tduration: ~f~%" (-> this duration))
(format #t "~1Tamp: ~f~%" (-> this amp))
(format #t "~1Tdamp-amp: ~f~%" (-> this damp-amp))
(format #t "~1Tdamp-period: ~f~%" (-> this damp-period))
(format #t "~1Tticks: ~f~%" (-> this ticks))
(label cfg-4)
this
)
;; definition for method 13 of type smush-control
(defmethod nonzero-amplitude? ((this smush-control))
(!= (-> this amp) 0.0)
)
;; definition for method 9 of type smush-control
(defmethod set-zero! ((this smush-control))
(set! (-> this period) 0.0)
(set! (-> this duration) 0.0)
(set! (-> this amp) 0.0)
(set! (-> this damp-amp) 0.0)
(set! (-> this damp-period) 0.0)
(set! (-> this ticks) 0.0)
this
)
;; definition for method 10 of type smush-control
(defmethod update! ((this smush-control))
(cond
((!= (-> this amp) 0.0)
(let* ((elapsed-time (the float (- (current-time) (-> this start-time))))
(period (-> this period))
(f28-0 (- elapsed-time (* (the float (the int (/ elapsed-time period))) period)))
)
(when (>= (- elapsed-time (-> this ticks)) (-> this period))
(set! (-> this amp) (* (-> this amp) (-> this damp-amp)))
(set! (-> this period) (* (-> this period) (-> this damp-period)))
(set! (-> this ticks) elapsed-time)
(if (< (-> this damp-period) 0.0)
(set-zero! this)
)
)
(if (>= elapsed-time (-> this duration))
(set-zero! this)
)
(* (sin (/ (* 65536.0 f28-0) (-> this period)))
(* (-> this amp) (/ (- (-> this duration) elapsed-time) (-> this duration)))
)
)
)
(else
0.0
)
)
)
;; definition for method 11 of type smush-control
(defmethod get-no-update ((this smush-control))
(cond
((!= (-> this amp) 0.0)
(let* ((elapsed-time (the float (- (current-time) (-> this start-time))))
(period (-> this period))
(f0-4 (- elapsed-time (* (the float (the int (/ elapsed-time period))) period)))
)
(* (sin (/ (* 65536.0 f0-4) (-> this period)))
(* (-> this amp) (/ (- (-> this duration) elapsed-time) (-> this duration)))
)
)
)
(else
0.0
)
)
)
;; definition for method 14 of type smush-control
(defmethod die-on-next-update! ((this smush-control))
(if (!= (-> this amp) 0.0)
(set! (-> this damp-period) -1.0)
)
this
)
;; definition for method 12 of type smush-control
(defmethod activate! ((this smush-control)
(amplitude float)
(period int)
(duration int)
(damp-amplitude float)
(damp-period float)
(clock clock)
)
(when (>= (fabs (* 0.2 (-> this amp))) (fabs (get-no-update this)))
(set! (-> this amp) amplitude)
(set! (-> this period) (the float period))
(set! (-> this duration) (the float duration))
(set! (-> this damp-amp) damp-amplitude)
(set! (-> this damp-period) damp-period)
(set! (-> this ticks) 0.0)
(set! (-> this start-time) (-> clock frame-counter))
)
this
)