mirror of
https://github.com/open-goal/jak-project
synced 2026-05-25 15:25:31 -04:00
7348e6a4ff
Update the decompiler to use the new vf macros. Also, fix a bunch of silly casting issues where accessing inline fields with an offset of 0 would be better than a cast:  --------- Co-authored-by: water111 <awaterford1111445@gmail.com>
195 lines
7.2 KiB
Common Lisp
Vendored
Generated
195 lines
7.2 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for method 9 of type align-control
|
|
;; INFO: Used lq/sq
|
|
;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)]
|
|
;; ERROR: Unsupported inline assembly instruction kind - [jr ra]
|
|
(defmethod compute-alignment! ((this align-control))
|
|
(local-vars (a0-10 symbol) (s7-0 none) (ra-0 int))
|
|
(update-anim-data (-> this process skel))
|
|
(let ((s5-0 (-> this process skel active-channels)))
|
|
(dotimes (s4-0 (the-as int s5-0))
|
|
(let* ((a0-4 (-> this process skel channel s4-0))
|
|
(v1-7 (-> a0-4 frame-group))
|
|
)
|
|
(case (-> a0-4 command)
|
|
(((joint-control-command stack) (joint-control-command stack1))
|
|
)
|
|
(else
|
|
(when (!= (-> v1-7 type) art-joint-anim)
|
|
(go process-drawable-art-error "align joint-anim")
|
|
(.lw ra-0 return-from-thread s7-0)
|
|
(.jr ra-0)
|
|
(nop!)
|
|
0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let* ((a0-9 (-> this process skel root-channel 0))
|
|
(v1-18 (-> a0-9 frame-group))
|
|
(f0-0 (-> a0-9 frame-num))
|
|
)
|
|
(= (-> a0-9 num-func) num-func-loop!)
|
|
(cond
|
|
((or (not v1-18) (!= (-> this frame-group) v1-18))
|
|
(set! a0-10 #t)
|
|
)
|
|
((= (-> a0-9 num-func) num-func-loop!)
|
|
(set! a0-10 (< (* (-> a0-9 param 0) (- f0-0 (-> this frame-num))) 0.0))
|
|
)
|
|
(else
|
|
(set! a0-10 (= f0-0 0.0))
|
|
)
|
|
)
|
|
(if a0-10
|
|
(logior! (-> this flags) (align-flags disabled))
|
|
(logclear! (-> this flags) (align-flags disabled))
|
|
)
|
|
(set! (-> this frame-group) v1-18)
|
|
(set! (-> this frame-num) f0-0)
|
|
)
|
|
(mem-copy! (the-as pointer (-> this transform 1)) (the-as pointer (-> this transform)) 48)
|
|
(quaternion-copy! (the-as quaternion (-> this transform 1 rot)) (-> this align quat))
|
|
(set! (-> this transform 1 scale quad) (-> this align scale quad))
|
|
(let* ((a2-5 (-> this matrix 1))
|
|
(a3-0 (-> this matrix))
|
|
(v1-21 (-> a3-0 0 quad 0))
|
|
(a0-19 (-> a3-0 0 quad 1))
|
|
(a1-13 (-> a3-0 0 quad 2))
|
|
(a3-1 (-> a3-0 0 trans quad))
|
|
)
|
|
(set! (-> a2-5 quad 0) v1-21)
|
|
(set! (-> a2-5 quad 1) a0-19)
|
|
(set! (-> a2-5 quad 2) a1-13)
|
|
(set! (-> a2-5 trans quad) a3-1)
|
|
)
|
|
(let ((s5-1 (-> this process node-list data 1)))
|
|
(cspace<-matrix-no-push-joint! s5-1 (-> this process skel))
|
|
(let* ((v1-25 (-> this matrix))
|
|
(a3-2 (-> s5-1 bone transform))
|
|
(a0-22 (-> a3-2 quad 0))
|
|
(a1-15 (-> a3-2 quad 1))
|
|
(a2-6 (-> a3-2 quad 2))
|
|
(a3-3 (-> a3-2 trans quad))
|
|
)
|
|
(set! (-> v1-25 0 quad 0) a0-22)
|
|
(set! (-> v1-25 0 quad 1) a1-15)
|
|
(set! (-> v1-25 0 quad 2) a2-6)
|
|
(set! (-> v1-25 0 trans quad) a3-3)
|
|
)
|
|
(vector*! (-> this transform 0 trans) (-> s5-1 bone transform trans) (-> this process root scale))
|
|
)
|
|
(vector-! (-> this delta trans) (-> this transform 0 trans) (-> this transform 1 trans))
|
|
(set-vector!
|
|
(-> this align scale)
|
|
(vector-length (the-as vector (-> this matrix)))
|
|
(vector-length (-> this matrix 0 vector 1))
|
|
(vector-length (-> this matrix 0 vector 2))
|
|
1.0
|
|
)
|
|
(vector-! (-> this delta scale) (-> this align scale) (-> this transform 1 scale))
|
|
(let ((a2-7 (matrix-inv-scale! (new 'stack-no-clear 'matrix) (-> this align scale))))
|
|
(quaternion-normalize! (matrix->quaternion (-> this align quat) (matrix*! a2-7 (-> this matrix 0) a2-7)))
|
|
)
|
|
(let ((a1-27 (quaternion-inverse! (new 'stack-no-clear 'quaternion) (the-as quaternion (-> this transform 1 rot))))
|
|
)
|
|
(quaternion-normalize! (quaternion*! (-> this delta quat) a1-27 (-> this align quat)))
|
|
)
|
|
(-> this delta)
|
|
)
|
|
|
|
;; definition for method 12 of type align-control
|
|
;; WARN: Return type mismatch (inline-array transform) vs transform.
|
|
(defmethod first-transform ((this align-control))
|
|
"@returns The first of the two [[transforms]] held by the object"
|
|
(the-as transform (-> this transform))
|
|
)
|
|
|
|
;; definition for method 13 of type align-control
|
|
(defmethod second-transform ((this align-control))
|
|
"@returns The second of the two [[transforms]] held by the object"
|
|
(-> this transform 1)
|
|
)
|
|
|
|
;; definition for method 10 of type align-control
|
|
(defmethod align! ((this align-control) (options align-opts) (x float) (y float) (z float))
|
|
"As long as [[align-flags::0]] is not set call [[process-drawable::16]] on the process being controlled
|
|
using the arguments passed to construct a [[vector]] - <`x`, `y`, `z`, 1.0>
|
|
|
|
@returns the `root` of the [[process-drawable]] after the method returns
|
|
@see [[process-drawable::16]]"
|
|
(when (not (logtest? (-> this flags) (align-flags disabled)))
|
|
(let* ((process (-> this process))
|
|
(method-call (method-of-object process apply-alignment))
|
|
(transform (-> this delta))
|
|
(data (new 'stack-no-clear 'vector))
|
|
)
|
|
(set! (-> data x) x)
|
|
(set! (-> data y) y)
|
|
(set! (-> data z) z)
|
|
(set! (-> data w) 1.0)
|
|
(method-call process options transform data)
|
|
)
|
|
)
|
|
(-> this process root)
|
|
)
|
|
|
|
;; definition for method 26 of type trsqv
|
|
(defmethod set-and-limit-velocity ((this trsqv) (unkBitfield int) (limit vector) (arg2 float))
|
|
"TODO - arg1 is an bitfield of some sort"
|
|
(let ((transv (-> this transv)))
|
|
(when (logtest? unkBitfield 4)
|
|
(set! (-> transv x) (-> limit x))
|
|
(set! (-> transv z) (-> limit z))
|
|
(let* ((v1-2 limit)
|
|
(f0-8
|
|
(fmin
|
|
(* (sqrtf (+ (* (-> v1-2 x) (-> v1-2 x)) (* (-> v1-2 z) (-> v1-2 z)))) (-> self clock frames-per-second))
|
|
arg2
|
|
)
|
|
)
|
|
)
|
|
(vector-xz-normalize! transv f0-8)
|
|
)
|
|
)
|
|
)
|
|
this
|
|
)
|
|
|
|
;; definition for method 11 of type align-control
|
|
(defmethod align-vel-and-quat-only! ((this align-control) (arg0 align-opts) (arg1 vector) (arg2 int) (arg3 float) (arg4 float))
|
|
(when (not (logtest? (-> this flags) (align-flags disabled)))
|
|
(let ((s5-0 (-> this delta)))
|
|
(let ((a0-1 (-> this process root transv)))
|
|
(if (logtest? arg0 (align-opts adjust-y-vel))
|
|
(set! (-> a0-1 y) (* (-> s5-0 trans y) arg3 (-> self clock frames-per-second)))
|
|
)
|
|
(when (logtest? arg0 (align-opts adjust-xz-vel))
|
|
(set! (-> a0-1 x) (-> arg1 x))
|
|
(set! (-> a0-1 z) (-> arg1 z))
|
|
(let* ((v1-11 arg1)
|
|
(f0-9 (sqrtf (+ (* (-> v1-11 x) (-> v1-11 x)) (* (-> v1-11 z) (-> v1-11 z)))))
|
|
(v1-13 (-> s5-0 trans))
|
|
(f0-11 (* (fmin f0-9 (* (sqrtf (+ (* (-> v1-13 x) (-> v1-13 x)) (* (-> v1-13 z) (-> v1-13 z)))) arg4))
|
|
(-> self clock frames-per-second)
|
|
)
|
|
)
|
|
(t9-0 vector-xz-normalize!)
|
|
)
|
|
(set! (-> this last-speed) f0-11)
|
|
(t9-0 a0-1 f0-11)
|
|
)
|
|
)
|
|
)
|
|
(if (logtest? arg0 (align-opts adjust-quat))
|
|
(quaternion-normalize! (quaternion*! (-> this process root quat) (-> this process root quat) (-> s5-0 quat)))
|
|
)
|
|
)
|
|
)
|
|
(-> this process root)
|
|
)
|