mirror of
https://github.com/open-goal/jak-project
synced 2026-08-17 05:31:46 -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>
236 lines
12 KiB
Common Lisp
Vendored
Generated
236 lines
12 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type edge-grab-info
|
|
(deftype edge-grab-info (structure)
|
|
((world-vertex vector 6 :inline)
|
|
(local-vertex vector 6 :inline)
|
|
(actor-cshape-prim-offset int32)
|
|
(actor-handle handle)
|
|
(hanging-matrix matrix :inline)
|
|
(edge-vertex vector 2 :inline :overlay-at (-> world-vertex 0))
|
|
(center-hold vector :inline :overlay-at (-> world-vertex 2))
|
|
(tri-vertex vector 3 :inline :overlay-at (-> world-vertex 3))
|
|
(left-hand-hold vector :inline)
|
|
(right-hand-hold vector :inline)
|
|
(center-hold-old vector :inline)
|
|
(edge-tri-pat uint32)
|
|
)
|
|
(:methods
|
|
(edge-grab-info-method-9 (_type_) symbol)
|
|
(debug-draw (_type_) symbol)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type edge-grab-info
|
|
(defmethod inspect ((this edge-grab-info))
|
|
(format #t "[~8x] ~A~%" this 'edge-grab-info)
|
|
(format #t "~Tworld-vertex[6] @ #x~X~%" (-> this world-vertex))
|
|
(format #t "~Tlocal-vertex[6] @ #x~X~%" (-> this local-vertex))
|
|
(format #t "~Tactor-cshape-prim-offset: ~D~%" (-> this actor-cshape-prim-offset))
|
|
(format #t "~Tactor-handle: ~D~%" (-> this actor-handle))
|
|
(format #t "~Thanging-matrix: #<matrix @ #x~X>~%" (-> this hanging-matrix))
|
|
(format #t "~Tedge-vertex[2] @ #x~X~%" (-> this world-vertex))
|
|
(format #t "~Tcenter-hold: ~`vector`P~%" (-> this center-hold))
|
|
(format #t "~Ttri-vertex[3] @ #x~X~%" (-> this tri-vertex))
|
|
(format #t "~Tleft-hand-hold: #<vector @ #x~X>~%" (-> this left-hand-hold))
|
|
(format #t "~Tright-hand-hold: #<vector @ #x~X>~%" (-> this right-hand-hold))
|
|
(format #t "~Tcenter-hold-old: ~`vector`P~%" (-> this center-hold-old))
|
|
(format #t "~Tedge-tri-pat: ~D~%" (-> this edge-tri-pat))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-edge-tri
|
|
(deftype collide-edge-tri (structure)
|
|
((ctri collide-cache-tri)
|
|
(normal vector :inline)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-edge-tri
|
|
(defmethod inspect ((this collide-edge-tri))
|
|
(format #t "[~8x] ~A~%" this 'collide-edge-tri)
|
|
(format #t "~Tctri: #<collide-cache-tri @ #x~X>~%" (-> this ctri))
|
|
(format #t "~Tnormal: #<vector @ #x~X>~%" (-> this normal))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-edge-edge
|
|
(deftype collide-edge-edge (structure)
|
|
((ignore basic)
|
|
(etri collide-edge-tri)
|
|
(vertex-ptr (inline-array vector) 2)
|
|
(outward vector :inline)
|
|
(edge-vec-norm vector :inline)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-edge-edge
|
|
(defmethod inspect ((this collide-edge-edge))
|
|
(format #t "[~8x] ~A~%" this 'collide-edge-edge)
|
|
(format #t "~Tignore: ~A~%" (-> this ignore))
|
|
(format #t "~Tetri: #<collide-edge-tri @ #x~X>~%" (-> this etri))
|
|
(format #t "~Tvertex-ptr[2] @ #x~X~%" (-> this vertex-ptr))
|
|
(format #t "~Toutward: #<vector @ #x~X>~%" (-> this outward))
|
|
(format #t "~Tedge-vec-norm: #<vector @ #x~X>~%" (-> this edge-vec-norm))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-edge-hold-item
|
|
(deftype collide-edge-hold-item (structure)
|
|
((next collide-edge-hold-item)
|
|
(rating float)
|
|
(split int8)
|
|
(edge collide-edge-edge)
|
|
(center-pt vector :inline)
|
|
(outward-pt vector :inline)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-edge-hold-item
|
|
(defmethod inspect ((this collide-edge-hold-item))
|
|
(format #t "[~8x] ~A~%" this 'collide-edge-hold-item)
|
|
(format #t "~Tnext: #<collide-edge-hold-item @ #x~X>~%" (-> this next))
|
|
(format #t "~Trating: ~f~%" (-> this rating))
|
|
(format #t "~Tsplit: ~D~%" (-> this split))
|
|
(format #t "~Tedge: #<collide-edge-edge @ #x~X>~%" (-> this edge))
|
|
(format #t "~Tcenter-pt: #<vector @ #x~X>~%" (-> this center-pt))
|
|
(format #t "~Toutward-pt: #<vector @ #x~X>~%" (-> this outward-pt))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-edge-hold-list
|
|
(deftype collide-edge-hold-list (structure)
|
|
((num-allocs uint32)
|
|
(num-attempts uint32)
|
|
(head collide-edge-hold-item)
|
|
(items collide-edge-hold-item 32 :inline)
|
|
(attempts qword 32 :inline)
|
|
)
|
|
(:methods
|
|
(debug-draw (_type_) object)
|
|
(add-to-list! (_type_ collide-edge-hold-item) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-edge-hold-list
|
|
(defmethod inspect ((this collide-edge-hold-list))
|
|
(format #t "[~8x] ~A~%" this 'collide-edge-hold-list)
|
|
(format #t "~Tnum-allocs: ~D~%" (-> this num-allocs))
|
|
(format #t "~Tnum-attempts: ~D~%" (-> this num-attempts))
|
|
(format #t "~Thead: #<collide-edge-hold-item @ #x~X>~%" (-> this head))
|
|
(format #t "~Titems[32] @ #x~X~%" (-> this items))
|
|
(format #t "~Tattempts[32] @ #x~X~%" (-> this attempts))
|
|
this
|
|
)
|
|
|
|
;; definition of type collide-edge-work
|
|
(deftype collide-edge-work (structure)
|
|
((ccache collide-cache)
|
|
(cshape collide-shape)
|
|
(num-verts uint32)
|
|
(num-edges uint32)
|
|
(num-tris uint32)
|
|
(cache-fill-box bounding-box :inline)
|
|
(within-reach-box bounding-box :inline)
|
|
(within-reach-box4w bounding-box4w :inline)
|
|
(search-pt vector :inline)
|
|
(search-dir-vec vector :inline)
|
|
(max-dist-sqrd-to-outward-pt float)
|
|
(max-dir-cosa-delta float)
|
|
(split-dists float 2)
|
|
(outward-offset vector :inline)
|
|
(local-cache-fill-box bounding-box :inline)
|
|
(local-within-reach-box bounding-box :inline)
|
|
(local-player-spheres sphere 12 :inline)
|
|
(world-player-spheres sphere 12 :inline)
|
|
(local-player-hanging-spheres sphere 6 :inline :overlay-at (-> local-player-spheres 0))
|
|
(world-player-hanging-spheres sphere 6 :inline :overlay-at (-> world-player-spheres 0))
|
|
(local-player-leap-up-spheres sphere 6 :inline :overlay-at (-> local-player-spheres 6))
|
|
(world-player-leap-up-spheres sphere 6 :inline :overlay-at (-> world-player-spheres 6))
|
|
(verts vector 64 :inline)
|
|
(edges collide-edge-edge 96 :inline)
|
|
(tris collide-edge-tri 48 :inline)
|
|
(hold-list collide-edge-hold-list :inline)
|
|
)
|
|
(:methods
|
|
(search-for-edges (_type_ collide-edge-hold-list) symbol)
|
|
(debug-draw-edges (_type_) object)
|
|
(debug-draw-tris (_type_) none)
|
|
(debug-draw-sphere (_type_) symbol)
|
|
(compute-center-point! (_type_ collide-edge-edge vector) float)
|
|
(collide-edge-work-method-14 (_type_ vector vector int) float)
|
|
(find-grabbable-edges! (_type_) none)
|
|
(find-grabbable-tris! (_type_) none)
|
|
(should-add-to-list? (_type_ collide-edge-hold-item collide-edge-edge) symbol)
|
|
(find-best-grab! (_type_ collide-edge-hold-list edge-grab-info) symbol)
|
|
(check-grab-for-collisions (_type_ collide-edge-hold-item edge-grab-info) symbol)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type collide-edge-work
|
|
(defmethod inspect ((this collide-edge-work))
|
|
(format #t "[~8x] ~A~%" this 'collide-edge-work)
|
|
(format #t "~Tccache: ~A~%" (-> this ccache))
|
|
(format #t "~Tcshape: ~A~%" (-> this cshape))
|
|
(format #t "~Tnum-verts: ~D~%" (-> this num-verts))
|
|
(format #t "~Tnum-edges: ~D~%" (-> this num-edges))
|
|
(format #t "~Tnum-tris: ~D~%" (-> this num-tris))
|
|
(format #t "~Tcache-fill-box: #<bounding-box @ #x~X>~%" (-> this cache-fill-box))
|
|
(format #t "~Twithin-reach-box: #<bounding-box @ #x~X>~%" (-> this within-reach-box))
|
|
(format #t "~Twithin-reach-box4w: #<bounding-box4w @ #x~X>~%" (-> this within-reach-box4w))
|
|
(format #t "~Tsearch-pt: #<vector @ #x~X>~%" (-> this search-pt))
|
|
(format #t "~Tsearch-dir-vec: #<vector @ #x~X>~%" (-> this search-dir-vec))
|
|
(format #t "~Tmax-dist-sqrd-to-outward-pt: ~f~%" (-> this max-dist-sqrd-to-outward-pt))
|
|
(format #t "~Tmax-dir-cosa-delta: ~f~%" (-> this max-dir-cosa-delta))
|
|
(format #t "~Tsplit-dists[2] @ #x~X~%" (-> this split-dists))
|
|
(format #t "~Toutward-offset: #<vector @ #x~X>~%" (-> this outward-offset))
|
|
(format #t "~Tlocal-cache-fill-box: #<bounding-box @ #x~X>~%" (-> this local-cache-fill-box))
|
|
(format #t "~Tlocal-within-reach-box: #<bounding-box @ #x~X>~%" (-> this local-within-reach-box))
|
|
(format #t "~Tlocal-player-spheres[12] @ #x~X~%" (-> this local-player-spheres))
|
|
(format #t "~Tworld-player-spheres[12] @ #x~X~%" (-> this world-player-spheres))
|
|
(format #t "~Tlocal-player-hanging-spheres[6] @ #x~X~%" (-> this local-player-spheres))
|
|
(format #t "~Tworld-player-hanging-spheres[6] @ #x~X~%" (-> this world-player-spheres))
|
|
(format #t "~Tlocal-player-leap-up-spheres[6] @ #x~X~%" (-> this local-player-leap-up-spheres))
|
|
(format #t "~Tworld-player-leap-up-spheres[6] @ #x~X~%" (-> this world-player-leap-up-spheres))
|
|
(format #t "~Tverts[64] @ #x~X~%" (-> this verts))
|
|
(format #t "~Tedges[96] @ #x~X~%" (-> this edges))
|
|
(format #t "~Ttris[48] @ #x~X~%" (-> this tris))
|
|
(format #t "~Thold-list: #<collide-edge-hold-list @ #x~X>~%" (-> this hold-list))
|
|
this
|
|
)
|
|
|
|
;; definition for symbol *collide-edge-work*, type collide-edge-work
|
|
(define *collide-edge-work* (new 'static 'collide-edge-work
|
|
:max-dist-sqrd-to-outward-pt 37748736.0
|
|
:max-dir-cosa-delta 0.6
|
|
:split-dists (new 'static 'array float 2 1024.0 1433.6)
|
|
:outward-offset (new 'static 'vector :x 708.608 :y 13312.0 :w 1.0)
|
|
:local-cache-fill-box (new 'static 'bounding-box
|
|
:min (new 'static 'vector :x -8192.0 :y -11059.2 :z -8192.0 :w 1.0)
|
|
:max (new 'static 'vector :x 8192.0 :y 24576.0 :z 8192.0 :w 1.0)
|
|
)
|
|
:local-within-reach-box (new 'static 'bounding-box
|
|
:min (new 'static 'vector :x -6144.0 :y 5324.8 :z -6144.0 :w 1.0)
|
|
:max (new 'static 'vector :x 6144.0 :y 11059.2 :z 6144.0 :w 1.0)
|
|
)
|
|
:local-player-spheres (new 'static 'inline-array sphere 12
|
|
(new 'static 'sphere :x 1720.32 :y -819.2 :w 1433.6)
|
|
(new 'static 'sphere :x 2293.76 :y -3276.8 :w 1884.16)
|
|
(new 'static 'sphere :x 1966.08 :y -6144.0 :w 1556.48)
|
|
(new 'static 'sphere :x 1966.08 :y -8601.6 :w 1556.48)
|
|
(new 'static 'sphere :x 1761.28 :y -11059.2 :w 1351.68)
|
|
(new 'static 'sphere :x 1679.36 :y -13312.0 :w 1269.76)
|
|
(new 'static 'sphere :x -737.28 :y 4096.0 :w 3072.0)
|
|
(new 'static 'sphere :x -737.28 :y 6553.6 :w 3072.0)
|
|
(new 'static 'sphere :x -737.28 :y 9420.8 :w 3072.0)
|
|
(new 'static 'sphere :x 1720.32 :y 3686.4 :w 2949.12)
|
|
(new 'static 'sphere :x 1720.32 :y 5734.4 :w 2949.12)
|
|
(new 'static 'sphere :x 1720.32 :y 8601.6 :w 2949.12)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition (perm) for symbol *edge-grab-info*, type edge-grab-info
|
|
(define-perm *edge-grab-info* edge-grab-info (new 'global 'edge-grab-info))
|