Files
Hat Kid dacb704ef6 decomp3: more engine stuff, fix ja macro detection for jak 2/3, unmerged let matcher, part-tracker-spawn macro (#3436)
- `aligner`
- `effect-control`
- `pov-camera`
- `powerups`
- `los-control-h`
- `airlock`
- `water-anim`
- `blocking-plane`
- `proc-focusable-spawner`
- `idle-control`
- `enemy-h`
- `nav-enemy-h`
- `enemy`
- `enemy-states`
- `particle-curves`
- `base-plat`
- `plat`
- `bouncer`
- `elevator`
- `rigid-body`
- `rigid-body-queue`
- `process-taskable`
- `scene-actor`
- `warp-gate`
- `guard-projectile`
- `metalhead-projectile`
- `los-control`
- `joint-exploder`
- `ragdoll-test`
- `debris`
- `shield-sphere`
- `text`
- `target-launch`
2024-03-30 10:28:02 -04:00

2303 lines
83 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition for method 2 of type joint
(defmethod print ((this joint))
(format #t "#<~A ~S ~D @ #x~X>" (-> this type) (-> this name) (-> this number) this)
this
)
;; definition for method 8 of type joint
(defmethod mem-usage ((this joint) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 69 (-> usage length)))
(set! (-> usage data 68 name) "joint")
(+! (-> usage data 68 count) 1)
(let ((v1-6 (asize-of this)))
(+! (-> usage data 68 used) v1-6)
(+! (-> usage data 68 total) (logand -16 (+ v1-6 15)))
)
this
)
;; definition for method 2 of type joint-anim
(defmethod print ((this joint-anim))
(format #t "#<~A ~S ~D [~D] @ #x~X>" (-> this type) (-> this name) (-> this number) (-> this length) this)
this
)
;; definition for method 4 of type joint-anim
(defmethod length ((this joint-anim))
(-> this length)
)
;; definition for method 5 of type joint-anim-matrix
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this joint-anim-matrix))
(the-as int (+ (-> joint-anim-matrix size) (* (-> this length) 64)))
)
;; definition for method 5 of type joint-anim-transformq
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this joint-anim-transformq))
(the-as int (+ (-> joint-anim-transformq size) (* 48 (-> this length))))
)
;; definition for method 5 of type joint-anim-drawable
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this joint-anim-drawable))
(the-as int (+ (-> joint-anim-drawable size) (* (-> this length) 4)))
)
;; definition for function joint-anim-login
(defun joint-anim-login ((jad joint-anim-drawable))
"Login a joint-anim-drawable by calling login on all drawables"
(dotimes (s5-0 (-> jad length))
(if (-> jad data s5-0)
(login (-> jad data s5-0))
)
)
jad
)
;; definition for function joint-anim-inspect-elt
(defun joint-anim-inspect-elt ((ja joint-anim) (frame float))
"Inspect an uncompressed anim (unused)"
(case (-> ja type)
((joint-anim-matrix)
((method-of-type matrix inspect) (the-as matrix (+ (+ (* (the int frame) 64) 12) (the-as int ja))))
)
((joint-anim-transformq)
(format #t "~`transform`P~%" (+ (+ (* 48 (the int frame)) 12) (the-as int ja)))
)
)
ja
)
;; definition for method 8 of type joint-anim-drawable
(defmethod mem-usage ((this joint-anim-drawable) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 81 (-> usage length)))
(set! (-> usage data 80 name) "joint-anim-drawable")
(+! (-> usage data 80 count) 1)
(let ((v1-6 (asize-of this)))
(+! (-> usage data 80 used) v1-6)
(+! (-> usage data 80 total) (logand -16 (+ v1-6 15)))
)
(dotimes (s3-0 (-> this length))
(mem-usage (-> this data s3-0) usage flags)
)
this
)
;; definition for function jacc-mem-usage
(defun jacc-mem-usage ((jacc joint-anim-compressed-control) (mem-block memory-usage-block) (flags int))
"Compute memory usage stats for a compressed joint anim."
(set! (-> mem-block length) (max 71 (-> mem-block length)))
(set! (-> mem-block data 70 name) "joint-anim-compressed-control")
(+! (-> mem-block data 70 count) 1)
(let ((v1-7 (+ (* (-> jacc num-frames) 4) 16)))
(+! (-> mem-block data 70 used) v1-7)
(+! (-> mem-block data 70 total) (logand -16 (+ v1-7 15)))
)
(set! (-> mem-block length) (max 72 (-> mem-block length)))
(set! (-> mem-block data 71 name) "joint-anim-fixed")
(+! (-> mem-block data 71 count) 1)
(let ((v1-17 (+ (-> jacc fixed-qwc) 16)))
(+! (-> mem-block data 71 used) v1-17)
(+! (-> mem-block data 71 total) (logand -16 (+ v1-17 15)))
)
(dotimes (v1-21 (the-as int (-> jacc num-frames)))
(set! (-> mem-block length) (max 73 (-> mem-block length)))
(set! (-> mem-block data 72 name) "joint-anim-frame")
(+! (-> mem-block data 72 count) 1)
(let ((a2-15 (* (-> jacc frame-qwc) 16)))
(+! (-> mem-block data 72 used) a2-15)
(+! (-> mem-block data 72 total) (logand -16 (+ a2-15 15)))
)
)
jacc
)
;; definition for method 2 of type joint-control-channel
(defmethod print ((this joint-control-channel))
(let ((t9-0 format)
(a0-1 #t)
(a1-0 "#<joint-control-channel ~A ~A ~F @ #x~X>")
(v1-0 (-> this command))
)
(t9-0
a0-1
a1-0
(cond
((= v1-0 (joint-control-command stack1))
"stack1"
)
((= v1-0 (joint-control-command push))
"push"
)
((= v1-0 (joint-control-command blend))
"blend"
)
((= v1-0 (joint-control-command push1))
"push1"
)
((= v1-0 (joint-control-command float))
"float"
)
((= v1-0 (joint-control-command stack))
"stack"
)
(else
"*unknown*"
)
)
(-> this frame-group)
(-> this frame-num)
this
)
)
this
)
;; definition for method 5 of type joint-control
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this joint-control))
(the-as int (+ (-> this type size) (* (-> this allocated-length) 64)))
)
;; definition for method 0 of type joint-control
(defmethod new joint-control ((allocation symbol) (type-to-make type) (arg0 int))
(let ((v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* arg0 64))))))
(set! (-> v0-0 allocated-length) (the-as uint arg0))
(set! (-> v0-0 active-channels) (the-as uint 0))
(set! (-> v0-0 float-channels) (the-as uint 0))
(set! (-> v0-0 root-channel) (-> v0-0 channel))
(set! (-> v0-0 generate-frame-function) create-interpolated-joint-animation-frame)
(set! (-> v0-0 prebind-function) #f)
(set! (-> v0-0 postbind-function) #f)
(set! (-> v0-0 effect) #f)
(set! (-> v0-0 top-anim) #f)
(set! (-> v0-0 override) #f)
(dotimes (v1-4 arg0)
(set! (-> v0-0 channel v1-4 parent) v0-0)
)
(set! (-> v0-0 blend-index) (the-as uint -1))
v0-0
)
)
;; definition for method 11 of type joint-control
(defmethod debug-print-channels ((this joint-control) (arg0 symbol))
"Print the list of joint animations playing in the flattened blend tree."
(format arg0 "~0K")
(dotimes (s4-0 (the-as int (+ (-> this active-channels) (-> this float-channels))))
(let* ((s3-0 (-> this channel s4-0))
(s2-0 (if (and (-> s3-0 frame-group) (nonzero? (-> s3-0 frame-group)))
(-> s3-0 frame-group)
)
)
)
(let* ((t9-1 format)
(a0-3 arg0)
(a1-2 "~S~2d ~C ~-35S ")
(a2-0 (if (= (-> this root-channel) s3-0)
"~3Lch:~0L"
"ch:"
)
)
(a3-0 s4-0)
(v1-6 (-> s3-0 command))
(t0-2 (cond
((= v1-6 (joint-control-command push))
80
)
((= v1-6 (joint-control-command push1))
112
)
((= v1-6 (joint-control-command blend))
66
)
((= v1-6 (joint-control-command stack))
83
)
((= v1-6 (joint-control-command stack1))
115
)
((= v1-6 (joint-control-command float))
102
)
)
)
)
(t9-1 a0-3 a1-2 a2-0 a3-0 t0-2 (if s2-0
(-> s2-0 name)
"(none)"
)
)
)
(if (and (= (-> s3-0 frame-interp 0) 0.0) (!= (-> s3-0 frame-interp 1) 0.0))
(format
arg0
"f: ~6,,2f ~1L~4,,2f~0L ~4,,2f%~%"
(+ (* (-> s3-0 frame-num) (if s2-0
(-> s2-0 artist-step)
1.0
)
)
(if s2-0
(-> s2-0 artist-base)
0.0
)
)
(-> s3-0 frame-interp 1)
(* 0.003921569 (the float (-> s3-0 inspector-amount)))
)
(format
arg0
"f: ~6,,2f ~4,,2f ~4,,2f%~%"
(+ (* (-> s3-0 frame-num) (if s2-0
(-> s2-0 artist-step)
1.0
)
)
(if s2-0
(-> s2-0 artist-base)
0.0
)
)
(-> s3-0 frame-interp (-> this active-frame-interp))
(* 0.003921569 (the float (-> s3-0 inspector-amount)))
)
)
)
)
(format arg0 "~1K")
0
)
;; definition for method 13 of type art
(defmethod contains-art-for-other-group? ((this art))
"Some art groups have placeholder #f's for some art that will be loaded separately as needed.
Does this art group contain art that needs to be added to another group?"
#f
)
;; definition for method 11 of type art
;; WARN: Return type mismatch symbol vs basic.
(defmethod get-art-by-name-method ((this art) (arg0 string) (arg1 type))
"Look inside this art for an art with the given name and type. Return #f if not found"
(the-as basic #f)
)
;; definition for method 12 of type art
;; WARN: Return type mismatch symbol vs int.
(defmethod get-art-idx-by-name-method ((this art) (arg0 string) (arg1 type))
"Look inside this art for an art with the given name and type and return the index of the art. Return #f if not found."
(the-as int #f)
)
;; definition for method 2 of type art
(defmethod print ((this art))
(format #t "#<~A ~S :length ~D @ #x~X>" (-> this type) (-> this name) (-> this length) this)
this
)
;; definition for method 4 of type art
(defmethod length ((this art))
(-> this length)
)
;; definition for method 9 of type art
(defmethod login ((this art))
(if (and (-> this extra) (zero? (-> this extra tag)))
(set! (-> this extra tag) (the-as (pointer res-tag) (&+ (the-as pointer (-> this extra)) 28)))
)
this
)
;; definition for method 10 of type art
(defmethod art-method-10 ((this art))
this
)
;; definition for method 8 of type art-mesh-anim
(defmethod mem-usage ((this art-mesh-anim) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 76 (-> usage length)))
(set! (-> usage data 75 name) "art-mesh-anim")
(+! (-> usage data 75 count) 1)
(let ((v1-6 (asize-of this)))
(+! (-> usage data 75 used) v1-6)
(+! (-> usage data 75 total) (logand -16 (+ v1-6 15)))
)
(if (-> this extra)
(mem-usage (-> this extra) usage (logior flags 512))
)
(dotimes (s3-0 (-> this length))
(mem-usage (-> this data s3-0) usage flags)
)
this
)
;; definition for method 8 of type art-joint-anim
(defmethod mem-usage ((this art-joint-anim) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 79 (-> usage length)))
(set! (-> usage data 78 name) "art-joint-anim")
(+! (-> usage data 78 count) 1)
(let ((v1-6 (asize-of this)))
(+! (-> usage data 78 used) v1-6)
(+! (-> usage data 78 total) (logand -16 (+ v1-6 15)))
)
(if (-> this extra)
(mem-usage (-> this extra) usage (logior flags 512))
)
(jacc-mem-usage (-> this frames) usage flags)
(when (and (nonzero? (-> this eye-anim)) (-> this eye-anim))
(set! (-> usage length) (max 113 (-> usage length)))
(set! (-> usage data 112 name) "eye-anim")
(+! (-> usage data 112 count) 1)
(let ((v1-26 (* (* (+ (-> this eye-anim max-frame) 1) 2) 8)))
(+! (-> usage data 112 used) v1-26)
(+! (-> usage data 112 total) (logand -16 (+ v1-26 15)))
)
)
this
)
;; definition for method 5 of type art-joint-anim
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this art-joint-anim))
(the-as int (+ (-> art size) (* (-> this length) 4)))
)
;; definition for method 3 of type art-group
(defmethod inspect ((this art-group))
(format #t "[~8x] ~A~%" this (-> this type))
(format #t "~Tinfo: ~A~%" (-> this info))
(format #t "~Tlength: ~D~%" (-> this length))
(format #t "~Tname: ~A~%" (-> this name))
(format #t "~Textra: ~A~%" (-> this extra))
(format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data))
(dotimes (s5-0 (-> this length))
(if (-> this data s5-0)
(format #t "~T [~D] ~A (~D bytes)~%" s5-0 (-> this data s5-0) (mem-size (-> this data s5-0) #f 0))
(format #t "~T [~D] ~A (~D bytes)~%" s5-0 (-> this data s5-0) 0)
)
)
this
)
;; definition for method 13 of type art-group
(defmethod contains-art-for-other-group? ((this art-group))
"Some art groups have placeholder #f's for some art that will be loaded separately as needed.
Does this art group contain art that needs to be added to another group?"
(and (nonzero? (-> this length))
(type? (-> this data 0) art-element)
(not (string= (-> this name) (-> this data 0 master-art-group-name)))
)
)
;; definition for method 11 of type art-group
;; WARN: Return type mismatch art-element vs basic.
(defmethod get-art-by-name-method ((this art-group) (arg0 string) (arg1 type))
"Look inside this art for an art with the given name and type. Return #f if not found"
(cond
(arg1
(let ((s3-0 (+ (length (-> this name)) 1)))
(dotimes (s2-0 (-> this length))
(if (and (-> this data s2-0)
(= (-> this data s2-0 type) arg1)
(or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0)))
)
(return (the-as basic (-> this data s2-0)))
)
)
)
(the-as art-element #f)
)
(else
(dotimes (s4-1 (-> this length))
(if (and (-> this data s4-1) (name= arg0 (-> this data s4-1 name)))
(return (the-as basic (-> this data s4-1)))
)
)
(the-as art-element #f)
)
)
)
;; definition for method 12 of type art-group
(defmethod get-art-idx-by-name-method ((this art-group) (arg0 string) (arg1 type))
"Look inside this art for an art with the given name and type and return the index of the art. Return #f if not found."
(cond
(arg1
(let ((s3-0 (+ (length (-> this name)) 1)))
(dotimes (s2-0 (-> this length))
(if (and (-> this data s2-0)
(= (-> this data s2-0 type) arg1)
(or (name= arg0 (-> this data s2-0 name)) (string-charp= arg0 (&-> (-> this data s2-0 name) data s3-0)))
)
(return s2-0)
)
)
)
(the-as int #f)
)
(else
(dotimes (s4-1 (-> this length))
(if (and (-> this data s4-1) (name= arg0 (-> this data s4-1 name)))
(return s4-1)
)
)
(the-as int #f)
)
)
)
;; definition for method 9 of type art-group
(defmethod login ((this art-group))
(set! (-> *kernel-context* login-art-group) this)
(dotimes (s5-0 (-> this length))
(if (-> this data s5-0)
(set! (-> this data s5-0) (login (-> this data s5-0)))
)
)
(set! (-> *kernel-context* login-art-group) #f)
this
)
;; definition for method 10 of type art-group
(defmethod art-method-10 ((this art-group))
(dotimes (s5-0 (-> this length))
(if (-> this data s5-0)
(set! (-> this data s5-0) (art-method-10 (-> this data s5-0)))
)
)
this
)
;; definition for method 8 of type art-group
(defmethod mem-usage ((this art-group) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 75 (-> usage length)))
(set! (-> usage data 74 name) "art-group")
(+! (-> usage data 74 count) 1)
(let ((v1-6 (asize-of this)))
(+! (-> usage data 74 used) v1-6)
(+! (-> usage data 74 total) (logand -16 (+ v1-6 15)))
)
(if (-> this extra)
(mem-usage (-> this extra) usage (logior flags 512))
)
(dotimes (s3-0 (-> this length))
(if (-> this data s3-0)
(mem-usage (-> this data s3-0) usage flags)
)
)
this
)
;; definition for method 7 of type art-group
;; WARN: Return type mismatch art-group vs none.
(defmethod relocate ((this art-group) (heap kheap) (name (pointer uint8)))
(let ((s4-0 (clear *temp-string*)))
(string<-charp s4-0 name)
(set! this
(cond
((not this)
(format 0 "ERROR: art-group ~A is not a valid file.~%" s4-0)
(the-as art-group #f)
)
((not (type? this art-group))
(format 0 "ERROR: art-group ~A is not a art-group.~%" s4-0)
(the-as art-group #f)
)
((not (file-info-correct-version? (-> this info) (file-kind art-group) 0))
(the-as art-group #f)
)
(else
(let ((s5-1 (-> *level* loading-level)))
(if (and (nonzero? (-> s5-1 code-memory-end)) (< (the-as uint (-> s5-1 load-buffer-mode)) (the-as uint 2)))
(set! (-> s5-1 load-buffer-mode) (level-memory-mode tiny-edge))
)
(cond
((and s5-1 (= (-> s5-1 name) 'default) (not *print-login*))
(format
0
"ERROR: illegal login of art ~A (in level ~A) to level ~A~%"
this
(get-level-by-heap-ptr-and-status *level* (the-as pointer this) 'loading)
s5-1
)
(break!)
0
)
((or (not s5-1) (= (-> s5-1 name) 'default))
)
((!= (get-level-by-heap-ptr-and-status *level* (the-as pointer this) 'loading) s5-1)
(format
0
"ERROR: illegal login of art ~A (in level ~A) to level ~A~%"
this
(get-level-by-heap-ptr-and-status *level* (the-as pointer this) 'loading)
s5-1
)
(break!)
0
)
)
(when (or (not s5-1) (= (-> s5-1 name) 'default))
(login this)
(if (contains-art-for-other-group? this)
(link-art-to-master this)
)
)
(if s5-1
(set-loaded-art (-> s5-1 art-group) this)
)
)
this
)
)
)
)
(none)
)
;; definition for method 5 of type art-mesh-geo
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this art-mesh-geo))
(the-as int (+ (-> art size) (* (-> this length) 4)))
)
;; definition for method 8 of type art-mesh-geo
(defmethod mem-usage ((this art-mesh-geo) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 77 (-> usage length)))
(set! (-> usage data 76 name) "art-mesh-geo")
(+! (-> usage data 76 count) 1)
(let ((v1-6 (asize-of this)))
(+! (-> usage data 76 used) v1-6)
(+! (-> usage data 76 total) (logand -16 (+ v1-6 15)))
)
(if (-> this extra)
(mem-usage (-> this extra) usage (logior flags 512))
)
(dotimes (s3-0 (-> this length))
(mem-usage (-> this data s3-0) usage flags)
)
this
)
;; definition for method 9 of type art-mesh-geo
(defmethod login ((this art-mesh-geo))
(dotimes (s5-0 (-> this length))
(let ((s4-0 (the-as object (-> this data s5-0))))
(dotimes (s3-0 (-> (the-as (pointer int16) s4-0) 3))
(if (-> (the-as (pointer art) (+ (* s3-0 4) (the-as int s4-0))) 2)
(login (the-as drawable (-> (the-as (pointer art) (+ (* s3-0 4) (the-as int s4-0))) 2)))
)
)
)
)
this
)
;; definition for method 9 of type art-joint-anim
(defmethod login ((this art-joint-anim))
(if (and (-> this extra) (zero? (-> this extra tag)))
(set! (-> this extra tag) (the-as (pointer res-tag) (&+ (the-as pointer (-> this extra)) 28)))
)
this
)
;; definition for method 5 of type art-joint-geo
;; WARN: Return type mismatch uint vs int.
(defmethod asize-of ((this art-joint-geo))
(the-as int (+ (-> art size) (* (-> this length) 4)))
)
;; definition for method 11 of type art-joint-geo
;; WARN: Return type mismatch joint vs basic.
(defmethod get-art-by-name-method ((this art-joint-geo) (arg0 string) (arg1 type))
"Look inside this art for an art with the given name and type. Return #f if not found"
(cond
(arg1
(dotimes (s3-0 (-> this length))
(if (and (= (-> this data s3-0 type) arg1) (name= arg0 (-> this data s3-0 name)))
(return (the-as basic (-> this data s3-0)))
)
)
(the-as joint #f)
)
(else
(dotimes (s4-1 (-> this length))
(if (name= arg0 (-> this data s4-1 name))
(return (the-as basic (-> this data s4-1)))
)
)
(the-as joint #f)
)
)
)
;; definition for method 12 of type art-joint-geo
(defmethod get-art-idx-by-name-method ((this art-joint-geo) (arg0 string) (arg1 type))
"Look inside this art for an art with the given name and type and return the index of the art. Return #f if not found."
(cond
(arg1
(dotimes (s3-0 (-> this length))
(if (and (= (-> this data s3-0 type) arg1) (name= arg0 (-> this data s3-0 name)))
(return s3-0)
)
)
(the-as int #f)
)
(else
(dotimes (s4-1 (-> this length))
(if (name= arg0 (-> this data s4-1 name))
(return s4-1)
)
)
(the-as int #f)
)
)
)
;; definition for method 8 of type art-joint-geo
(defmethod mem-usage ((this art-joint-geo) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 78 (-> usage length)))
(set! (-> usage data 77 name) "art-joint-geo")
(+! (-> usage data 77 count) 1)
(let ((v1-6 (asize-of this)))
(+! (-> usage data 77 used) v1-6)
(+! (-> usage data 77 total) (logand -16 (+ v1-6 15)))
)
(if (-> this extra)
(mem-usage (-> this extra) usage (logior flags 512))
)
(dotimes (s3-0 (-> this length))
(mem-usage (-> this data s3-0) usage flags)
)
this
)
;; definition for function joint-control-cleanup
(defun joint-control-cleanup ((jc joint-control) (heap kheap) (ja art-joint-anim))
"Remove all animations that are stored on the given heap and return those slots to a safe default."
(let ((v1-0 (-> heap base))
(a1-1 (-> heap top-base))
(v0-0 #f)
)
(countdown (a3-1 (+ (-> jc active-channels) (-> jc float-channels)))
(let ((t0-3 (-> jc channel a3-1)))
(when (and (>= (the-as int (-> t0-3 frame-group)) (the-as int v1-0))
(< (the-as int (-> t0-3 frame-group)) (the-as int a1-1))
)
(set! (-> t0-3 frame-group) ja)
(set! (-> t0-3 frame-num) 0.0)
(set! (-> t0-3 num-func) num-func-identity)
(set! v0-0 #t)
)
)
)
v0-0
)
)
;; definition for function joint-control-channel-eval
(defbehavior joint-control-channel-eval process ((jcc joint-control-channel))
"Run the num-func to produce the current frame for this channel."
(let ((f0-3 ((-> jcc num-func) jcc (-> jcc param 0) (-> jcc param 1) (-> jcc param 2))))
(set! (-> jcc eval-time) (the-as uint (current-time)))
f0-3
)
)
;; definition for function joint-control-channel-eval!
(defbehavior joint-control-channel-eval! process ((jcc joint-control-channel) (num-func (function joint-control-channel float float float float)))
"Update the num-func for this channel and evaluate it."
(set! (-> jcc num-func) num-func)
(let ((f0-3 (num-func jcc (-> jcc param 0) (-> jcc param 1) (-> jcc param 2))))
(set! (-> jcc eval-time) (the-as uint (current-time)))
f0-3
)
)
;; definition for function joint-control-channel-group-eval!
(defun joint-control-channel-group-eval! ((jcc joint-control-channel)
(ja art-joint-anim)
(num-func (function joint-control-channel float float float float))
)
(set! (-> jcc num-func) num-func)
(cond
((= (-> jcc command) (joint-control-command stack))
)
(else
(if ja
(set! (-> jcc frame-group) ja)
)
(num-func jcc (-> jcc param 0) (-> jcc param 1) (-> jcc param 2))
(set! (-> jcc eval-time) (the-as uint (current-time)))
)
)
0
)
;; definition for function joint-control-channel-group!
(defun joint-control-channel-group! ((arg0 joint-control-channel)
(arg1 art-joint-anim)
(arg2 (function joint-control-channel float float float float))
)
(set! (-> arg0 num-func) arg2)
(cond
((= (-> arg0 command) (joint-control-command stack))
)
(arg1
(set! (-> arg0 frame-group) arg1)
)
)
0
)
;; definition for function joint-control-copy!
(defun joint-control-copy! ((dst joint-control) (src joint-control))
"Copy all settings and channels from one joint-control to another."
(set! (-> dst blend-index) (-> src blend-index))
(set! (-> dst active-channels) (-> src active-channels))
(set! (-> dst float-channels) (the-as uint 0))
(set! (-> dst root-channel)
(the-as
(inline-array joint-control-channel)
(-> dst
channel
(/ (the-as int (- (the-as uint (-> src root-channel)) (the-as uint (the-as uint (-> src channel))))) 64)
)
)
)
(let ((v1-10 (min (the-as int (-> dst allocated-length)) (the-as int (-> src active-channels)))))
(mem-copy! (the-as pointer (-> dst channel)) (the-as pointer (-> src channel)) (* v1-10 64))
)
(dotimes (v1-12 (the-as int (-> dst allocated-length)))
(set! (-> dst channel v1-12 parent) dst)
)
dst
)
;; definition for function joint-control-remap!
;; INFO: Used lq/sq
(defun joint-control-remap! ((jc joint-control)
(dst-art-group art-group)
(parent-art-group art-group)
(remap-list pair)
(seed int)
(prefix string)
)
"Map animation from parent to child using the given animation mapping.
This is used to animate daxter based on the animation of jak."
(local-vars
(sv-16 int)
(sv-24 symbol)
(sv-32 int)
(sv-40 int)
(sv-48 joint-control-channel)
(sv-52 basic)
(sv-56 object)
(sv-60 basic)
(sv-64 art-joint-anim)
(sv-80 string)
)
(set! sv-16 (+ (length (-> parent-art-group name)) 1))
(set! sv-24 #t)
(set! sv-32 seed)
(set! sv-40 2)
(while (and (< sv-40 (-> dst-art-group length))
(or (not (-> dst-art-group data sv-40)) (!= (-> dst-art-group data sv-40 type) art-joint-anim))
)
(set! sv-40 (+ sv-40 1))
)
(dotimes (s2-1 (the-as int (+ (-> jc active-channels) (-> jc float-channels))))
(set! sv-48 (-> jc channel s2-1))
(set! sv-52 (the-as basic #f))
(when (-> sv-48 frame-group)
(format (clear *temp-string*) "~S~G" prefix (&+ (-> sv-48 frame-group name data) sv-16))
(when (not (null? remap-list))
(set! sv-56 (nassoc *temp-string* remap-list))
(when sv-56
(let* ((s1-1 sv-32)
(a0-8 sv-56)
(v1-36 (mod s1-1 (+ ((method-of-type (rtype-of a0-8) length) a0-8) -1)))
)
(set! sv-60 (the-as basic (ref sv-56 (+ v1-36 1))))
)
(cond
((= (-> sv-60 type) string)
(format (clear *temp-string*) "~S" sv-60)
)
((= (-> sv-60 type) function)
(set! sv-52 sv-60)
(let ((s1-3 format)
(s0-0 (clear *temp-string*))
)
(set! sv-80 "~S")
(let ((a2-4 ((the-as (function joint-control joint-control-channel int object) sv-52) jc sv-48 0)))
(s1-3 s0-0 sv-80 a2-4)
)
)
)
)
)
)
(set! sv-64 (get-art-by-name dst-art-group *temp-string* art-joint-anim))
(cond
(sv-64
(let* ((v1-46 (-> sv-48 frame-group))
(f0-2 (+ (* (-> sv-48 frame-num) (-> v1-46 artist-step)) (-> v1-46 artist-base)))
)
(set! (-> sv-48 frame-group) sv-64)
(set! (-> sv-48 frame-num) (/ (- f0-2 (-> sv-64 artist-base)) (-> sv-64 artist-step)))
)
(set! (-> sv-48 frame-num)
(fmax 0.0 (fmin (-> sv-48 frame-num) (the float (+ (-> sv-64 frames num-frames) -1))))
)
(if sv-52
((the-as (function joint-control joint-control-channel int object) sv-52) jc sv-48 1)
)
)
(else
(set! (-> sv-48 frame-group) (the-as art-joint-anim (-> dst-art-group data sv-40)))
(set! (-> sv-48 frame-num) 0.0)
(set! sv-24 (the-as symbol #f))
)
)
)
)
sv-24
)
;; definition for function flatten-joint-control-to-spr
;; INFO: Used lq/sq
(defun flatten-joint-control-to-spr ((jc joint-control))
"Walk the blend tree and compute interpolation weights, prepare animation upload info."
(rlet ((vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf12 :class vf)
(vf13 :class vf)
(vf14 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(let ((chan-count (+ (-> jc active-channels) (-> jc float-channels))))
(let ((one 1.0)
(chan-float-offset 0)
(chan-vector-ptr (the-as (inline-array vector) #x70000960))
(interp2-selected-idx (-> jc active-frame-interp))
)
(dotimes (chan-idx (the-as int chan-count))
(let ((chan (-> jc channel chan-idx)))
(case (-> chan command)
(((joint-control-command push))
(let ((flt1 (the-as (pointer float) (+ (the-as int chan-vector-ptr) chan-float-offset))))
(set! (-> chan-vector-ptr 0 quad) (the-as uint128 0))
(set! (-> chan-vector-ptr 1 quad) (the-as uint128 0))
(set! (-> chan-vector-ptr 2 quad) (the-as uint128 0))
(set! (-> chan-vector-ptr 3 quad) (the-as uint128 0))
(set! (-> chan-vector-ptr 4 quad) (the-as uint128 0))
(set! (-> chan-vector-ptr 5 quad) (the-as uint128 0))
(set! (-> flt1 0) one)
)
(set! chan-vector-ptr (the-as (inline-array vector) (-> chan-vector-ptr 6)))
)
(((joint-control-command blend) (joint-control-command push1) (joint-control-command float))
(let ((interp2-selected-weight1 (-> chan frame-interp interp2-selected-idx)))
(let ((a3-5 (- one interp2-selected-weight1)))
(.mov vf1 a3-5)
)
(let ((prev-chan-ptr (the-as (inline-array vector) (-> chan-vector-ptr -6))))
(.lvf vf2 (&-> prev-chan-ptr 0 quad))
(let ((a3-6 (&+ (the-as pointer prev-chan-ptr) chan-float-offset)))
(.lvf vf3 (&-> prev-chan-ptr 1 quad))
(.lvf vf4 (&-> prev-chan-ptr 2 quad))
(.lvf vf5 (&-> prev-chan-ptr 3 quad))
(.lvf vf6 (&-> prev-chan-ptr 4 quad))
(.lvf vf7 (&-> prev-chan-ptr 5 quad))
(.mul.x.vf vf2 vf2 vf1)
(.mul.x.vf vf3 vf3 vf1)
(.mul.x.vf vf4 vf4 vf1)
(.mul.x.vf vf5 vf5 vf1)
(.mul.x.vf vf6 vf6 vf1)
(.mul.x.vf vf7 vf7 vf1)
(.svf (&-> prev-chan-ptr 0 quad) vf2)
(.svf (&-> prev-chan-ptr 1 quad) vf3)
(.svf (&-> prev-chan-ptr 2 quad) vf4)
(.svf (&-> prev-chan-ptr 3 quad) vf5)
(.svf (&-> prev-chan-ptr 4 quad) vf6)
(.svf (&-> prev-chan-ptr 5 quad) vf7)
(+! (-> (the-as (pointer float) a3-6) 0) interp2-selected-weight1)
)
(set! chan-vector-ptr (the-as (inline-array vector) (-> prev-chan-ptr 6)))
)
)
)
(((joint-control-command stack))
(let* ((interp2-selected-weight2 (-> chan frame-interp interp2-selected-idx))
(one-minus-interp2 (- one interp2-selected-weight2))
(chans-to-stack (the-as (inline-array vector) (-> chan-vector-ptr -12)))
)
(let ((a3-8 interp2-selected-weight2))
(.mov vf1 a3-8)
)
(let ((a3-9 one-minus-interp2))
(.mov vf2 a3-9)
)
(.lvf vf3 (&-> chans-to-stack 0 quad))
(.lvf vf4 (&-> chans-to-stack 1 quad))
(.lvf vf5 (&-> chans-to-stack 2 quad))
(.lvf vf6 (&-> chans-to-stack 3 quad))
(.lvf vf7 (&-> chans-to-stack 4 quad))
(.lvf vf8 (&-> chans-to-stack 5 quad))
(.mul.x.vf vf3 vf3 vf2)
(.mul.x.vf vf4 vf4 vf2)
(.mul.x.vf vf5 vf5 vf2)
(.mul.x.vf vf6 vf6 vf2)
(.mul.x.vf vf7 vf7 vf2)
(.mul.x.vf vf8 vf8 vf2)
(.lvf vf9 (&-> chans-to-stack 6 quad))
(.lvf vf10 (&-> chans-to-stack 7 quad))
(.lvf vf11 (&-> chans-to-stack 8 quad))
(.lvf vf12 (&-> chans-to-stack 9 quad))
(.lvf vf13 (&-> chans-to-stack 10 quad))
(.lvf vf14 (&-> chans-to-stack 11 quad))
(.mul.x.vf vf9 vf9 vf1)
(.mul.x.vf vf10 vf10 vf1)
(.mul.x.vf vf11 vf11 vf1)
(.mul.x.vf vf12 vf12 vf1)
(.mul.x.vf vf13 vf13 vf1)
(.mul.x.vf vf14 vf14 vf1)
(.add.vf vf3 vf3 vf9)
(.add.vf vf4 vf4 vf10)
(.add.vf vf5 vf5 vf11)
(.add.vf vf6 vf6 vf12)
(.add.vf vf7 vf7 vf13)
(.add.vf vf8 vf8 vf14)
(.svf (&-> chans-to-stack 0 quad) vf3)
(.svf (&-> chans-to-stack 1 quad) vf4)
(.svf (&-> chans-to-stack 2 quad) vf5)
(.svf (&-> chans-to-stack 3 quad) vf6)
(.svf (&-> chans-to-stack 4 quad) vf7)
(.svf (&-> chans-to-stack 5 quad) vf8)
(set! chan-vector-ptr (the-as (inline-array vector) (&+ (the-as pointer chans-to-stack) 96)))
)
)
)
)
(+! chan-float-offset 4)
)
)
(let ((upload-count 0))
(dotimes (upload-chan-idx (the-as int chan-count))
(when (< 0.001 (-> (the-as terrain-context #x70000000) work foreground joint-work flatten-array upload-chan-idx))
(let* ((upload-chan (-> jc channel upload-chan-idx))
(anim (-> upload-chan frame-group frames))
(frame-num (-> upload-chan frame-num))
(int-frame-num (the int frame-num))
(frame-frac (- frame-num (the float int-frame-num)))
)
(let ((last-frame (+ (-> anim num-frames) -1)))
(if (not (-> upload-chan frame-group))
(format 0 "Channel ~D skel ~A frame-group is #f!!!~%" upload-chan-idx jc)
)
(when (>= int-frame-num (the-as int last-frame))
(set! frame-frac 0.0)
(set! int-frame-num (the-as int last-frame))
)
)
(let ((upload (-> (the-as terrain-context #x70000000) work foreground joint-work uploads upload-count)))
(set! (-> upload fixed) (-> anim fixed))
(set! (-> upload fixed-qwc) (the-as int (-> anim fixed-qwc)))
(set! (-> upload frame) (-> anim data int-frame-num))
(set! (-> upload frame-qwc) (the-as int (if (= frame-frac 0.0)
(-> anim frame-qwc)
(* (-> anim frame-qwc) 2)
)
)
)
(set! (-> upload amount)
(-> (the-as terrain-context #x70000000) work foreground joint-work flatten-array upload-chan-idx)
)
(set! (-> upload interp) frame-frac)
)
)
(+! upload-count 1)
)
)
(set! (-> (the-as terrain-context #x70000000) work foreground joint-work num-uploads) upload-count)
)
(dotimes (v1-26 (the-as int chan-count))
(set! (-> jc channel v1-26 inspector-amount)
(the-as
uint
(the int (* 255.0 (-> (the-as terrain-context #x70000000) work foreground joint-work flatten-array v1-26)))
)
)
)
)
0
)
)
;; definition for function matrix-from-joint-anim-frame
;; WARN: Return type mismatch object vs matrix.
(defun matrix-from-joint-anim-frame ((jacc joint-anim-compressed-control) (joint-idx int) (frame-idx int))
"Get a matrix from a joint-animation at a given (integer) frame.
This only works on the first two joints, since those are the only ones that store matrices."
(let ((fixed-matrix (the-as object (-> jacc fixed data)))
(frame-matrix (the-as object (-> jacc data frame-idx data)))
)
(cond
((not (logtest? (-> jacc fixed hdr matrix-bits) 1))
(set! fixed-matrix (cond
((zero? joint-idx)
(return (the-as matrix fixed-matrix))
fixed-matrix
)
(else
(-> (the-as (inline-array vector) fixed-matrix) 4)
)
)
)
)
((zero? joint-idx)
(return (the-as matrix frame-matrix))
)
(else
(set! frame-matrix (-> (the-as (inline-array vector) frame-matrix) 4))
)
)
(if (not (logtest? (-> jacc fixed hdr matrix-bits) 2))
(return (the-as matrix fixed-matrix))
)
(the-as matrix frame-matrix)
)
)
;; definition for function matrix-from-control-channel!
;; INFO: Used lq/sq
(defun matrix-from-control-channel! ((dest-mat matrix) (requested-joint joint) (chan joint-control-channel))
"Get a matrix for a joint (must be 0 or 1) for the animation specified by the channel.
Will interpolate if we are in between animation frames.
This does not apply any frame-interp blending."
(let ((jacc (-> chan frame-group))
(joint-num (-> requested-joint number))
)
(if (>= joint-num 2)
(format 0 "ERROR: Call to matrix-from-control-channel! on joint ~D~%" joint-num)
)
(let* ((frame-num (fmax 0.0 (fmin (-> chan frame-num) (the float (+ (-> jacc frames num-frames) -1)))))
(f0-1 frame-num)
)
(cond
((= (the float (the int f0-1)) f0-1)
(let* ((mat (matrix-from-joint-anim-frame (-> jacc frames) joint-num (the int frame-num)))
(v1-7 (-> mat rvec quad))
(a0-3 (-> mat uvec quad))
(a1-3 (-> mat fvec quad))
(a2-4 (-> mat trans quad))
)
(set! (-> dest-mat rvec quad) v1-7)
(set! (-> dest-mat uvec quad) a0-3)
(set! (-> dest-mat fvec quad) a1-3)
(set! (-> dest-mat trans quad) a2-4)
)
dest-mat
)
(else
(let ((first-mat (matrix-from-joint-anim-frame (-> jacc frames) joint-num (the int frame-num)))
(second-mat (matrix-from-joint-anim-frame (-> jacc frames) joint-num (+ (the int frame-num) 1)))
(mat-blend (- frame-num (the float (the int frame-num))))
)
(matrix-lerp! dest-mat first-mat second-mat mat-blend)
)
)
)
)
)
)
;; definition for function matrix-from-control-pair!
(defun matrix-from-control-pair! ((matrix-to-modify matrix) (jcc joint-control-channel) (jnt joint) (active-frame-interp int))
"Modify the matrix to add in a blended animation for the given channel."
(let ((f30-0 (-> jcc frame-interp active-frame-interp)))
(cond
((>= 0.0 f30-0)
(empty)
matrix-to-modify
)
((>= f30-0 1.0)
(matrix-from-control-channel! matrix-to-modify jnt jcc)
)
(else
(let ((a2-3 (matrix-from-control-channel! (the-as matrix (+ #x70000000 0)) jnt jcc)))
(matrix-lerp! matrix-to-modify matrix-to-modify a2-3 f30-0)
)
)
)
)
)
;; definition for function matrix-from-control!
;; INFO: Used lq/sq
;; WARN: Return type mismatch (inline-array matrix) vs matrix.
(defun matrix-from-control! ((mat-stack matrix-stack) (jnt joint) (jc joint-control) (mode symbol))
"Compute a matrix for a given joint (must be 0 or 1) given the entire joint-control.
This walks the blend tree."
(set! (-> mat-stack top) (the-as matrix (-> mat-stack data)))
(dotimes (s2-0 (the-as int (+ (-> jc active-channels) (-> jc float-channels))))
(let* ((a2-1 (-> jc channel s2-0))
(v1-3 (-> a2-1 command))
(s1-0 64)
)
(cond
((and (= mode 'no-push) (= v1-3 (joint-control-command push1)))
(matrix-from-control-channel! (- (-> mat-stack top) (the-as uint s1-0)) jnt a2-1)
)
((and (= mode 'no-push) (= v1-3 (joint-control-command stack)))
(set! (-> mat-stack top) (- (-> mat-stack top) (the-as uint s1-0)))
(let* ((v1-9 (- (-> mat-stack top) (the-as uint s1-0)))
(a3-1 (-> mat-stack top))
(a0-8 (-> a3-1 rvec quad))
(a1-6 (-> a3-1 uvec quad))
(a2-2 (-> a3-1 fvec quad))
(a3-2 (-> a3-1 trans quad))
)
(set! (-> v1-9 rvec quad) a0-8)
(set! (-> v1-9 uvec quad) a1-6)
(set! (-> v1-9 fvec quad) a2-2)
(set! (-> v1-9 trans quad) a3-2)
)
)
((and (= mode 'no-push) (= v1-3 (joint-control-command float)))
)
((= v1-3 (joint-control-command push))
(matrix-from-control-channel! (-> mat-stack top) jnt a2-1)
(set! (-> mat-stack top) (+ (the-as uint (-> mat-stack top)) s1-0))
)
((logtest? v1-3 (joint-control-command blend))
(matrix-from-control-pair!
(- (-> mat-stack top) (the-as uint s1-0))
a2-1
jnt
(the-as int (-> jc active-frame-interp))
)
)
((= v1-3 (joint-control-command stack))
(set! (-> mat-stack top) (- (-> mat-stack top) (the-as uint s1-0)))
(let ((a1-11 (- (-> mat-stack top) (the-as uint s1-0)))
(v1-19 (-> mat-stack top))
(f0-0 (-> a2-1 frame-interp (-> jc active-frame-interp)))
)
(matrix-lerp! a1-11 a1-11 v1-19 f0-0)
)
)
)
)
)
(the-as matrix (-> mat-stack data))
)
;; definition for method 9 of type cspace
(defmethod reset-and-assign-geo! ((this cspace) (arg0 drawable))
(set! (-> this parent) #f)
(set! (-> this joint) #f)
(set! (-> this geo) arg0)
(set! (-> this param0) #f)
(set! (-> this param1) #f)
(set! (-> this param2) #f)
this
)
;; definition for method 0 of type cspace
(defmethod new cspace ((allocation symbol) (type-to-make type) (arg0 drawable))
(let ((t9-0 (method-of-type structure new))
(v1-1 type-to-make)
)
(-> type-to-make size)
((method-of-type cspace reset-and-assign-geo!) (the-as cspace (t9-0 allocation v1-1)) arg0)
)
)
;; definition for function cspace<-cspace!
;; INFO: Used lq/sq
(defun cspace<-cspace! ((dst cspace) (src cspace))
"Set one cspace's bone from another"
(let ((v0-0 (-> dst bone transform)))
(let* ((a2-0 (-> src bone transform))
(v1-2 (-> a2-0 rvec quad))
(a0-1 (-> a2-0 uvec quad))
(a1-1 (-> a2-0 fvec quad))
(a2-1 (-> a2-0 trans quad))
)
(set! (-> v0-0 rvec quad) v1-2)
(set! (-> v0-0 uvec quad) a0-1)
(set! (-> v0-0 fvec quad) a1-1)
(set! (-> v0-0 trans quad) a2-1)
)
v0-0
)
)
;; definition for function cspace<-cspace-normalized!
;; INFO: Used lq/sq
(defun cspace<-cspace-normalized! ((dst cspace) (src cspace))
"Set one cspace's bone from another, and normalize the rows of the matrix."
(let ((gp-0 (-> dst bone transform)))
(let* ((a2-0 (-> src bone transform))
(v1-2 (-> a2-0 rvec quad))
(a0-1 (-> a2-0 uvec quad))
(a1-1 (-> a2-0 fvec quad))
(a2-1 (-> a2-0 trans quad))
)
(set! (-> gp-0 rvec quad) v1-2)
(set! (-> gp-0 uvec quad) a0-1)
(set! (-> gp-0 fvec quad) a1-1)
(set! (-> gp-0 trans quad) a2-1)
)
(vector-normalize! (-> gp-0 rvec) 1.0)
(vector-normalize! (-> gp-0 uvec) 1.0)
(vector-normalize! (-> gp-0 fvec) 1.0)
gp-0
)
)
;; definition for function cspace<-parent-joint!
;; INFO: Used lq/sq
(defun cspace<-parent-joint! ((dst cspace) (proc (pointer process-drawable)) (parent-idx int))
"Set one cspace's bone to another from the given process-drawable"
(let ((v0-0 (-> dst bone transform)))
(let* ((a2-1 (-> proc 0 node-list data parent-idx bone transform))
(v1-5 (-> a2-1 rvec quad))
(a0-2 (-> a2-1 uvec quad))
(a1-1 (-> a2-1 fvec quad))
(a2-2 (-> a2-1 trans quad))
)
(set! (-> v0-0 rvec quad) v1-5)
(set! (-> v0-0 uvec quad) a0-2)
(set! (-> v0-0 fvec quad) a1-1)
(set! (-> v0-0 trans quad) a2-2)
)
v0-0
)
)
;; definition for function cspace<-rot-yxy!
(defun cspace<-rot-yxy! ((dst cspace) (src transform))
"Set one cspace's bone to a yxy rotation and scale."
(let ((s5-0 (-> dst bone transform)))
(matrix-rotate-yxy! s5-0 (-> src rot))
(scale-matrix! s5-0 (-> src scale) s5-0)
)
)
;; definition for function cspace<-transform-yxy!
(defun cspace<-transform-yxy! ((dst cspace) (src transform))
"Set one cspace's bone to yxy rotation, translation, and scale"
(let ((s4-0 (-> dst bone transform))
(s5-0 (new 'stack-no-clear 'matrix))
(s3-0 (new 'stack-no-clear 'matrix))
)
(matrix-identity! s4-0)
(matrix-translate! s4-0 (-> src trans))
(matrix-rotate-yxy! s5-0 (-> src rot))
(matrix*! s3-0 s5-0 s4-0)
(scale-matrix! s4-0 (-> src scale) s3-0)
)
)
;; definition for function cspace<-transformq!
(defun cspace<-transformq! ((dst cspace) (src transformq))
"Set one cspace's from a transformq"
(matrix<-transformq! (-> dst bone transform) src)
)
;; definition for function cspace<-transformq+trans!
(defun cspace<-transformq+trans! ((dst cspace) (src transformq) (extra-trans vector))
"Set one cspace from a transformq and an additional local translation."
(matrix<-transformq+trans! (-> dst bone transform) src extra-trans)
)
;; definition for function cspace<-transformq+world-trans!
(defun cspace<-transformq+world-trans! ((dst cspace) (src transformq) (extra-trans vector))
"Set one cspace from a transformq and an additional world translation."
(matrix<-transformq+world-trans! (-> dst bone transform) src extra-trans)
)
;; definition for function cspace<-transformq+rot-offset!
(defun cspace<-transformq+rot-offset! ((dst cspace) (src transformq) (extra-rot vector))
"Set one cspace from a transformq and an additional rotate."
(matrix<-transformq+rot-offset! (-> dst bone transform) src extra-rot)
)
;; definition for function cspace-calc-total-matrix!
(defun cspace-calc-total-matrix! ((csp cspace) (dst matrix))
"Combine the bone matrix and camera matrix.
This is not actually a useful matrix since it does not include the inverse bind pose, but
is close to the rendering matrices computed by bones.gc"
(matrix*! dst (-> csp bone transform) (-> *math-camera* camera-temp))
)
;; definition for function cspace<-matrix-no-push-joint!
;; INFO: Used lq/sq
(defun cspace<-matrix-no-push-joint! ((dst cspace) (jc joint-control))
"Compute animated matrix, using the special 'no-push mode."
(let ((v1-2 (matrix-from-control! (the-as matrix-stack (+ 64 #x70000000)) (-> dst joint) jc 'no-push))
(v0-1 (-> dst bone transform))
)
(let ((a0-4 (-> v1-2 rvec quad))
(a1-2 (-> v1-2 uvec quad))
(a2-1 (-> v1-2 fvec quad))
(v1-3 (-> v1-2 trans quad))
)
(set! (-> v0-1 rvec quad) a0-4)
(set! (-> v0-1 uvec quad) a1-2)
(set! (-> v0-1 fvec quad) a2-1)
(set! (-> v0-1 trans quad) v1-3)
)
v0-1
)
)
;; definition for function cspace<-matrix-joint!
;; INFO: Used lq/sq
(defun cspace<-matrix-joint! ((dst cspace) (src matrix))
"Set the cspace from a matrix."
(let ((v0-0 (-> dst bone transform)))
(let* ((a2-0 src)
(v1-1 (-> a2-0 rvec quad))
(a0-1 (-> a2-0 uvec quad))
(a1-1 (-> a2-0 fvec quad))
(a2-1 (-> a2-0 trans quad))
)
(set! (-> v0-0 rvec quad) v1-1)
(set! (-> v0-0 uvec quad) a0-1)
(set! (-> v0-0 fvec quad) a1-1)
(set! (-> v0-0 trans quad) a2-1)
)
v0-0
)
)
;; definition for function cspace<-parented-matrix-joint!
(defun cspace<-parented-matrix-joint! ((dst cspace) (joint-mat matrix))
"Compute the bone matrix of a cspace from combining the transform of the parent bone and the given joint matrix.
This computes world-space bones from a tree of bones (skeleton)"
(rlet ((acc :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf12 :class vf)
(vf13 :class vf)
(vf14 :class vf)
(vf15 :class vf)
(vf16 :class vf)
(vf17 :class vf)
(vf18 :class vf)
(vf19 :class vf)
(vf20 :class vf)
(vf21 :class vf)
)
(let ((v0-0 (-> dst bone transform)))
(let ((v1-1 joint-mat))
(let ((a0-3 (-> dst parent bone transform)))
(.lvf vf10 (&-> v1-1 rvec quad))
(.lvf vf14 (&-> a0-3 rvec quad))
(.lvf vf15 (&-> a0-3 uvec quad))
(.lvf vf16 (&-> a0-3 fvec quad))
(.lvf vf17 (&-> a0-3 trans quad))
)
(.lvf vf11 (&-> v1-1 uvec quad))
(.lvf vf12 (&-> v1-1 fvec quad))
(.lvf vf13 (&-> v1-1 trans quad))
)
(.mul.x.vf acc vf14 vf10)
(.add.mul.y.vf acc vf15 vf10 acc)
(.add.mul.z.vf acc vf16 vf10 acc)
(.add.mul.w.vf vf18 vf17 vf10 acc)
(.mul.x.vf acc vf14 vf11)
(.add.mul.y.vf acc vf15 vf11 acc)
(.add.mul.z.vf acc vf16 vf11 acc)
(.add.mul.w.vf vf19 vf17 vf11 acc)
(.mul.x.vf acc vf14 vf12)
(.add.mul.y.vf acc vf15 vf12 acc)
(.add.mul.z.vf acc vf16 vf12 acc)
(.add.mul.w.vf vf20 vf17 vf12 acc)
(.mul.x.vf acc vf14 vf13)
(.add.mul.y.vf acc vf15 vf13 acc)
(.add.mul.z.vf acc vf16 vf13 acc)
(.add.mul.w.vf vf21 vf17 vf13 acc)
(.svf (&-> v0-0 rvec quad) vf18)
(.svf (&-> v0-0 uvec quad) vf19)
(.svf (&-> v0-0 fvec quad) vf20)
(.svf (&-> v0-0 trans quad) vf21)
v0-0
)
)
)
;; definition for function cspace<-parented-matrix-mirror!
(defun cspace<-parented-matrix-mirror! ((dst cspace) (joint-mat matrix))
"Mirror the provided matrix (using cspace param1,2 as the normal/tangent dirs) as the joint matrix
This is similar to cspace<-parented-matrix-joint!, but essentially mirrors the joint."
(let ((gp-0
(matrix-mirror! (new 'stack-no-clear 'matrix) (the-as vector (-> dst param1)) (the-as vector (-> dst param2)))
)
)
(cspace<-parented-matrix-joint! dst joint-mat)
(matrix*! (-> dst bone transform) (-> dst bone transform) gp-0)
)
)
;; definition for function cspace<-parented-matrix-joint-flip-z!
(defun cspace<-parented-matrix-joint-flip-z! ((dst cspace) (joint-mat matrix))
"Compute the bone matrix from the parent bone and joint, but flip the z-axis of the joint frame."
(rlet ((acc :class vf)
(vf0 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf12 :class vf)
(vf13 :class vf)
(vf14 :class vf)
(vf15 :class vf)
(vf16 :class vf)
(vf17 :class vf)
(vf18 :class vf)
(vf19 :class vf)
(vf20 :class vf)
(vf21 :class vf)
(vf31 :class vf)
)
(init-vf0-vector)
(let ((v0-0 (-> dst bone transform)))
(let ((v1-1 joint-mat))
(let ((a0-3 (-> dst parent bone transform)))
(.lvf vf10 (&-> v1-1 rvec quad))
(.lvf vf14 (&-> a0-3 rvec quad))
(.lvf vf15 (&-> a0-3 uvec quad))
(.lvf vf16 (&-> a0-3 fvec quad))
(.lvf vf17 (&-> a0-3 trans quad))
)
(.lvf vf11 (&-> v1-1 uvec quad))
(.lvf vf12 (&-> v1-1 fvec quad))
(.lvf vf13 (&-> v1-1 trans quad))
)
(.sub.vf vf31 vf0 vf0)
(.mul.x.vf acc vf14 vf10)
(.add.mul.y.vf acc vf15 vf10 acc)
(.add.mul.z.vf acc vf16 vf10 acc)
(.add.mul.w.vf vf18 vf17 vf10 acc)
(.mul.x.vf acc vf14 vf12)
(.add.mul.y.vf acc vf15 vf12 acc)
(.add.mul.z.vf acc vf16 vf12 acc)
(.add.mul.w.vf vf20 vf17 vf12 acc)
(.mul.x.vf acc vf14 vf11)
(.add.mul.y.vf acc vf15 vf11 acc)
(.add.mul.z.vf acc vf16 vf11 acc)
(.add.mul.w.vf vf19 vf17 vf11 acc)
(.sub.vf vf18 vf31 vf18)
(.mul.x.vf acc vf14 vf13)
(.add.mul.y.vf acc vf15 vf13 acc)
(.add.mul.z.vf acc vf16 vf13 acc)
(.add.mul.w.vf vf21 vf17 vf13 acc)
(.svf (&-> v0-0 rvec quad) vf18)
(.svf (&-> v0-0 uvec quad) vf19)
(.svf (&-> v0-0 fvec quad) vf20)
(.svf (&-> v0-0 trans quad) vf21)
v0-0
)
)
)
;; definition for function cspace<-matrix-joint-flip-z!
;; WARN: Return type mismatch int vs none.
(defun cspace<-matrix-joint-flip-z! ((dst cspace) (src matrix))
"Set the bone matrix directly from the joint matrix, flipping z."
(local-vars (v1-2 float))
(rlet ((vf0 :class vf)
(vf30 :class vf)
(vf31 :class vf)
)
(init-vf0-vector)
(let ((v1-1 (-> dst bone transform)))
(.sub.vf vf31 vf0 vf0)
(.lvf vf30 (&-> v1-1 rvec quad))
(.sub.vf vf30 vf31 vf30)
(.svf (&-> v1-1 rvec quad) vf30)
)
(.mov v1-2 vf30)
0
(none)
)
)
;; definition for function cspace<-parented-transformq-joint!
;; ERROR: Function may read a register that is not set: ra
;; ERROR: Unsupported inline assembly instruction kind - [jr ra]
;; ERROR: Unsupported inline assembly instruction kind - [jr ra]
(defun cspace<-parented-transformq-joint! ((dst cspace) (joint-transformq transformq))
"Main function for doing skeletal animation from decompressed transformq's.
Sets the cspace bone to the parent bone, plus the transformq."
(local-vars (t1-1 uint128) (ra-0 none) (f4-2 float))
(rlet ((acc :class vf)
(vf0 :class vf)
(vf1 :class vf)
(vf10 :class vf)
(vf11 :class vf)
(vf12 :class vf)
(vf13 :class vf)
(vf14 :class vf)
(vf15 :class vf)
(vf16 :class vf)
(vf2 :class vf)
(vf3 :class vf)
(vf4 :class vf)
(vf5 :class vf)
(vf6 :class vf)
(vf7 :class vf)
(vf8 :class vf)
(vf9 :class vf)
)
(init-vf0-vector)
(nop!)
(let ((a3-0 (-> dst parent))
(v1-0 1.0)
)
(.lvf vf5 (&-> joint-transformq quat quad))
(let ((f0-0 v1-0)
(t0-0 (-> a3-0 bone))
)
(nop!)
(let ((a2-0 (-> dst bone)))
(.add.vf vf6 vf5 vf5)
(let ((f1-0 (-> t0-0 scale x)))
(.add.w.vf vf2 vf0 vf5 :mask #b1)
(.lvf vf15 (&-> joint-transformq trans quad))
(.add.z.vf vf2 vf0 vf5 :mask #b10)
(.lvf vf1 (&-> joint-transformq scale quad))
(let ((f4-0 (/ f0-0 f1-0)))
(.lvf vf7 (&-> t0-0 transform rvec quad))
(.sub.y.vf vf2 vf0 vf5 :mask #b100)
(.lvf vf8 (&-> t0-0 transform uvec quad))
(.sub.w.vf vf2 vf0 vf0 :mask #b1000)
(.lvf vf9 (&-> t0-0 transform fvec quad))
(.sub.z.vf vf3 vf0 vf5 :mask #b1)
(.lvf vf10 (&-> t0-0 transform trans quad))
(.add.w.vf vf3 vf0 vf5 :mask #b10)
(let ((f2-0 (-> t0-0 scale y)))
(.add.x.vf vf3 vf0 vf5 :mask #b100)
(.svf (&-> a2-0 scale quad) vf1)
(.sub.w.vf vf3 vf0 vf0 :mask #b1000)
(let ((f3-0 (-> t0-0 scale z)))
(.add.y.vf vf4 vf0 vf5 :mask #b1)
(let ((v1-1 (-> t0-0 scale w)))
(.sub.x.vf vf4 vf0 vf5 :mask #b10)
(let ((t1-0 (the-as uint128 f4-0)))
(.add.w.vf vf4 vf0 vf5 :mask #b100)
(let ((f4-1 (/ f0-0 f2-0)))
(.sub.w.vf vf4 vf0 vf0 :mask #b1000)
(.outer.product.a.vf acc vf6 vf2)
(.outer.product.b.vf vf2 vf2 vf6 acc)
(.outer.product.a.vf acc vf6 vf3)
(.outer.product.b.vf vf3 vf3 vf6 acc)
(.outer.product.a.vf acc vf6 vf4)
(.outer.product.b.vf vf4 vf4 vf6 acc)
(.add.w.vf vf2 vf2 vf0 :mask #b1)
(.add.w.vf vf3 vf3 vf0 :mask #b10)
(.add.w.vf vf4 vf4 vf0 :mask #b100)
(let ((t2-0 (the-as uint128 f4-1)))
(b! (nonzero? v1-1) cfg-2 :delay (set! f4-2 (/.s f0-0 f3-0)))
(.mul.x.vf vf2 vf2 vf1)
(.mul.y.vf vf3 vf3 vf1)
(.mul.z.vf vf4 vf4 vf1)
(.mul.x.vf acc vf7 vf2)
(.add.mul.y.vf acc vf8 vf2 acc)
(.add.mul.z.vf acc vf9 vf2 acc)
(.add.mul.w.vf vf11 vf10 vf2 acc)
(.mul.x.vf acc vf7 vf3)
(.add.mul.y.vf acc vf8 vf3 acc)
(.add.mul.z.vf acc vf9 vf3 acc)
(.add.mul.w.vf vf12 vf10 vf3 acc)
(.mul.x.vf acc vf7 vf4)
(.add.mul.y.vf acc vf8 vf4 acc)
(.add.mul.z.vf acc vf9 vf4 acc)
(.add.mul.w.vf vf13 vf10 vf4 acc)
(.mul.x.vf acc vf7 vf15)
(.add.mul.y.vf acc vf8 vf15 acc)
(.add.mul.z.vf acc vf9 vf15 acc)
(.add.mul.w.vf vf14 vf10 vf0 acc)
(.svf (&-> a2-0 transform rvec quad) vf11)
(.svf (&-> a2-0 transform uvec quad) vf12)
(.svf (&-> a2-0 transform fvec quad) vf13)
(.svf (&-> a2-0 transform trans quad) vf14)
(.jr ra-0)
(nop!)
(label cfg-2)
(.pextlw t1-1 t2-0 t1-0)
)
)
)
)
)
)
)
)
(.mul.x.vf vf2 vf2 vf1)
(.mul.y.vf vf3 vf3 vf1)
(.mul.z.vf vf4 vf4 vf1)
(let ((t1-2 (make-u128 f4-2 (the-as int t1-1))))
(.mov vf16 t1-2)
)
(.mul.vf vf2 vf2 vf16)
(.mul.vf vf3 vf3 vf16)
(.mul.vf vf4 vf4 vf16)
(.mul.x.vf acc vf7 vf2)
(.add.mul.y.vf acc vf8 vf2 acc)
(.add.mul.z.vf acc vf9 vf2 acc)
(.add.mul.w.vf vf11 vf10 vf2 acc)
(.mul.x.vf acc vf7 vf3)
(.add.mul.y.vf acc vf8 vf3 acc)
(.add.mul.z.vf acc vf9 vf3 acc)
(.add.mul.w.vf vf12 vf10 vf3 acc)
(.mul.x.vf acc vf7 vf4)
(.add.mul.y.vf acc vf8 vf4 acc)
(.add.mul.z.vf acc vf9 vf4 acc)
(.add.mul.w.vf vf13 vf10 vf4 acc)
(.mul.x.vf acc vf7 vf15)
(.add.mul.y.vf acc vf8 vf15 acc)
(.add.mul.z.vf acc vf9 vf15 acc)
(.add.mul.w.vf vf14 vf10 vf0 acc)
(.svf (&-> a2-0 transform rvec quad) vf11)
(.svf (&-> a2-0 transform uvec quad) vf12)
(.svf (&-> a2-0 transform fvec quad) vf13)
(.svf (&-> a2-0 transform trans quad) vf14)
)
)
)
(.jr ra-0)
(nop!)
(none)
)
)
;; definition for function cspace<-parented-transformq-joint-flip-z!
;; WARN: Return type mismatch int vs none.
(defun cspace<-parented-transformq-joint-flip-z! ((dst cspace) (joint-transformq transformq))
"Unused, but would flip the z-axis of the transformq and do a normal parented joint transform."
(cspace<-parented-transformq-joint! dst joint-transformq)
(cspace<-matrix-joint-flip-z! dst (-> dst bone transform))
0
(none)
)
;; definition for function clear-frame-accumulator
;; ERROR: function has no type analysis. Cannot decompile.
;; definition for function normalize-frame-quaternions
;; ERROR: function has no type analysis. Cannot decompile.
;; definition for function decompress-fixed-data-to-accumulator
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function decompress-frame-data-to-accumulator
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function decompress-frame-data-pair-to-accumulator
;; ERROR: function was not converted to expressions. Cannot decompile.
;; definition for function make-joint-jump-tables
;; ERROR: Failed store: (s.w! (+ a0-2 1616) v1-1) at op 5
;; ERROR: Failed store: (s.w! (+ a0-5 1620) v1-3) at op 11
;; ERROR: Failed store: (s.w! (+ a0-8 1624) v1-5) at op 17
;; ERROR: Failed store: (s.w! (+ a0-11 1628) v1-7) at op 23
;; ERROR: Failed store: (s.w! (+ a0-14 1632) v1-9) at op 29
;; ERROR: Failed store: (s.w! (+ a0-17 1636) v1-11) at op 35
;; ERROR: Failed store: (s.w! (+ a0-20 1640) v1-13) at op 41
;; ERROR: Failed store: (s.w! (+ a0-23 1644) v1-15) at op 47
;; ERROR: Failed store: (s.w! (+ a0-26 1648) v1-17) at op 53
;; ERROR: Failed store: (s.w! (+ a0-29 1652) v1-19) at op 59
;; ERROR: Failed store: (s.w! (+ a0-32 1656) v1-21) at op 65
;; ERROR: Failed store: (s.w! (+ a0-35 1660) v1-23) at op 71
;; ERROR: Failed store: (s.w! (+ a0-38 1664) v1-25) at op 77
;; ERROR: Failed store: (s.w! (+ a0-41 1668) v1-27) at op 83
;; ERROR: Failed store: (s.w! (+ a0-44 1672) v1-29) at op 89
;; ERROR: Failed store: (s.w! (+ a0-47 1676) v1-31) at op 95
;; ERROR: Failed store: (s.w! (+ a0-50 1680) v1-33) at op 101
;; ERROR: Failed store: (s.w! (+ a0-53 1684) v1-35) at op 107
;; ERROR: Failed store: (s.w! (+ a0-56 1688) v1-37) at op 113
;; ERROR: Failed store: (s.w! (+ a0-59 1692) v1-39) at op 119
;; ERROR: Failed store: (s.w! (+ a0-62 1696) v1-41) at op 125
;; ERROR: Failed store: (s.w! (+ a0-65 1700) v1-43) at op 131
;; ERROR: Failed store: (s.w! (+ a0-68 1704) v1-45) at op 137
;; ERROR: Failed store: (s.w! (+ a0-71 1708) v1-47) at op 143
;; ERROR: Failed store: (s.w! (+ a0-74 1712) v1-49) at op 149
;; ERROR: Failed store: (s.w! (+ a0-77 1716) v1-51) at op 155
;; ERROR: Failed store: (s.w! (+ a0-80 1720) v1-53) at op 161
;; ERROR: Failed store: (s.w! (+ a0-83 1724) v1-55) at op 167
;; ERROR: Failed store: (s.w! (+ a0-86 1728) v1-57) at op 173
;; ERROR: Failed store: (s.w! (+ a0-89 1732) v1-59) at op 179
;; ERROR: Failed store: (s.w! (+ a0-92 1736) v1-61) at op 185
;; ERROR: Failed store: (s.w! (+ a0-95 1740) v1-63) at op 191
;; ERROR: Failed store: (s.w! (+ a0-98 1744) v1-65) at op 197
;; ERROR: Failed store: (s.w! (+ a0-101 1748) v1-67) at op 203
;; ERROR: Failed store: (s.w! (+ a0-104 1752) v1-69) at op 209
;; ERROR: Failed store: (s.w! (+ a0-107 1756) v1-71) at op 215
;; ERROR: Failed store: (s.w! (+ a0-110 1760) v1-73) at op 221
;; ERROR: Failed store: (s.w! (+ a0-113 1764) v1-75) at op 227
;; ERROR: Failed store: (s.w! (+ a0-116 1768) v1-77) at op 233
;; ERROR: Failed store: (s.w! (+ a0-119 1772) v1-79) at op 239
;; ERROR: Failed store: (s.w! (+ a0-122 1776) v1-81) at op 245
;; ERROR: Failed store: (s.w! (+ a0-125 1780) v1-83) at op 251
;; ERROR: Failed store: (s.w! (+ a0-128 1784) v1-85) at op 257
;; ERROR: Failed store: (s.w! (+ a0-131 1788) v1-87) at op 263
;; ERROR: Failed store: (s.w! (+ a0-134 1792) v1-89) at op 269
;; ERROR: Failed store: (s.w! (+ a0-137 1796) v1-91) at op 275
;; ERROR: Failed store: (s.w! (+ a0-140 1800) v1-93) at op 281
;; ERROR: Failed store: (s.w! (+ a0-143 1804) v1-95) at op 287
(defun make-joint-jump-tables ()
(let ((v1-1 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 108 4)))
(a0-2 #x70000000)
)
(s.w! (+ a0-2 1616) v1-1)
)
(let ((v1-3 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 199 4)))
(a0-5 #x70000000)
)
(s.w! (+ a0-5 1620) v1-3)
)
(let ((v1-5 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 233 4)))
(a0-8 #x70000000)
)
(s.w! (+ a0-8 1624) v1-5)
)
(let ((v1-7 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 286 4)))
(a0-11 #x70000000)
)
(s.w! (+ a0-11 1628) v1-7)
)
(let ((v1-9 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 301 4)))
(a0-14 #x70000000)
)
(s.w! (+ a0-14 1632) v1-9)
)
(let ((v1-11 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 366 4)))
(a0-17 #x70000000)
)
(s.w! (+ a0-17 1636) v1-11)
)
(let ((v1-13 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 387 4)))
(a0-20 #x70000000)
)
(s.w! (+ a0-20 1640) v1-13)
)
(let ((v1-15 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 100 4)))
(a0-23 #x70000000)
)
(s.w! (+ a0-23 1644) v1-15)
)
(let ((v1-17 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 155 4)))
(a0-26 #x70000000)
)
(s.w! (+ a0-26 1648) v1-17)
)
(let ((v1-19 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 199 4)))
(a0-29 #x70000000)
)
(s.w! (+ a0-29 1652) v1-19)
)
(let ((v1-21 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 261 4)))
(a0-32 #x70000000)
)
(s.w! (+ a0-32 1656) v1-21)
)
(let ((v1-23 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 286 4)))
(a0-35 #x70000000)
)
(s.w! (+ a0-35 1660) v1-23)
)
(let ((v1-25 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 335 4)))
(a0-38 #x70000000)
)
(s.w! (+ a0-38 1664) v1-25)
)
(let ((v1-27 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 366 4)))
(a0-41 #x70000000)
)
(s.w! (+ a0-41 1668) v1-27)
)
(let ((v1-29 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 402 4)))
(a0-44 #x70000000)
)
(s.w! (+ a0-44 1672) v1-29)
)
(let ((v1-31 (+ (the-as uint decompress-fixed-data-to-accumulator) (* 100 4)))
(a0-47 #x70000000)
)
(s.w! (+ a0-47 1676) v1-31)
)
(let ((v1-33 (+ (the-as uint decompress-frame-data-to-accumulator) (* 84 4)))
(a0-50 #x70000000)
)
(s.w! (+ a0-50 1680) v1-33)
)
(let ((v1-35 (+ (the-as uint decompress-frame-data-to-accumulator) (* 92 4)))
(a0-53 #x70000000)
)
(s.w! (+ a0-53 1684) v1-35)
)
(let ((v1-37 (+ (the-as uint decompress-frame-data-to-accumulator) (* 119 4)))
(a0-56 #x70000000)
)
(s.w! (+ a0-56 1688) v1-37)
)
(let ((v1-39 (+ (the-as uint decompress-frame-data-to-accumulator) (* 140 4)))
(a0-59 #x70000000)
)
(s.w! (+ a0-59 1692) v1-39)
)
(let ((v1-41 (+ (the-as uint decompress-frame-data-to-accumulator) (* 205 4)))
(a0-62 #x70000000)
)
(s.w! (+ a0-62 1696) v1-41)
)
(let ((v1-43 (+ (the-as uint decompress-frame-data-to-accumulator) (* 220 4)))
(a0-65 #x70000000)
)
(s.w! (+ a0-65 1700) v1-43)
)
(let ((v1-45 (+ (the-as uint decompress-frame-data-to-accumulator) (* 273 4)))
(a0-68 #x70000000)
)
(s.w! (+ a0-68 1704) v1-45)
)
(let ((v1-47 (+ (the-as uint decompress-frame-data-to-accumulator) (* 307 4)))
(a0-71 #x70000000)
)
(s.w! (+ a0-71 1708) v1-47)
)
(let ((v1-49 (+ (the-as uint decompress-frame-data-to-accumulator) (* 84 4)))
(a0-74 #x70000000)
)
(s.w! (+ a0-74 1712) v1-49)
)
(let ((v1-51 (+ (the-as uint decompress-frame-data-to-accumulator) (* 107 4)))
(a0-77 #x70000000)
)
(s.w! (+ a0-77 1716) v1-51)
)
(let ((v1-53 (+ (the-as uint decompress-frame-data-to-accumulator) (* 119 4)))
(a0-80 #x70000000)
)
(s.w! (+ a0-80 1720) v1-53)
)
(let ((v1-55 (+ (the-as uint decompress-frame-data-to-accumulator) (* 174 4)))
(a0-83 #x70000000)
)
(s.w! (+ a0-83 1724) v1-55)
)
(let ((v1-57 (+ (the-as uint decompress-frame-data-to-accumulator) (* 205 4)))
(a0-86 #x70000000)
)
(s.w! (+ a0-86 1728) v1-57)
)
(let ((v1-59 (+ (the-as uint decompress-frame-data-to-accumulator) (* 248 4)))
(a0-89 #x70000000)
)
(s.w! (+ a0-89 1732) v1-59)
)
(let ((v1-61 (+ (the-as uint decompress-frame-data-to-accumulator) (* 273 4)))
(a0-92 #x70000000)
)
(s.w! (+ a0-92 1736) v1-61)
)
(let ((v1-63 (+ (the-as uint decompress-frame-data-to-accumulator) (* 354 4)))
(a0-95 #x70000000)
)
(s.w! (+ a0-95 1740) v1-63)
)
(let ((v1-65 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 117 4)))
(a0-98 #x70000000)
)
(s.w! (+ a0-98 1744) v1-65)
)
(let ((v1-67 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 125 4)))
(a0-101 #x70000000)
)
(s.w! (+ a0-101 1748) v1-67)
)
(let ((v1-69 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 169 4)))
(a0-104 #x70000000)
)
(s.w! (+ a0-104 1752) v1-69)
)
(let ((v1-71 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 197 4)))
(a0-107 #x70000000)
)
(s.w! (+ a0-107 1756) v1-71)
)
(let ((v1-73 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 293 4)))
(a0-110 #x70000000)
)
(s.w! (+ a0-110 1760) v1-73)
)
(let ((v1-75 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 318 4)))
(a0-113 #x70000000)
)
(s.w! (+ a0-113 1764) v1-75)
)
(let ((v1-77 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 408 4)))
(a0-116 #x70000000)
)
(s.w! (+ a0-116 1768) v1-77)
)
(let ((v1-79 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 459 4)))
(a0-119 #x70000000)
)
(s.w! (+ a0-119 1772) v1-79)
)
(let ((v1-81 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 117 4)))
(a0-122 #x70000000)
)
(s.w! (+ a0-122 1776) v1-81)
)
(let ((v1-83 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 150 4)))
(a0-125 #x70000000)
)
(s.w! (+ a0-125 1780) v1-83)
)
(let ((v1-85 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 169 4)))
(a0-128 #x70000000)
)
(s.w! (+ a0-128 1784) v1-85)
)
(let ((v1-87 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 248 4)))
(a0-131 #x70000000)
)
(s.w! (+ a0-131 1788) v1-87)
)
(let ((v1-89 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 293 4)))
(a0-134 #x70000000)
)
(s.w! (+ a0-134 1792) v1-89)
)
(let ((v1-91 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 366 4)))
(a0-137 #x70000000)
)
(s.w! (+ a0-137 1796) v1-91)
)
(let ((v1-93 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 408 4)))
(a0-140 #x70000000)
)
(s.w! (+ a0-140 1800) v1-93)
)
(let ((v1-95 (+ (the-as uint decompress-frame-data-pair-to-accumulator) (* 533 4)))
(a0-143 #x70000000)
)
(s.w! (+ a0-143 1804) v1-95)
)
0
)
;; definition for function calc-animation-from-spr
;; INFO: function output is handled by mips2c
(def-mips2c calc-animation-from-spr (function joint-anim-frame int none))
;; definition for function create-interpolated-joint-animation-frame
(defun create-interpolated-joint-animation-frame ((dst joint-anim-frame) (num-joints int) (jc joint-control))
(flatten-joint-control-to-spr jc)
(make-joint-jump-tables)
(calc-animation-from-spr dst num-joints)
0
)
;; definition for function create-interpolated2-joint-animation-frame
;; INFO: Used lq/sq
(defun create-interpolated2-joint-animation-frame ((dst joint-anim-frame) (num-joints int) (jc joint-control))
(flush-cache 0)
(if (and (zero? (-> jc interp-select 0)) (zero? (-> jc interp-select 1)))
(return (create-interpolated-joint-animation-frame dst num-joints jc))
)
(set! (-> jc active-frame-interp) (the-as uint 1))
(flatten-joint-control-to-spr jc)
(make-joint-jump-tables)
(calc-animation-from-spr dst num-joints)
(dma-send-from-spr-no-flush
(the-as uint *gsf-buffer*)
(the-as uint dst)
(the-as uint (/ (+ (* 48 num-joints) 128) 16))
#f
)
(set! (-> jc active-frame-interp) (the-as uint 0))
(flatten-joint-control-to-spr jc)
(make-joint-jump-tables)
(calc-animation-from-spr dst num-joints)
(let ((v1-9 (the-as joint-anim-frame *gsf-buffer*)))
(let ((a0-9 (-> jc interp-select 0)))
(dotimes (a1-5 2)
(when (logtest? a0-9 1)
(let* ((a2-7 (the-as object (-> dst matrices a1-5)))
(t2-0 (the-as (inline-array vector) (-> v1-9 matrices a1-5)))
(a3-3 (-> t2-0 0 quad))
(t0-0 (-> t2-0 1 quad))
(t1-0 (-> t2-0 2 quad))
(t2-1 (-> t2-0 3 quad))
)
(set! (-> (the-as (inline-array vector) a2-7) 0 quad) a3-3)
(set! (-> (the-as (inline-array vector) a2-7) 1 quad) t0-0)
(set! (-> (the-as (inline-array vector) a2-7) 2 quad) t1-0)
(set! (-> (the-as (inline-array vector) a2-7) 3 quad) t2-1)
)
)
(set! a0-9 (shr a0-9 1))
)
(let ((a1-9 (min 62 (+ num-joints -2))))
(dotimes (a2-9 a1-9)
(when (logtest? a0-9 1)
(let* ((a3-9 (-> dst data a2-9))
(t2-2 (-> v1-9 data a2-9))
(t0-4 (-> t2-2 trans quad))
(t1-1 (-> t2-2 quat quad))
(t2-3 (-> t2-2 scale quad))
)
(set! (-> a3-9 trans quad) t0-4)
(set! (-> a3-9 quat quad) t1-1)
(set! (-> a3-9 scale quad) t2-3)
)
)
(set! a0-9 (shr a0-9 1))
)
)
)
(let ((a0-13 (min 64 (+ num-joints -64)))
(a1-11 (-> jc interp-select 1))
)
(dotimes (a2-10 a0-13)
(when (logtest? a1-11 1)
(let* ((a3-15 (-> dst data (+ a2-10 62)))
(t2-4 (-> v1-9 data (+ a2-10 62)))
(t0-9 (-> t2-4 trans quad))
(t1-3 (-> t2-4 quat quad))
(t2-5 (-> t2-4 scale quad))
)
(set! (-> a3-15 trans quad) t0-9)
(set! (-> a3-15 quat quad) t1-3)
(set! (-> a3-15 scale quad) t2-5)
)
)
(set! a1-11 (shr a1-11 1))
)
)
)
0
)
;; definition for method 2 of type art-joint-anim-manager-slot
(defmethod print ((this art-joint-anim-manager-slot))
(let* ((gp-0 format)
(s5-0 #t)
(s4-0 "#<slot ~48S #x~8X #x~8X ~4DK ~D>")
(v1-0 (-> this anim))
(s3-0 (if v1-0
(-> v1-0 name)
)
)
(s1-0 (-> this comp-data))
(v1-1 (-> this anim))
)
(gp-0
s5-0
s4-0
s3-0
s1-0
(if v1-1
(-> v1-1 frames fixed)
0
)
(if (-> this anim)
(sar
(used-bytes-for-slot
*anim-manager*
(the-as int (/ (the-as int (- (the-as uint this) (the-as uint (the-as uint (-> *anim-manager* slot))))) 16))
)
10
)
0
)
(-> this time-stamp)
)
)
this
)
;; definition for method 12 of type art-joint-anim-manager
(defmethod used-bytes-for-slot ((this art-joint-anim-manager) (arg0 int))
"Get how many bytes of our heap are used by the given anim slot."
(let ((v1-2 (-> this slot arg0)))
(if (< arg0 (+ (-> this free-index) -1))
(&-
(the-as pointer (-> this slot (+ arg0 1) anim frames fixed))
(the-as uint (the-as pointer (-> v1-2 anim frames fixed)))
)
(&- (the-as pointer (-> this heap current)) (the-as uint (the-as pointer (-> v1-2 anim frames fixed))))
)
)
)
;; definition for method 11 of type art-joint-anim-manager
(defmethod unload-from-slot ((this art-joint-anim-manager) (arg0 int))
"Remove the given animation from the cache."
(let* ((s3-0 (-> this slot arg0))
(s5-0 (-> s3-0 anim))
)
(let ((s2-0 (the-as object (-> s5-0 frames fixed))))
(if (= (-> *display* base-clock frame-counter) (-> s3-0 time-stamp))
(format 0 "ERROR: anim-decomp: removing cache entry for ~A, but it is still in use.~%" s5-0)
)
(let ((a0-5 (-> s3-0 comp-data))
(v1-6 (-> s5-0 frames))
)
(set! (-> v1-6 fixed) (the-as joint-anim-compressed-fixed a0-5))
(dotimes (a1-2 (the-as int (-> v1-6 num-frames)))
(set! (-> v1-6 data a1-2)
(the-as
joint-anim-compressed-frame
(+ a0-5 (* (+ (-> v1-6 fixed-qwc) (* (the-as uint a1-2) (-> v1-6 frame-qwc))) 16))
)
)
)
(logior! (-> v1-6 flags) 1)
(logand! (-> v1-6 flags) -3)
)
(cond
((< arg0 (+ (-> this free-index) -1))
(let ((s1-0 (- (the-as uint (-> this slot (+ arg0 1) anim frames fixed)) (the-as uint s2-0))))
(let ((s0-0 (+ (- -1 arg0) (-> this free-index))))
(let ((a2-6 (&- (-> this heap current) (the-as uint (+ (the-as uint s2-0) s1-0)))))
(if #t
(qmem-copy<-! (the-as pointer s2-0) (the-as pointer (+ (the-as uint s2-0) s1-0)) (the-as int a2-6))
(ultimate-memcpy (the-as pointer s2-0) (the-as pointer (+ (the-as uint s2-0) s1-0)) (the-as uint a2-6))
)
)
(qmem-copy<-! (the-as pointer s3-0) (the-as pointer (&+ s3-0 16)) (* s0-0 16))
(dotimes (v1-21 s0-0)
(let ((a0-21 (-> this slot (+ arg0 v1-21) anim frames)))
(set! (-> a0-21 fixed) (the-as joint-anim-compressed-fixed (- (the-as uint (-> a0-21 fixed)) s1-0)))
(dotimes (a1-9 (the-as int (-> a0-21 num-frames)))
(set! (-> a0-21 data a1-9) (the-as joint-anim-compressed-frame (- (the-as uint (-> a0-21 data a1-9)) s1-0)))
)
)
)
)
(set! s3-0 (-> this slot (+ (-> this free-index) -1)))
(set! (-> this heap current) (&- (-> this heap current) (the-as uint s1-0)))
)
)
(else
(set! (-> this heap current) (the-as pointer s2-0))
)
)
)
(+! (-> this free-index) -1)
(set! (-> s3-0 anim) #f)
(set! (-> s3-0 time-stamp) (the-as uint 0))
(set! (-> s3-0 comp-data) (the-as uint 0))
s5-0
)
)
;; definition for method 10 of type art-joint-anim-manager
(defmethod mark-anim-in-use ((this art-joint-anim-manager) (arg0 art-joint-anim))
"Inform the cache this animation is in used, so it is not evicted."
(countdown (v1-0 (-> this free-index))
(when (= arg0 (-> this slot v1-0 anim))
(set! (-> this slot v1-0 time-stamp) (the-as uint (-> *display* base-clock frame-counter)))
(return arg0)
)
)
arg0
)
;; definition for method 9 of type art-joint-anim-manager
(defmethod decompress ((this art-joint-anim-manager) (arg0 art-joint-anim))
"Decompress the given animation and store the decompressed data in this cache."
(let* ((s5-0 (-> arg0 frames))
(s3-0 (* (+ (-> s5-0 fixed-qwc) (* (-> s5-0 num-frames) (-> s5-0 frame-qwc))) 16))
)
(while (or (< (the-as uint (&- (-> this heap top) (the-as uint (-> this heap current)))) (+ s3-0 64))
(>= (-> this free-index) 64)
)
(let ((a1-2 -1))
(let ((a0-3 0))
(dotimes (v1-2 (-> this free-index))
(when (or (< a1-2 0) (< (the-as int (-> this slot v1-2 time-stamp)) a0-3))
(set! a0-3 (the-as int (-> this slot v1-2 time-stamp)))
(set! a1-2 v1-2)
)
)
)
(unload-from-slot this a1-2)
)
)
(let ((v1-15 (-> this slot (-> this free-index))))
0
(+! (-> this free-index) 1)
(set! (-> v1-15 anim) arg0)
(set! (-> v1-15 time-stamp) (the-as uint (-> *display* base-clock frame-counter)))
(set! (-> v1-15 comp-data) (the-as uint (-> s5-0 fixed)))
)
(let ((s4-1 (kmalloc (-> this heap) (the-as int s3-0) (kmalloc-flags) "malloc")))
(unpack-comp-lzo (the-as (pointer uint8) s4-1) (the-as (pointer uint8) (-> s5-0 fixed)))
(logand! (-> s5-0 flags) -2)
(logior! (-> s5-0 flags) 2)
(set! (-> s5-0 fixed) (the-as joint-anim-compressed-fixed s4-1))
(dotimes (v1-22 (the-as int (-> s5-0 num-frames)))
(set! (-> s5-0 data v1-22)
(the-as
joint-anim-compressed-frame
(&+ s4-1 (* (+ (-> s5-0 fixed-qwc) (* (the-as uint v1-22) (-> s5-0 frame-qwc))) 16))
)
)
)
)
)
(flush-cache 0)
arg0
)
;; definition for method 13 of type art-joint-anim-manager
;; WARN: Return type mismatch int vs none.
(defmethod unload-from-heap ((this art-joint-anim-manager) (arg0 kheap))
"Remove all animations which have their original compressed data in the given heap."
(let ((s5-0 (-> arg0 base))
(s4-0 (-> arg0 top-base))
)
(countdown (s3-0 (-> this free-index))
(if (and (>= (the-as int (-> this slot s3-0 anim)) (the-as int s5-0))
(< (the-as int (-> this slot s3-0 anim)) (the-as int s4-0))
)
(unload-from-slot this s3-0)
)
)
)
0
(none)
)
;; failed to figure out what this is:
(kmemopen global "anim-manager")
;; definition for symbol *anim-manager*, type art-joint-anim-manager
(define *anim-manager* (new 'global 'art-joint-anim-manager #x30000))
;; failed to figure out what this is:
(kmemclose)