Files
jak-project/test/decompiler/reference/jak3/levels/sewer/jump-pad_REF.gc
T
water111 3ee2b4423c [decompiler] Cleanup for Jak 3 (#3845)
This PR does a few cleanups:
- improve method names/comments/flags for `enemy.gc` and a few other
files
- fix `new-stack-matrix0` not working for jak 3
- add `matrix-copy!` detection for jak 3
- add `vector-copy!` detection

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-01-20 10:31:29 -05:00

174 lines
5.4 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type jump-pad
(deftype jump-pad (bouncer)
((fan-quat quaternion :inline)
(rot-vel float)
(fan-loop-sound-id sound-id)
(fan-loop-sound sound-spec)
(jump-sound sound-spec)
)
(:methods
(get-skel (_type_) art-group)
(get-fan-joint-idx (_type_) int)
(init-sounds (_type_) none)
)
)
;; definition for method 3 of type jump-pad
(defmethod inspect ((this jump-pad))
(when (not this)
(set! this this)
(goto cfg-4)
)
(let ((t9-0 (method-of-type bouncer inspect)))
(t9-0 this)
)
(format #t "~2Tfan-quat: #<quaternion @ #x~X>~%" (-> this fan-quat))
(format #t "~2Trot-vel: ~f~%" (-> this rot-vel))
(format #t "~2Tfan-loop-sound-id: ~D~%" (-> this fan-loop-sound-id))
(format #t "~2Tfan-loop-sound: ~A~%" (-> this fan-loop-sound))
(format #t "~2Tjump-sound: ~A~%" (-> this jump-sound))
(label cfg-4)
this
)
;; failed to figure out what this is:
(defstate idle (jump-pad)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('trigger)
(go-virtual fire)
)
(('attack)
(let ((v1-3 (the-as object (-> block param 1)))
(a0-3 (-> block param 0))
(a2-1 0)
)
0.0
(let ((f30-0 (-> self spring-height)))
(cond
((= (-> (the-as attack-info v1-3) mode) 'flop)
(set! a2-1 1)
)
((= (-> (the-as attack-info v1-3) mode) 'board)
(set! a2-1 9)
)
)
(when (and (nonzero? a2-1) (and ((method-of-type touching-shapes-entry prims-touching?)
(the-as touching-shapes-entry a0-3)
(-> self root)
(the-as uint a2-1)
)
(send-event proc 'jump f30-0 f30-0 (-> self mods))
)
)
(sound-play "trampoline")
(go-virtual fire)
#f
)
)
)
)
(else
((-> (method-of-type bouncer idle) event) proc argc message block)
)
)
)
:trans (behavior ()
(seek! (-> self rot-vel) 10922.667 (* 21845.334 (seconds-per-frame)))
)
:code (behavior ()
(ja :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) :num! min)
(transform-post)
(sleep-code)
)
:post (behavior ()
(when (-> self fan-loop-sound)
(set! (-> self fan-loop-sound pitch-mod)
(the int (* 1524.0 (lerp-scale -0.9 0.6 (-> self rot-vel) 10922.667 87381.336)))
)
(sound-play-by-spec (-> self fan-loop-sound) (-> self fan-loop-sound-id) (-> self root trans))
)
(ja-post)
)
)
;; failed to figure out what this is:
(defstate fire (jump-pad)
:virtual #t
:enter (behavior ()
(set-time! (-> self state-time))
)
:trans (behavior ()
(seek! (-> self rot-vel) 87381.336 (* 87381.336 (seconds-per-frame)))
)
:code (behavior ()
(cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1))
(if (-> self jump-sound)
(sound-play-by-spec (-> self jump-sound) (new-sound-id) (the-as vector #t))
)
(until (time-elapsed? (-> self state-time) (seconds 2))
(suspend)
)
(go-virtual idle)
)
:post (behavior ()
(when (-> self fan-loop-sound)
(set! (-> self fan-loop-sound pitch-mod)
(the int (* 1524.0 (lerp-scale -0.9 0.6 (-> self rot-vel) 10922.667 87381.336)))
)
(sound-play-by-spec (-> self fan-loop-sound) (-> self fan-loop-sound-id) (-> self root trans))
)
(let ((t9-2 (-> (method-of-type bouncer fire) post)))
(if t9-2
((the-as (function none) t9-2))
)
)
)
)
;; definition for function jump-pad-joint-fan
;; WARN: Return type mismatch int vs none.
(defun jump-pad-joint-fan ((arg0 cspace) (arg1 quaternion))
(let ((gp-0 (-> arg0 param1)))
(quaternion-rotate-local-y!
(-> (the-as jump-pad gp-0) fan-quat)
(-> (the-as jump-pad gp-0) fan-quat)
(* (-> (the-as jump-pad gp-0) rot-vel) (seconds-per-frame))
)
(quaternion-copy! (&+ arg1 16) (-> (the-as jump-pad gp-0) fan-quat))
)
(cspace<-parented-transformq-joint! arg0 (the-as transformq arg1))
0
(none)
)
;; definition for method 23 of type jump-pad
;; WARN: Return type mismatch int vs none.
(defmethod init-skel! ((this jump-pad))
(initialize-skeleton this (the-as skeleton-group (get-skel this)) (the-as pair 0))
(quaternion-copy! (-> this fan-quat) (-> this root quat))
(let ((a0-6 (-> this node-list data (get-fan-joint-idx this))))
(set! (-> a0-6 param0) (the-as (function cspace transformq none) jump-pad-joint-fan))
(set! (-> a0-6 param1) this)
(set! (-> a0-6 param2) (the-as basic 0))
)
0
(none)
)
;; definition for method 11 of type jump-pad
(defmethod init-from-entity! ((this jump-pad) (arg0 entity-actor))
"Set up a newly created process from the entity that created it."
(set! (-> this fan-loop-sound) #f)
(set! (-> this jump-sound) #f)
(init-sounds this)
(if (-> this fan-loop-sound)
(set! (-> this fan-loop-sound-id) (new-sound-id))
)
(call-parent-method this arg0)
)