Files
jak-project/goal_src/jak2/levels/common/enemy/hover/hover-enemy-h.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

78 lines
2.5 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: hover-enemy-h.gc
;; name in dgo: hover-enemy-h
;; dgos: FOR, DMI, FRA, STR, NEB, D3A, UNB
;; DECOMP BEGINS
(deftype hover-enemy-info (structure)
((fly-forward-anim int32)
(fly-backward-anim int32)
(fly-left-anim int32)
(fly-right-anim int32)
(shoot-anim int32)
(main-joint int32)
(gun-base int32)
(engine-left int32)
(engine-right int32)
(thrust-rotate-left float)
(thrust-rotate-right float)
)
)
(deftype hover-enemy (enemy)
((hover hover-nav-control)
(hover-info hover-enemy-info)
(formation-entity entity)
(fly-anim-speed float)
(restart-fly-anims symbol)
(main-joint-acc vector :inline)
(main-joint-vel vector :inline)
(main-joint-pos vector :inline)
(thrust float 2)
(rotation-vec vector :inline)
(dest-pos vector :inline)
(offset vector :inline)
(surface-normal vector :inline)
(local-dir vector :inline)
(scale float)
(scale-timer uint64)
(hit-surface? symbol)
(knocked-start-level float)
(knocked-fall-dist float)
(flying-death-anim int32)
(flying-death-transv vector :inline)
(flying-death-engine int32)
(flying-death-thrust-rotate float)
(flying-death-spin float)
(flying-death-spin-dest float)
(flying-death-spin-axis vector :inline)
)
(:state-methods
knocked-recover
flying-death
flying-death-explode
)
(:methods
(hover-enemy-method-140 (_type_ symbol) none)
(hover-enemy-method-141 (_type_ float) none)
(hover-enemy-method-142 (_type_) none)
(hover-enemy-method-143 (_type_ int float) none)
(hover-enemy-method-144 (_type_) none)
(hover-enemy-method-145 (_type_ int float int int) none)
(hover-enemy-method-146 (_type_) none)
(hover-enemy-method-147 (_type_) none)
(hover-enemy-method-148 (_type_) none)
(hover-enemy-method-149 (_type_) none)
(hover-enemy-method-150 (_type_) enemy-info)
(hover-enemy-method-151 (_type_) hover-enemy-info)
(hover-enemy-method-152 (_type_) hover-nav-params)
(hover-enemy-method-153 (_type_) none)
(hover-enemy-method-154 (_type_) none)
(hover-enemy-method-155 (_type_) none)
)
)