jak-project/goal_src/jak1/levels/finalboss/robotboss-h.gc
Tyler Wilding d1ece445d4
Dependency graph work - Part 1 - Preliminary work (#3505)
Relates to #1353 

This adds no new functionality or overhead to the compiler, yet. This is
the preliminary work that has:
- added code to the compiler in several spots to flag when something is
used without being properly required/imported/whatever (disabled by
default)
- that was used to generate project wide file dependencies (some
circulars were manually fixed)
- then that graph underwent a transitive reduction and the result was
written to all `jak1` source files.

The next step will be making this actually produce and use a dependency
graph. Some of the reasons why I'm working on this:
- eliminates more `game.gp` boilerplate. This includes the `.gd` files
to some extent (`*-ag` files and `tpage` files will still need to be
handled) this is the point of the new `bundles` form. This should make
it even easier to add a new file into the source tree.
- a build order that is actually informed from something real and
compiler warnings that tell you when you are using something that won't
be available at build time.
- narrows the search space for doing LSP actions -- like searching for
references. Since it would be way too much work to store in the compiler
every location where every symbol/function/etc is used, I have to do
ad-hoc searches. By having a dependency graph i can significantly reduce
that search space.
- opens the doors for common shared code with a legitimate pattern.
Right now jak 2 shares code from the jak 1 folder. This is basically a
hack -- but by having an explicit require syntax, it would be possible
to reference arbitrary file paths, such as a `common` folder.

Some stats:
- Jak 1 has about 2500 edges between files, including transitives
- With transitives reduced at the source code level, each file seems to
have a modest amount of explicit requirements.

Known issues:
- Tracking the location for where `defmacro`s and virtual state
definitions were defined (and therefore the file) is still problematic.
Because those forms are in a macro environment, the reader does not
track them. I'm wondering if a workaround could be to search the
reader's text_db by not just the `goos::Object` but by the text
position. But for the purposes of finishing this work, I just statically
analyzed and searched the code with throwaway python code.
2024-05-12 12:37:59 -04:00

136 lines
3.6 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
(bundles "FIN.DGO")
(require "engine/data/art-h.gc")
(require "engine/gfx/sprite/sparticle/sparticle-launcher.gc")
;; 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)
)