jak-project/goal_src/jak2/engine/nav/nav-enemy-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

119 lines
4 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: nav-enemy-h.gc
;; name in dgo: nav-enemy-h
;; dgos: GAME, COMMON
;; grunt
(declare-type nav-enemy enemy)
(define-extern nav-enemy-falling-post (function none :behavior nav-enemy))
(define-extern nav-enemy-chase-post (function none :behavior nav-enemy))
(define-extern nav-enemy-simple-post (function none :behavior nav-enemy))
(declare-type nav-callback-info structure)
(define-extern *nav-enemy-null-callback-info* nav-callback-info)
;; flitter
(define-extern nav-enemy-travel-post (function none :behavior nav-enemy))
;; DECOMP BEGINS
(deftype nav-enemy-info (enemy-info)
((callback-info nav-callback-info)
(use-momentum symbol)
(use-frustration symbol)
(use-stop-chase symbol)
(use-circling symbol)
(use-pacing symbol)
(walk-anim int32)
(turn-anim int32)
(run-anim int32)
(taunt-anim int32)
(run-travel-speed meters)
(run-acceleration meters)
(run-turning-acceleration meters)
(walk-travel-speed meters)
(walk-acceleration meters)
(walk-turning-acceleration meters)
(maximum-rotation-rate degrees)
(notice-nav-radius meters)
(frustration-distance meters)
(frustration-time time-frame)
(blocked-time time-frame)
(circle-dist-lo float)
(circle-dist-hi float)
(nav-mesh nav-mesh)
)
(:methods
(copy-nav-enemy-info! (_type_ nav-enemy-info) none)
)
)
(deftype nav-enemy (enemy)
((enemy-info nav-enemy-info :override)
(frustration-point vector :inline)
(move-dest vector :inline)
(frustration-time time-frame)
(blocked-start-time time-frame)
(restore-nav-radius-time time-frame)
(nav-radius-backup float)
)
(:state-methods
taunt
pacing
circling
stop-chase
debug-control
)
(:methods
(set-enemy-info! (_type_ nav-enemy-info) none :replace)
(init-enemy-behaviour-and-stats! (_type_ nav-enemy-info) none :replace)
(nav-enemy-method-142 (_type_ nav-control) none)
(nav-enemy-method-143 (_type_ nav-control) none)
(nav-enemy-method-144 (_type_) time-frame :behavior nav-enemy)
(nav-enemy-method-145 (_type_ nav-control) none)
(nav-enemy-method-146 (_type_ nav-control) none)
(nav-enemy-method-147 (_type_ nav-control) none)
(nav-enemy-method-148 (_type_ nav-control) none)
(nav-enemy-method-149 (_type_ nav-control) none)
(nav-enemy-method-150 (_type_ nav-control) none)
(nav-enemy-method-151 (_type_ nav-control) none)
(nav-enemy-method-152 (_type_ nav-control) none)
(nav-enemy-method-153 (_type_ nav-control) none)
(nav-enemy-method-154 (_type_ nav-control) none)
(nav-enemy-method-155 (_type_) none)
(nav-enemy-method-156 (_type_) none)
(nav-enemy-method-157 (_type_ vector) nav-poly)
(nav-enemy-method-158 (_type_ vector) object)
(nav-enemy-method-159 (_type_ vector) symbol)
(nav-enemy-method-160 (_type_) none)
(nav-enemy-method-161 (_type_) none)
(nav-enemy-method-162 (_type_) none)
(nav-enemy-method-163 (_type_) symbol)
(nav-enemy-method-164 (_type_) none)
(nav-enemy-method-165 (_type_) none)
(nav-enemy-method-166 (_type_) none)
(nav-enemy-method-167 (_type_) none)
(nav-enemy-method-168 (_type_) float)
(nav-enemy-method-169 (_type_ float symbol) float)
(nav-enemy-method-170 (_type_) none)
(nav-enemy-method-171 (_type_) none)
(nav-enemy-method-172 (_type_) none)
(nav-enemy-method-173 (_type_) none)
(nav-enemy-method-174 (_type_) symbol)
(nav-enemy-method-175 (_type_) symbol)
(nav-enemy-method-176 (_type_) none :behavior nav-enemy)
(nav-enemy-method-177 (_type_) none)
)
)
(deftype nav-enemy-debug-control-info (basic)
((enable basic)
(steering float)
(throttle float)
)
)