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

245 lines
7.6 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: hover-nav-control-h.gc
;; name in dgo: hover-nav-control-h
;; dgos: FOR, DMI, FRA, STR, NEB, D3A, UNB
;; +++net-path-node-status
(defenum net-path-node-status
:bitfield #t
:type uint16
(open)
(closed))
;; ---net-path-node-status
;; NOTE - for nestb-scenes
(declare-type nav-network basic)
(define-extern *nav-network* nav-network)
(defenum hover-nav-flags
:bitfield #t
:type uint16
(honflags-0)
(honflags-1)
(honflags-2)
(honflags-3)
(honflags-4)
(honflags-5)
(honflags-6)
(honflags-7)
)
;; DECOMP BEGINS
(deftype nav-network-adjacency (structure)
((index int32)
(dist float)
)
)
(deftype nav-network-adjacency-array (inline-array-class)
((data nav-network-adjacency :inline :dynamic)
)
)
(set! (-> nav-network-adjacency-array heap-base) (the-as uint 16))
(deftype list-node (structure)
((next list-node)
(prev list-node)
)
)
(deftype nav-network-path-node (list-node)
((row-index int32)
(status net-path-node-status)
(parent nav-network-path-node)
(cost-to-start float)
(cost-to-end float)
)
)
(deftype nav-network-info (structure)
((index int32)
(pos vector :inline)
(path-node nav-network-path-node :inline)
(count int32)
(adjacency (inline-array nav-network-adjacency))
)
)
(deftype nav-network-info-array (inline-array-class)
((data nav-network-info :inline :dynamic)
)
)
(set! (-> nav-network-info-array heap-base) (the-as uint 80))
(deftype hover-nav-sphere (list-node)
((sphere sphere :inline)
(handle handle)
(timer time-frame)
)
)
(deftype hover-nav-path-segment (list-node)
((curve-matrix matrix :inline)
(pos-index float 2)
(dist float)
(du float)
)
(:methods
(hover-nav-path-segment-method-9 (_type_ float) none)
)
)
(defmethod hover-nav-path-segment-method-9 ((this hover-nav-path-segment) (arg0 float))
(set! (-> this du) (/ arg0 (-> this dist)))
0
(none)
)
(deftype hover-nav-path-info (structure)
((segment-list hover-nav-path-segment)
(tail-segment hover-nav-path-segment)
(curr-segment hover-nav-path-segment)
(curr-u float)
)
(:methods
(hover-nav-path-info-method-9 (_type_) none)
)
)
(deftype path-index-array (inline-array-class)
((data hover-nav-path-info :inline :dynamic)
)
)
(set! (-> path-index-array heap-base) (the-as uint 4))
(deftype nav-network (basic)
((network (array nav-network-info))
(dummy nav-network-info :inline)
(control-handle handle)
(list-table list-node 5)
(open-list nav-network-path-node :overlay-at (-> list-table 0))
(closed-list nav-network-path-node :overlay-at (-> list-table 1))
(sphere-list hover-nav-sphere :overlay-at (-> list-table 3))
(free-segment-list hover-nav-path-segment :overlay-at (-> list-table 2))
(free-sphere-list hover-nav-sphere :overlay-at (-> list-table 4))
(segment-pool (pointer hover-nav-path-segment))
(sphere-pool (pointer hover-nav-sphere))
)
(:methods
(new (symbol type) _type_)
(nav-network-method-9 (_type_) none)
(nav-network-method-10 (_type_ level (array nav-network-info)) none)
(nav-network-method-11 (_type_) none)
(nav-network-method-12 (_type_) none)
(nav-network-method-13 (_type_ int nav-network-path-node) none)
(nav-network-method-14 (_type_ int nav-network-path-node) object)
(nav-network-method-15 (_type_ nav-network-path-node) object)
(nav-network-method-16 (_type_ nav-network-path-node) none)
(nav-network-method-17 (_type_) nav-network-path-node)
(nav-network-method-18 (_type_ nav-network-path-node) none)
(nav-network-method-19 (_type_ nav-network-path-node) none)
(nav-network-method-20 (_type_ nav-network-path-node vector) none)
(nav-network-method-21 (_type_ object int int) none)
(nav-network-method-22 (_type_ hover-nav-path-info vector vector int int) hover-nav-path-segment)
(nav-network-method-23 (_type_ hover-nav-path-info) none)
(nav-network-method-24 (_type_ hover-nav-path-info int int int) symbol)
(nav-network-method-25 (_type_ process collide-prim-core) none)
(nav-network-method-26 (_type_ vector process vector vector float) vector)
(nav-network-method-27 (_type_) none)
(nav-network-method-28 (_type_) none)
(nav-network-method-29 (_type_) symbol)
(get-network (_type_) (array nav-network-info))
(nav-network-method-31 (_type_ bounding-box) none)
(nav-network-method-32 (_type_ string) none)
)
)
(defmethod get-network ((this nav-network))
(-> this network)
)
(deftype hover-nav-params (structure)
((max-speed float)
(max-acceleration float)
(friction float)
(nav-collide-prim-index int32)
)
)
(deftype hover-nav-control (basic)
((root collide-shape-moving)
(nav nav-network)
(flags hover-nav-flags)
(params hover-nav-params)
(path-timer time-frame)
(transvv vector :inline)
(dest-pos vector :inline)
(dest-vel vector :inline)
(dest-move-dir vector :inline)
(dest-offset vector :inline)
(move-dir vector :inline)
(nav-collide-impulse vector :inline)
(nav-collide-impulse-len float)
(dest-speed float)
(local-dist float)
(speed float)
(max-los-speed float)
(target-speed float)
(target-acceleration float)
(speed-dest float)
(path-info hover-nav-path-info :inline)
(curr-dest-pt int32)
(los-obstruction-distance float)
(los-last-clear-time time-frame)
(max-speed-multiplier float)
(max-acceleration-multiplier float)
)
(:methods
(new (symbol type process collide-shape-moving hover-nav-params) _type_)
(hover-nav-control-method-9 (_type_) none)
(hover-nav-control-method-10 (_type_ vector vector vector) none)
(hover-nav-control-method-11 (_type_ vector) none)
(hover-nav-control-method-12 (_type_) none)
(hover-nav-control-method-13 (_type_) none)
(hover-nav-control-method-14 (_type_ float float) none)
(hover-nav-control-method-15 (_type_ vector) none)
(hover-nav-control-method-16 (_type_ vector) vector)
(hover-nav-control-method-17 (_type_) collide-prim-core)
(hover-nav-control-method-18 (_type_ path-control int int) none)
(hover-nav-control-method-19 (_type_ (inline-array vector) int) none)
(hover-nav-control-method-20 (_type_) none)
(hover-nav-control-method-21 (_type_) none)
(hover-nav-control-method-22 (_type_) hover-nav-path-segment)
(hover-nav-control-method-23 (_type_) object)
(hover-nav-control-method-24 (_type_) none)
(hover-nav-control-method-25 (_type_) none)
(hover-nav-control-method-26 (_type_ vector vector float) symbol)
(hover-nav-control-method-27 (_type_ vector vector) int)
(hover-nav-control-method-28 (_type_ vector vector) none)
(hover-nav-control-method-29 (_type_ vector) none)
(hover-nav-control-method-30 (_type_) float)
(hover-nav-control-method-31 (_type_) float)
)
)
(define *hover-nav-time-offset* 0)