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

212 lines
7.1 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type target
(deftype target (process-drawable)
((fact fact-info-target :override)
(self-override target :overlay-at self)
(control control-info :overlay-at root)
(skel2 basic)
(racer racer-info)
(game game-info)
(neck joint-mod)
(state-hook-time time-frame)
(state-hook (function none :behavior target))
(cam-user-mode symbol)
(sidekick (pointer sidekick))
(manipy (pointer manipy))
(attack-info attack-info :inline)
(attack-info-rec attack-info :inline)
(anim-seed uint64)
(alt-cam-pos vector :inline)
(snowball snowball-info)
(tube tube-info)
(flut flut-info)
(current-level level)
(saved-pos transformq :inline)
(saved-owner uint64)
(alt-neck-pos vector :inline)
(fp-hud handle)
(no-load-wait time-frame)
(no-look-around-wait time-frame)
(burn-proc handle)
)
(:methods
(find-edge-grabs! (_type_ collide-cache) object)
)
(:states
target-attack
(target-attack-air symbol)
(target-attack-uppercut float float)
(target-attack-uppercut-jump float float)
target-billy-game
(target-clone-anim handle)
(target-continue continue-point)
(target-death symbol)
target-demo
(target-double-jump float float)
(target-duck-high-jump float float symbol)
(target-duck-high-jump-jump float float symbol)
target-duck-stance
target-duck-walk
(target-eco-powerup object float)
target-edge-grab
(target-edge-grab-jump float float)
target-edge-grab-off
(target-falling symbol)
(target-final-door basic handle)
(target-fishing handle)
(target-flop float float float)
(target-flop-hit-ground symbol)
(target-flut-air-attack float)
target-flut-air-attack-hit-ground
(target-flut-clone-anim handle)
(target-flut-death symbol)
(target-flut-double-jump float float)
(target-flut-falling symbol)
(target-flut-get-off handle)
(target-flut-get-off-hit-ground symbol)
(target-flut-get-off-jump handle)
(target-flut-get-on handle)
target-flut-grab
(target-flut-hit symbol attack-info)
target-flut-hit-ground
(target-flut-jump float float)
target-flut-running-attack
target-flut-stance
(target-flut-start handle)
target-flut-walk
target-grab
(target-high-jump float float basic)
(target-hit symbol attack-info)
(target-hit-ground symbol)
(target-hit-ground-hard float)
target-ice-stance
target-ice-walk
(target-jump float float surface)
(target-jump-forward float float)
(target-launch float symbol vector int)
target-load-wait
target-look-around
(target-periscope handle)
(target-play-anim string handle)
(target-pole-cycle handle)
(target-pole-flip-forward float float float)
(target-pole-flip-forward-jump float float)
(target-pole-flip-up object object float)
(target-pole-flip-up-jump float float)
target-racing
(target-racing-bounce float float symbol)
(target-racing-clone-anim handle)
(target-racing-death symbol)
target-racing-falling
(target-racing-get-off handle)
(target-racing-get-off-hit-ground symbol)
(target-racing-get-off-jump handle)
(target-racing-get-on handle)
target-racing-grab
(target-racing-hit handle attack-info)
(target-racing-jump float float symbol)
(target-racing-smack float symbol)
(target-racing-start handle)
target-running-attack
target-slide-down
target-snowball
(target-snowball-start handle)
target-stance
target-stance-ambient
target-stance-look-around
target-startup
target-swim-down
(target-swim-jump float float)
(target-swim-jump-jump float float surface)
target-swim-stance
target-swim-up
target-swim-walk
target-title
target-title-play
target-title-wait
target-tube
(target-tube-death symbol)
(target-tube-hit symbol attack-info)
(target-tube-jump float float)
(target-tube-start handle)
target-turn-around
target-wade-stance
target-wade-walk
target-walk
(target-warp-in vector vector)
(target-warp-out vector vector)
target-wheel
(target-wheel-flip float float)
target-yellow-blast
target-yellow-jump-blast
)
)
;; definition for method 3 of type target
(defmethod inspect ((this target))
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 this)
)
(format #t "~T~Tcontrol: ~A~%" (-> this control))
(format #t "~T~Tskel2: ~A~%" (-> this skel2))
(format #t "~T~Tracer: ~A~%" (-> this racer))
(format #t "~T~Tgame: ~A~%" (-> this game))
(format #t "~T~Tneck: ~A~%" (-> this neck))
(format #t "~T~Tstate-hook-time: ~D~%" (-> this state-hook-time))
(format #t "~T~Tstate-hook: ~A~%" (-> this state-hook))
(format #t "~T~Tcam-user-mode: ~A~%" (-> this cam-user-mode))
(format #t "~T~Tsidekick: #x~X~%" (-> this sidekick))
(format #t "~T~Tmanipy: #x~X~%" (-> this manipy))
(format #t "~T~Tattack-info: #<attack-info @ #x~X>~%" (-> this attack-info))
(format #t "~T~Tattack-info-rec: #<attack-info @ #x~X>~%" (-> this attack-info-rec))
(format #t "~T~Tanim-seed: ~D~%" (-> this anim-seed))
(format #t "~T~Talt-cam-pos: ~`vector`P~%" (-> this alt-cam-pos))
(format #t "~T~Tsnowball: ~A~%" (-> this snowball))
(format #t "~T~Ttube: ~A~%" (-> this tube))
(format #t "~T~Tflut: ~A~%" (-> this flut))
(format #t "~T~Tcurrent-level: ~A~%" (-> this current-level))
(format #t "~T~Tsaved-pos: #<transformq @ #x~X>~%" (-> this saved-pos))
(format #t "~T~Tsaved-owner: ~D~%" (-> this saved-owner))
(format #t "~T~Talt-neck-pos: ~`vector`P~%" (-> this alt-neck-pos))
(format #t "~T~Tfp-hud: ~D~%" (-> this fp-hud))
(format #t "~T~Tno-load-wait: ~D~%" (-> this no-load-wait))
(format #t "~T~Tno-look-around-wait: ~D~%" (-> this no-look-around-wait))
this
)
;; definition (perm) for symbol *target*, type target
(define-perm *target* target #f)
;; definition of type sidekick
(deftype sidekick (process-drawable)
((parent-override (pointer target) :overlay-at parent)
(control control-info :overlay-at root)
(anim-seed uint64 :offset 192)
(shadow-in-movie? symbol)
)
(:states
sidekick-clone
)
)
;; definition for method 3 of type sidekick
(defmethod inspect ((this sidekick))
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 this)
)
(format #t "~T~Tcontrol: ~A~%" (-> this root))
(format #t "~T~Tstate-time: ~D~%" (-> this state-time))
(format #t "~T~Tstate-flags: ~D~%" (-> this state-flags))
(format #t "~T~Tanim-seed: ~D~%" (-> this anim-seed))
(format #t "~T~Tshadow-in-movie?: ~A~%" (-> this shadow-in-movie?))
this
)
;; definition (perm) for symbol *sidekick*, type sidekick
(define-perm *sidekick* sidekick #f)
;; failed to figure out what this is:
0