jak-project/goal_src/levels/common/babak-with-cannon.gc

700 lines
16 KiB
Common Lisp
Raw Normal View History

;;-*-Lisp-*-
2020-09-04 14:44:23 -04:00
(in-package goal)
;; name: babak-with-cannon.gc
;; name in dgo: babak-with-cannon
;; dgos: BEA, L1, MIS
decomp: Continuing full pass of gameplay code (#839) * decomp: finish `babak` - :code is called in `(code nav-enemy-patrol babak)` * decomp: almost finish `process-taskable` * blocked: mistycannon / pelican * decomp: finish `babak-with-cannon` write a script to fix gsrc * decomp: finish `process-taskable` * decomp: finish `flutflut` and `yakow` * decomp: finish `fishermans-boat` * blocked: state decomp `training-obs` * decomp: finish `muse` * decomp: finish `bonelurker` * blocked: state decomp in `quicksandlurker`| `balloonlurker` * decomp: finish `assistant-village2` * scripts: script to help updating goal_src * starting to update goal_src * tests: update ref tests * src: more src updating * src: waiting on `process-taskable` and `muse` * blocked: `citb-plat` state decomp * decomp: finish `square-platform` * blocked: `orbit-plat` due to overlays + static data * decomp: finish `qbert-plat` * blocked: almost finish `misty-conveyor`, sparticle-callback * blocked: jungle-mirrors * blocked: state decomp in `swamp-blimp` * decomp: finish `swamp-bat` * decomp: finish `swamp-rat` * decomp: finish `swamp-rat-nest` * blocked: state decomp `kermit` * decomp: finish `cavecrystal-light` * decomp: finish `spiderwebs` * blocked: state decomp `dark-crystal` * decomp: finish `baby-spider` * decomp: finish `mother-spider-h` * decomp: finish `mother-spider-proj` * blocked: state decomp in `gnawer` * blocked: state decomp in `driller-lurker` * blocked: `sun-exit-chamber` breaks when adding handle cast * decomp: finish `sunken-water` * blocked: `target-tube` ShortCircuitElement::push_to_stack * decomp: finish `sunken-fish` * blocked: `minecart` decomp crash when adding stack cast * decomp: finish `assistant-village3` * decomp: finish `sage-village3` * blocked: `cave-trap` done but ran into `go` issue * blocked: `spider-egg` state decomp * decomp: finish `target-snowball` * blocked/stuck: `target-ice` decomp issue around cpad * pausing: ice-cube has some weird collide-shape-prim handling * blocked: `snow-ball` state decomp * blocked: `snow-bumper` state decomp * decomp: finish `snow-ram-h` * decomp: finish `yeti` * decomp: finish `assistant-lavatube` * re-enable the float cast log * decomp: updating to new sparticle definitions * decomp: address feedback up to `swamp-rat-nest` * address remaining feedback * all-types: move the `pointer` def * add back temporary `hud-hidden?`
2021-09-28 20:42:00 -04:00
(declare-type babak-with-cannon babak)
(define-extern babak-with-cannon-jump-off-cannon (state babak-with-cannon)) ;; unknown type
(define-extern babak-with-cannon-shooting (state babak-with-cannon)) ;; unknown type
(define-extern babak-with-cannon-jump-onto-cannon (state babak-with-cannon)) ;; unknown type
(define-extern babak-run-to-cannon (state babak)) ;; unknown type
;; DECOMP BEGINS
(deftype babak-with-cannon (babak)
((cannon-ent entity :offset-assert 400)
(distance float :offset-assert 404)
)
:heap-base #x130
:method-count-assert 76
:size-assert #x198
:flag-assert #x4c01300198
)
nav-enemy-default-event-handler
(defstate nav-enemy-idle (babak-with-cannon)
:virtual #t
:event
(the-as
(function process int symbol event-message-block object :behavior babak-with-cannon)
nav-enemy-default-event-handler
)
:trans
(behavior ()
(if
(and
(and
*target*
(>=
(-> self enemy-info idle-distance)
(vector-vector-distance
(-> self collide-info trans)
(-> *target* control trans)
)
)
)
(>=
(- (-> *display* base-frame-counter) (-> self state-time))
decomp: Continuing full pass of gameplay code (#839) * decomp: finish `babak` - :code is called in `(code nav-enemy-patrol babak)` * decomp: almost finish `process-taskable` * blocked: mistycannon / pelican * decomp: finish `babak-with-cannon` write a script to fix gsrc * decomp: finish `process-taskable` * decomp: finish `flutflut` and `yakow` * decomp: finish `fishermans-boat` * blocked: state decomp `training-obs` * decomp: finish `muse` * decomp: finish `bonelurker` * blocked: state decomp in `quicksandlurker`| `balloonlurker` * decomp: finish `assistant-village2` * scripts: script to help updating goal_src * starting to update goal_src * tests: update ref tests * src: more src updating * src: waiting on `process-taskable` and `muse` * blocked: `citb-plat` state decomp * decomp: finish `square-platform` * blocked: `orbit-plat` due to overlays + static data * decomp: finish `qbert-plat` * blocked: almost finish `misty-conveyor`, sparticle-callback * blocked: jungle-mirrors * blocked: state decomp in `swamp-blimp` * decomp: finish `swamp-bat` * decomp: finish `swamp-rat` * decomp: finish `swamp-rat-nest` * blocked: state decomp `kermit` * decomp: finish `cavecrystal-light` * decomp: finish `spiderwebs` * blocked: state decomp `dark-crystal` * decomp: finish `baby-spider` * decomp: finish `mother-spider-h` * decomp: finish `mother-spider-proj` * blocked: state decomp in `gnawer` * blocked: state decomp in `driller-lurker` * blocked: `sun-exit-chamber` breaks when adding handle cast * decomp: finish `sunken-water` * blocked: `target-tube` ShortCircuitElement::push_to_stack * decomp: finish `sunken-fish` * blocked: `minecart` decomp crash when adding stack cast * decomp: finish `assistant-village3` * decomp: finish `sage-village3` * blocked: `cave-trap` done but ran into `go` issue * blocked: `spider-egg` state decomp * decomp: finish `target-snowball` * blocked/stuck: `target-ice` decomp issue around cpad * pausing: ice-cube has some weird collide-shape-prim handling * blocked: `snow-ball` state decomp * blocked: `snow-bumper` state decomp * decomp: finish `snow-ram-h` * decomp: finish `yeti` * decomp: finish `assistant-lavatube` * re-enable the float cast log * decomp: updating to new sparticle definitions * decomp: address feedback up to `swamp-rat-nest` * address remaining feedback * all-types: move the `pointer` def * add back temporary `hud-hidden?`
2021-09-28 20:42:00 -04:00
(-> self state-timeout)
)
)
(go-virtual nav-enemy-patrol)
)
(none)
)
:code
(behavior ()
(ja-channel-push! 1 22)
(let ((a0-1 (-> self skel root-channel 0)))
(set!
(-> a0-1 frame-group)
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info idle-anim))
)
)
(set!
(-> a0-1 param 0)
(the
float
(+
(->
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info idle-anim))
)
data
0
length
)
-1
)
)
)
(set! (-> a0-1 param 1) 1.0)
(set! (-> a0-1 frame-num) 0.0)
(joint-control-channel-group!
a0-1
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info idle-anim))
)
num-func-seek!
)
)
(until (ja-done? 0)
(ja-post)
(suspend)
(let ((a0-2 (-> self skel root-channel 0)))
(set!
(-> a0-2 param 0)
(the float (+ (-> a0-2 frame-group data 0 length) -1))
)
(set! (-> a0-2 param 1) 1.0)
(joint-control-channel-group-eval!
a0-2
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(anim-loop)
(none)
)
:post
(the-as (function none :behavior babak-with-cannon) #f)
)
(defstate nav-enemy-patrol (babak-with-cannon)
:virtual #t
:event
(the-as
(function process int symbol event-message-block object :behavior babak-with-cannon)
nav-enemy-default-event-handler
)
:trans
(behavior ()
(when (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30)
decomp: Continuing full pass of gameplay code (#839) * decomp: finish `babak` - :code is called in `(code nav-enemy-patrol babak)` * decomp: almost finish `process-taskable` * blocked: mistycannon / pelican * decomp: finish `babak-with-cannon` write a script to fix gsrc * decomp: finish `process-taskable` * decomp: finish `flutflut` and `yakow` * decomp: finish `fishermans-boat` * blocked: state decomp `training-obs` * decomp: finish `muse` * decomp: finish `bonelurker` * blocked: state decomp in `quicksandlurker`| `balloonlurker` * decomp: finish `assistant-village2` * scripts: script to help updating goal_src * starting to update goal_src * tests: update ref tests * src: more src updating * src: waiting on `process-taskable` and `muse` * blocked: `citb-plat` state decomp * decomp: finish `square-platform` * blocked: `orbit-plat` due to overlays + static data * decomp: finish `qbert-plat` * blocked: almost finish `misty-conveyor`, sparticle-callback * blocked: jungle-mirrors * blocked: state decomp in `swamp-blimp` * decomp: finish `swamp-bat` * decomp: finish `swamp-rat` * decomp: finish `swamp-rat-nest` * blocked: state decomp `kermit` * decomp: finish `cavecrystal-light` * decomp: finish `spiderwebs` * blocked: state decomp `dark-crystal` * decomp: finish `baby-spider` * decomp: finish `mother-spider-h` * decomp: finish `mother-spider-proj` * blocked: state decomp in `gnawer` * blocked: state decomp in `driller-lurker` * blocked: `sun-exit-chamber` breaks when adding handle cast * decomp: finish `sunken-water` * blocked: `target-tube` ShortCircuitElement::push_to_stack * decomp: finish `sunken-fish` * blocked: `minecart` decomp crash when adding stack cast * decomp: finish `assistant-village3` * decomp: finish `sage-village3` * blocked: `cave-trap` done but ran into `go` issue * blocked: `spider-egg` state decomp * decomp: finish `target-snowball` * blocked/stuck: `target-ice` decomp issue around cpad * pausing: ice-cube has some weird collide-shape-prim handling * blocked: `snow-ball` state decomp * blocked: `snow-bumper` state decomp * decomp: finish `snow-ram-h` * decomp: finish `yeti` * decomp: finish `assistant-lavatube` * re-enable the float cast log * decomp: updating to new sparticle definitions * decomp: address feedback up to `swamp-rat-nest` * address remaining feedback * all-types: move the `pointer` def * add back temporary `hud-hidden?`
2021-09-28 20:42:00 -04:00
(let ((f30-0 (- (-> (target-pos 0) y) (-> self collide-info trans y))))
(if
(and
(>= (- (-> *display* base-frame-counter) (-> self state-time)) 900)
decomp: Continuing full pass of gameplay code (#839) * decomp: finish `babak` - :code is called in `(code nav-enemy-patrol babak)` * decomp: almost finish `process-taskable` * blocked: mistycannon / pelican * decomp: finish `babak-with-cannon` write a script to fix gsrc * decomp: finish `process-taskable` * decomp: finish `flutflut` and `yakow` * decomp: finish `fishermans-boat` * blocked: state decomp `training-obs` * decomp: finish `muse` * decomp: finish `bonelurker` * blocked: state decomp in `quicksandlurker`| `balloonlurker` * decomp: finish `assistant-village2` * scripts: script to help updating goal_src * starting to update goal_src * tests: update ref tests * src: more src updating * src: waiting on `process-taskable` and `muse` * blocked: `citb-plat` state decomp * decomp: finish `square-platform` * blocked: `orbit-plat` due to overlays + static data * decomp: finish `qbert-plat` * blocked: almost finish `misty-conveyor`, sparticle-callback * blocked: jungle-mirrors * blocked: state decomp in `swamp-blimp` * decomp: finish `swamp-bat` * decomp: finish `swamp-rat` * decomp: finish `swamp-rat-nest` * blocked: state decomp `kermit` * decomp: finish `cavecrystal-light` * decomp: finish `spiderwebs` * blocked: state decomp `dark-crystal` * decomp: finish `baby-spider` * decomp: finish `mother-spider-h` * decomp: finish `mother-spider-proj` * blocked: state decomp in `gnawer` * blocked: state decomp in `driller-lurker` * blocked: `sun-exit-chamber` breaks when adding handle cast * decomp: finish `sunken-water` * blocked: `target-tube` ShortCircuitElement::push_to_stack * decomp: finish `sunken-fish` * blocked: `minecart` decomp crash when adding stack cast * decomp: finish `assistant-village3` * decomp: finish `sage-village3` * blocked: `cave-trap` done but ran into `go` issue * blocked: `spider-egg` state decomp * decomp: finish `target-snowball` * blocked/stuck: `target-ice` decomp issue around cpad * pausing: ice-cube has some weird collide-shape-prim handling * blocked: `snow-ball` state decomp * blocked: `snow-bumper` state decomp * decomp: finish `snow-ram-h` * decomp: finish `yeti` * decomp: finish `assistant-lavatube` * re-enable the float cast log * decomp: updating to new sparticle definitions * decomp: address feedback up to `swamp-rat-nest` * address remaining feedback * all-types: move the `pointer` def * add back temporary `hud-hidden?`
2021-09-28 20:42:00 -04:00
(or
(or
(not *target*)
(<
(-> self distance)
(vector-vector-distance
(-> self collide-info trans)
(-> *target* control trans)
)
)
)
(< f30-0 -40960.0)
)
)
(go babak-run-to-cannon)
)
)
(when
(>=
(- (-> *display* base-frame-counter) (-> self state-time))
decomp: Continuing full pass of gameplay code (#839) * decomp: finish `babak` - :code is called in `(code nav-enemy-patrol babak)` * decomp: almost finish `process-taskable` * blocked: mistycannon / pelican * decomp: finish `babak-with-cannon` write a script to fix gsrc * decomp: finish `process-taskable` * decomp: finish `flutflut` and `yakow` * decomp: finish `fishermans-boat` * blocked: state decomp `training-obs` * decomp: finish `muse` * decomp: finish `bonelurker` * blocked: state decomp in `quicksandlurker`| `balloonlurker` * decomp: finish `assistant-village2` * scripts: script to help updating goal_src * starting to update goal_src * tests: update ref tests * src: more src updating * src: waiting on `process-taskable` and `muse` * blocked: `citb-plat` state decomp * decomp: finish `square-platform` * blocked: `orbit-plat` due to overlays + static data * decomp: finish `qbert-plat` * blocked: almost finish `misty-conveyor`, sparticle-callback * blocked: jungle-mirrors * blocked: state decomp in `swamp-blimp` * decomp: finish `swamp-bat` * decomp: finish `swamp-rat` * decomp: finish `swamp-rat-nest` * blocked: state decomp `kermit` * decomp: finish `cavecrystal-light` * decomp: finish `spiderwebs` * blocked: state decomp `dark-crystal` * decomp: finish `baby-spider` * decomp: finish `mother-spider-h` * decomp: finish `mother-spider-proj` * blocked: state decomp in `gnawer` * blocked: state decomp in `driller-lurker` * blocked: `sun-exit-chamber` breaks when adding handle cast * decomp: finish `sunken-water` * blocked: `target-tube` ShortCircuitElement::push_to_stack * decomp: finish `sunken-fish` * blocked: `minecart` decomp crash when adding stack cast * decomp: finish `assistant-village3` * decomp: finish `sage-village3` * blocked: `cave-trap` done but ran into `go` issue * blocked: `spider-egg` state decomp * decomp: finish `target-snowball` * blocked/stuck: `target-ice` decomp issue around cpad * pausing: ice-cube has some weird collide-shape-prim handling * blocked: `snow-ball` state decomp * blocked: `snow-bumper` state decomp * decomp: finish `snow-ram-h` * decomp: finish `yeti` * decomp: finish `assistant-lavatube` * re-enable the float cast log * decomp: updating to new sparticle definitions * decomp: address feedback up to `swamp-rat-nest` * address remaining feedback * all-types: move the `pointer` def * add back temporary `hud-hidden?`
2021-09-28 20:42:00 -04:00
(-> self state-timeout)
)
(if
(or
(not *target*)
(<
(-> self enemy-info idle-distance)
(vector-vector-distance
(-> self collide-info trans)
(-> *target* control trans)
)
)
)
(go-virtual nav-enemy-idle)
)
)
(if (nav-enemy-notice-player?)
(go-virtual nav-enemy-notice)
)
)
(none)
)
:code
(-> (method-of-type babak nav-enemy-patrol) code)
)
(defstate babak-run-to-cannon (babak)
:event
(the-as
(function process int symbol event-message-block object :behavior babak)
nav-enemy-default-event-handler
)
:enter
(behavior ()
(set! (-> self state-time) (-> *display* base-frame-counter))
decomp: Continuing full pass of gameplay code (#839) * decomp: finish `babak` - :code is called in `(code nav-enemy-patrol babak)` * decomp: almost finish `process-taskable` * blocked: mistycannon / pelican * decomp: finish `babak-with-cannon` write a script to fix gsrc * decomp: finish `process-taskable` * decomp: finish `flutflut` and `yakow` * decomp: finish `fishermans-boat` * blocked: state decomp `training-obs` * decomp: finish `muse` * decomp: finish `bonelurker` * blocked: state decomp in `quicksandlurker`| `balloonlurker` * decomp: finish `assistant-village2` * scripts: script to help updating goal_src * starting to update goal_src * tests: update ref tests * src: more src updating * src: waiting on `process-taskable` and `muse` * blocked: `citb-plat` state decomp * decomp: finish `square-platform` * blocked: `orbit-plat` due to overlays + static data * decomp: finish `qbert-plat` * blocked: almost finish `misty-conveyor`, sparticle-callback * blocked: jungle-mirrors * blocked: state decomp in `swamp-blimp` * decomp: finish `swamp-bat` * decomp: finish `swamp-rat` * decomp: finish `swamp-rat-nest` * blocked: state decomp `kermit` * decomp: finish `cavecrystal-light` * decomp: finish `spiderwebs` * blocked: state decomp `dark-crystal` * decomp: finish `baby-spider` * decomp: finish `mother-spider-h` * decomp: finish `mother-spider-proj` * blocked: state decomp in `gnawer` * blocked: state decomp in `driller-lurker` * blocked: `sun-exit-chamber` breaks when adding handle cast * decomp: finish `sunken-water` * blocked: `target-tube` ShortCircuitElement::push_to_stack * decomp: finish `sunken-fish` * blocked: `minecart` decomp crash when adding stack cast * decomp: finish `assistant-village3` * decomp: finish `sage-village3` * blocked: `cave-trap` done but ran into `go` issue * blocked: `spider-egg` state decomp * decomp: finish `target-snowball` * blocked/stuck: `target-ice` decomp issue around cpad * pausing: ice-cube has some weird collide-shape-prim handling * blocked: `snow-ball` state decomp * blocked: `snow-bumper` state decomp * decomp: finish `snow-ram-h` * decomp: finish `yeti` * decomp: finish `assistant-lavatube` * re-enable the float cast log * decomp: updating to new sparticle definitions * decomp: address feedback up to `swamp-rat-nest` * address remaining feedback * all-types: move the `pointer` def * add back temporary `hud-hidden?`
2021-09-28 20:42:00 -04:00
(set! (-> self nav destination-pos quad) (-> self entity extra trans quad))
(set! (-> self nav target-pos quad) (-> self entity extra trans quad))
(none)
)
:trans
(behavior ()
(if (nav-enemy-notice-player?)
(go-virtual nav-enemy-chase)
)
(if (logtest? (nav-control-flags bit19) (-> self nav flags))
(go babak-with-cannon-jump-onto-cannon)
)
(none)
)
:code
(behavior ()
(ja-channel-push! 1 22)
(while #t
(let ((a0-1 (-> self skel root-channel 0)))
(set!
(-> a0-1 frame-group)
(the-as art-joint-anim (-> self draw art-group data 8))
)
(set!
(-> a0-1 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 8))
data
0
length
)
-1
)
)
)
(set! (-> a0-1 param 1) 1.0)
(set! (-> a0-1 frame-num) 0.0)
(joint-control-channel-group!
a0-1
(the-as art-joint-anim (-> self draw art-group data 8))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-2 (-> self skel root-channel 0)))
(set!
(-> a0-2 param 0)
(the float (+ (-> a0-2 frame-group data 0 length) -1))
)
(set! (-> a0-2 param 1) 1.0)
(joint-control-channel-group-eval!
a0-2
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
)
(none)
)
:post
(behavior ()
(nav-enemy-travel-post)
(none)
)
)
(defun handle->process-safe ((arg0 handle))
(let ((v0-0 (the-as process #f)))
(if (handle->process arg0)
(set! v0-0 (-> arg0 process 0))
)
v0-0
)
)
(defun babak-with-cannon-compute-cannon-dir ((arg0 mistycannon) (arg1 vector))
(set! (-> arg1 quad) (-> arg0 node-list data 3 bone transform vector 2 quad))
arg1
)
(defun babak-with-cannon-compute-ride-point ((arg0 mistycannon) (arg1 vector))
(set! (-> arg1 quad) (-> arg0 root trans quad))
(let ((a1-4 (new 'static 'vector :y 18149.377 :z -17289.217 :w 1.0))
(a2-0 (-> arg0 node-list data 3 bone transform))
)
(vector-matrix*! arg1 a1-4 a2-0)
)
arg1
)
(defbehavior babak-with-cannon-ride-cannon-post babak-with-cannon ()
(let* ((v1-0 (-> self cannon-ent))
(s5-0 (if v1-0
(-> v1-0 extra process)
)
)
(gp-0
(if (and (nonzero? s5-0) (type-type? (-> s5-0 type) process-drawable))
s5-0
)
)
)
(when gp-0
(let ((s5-1 (new 'stack-no-clear 'vector)))
(babak-with-cannon-compute-cannon-dir (the-as mistycannon gp-0) s5-1)
(forward-up->quaternion (-> self collide-info quat) s5-1 *y-vector*)
)
(babak-with-cannon-compute-ride-point
(the-as mistycannon gp-0)
(-> self collide-info trans)
)
)
)
(nav-enemy-simple-post)
(none)
)
(defstate babak-with-cannon-jump-onto-cannon (babak-with-cannon)
:event
(the-as
(function process int symbol event-message-block object :behavior babak-with-cannon)
nav-enemy-jump-event-handler
)
:exit
(behavior ()
(logior! (-> self nav-enemy-flags) 24)
(none)
)
:code
(behavior ()
(set! (-> self state-time) (-> *display* base-frame-counter))
decomp: Continuing full pass of gameplay code (#839) * decomp: finish `babak` - :code is called in `(code nav-enemy-patrol babak)` * decomp: almost finish `process-taskable` * blocked: mistycannon / pelican * decomp: finish `babak-with-cannon` write a script to fix gsrc * decomp: finish `process-taskable` * decomp: finish `flutflut` and `yakow` * decomp: finish `fishermans-boat` * blocked: state decomp `training-obs` * decomp: finish `muse` * decomp: finish `bonelurker` * blocked: state decomp in `quicksandlurker`| `balloonlurker` * decomp: finish `assistant-village2` * scripts: script to help updating goal_src * starting to update goal_src * tests: update ref tests * src: more src updating * src: waiting on `process-taskable` and `muse` * blocked: `citb-plat` state decomp * decomp: finish `square-platform` * blocked: `orbit-plat` due to overlays + static data * decomp: finish `qbert-plat` * blocked: almost finish `misty-conveyor`, sparticle-callback * blocked: jungle-mirrors * blocked: state decomp in `swamp-blimp` * decomp: finish `swamp-bat` * decomp: finish `swamp-rat` * decomp: finish `swamp-rat-nest` * blocked: state decomp `kermit` * decomp: finish `cavecrystal-light` * decomp: finish `spiderwebs` * blocked: state decomp `dark-crystal` * decomp: finish `baby-spider` * decomp: finish `mother-spider-h` * decomp: finish `mother-spider-proj` * blocked: state decomp in `gnawer` * blocked: state decomp in `driller-lurker` * blocked: `sun-exit-chamber` breaks when adding handle cast * decomp: finish `sunken-water` * blocked: `target-tube` ShortCircuitElement::push_to_stack * decomp: finish `sunken-fish` * blocked: `minecart` decomp crash when adding stack cast * decomp: finish `assistant-village3` * decomp: finish `sage-village3` * blocked: `cave-trap` done but ran into `go` issue * blocked: `spider-egg` state decomp * decomp: finish `target-snowball` * blocked/stuck: `target-ice` decomp issue around cpad * pausing: ice-cube has some weird collide-shape-prim handling * blocked: `snow-ball` state decomp * blocked: `snow-bumper` state decomp * decomp: finish `snow-ram-h` * decomp: finish `yeti` * decomp: finish `assistant-lavatube` * re-enable the float cast log * decomp: updating to new sparticle definitions * decomp: address feedback up to `swamp-rat-nest` * address remaining feedback * all-types: move the `pointer` def * add back temporary `hud-hidden?`
2021-09-28 20:42:00 -04:00
(set! (-> self rotate-speed) (-> self nav-info run-rotate-speed))
(set! (-> self turn-time) (the-as int (-> self nav-info run-turn-time)))
(set! (-> self nav-enemy-flags) (logand -25 (-> self nav-enemy-flags)))
(nav-enemy-neck-control-inactive)
(let* ((v1-7 (-> self cannon-ent))
(gp-0 (if v1-7
(-> v1-7 extra process)
)
)
(a0-2
(if
(and (nonzero? gp-0) (type-type? (-> gp-0 type) process-drawable))
gp-0
)
)
)
(cond
(a0-2
(babak-with-cannon-compute-ride-point
(the-as mistycannon a0-2)
(-> self event-param-point)
)
(nav-enemy-initialize-jump (-> self event-param-point))
)
(else
(go-virtual nav-enemy-idle)
)
)
)
(when (not (nav-enemy-facing-point? (-> self jump-dest) 5461.3335))
(ja-channel-push! 1 60)
(nav-enemy-turn-to-face-point (-> self jump-dest) 1820.4445)
)
(logior! (-> self nav-enemy-flags) 16)
(nav-enemy-execute-jump)
(set! (-> self nav-enemy-flags) (logand -25 (-> self nav-enemy-flags)))
(let* ((v1-20 (-> self cannon-ent))
(gp-1 (if v1-20
(-> v1-20 extra process)
)
)
(a0-9
(if
(and (nonzero? gp-1) (type-type? (-> gp-1 type) process-drawable))
gp-1
)
)
)
(when a0-9
(let
((gp-2
(babak-with-cannon-compute-cannon-dir
(the-as mistycannon a0-9)
(new 'stack-no-clear 'vector)
)
)
)
(when (not (nav-enemy-facing-direction? gp-2 1820.4445))
(ja-channel-push! 1 60)
(nav-enemy-turn-to-face-dir gp-2 182.04445)
(forward-up->quaternion (-> self collide-info quat) gp-2 *y-vector*)
)
)
)
)
(ja-channel-push! 1 30)
(let ((a0-15 (-> self skel root-channel 0)))
(set!
(-> a0-15 frame-group)
(the-as art-joint-anim (-> self draw art-group data 17))
)
(set!
(-> a0-15 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 17))
data
0
length
)
-1
)
)
)
(set! (-> a0-15 param 1) 1.0)
(set! (-> a0-15 frame-num) 0.0)
(joint-control-channel-group!
a0-15
(the-as art-joint-anim (-> self draw art-group data 17))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-16 (-> self skel root-channel 0)))
(set!
(-> a0-16 param 0)
(the float (+ (-> a0-16 frame-group data 0 length) -1))
)
(set! (-> a0-16 param 1) 1.0)
(joint-control-channel-group-eval!
a0-16
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(go babak-with-cannon-shooting)
(none)
)
:post
(the-as (function none :behavior babak-with-cannon) nav-enemy-jump-post)
)
(defstate babak-with-cannon-jump-off-cannon (babak-with-cannon)
:event
(the-as
(function process int symbol event-message-block object :behavior babak-with-cannon)
nav-enemy-jump-event-handler
)
:exit
(behavior ()
(logior! (-> self nav-enemy-flags) 24)
(none)
)
:code
(behavior ()
(set! (-> self state-time) (-> *display* base-frame-counter))
decomp: Continuing full pass of gameplay code (#839) * decomp: finish `babak` - :code is called in `(code nav-enemy-patrol babak)` * decomp: almost finish `process-taskable` * blocked: mistycannon / pelican * decomp: finish `babak-with-cannon` write a script to fix gsrc * decomp: finish `process-taskable` * decomp: finish `flutflut` and `yakow` * decomp: finish `fishermans-boat` * blocked: state decomp `training-obs` * decomp: finish `muse` * decomp: finish `bonelurker` * blocked: state decomp in `quicksandlurker`| `balloonlurker` * decomp: finish `assistant-village2` * scripts: script to help updating goal_src * starting to update goal_src * tests: update ref tests * src: more src updating * src: waiting on `process-taskable` and `muse` * blocked: `citb-plat` state decomp * decomp: finish `square-platform` * blocked: `orbit-plat` due to overlays + static data * decomp: finish `qbert-plat` * blocked: almost finish `misty-conveyor`, sparticle-callback * blocked: jungle-mirrors * blocked: state decomp in `swamp-blimp` * decomp: finish `swamp-bat` * decomp: finish `swamp-rat` * decomp: finish `swamp-rat-nest` * blocked: state decomp `kermit` * decomp: finish `cavecrystal-light` * decomp: finish `spiderwebs` * blocked: state decomp `dark-crystal` * decomp: finish `baby-spider` * decomp: finish `mother-spider-h` * decomp: finish `mother-spider-proj` * blocked: state decomp in `gnawer` * blocked: state decomp in `driller-lurker` * blocked: `sun-exit-chamber` breaks when adding handle cast * decomp: finish `sunken-water` * blocked: `target-tube` ShortCircuitElement::push_to_stack * decomp: finish `sunken-fish` * blocked: `minecart` decomp crash when adding stack cast * decomp: finish `assistant-village3` * decomp: finish `sage-village3` * blocked: `cave-trap` done but ran into `go` issue * blocked: `spider-egg` state decomp * decomp: finish `target-snowball` * blocked/stuck: `target-ice` decomp issue around cpad * pausing: ice-cube has some weird collide-shape-prim handling * blocked: `snow-ball` state decomp * blocked: `snow-bumper` state decomp * decomp: finish `snow-ram-h` * decomp: finish `yeti` * decomp: finish `assistant-lavatube` * re-enable the float cast log * decomp: updating to new sparticle definitions * decomp: address feedback up to `swamp-rat-nest` * address remaining feedback * all-types: move the `pointer` def * add back temporary `hud-hidden?`
2021-09-28 20:42:00 -04:00
(nav-enemy-initialize-jump (-> self entity extra trans))
(nav-enemy-neck-control-look-at)
(set! (-> self nav-enemy-flags) (logand -25 (-> self nav-enemy-flags)))
(let ((a0-2 (-> self skel root-channel 0)))
(set!
(-> a0-2 frame-group)
(the-as art-joint-anim (-> self draw art-group data 17))
)
(set! (-> a0-2 param 0) 0.0)
(set! (-> a0-2 param 1) 2.0)
(set!
(-> a0-2 frame-num)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 17))
data
0
length
)
-1
)
)
)
(joint-control-channel-group!
a0-2
(the-as art-joint-anim (-> self draw art-group data 17))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-3 (-> self skel root-channel 0)))
(set! (-> a0-3 param 0) 0.0)
(set! (-> a0-3 param 1) 2.0)
(joint-control-channel-group-eval!
a0-3
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(when (not (nav-enemy-facing-point? (-> self jump-dest) 5461.3335))
(ja-channel-push! 1 60)
(nav-enemy-turn-to-face-point (-> self jump-dest) 1820.4445)
)
(logior! (-> self nav-enemy-flags) 16)
(nav-enemy-execute-jump)
(let ((a1-6 (dummy-16 (-> self nav) (-> self jump-dest))))
(set-current-poly! (-> self nav) a1-6)
)
(go-virtual nav-enemy-jump-land)
(none)
)
:post
(the-as (function none :behavior babak-with-cannon) nav-enemy-jump-post)
)
(defstate babak-with-cannon-shooting (babak-with-cannon)
:event
(the-as
(function process int symbol event-message-block object :behavior babak-with-cannon)
nav-enemy-default-event-handler
)
:enter
(behavior ()
(set! (-> self state-time) (-> *display* base-frame-counter))
decomp: Continuing full pass of gameplay code (#839) * decomp: finish `babak` - :code is called in `(code nav-enemy-patrol babak)` * decomp: almost finish `process-taskable` * blocked: mistycannon / pelican * decomp: finish `babak-with-cannon` write a script to fix gsrc * decomp: finish `process-taskable` * decomp: finish `flutflut` and `yakow` * decomp: finish `fishermans-boat` * blocked: state decomp `training-obs` * decomp: finish `muse` * decomp: finish `bonelurker` * blocked: state decomp in `quicksandlurker`| `balloonlurker` * decomp: finish `assistant-village2` * scripts: script to help updating goal_src * starting to update goal_src * tests: update ref tests * src: more src updating * src: waiting on `process-taskable` and `muse` * blocked: `citb-plat` state decomp * decomp: finish `square-platform` * blocked: `orbit-plat` due to overlays + static data * decomp: finish `qbert-plat` * blocked: almost finish `misty-conveyor`, sparticle-callback * blocked: jungle-mirrors * blocked: state decomp in `swamp-blimp` * decomp: finish `swamp-bat` * decomp: finish `swamp-rat` * decomp: finish `swamp-rat-nest` * blocked: state decomp `kermit` * decomp: finish `cavecrystal-light` * decomp: finish `spiderwebs` * blocked: state decomp `dark-crystal` * decomp: finish `baby-spider` * decomp: finish `mother-spider-h` * decomp: finish `mother-spider-proj` * blocked: state decomp in `gnawer` * blocked: state decomp in `driller-lurker` * blocked: `sun-exit-chamber` breaks when adding handle cast * decomp: finish `sunken-water` * blocked: `target-tube` ShortCircuitElement::push_to_stack * decomp: finish `sunken-fish` * blocked: `minecart` decomp crash when adding stack cast * decomp: finish `assistant-village3` * decomp: finish `sage-village3` * blocked: `cave-trap` done but ran into `go` issue * blocked: `spider-egg` state decomp * decomp: finish `target-snowball` * blocked/stuck: `target-ice` decomp issue around cpad * pausing: ice-cube has some weird collide-shape-prim handling * blocked: `snow-ball` state decomp * blocked: `snow-bumper` state decomp * decomp: finish `snow-ram-h` * decomp: finish `yeti` * decomp: finish `assistant-lavatube` * re-enable the float cast log * decomp: updating to new sparticle definitions * decomp: address feedback up to `swamp-rat-nest` * address remaining feedback * all-types: move the `pointer` def * add back temporary `hud-hidden?`
2021-09-28 20:42:00 -04:00
(let ((v1-2 (entity-actor-lookup (-> self entity) 'alt-actor 0)))
(if v1-2
(logior! (-> v1-2 extra perm status) (entity-perm-status complete))
)
)
(none)
)
:exit
(behavior ()
(let ((v1-0 (entity-actor-lookup (-> self entity) 'alt-actor 0)))
(if v1-0
(logclear! (-> v1-0 extra perm status) (entity-perm-status complete))
)
)
(none)
)
:trans
(behavior ()
(let ((f0-1 (- (-> (target-pos 0) y) (-> self collide-info trans y))))
(if
(and
(< -40960.0 f0-1)
(and
(and
*target*
(>=
(-> self distance)
(vector-vector-distance
(-> self collide-info trans)
(-> *target* control trans)
)
)
)
(>= (- (-> *display* base-frame-counter) (-> self state-time)) 900)
decomp: Continuing full pass of gameplay code (#839) * decomp: finish `babak` - :code is called in `(code nav-enemy-patrol babak)` * decomp: almost finish `process-taskable` * blocked: mistycannon / pelican * decomp: finish `babak-with-cannon` write a script to fix gsrc * decomp: finish `process-taskable` * decomp: finish `flutflut` and `yakow` * decomp: finish `fishermans-boat` * blocked: state decomp `training-obs` * decomp: finish `muse` * decomp: finish `bonelurker` * blocked: state decomp in `quicksandlurker`| `balloonlurker` * decomp: finish `assistant-village2` * scripts: script to help updating goal_src * starting to update goal_src * tests: update ref tests * src: more src updating * src: waiting on `process-taskable` and `muse` * blocked: `citb-plat` state decomp * decomp: finish `square-platform` * blocked: `orbit-plat` due to overlays + static data * decomp: finish `qbert-plat` * blocked: almost finish `misty-conveyor`, sparticle-callback * blocked: jungle-mirrors * blocked: state decomp in `swamp-blimp` * decomp: finish `swamp-bat` * decomp: finish `swamp-rat` * decomp: finish `swamp-rat-nest` * blocked: state decomp `kermit` * decomp: finish `cavecrystal-light` * decomp: finish `spiderwebs` * blocked: state decomp `dark-crystal` * decomp: finish `baby-spider` * decomp: finish `mother-spider-h` * decomp: finish `mother-spider-proj` * blocked: state decomp in `gnawer` * blocked: state decomp in `driller-lurker` * blocked: `sun-exit-chamber` breaks when adding handle cast * decomp: finish `sunken-water` * blocked: `target-tube` ShortCircuitElement::push_to_stack * decomp: finish `sunken-fish` * blocked: `minecart` decomp crash when adding stack cast * decomp: finish `assistant-village3` * decomp: finish `sage-village3` * blocked: `cave-trap` done but ran into `go` issue * blocked: `spider-egg` state decomp * decomp: finish `target-snowball` * blocked/stuck: `target-ice` decomp issue around cpad * pausing: ice-cube has some weird collide-shape-prim handling * blocked: `snow-ball` state decomp * blocked: `snow-bumper` state decomp * decomp: finish `snow-ram-h` * decomp: finish `yeti` * decomp: finish `assistant-lavatube` * re-enable the float cast log * decomp: updating to new sparticle definitions * decomp: address feedback up to `swamp-rat-nest` * address remaining feedback * all-types: move the `pointer` def * add back temporary `hud-hidden?`
2021-09-28 20:42:00 -04:00
)
)
(go babak-with-cannon-jump-off-cannon)
)
)
(none)
)
:code
(behavior ()
(while #t
(suspend)
)
(none)
)
:post
babak-with-cannon-ride-cannon-post
)
(defstate nav-enemy-die (babak-with-cannon)
:virtual #t
:event
(the-as
(function process int symbol event-message-block object :behavior babak-with-cannon)
nav-enemy-default-event-handler
)
:trans
(behavior ()
(if (and *target* (= (-> *target* current-level name) 'beach))
(spool-push *art-control* "beachcam-cannon" 0 self -1.0)
)
(if (and *target* (= (-> *target* current-level name) 'misty))
(spool-push *art-control* "mistycam-cannon" 0 self -1.0)
)
(let
((t9-3
(->
(the-as (state nav-enemy) (find-parent-method babak-with-cannon 23))
trans
)
)
)
(if t9-3
(t9-3)
)
)
(none)
)
)
(defstate nav-enemy-fuel-cell (babak-with-cannon)
:virtual #t
:event
(the-as
(function process int symbol event-message-block object :behavior babak-with-cannon)
process-drawable-fuel-cell-handler
)
:code
(behavior ()
(ja-channel-set! 0)
(dummy-48 (-> self collide-info))
(ja-post)
(when (not (task-complete? *game-info* (-> self entity extra perm task)))
(when
(not
(and
(-> self entity)
(logtest?
(-> self entity extra perm status)
(entity-perm-status complete)
)
)
)
(process-entity-status! self (entity-perm-status complete) #t)
(if (and *target* (= (-> *target* current-level name) 'beach))
(beachcam-spawn)
)
(if (and *target* (= (-> *target* current-level name) 'misty))
(mistycam-spawn)
)
)
(if (not (-> self child))
(birth-pickup-at-point
(-> self collide-info trans)
6
(the float (-> self entity extra perm task))
#f
self
#f
)
)
(while (-> self child)
(suspend)
)
)
(dummy-18 self)
(none)
)
)
(defmethod common-post babak-with-cannon ((obj babak-with-cannon))
(cond
((= (level-status *level* 'beach) 'active)
(spool-push *art-control* "beachcam-cannon" 0 obj -99.0)
)
((= (level-status *level* 'misty) 'active)
(spool-push *art-control* "mistycam-cannon" 0 obj -99.0)
)
)
((method-of-type nav-enemy common-post) obj)
(none)
)
(defmethod
copy-defaults!
babak-with-cannon
((obj babak-with-cannon) (arg0 res-lump))
(initialize-collision obj)
(process-drawable-from-entity! obj arg0)
(TODO-RENAME-48 obj)
(set! (-> obj distance) (res-lump-float arg0 'distance :default 163840.0))
(set! (-> obj cannon-ent) (entity-actor-lookup (-> obj entity) 'alt-actor 0))
(logclear! (-> obj mask) (process-mask actor-pause))
(if
(or
(not
(and
(-> obj entity)
(logtest? (-> obj entity extra perm status) (entity-perm-status complete))
)
)
(zero? (logand (-> obj enemy-info options) 2))
)
(go (method-of-object obj nav-enemy-idle))
)
(go (method-of-object obj nav-enemy-fuel-cell))
(none)
)