Decompile joint, collide-func, clean up joint decompression code for all games (#3369)

I finally read through all the joint code and wrote up some
documentation. I think this will be really helpful when we try to
understand all the functions in `process-drawable`, or if somebody ever
wants to import/export animations.

This switches all three games to using a new faster GOAL joint
decompressor. It is on by default, but you can go back to the old
version by setting `*use-new-decompressor*` to false.

Also fix the log-related crash, fix the clock speed used in timer math.
This commit is contained in:
water111
2024-02-11 09:50:07 -05:00
committed by GitHub
parent a4e629ebf9
commit 79d14af0b5
32 changed files with 8951 additions and 129 deletions
+4 -4
View File
@@ -157,13 +157,13 @@ Multiple channels are used to blend animations together."
(interp-select int64 2)
(top-anim top-anim-joint-control)
(override (array float))
(channel joint-control-channel :dynamic)
(channel joint-control-channel :inline :dynamic)
)
(:methods
(new (symbol type) _type_)
(new (symbol type int) _type_)
(joint-control-method-9 () none)
(joint-control-method-10 () none)
(joint-control-method-11 () none)
(debug-print-channels (_type_ symbol) int)
(joint-control-method-12 () none)
)
)
@@ -232,7 +232,7 @@ Multiple channels are used to blend animations together."
(format #t "~1Toverride: ~A~%" (-> this override))
(format #t "~1Tchannel[0] @ #x~X~%" (-> this channel))
(dotimes (s5-2 (the-as int (-> this active-channels)))
(format #t "~T [~D]~1Tchannel: ~`joint-control-channel`P~%" s5-2 (+ (+ (* s5-2 64) 60) (the-as int this)))
(format #t "~T [~D]~1Tchannel: ~`joint-control-channel`P~%" s5-2 (-> this channel s5-2))
)
(label cfg-32)
this
File diff suppressed because it is too large Load Diff
+13 -11
View File
@@ -234,7 +234,7 @@ This can be either an art container containing more arts, or an actual art thing
(art-method-10 (_type_) _type_)
(get-art-by-name-method (_type_ string type) basic)
(get-art-idx-by-name-method (_type_ string type) int)
(needs-link? (_type_) symbol)
(contains-art-for-other-group? (_type_) symbol)
)
)
@@ -280,7 +280,8 @@ This can be either an art container containing more arts, or an actual art thing
;; definition of type art-mesh-anim
(deftype art-mesh-anim (art-element)
"An unused mesh animation."
()
((data basic :dynamic)
)
)
;; definition of type art-joint-anim
@@ -325,8 +326,8 @@ actor, like the mesh, animations, shadow mesh, skeleton, etc."
(data art-element :dynamic :offset 32)
)
(:methods
(relocate (_type_ kheap (pointer uint8)) _type_ :replace)
(link-art! (_type_) art-group)
(relocate (_type_ kheap (pointer uint8)) none :replace)
(link-art-to-master (_type_) none)
(unknown-1 () none)
)
)
@@ -334,13 +335,14 @@ actor, like the mesh, animations, shadow mesh, skeleton, etc."
;; definition of type art-mesh-geo
(deftype art-mesh-geo (art-element)
"Unused art format for a mesh. This might have been for the renderer that came before merc."
()
((data basic :dynamic)
)
)
;; definition of type art-joint-geo
(deftype art-joint-geo (art-element)
"Collection of joints for an actor."
((data joint :dynamic :offset 48)
((data joint :dynamic)
)
)
@@ -417,11 +419,11 @@ This is used for short, commonly used animations that always remain in RAM."
)
(:methods
(new (symbol type int) _type_)
(art-joint-anim-manager-method-9 () none)
(art-joint-anim-manager-method-10 () none)
(art-joint-anim-manager-method-11 () none)
(art-joint-anim-manager-method-12 () none)
(art-joint-anim-manager-method-13 () none)
(decompress (_type_ art-joint-anim) art-joint-anim)
(mark-anim-in-use (_type_ art-joint-anim) art-joint-anim)
(unload-from-slot (_type_ int) art-joint-anim)
(used-bytes-for-slot (_type_ int) int)
(unload-from-heap (_type_ kheap) none)
)
)
@@ -108,8 +108,8 @@
(let ((a1-5 (/ (&- (the-as pointer chan) (the-as uint (the-as pointer (-> v1-0 channel)))) 64)))
(if (< a1-5 (the-as int (+ (-> v1-0 active-channels) (-> v1-0 float-channels))))
(qmem-copy<-!
(the-as pointer (+ (+ (* a1-5 64) 60) (the-as int v1-0)))
(the-as pointer (+ (+ (* (+ a1-5 1) 64) 60) (the-as int v1-0)))
(the-as pointer (-> v1-0 channel a1-5))
(the-as pointer (-> v1-0 channel (+ a1-5 1)))
(the-as int (* (-> v1-0 float-channels) 64))
)
)
@@ -187,7 +187,3 @@
;; failed to figure out what this is:
0
+2 -1
View File
@@ -6,7 +6,8 @@
"skip_compile_files": [
"types-h", // weird array of types.
"hfrag-h" // weird duplicate type
"hfrag-h", // weird duplicate type
"joint"
],
"skip_compile_functions": [