Files
jak-project/test/decompiler/reference/jak1/engine/game/projectiles-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

111 lines
3.6 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type projectile
(deftype projectile (process-drawable)
((root collide-shape-moving :override)
(base-trans vector :inline)
(target vector :inline)
(target-base vector :inline)
(parent-base vector :inline)
(parent-quat vector :inline)
(base-vector vector :inline)
(timeout time-frame)
(options uint64)
(last-target handle)
(notify-handle handle)
(max-speed float)
(max-turn float)
(old-dist float 16)
(old-dist-count int32)
(hits int32)
(max-hits int32)
(tween float)
(attack-mode symbol)
(update-velocity (function projectile none))
(counter int32)
(target-count int32)
(sound-id sound-id)
)
(:state-methods
projectile-die
projectile-dissipate
projectile-impact
projectile-moving
)
(:methods
(projectile-method-24 (_type_) none)
(projectile-method-25 (_type_) none)
(projectile-method-26 (_type_) none)
(projectile-method-27 (_type_) none)
(projectile-method-28 (_type_) none)
)
)
;; definition for method 3 of type projectile
(defmethod inspect ((this projectile))
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 this)
)
(format #t "~T~Tbase-trans: ~`vector`P~%" (-> this base-trans))
(format #t "~T~Ttarget: ~`vector`P~%" (-> this target))
(format #t "~T~Ttarget-base: ~`vector`P~%" (-> this target-base))
(format #t "~T~Tparent-base: ~`vector`P~%" (-> this parent-base))
(format #t "~T~Tparent-quat: ~`vector`P~%" (-> this parent-quat))
(format #t "~T~Tbase-vector: ~`vector`P~%" (-> this base-vector))
(format #t "~T~Ttimeout: ~D~%" (-> this timeout))
(format #t "~T~Toptions: ~D~%" (-> this options))
(format #t "~T~Tlast-target: ~D~%" (-> this last-target))
(format #t "~T~Tnotify-handle: ~D~%" (-> this notify-handle))
(format #t "~T~Tmax-speed: ~f~%" (-> this max-speed))
(format #t "~T~Tmax-turn: ~f~%" (-> this max-turn))
(format #t "~T~Told-dist[16] @ #x~X~%" (-> this old-dist))
(format #t "~T~Told-dist-count: ~D~%" (-> this old-dist-count))
(format #t "~T~Thits: ~D~%" (-> this hits))
(format #t "~T~Tmax-hits: ~D~%" (-> this max-hits))
(format #t "~T~Ttween: ~f~%" (-> this tween))
(format #t "~T~Tattack-mode: ~A~%" (-> this attack-mode))
(format #t "~T~Tupdate-velocity: ~A~%" (-> this update-velocity))
(format #t "~T~Tcounter: ~D~%" (-> this counter))
(format #t "~T~Ttarget-count: ~D~%" (-> this target-count))
(format #t "~T~Tsound-id: ~D~%" (-> this sound-id))
this
)
;; definition of type projectile-yellow
(deftype projectile-yellow (projectile)
((mode int32)
(angle float)
)
)
;; definition for method 3 of type projectile-yellow
(defmethod inspect ((this projectile-yellow))
(let ((t9-0 (method-of-type projectile inspect)))
(t9-0 this)
)
(format #t "~T~Tmode: ~D~%" (-> this mode))
(format #t "~T~Tangle: ~f~%" (-> this angle))
this
)
;; definition of type projectile-blue
(deftype projectile-blue (projectile)
((mode int32)
(joint-num int32)
)
)
;; definition for method 3 of type projectile-blue
(defmethod inspect ((this projectile-blue))
(let ((t9-0 (method-of-type projectile inspect)))
(t9-0 this)
)
(format #t "~T~Tmode: ~D~%" (-> this mode))
(format #t "~T~Tjoint-num: ~D~%" (-> this joint-num))
this
)
;; failed to figure out what this is:
0