mirror of
https://github.com/open-goal/jak-project
synced 2026-09-12 04:49:19 -04:00
deftype and defmethod syntax major changes (#3094)
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>
This commit is contained in:
+15
-24
@@ -12,15 +12,12 @@
|
||||
|
||||
;; definition of type actor-cshape-ptr
|
||||
(deftype actor-cshape-ptr (structure)
|
||||
((cshape collide-shape :offset-assert 0)
|
||||
((cshape collide-shape)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x4
|
||||
:flag-assert #x900000004
|
||||
)
|
||||
|
||||
;; definition for method 3 of type actor-cshape-ptr
|
||||
(defmethod inspect actor-cshape-ptr ((this actor-cshape-ptr))
|
||||
(defmethod inspect ((this actor-cshape-ptr))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -33,21 +30,18 @@
|
||||
|
||||
;; definition of type actor-hash-bucket
|
||||
(deftype actor-hash-bucket (structure)
|
||||
((length int16 :offset-assert 0)
|
||||
(max-length int16 :offset-assert 2)
|
||||
(data (inline-array actor-cshape-ptr) :offset-assert 4)
|
||||
((length int16)
|
||||
(max-length int16)
|
||||
(data (inline-array actor-cshape-ptr))
|
||||
)
|
||||
:allow-misaligned
|
||||
:method-count-assert 10
|
||||
:size-assert #x8
|
||||
:flag-assert #xa00000008
|
||||
(:methods
|
||||
(add-actor-cshape (_type_ collide-shape) none 9)
|
||||
(add-actor-cshape (_type_ collide-shape) none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type actor-hash-bucket
|
||||
(defmethod inspect actor-hash-bucket ((this actor-hash-bucket))
|
||||
(defmethod inspect ((this actor-hash-bucket))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -62,7 +56,7 @@
|
||||
|
||||
;; definition for method 9 of type actor-hash-bucket
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod add-actor-cshape actor-hash-bucket ((this actor-hash-bucket) (arg0 collide-shape))
|
||||
(defmethod add-actor-cshape ((this actor-hash-bucket) (arg0 collide-shape))
|
||||
(let ((v1-0 (-> this length)))
|
||||
(when (< v1-0 (-> this max-length))
|
||||
(set! (-> this data v1-0 cshape) arg0)
|
||||
@@ -75,21 +69,18 @@
|
||||
|
||||
;; definition of type actor-hash-buckets
|
||||
(deftype actor-hash-buckets (structure)
|
||||
((hash spatial-hash :offset-assert 0)
|
||||
(list engine :offset-assert 4)
|
||||
(data actor-hash-bucket 4 :inline :offset-assert 8)
|
||||
(tpos vector :inline :offset-assert 80)
|
||||
((hash spatial-hash)
|
||||
(list engine)
|
||||
(data actor-hash-bucket 4 :inline)
|
||||
(tpos vector :inline)
|
||||
)
|
||||
:method-count-assert 10
|
||||
:size-assert #x60
|
||||
:flag-assert #xa00000060
|
||||
(:methods
|
||||
(hash-actors (_type_) none 9)
|
||||
(hash-actors (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type actor-hash-buckets
|
||||
(defmethod inspect actor-hash-buckets ((this actor-hash-buckets))
|
||||
(defmethod inspect ((this actor-hash-buckets))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -106,7 +97,7 @@
|
||||
;; definition for method 9 of type actor-hash-buckets
|
||||
;; INFO: Used lq/sq
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod hash-actors actor-hash-buckets ((this actor-hash-buckets))
|
||||
(defmethod hash-actors ((this actor-hash-buckets))
|
||||
(local-vars (sv-16 hash-object-info) (sv-32 collide-prim-core) (sv-48 collide-shape) (sv-64 hash-object-info))
|
||||
(set! (-> this hash) *actor-hash*)
|
||||
(set! (-> this list) *collide-hit-by-others-list*)
|
||||
|
||||
+56
-80
@@ -18,18 +18,15 @@
|
||||
|
||||
;; definition of type collide-hash-scratch
|
||||
(deftype collide-hash-scratch (structure)
|
||||
((collidable-bits uint128 128 :offset-assert 0)
|
||||
(poly-bits uint64 2 :offset 0)
|
||||
(id-bits uint32 512 :offset 0)
|
||||
(tris uint32 :offset-assert 2048)
|
||||
((collidable-bits uint128 128)
|
||||
(poly-bits uint64 2 :overlay-at (-> collidable-bits 0))
|
||||
(id-bits uint32 512 :overlay-at (-> collidable-bits 0))
|
||||
(tris uint32)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x804
|
||||
:flag-assert #x900000804
|
||||
)
|
||||
|
||||
;; definition for method 3 of type collide-hash-scratch
|
||||
(defmethod inspect collide-hash-scratch ((this collide-hash-scratch))
|
||||
(defmethod inspect ((this collide-hash-scratch))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -45,16 +42,13 @@
|
||||
|
||||
;; definition of type collide-hash-bucket
|
||||
(deftype collide-hash-bucket (structure)
|
||||
((index int16 :offset-assert 0)
|
||||
(count int16 :offset-assert 2)
|
||||
((index int16)
|
||||
(count int16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x4
|
||||
:flag-assert #x900000004
|
||||
)
|
||||
|
||||
;; definition for method 3 of type collide-hash-bucket
|
||||
(defmethod inspect collide-hash-bucket ((this collide-hash-bucket))
|
||||
(defmethod inspect ((this collide-hash-bucket))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -68,17 +62,14 @@
|
||||
|
||||
;; definition of type collide-hash-item
|
||||
(deftype collide-hash-item (structure)
|
||||
((id uint32 :offset-assert 0)
|
||||
(collidable basic :offset-assert 4)
|
||||
((id uint32)
|
||||
(collidable basic)
|
||||
)
|
||||
:pack-me
|
||||
:method-count-assert 9
|
||||
:size-assert #x8
|
||||
:flag-assert #x900000008
|
||||
)
|
||||
|
||||
;; definition for method 3 of type collide-hash-item
|
||||
(defmethod inspect collide-hash-item ((this collide-hash-item))
|
||||
(defmethod inspect ((this collide-hash-item))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -92,20 +83,17 @@
|
||||
|
||||
;; definition of type collide-hash-poly
|
||||
(deftype collide-hash-poly (structure)
|
||||
((data uint8 4 :offset-assert 0)
|
||||
(vert-index0 uint8 :offset 0)
|
||||
(vert-index1 uint8 :offset 1)
|
||||
(vert-index2 uint8 :offset 2)
|
||||
(pat-index uint8 :offset 3)
|
||||
(word uint32 :offset 0)
|
||||
((data uint8 4)
|
||||
(vert-index0 uint8 :overlay-at (-> data 0))
|
||||
(vert-index1 uint8 :overlay-at (-> data 1))
|
||||
(vert-index2 uint8 :overlay-at (-> data 2))
|
||||
(pat-index uint8 :overlay-at (-> data 3))
|
||||
(word uint32 :overlay-at (-> data 0))
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x4
|
||||
:flag-assert #x900000004
|
||||
)
|
||||
|
||||
;; definition for method 3 of type collide-hash-poly
|
||||
(defmethod inspect collide-hash-poly ((this collide-hash-poly))
|
||||
(defmethod inspect ((this collide-hash-poly))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -123,18 +111,15 @@
|
||||
|
||||
;; definition of type collide-hash-fragment-stats
|
||||
(deftype collide-hash-fragment-stats (structure)
|
||||
((num-verts uint16 :offset-assert 0)
|
||||
(num-polys uint8 :offset-assert 2)
|
||||
(poly-count uint8 :offset-assert 3)
|
||||
((num-verts uint16)
|
||||
(num-polys uint8)
|
||||
(poly-count uint8)
|
||||
)
|
||||
:pack-me
|
||||
:method-count-assert 9
|
||||
:size-assert #x4
|
||||
:flag-assert #x900000004
|
||||
)
|
||||
|
||||
;; definition for method 3 of type collide-hash-fragment-stats
|
||||
(defmethod inspect collide-hash-fragment-stats ((this collide-hash-fragment-stats))
|
||||
(defmethod inspect ((this collide-hash-fragment-stats))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -149,31 +134,28 @@
|
||||
|
||||
;; definition of type collide-hash-fragment
|
||||
(deftype collide-hash-fragment (drawable)
|
||||
((num-buckets uint16 :offset 4)
|
||||
(num-indices uint16 :offset 6)
|
||||
(pat-array uint32 :offset 8)
|
||||
(bucket-array uint32 :offset 12)
|
||||
(grid-step vector :inline :offset-assert 32)
|
||||
(bbox bounding-box :inline :offset-assert 48)
|
||||
(bbox4w bounding-box4w :inline :offset-assert 80)
|
||||
(axis-scale vector :inline :offset 64)
|
||||
(avg-extents vector :inline :offset 80)
|
||||
(dimension-array uint32 4 :offset 44)
|
||||
(stats collide-hash-fragment-stats :inline :offset 60)
|
||||
(num-verts uint16 :offset 60)
|
||||
(num-polys uint8 :offset 62)
|
||||
(poly-count uint8 :offset 63)
|
||||
(poly-array uint32 :offset 76)
|
||||
(vert-array uint32 :offset 92)
|
||||
(index-array uint32 :offset 108)
|
||||
((num-buckets uint16 :overlay-at id)
|
||||
(num-indices uint16 :offset 6)
|
||||
(pat-array uint32 :offset 8)
|
||||
(bucket-array uint32 :offset 12)
|
||||
(grid-step vector :inline)
|
||||
(bbox bounding-box :inline)
|
||||
(bbox4w bounding-box4w :inline)
|
||||
(axis-scale vector :inline :overlay-at (-> bbox max))
|
||||
(avg-extents vector :inline :overlay-at (-> bbox4w min data 0))
|
||||
(dimension-array uint32 4 :overlay-at (-> grid-step data 3))
|
||||
(stats collide-hash-fragment-stats :inline :overlay-at (-> bbox min data 3))
|
||||
(num-verts uint16 :overlay-at (-> bbox min data 3))
|
||||
(num-polys uint8 :offset 62)
|
||||
(poly-count uint8 :offset 63)
|
||||
(poly-array uint32 :overlay-at (-> bbox max data 3))
|
||||
(vert-array uint32 :overlay-at (-> bbox4w min data 3))
|
||||
(index-array uint32 :overlay-at (-> bbox4w max data 3))
|
||||
)
|
||||
:method-count-assert 17
|
||||
:size-assert #x70
|
||||
:flag-assert #x1100000070
|
||||
)
|
||||
|
||||
;; definition for method 3 of type collide-hash-fragment
|
||||
(defmethod inspect collide-hash-fragment ((this collide-hash-fragment))
|
||||
(defmethod inspect ((this collide-hash-fragment))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -204,15 +186,12 @@
|
||||
|
||||
;; definition of type collide-hash-fragment-array
|
||||
(deftype collide-hash-fragment-array (array)
|
||||
((fragments collide-hash-fragment :dynamic :offset 16)
|
||||
((fragments collide-hash-fragment :dynamic :offset 16)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x10
|
||||
:flag-assert #x900000010
|
||||
)
|
||||
|
||||
;; definition for method 3 of type collide-hash-fragment-array
|
||||
(defmethod inspect collide-hash-fragment-array ((this collide-hash-fragment-array))
|
||||
(defmethod inspect ((this collide-hash-fragment-array))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -228,27 +207,24 @@
|
||||
|
||||
;; definition of type collide-hash
|
||||
(deftype collide-hash (drawable)
|
||||
((num-ids uint16 :offset 4)
|
||||
(id-count uint16 :offset 6)
|
||||
(num-buckets uint32 :offset 8)
|
||||
(qwc-id-bits uint32 :offset 12)
|
||||
(grid-step vector :inline :offset 16)
|
||||
(bbox bounding-box :inline :offset-assert 32)
|
||||
(bbox4w bounding-box4w :inline :offset-assert 64)
|
||||
(axis-scale vector :inline :offset 48)
|
||||
(avg-extents vector :inline :offset 64)
|
||||
(bucket-array uint32 :offset 44)
|
||||
(item-array (inline-array collide-hash-item) :offset 60)
|
||||
(dimension-array uint32 3 :offset 76)
|
||||
(num-items uint32 :offset 92)
|
||||
((num-ids uint16 :overlay-at id)
|
||||
(id-count uint16 :offset 6)
|
||||
(num-buckets uint32 :offset 8)
|
||||
(qwc-id-bits uint32 :offset 12)
|
||||
(grid-step vector :inline :overlay-at bsphere)
|
||||
(bbox bounding-box :inline)
|
||||
(bbox4w bounding-box4w :inline)
|
||||
(axis-scale vector :inline :overlay-at (-> bbox max))
|
||||
(avg-extents vector :inline :overlay-at (-> bbox4w min data 0))
|
||||
(bucket-array uint32 :overlay-at (-> bbox min data 3))
|
||||
(item-array (inline-array collide-hash-item) :overlay-at (-> bbox max data 3))
|
||||
(dimension-array uint32 3 :overlay-at (-> bbox4w min data 3))
|
||||
(num-items uint32 :overlay-at (-> bbox4w max data 3))
|
||||
)
|
||||
:method-count-assert 17
|
||||
:size-assert #x60
|
||||
:flag-assert #x1100000060
|
||||
)
|
||||
|
||||
;; definition for method 3 of type collide-hash
|
||||
(defmethod inspect collide-hash ((this collide-hash))
|
||||
(defmethod inspect ((this collide-hash))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
|
||||
+3
-3
@@ -614,7 +614,7 @@
|
||||
|
||||
;; definition for method 8 of type collide-hash
|
||||
;; INFO: Used lq/sq
|
||||
(defmethod mem-usage collide-hash ((this collide-hash) (arg0 memory-usage-block) (arg1 int))
|
||||
(defmethod mem-usage ((this collide-hash) (arg0 memory-usage-block) (arg1 int))
|
||||
(set! (-> arg0 length) (max 51 (-> arg0 length)))
|
||||
(set! (-> arg0 data 50 name) (symbol->string 'collision))
|
||||
(+! (-> arg0 data 50 count) 1)
|
||||
@@ -641,7 +641,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 8 of type collide-hash-fragment
|
||||
(defmethod mem-usage collide-hash-fragment ((this collide-hash-fragment) (arg0 memory-usage-block) (arg1 int))
|
||||
(defmethod mem-usage ((this collide-hash-fragment) (arg0 memory-usage-block) (arg1 int))
|
||||
(cond
|
||||
((logtest? arg1 1)
|
||||
(set! (-> arg0 length) (max 58 (-> arg0 length)))
|
||||
@@ -688,7 +688,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 8 of type collide-hash-fragment-array
|
||||
(defmethod mem-usage collide-hash-fragment-array ((this collide-hash-fragment-array) (arg0 memory-usage-block) (arg1 int))
|
||||
(defmethod mem-usage ((this collide-hash-fragment-array) (arg0 memory-usage-block) (arg1 int))
|
||||
(set! (-> arg0 length) (max 55 (-> arg0 length)))
|
||||
(set! (-> arg0 data 54 name) (symbol->string 'prototype-collision))
|
||||
(+! (-> arg0 data 54 count) 1)
|
||||
|
||||
+75
-96
@@ -4,24 +4,18 @@
|
||||
;; definition of type grid-hash-word
|
||||
(deftype grid-hash-word (uint8)
|
||||
()
|
||||
:method-count-assert 9
|
||||
:size-assert #x1
|
||||
:flag-assert #x900000001
|
||||
)
|
||||
|
||||
;; definition of type grid-hash-box
|
||||
(deftype grid-hash-box (structure)
|
||||
((min int8 3 :offset-assert 0)
|
||||
(max int8 3 :offset-assert 3)
|
||||
((min int8 3)
|
||||
(max int8 3)
|
||||
)
|
||||
:pack-me
|
||||
:method-count-assert 9
|
||||
:size-assert #x6
|
||||
:flag-assert #x900000006
|
||||
)
|
||||
|
||||
;; definition for method 3 of type grid-hash-box
|
||||
(defmethod inspect grid-hash-box ((this grid-hash-box))
|
||||
(defmethod inspect ((this grid-hash-box))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -35,50 +29,47 @@
|
||||
|
||||
;; definition of type grid-hash
|
||||
(deftype grid-hash (basic)
|
||||
((work grid-hash-work :offset-assert 4)
|
||||
(search-box grid-hash-box :inline :offset-assert 8)
|
||||
(bucket-size int16 :offset-assert 14)
|
||||
(axis-scale float 3 :offset-assert 16)
|
||||
(dimension-array int8 3 :offset-assert 28)
|
||||
(vertical-cell-count int8 :offset-assert 31)
|
||||
(bucket-array (pointer grid-hash-word) :offset-assert 32)
|
||||
(box-min float 3 :offset-assert 36)
|
||||
(box-max float 3 :offset-assert 48)
|
||||
(object-count int16 :offset-assert 60)
|
||||
(bucket-count int16 :offset-assert 62)
|
||||
(min-cell-size float :offset-assert 64)
|
||||
(bucket-memory-size int32 :offset-assert 68)
|
||||
(mem-bucket-array (pointer grid-hash-word) :offset-assert 72)
|
||||
(spr-bucket-array (pointer grid-hash-word) :offset-assert 76)
|
||||
(debug-draw symbol :offset-assert 80)
|
||||
(use-scratch-ram symbol :offset-assert 84)
|
||||
((work grid-hash-work)
|
||||
(search-box grid-hash-box :inline)
|
||||
(bucket-size int16)
|
||||
(axis-scale float 3)
|
||||
(dimension-array int8 3)
|
||||
(vertical-cell-count int8)
|
||||
(bucket-array (pointer grid-hash-word))
|
||||
(box-min float 3)
|
||||
(box-max float 3)
|
||||
(object-count int16)
|
||||
(bucket-count int16)
|
||||
(min-cell-size float)
|
||||
(bucket-memory-size int32)
|
||||
(mem-bucket-array (pointer grid-hash-word))
|
||||
(spr-bucket-array (pointer grid-hash-word))
|
||||
(debug-draw symbol)
|
||||
(use-scratch-ram symbol)
|
||||
)
|
||||
:method-count-assert 25
|
||||
:size-assert #x58
|
||||
:flag-assert #x1900000058
|
||||
(:methods
|
||||
(new (symbol type int) _type_ 0)
|
||||
(update-grid-for-objects-in-box (_type_ int vector vector) none 9)
|
||||
(clear-bucket-array (_type_) none 10)
|
||||
(setup-search-box (_type_ int vector vector vector) none 11)
|
||||
(search-for-point (_type_ vector) (pointer uint8) 12)
|
||||
(search-for-sphere (_type_ vector float) (pointer uint8) 13)
|
||||
(draw (_type_ rgba) none 14)
|
||||
(dump-grid-info (_type_) none 15)
|
||||
(verify-bits-in-bucket (_type_ grid-hash-box grid-hash-box) none 16)
|
||||
(box-of-everything (_type_ object grid-hash-box) none 17)
|
||||
(grid-hash-method-18 (_type_ grid-hash-box int) none 18)
|
||||
(grid-hash-method-19 (_type_ grid-hash-box int) none 19)
|
||||
(do-search! (_type_ grid-hash-box (pointer uint8)) none 20)
|
||||
(set-up-box (_type_ grid-hash-box vector vector) none 21)
|
||||
(sphere-to-grid-box (_type_ grid-hash-box sphere) none 22)
|
||||
(line-sphere-to-grid-box (_type_ grid-hash-box vector vector float) none 23)
|
||||
(update-grid (_type_) none 24)
|
||||
(new (symbol type int) _type_)
|
||||
(update-grid-for-objects-in-box (_type_ int vector vector) none)
|
||||
(clear-bucket-array (_type_) none)
|
||||
(setup-search-box (_type_ int vector vector vector) none)
|
||||
(search-for-point (_type_ vector) (pointer uint8))
|
||||
(search-for-sphere (_type_ vector float) (pointer uint8))
|
||||
(draw (_type_ rgba) none)
|
||||
(dump-grid-info (_type_) none)
|
||||
(verify-bits-in-bucket (_type_ grid-hash-box grid-hash-box) none)
|
||||
(box-of-everything (_type_ object grid-hash-box) none)
|
||||
(grid-hash-method-18 (_type_ grid-hash-box int) none)
|
||||
(grid-hash-method-19 (_type_ grid-hash-box int) none)
|
||||
(do-search! (_type_ grid-hash-box (pointer uint8)) none)
|
||||
(set-up-box (_type_ grid-hash-box vector vector) none)
|
||||
(sphere-to-grid-box (_type_ grid-hash-box sphere) none)
|
||||
(line-sphere-to-grid-box (_type_ grid-hash-box vector vector float) none)
|
||||
(update-grid (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type grid-hash
|
||||
(defmethod inspect grid-hash ((this grid-hash))
|
||||
(defmethod inspect ((this grid-hash))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -107,20 +98,17 @@
|
||||
|
||||
;; definition of type find-nav-sphere-ids-params
|
||||
(deftype find-nav-sphere-ids-params (structure)
|
||||
((bsphere sphere :inline :offset-assert 0)
|
||||
(y-threshold float :offset-assert 16)
|
||||
(len int16 :offset-assert 20)
|
||||
(max-len int16 :offset-assert 22)
|
||||
(mask uint8 :offset-assert 24)
|
||||
(array (pointer uint8) :offset-assert 28)
|
||||
((bsphere sphere :inline)
|
||||
(y-threshold float)
|
||||
(len int16)
|
||||
(max-len int16)
|
||||
(mask uint8)
|
||||
(array (pointer uint8))
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x20
|
||||
:flag-assert #x900000020
|
||||
)
|
||||
|
||||
;; definition for method 3 of type find-nav-sphere-ids-params
|
||||
(defmethod inspect find-nav-sphere-ids-params ((this find-nav-sphere-ids-params))
|
||||
(defmethod inspect ((this find-nav-sphere-ids-params))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -138,31 +126,28 @@
|
||||
|
||||
;; definition of type sphere-hash
|
||||
(deftype sphere-hash (grid-hash)
|
||||
((sphere-array (inline-array sphere) :offset-assert 88)
|
||||
(max-object-count int16 :offset-assert 92)
|
||||
(pad int16 :offset-assert 94)
|
||||
(mem-sphere-array uint32 :offset-assert 96)
|
||||
(spr-sphere-array uint32 :offset-assert 100)
|
||||
((sphere-array (inline-array sphere))
|
||||
(max-object-count int16)
|
||||
(pad int16)
|
||||
(mem-sphere-array uint32)
|
||||
(spr-sphere-array uint32)
|
||||
)
|
||||
:method-count-assert 34
|
||||
:size-assert #x68
|
||||
:flag-assert #x2200000068
|
||||
(:methods
|
||||
(new (symbol type int int) _type_ 0)
|
||||
(clear-objects! (_type_) none 25)
|
||||
(add-a-sphere (_type_ vector) int 26)
|
||||
(add-a-sphere-with-flag (_type_ vector int) int 27)
|
||||
(update-from-spheres (_type_) none 28)
|
||||
(sphere-hash-method-29 (_type_ find-nav-sphere-ids-params int int int) none 29)
|
||||
(find-nav-sphere-ids (_type_ find-nav-sphere-ids-params) none 30)
|
||||
(add-sphere-with-mask-and-id (_type_ vector int int) symbol 31)
|
||||
(sphere-hash-method-32 (_type_ vector vector float int) symbol 32)
|
||||
(remove-by-id (_type_ sphere int) none 33)
|
||||
(new (symbol type int int) _type_)
|
||||
(clear-objects! (_type_) none)
|
||||
(add-a-sphere (_type_ vector) int)
|
||||
(add-a-sphere-with-flag (_type_ vector int) int)
|
||||
(update-from-spheres (_type_) none)
|
||||
(sphere-hash-method-29 (_type_ find-nav-sphere-ids-params int int int) none)
|
||||
(find-nav-sphere-ids (_type_ find-nav-sphere-ids-params) none)
|
||||
(add-sphere-with-mask-and-id (_type_ vector int int) symbol)
|
||||
(sphere-hash-method-32 (_type_ vector vector float int) symbol)
|
||||
(remove-by-id (_type_ sphere int) none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type sphere-hash
|
||||
(defmethod inspect sphere-hash ((this sphere-hash))
|
||||
(defmethod inspect ((this sphere-hash))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -196,15 +181,12 @@
|
||||
|
||||
;; definition of type hash-object-info
|
||||
(deftype hash-object-info (structure)
|
||||
((object basic :offset-assert 0)
|
||||
((object basic)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x4
|
||||
:flag-assert #x900000004
|
||||
)
|
||||
|
||||
;; definition for method 3 of type hash-object-info
|
||||
(defmethod inspect hash-object-info ((this hash-object-info))
|
||||
(defmethod inspect ((this hash-object-info))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -217,27 +199,24 @@
|
||||
|
||||
;; definition of type spatial-hash
|
||||
(deftype spatial-hash (sphere-hash)
|
||||
((object-array (inline-array hash-object-info) :offset-assert 104)
|
||||
(mem-object-array (inline-array hash-object-info) :offset-assert 108)
|
||||
(spr-object-array (inline-array hash-object-info) :offset-assert 112)
|
||||
((object-array (inline-array hash-object-info))
|
||||
(mem-object-array (inline-array hash-object-info))
|
||||
(spr-object-array (inline-array hash-object-info))
|
||||
)
|
||||
:method-count-assert 41
|
||||
:size-assert #x74
|
||||
:flag-assert #x2900000074
|
||||
(:methods
|
||||
(new (symbol type int int) _type_ 0)
|
||||
(add-an-object (_type_ vector hash-object-info) int 34)
|
||||
(fill-actor-list-for-box (_type_ bounding-box (pointer collide-shape) int) int 35)
|
||||
(fill-actor-list-for-sphere (_type_ sphere (pointer collide-shape) int) int 36)
|
||||
(fill-actor-list-for-line-sphere (_type_ vector vector float (pointer collide-shape) int int) int 37)
|
||||
(fill-actor-list-for-vec+r (_type_ vector (pointer collide-shape) int) int 38)
|
||||
(spatial-hash-method-39 (_type_ object hash-object-info) int 39)
|
||||
(validate-objects (_type_) none 40)
|
||||
(new (symbol type int int) _type_)
|
||||
(add-an-object (_type_ vector hash-object-info) int)
|
||||
(fill-actor-list-for-box (_type_ bounding-box (pointer collide-shape) int) int)
|
||||
(fill-actor-list-for-sphere (_type_ sphere (pointer collide-shape) int) int)
|
||||
(fill-actor-list-for-line-sphere (_type_ vector vector float (pointer collide-shape) int int) int)
|
||||
(fill-actor-list-for-vec+r (_type_ vector (pointer collide-shape) int) int)
|
||||
(spatial-hash-method-39 (_type_ object hash-object-info) int)
|
||||
(validate-objects (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type spatial-hash
|
||||
(defmethod inspect spatial-hash ((this spatial-hash))
|
||||
(defmethod inspect ((this spatial-hash))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
|
||||
+32
-35
@@ -3,25 +3,22 @@
|
||||
|
||||
;; definition of type grid-hash-work
|
||||
(deftype grid-hash-work (basic)
|
||||
((result-words uint8 32 :offset 16)
|
||||
(result-bits uint8 32 :offset 16)
|
||||
(object-id int32 :offset-assert 48)
|
||||
(temp-box-min vector :inline :offset-assert 64)
|
||||
(temp-box-max vector :inline :offset-assert 80)
|
||||
(visit-count int32 :offset-assert 96)
|
||||
(temp-time uint32 :offset-assert 100)
|
||||
(queue-object-time uint32 :offset-assert 104)
|
||||
(make-hash-time uint32 :offset-assert 108)
|
||||
(search-time uint32 :offset-assert 112)
|
||||
(add-object-time uint32 :offset-assert 116)
|
||||
((result-words uint8 32 :offset 16)
|
||||
(result-bits uint8 32 :overlay-at (-> result-words 0))
|
||||
(object-id int32)
|
||||
(temp-box-min vector :inline)
|
||||
(temp-box-max vector :inline)
|
||||
(visit-count int32)
|
||||
(temp-time uint32)
|
||||
(queue-object-time uint32)
|
||||
(make-hash-time uint32)
|
||||
(search-time uint32)
|
||||
(add-object-time uint32)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x78
|
||||
:flag-assert #x900000078
|
||||
)
|
||||
|
||||
;; definition for method 3 of type grid-hash-work
|
||||
(defmethod inspect grid-hash-work ((this grid-hash-work))
|
||||
(defmethod inspect ((this grid-hash-work))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
@@ -72,7 +69,7 @@
|
||||
|
||||
;; definition for method 16 of type grid-hash
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod verify-bits-in-bucket grid-hash ((this grid-hash) (arg0 grid-hash-box) (arg1 grid-hash-box))
|
||||
(defmethod verify-bits-in-bucket ((this grid-hash) (arg0 grid-hash-box) (arg1 grid-hash-box))
|
||||
(let ((s5-0 0))
|
||||
0
|
||||
(let ((v1-1 8)
|
||||
@@ -102,7 +99,7 @@
|
||||
|
||||
;; definition for method 17 of type grid-hash
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod box-of-everything grid-hash ((this grid-hash) (arg0 object) (arg1 grid-hash-box))
|
||||
(defmethod box-of-everything ((this grid-hash) (arg0 object) (arg1 grid-hash-box))
|
||||
(dotimes (v1-0 3)
|
||||
(set! (-> arg1 min v1-0) (-> this dimension-array v1-0))
|
||||
(set! (-> arg1 max v1-0) -1)
|
||||
@@ -186,7 +183,7 @@
|
||||
|
||||
;; definition for method 21 of type grid-hash
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod set-up-box grid-hash ((this grid-hash) (arg0 grid-hash-box) (arg1 vector) (arg2 vector))
|
||||
(defmethod set-up-box ((this grid-hash) (arg0 grid-hash-box) (arg1 vector) (arg2 vector))
|
||||
(dotimes (v1-0 3)
|
||||
(set! (-> arg0 min v1-0)
|
||||
(the int
|
||||
@@ -219,7 +216,7 @@
|
||||
;; definition for method 23 of type grid-hash
|
||||
;; INFO: Used lq/sq
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod line-sphere-to-grid-box grid-hash ((this grid-hash) (arg0 grid-hash-box) (arg1 vector) (arg2 vector) (arg3 float))
|
||||
(defmethod line-sphere-to-grid-box ((this grid-hash) (arg0 grid-hash-box) (arg1 vector) (arg2 vector) (arg3 float))
|
||||
(let ((s4-0 (new 'stack-no-clear 'grid-hash-box))
|
||||
(s5-0 (new 'stack-no-clear 'grid-hash-box))
|
||||
)
|
||||
@@ -247,7 +244,7 @@
|
||||
;; definition for method 10 of type grid-hash
|
||||
;; INFO: Used lq/sq
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod clear-bucket-array grid-hash ((this grid-hash))
|
||||
(defmethod clear-bucket-array ((this grid-hash))
|
||||
(let ((v1-5 (/ (+ (* (* (* (-> this dimension-array 0) (-> this dimension-array 1)) (-> this dimension-array 2))
|
||||
(-> this bucket-size)
|
||||
)
|
||||
@@ -271,7 +268,7 @@
|
||||
;; definition for method 24 of type grid-hash
|
||||
;; INFO: Used lq/sq
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod update-grid grid-hash ((this grid-hash))
|
||||
(defmethod update-grid ((this grid-hash))
|
||||
(let ((v1-0 (new 'stack-no-clear 'vector)))
|
||||
(dotimes (a1-0 3)
|
||||
(set! (-> v1-0 data a1-0) (fmax (-> this min-cell-size) (- (-> this box-max a1-0) (-> this box-min a1-0))))
|
||||
@@ -401,7 +398,7 @@
|
||||
|
||||
;; definition for method 9 of type grid-hash
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod update-grid-for-objects-in-box grid-hash ((this grid-hash) (arg0 int) (arg1 vector) (arg2 vector))
|
||||
(defmethod update-grid-for-objects-in-box ((this grid-hash) (arg0 int) (arg1 vector) (arg2 vector))
|
||||
(set! (-> this object-count) arg0)
|
||||
(dotimes (v1-0 3)
|
||||
(set! (-> this box-min v1-0) (-> arg1 data v1-0))
|
||||
@@ -414,7 +411,7 @@
|
||||
|
||||
;; definition for method 11 of type grid-hash
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod setup-search-box grid-hash ((this grid-hash) (arg0 int) (arg1 vector) (arg2 vector) (arg3 vector))
|
||||
(defmethod setup-search-box ((this grid-hash) (arg0 int) (arg1 vector) (arg2 vector) (arg3 vector))
|
||||
(let ((v1-0 (new 'stack-no-clear 'vector))
|
||||
(t1-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
@@ -502,7 +499,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 12 of type grid-hash
|
||||
(defmethod search-for-point grid-hash ((this grid-hash) (arg0 vector))
|
||||
(defmethod search-for-point ((this grid-hash) (arg0 vector))
|
||||
(let ((v1-0 this)
|
||||
(a0-1 (-> this search-box))
|
||||
(a2-0 arg0)
|
||||
@@ -537,7 +534,7 @@
|
||||
;; definition for method 13 of type grid-hash
|
||||
;; WARN: Found some very strange gotos. Check result carefully, this is not well tested.
|
||||
;; INFO: Used lq/sq
|
||||
(defmethod search-for-sphere grid-hash ((this grid-hash) (arg0 vector) (arg1 float))
|
||||
(defmethod search-for-sphere ((this grid-hash) (arg0 vector) (arg1 float))
|
||||
(let ((v1-0 (new 'stack-no-clear 'sphere)))
|
||||
(set! (-> v1-0 quad) (-> arg0 quad))
|
||||
(set! (-> v1-0 r) arg1)
|
||||
@@ -617,7 +614,7 @@
|
||||
|
||||
;; definition for method 14 of type grid-hash
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod draw grid-hash ((this grid-hash) (arg0 rgba))
|
||||
(defmethod draw ((this grid-hash) (arg0 rgba))
|
||||
"Draws the grid-hash"
|
||||
(let ((v1-0 (new 'stack-no-clear 'vector))
|
||||
(t0-0 (new 'stack-no-clear 'vector))
|
||||
@@ -634,7 +631,7 @@
|
||||
|
||||
;; definition for method 15 of type grid-hash
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod dump-grid-info grid-hash ((this grid-hash))
|
||||
(defmethod dump-grid-info ((this grid-hash))
|
||||
"Prints out info about the grid-hash, also draws via [[grid-hash::draw-grid]] if `debug-draw` is `#t`"
|
||||
(if (-> this debug-draw)
|
||||
(draw this *color-light-blue*)
|
||||
@@ -719,7 +716,7 @@
|
||||
|
||||
;; definition for method 25 of type sphere-hash
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod clear-objects! sphere-hash ((this sphere-hash))
|
||||
(defmethod clear-objects! ((this sphere-hash))
|
||||
(set! (-> this object-count) 0)
|
||||
(dotimes (v1-0 3)
|
||||
(set! (-> this box-min v1-0) 10000000000000000000000000000000000000.0)
|
||||
@@ -744,7 +741,7 @@
|
||||
(defmethod-mips2c "(method 28 sphere-hash)" 28 sphere-hash)
|
||||
|
||||
;; definition for method 26 of type sphere-hash
|
||||
(defmethod add-a-sphere sphere-hash ((this sphere-hash) (arg0 vector))
|
||||
(defmethod add-a-sphere ((this sphere-hash) (arg0 vector))
|
||||
(let ((gp-0 (-> this object-count)))
|
||||
(cond
|
||||
((< gp-0 (-> this max-object-count))
|
||||
@@ -766,7 +763,7 @@
|
||||
)
|
||||
|
||||
;; definition for method 27 of type sphere-hash
|
||||
(defmethod add-a-sphere-with-flag sphere-hash ((this sphere-hash) (arg0 vector) (arg1 int))
|
||||
(defmethod add-a-sphere-with-flag ((this sphere-hash) (arg0 vector) (arg1 int))
|
||||
(let ((gp-0 (-> this object-count)))
|
||||
(cond
|
||||
((< gp-0 (-> this max-object-count))
|
||||
@@ -811,7 +808,7 @@
|
||||
;; definition for method 15 of type sphere-hash
|
||||
;; INFO: Used lq/sq
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod dump-grid-info sphere-hash ((this sphere-hash))
|
||||
(defmethod dump-grid-info ((this sphere-hash))
|
||||
"Prints out info about the grid-hash, also draws via [[grid-hash::draw-grid]] if `debug-draw` is `#t`"
|
||||
(call-parent-method this)
|
||||
(new 'stack-no-clear 'vector)
|
||||
@@ -867,7 +864,7 @@
|
||||
|
||||
;; definition for method 25 of type spatial-hash
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod clear-objects! spatial-hash ((this spatial-hash))
|
||||
(defmethod clear-objects! ((this spatial-hash))
|
||||
(set! (-> this object-count) 0)
|
||||
(dotimes (v1-0 3)
|
||||
(set! (-> this box-min v1-0) 10000000000000000000000000000000000000.0)
|
||||
@@ -894,7 +891,7 @@
|
||||
(defmethod-mips2c "(method 33 spatial-hash)" 33 spatial-hash)
|
||||
|
||||
;; definition for method 34 of type spatial-hash
|
||||
(defmethod add-an-object spatial-hash ((this spatial-hash) (arg0 vector) (arg1 hash-object-info))
|
||||
(defmethod add-an-object ((this spatial-hash) (arg0 vector) (arg1 hash-object-info))
|
||||
(let ((gp-0 (-> this object-count)))
|
||||
(cond
|
||||
((< gp-0 (-> this max-object-count))
|
||||
@@ -936,7 +933,7 @@
|
||||
|
||||
;; definition for method 38 of type spatial-hash
|
||||
;; INFO: Used lq/sq
|
||||
(defmethod fill-actor-list-for-vec+r spatial-hash ((this spatial-hash) (arg0 vector) (arg1 (pointer collide-shape)) (arg2 int))
|
||||
(defmethod fill-actor-list-for-vec+r ((this spatial-hash) (arg0 vector) (arg1 (pointer collide-shape)) (arg2 int))
|
||||
(let ((v1-0 (new 'stack-no-clear 'sphere)))
|
||||
(set! (-> v1-0 quad) (-> arg0 quad))
|
||||
(set! (-> v1-0 r) 0.0)
|
||||
@@ -946,7 +943,7 @@
|
||||
|
||||
;; definition for method 40 of type spatial-hash
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod validate-objects spatial-hash ((this spatial-hash))
|
||||
(defmethod validate-objects ((this spatial-hash))
|
||||
(dotimes (s5-0 (-> this object-count))
|
||||
(let ((a0-2 (-> this object-array s5-0 object)))
|
||||
(when (not (valid? a0-2 basic "" #t 0))
|
||||
|
||||
Reference in New Issue
Block a user