Files
jak-project/test/decompiler/reference/jak1/engine/game/game-h_REF.gc
T
ManDude cd68cb671e 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>
2023-10-30 03:20:02 +00:00

183 lines
6.4 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type process-drawable
(deftype process-drawable (process)
((root trsqv)
(node-list cspace-array)
(draw draw-control)
(skel joint-control)
(nav nav-control)
(align align-control)
(path path-control)
(vol vol-control)
(fact fact-info)
(link actor-link-info)
(part sparticle-launch-control)
(water water-control)
(sound ambient-sound)
(state-flags state-flags)
(state-time time-frame)
)
(:methods
(initialize-skeleton (_type_ skeleton-group pair) none)
(initialize-skeleton-by-name (_type_ string object) _type_)
(apply-alignment (_type_ align-opts transformq vector) collide-shape)
(do-joint-math! (_type_) none)
(cleanup-for-death (_type_) none)
(evaluate-joint-control (_type_) none)
)
(:states
(process-drawable-art-error string)
process-drawable-idle
)
)
;; definition for method 3 of type process-drawable
(defmethod inspect ((this process-drawable))
(let ((t9-0 (method-of-type process inspect)))
(t9-0 this)
)
(format #t "~T~Troot: ~A~%" (-> this root))
(format #t "~T~Tnode-list: ~A~%" (-> this node-list))
(format #t "~T~Tdraw: ~A~%" (-> this draw))
(format #t "~T~Tskel: ~A~%" (-> this skel))
(format #t "~T~Tnav: ~A~%" (-> this nav))
(format #t "~T~Talign: ~A~%" (-> this align))
(format #t "~T~Tpath: ~A~%" (-> this path))
(format #t "~T~Tvol: ~A~%" (-> this vol))
(format #t "~T~Tfact: ~A~%" (-> this fact))
(format #t "~T~Tlink: ~A~%" (-> this link))
(format #t "~T~Tpart: ~A~%" (-> this part))
(format #t "~T~Twater: ~A~%" (-> this water))
(format #t "~T~Tsound: ~A~%" (-> this sound))
(format #t "~T~Tstate-flags: ~D~%" (-> this state-flags))
(format #t "~T~Tstate-time: ~D~%" (-> this state-time))
this
)
;; definition of type process-drawable-reserved
(deftype process-drawable-reserved (process-drawable)
()
(:methods
(process-drawable-reserved-method-20 () none)
(process-drawable-reserved-method-21 () none)
(process-drawable-reserved-method-22 () none)
(process-drawable-reserved-method-23 () none)
(process-drawable-reserved-method-24 () none)
(process-drawable-reserved-method-25 () none)
(process-drawable-reserved-method-26 () none)
(process-drawable-reserved-method-27 () none)
(process-drawable-reserved-method-28 () none)
(process-drawable-reserved-method-29 () none)
(process-drawable-reserved-method-30 () none)
(process-drawable-reserved-method-31 () none)
(process-drawable-reserved-method-32 () none)
(process-drawable-reserved-method-33 () none)
(process-drawable-reserved-method-34 () none)
(process-drawable-reserved-method-35 () none)
(process-drawable-reserved-method-36 () none)
(process-drawable-reserved-method-37 () none)
(process-drawable-reserved-method-38 () none)
(process-drawable-reserved-method-39 () none)
(process-drawable-reserved-method-40 () none)
(process-drawable-reserved-method-41 () none)
(process-drawable-reserved-method-42 () none)
(process-drawable-reserved-method-43 () none)
(process-drawable-reserved-method-44 () none)
(process-drawable-reserved-method-45 () none)
(process-drawable-reserved-method-46 () none)
(process-drawable-reserved-method-47 () none)
(process-drawable-reserved-method-48 () none)
(process-drawable-reserved-method-49 () none)
(process-drawable-reserved-method-50 () none)
(process-drawable-reserved-method-51 () none)
(process-drawable-reserved-method-52 () none)
(process-drawable-reserved-method-53 () none)
(process-drawable-reserved-method-54 () none)
(process-drawable-reserved-method-55 () none)
(process-drawable-reserved-method-56 () none)
(process-drawable-reserved-method-57 () none)
(process-drawable-reserved-method-58 () none)
(process-drawable-reserved-method-59 () none)
(process-drawable-reserved-method-60 () none)
(process-drawable-reserved-method-61 () none)
(process-drawable-reserved-method-62 () none)
)
)
;; definition for method 3 of type process-drawable-reserved
(defmethod inspect ((this process-drawable-reserved))
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 this)
)
this
)
;; definition of type attack-info
(deftype attack-info (structure)
((trans vector :inline)
(vector vector :inline)
(intersection vector :inline)
(attacker handle)
(invinc-time time-frame)
(mask attack-mask)
(mode symbol)
(shove-back meters)
(shove-up meters)
(speed meters)
(dist meters)
(control float)
(angle symbol)
(rotate-to degrees)
(prev-state state)
)
(:methods
(combine! (_type_ attack-info) none)
)
)
;; definition for method 3 of type attack-info
(defmethod inspect ((this attack-info))
(format #t "[~8x] ~A~%" this 'attack-info)
(format #t "~Ttrans: ~`vector`P~%" (-> this trans))
(format #t "~Tvector: ~`vector`P~%" (-> this vector))
(format #t "~Tintersection: ~`vector`P~%" (-> this intersection))
(format #t "~Tattacker: ~`handle`P~%" (-> this attacker))
(format #t "~Tinvinc-time: ~D~%" (-> this invinc-time))
(format #t "~Tmask: ~D~%" (-> this mask))
(format #t "~Tmode: ~A~%" (-> this mode))
(format #t "~Tshove-back: (meters ~m)~%" (-> this shove-back))
(format #t "~Tshove-up: (meters ~m)~%" (-> this shove-up))
(format #t "~Tspeed: (meters ~m)~%" (-> this speed))
(format #t "~Tdist: (meters ~m)~%" (-> this dist))
(format #t "~Tcontrol: ~f~%" (-> this control))
(format #t "~Tangle: ~A~%" (-> this angle))
(format #t "~Trotate-to: (deg ~r)~%" (-> this rotate-to))
(format #t "~Tprev-state: ~A~%" (-> this prev-state))
this
)
;; definition for symbol *global-attack-id*, type int
(define *global-attack-id* 0)
;; definition of type ground-tween-info
(deftype ground-tween-info (structure)
((chan uint8 3)
(blend float 3)
(group uint32 5)
)
)
;; definition for method 3 of type ground-tween-info
(defmethod inspect ((this ground-tween-info))
(format #t "[~8x] ~A~%" this 'ground-tween-info)
(format #t "~Tchan[3] @ #x~X~%" (-> this chan))
(format #t "~Tblend[3] @ #x~X~%" (-> this blend))
(format #t "~Tgroup[5] @ #x~X~%" (-> this group))
this
)
;; failed to figure out what this is:
0