mirror of
https://github.com/open-goal/jak-project
synced 2026-07-30 16:04:33 -04:00
cd68cb671e
Major change to how `deftype` shows up in our code: - the decompiler will no longer emit the `offset-assert`, `method-count-assert`, `size-assert` and `flag-assert` parameters. There are extremely few cases where having this in the decompiled code is helpful, as the types there come from `all-types` which already has those parameters. This also doesn't break type consistency because: - the asserts aren't compared. - the first step of the test uses `all-types`, which has the asserts, which will throw an error if they're bad. - the decompiler won't emit the `heap-base` parameter unless necessary now. - the decompiler will try its hardest to turn a fixed-offset field into an `overlay-at` field. It falls back to the old offset if all else fails. - `overlay-at` now supports field "dereferencing" to specify the offset that's within a field that's a structure, e.g.: ```lisp (deftype foobar (structure) ((vec vector :inline) (flags int32 :overlay-at (-> vec w)) ) ) ``` in this structure, the offset of `flags` will be 12 because that is the final offset of `vec`'s `w` field within this structure. - **removed ID from all method declarations.** IDs are only ever automatically assigned now. Fixes #3068. - added an `:overlay` parameter to method declarations, in order to declare a new method that goes on top of a previously-defined method. Syntax is `:overlay <method-name>`. Please do not ever use this. - added `state-methods` list parameter. This lets you quickly specify a list of states to be put in the method table. Same syntax as the `states` list parameter. The decompiler will try to put as many states in this as it can without messing with the method ID order. Also changes `defmethod` to make the first type definition (before the arguments) optional. The type can now be inferred from the first argument. Fixes #3093. --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
153 lines
4.4 KiB
Common Lisp
153 lines
4.4 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: joint-h.gc
|
|
;; name in dgo: joint-h
|
|
;; dgos: ENGINE, GAME
|
|
|
|
(declare-type joint-control basic)
|
|
|
|
(defenum joint-control-status
|
|
:type uint16
|
|
:bitfield #t
|
|
|
|
(sync-math 0) ;; 1
|
|
(spooling 1) ;; 2
|
|
(spooling-not-last-block 2) ;; 4
|
|
(blend-shape 3) ;; 8
|
|
(math-when-off-screen 4) ;; 16
|
|
(valid-spooled-frame 5) ;; 32
|
|
(blend-shape-valid 6) ;; 64
|
|
(eye-anim-valid 7) ;; 128
|
|
(eye-anim 8) ;; 256
|
|
)
|
|
;; +++joint-control-command
|
|
(defenum joint-control-command
|
|
:type int64
|
|
(zero 0)
|
|
(push 1)
|
|
(blend 2)
|
|
(joint-control-command-4 4)
|
|
(eight 8)
|
|
(push1 19)
|
|
(thirty-two 32)
|
|
(stack 36)
|
|
(float 42)
|
|
(stack1 52)
|
|
)
|
|
;; ---joint-control-command
|
|
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(deftype joint-control-channel (structure)
|
|
((parent joint-control)
|
|
(frame-group art-joint-anim)
|
|
(frame-num float)
|
|
(dist meters)
|
|
(num-func (function joint-control-channel float float float float))
|
|
(param float 3)
|
|
(frame-interp float 2)
|
|
(inspector-amount uint8)
|
|
(command joint-control-command)
|
|
(group-sub-index int8)
|
|
(group-size int8)
|
|
(eval-time uint32)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype top-anim-joint-control (basic)
|
|
((process (pointer process-drawable))
|
|
(interp-select uint64 2)
|
|
(base-anim basic)
|
|
(base-anim-speed float)
|
|
(base-anim-blend float)
|
|
(interp float)
|
|
(frame-group art-joint-anim)
|
|
(frame-group-push art-joint-anim)
|
|
(frame-num float)
|
|
(frame-targ art-joint-anim)
|
|
(frame-speed float)
|
|
(frame-blend float)
|
|
(frame-cur-blend float)
|
|
(frame-start float)
|
|
(frame-post-blend float)
|
|
(frame-post-end float)
|
|
(frame-push-time time-frame)
|
|
(frame-post-put-away basic)
|
|
(update-time time-frame)
|
|
)
|
|
(:methods
|
|
(new (symbol type process-drawable) _type_)
|
|
(reset (_type_) none)
|
|
(update (_type_) none)
|
|
(get-channel (_type_ int) joint-control-channel)
|
|
(push-anim-to-targ (_type_ art-joint-anim float int int float float symbol) none)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype joint-control (basic)
|
|
((status joint-control-status)
|
|
(allocated-length uint8)
|
|
(active-channels uint8)
|
|
(root-channel (inline-array joint-control-channel) :offset 16)
|
|
(blend-index uint8)
|
|
(active-frame-interp uint8)
|
|
(float-channels uint8)
|
|
(generate-frame-function (function joint-anim-frame int joint-control int))
|
|
(prebind-function (function joint-anim-frame int joint-control int))
|
|
(postbind-function (function draw-control cspace-array joint-control none))
|
|
(effect effect-control)
|
|
(interp-select int64 2)
|
|
(top-anim top-anim-joint-control)
|
|
(override (array float))
|
|
(channel joint-control-channel :inline :dynamic)
|
|
)
|
|
(:methods
|
|
(new (symbol type int) _type_)
|
|
(current-cycle-distance (_type_) float)
|
|
(update-anim-data (_type_) none)
|
|
(debug-print-channels (_type_ symbol) int)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype matrix-stack (structure)
|
|
((top matrix)
|
|
(data matrix 24 :inline)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype channel-upload-info (structure)
|
|
((fixed joint-anim-compressed-fixed)
|
|
(fixed-qwc int32)
|
|
(frame joint-anim-compressed-frame)
|
|
(frame-qwc int32)
|
|
(amount float)
|
|
(interp float)
|
|
)
|
|
:pack-me
|
|
)
|
|
|
|
|
|
(deftype joint-work (structure)
|
|
((temp-mtx matrix :inline)
|
|
(joint-stack matrix-stack :inline)
|
|
(fix-jmp-table (function none) 16)
|
|
(frm-jmp-table (function none) 16)
|
|
(pair-jmp-table (function none) 16)
|
|
(uploads channel-upload-info 24 :inline)
|
|
(num-uploads int32)
|
|
(mtx-acc matrix 2 :inline)
|
|
(tq-acc transformq 100 :inline)
|
|
(jacp-hdr joint-anim-compressed-hdr :inline)
|
|
(fixed-data joint-anim-compressed-fixed :inline)
|
|
(frame-data joint-anim-compressed-frame 2 :inline)
|
|
(flatten-array float 576 :overlay-at mtx-acc)
|
|
(flattened vector 24 :overlay-at mtx-acc)
|
|
)
|
|
)
|