mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -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>
91 lines
2.6 KiB
Common Lisp
91 lines
2.6 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: drawable-tree.gc
|
|
;; name in dgo: drawable-tree
|
|
;; dgos: ENGINE, GAME
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(defmethod draw ((this drawable-tree-array) (arg0 drawable-tree-array) (arg1 display-frame))
|
|
(case (-> *level* draw-level *draw-index* display?)
|
|
(('special #f)
|
|
)
|
|
(else
|
|
(dotimes (idx (-> this length))
|
|
(draw (-> this trees idx) (-> arg0 trees idx) arg1)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod collect-stats ((this drawable-tree-array))
|
|
(dotimes (idx (-> this length))
|
|
(collect-stats (-> this trees idx))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod debug-draw ((this drawable-tree-array) (arg0 drawable) (arg1 display-frame))
|
|
(dotimes (idx (-> this length))
|
|
(debug-draw (-> this trees idx) (-> (the-as drawable-tree-array arg0) trees idx) arg1)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod unpack-vis ((this drawable-tree) (arg0 (pointer int8)) (arg1 (pointer int8)))
|
|
(local-vars (t5-1 uint))
|
|
(let* ((v1-0 (the-as drawable-inline-array-node (-> this data 0)))
|
|
(a3-1 (/ (-> v1-0 data 0 id) 8))
|
|
(t0-0 (-> v1-0 length))
|
|
(v1-1 (&+ arg0 a3-1))
|
|
(a3-3 (/ (+ t0-0 7) 8))
|
|
)
|
|
(dotimes (t0-1 a3-3)
|
|
(let ((t1-0 (-> arg1 0)))
|
|
(set! arg1 (&-> arg1 1))
|
|
(set! (-> v1-1 0) t1-0)
|
|
)
|
|
(set! v1-1 (&-> v1-1 1))
|
|
)
|
|
)
|
|
(let ((v1-5 (+ (-> this length) -1)))
|
|
(when (nonzero? v1-5)
|
|
(dotimes (a3-5 v1-5)
|
|
(let* ((t0-4 (-> this data a3-5))
|
|
(t2-0 (the-as drawable-inline-array-node (-> this data (+ a3-5 1))))
|
|
(t1-5 (/ (-> (the-as drawable-inline-array-node t0-4) data 0 id) 8))
|
|
(t2-2 (/ (-> t2-0 data 0 id) 8))
|
|
(t0-5 (-> (the-as drawable-inline-array-node t0-4) length))
|
|
(t1-6 (&+ arg0 t1-5))
|
|
(t2-3 (the-as object (&+ arg0 t2-2)))
|
|
)
|
|
(loop
|
|
(let ((t3-0 (-> t1-6 0)))
|
|
(set! t1-6 (&-> t1-6 1))
|
|
(let ((t4-0 128))
|
|
(label cfg-7)
|
|
(b! (not (logtest? t3-0 t4-0)) cfg-9 :delay (set! t5-1 (the-as uint (-> arg1 0))))
|
|
(set! arg1 (&-> arg1 1))
|
|
(set! (-> (the-as (pointer int8) t2-3) 0) (the-as int t5-1))
|
|
(label cfg-9)
|
|
(+! t0-5 -1)
|
|
(b! (zero? t0-5) cfg-12 :delay (shift-arith-right-32 t4-0 t4-0 1))
|
|
(b! (nonzero? (the-as uint t4-0)) cfg-7 :delay (set! t2-3 (&-> (the-as (pointer int8) t2-3) 1)))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(label cfg-12)
|
|
(nop!)
|
|
0
|
|
)
|
|
)
|
|
)
|
|
arg1
|
|
)
|