jak-project/goal_src/jak2/levels/atoll/juicer.gc
Hat Kid 67d4eda169
decomp: hover-* files, wasp, crimson-guard-hover, flamer, target-turret, drill-turret, jellyfish (#2198)
Manual patches:

- `drill-turret`: The static data for `*turret-13-path*`,
`*turret-14-path*` and `*turret-15-path*` was decompiled by hand and the
integers in the `set-speed-mult` events have been replaced with boxed
integer arrays that contain only that integer in order to make the
compiler happy. To that effect, the event handler in `target-turret` was
changed to access that array instead of just accessing the int.
- `hover-nav-control`: In `hover-nav-control::10`, `arg2` is usually a
`vector`, but there are some places where it is called with `#t` as
`arg2` and, subsequently, crashes the game because it tries to access
the `quad` of `arg2` if `arg2` is truthy. To mitigate this, the
condition `arg2` has been replaced with `(and (!= arg2 #t) arg2)` (in
this case, it would jump to the `else` that just resets the `dest-vel`
and `transv` `quad`s)
- `drill-baron`: The static data for `*drill-ship-turret-speed-event*`
has been decompiled by hand.

TODOs:
- Jellyfish crash the game
- Destroying the metalhead eggs that are on the breakable wall crashes
the game (already happened with the Peacemaker before)
- Figure out why static data of type `turret-path-event` doesn't
decompile

The docs for all the hover-nav and nav-network code could use some love
in the future, I'm not smart enough to figure out what any of that code
actually means, but it seems to work...

Also threw in the fix for the ▲ that was accidentally left commented
out.
2023-02-09 18:22:56 -05:00

1924 lines
68 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: juicer.gc
;; name in dgo: juicer
;; dgos: ATE, CTYASHA
(declare-type juicer nav-enemy)
;; DECOMP BEGINS
(defpartgroup group-juicer-shot-hit
:id 1061
:duration (seconds 0.017)
:flags (use-local-clock)
:bounds (static-bspherem 0 0 0 8)
:parts ((sp-item 4633))
)
(defpart 4633
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc))
(sp-flt spt-num 1.0)
(sp-rnd-flt spt-scale-x (meters 1) (meters 1) 1.0)
(sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-r 96.0 64.0 1.0)
(sp-rnd-flt spt-g 64.0 32.0 1.0)
(sp-rnd-flt spt-b 96.0 64.0 1.0)
(sp-flt spt-a 64.0)
(sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0)
(sp-flt spt-fade-r -0.35555556)
(sp-flt spt-fade-g -0.35555556)
(sp-flt spt-fade-b 0.0)
(sp-flt spt-fade-a -0.30476192)
(sp-rnd-flt spt-accel-y -0.68266666 0.68266666 1.0)
(sp-int spt-timer 210)
(sp-cpuinfo-flags sp-cpuinfo-flag-2)
(sp-int spt-next-time 60)
(sp-launcher-by-id spt-next-launcher 4634)
(sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 180.0) 1.0)
)
)
(defpart 4635
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc))
(sp-flt spt-num 1.0)
(sp-flt spt-scale-x (meters 3.5))
(sp-flt spt-rot-x 409.6)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-flt spt-g 0.0)
(sp-flt spt-b 0.0)
(sp-flt spt-a 16.0)
(sp-int spt-timer 5)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-flt spt-userdata 819.2)
)
)
(defpart 4636
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc))
(sp-flt spt-num 1.0)
(sp-rnd-flt spt-scale-x (meters 1.5) (meters 1) 1.0)
(sp-flt spt-rot-x 409.6)
(sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-flt spt-g 0.0)
(sp-flt spt-b 0.0)
(sp-rnd-flt spt-a 48.0 16.0 1.0)
(sp-int spt-timer 5)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-flt spt-userdata 819.2)
)
)
(defpart 4637
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc))
(sp-flt spt-num 1.0)
(sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.5) 1.0)
(sp-flt spt-rot-x 409.6)
(sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 16.0) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-flt spt-g 0.0)
(sp-flt spt-b 0.0)
(sp-rnd-flt spt-a 16.0 16.0 1.0)
(sp-int spt-timer 5)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-flt spt-userdata 819.2)
)
)
(defpart 4638
:init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc))
(sp-flt spt-num 1.0)
(sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.2) 1.0)
(sp-flt spt-rot-x 409.6)
(sp-copy-from-other spt-scale-y -4)
(sp-flt spt-r 255.0)
(sp-rnd-flt spt-g 196.0 128.0 1.0)
(sp-rnd-flt spt-b 64.0 64.0 1.0)
(sp-rnd-flt spt-a 32.0 16.0 1.0)
(sp-int spt-timer 5)
(sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)
(sp-flt spt-userdata 819.2)
)
)
(deftype juicer-shot (projectile)
((lightning lightning-control 5 :offset-assert 472)
(victim handle :offset-assert 496)
)
:heap-base #x180
:method-count-assert 40
:size-assert #x1f8
:flag-assert #x28018001f8
)
(defmethod event-handler! juicer-shot ((obj juicer-shot) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
"Multiplex the projectile's event processing, called by [[projectile-event-handler]]"
(with-pp
(case arg2
(('reset)
(let ((v1-1 (the-as object (-> arg3 param 0))))
(set! (-> obj root-override trans quad) (-> (the-as matrix v1-1) trans quad))
(set! (-> obj starting-pos quad) (-> (the-as matrix v1-1) trans quad))
(set! (-> obj root-override transv quad) (-> (&+ (the-as matrix v1-1) 64) quad 0))
(set! (-> obj pre-move-transv quad) (-> (&+ (the-as matrix v1-1) 64) quad 0))
)
(set! (-> obj hits) 0)
(set! (-> obj spawn-time) (-> pp clock frame-counter))
(if (made-impact? obj)
(go (method-of-object obj impact))
(go (method-of-object obj moving))
)
#t
)
(else
((method-of-type projectile event-handler!) obj arg0 arg1 arg2 arg3)
)
)
)
)
(defstate dissipate (juicer-shot)
:virtual #t
:enter (behavior ()
(go-virtual impact)
(none)
)
)
(defmethod deal-damage! juicer-shot ((obj juicer-shot) (arg0 process) (arg1 event-message-block))
"Constructs an [[attack-info]] according to the projectile's `options`"
(let ((a0-2 (if (type? arg0 process-focusable)
arg0
)
)
)
(when a0-2
(set! (-> obj victim) (process->handle a0-2))
#t
)
)
)
(defmethod spawn-impact-particles juicer-shot ((obj juicer-shot))
"Spawns associated particles with the projectile if applicable"
(let ((s5-0 (-> obj starting-pos))
(s4-0 (-> obj root-override trans))
)
(when (line-in-view-frustum? s5-0 s4-0)
(let ((s3-0 (new 'stack-no-clear 'vector))
(s2-0 (new 'stack-no-clear 'vector))
(s1-0 (new 'stack-no-clear 'matrix))
)
(let ((t9-1 sp-launch-particles-var)
(a0-2 *sp-particle-system-2d*)
(a1-1 (-> *part-id-table* 4637))
(a2-0 *launch-matrix*)
)
(set! (-> a2-0 trans quad) (-> s5-0 quad))
(t9-1 a0-2 a1-1 a2-0 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
(let ((t9-2 sp-launch-particles-var)
(a0-3 *sp-particle-system-2d*)
(a1-2 (-> *part-id-table* 4638))
(a2-1 *launch-matrix*)
)
(set! (-> a2-1 trans quad) (-> s5-0 quad))
(t9-2 a0-3 a1-2 a2-1 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
(when (not (handle->process (-> obj victim)))
(let ((t9-3 sp-launch-particles-var)
(a0-8 *sp-particle-system-2d*)
(a1-4 (-> *part-id-table* 4637))
(a2-2 *launch-matrix*)
)
(set! (-> a2-2 trans quad) (-> s4-0 quad))
(t9-3 a0-8 a1-4 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
(let ((t9-4 sp-launch-particles-var)
(a0-9 *sp-particle-system-2d*)
(a1-5 (-> *part-id-table* 4638))
(a2-3 *launch-matrix*)
)
(set! (-> a2-3 trans quad) (-> s4-0 quad))
(t9-4 a0-9 a1-5 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
)
(vector-! s2-0 s4-0 s5-0)
(vector-normalize! s2-0 1.0)
(matrix-axis-angle! s1-0 s2-0 13107.2)
(vector-reset! (-> s1-0 trans))
(set-vector! s3-0 (-> s2-0 z) 0.0 (- (-> s2-0 x)) 1.0)
(vector-normalize! s3-0 409.6)
(dotimes (s0-0 5)
(vector-matrix*! s3-0 s3-0 s1-0)
(vector+! s2-0 s3-0 s5-0)
(let ((a0-17 (-> obj lightning s0-0))
(v1-21 s2-0)
)
(set! (-> a0-17 state meet data 0 quad) (-> v1-21 quad))
)
(let ((a0-20 (-> obj lightning s0-0))
(v1-25 s4-0)
)
(set! (-> a0-20 state meet data (+ (the-as int (-> a0-20 state points-to-draw)) -1) quad) (-> v1-25 quad))
)
)
)
)
)
0
(none)
)
(defmethod spawn-shell-particles juicer-shot ((obj juicer-shot))
"TODO - confirm"
(spawn-impact-particles obj)
(let ((s5-0 (get-process *default-dead-pool* part-tracker #x4000)))
(when s5-0
(let ((t9-2 (method-of-type part-tracker activate)))
(t9-2
(the-as part-tracker s5-0)
*entity-pool*
(symbol->string (-> part-tracker symbol))
(the-as pointer #x70004000)
)
)
(let ((t9-3 run-function-in-process)
(a0-4 s5-0)
(a1-2 part-tracker-init)
(a2-4 (-> *part-group-id-table* 1061))
(a3-1 0)
(t0-0 #f)
(t1-0 #f)
(t2-0 #f)
(t3-0 *launch-matrix*)
)
(set! (-> t3-0 trans quad) (-> obj root-override trans quad))
((the-as (function object object object object object object object object none) t9-3)
a0-4
a1-2
a2-4
a3-1
t0-0
t1-0
t2-0
t3-0
)
)
(-> s5-0 ppointer)
)
)
0
(none)
)
(defmethod made-impact? juicer-shot ((obj juicer-shot))
"TODO - queries the collision cache, return true/false"
(let ((gp-0 (-> obj root-override))
(s5-0 (new 'stack-no-clear 'collide-query))
)
(let ((v1-0 s5-0))
(set! (-> v1-0 radius) (-> gp-0 root-prim prim-core world-sphere w))
(set! (-> v1-0 collide-with) (-> gp-0 root-prim prim-core collide-with))
(set! (-> v1-0 ignore-process0) obj)
(set! (-> v1-0 ignore-process1) (ppointer->process (-> obj parent)))
(set! (-> v1-0 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1))
(set! (-> v1-0 action-mask) (collide-action solid))
)
(let ((a0-2 (handle->process (-> obj notify-handle))))
(when a0-2
(let* ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> gp-0 trans) (get-trans (the-as process-focusable a0-2) 3)))
(f0-2 (- (vector-length s4-1)))
)
(fill-and-try-snap-to-surface gp-0 s4-1 f0-2 0.0 -3072.0 s5-0)
)
)
)
)
)
(defbehavior juicer-proj-move juicer ((arg0 juicer-shot))
(let ((s5-0 (handle->process (-> arg0 victim))))
(cond
(s5-0
(set! (-> arg0 root-override trans quad) (-> (get-trans (the-as process-focusable s5-0) 3) quad))
((method-of-type projectile deal-damage!) arg0 s5-0 (the-as event-message-block #f))
)
(else
(projectile-move-fill-line-sphere arg0)
(if (logtest? (-> arg0 root-override status) (collide-status touch-surface))
(go (method-of-object arg0 impact))
)
)
)
)
0
(none)
)
(defmethod init-proj-collision! juicer-shot ((obj juicer-shot))
"Init the [[projectile]]'s [[collide-shape]]"
(let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))))
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s5-0 reaction) cshape-reaction-default)
(set! (-> s5-0 no-reaction)
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
)
(set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot))
(let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> v1-7 prim-core collide-as) (collide-spec projectile))
(set! (-> v1-7 prim-core collide-with)
(collide-spec
backgnd
jak
bot
crate
civilian
enemy
obstacle
vehicle-sphere
hit-by-others-list
player-list
pusher
)
)
(set! (-> v1-7 prim-core action) (collide-action solid))
(set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 1228.8)
(set! (-> s5-0 total-prims) (the-as uint 1))
(set! (-> s5-0 root-prim) v1-7)
)
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
(let ((v1-10 (-> s5-0 root-prim)))
(set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as))
(set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with))
)
(set! (-> s5-0 max-iteration-count) (the-as uint 1))
(set! (-> obj root-override) s5-0)
)
(set! (-> obj root-override pat-ignore-mask)
(new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1)
)
(none)
)
;; WARN: Return type mismatch projectile vs juicer-shot.
(defmethod relocate juicer-shot ((obj juicer-shot) (arg0 int))
(dotimes (v1-0 5)
(if (nonzero? (-> obj lightning v1-0))
(&+! (-> obj lightning v1-0) arg0)
)
)
(the-as juicer-shot ((method-of-type projectile relocate) obj arg0))
)
(defmethod init-proj-settings! juicer-shot ((obj juicer-shot))
"Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc"
(logior! (-> obj options) (projectile-options proj-options-8000))
(set! (-> obj attack-mode) 'eco-yellow)
(set! (-> obj move) juicer-proj-move)
(set! (-> obj root-override dynam gravity y) 0.0)
(set! (-> obj root-override dynam gravity-length) 0.0)
(set! (-> obj root-override dynam gravity-max) 0.0)
(set! (-> obj attack-mode) 'shock-red)
(dotimes (s5-0 5)
(set! (-> obj lightning s5-0) (new
'process
'lightning-control
(new 'static 'lightning-spec
:name #f
:flags (lightning-spec-flags lsf0)
:start-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)
:end-color (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80)
:fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5)
:fade-start-factor 0.2
:fade-time 120.0
:texture (new 'static 'texture-id :index #x86 :page #xc)
:reduction 0.42
:num-points 8
:box-size 8192.0
:merge-factor 0.5
:merge-count 2
:radius 1433.6
:duration -1.0
:sound #f
)
obj
0.0
)
)
)
(set! (-> obj victim) (the-as handle #f))
0
(none)
)
(defskelgroup skel-juicer juicer juicer-lod0-jg -1
((juicer-lod0-mg (meters 20)) (juicer-lod1-mg (meters 40)) (juicer-lod2-mg (meters 999999)))
:bounds (static-spherem 0 0 0 5.3)
:shadow juicer-shadow-mg
:origin-joint-index 21
)
(deftype juicer-anim-info (structure)
((anim-index int32 :offset-assert 0)
)
:method-count-assert 9
:size-assert #x4
:flag-assert #x900000004
)
(deftype juicer-global-info (basic)
((prev-yellow-hit int8 :offset-assert 4)
(prev-blue-hit int8 :offset-assert 5)
(idle-anim int32 3 :offset-assert 8)
(patrol-anim int32 2 :offset-assert 20)
(notice-anim int32 2 :offset-assert 28)
(charge-anim int32 2 :offset-assert 36)
(knocked-anim int32 2 :offset-assert 44)
(celebrate-anim int32 2 :offset-assert 52)
(yellow-hit-anim int32 4 :offset-assert 60)
(blue-hit-anim int32 6 :offset-assert 76)
)
:method-count-assert 9
:size-assert #x64
:flag-assert #x900000064
)
(deftype juicer (nav-enemy)
((los los-control :inline :offset-assert 608)
(intro-path path-control :offset-assert 756)
(joint joint-mod :offset-assert 760)
(joint-enable symbol :offset-assert 764)
(joint-blend float :offset-assert 768)
(last-fire-time time-frame :offset-assert 776)
(heading basic :offset-assert 784)
(move-angle float :offset-assert 788)
(torso-track-player basic :offset-assert 792)
(circle-backward? symbol :offset 800)
(using-turn-anim symbol :offset-assert 804)
(hit-focus enemy-focus :offset-assert 808)
(ambush-path-pt int8 :offset-assert 812)
(charge-index int8 :offset-assert 813)
(hostile-dest vector :inline :offset-assert 816)
(focus-is-up symbol :offset-assert 832)
(current-projectile handle :offset-assert 840)
)
:heap-base #x2d0
:method-count-assert 185
:size-assert #x350
:flag-assert #xb902d00350
(:methods
(ambush-cont () _type_ :state 178)
(attack () _type_ :state 179)
(juicer-method-180 (_type_) none 180)
(fire-projectile (_type_ process-focusable uint) none 181)
(juicer-method-182 (_type_) none 182)
(juicer-method-183 (_type_) none 183)
(juicer-method-184 (_type_ symbol) none 184)
)
)
(define *juicer-global-info* (new 'static 'juicer-global-info
:idle-anim (new 'static 'array int32 3 5 6 7)
:patrol-anim (new 'static 'array int32 2 8 23)
:notice-anim (new 'static 'array int32 2 21 22)
:charge-anim (new 'static 'array int32 2 9 20)
:knocked-anim (new 'static 'array int32 2 16 18)
:celebrate-anim (new 'static 'array int32 2 24 25)
:yellow-hit-anim (new 'static 'array int32 4 33 34 35 36)
:blue-hit-anim (new 'static 'array int32 6 26 27 28 29 30 31)
)
)
(define *juicer-nav-enemy-info*
(new 'static 'nav-enemy-info
:use-die-falling #t
:use-victory #t
:use-jump-blocked #t
:debug-draw-neck #f
:jump-debug-draw #f
:move-to-ground #t
:hover-if-no-ground #f
:idle-anim-script (new 'static 'array idle-control-frame 4
(new 'static 'idle-control-frame :command (ic-cmd play) :anim #x5 :param0 #x1 :param1 #x1)
(new 'static 'idle-control-frame)
(new 'static 'idle-control-frame)
(new 'static 'idle-control-frame)
)
:idle-anim 5
:notice-anim 21
:hostile-anim 9
:hit-anim 11
:knocked-anim 18
:knocked-land-anim 19
:die-anim 40
:die-falling-anim 41
:victory-anim 24
:jump-wind-up-anim 37
:jump-in-air-anim 38
:jump-land-anim 39
:neck-joint 34
:look-at-joint 34
:bullseye-joint 6
:sound-hit (static-sound-name "juicer-hit")
:sound-die (static-sound-name "juicer-die")
:notice-distance (meters 30)
:notice-distance-delta (meters 10)
:proximity-notice-distance (meters 24)
:default-hit-points 9
:gnd-collide-with (collide-spec backgnd)
:overlaps-others-collide-with-filter (collide-spec jak bot player-list)
:penetrate-knocked (penetrate
touch
generic-attack
lunge
flop
punch
spin
roll
uppercut
bonk
tube
vehicle
flut-attack
board
mech
mech-punch
mech-bonk
dark-skin
dark-punch
dark-bomb
dark-giant
shield
explode
jak-yellow-shot
jak-red-shot
jak-blue-shot
jak-dark-shot
enemy-yellow-shot
enemy-dark-shot
eco-yellow
eco-red
eco-blue
eco-green
knocked
penetrate-33
penetrate-34
penetrate-35
penetrate-36
penetrate-37
penetrate-38
penetrate-39
penetrate-40
penetrate-41
penetrate-42
penetrate-43
penetrate-44
penetrate-45
penetrate-46
penetrate-47
penetrate-48
penetrate-49
penetrate-50
penetrate-51
penetrate-52
penetrate-53
penetrate-54
penetrate-55
penetrate-56
penetrate-57
penetrate-58
penetrate-59
penetrate-60
penetrate-61
penetrate-62
penetrate-63
)
:movement-gravity (meters -100)
:friction 0.9
:attack-shove-back (meters 3)
:attack-shove-up (meters 2)
:attack-mode 'shock-red
:attack-damage 2
:recover-gnd-collide-with (collide-spec backgnd crate obstacle hit-by-others-list pusher)
:jump-height-min (meters 3)
:jump-height-factor 0.5
:knocked-seek-ry-clamp 6371.5557
:knocked-soft-vxz-lo 65536.0
:knocked-soft-vxz-hi 94208.0
:knocked-soft-vy-lo 77824.0
:knocked-soft-vy-hi 98304.0
:knocked-medium-vxz-lo 81920.0
:knocked-medium-vxz-hi 98304.0
:knocked-medium-vy-lo 81920.0
:knocked-medium-vy-hi 122880.0
:knocked-hard-vxz-lo 65536.0
:knocked-hard-vxz-hi 95846.4
:knocked-hard-vy-lo 122880.0
:knocked-hard-vy-hi 163840.0
:knocked-huge-vxz-lo 164659.2
:knocked-huge-vxz-hi 249036.8
:knocked-huge-vy-lo 183500.8
:knocked-huge-vy-hi 217907.2
:knocked-yellow-vxz-lo 40960.0
:knocked-yellow-vxz-hi 49152.0
:knocked-yellow-vy-lo 57344.0
:knocked-yellow-vy-hi 81920.0
:knocked-red-vxz-lo 24576.0
:knocked-red-vxz-hi 98304.0
:knocked-red-vy-lo 90112.0
:knocked-red-vy-hi 131072.0
:knocked-blue-vxz-lo 24576.0
:knocked-blue-vxz-hi 32768.0
:knocked-blue-vy-lo 24576.0
:knocked-blue-vy-hi 73728.0
:shadow-size (meters 2)
:shadow-max-y (meters 1)
:shadow-min-y (meters -1)
:shadow-locus-dist (meters 150)
:gem-joint 34
:gem-seg #x2
:gem-no-seg #x4
:gem-offset (new 'static 'sphere :y 942.08 :z 40.96 :r 163840.0)
:callback-info #f
:use-momentum #f
:use-frustration #t
:use-stop-chase #f
:use-circling #t
:use-pacing #t
:walk-anim 8
:turn-anim 10
:run-anim 9
:taunt-anim -1
:run-travel-speed (meters 8)
:run-acceleration (meters 8)
:run-turning-acceleration (meters 20)
:walk-travel-speed (meters 2)
:walk-acceleration (meters 2)
:walk-turning-acceleration (meters 3)
:maximum-rotation-rate (degrees 360.0)
:notice-nav-radius (meters 7.5)
:frustration-distance (meters 8)
:frustration-time (seconds 4)
:blocked-time (seconds 0.3)
:circle-dist-lo 28672.0
:circle-dist-hi 53248.0
:nav-mesh #f
)
)
(set! (-> *juicer-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*)
(defmethod juicer-method-182 juicer ((obj juicer))
(let ((s3-0 (handle->process (-> obj focus handle))))
(when s3-0
(let ((s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data 4)))
(s5-0 (new 'stack-no-clear 'vector))
)
(set! (-> s5-0 quad) (-> (get-trans (the-as process-focusable s3-0) 3) quad))
(let ((s3-1
(vector-normalize-copy! (new 'stack-no-clear 'vector) (-> obj node-list data 4 bone transform vector 2) 1.0)
)
)
(vector-! s5-0 s5-0 s4-0)
(vector-normalize! s5-0 1.0)
(quaternion-from-two-vectors-partial! (-> obj joint quat) s3-1 s5-0 (-> obj joint-blend))
)
)
)
)
0
(none)
)
(defmethod juicer-method-183 juicer ((obj juicer))
(with-pp
(cond
((-> obj torso-track-player)
(set! (-> obj joint-enable) #t)
(seek! (-> obj joint-blend) 1.0 (* 2.0 (-> pp clock seconds-per-frame)))
(juicer-method-182 obj)
)
((-> obj joint-enable)
(seek! (-> obj joint-blend) 0.0 (* 4.0 (-> pp clock seconds-per-frame)))
(juicer-method-182 obj)
(if (= (-> obj joint-blend) 0.0)
(set! (-> obj joint-enable) #f)
)
)
)
0
(none)
)
)
(defmethod track-target! juicer ((obj juicer))
"Does a lot of various things relating to interacting with the target
- tracks when the enemy was last drawn
- looks at the target and handles attacking
@TODO Not extremely well understood yet"
(let ((t9-0 (method-of-type nav-enemy track-target!)))
(t9-0 obj)
)
(los-control-method-9 (-> obj los) (the-as process-focusable #f) (the-as vector #f) 2048.0)
(juicer-method-183 obj)
(none)
)
;; WARN: Return type mismatch object vs none.
(defmethod juicer-method-180 juicer ((obj juicer))
(if (and (= (-> obj incoming knocked-type) (knocked-type knocked-type-4))
(not (and (-> obj next-state) (let ((v1-6 (-> obj next-state name)))
(or (= v1-6 'knocked) (= v1-6 'jump) (= v1-6 'jump-land))
)
)
)
(zero? (get-rand-int obj 3))
(let ((f0-0 (vector-vector-distance-squared (-> obj root-override2 trans) (target-pos 0)))
(f1-0 32768.0)
)
(>= f0-0 (* f1-0 f1-0))
)
)
(kill-prefer-falling obj)
(go (method-of-object obj knocked))
)
(none)
)
(defmethod general-event-handler juicer ((obj juicer) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
"Handles various events for the enemy
@TODO - unsure if there is a pattern for the events and this should have a more specific name"
(case arg2
(('hit-flinch)
(cond
((zero? (-> obj hit-points))
(logclear! (-> obj mask) (process-mask actor-pause))
(logclear! (-> obj focus-status) (focus-status dangerous))
(logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice))
(logior! (-> obj enemy-flags) (enemy-flag chase-startup))
(logior! (-> obj focus-status) (focus-status hit))
(if (zero? (-> obj hit-points))
(logior! (-> obj focus-status) (focus-status dead))
)
(logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup))
(enemy-method-62 obj)
(set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags)))
(process-contact-action arg0)
(send-event arg0 'get-attack-count 1)
(juicer-method-180 obj)
)
(else
(let ((v1-31 (ja-channel-float! (the-as art-joint-anim (-> obj draw art-group data 11)) 0.0 0.0 0.0)))
(when v1-31
(set! (-> v1-31 param 0) 1.0)
(set! (-> v1-31 param 1) 0.75)
(set! (-> v1-31 param 2) 2.0)
(set! (-> v1-31 num-func) num-func-interp-play!)
)
)
)
)
#t
)
(('hit)
(logclear! (-> obj mask) (process-mask actor-pause))
(logclear! (-> obj focus-status) (focus-status dangerous))
(logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice))
(logior! (-> obj enemy-flags) (enemy-flag chase-startup))
(logior! (-> obj focus-status) (focus-status hit))
(if (zero? (-> obj hit-points))
(logior! (-> obj focus-status) (focus-status dead))
)
(logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup))
(enemy-method-62 obj)
(set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags)))
(process-contact-action arg0)
(send-event arg0 'get-attack-count 1)
(if (zero? (-> obj hit-points))
(juicer-method-180 obj)
(go (method-of-object obj hit))
)
#t
)
(('instant-death)
(when (> (-> obj hit-points) 0)
(set! (-> obj hit-points) 0)
(set! (-> obj root-override2 penetrated-by) (get-penetrate-info obj))
(let ((s4-0 (enemy-method-50 obj (new 'stack-no-clear 'vector))))
(vector-z-quaternion! s4-0 (-> obj root-override2 quat))
(vector-float*! s4-0 s4-0 -1.0)
(vector-normalize! s4-0 1.0)
)
(logclear! (-> obj mask) (process-mask actor-pause))
(logclear! (-> obj focus-status) (focus-status dangerous))
(logclear! (-> obj enemy-flags) (enemy-flag enable-on-notice))
(logior! (-> obj enemy-flags) (enemy-flag chase-startup))
(logior! (-> obj focus-status) (focus-status hit))
(if (zero? (-> obj hit-points))
(logior! (-> obj focus-status) (focus-status dead))
)
(logclear! (-> obj enemy-flags) (enemy-flag actor-pause-backup))
(enemy-method-62 obj)
(set! (-> obj enemy-flags) (logior (enemy-flag actor-pause-backup) (-> obj enemy-flags)))
(process-contact-action arg0)
(send-event arg0 'get-attack-count 1)
(juicer-method-180 obj)
)
#t
)
(('notify)
(if (and (= (-> arg3 param 0) 'attack) (= (-> arg3 param 1) (handle->process (-> obj focus handle))))
(set! (-> obj hit-focus) (the-as enemy-focus #t))
)
((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3)
)
(else
((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3)
)
)
)
(defstate active (juicer)
:virtual #t
:code (behavior ()
(let ((v1-2 (ja-group)))
(when (or (and v1-2 (or (= v1-2 juicer-charge0-ja) (= v1-2 juicer-charge1-ja)))
(let ((v1-8 (ja-group)))
(and v1-8 (or (= v1-8 juicer-patrol0-ja) (= v1-8 juicer-patrol1-ja)))
)
)
(ja-no-eval :num! (seek!))
(while (not (ja-done? 0))
(suspend)
(ja-eval)
)
)
)
(let ((f30-0 (get-rand-float-range self 0.9 1.1)))
(until #f
(let ((gp-0 (-> self draw art-group data (-> (&-> *juicer-global-info* patrol-anim (get-rand-int self 2)) 0)))
(s5-0 (get-rand-int-range self 1 8))
)
(let ((v1-34 (ja-group)))
(if (not (and v1-34 (= v1-34 gp-0)))
(ja-channel-push! 1 (seconds 0.2))
)
)
(dotimes (s4-0 s5-0)
(ja-no-eval :group! gp-0
:num! (seek! (the float (+ (-> (the-as art-joint-anim gp-0) frames num-frames) -1)) f30-0)
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! max f30-0))
)
)
)
(when (zero? (get-rand-int self 2))
(let ((v1-58 self))
(set! (-> v1-58 enemy-flags) (the-as enemy-flag (logclear (-> v1-58 enemy-flags) (enemy-flag enemy-flag36))))
(set! (-> v1-58 nav callback-info) *nav-enemy-null-callback-info*)
)
0
(ja-channel-push! 1 (seconds 0.3))
(let ((gp-1 0))
(until (not (enemy-method-123 self 0.4))
(let* ((v1-62 (enemy-method-120 self 3 gp-1))
(a1-16 (-> self draw art-group data (-> *juicer-global-info* idle-anim v1-62)))
)
(set! gp-1 (ash 1 v1-62))
(ja-no-eval :group! a1-16
:num! (seek! (the float (+ (-> (the-as art-joint-anim a1-16) frames num-frames) -1)) f30-0)
:frame-num 0.0
)
)
(ja-no-eval :group! (ja-group)
:num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1)) f30-0)
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! max f30-0))
)
)
)
(let ((v1-102 self))
(if (not (logtest? (enemy-flag enemy-flag36) (-> v1-102 enemy-flags)))
(set! (-> v1-102 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-102 enemy-flags))))
)
(set! (-> v1-102 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-102 enemy-flags))))
(set! (-> v1-102 nav callback-info) (-> v1-102 enemy-info-override callback-info))
)
0
)
)
)
#f
(none)
)
)
(defmethod enemy-method-84 juicer ((obj juicer) (arg0 enemy-jump-info))
(cond
((logtest? (-> obj fact-info-override enemy-options) (enemy-option user8))
(vector-vector-xz-distance (-> arg0 start-pos) (-> arg0 dest-pos))
(let ((f0-1 8192.0))
(setup-from-to-height! (-> arg0 traj) (-> arg0 start-pos) (-> arg0 dest-pos) f0-1 -4.551111)
)
)
(else
((method-of-type nav-enemy enemy-method-84) obj arg0)
)
)
(none)
)
(defmethod enemy-method-93 juicer ((obj juicer))
(case (-> obj jump-why)
((2)
(go (method-of-object obj ambush-cont))
)
(else
((method-of-type nav-enemy enemy-method-93) obj)
)
)
(none)
)
(defstate ambush (juicer)
:virtual #t
:enter (behavior ()
(let ((t9-0 (-> (method-of-type nav-enemy ambush) enter)))
(if t9-0
(t9-0)
)
)
(when (zero? (-> self intro-path))
(format 0 "ERROR: ~A has no intro path, skipping ambush~%" (-> self name))
(go-virtual notice)
)
(get-point-in-path! (-> self intro-path) (-> self root-override2 trans) 0.0 'interp)
(none)
)
:code (behavior ()
(set! (-> self ambush-path-pt) 1)
(until #f
(let ((gp-0 (new 'stack-no-clear 'vector)))
(get-point-in-path! (-> self intro-path) gp-0 1.0 'interp)
(set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable))))
(let ((a1-1 (new 'stack-no-clear 'event-message-block)))
(let ((v1-5 (process->ppointer self)))
(set! (-> a1-1 from) v1-5)
)
(set! (-> a1-1 num-params) 2)
(set! (-> a1-1 message) 'jump)
(set! (-> a1-1 param 0) (the-as uint 2))
(set! (-> a1-1 param 1) (the-as uint gp-0))
(send-event-function self a1-1)
)
)
(suspend)
)
#f
(none)
)
)
(defstate ambush-cont (juicer)
:virtual #t
:event (the-as (function process int symbol event-message-block object :behavior juicer) enemy-event-handler)
:code (behavior ()
(let ((a0-0 (-> self intro-path))
(v1-1 (+ (-> self ambush-path-pt) 1))
)
(if (< v1-1 (-> a0-0 curve num-cverts))
(set! (-> self ambush-path-pt) v1-1)
(react-to-focus self)
)
)
(until #f
(let ((gp-0 (new 'stack-no-clear 'vector)))
(get-point-in-path! (-> self intro-path) gp-0 (the float (-> self ambush-path-pt)) 'interp)
(set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable))))
(let ((a1-1 (new 'stack-no-clear 'event-message-block)))
(let ((v1-9 (process->ppointer self)))
(set! (-> a1-1 from) v1-9)
)
(set! (-> a1-1 num-params) 2)
(set! (-> a1-1 message) 'jump)
(set! (-> a1-1 param 0) (the-as uint 2))
(set! (-> a1-1 param 1) (the-as uint gp-0))
(send-event-function self a1-1)
)
)
(suspend)
)
#f
(none)
)
)
(defstate notice (juicer)
:virtual #t
:code (behavior ()
(ja-channel-push! 1 (seconds 0.075))
(let ((s5-0 0))
(let ((s4-0 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> self root-override2 quat)))
(gp-1 (vector-!
(new 'stack-no-clear 'vector)
(get-trans (the-as process-focusable (handle->process (-> self focus handle))) 0)
(-> self root-override2 trans)
)
)
)
(vector-flatten! gp-1 gp-1 (-> s4-0 vector 1))
(vector-normalize! gp-1 1.0)
(cond
((< (vector-dot gp-1 (-> s4-0 vector 2)) (cos 8192.0))
)
(else
(set! s5-0 (logior s5-0 1))
)
)
)
(let ((f30-1 (get-rand-float-range self 0.8 1.2))
(gp-2 (new 'stack-no-clear 'vector))
)
(let* ((a0-13 (enemy-method-120 self 2 s5-0))
(a1-8 (-> self draw art-group data (-> *juicer-global-info* notice-anim a0-13)))
)
(ja-no-eval :group! a1-8
:num! (seek! (the float (+ (-> (the-as art-joint-anim a1-8) frames num-frames) -1)) f30-1)
:frame-num 0.0
)
)
(until (ja-done? 0)
(let ((a1-9 (-> self nav state)))
(set! (-> gp-2 quad) (-> a1-9 travel quad))
)
(seek-toward-heading-vec! (-> self root-override2) gp-2 (-> self nav max-rotation-rate) (seconds 0.02))
(suspend)
(ja :num! (seek! max f30-1))
)
)
)
(react-to-focus self)
(none)
)
)
(defstate victory (juicer)
:virtual #t
:code (behavior ()
(ja-channel-push! 1 (seconds 0.15))
(let ((gp-1 (-> self draw art-group data (-> *juicer-global-info* celebrate-anim (get-rand-int self 2))))
(f30-0 (get-rand-float-range self 0.9 1.1))
)
(ja-no-eval :group! gp-1
:num! (seek! (the float (+ (-> (the-as art-joint-anim gp-1) frames num-frames) -1)) f30-0)
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! max f30-0))
)
)
(react-to-focus self)
(none)
)
)
(defstate hostile (juicer)
:virtual #t
:enter (behavior ()
(let ((t9-0 (-> (method-of-type nav-enemy hostile) enter)))
(if t9-0
(t9-0)
)
)
(set! (-> self focus-is-up) #f)
(none)
)
:exit (behavior ()
(let ((t9-0 (-> (method-of-type nav-enemy hostile) exit)))
(if t9-0
(t9-0)
)
)
(none)
)
:code (behavior ()
(let ((v1-2 (ja-group)))
(when (and v1-2 (or (= v1-2 juicer-charge0-ja) (= v1-2 juicer-charge1-ja)))
(ja-no-eval :num! (seek!))
(while (not (ja-done? 0))
(suspend)
(ja-eval)
)
)
)
(let* ((v1-16 (get-rand-int self 2))
(gp-0 (-> self draw art-group data (-> *juicer-global-info* charge-anim v1-16)))
)
(set! (-> self charge-index) v1-16)
(let ((v1-19 (ja-group)))
(if (not (and v1-19 (= v1-19 gp-0)))
(ja-channel-push! 1 (seconds 0.2))
)
)
(set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim gp-0))
)
(ja :num-func num-func-identity :frame-num 0.0)
(let ((f30-0 (get-rand-float-range self 0.9 1.1)))
(until #f
(suspend)
(ja :num! (loop! f30-0))
)
)
#f
(none)
)
:post (behavior ()
(let ((a0-1 (handle->process (-> self focus handle))))
(when a0-1
(let* ((gp-0 (get-trans (the-as process-focusable a0-1) 1))
(f30-0 (vector-vector-xz-distance (-> self root-override2 trans) gp-0))
)
(cond
((< (- (-> gp-0 y) (-> self root-override2 trans y)) 4096.0)
(let ((v1-10 (-> self nav state)))
(logclear! (-> v1-10 flags) (nav-state-flag directional-mode))
(logior! (-> v1-10 flags) (nav-state-flag target-poly-dirty))
(set! (-> v1-10 target-post quad) (-> gp-0 quad))
)
0
(set! (-> self focus-is-up) #f)
)
((not (-> self focus-is-up))
(let ((s4-0 (new 'stack-no-clear 'vector))
(s5-0 (new 'stack-no-clear 'vector))
)
(let ((f28-0 (rand-vu-float-range 0.0 65536.0)))
(set-vector! s4-0 (* 8192.0 (cos f28-0)) 0.0 (* 8192.0 (sin f28-0)) 1.0)
)
(vector+! s4-0 s4-0 gp-0)
(cloest-point-on-mesh (-> self nav) s4-0 s4-0 (the-as nav-poly #f))
(vector-! s5-0 s4-0 gp-0)
(set! (-> s5-0 y) 0.0)
(vector-normalize! s5-0 30720.0)
(vector+! s5-0 s5-0 s4-0)
(let ((v1-24 (-> self nav state)))
(logclear! (-> v1-24 flags) (nav-state-flag directional-mode))
(logior! (-> v1-24 flags) (nav-state-flag target-poly-dirty))
(set! (-> v1-24 target-post quad) (-> s5-0 quad))
)
)
0
(set! (-> self focus-is-up) #t)
)
(else
(when (and (or (logtest? (-> self nav state flags) (nav-state-flag blocked))
(logtest? (-> self nav state flags) (nav-state-flag at-target))
)
(>= (- (-> self clock frame-counter) (-> self state-time)) (-> self reaction-time))
)
(if (and (>= (- (-> self clock frame-counter) (-> self last-fire-time)) (rand-vu-int-range (seconds 1) (seconds 2)))
(< 20480.0 f30-0)
)
(go-virtual attack)
(go-virtual circling)
)
)
)
)
(if (and (check-los? (-> self los) 0)
(or (>= 11468.8 f30-0)
(and (>= (- (-> self clock frame-counter) (-> self last-fire-time)) (rand-vu-int-range (seconds 5) (seconds 8)))
(>= 53248.0 f30-0)
)
)
)
(go-virtual attack)
)
)
)
)
(nav-enemy-travel-post)
(none)
)
)
(defbehavior juicer-face-player-post juicer ()
(let ((gp-0 (handle->process (-> self focus handle)))
(a0-3 self)
)
(when (and (logtest? (enemy-flag enemy-flag37) (-> a0-3 enemy-flags)) gp-0)
(let ((f0-1 (fabs (deg-diff
(quaternion-y-angle (-> self root-override2 quat))
(vector-y-angle (vector-!
(new 'stack-no-clear 'vector)
(get-trans (the-as process-focusable gp-0) 0)
(-> self root-override2 trans)
)
)
)
)
)
)
(cond
((or (< 5461.3335 f0-1) (and (-> self using-turn-anim) (< 910.2222 f0-1)))
(set! (-> self using-turn-anim) #t)
(seek-to-point-toward-point!
(-> self root-override2)
(get-trans (the-as process-focusable gp-0) 0)
(-> self nav max-rotation-rate)
(seconds 0.2)
)
)
(else
(set! (-> self using-turn-anim) #f)
)
)
)
)
)
(nav-enemy-simple-post)
0
(none)
)
;; WARN: Return type mismatch object vs none.
(defmethod fire-projectile juicer ((obj juicer) (arg0 process-focusable) (arg1 uint))
(with-pp
(let ((s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj node-list data 20)))
(s5-0 (new 'stack-no-clear 'projectile-init-by-other-params))
)
(when (not (handle->process (-> obj current-projectile)))
(set! (-> s5-0 ent) (-> obj entity))
(set! (-> s5-0 charge) 1.0)
(set! (-> s5-0 options) (projectile-options))
(set! (-> s5-0 notify-handle) (process->handle obj))
(set! (-> s5-0 owner-handle) (the-as handle #f))
(set! (-> s5-0 ignore-handle) (process->handle obj))
(set! (-> s5-0 attack-id) arg1)
(set! (-> s5-0 timeout) (seconds 4))
)
(vector-normalize! (vector-! (-> s5-0 pos) (get-trans arg0 3) s4-0) 1.0)
(vector-float*! (-> s5-0 vel) (-> s5-0 pos) (* 24576.0 (-> pp clock frames-per-second)))
(vector+float*! (-> s5-0 pos) s4-0 (-> s5-0 pos) -1024.0)
(let ((a0-20 (handle->process (-> obj current-projectile))))
(if a0-20
(send-event a0-20 'reset s5-0)
(set! (-> obj current-projectile)
(ppointer->handle (spawn-projectile juicer-shot s5-0 obj *default-dead-pool*))
)
)
)
)
(none)
)
)
(defstate attack (juicer)
:virtual #t
:event (the-as (function process int symbol event-message-block object :behavior juicer) enemy-event-handler)
:enter (behavior ()
(let ((v1-1 (-> self nav state))
(a0-1 (-> self root-override2 trans))
)
(logclear! (-> v1-1 flags) (nav-state-flag directional-mode))
(logior! (-> v1-1 flags) (nav-state-flag target-poly-dirty))
(set! (-> v1-1 target-post quad) (-> a0-1 quad))
)
0
(set! (-> self torso-track-player) (the-as basic #t))
(set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags)))
(set! (-> self hit-focus) #f)
(logior! (-> self focus-status) (focus-status dangerous))
(let* ((v1-9 *game-info*)
(v0-0 (+ (-> v1-9 attack-id) 1))
)
(set! (-> v1-9 attack-id) v0-0)
(set! (-> self attack-id) v0-0)
)
(none)
)
:exit (behavior ()
(set! (-> self torso-track-player) #f)
(logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup))
(juicer-method-184 self #f)
(set! (-> self last-fire-time) (-> self clock frame-counter))
(if (logtest? (-> self enemy-flags) (enemy-flag check-water))
(logior! (-> self focus-status) (focus-status dangerous))
(logclear! (-> self focus-status) (focus-status dangerous))
)
(send-event (handle->process (-> self current-projectile)) 'die)
(none)
)
:trans (behavior ()
(when (skip-check-los? (-> self los) 90)
)
(none)
)
:code (behavior ()
(ja-channel-push! 1 (seconds 0.1))
(ja-no-eval :group! juicer-attack0-start-ja
:num! (seek! (the float (+ (-> (the-as art-joint-anim juicer-attack0-start-ja) frames num-frames) -1)))
:frame-num 0.0
)
(until (ja-done? 0)
(if (< 11.0 (ja-aframe-num 0))
(juicer-method-184 self #t)
)
(suspend)
(ja :num! (seek!))
)
0
(let* ((gp-0 #f)
(v1-29 *game-info*)
(s5-0 (+ (-> v1-29 attack-id) 1))
)
(set! (-> v1-29 attack-id) s5-0)
(let ((s4-0 (-> self clock frame-counter)))
(until (>= (- (-> self clock frame-counter) s4-0) (seconds 0.25))
(ja-no-eval :group! juicer-attack0-ja
:num! (seek! (the float (+ (-> (the-as art-joint-anim juicer-attack0-ja) frames num-frames) -1)))
:frame-num 0.0
)
(until (ja-done? 0)
(let ((s3-0 (handle->process (-> self focus handle))))
(when s3-0
(when (< 28672.0
(vector-vector-distance (-> self root-override2 trans) (get-trans (the-as process-focusable s3-0) 0))
)
(fire-projectile self (the-as process-focusable s3-0) s5-0)
(-> self clock frame-counter)
(if (not gp-0)
(set! gp-0 #t)
)
)
)
)
(if (and (logtest? (-> self enemy-flags) (enemy-flag look-at-focus)) (-> self enemy-info-override use-victory))
(go-virtual victory)
)
(b!
(not (and (-> self using-turn-anim) (let ((v1-73 (ja-group)))
(not (and v1-73 (= v1-73 juicer-attack-turn-ja)))
)
)
)
cfg-31
:delay (empty-form)
)
(ja-channel-push! 1 (seconds 0.05))
(ja :group! juicer-attack-turn-ja)
(b! #t cfg-42 :delay (nop!))
(label cfg-31)
(when (and (not (-> self using-turn-anim)) (let ((v1-84 (ja-group)))
(not (and v1-84 (= v1-84 juicer-attack0-ja)))
)
)
(ja-channel-push! 1 (seconds 0.05))
(ja :group! juicer-attack0-ja)
)
(label cfg-42)
(suspend)
(ja :num! (seek!))
)
(send-event (handle->process (-> self current-projectile)) 'die)
(let ((a0-37 (handle->process (-> self focus handle))))
(when a0-37
(if (>= 28672.0
(vector-vector-distance (-> self root-override2 trans) (get-trans (the-as process-focusable a0-37) 0))
)
(go-virtual circling)
)
)
)
(suspend)
)
)
)
(if (-> self hit-focus)
(go-virtual victory)
)
(go-hostile self)
(none)
)
:post juicer-face-player-post
)
(defstate circling (juicer)
:virtual #t
:code (behavior ()
(let ((v1-2 (ja-group)))
(when (and v1-2 (or (= v1-2 juicer-charge0-ja) (= v1-2 juicer-charge1-ja)))
(ja-no-eval :num! (seek!))
(while (not (ja-done? 0))
(suspend)
(ja-eval)
)
)
)
(until #f
(let ((v1-15 self))
(if (not (logtest? (enemy-flag enemy-flag36) (-> v1-15 enemy-flags)))
(set! (-> v1-15 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag38) (-> v1-15 enemy-flags))))
)
(set! (-> v1-15 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag36) (-> v1-15 enemy-flags))))
(set! (-> v1-15 nav callback-info) (-> v1-15 enemy-info-override callback-info))
)
0
(let ((v1-18 self))
(set! (-> v1-18 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-18 enemy-flags))))
)
0
(nav-enemy-method-166 self)
(let* ((v1-23 (get-rand-int self 2))
(gp-0 (-> self draw art-group data (-> *juicer-global-info* charge-anim v1-23)))
)
(set! (-> self charge-index) v1-23)
(let ((v1-26 (ja-group)))
(if (not (and v1-26 (= v1-26 gp-0)))
(ja-channel-push! 1 (seconds 0.15))
)
)
(let ((s5-0 (+ (get-rand-int self 6) 2))
(f30-0 (get-rand-float-range self 0.9 1.1))
)
(while (nonzero? s5-0)
(+! s5-0 -1)
(ja-no-eval :group! gp-0
:num! (seek! (the float (+ (-> (the-as art-joint-anim gp-0) frames num-frames) -1)) f30-0)
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! max f30-0))
)
)
)
)
(when (< 20480.0 (vector-vector-xz-distance (-> self focus-pos) (-> self root-override2 trans)))
(let ((v1-54 self))
(set! (-> v1-54 enemy-flags) (the-as enemy-flag (logclear (-> v1-54 enemy-flags) (enemy-flag enemy-flag36))))
(set! (-> v1-54 nav callback-info) *nav-enemy-null-callback-info*)
)
0
(let ((v1-57 self))
(set! (-> v1-57 enemy-flags) (the-as enemy-flag (logclear (-> v1-57 enemy-flags) (enemy-flag enemy-flag37))))
)
0
(vector-reset! (-> self root-override2 transv))
(ja-channel-push! 1 (seconds 0.1))
(let ((gp-2 (-> self draw art-group data (-> *juicer-global-info* celebrate-anim (get-rand-int self 2))))
(f30-2 (get-rand-float-range self 0.9 1.1))
)
(ja-no-eval :group! gp-2
:num! (seek! (the float (+ (-> (the-as art-joint-anim gp-2) frames num-frames) -1)) f30-2)
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! max f30-2))
)
)
)
)
#f
(none)
)
)
(defstate hit (juicer)
:virtual #t
:code (behavior ()
(local-vars (v1-37 enemy-flag) (v1-45 enemy-flag))
(ja-channel-push! 1 (seconds 0.2))
(let ((f30-0 (get-rand-float-range self 0.9 1.1)))
(ja-no-eval :group! (-> self draw art-group data (-> self enemy-info-override hit-anim))
:num! (seek!
(the float
(+ (-> (the-as art-joint-anim (-> self draw art-group data (-> self enemy-info-override hit-anim)))
frames
num-frames
)
-1
)
)
f30-0
)
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! max f30-0))
)
)
(if (logtest? (-> self enemy-flags) (enemy-flag check-water))
(logior! (-> self focus-status) (focus-status dangerous))
(logclear! (-> self focus-status) (focus-status dangerous))
)
(let ((v1-36 (-> self enemy-flags)))
(if (logtest? v1-36 (enemy-flag checking-water))
(set! v1-37 (logior v1-36 (enemy-flag enable-on-active)))
(set! v1-37 (logclear v1-36 (enemy-flag enable-on-active)))
)
)
(set! (-> self enemy-flags) v1-37)
(if (logtest? (-> self enemy-flags) (enemy-flag look-at-move-dest))
(set! (-> self mask) (logior (process-mask collectable) (-> self mask)))
(logclear! (-> self mask) (process-mask collectable))
)
(let ((v1-44 (-> self enemy-flags)))
(if (logtest? (enemy-flag no-initial-move-to-ground) v1-44)
(set! v1-45 (logior (enemy-flag check-water-backup) v1-44))
(set! v1-45 (logclear v1-44 (enemy-flag check-water-backup)))
)
)
(set! (-> self enemy-flags) v1-45)
(logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup))
(logclear! (-> self focus-status) (focus-status hit))
(go-virtual hostile)
(none)
)
)
(defstate stare (juicer)
:virtual #t
:code (behavior ()
(ja-channel-push! 1 (seconds 1))
(let ((f30-0 (get-rand-float-range self 0.9 1.1))
(gp-0 (-> self draw art-group data (-> self enemy-info-override idle-anim)))
)
(until #f
(ja-no-eval :group! gp-0
:num! (seek! (the float (+ (-> (the-as art-joint-anim gp-0) frames num-frames) -1)) f30-0)
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! max f30-0))
)
)
)
#f
(none)
)
)
(defstate taunt (juicer)
:virtual #t
:code (behavior ()
(ja-channel-push! 1 (seconds 0.6))
(let ((f30-0 (get-rand-float-range self 0.8 1.2)))
(let ((gp-0 (get-rand-int-range self 60 210))
(s5-0 (-> self clock frame-counter))
(f28-0 f30-0)
)
(ja-no-eval :group! (-> self draw art-group data (-> self enemy-info-override idle-anim))
:num! (loop! f28-0)
:frame-num 0.0
)
(until (>= (- (-> self clock frame-counter) s5-0) gp-0)
(suspend)
(ja :num! (loop! f28-0))
)
)
(ja-channel-push! 1 (seconds 0.1))
(ja-no-eval :group! (-> self draw art-group data (-> self enemy-info-override taunt-anim))
:num! (seek!
(the float
(+ (-> (the-as art-joint-anim (-> self draw art-group data (-> self enemy-info-override taunt-anim)))
frames
num-frames
)
-1
)
)
f30-0
)
:frame-num 0.0
)
(until (ja-done? 0)
(suspend)
(ja :num! (seek! max f30-0))
)
)
(go-virtual stare)
(none)
)
)
(defmethod enemy-method-77 juicer ((obj juicer) (arg0 (pointer float)))
(local-vars (a2-2 int))
(case (-> obj incoming knocked-type)
(((knocked-type knocked-type-4))
(ja-channel-push! 1 0)
(let* ((a2-0 (ash 1 (-> *juicer-global-info* prev-yellow-hit)))
(v1-3 (enemy-method-120 obj 4 a2-0))
(a1-6 (-> obj draw art-group data (-> *juicer-global-info* yellow-hit-anim v1-3)))
)
(set! (-> *juicer-global-info* prev-yellow-hit) v1-3)
(let ((a0-13 (-> obj skel root-channel 0)))
(set! (-> a0-13 frame-group) (the-as art-joint-anim a1-6))
(set! (-> a0-13 param 0) (the float (+ (-> (the-as art-joint-anim a1-6) frames num-frames) -1)))
(set! (-> a0-13 param 1) (-> arg0 0))
(set! (-> a0-13 frame-num) 0.0)
(joint-control-channel-group! a0-13 (the-as art-joint-anim a1-6) num-func-seek!)
)
)
)
(((knocked-type knocked-type-6))
(let ((v1-11 (ash 1 (-> *juicer-global-info* prev-blue-hit))))
(if (zero? (-> obj charge-index))
(set! a2-2 (logior v1-11 56))
(set! a2-2 (logior v1-11 7))
)
)
(let* ((v1-15 (enemy-method-120 obj 6 a2-2))
(s5-1 (-> obj draw art-group data (-> *juicer-global-info* blue-hit-anim v1-15)))
)
(set! (-> *juicer-global-info* prev-blue-hit) v1-15)
(let ((v1-18 (if (> (-> obj skel active-channels) 0)
(-> obj skel root-channel 0 frame-group)
)
)
)
(if (and v1-18 (= v1-18 (-> obj draw art-group data 32)))
(ja-channel-push! 1 (seconds 0.17))
(ja-channel-push! 1 (seconds 0.02))
)
)
(let ((a0-32 (-> obj skel root-channel 0)))
(set! (-> a0-32 frame-group) (the-as art-joint-anim s5-1))
(set! (-> a0-32 param 0) (the float (+ (-> (the-as art-joint-anim s5-1) frames num-frames) -1)))
(set! (-> a0-32 param 1) 1.0)
(set! (-> a0-32 frame-num) 0.0)
(joint-control-channel-group! a0-32 (the-as art-joint-anim s5-1) num-func-seek!)
)
)
)
(else
(let ((s4-1 (-> obj draw art-group data (-> *juicer-global-info* knocked-anim (get-rand-int obj 2)))))
(ja-channel-push! 1 (seconds 0.17))
(let ((a0-37 (-> obj skel root-channel 0)))
(set! (-> a0-37 frame-group) (the-as art-joint-anim s4-1))
(set! (-> a0-37 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1)))
(set! (-> a0-37 param 1) (-> arg0 0))
(set! (-> a0-37 frame-num) 0.0)
(joint-control-channel-group! a0-37 (the-as art-joint-anim s4-1) num-func-seek!)
)
)
)
)
#t
)
(defmethod enemy-method-78 juicer ((obj juicer) (arg0 (pointer float)))
(cond
((= (-> obj incoming knocked-type) (knocked-type knocked-type-6))
(when (>= (-> obj incoming blue-juggle-count) (the-as uint 2))
(let ((s4-0 (-> obj draw art-group data 32)))
(ja-channel-push! 1 (seconds 0.17))
(let ((a0-3 (-> obj skel root-channel 0)))
(set! (-> a0-3 frame-group) (the-as art-joint-anim s4-0))
(set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim s4-0) frames num-frames) -1)))
(set! (-> a0-3 param 1) (-> arg0 0))
(set! (-> a0-3 frame-num) 0.0)
(joint-control-channel-group! a0-3 (the-as art-joint-anim s4-0) num-func-seek!)
)
)
#t
)
)
((!= (-> obj incoming knocked-type) (knocked-type knocked-type-4))
(let* ((v1-14 (if (> (-> obj skel active-channels) 0)
(-> obj skel root-channel 0 frame-group)
)
)
(s4-1 (if (and v1-14 (= v1-14 (-> obj draw art-group data 18)))
(-> obj draw art-group data 19)
(-> obj draw art-group data 17)
)
)
)
(ja-channel-push! 1 (seconds 0.17))
(let ((a0-10 (-> obj skel root-channel 0)))
(set! (-> a0-10 frame-group) (the-as art-joint-anim s4-1))
(set! (-> a0-10 param 0) (the float (+ (-> (the-as art-joint-anim s4-1) frames num-frames) -1)))
(set! (-> a0-10 param 1) (-> arg0 0))
(set! (-> a0-10 frame-num) 0.0)
(joint-control-channel-group! a0-10 (the-as art-joint-anim s4-1) num-func-seek!)
)
)
#t
)
)
)
;; WARN: Return type mismatch symbol vs none.
(defmethod juicer-method-184 juicer ((obj juicer) (arg0 symbol))
(let ((v1-1 (-> obj root-override2 root-prim)))
(dotimes (a0-1 (the-as int (-> v1-1 specific 0)))
(let ((a2-1 (-> (the-as collide-shape-prim-group v1-1) child a0-1)))
(if arg0
(logior! (-> a2-1 prim-core action) (collide-action deadly))
(logclear! (-> a2-1 prim-core action) (collide-action deadly))
)
)
)
)
(none)
)
;; WARN: Return type mismatch none vs symbol.
(defmethod enemy-method-63 juicer ((obj juicer) (arg0 process-focusable) (arg1 enemy-aware))
(let ((t9-0 (method-of-type nav-enemy enemy-method-63)))
(the-as symbol (if (t9-0 obj arg0 arg1)
(set-dst-proc! (-> obj los) (-> obj focus handle))
)
)
)
)
(defmethod init-enemy-collision! juicer ((obj juicer))
"Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly"
(let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player))))
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s5-0 reaction) cshape-reaction-default)
(set! (-> s5-0 no-reaction)
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
)
(set! (-> s5-0 penetrated-by) (penetrate
generic-attack
lunge
flop
punch
spin
roll
uppercut
bonk
tube
vehicle
flut-attack
board
mech-punch
dark-punch
dark-giant
)
)
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 6) 0)))
(set! (-> s5-0 total-prims) (the-as uint 7))
(set! (-> s4-0 prim-core collide-as) (collide-spec enemy))
(set! (-> s4-0 prim-core collide-with)
(collide-spec backgnd jak bot crate obstacle hit-by-others-list player-list)
)
(set! (-> s4-0 prim-core action) (collide-action solid deadly no-standon))
(set! (-> s4-0 transform-index) 21)
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 -4096.0 18432.0)
(set! (-> s5-0 root-prim) s4-0)
)
(let ((v1-14 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> v1-14 prim-core collide-as) (collide-spec enemy))
(set! (-> v1-14 prim-core collide-with)
(collide-spec backgnd jak bot crate obstacle hit-by-others-list player-list)
)
(set! (-> v1-14 prim-core action) (collide-action solid no-standon))
(set-vector! (-> v1-14 local-sphere) 0.0 6144.0 0.0 6144.0)
)
(let ((v1-16 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> v1-16 prim-core collide-as) (collide-spec enemy))
(set! (-> v1-16 prim-core collide-with) (collide-spec jak bot player-list))
(set! (-> v1-16 prim-core action) (collide-action solid))
(set! (-> v1-16 transform-index) 6)
(set-vector! (-> v1-16 local-sphere) 0.0 0.0 0.0 6144.0)
)
(let ((v1-18 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> v1-18 prim-core collide-as) (collide-spec enemy))
(set! (-> v1-18 prim-core collide-with) (collide-spec jak bot player-list))
(set! (-> v1-18 prim-core action) (collide-action solid))
(set! (-> v1-18 transform-index) 16)
(set-vector! (-> v1-18 local-sphere) 0.0 0.0 0.0 2048.0)
)
(let ((v1-20 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> v1-20 prim-core collide-as) (collide-spec enemy))
(set! (-> v1-20 prim-core collide-with) (collide-spec jak bot player-list))
(set! (-> v1-20 prim-core action) (collide-action solid))
(set! (-> v1-20 transform-index) 11)
(set-vector! (-> v1-20 local-sphere) 0.0 0.0 0.0 2048.0)
)
(let ((v1-22 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> v1-22 prim-core collide-as) (collide-spec enemy))
(set! (-> v1-22 prim-core collide-with) (collide-spec jak bot player-list))
(set! (-> v1-22 prim-core action) (collide-action solid))
(set! (-> v1-22 transform-index) 34)
(set-vector! (-> v1-22 local-sphere) 0.0 0.0 0.0 2048.0)
)
(let ((v1-24 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> v1-24 prim-core collide-as) (collide-spec enemy))
(set! (-> v1-24 prim-core collide-with) (collide-spec jak bot player-list))
(set! (-> v1-24 prim-core action) (collide-action solid))
(set! (-> v1-24 transform-index) 20)
(set-vector! (-> v1-24 local-sphere) 0.0 0.0 0.0 2048.0)
)
(set! (-> s5-0 nav-radius) 8192.0)
(let ((v1-26 (-> s5-0 root-prim)))
(set! (-> s5-0 backup-collide-as) (-> v1-26 prim-core collide-as))
(set! (-> s5-0 backup-collide-with) (-> v1-26 prim-core collide-with))
)
(set! (-> s5-0 max-iteration-count) (the-as uint 3))
(set! (-> obj root-override2) s5-0)
)
0
(none)
)
;; WARN: Return type mismatch process-focusable vs juicer.
(defmethod relocate juicer ((obj juicer) (arg0 int))
(if (nonzero? (-> obj intro-path))
(&+! (-> obj intro-path) arg0)
)
(if (nonzero? (-> obj joint))
(&+! (-> obj joint) arg0)
)
(the-as
juicer
((the-as (function process-focusable int process-focusable) (find-parent-method juicer 7)) obj arg0)
)
)
(defmethod init-enemy! juicer ((obj juicer))
"Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods"
(initialize-skeleton
obj
(the-as skeleton-group (art-group-get-by-name *level* "skel-juicer" (the-as (pointer uint32) #f)))
(the-as pair 0)
)
(init-enemy-behaviour-and-stats! obj *juicer-nav-enemy-info*)
(let ((v1-5 (-> obj neck)))
(set! (-> v1-5 up) (the-as uint 1))
(set! (-> v1-5 nose) (the-as uint 2))
(set! (-> v1-5 ear) (the-as uint 0))
(set-vector! (-> v1-5 twist-max) 11832.889 11832.889 0.0 1.0)
(set! (-> v1-5 ignore-angle) 30947.555)
)
(let ((v1-7 (-> obj nav)))
(set! (-> v1-7 speed-scale) 1.0)
)
0
(set-gravity-length (-> obj root-override2 dynam) 573440.0)
(set! (-> obj last-fire-time) 0)
(set! (-> obj heading) (the-as basic (if (rand-vu-percent? 0.5)
#t
#f
)
)
)
(set! (-> obj move-angle) 5461.3335)
(set! (-> obj torso-track-player) #f)
(new-source! (-> obj los) obj (seconds 0.2) (collide-spec backgnd obstacle))
(set! (-> obj joint) (new 'process 'joint-mod (joint-mod-mode joint-set*-world) obj 5))
(set! (-> obj using-turn-anim) #f)
(let ((v1-18 (new 'process 'path-control obj 'intro 0.0 (the-as entity #f) #t)))
(set! (-> obj intro-path) v1-18)
(if (nonzero? v1-18)
(logior! (-> v1-18 flags) (path-control-flag display draw-line draw-point draw-text))
)
)
(add-connection
*part-engine*
obj
34
obj
318
(new 'static 'vector :x 901.12 :y -1146.88 :z 1269.76 :w 163840.0)
)
(add-connection
*part-engine*
obj
34
obj
318
(new 'static 'vector :x -901.12 :y -1146.88 :z 1269.76 :w 163840.0)
)
(add-connection *part-engine* obj 20 obj 4635 (new 'static 'vector :w 163840.0))
(set! (-> obj root-override2 pause-adjust-distance) 81920.0)
(set! (-> obj current-projectile) (the-as handle #f))
0
(none)
)