mirror of
https://github.com/open-goal/jak-project
synced 2026-06-09 20:50:55 -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>
261 lines
10 KiB
Common Lisp
Vendored
Generated
261 lines
10 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type collide-using-spheres-params
|
|
(deftype collide-using-spheres-params (structure)
|
|
((spheres (inline-array sphere))
|
|
(num-spheres uint32)
|
|
(collide-with collide-kind)
|
|
(proc process-drawable)
|
|
(ignore-pat pat-surface)
|
|
(solid-only basic)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-using-spheres-params
|
|
(defmethod inspect ((this collide-using-spheres-params))
|
|
(format #t "[~8x] ~A~%" this 'collide-using-spheres-params)
|
|
(format #t "~Tspheres: #x~X~%" (-> this spheres))
|
|
(format #t "~Tnum-spheres: ~D~%" (-> this num-spheres))
|
|
(format #t "~Tcollide-with: ~D~%" (-> this collide-with))
|
|
(format #t "~Tproc: ~A~%" (-> this proc))
|
|
(format #t "~Tignore-pat: ~D~%" (-> this ignore-pat))
|
|
(format #t "~Tsolid-only: ~A~%" (-> this solid-only))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-puss-sphere
|
|
(deftype collide-puss-sphere (structure)
|
|
((bsphere sphere :inline)
|
|
(bbox4w bounding-box4w :inline)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-puss-sphere
|
|
(defmethod inspect ((this collide-puss-sphere))
|
|
(format #t "[~8x] ~A~%" this 'collide-puss-sphere)
|
|
(format #t "~Tbsphere: #<sphere @ #x~X>~%" (-> this bsphere))
|
|
(format #t "~Tbbox4w: #<bounding-box4w @ #x~X>~%" (-> this bbox4w))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-puss-work
|
|
(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 (_type_ object object) symbol)
|
|
(collide-puss-work-method-10 (_type_ object object) symbol)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-puss-work
|
|
(defmethod inspect ((this collide-puss-work))
|
|
(format #t "[~8x] ~A~%" this 'collide-puss-work)
|
|
(format #t "~Tclosest-pt: #<vector @ #x~X>~%" (-> this closest-pt))
|
|
(format #t "~Ttri-normal: #<vector @ #x~X>~%" (-> this tri-normal))
|
|
(format #t "~Ttri-bbox4w: #<bounding-box4w @ #x~X>~%" (-> this tri-bbox4w))
|
|
(format #t "~Tspheres-bbox4w: #<bounding-box4w @ #x~X>~%" (-> this spheres-bbox4w))
|
|
(format #t "~Tspheres[64] @ #x~X~%" (-> this spheres))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-puyp-work
|
|
(deftype collide-puyp-work (structure)
|
|
((best-u float)
|
|
(ignore-pat pat-surface)
|
|
(tri-out collide-tri-result)
|
|
(start-pos vector :inline)
|
|
(move-dist vector :inline)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-puyp-work
|
|
(defmethod inspect ((this collide-puyp-work))
|
|
(format #t "[~8x] ~A~%" this 'collide-puyp-work)
|
|
(format #t "~Tbest-u: ~f~%" (-> this best-u))
|
|
(format #t "~Tignore-pat: ~D~%" (-> this ignore-pat))
|
|
(format #t "~Ttri-out: #<collide-tri-result @ #x~X>~%" (-> this tri-out))
|
|
(format #t "~Tstart-pos: #<vector @ #x~X>~%" (-> this start-pos))
|
|
(format #t "~Tmove-dist: #<vector @ #x~X>~%" (-> this move-dist))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-cache-tri
|
|
(deftype collide-cache-tri (structure)
|
|
((vertex vector 3 :inline)
|
|
(extra-quad uint128 :offset 48)
|
|
(pat pat-surface :overlay-at extra-quad)
|
|
(prim-index uint16 :offset 52)
|
|
(user16 uint16 :offset 54)
|
|
(user32 uint32 2 :offset 56)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-cache-tri
|
|
(defmethod inspect ((this collide-cache-tri))
|
|
(format #t "[~8x] ~A~%" this 'collide-cache-tri)
|
|
(format #t "~Tvertex[3] @ #x~X~%" (-> this vertex))
|
|
(format #t "~Textra-quad[16] @ #x~X~%" (&-> this extra-quad))
|
|
(format #t "~Tpat: ~D~%" (-> this pat))
|
|
(format #t "~Tprim-index: ~D~%" (-> this prim-index))
|
|
(format #t "~Tuser16: ~D~%" (-> this user16))
|
|
(format #t "~Tuser32[2] @ #x~X~%" (-> this user32))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-cache-prim
|
|
(deftype collide-cache-prim (structure)
|
|
((prim-core collide-prim-core :inline)
|
|
(extra-quad uint128)
|
|
(ccache collide-cache :overlay-at extra-quad)
|
|
(prim collide-shape-prim :offset 36)
|
|
(first-tri uint16 :offset 40)
|
|
(num-tris uint16 :offset 42)
|
|
(unused uint8 4 :offset 44)
|
|
(world-sphere vector :inline :overlay-at (-> prim-core world-sphere))
|
|
(collide-as collide-kind :overlay-at (-> prim-core collide-as))
|
|
(action collide-action :overlay-at (-> prim-core action))
|
|
(offense collide-offense :overlay-at (-> prim-core offense))
|
|
(prim-type int8 :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)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-cache-prim
|
|
(defmethod inspect ((this collide-cache-prim))
|
|
(format #t "[~8x] ~A~%" this 'collide-cache-prim)
|
|
(format #t "~Tprim-core: #<collide-prim-core @ #x~X>~%" (-> this prim-core))
|
|
(format #t "~Textra-quad[16] @ #x~X~%" (&-> this extra-quad))
|
|
(format #t "~Tccache: ~A~%" (-> this ccache))
|
|
(format #t "~Tprim: ~A~%" (-> this prim))
|
|
(format #t "~Tfirst-tri: ~D~%" (-> this first-tri))
|
|
(format #t "~Tnum-tris: ~D~%" (-> this num-tris))
|
|
(format #t "~Tunused[4] @ #x~X~%" (-> this unused))
|
|
(format #t "~Tworld-sphere: ~`vector`P~%" (-> this prim-core))
|
|
(format #t "~Tcollide-as: ~D~%" (-> this prim-core collide-as))
|
|
(format #t "~Taction: ~D~%" (-> this prim-core action))
|
|
(format #t "~Toffense: ~D~%" (-> this prim-core offense))
|
|
(format #t "~Tprim-type: ~D~%" (-> this prim-core prim-type))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-cache
|
|
(deftype collide-cache (basic)
|
|
((num-tris int32)
|
|
(num-prims int32)
|
|
(num-prims-u uint32 :overlay-at num-prims)
|
|
(ignore-mask pat-surface)
|
|
(proc process-drawable)
|
|
(collide-box bounding-box :inline)
|
|
(collide-box4w bounding-box4w :inline)
|
|
(collide-with collide-kind)
|
|
(prims collide-cache-prim 100 :inline)
|
|
(tris collide-cache-tri 461 :inline)
|
|
)
|
|
(:methods
|
|
(debug-draw (_type_) none)
|
|
(fill-and-probe-using-line-sphere (_type_ vector vector float collide-kind process collide-tri-result pat-surface) float)
|
|
(fill-and-probe-using-spheres (_type_ collide-using-spheres-params) symbol)
|
|
(fill-and-probe-using-y-probe (_type_ vector float collide-kind process-drawable collide-tri-result pat-surface) float)
|
|
(fill-using-bounding-box (_type_ bounding-box collide-kind process-drawable pat-surface) none)
|
|
(fill-using-line-sphere (_type_ vector vector float collide-kind process-drawable pat-surface) none)
|
|
(fill-using-spheres (_type_ collide-using-spheres-params) none)
|
|
(fill-using-y-probe (_type_ vector float collide-kind process-drawable pat-surface) none)
|
|
(initialize (_type_) none)
|
|
(probe-using-line-sphere (_type_ vector vector float collide-kind collide-tri-result pat-surface) float)
|
|
(probe-using-spheres (_type_ collide-using-spheres-params) symbol)
|
|
(probe-using-y-probe (_type_ vector float collide-kind collide-tri-result pat-surface) float)
|
|
(fill-from-background (_type_ (function bsp-header int collide-list none) (function collide-cache object none)) none)
|
|
(fill-from-foreground-using-box (_type_) none)
|
|
(fill-from-foreground-using-line-sphere (_type_) none)
|
|
(fill-from-foreground-using-y-probe (_type_) none)
|
|
(fill-from-water (_type_ water-control) none)
|
|
(load-mesh-from-spad-in-box (_type_ collide-frag-mesh) none)
|
|
(collide-cache-method-27 (_type_) none)
|
|
(collide-cache-method-28 (_type_) none)
|
|
(collide-cache-method-29 (_type_ collide-frag-mesh) none)
|
|
(puyp-mesh (_type_ collide-puyp-work collide-cache-prim) none)
|
|
(puyp-sphere (_type_ collide-puyp-work collide-cache-prim) vector)
|
|
(unpack-background-collide-mesh (_type_ object object object) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-cache
|
|
(defmethod inspect ((this collide-cache))
|
|
(format #t "[~8x] ~A~%" this (-> this type))
|
|
(format #t "~Tnum-tris: ~D~%" (-> this num-tris))
|
|
(format #t "~Tnum-prims: ~D~%" (-> this num-prims))
|
|
(format #t "~Tignore-mask: ~D~%" (-> this ignore-mask))
|
|
(format #t "~Tproc: ~A~%" (-> this proc))
|
|
(format #t "~Tcollide-box: #<bounding-box @ #x~X>~%" (-> this collide-box))
|
|
(format #t "~Tcollide-box4w: #<bounding-box4w @ #x~X>~%" (-> this collide-box4w))
|
|
(format #t "~Tcollide-with: ~D~%" (-> this collide-with))
|
|
(format #t "~Tprims[100] @ #x~X~%" (-> this prims))
|
|
(format #t "~Ttris[461] @ #x~X~%" (-> this tris))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-list-item
|
|
(deftype collide-list-item (structure)
|
|
((mesh collide-frag-mesh)
|
|
(inst basic)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-list-item
|
|
(defmethod inspect ((this collide-list-item))
|
|
(format #t "[~8x] ~A~%" this 'collide-list-item)
|
|
(format #t "~Tmesh: ~A~%" (-> this mesh))
|
|
(format #t "~Tinst: ~A~%" (-> this inst))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-list
|
|
(deftype collide-list (structure)
|
|
((num-items int32)
|
|
(items collide-list-item 256 :inline)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-list
|
|
(defmethod inspect ((this collide-list))
|
|
(format #t "[~8x] ~A~%" this 'collide-list)
|
|
(format #t "~Tnum-items: ~D~%" (-> this num-items))
|
|
(format #t "~Titems[256] @ #x~X~%" (-> this items))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-work
|
|
(deftype collide-work (structure)
|
|
((collide-sphere-neg-r sphere :inline)
|
|
(collide-box4w bounding-box4w :inline)
|
|
(inv-mat matrix :inline)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-work
|
|
(defmethod inspect ((this collide-work))
|
|
(format #t "[~8x] ~A~%" this 'collide-work)
|
|
(format #t "~Tcollide-sphere-neg-r: #<sphere @ #x~X>~%" (-> this collide-sphere-neg-r))
|
|
(format #t "~Tcollide-box4w: #<bounding-box4w @ #x~X>~%" (-> this collide-box4w))
|
|
(format #t "~Tinv-mat: #<matrix @ #x~X>~%" (-> this inv-mat))
|
|
this
|
|
)
|
|
|
|
;; definition (perm) for symbol *collide-work*, type collide-work
|
|
(define-perm *collide-work* collide-work (new 'global 'collide-work))
|
|
|
|
;; definition (perm) for symbol *collide-cache*, type collide-cache
|
|
(define-perm *collide-cache* collide-cache (new 'global 'collide-cache))
|
|
|
|
;; definition (perm) for symbol *collide-list*, type collide-list
|
|
(define-perm *collide-list* collide-list (new 'global 'collide-list))
|