mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
f7bd0752f8
* wip * getting stuff set up so we can actually run test cases * better handle block entry stuff * types2 working on gstring * comments * math ref working * up to first stack stuff * stack fixes * bounding box * math stuff is working * float fixes * temp debug for (method 9 profile-array) * stupid stupid bug * debugging * everything is broken * some amount of type stuff works * bitfield * texture bitfields not working * temp * types * more stuff * type check * temp * float related fixes for light and res problems * revisit broken files, fix bugs * more types * vector debug * bug fixes for decompiler crashes in harder functions * update goal_src
120 lines
3.3 KiB
Common Lisp
120 lines
3.3 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: smush-control-h.gc
|
|
;; name in dgo: smush-control-h
|
|
;; dgos: ENGINE, GAME
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(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)
|
|
)
|
|
: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)
|
|
)
|
|
)
|
|
|
|
(defmethod nonzero-amplitude? smush-control ((obj smush-control))
|
|
(!= (-> obj amp) 0.0)
|
|
)
|
|
|
|
(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
|
|
)
|
|
|
|
(defmethod update! smush-control ((obj smush-control))
|
|
(with-pp
|
|
(cond
|
|
((!= (-> obj amp) 0.0)
|
|
(let* ((f30-0 (the float (- (-> pp clock 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
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod get-no-update smush-control ((obj smush-control))
|
|
(with-pp
|
|
(cond
|
|
((!= (-> obj amp) 0.0)
|
|
(let* ((f30-0 (the float (- (-> pp clock 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
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod die-on-next-update! smush-control ((obj smush-control))
|
|
(if (!= (-> obj amp) 0.0)
|
|
(set! (-> obj damp-period) -1.0)
|
|
)
|
|
obj
|
|
)
|
|
|
|
(defmethod activate! smush-control ((obj smush-control) (arg0 float) (arg1 int) (arg2 int) (arg3 float) (arg4 float) (arg5 clock))
|
|
(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) (-> arg5 frame-counter))
|
|
)
|
|
obj
|
|
)
|
|
|
|
|
|
|
|
|