mirror of
https://github.com/open-goal/jak-project
synced 2026-07-10 23:22:17 -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>
127 lines
4.0 KiB
Common Lisp
Vendored
Generated
127 lines
4.0 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for symbol *traffic-manager*, type traffic-manager
|
|
(define *traffic-manager* (the-as traffic-manager #f))
|
|
|
|
;; definition for symbol *ctywide-entity*, type entity
|
|
(define *ctywide-entity* (the-as entity #f))
|
|
|
|
;; definition for symbol *lwide-entity*, type entity
|
|
(define *lwide-entity* (the-as entity #f))
|
|
|
|
;; definition for symbol *race-vehicle-entity*, type entity-actor
|
|
(define *race-vehicle-entity* (the-as entity-actor #f))
|
|
|
|
;; definition of type traffic-danger-info
|
|
(deftype traffic-danger-info (structure)
|
|
((sphere sphere :inline)
|
|
(velocity vector :inline)
|
|
(handle handle)
|
|
(notify-radius float)
|
|
(danger-level float)
|
|
(decay-rate float)
|
|
(flags traffic-danger-flags)
|
|
(danger-type traffic-danger-type)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type traffic-danger-info
|
|
(defmethod inspect ((this traffic-danger-info))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'traffic-danger-info)
|
|
(format #t "~1Tsphere: #<sphere @ #x~X>~%" (-> this sphere))
|
|
(format #t "~1Tvelocity: #<vector @ #x~X>~%" (-> this velocity))
|
|
(format #t "~1Thandle: ~D~%" (-> this handle))
|
|
(format #t "~1Tnotify-radius: ~f~%" (-> this notify-radius))
|
|
(format #t "~1Tdanger-level: ~f~%" (-> this danger-level))
|
|
(format #t "~1Tdecay-rate: ~f~%" (-> this decay-rate))
|
|
(format #t "~1Tflags: ~D~%" (-> this flags))
|
|
(format #t "~1Tdanger-type: ~D~%" (-> this danger-type))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type traffic-suppression-params
|
|
(deftype traffic-suppression-params (structure)
|
|
((bbox bounding-box :inline)
|
|
(duration time-frame)
|
|
(id int8)
|
|
)
|
|
(:methods
|
|
(try-creating-new-suppression-box (_type_) symbol)
|
|
(create-or-update-suppression-box (_type_) symbol)
|
|
(has-valid-id? (_type_) none)
|
|
(kill-suppression-box (_type_) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type traffic-suppression-params
|
|
(defmethod inspect ((this traffic-suppression-params))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'traffic-suppression-params)
|
|
(format #t "~1Tbbox: #<bounding-box @ #x~X>~%" (-> this bbox))
|
|
(format #t "~1Tduration: ~D~%" (-> this duration))
|
|
(format #t "~1Tid: ~D~%" (-> this id))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition for method 11 of type traffic-suppression-params
|
|
;; WARN: Return type mismatch symbol vs none.
|
|
(defmethod has-valid-id? ((this traffic-suppression-params))
|
|
(!= (-> this id) -1)
|
|
(none)
|
|
)
|
|
|
|
;; definition of type traffic-object-spawn-params
|
|
(deftype traffic-object-spawn-params (structure)
|
|
((object-type traffic-type)
|
|
(behavior uint64)
|
|
(id uint32)
|
|
(nav-mesh nav-mesh)
|
|
(nav-branch nav-branch)
|
|
(position vector :inline)
|
|
(rotation quaternion :inline)
|
|
(velocity vector :inline)
|
|
(handle handle)
|
|
(guard-type uint8)
|
|
(user-data uint32)
|
|
(flags traffic-spawn-flags)
|
|
(proc process)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type traffic-object-spawn-params
|
|
(defmethod inspect ((this traffic-object-spawn-params))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'traffic-object-spawn-params)
|
|
(format #t "~1Tobject-type: ~D~%" (-> this object-type))
|
|
(format #t "~1Tbehavior: ~D~%" (-> this behavior))
|
|
(format #t "~1Tid: ~D~%" (-> this id))
|
|
(format #t "~1Tnav-mesh: ~A~%" (-> this nav-mesh))
|
|
(format #t "~1Tnav-branch: ~A~%" (-> this nav-branch))
|
|
(format #t "~1Tposition: #<vector @ #x~X>~%" (-> this position))
|
|
(format #t "~1Trotation: #<quaternion @ #x~X>~%" (-> this rotation))
|
|
(format #t "~1Tvelocity: #<vector @ #x~X>~%" (-> this velocity))
|
|
(format #t "~1Thandle: ~D~%" (-> this handle))
|
|
(format #t "~1Tguard-type: ~D~%" (-> this guard-type))
|
|
(format #t "~1Tuser-data: ~D~%" (-> this user-data))
|
|
(format #t "~1Tflags: ~D~%" (-> this flags))
|
|
(format #t "~1Tproc: ~A~%" (-> this proc))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
0
|