Files
jak-project/test/decompiler/reference/jak2/engine/util/smush-control-h_REF.gc
T
Hat Kid fc43870d85 decompiler: obj -> this, set-time! and time-elapsed? macros (#3026)
This renames the method object in `defmethod`s to `this` and adds
detection for the `set-time!` and `time-elapsed?` macros.

Definitely my biggest PR yet...
2023-09-26 15:17:00 +01:00

132 lines
4.1 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type smush-control
(deftype smush-control (structure)
((start-time time-frame :offset-assert 0)
(period float :offset-assert 8)
(duration float :offset-assert 12)
(amp float :offset-assert 16)
(damp-amp float :offset-assert 20)
(damp-period float :offset-assert 24)
(ticks float :offset-assert 28)
)
:pack-me
:method-count-assert 15
:size-assert #x20
:flag-assert #xf00000020
(:methods
(set-zero! (_type_) _type_ 9)
(update! (_type_) float 10)
(get-no-update (_type_) float 11)
(activate! (_type_ float int int float float clock) _type_ 12)
(nonzero-amplitude? (_type_) symbol 13)
(die-on-next-update! (_type_) _type_ 14)
)
)
;; definition for method 3 of type smush-control
(defmethod inspect smush-control ((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? smush-control ((this smush-control))
(!= (-> this amp) 0.0)
)
;; definition for method 9 of type smush-control
(defmethod set-zero! smush-control ((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! smush-control ((this smush-control))
(cond
((!= (-> this amp) 0.0)
(let* ((f30-0 (the float (- (current-time) (-> this start-time))))
(f0-2 (-> this period))
(f28-0 (- f30-0 (* (the float (the int (/ f30-0 f0-2))) f0-2)))
)
(when (>= (- f30-0 (-> this ticks)) (-> this period))
(set! (-> this amp) (* (-> this amp) (-> this damp-amp)))
(set! (-> this period) (* (-> this period) (-> this damp-period)))
(set! (-> this ticks) f30-0)
(if (< (-> this damp-period) 0.0)
(set-zero! this)
)
)
(if (>= f30-0 (-> this duration))
(set-zero! this)
)
(* (sin (/ (* 65536.0 f28-0) (-> this period)))
(* (-> this amp) (/ (- (-> this duration) f30-0) (-> this duration)))
)
)
)
(else
0.0
)
)
)
;; definition for method 11 of type smush-control
(defmethod get-no-update smush-control ((this smush-control))
(cond
((!= (-> this amp) 0.0)
(let* ((f30-0 (the float (- (current-time) (-> this start-time))))
(f0-2 (-> this period))
(f0-4 (- f30-0 (* (the float (the int (/ f30-0 f0-2))) f0-2)))
)
(* (sin (/ (* 65536.0 f0-4) (-> this period)))
(* (-> this amp) (/ (- (-> this duration) f30-0) (-> this duration)))
)
)
)
(else
0.0
)
)
)
;; definition for method 14 of type smush-control
(defmethod die-on-next-update! smush-control ((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! smush-control ((this smush-control) (arg0 float) (arg1 int) (arg2 int) (arg3 float) (arg4 float) (arg5 clock))
(when (>= (fabs (* 0.2 (-> this amp))) (fabs (get-no-update this)))
(set! (-> this amp) arg0)
(set! (-> this period) (the float arg1))
(set! (-> this duration) (the float arg2))
(set! (-> this damp-amp) arg3)
(set! (-> this damp-period) arg4)
(set! (-> this ticks) 0.0)
(set! (-> this start-time) (-> arg5 frame-counter))
)
this
)