mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -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>
126 lines
4.2 KiB
Common Lisp
126 lines
4.2 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: collide-cache-h.gc
|
|
;; name in dgo: collide-cache-h
|
|
;; dgos: ENGINE, GAME
|
|
|
|
(declare-type collide-query structure)
|
|
(declare-type instance-tie basic)
|
|
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(deftype collide-puss-sphere (structure)
|
|
((bsphere sphere :inline)
|
|
(bbox4w bounding-box4w :inline)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype collide-puss-work (structure)
|
|
((closest-pt vector :inline)
|
|
(tri-normal vector :inline)
|
|
(tri-bbox4w bounding-box4w :inline)
|
|
(spheres-bbox4w bounding-box4w :inline)
|
|
(spheres collide-puss-sphere 64 :inline)
|
|
)
|
|
(:methods
|
|
(collide-puss-work-method-9 () none)
|
|
(collide-puss-work-method-10 () none)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype collide-cache-tri (structure)
|
|
((vertex vector 3 :inline)
|
|
(extra-quad uint8 16)
|
|
(pat pat-surface :overlay-at (-> extra-quad 0))
|
|
(collide-ptr basic :overlay-at (-> extra-quad 4))
|
|
(prim-index uint16 :overlay-at (-> extra-quad 8))
|
|
(user16 uint16 :overlay-at (-> extra-quad 10))
|
|
(user32 uint32 :overlay-at (-> extra-quad 12))
|
|
(clear-flags uint128 :overlay-at (-> extra-quad 0))
|
|
)
|
|
)
|
|
|
|
|
|
(deftype collide-cache-prim (structure)
|
|
((prim-core collide-prim-core :inline)
|
|
(extra-quad uint8 16)
|
|
(ccache collide-cache :overlay-at (-> extra-quad 0))
|
|
(prim collide-shape-prim :overlay-at (-> extra-quad 4))
|
|
(first-tri uint16 :overlay-at (-> extra-quad 8))
|
|
(num-tris uint16 :overlay-at (-> extra-quad 10))
|
|
(unused uint8 4 :overlay-at (-> extra-quad 12))
|
|
(world-sphere vector :inline :overlay-at (-> prim-core world-sphere))
|
|
(collide-as collide-spec :overlay-at (-> prim-core collide-as))
|
|
(action collide-action :overlay-at (-> prim-core action))
|
|
(prim-type prim-type :overlay-at (-> prim-core prim-type))
|
|
)
|
|
(:methods
|
|
(resolve-moving-sphere-tri (_type_ collide-tri-result collide-prim-core vector float collide-action) float)
|
|
(resolve-moving-sphere-sphere (_type_ collide-tri-result collide-prim-core vector float collide-action) float)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype collide-cache (basic)
|
|
((num-tris int32)
|
|
(num-tris-u32 uint32 :overlay-at num-tris)
|
|
(num-prims int32)
|
|
(num-prims-u32 uint32 :overlay-at num-prims)
|
|
(ignore-mask pat-surface)
|
|
(ignore-processes process 2)
|
|
(collide-box bounding-box :inline)
|
|
(collide-box4w bounding-box4w :inline)
|
|
(collide-with collide-spec)
|
|
(unused uint32)
|
|
(prims collide-cache-prim 100 :inline)
|
|
(tris collide-cache-tri 461 :inline)
|
|
)
|
|
(:methods
|
|
(debug-draw (_type_) none)
|
|
(fill-and-probe-using-line-sphere (_type_ collide-query) float)
|
|
(fill-and-probe-using-spheres (_type_ collide-query) symbol)
|
|
(fill-using-bounding-box (_type_ collide-query) none)
|
|
(fill-using-line-sphere (_type_ collide-query) none)
|
|
(fill-using-spheres (_type_ collide-query) none)
|
|
(reset (_type_) none)
|
|
(probe-using-line-sphere (_type_ collide-query) float)
|
|
(probe-using-spheres (_type_ collide-query) symbol)
|
|
(fill-from-bg (_type_ (function collide-hash int collide-list collide-query int) (function collide-cache collide-list collide-query none) collide-query) none)
|
|
(fill-from-fg-boxes (_type_) none)
|
|
(fill-from-fg-line-sphere (_type_ collide-query) none)
|
|
(fill-from-water (_type_ water-control) none)
|
|
(collide-cache-method-22 () none)
|
|
(collide-cache-method-23 () none)
|
|
(collide-cache-method-24 () none)
|
|
(collide-cache-method-25 () none)
|
|
)
|
|
)
|
|
|
|
|
|
(deftype collide-list-item (structure)
|
|
((mesh instance-tie)
|
|
(inst basic)
|
|
)
|
|
:pack-me
|
|
)
|
|
|
|
|
|
(deftype collide-list (structure)
|
|
((num-items int32)
|
|
(items collide-list-item 256 :inline :offset 16)
|
|
)
|
|
)
|
|
|
|
|
|
(kmemopen global "collide-cache")
|
|
|
|
(define-perm *collide-cache* collide-cache (new 'global 'collide-cache))
|
|
|
|
(define-perm *collide-list* collide-list (new 'global 'collide-list))
|
|
|
|
(kmemclose)
|