jak-project/goal_src/jak1/levels/finalboss/robotboss-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

132 lines
3.5 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: robotboss-h.gc
;; name in dgo: robotboss-h
;; dgos: FIN, L1
;; DECOMP BEGINS
(deftype robotboss-dda (structure)
((blue-bomb-time float)
(num-blobs int32)
(green-bomb-time float)
(red-shots-min int32)
(red-shots-rnd int32)
(red-shot-time-min float)
(red-shot-time-rnd float)
(red-bomb-time float)
(yellow-shot-time-min float)
(yellow-shot-time-rnd float)
(yellow-gun-hits int32)
(yellow-bomb-time float)
)
)
(deftype robotboss (process-drawable)
((root collide-shape-moving :override)
(alts entity-actor 13)
(desired-loc vector :inline)
(old-loc vector :inline)
(loc-t float)
(loc-t-start time-frame)
(loc-t-duration time-frame)
(hits-to-go int32)
(took-hit symbol)
(children-spawned int32)
(vulnerable int64)
(till-next-shot int64)
(shot-attractor handle)
(desired-pool-y float)
(particle sparticle-launch-control 7)
(blue-smoke symbol)
(red-smoke symbol)
(yellow-smoke symbol)
(white-eco handle)
(des-cam-entity string)
(use-interesting symbol)
(ignore-camera symbol)
(ambient ambient-control :inline)
(yellow-gun joint-mod)
(palette-val float)
(looping-sound ambient-sound 4)
(dda robotboss-dda)
(valid-frames int32)
(skip-cut symbol)
(keep-charging symbol)
)
(:methods
(ease-loc-t (_type_) float)
)
(:states
robotboss-blue-dark-bomb
robotboss-blue-dark-bomb-wait
robotboss-blue-wait
robotboss-daxter-sacrifice-movie
robotboss-green
robotboss-green-dark-bomb
robotboss-green-dark-bomb-wait
robotboss-green-wait
robotboss-red
robotboss-red-dark-bomb
robotboss-red-dark-bomb-wait
robotboss-red-wait
robotboss-white-eco-movie
robotboss-yellow
robotboss-yellow-dark-bomb
robotboss-yellow-dark-bomb-wait
robotboss-yellow-wait
)
)
(defmethod relocate ((this robotboss) (arg0 int))
(dotimes (v1-0 7)
(if (nonzero? (-> this particle v1-0))
(&+! (-> this particle v1-0) arg0)
)
)
(dotimes (v1-3 4)
(if (nonzero? (-> this looping-sound v1-3))
(&+! (-> this looping-sound v1-3) arg0)
)
)
(if (nonzero? (-> this yellow-gun))
(&+! (-> this yellow-gun) arg0)
)
(the-as robotboss ((method-of-type process-drawable relocate) this arg0))
)
(defmethod deactivate ((this robotboss))
(dotimes (s5-0 7)
(let ((a0-1 (-> this particle s5-0)))
(if (nonzero? a0-1)
(kill-and-free-particles a0-1)
)
)
)
(dotimes (s5-1 4)
(let ((a0-2 (-> this looping-sound s5-1)))
(if (nonzero? a0-2)
(stop! a0-2)
)
)
)
((method-of-type process-drawable deactivate) this)
(none)
)
(defbehavior target-has-all-the-cells? process ()
(the-as
symbol
(and *target* (>= (the int (the-as float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) 100))
)
)
(defskelgroup *robotboss-sg* robotboss robotboss-basic-lod0-jg robotboss-idle-ja
((robotboss-basic-lod0-mg (meters 999999)))
:bounds (static-spherem 0 -10 0 80)
:longest-edge (meters 19.9)
)