Files
jak-project/test/decompiler/reference/engine/util/smush-control-h_REF.gc
T
ManDude 24578b64b9 proper support for hardcoded "time" types (#1141)
* hardcode `time-frame`things

* Update cam-states_REF.gc

* Update level-info_REF.gc

* update refs 1

* update refs 2

* update refs 3

* update refs 4

* update refs 5

* update detection and casting

* Update FormExpressionAnalysis.cpp

* update refs 6

* update mood decomp

* update refs 7

* update refs 8

* remove temp entity birth code

* update time-frame casts

* fix compiler

* hardcode stuff and fix some types

* fix some bitfield detection being wrong

* bug fixes

* detect seconds on adds with immediate

* update refs 9

* fix casts and rand-vu-int-range bugs (update refs 10)

* update refs 11

* update 12

* update 13

* update 14

* Update game-info_REF.gc

* improve cpad macros detection

* remove unused code

* update refs

* clang

* update source code

* Update cam-states.gc

* `lavatube-energy` finish

* update refs

* fix actor bank stuff

* Update navigate.gc

* reduce entity default stack size

* Update transformq-h.gc

* oops forgot these

* fix code and tests

* fix mood sound stuff

* Update load-dgo.gc

* Update README.md
2022-02-12 12:26:19 -05:00

127 lines
3.9 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) _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 ((obj smush-control))
(format #t "[~8x] ~A~%" obj 'smush-control)
(format #t "~Tstart-time: ~D~%" (-> obj start-time))
(format #t "~Tperiod: ~f~%" (-> obj period))
(format #t "~Tduration: ~f~%" (-> obj duration))
(format #t "~Tamp: ~f~%" (-> obj amp))
(format #t "~Tdamp-amp: ~f~%" (-> obj damp-amp))
(format #t "~Tdamp-period: ~f~%" (-> obj damp-period))
(format #t "~Tticks: ~f~%" (-> obj ticks))
obj
)
;; definition for method 13 of type smush-control
(defmethod nonzero-amplitude? smush-control ((obj smush-control))
(!= (-> obj amp) 0.0)
)
;; definition for method 9 of type smush-control
(defmethod set-zero! smush-control ((obj smush-control))
(set! (-> obj period) 0.0)
(set! (-> obj duration) 0.0)
(set! (-> obj amp) 0.0)
(set! (-> obj damp-amp) 0.0)
(set! (-> obj damp-period) 0.0)
(set! (-> obj ticks) 0.0)
obj
)
;; definition for method 10 of type smush-control
(defmethod update! smush-control ((obj smush-control))
(cond
((!= (-> obj amp) 0.0)
(let* ((f30-0 (the float (- (-> *display* base-frame-counter) (-> obj start-time))))
(f0-2 (-> obj period))
(f28-0 (- f30-0 (* (the float (the int (/ f30-0 f0-2))) f0-2)))
)
(when (>= (- f30-0 (-> obj ticks)) (-> obj period))
(set! (-> obj amp) (* (-> obj amp) (-> obj damp-amp)))
(set! (-> obj period) (* (-> obj period) (-> obj damp-period)))
(set! (-> obj ticks) f30-0)
(if (< (-> obj damp-period) 0.0)
(set-zero! obj)
)
)
(if (>= f30-0 (-> obj duration))
(set-zero! obj)
)
(* (sin (/ (* 65536.0 f28-0) (-> obj period)))
(* (-> obj amp) (/ (- (-> obj duration) f30-0) (-> obj duration)))
)
)
)
(else
0.0
)
)
)
;; definition for method 11 of type smush-control
(defmethod get-no-update smush-control ((obj smush-control))
(cond
((!= (-> obj amp) 0.0)
(let* ((f30-0 (the float (- (-> *display* base-frame-counter) (-> obj start-time))))
(f0-2 (-> obj period))
(f0-4 (- f30-0 (* (the float (the int (/ f30-0 f0-2))) f0-2)))
)
(* (sin (/ (* 65536.0 f0-4) (-> obj period)))
(* (-> obj amp) (/ (- (-> obj duration) f30-0) (-> obj duration)))
)
)
)
(else
0.0
)
)
)
;; definition for method 14 of type smush-control
(defmethod die-on-next-update! smush-control ((obj smush-control))
(if (!= (-> obj amp) 0.0)
(set! (-> obj damp-period) -1.0)
)
obj
)
;; definition for method 12 of type smush-control
(defmethod activate! smush-control ((obj smush-control) (arg0 float) (arg1 int) (arg2 int) (arg3 float) (arg4 float))
(when (>= (fabs (* 0.2 (-> obj amp))) (fabs (get-no-update obj)))
(set! (-> obj amp) arg0)
(set! (-> obj period) (the float arg1))
(set! (-> obj duration) (the float arg2))
(set! (-> obj damp-amp) arg3)
(set! (-> obj damp-period) arg4)
(set! (-> obj ticks) 0.0)
(set! (-> obj start-time) (-> *display* base-frame-counter))
)
obj
)