jak-project/goal_src/jak1/engine/target/target-h.gc
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

191 lines
5.8 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: target-h.gc
;; name in dgo: target-h
;; dgos: GAME, ENGINE
(declare-type snowball-info basic)
(declare-type tube-info basic)
(declare-type racer-info basic)
(declare-type flut-info basic)
(declare-type sidekick process-drawable)
;; DECOMP BEGINS
(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
)
)
(define-perm *target* target #f)
(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
)
)
(define-perm *sidekick* sidekick #f)
(defun-extern start symbol continue-point target)
(defun-extern stop symbol int)
(define-extern do-target-shadow (function none :behavior target))
(define-extern target-joint-pos (function vector))
(define-extern target-cam-pos (function vector))
(define-extern target-powerup-process (function none :behavior target))
(define-extern target-exit (function none :behavior target))
(define-extern target-generic-event-handler (function process int symbol event-message-block object :behavior target))
(define-extern init-sidekick (function none :behavior sidekick))
(define-extern racer-collision-reaction (function control-info collide-shape-intersect vector vector cshape-moving-flags))
(define-extern start-sequence-a (function none))