jak-project/goal_src/jak2/engine/target/gun/gun-dark-shot.gc

843 lines
34 KiB
Common Lisp
Raw Normal View History

;;-*-Lisp-*-
(in-package goal)
;; name: gun-dark-shot.gc
;; name in dgo: gun-dark-shot
;; dgos: ENGINE, GAME
(define-extern market-object type)
(define-extern fruit-stand type)
(define-extern crate type)
;; DECOMP BEGINS
(set! (-> *lightning-spec-id-table* 11) (new 'static 'lightning-spec
:name "lightning-dark-shot-attack"
:flags (lightning-spec-flags lsf0)
:start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
:end-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
:fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5)
:fade-start-factor 0.2
:texture (new 'static 'texture-id :index #x83 :page #xc)
:reduction 0.42
:num-points 16
:box-size 8192.0
:merge-factor 0.6
:merge-count 2
:radius 3276.8
:duration 45.0
:duration-rand 60.0
:sound (static-sound-spec "stretched-zap")
)
)
(set! (-> *lightning-spec-id-table* 12) (new 'static 'lightning-spec
:name "lightning-dark-shot-attack-thick"
:flags (lightning-spec-flags lsf0)
:start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
:end-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
:fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5)
:fade-start-factor 0.2
:texture (new 'static 'texture-id :index #x83 :page #xc)
:reduction 0.42
:num-points 32
:box-size 12288.0
:merge-factor 0.6
:merge-count 2
:radius 12288.0
:duration 60.0
:sound (static-sound-spec "stretched-zap")
)
)
(defpart 429
:init-specs ((:texture (new 'static 'texture-id :index #xbb :page #xc))
(:num 1.0)
(:scale-x (meters 0.3) (meters 0.2))
(:rot-x (degrees 11.25))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 0.0 64.0)
(:g 64.0 64.0)
(:b 255.0)
(:a 48.0)
(:timer (seconds 0.017))
(:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
(:userdata 4096.0)
)
)
(defpart 430
:init-specs ((:texture (new 'static 'texture-id :index #xbc :page #xc))
(:num 1.0)
(:scale-x (meters 1) (meters 4))
(:rot-x (degrees 11.25))
(:rot-z (degrees 0) (degrees 360))
(:scale-y :copy scale-x)
(:r 0.0 64.0)
(:g 64.0 64.0)
(:b 255.0)
(:a 128.0)
(:timer (seconds 0.017))
(:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
(:userdata 4096.0)
(:conerot-x (degrees 0) (degrees 3600))
(:conerot-y (degrees 0) (degrees 3600))
(:conerot-z (degrees 0) (degrees 3600))
(:conerot-radius (meters -0.1) (meters 0.5))
)
)
(deftype gun-dark-shot (projectile)
((blast-radius float :offset-assert 472)
(core-position vector :inline :offset-assert 480)
(core-velocity vector :inline :offset-assert 496)
(spin-vector vector :inline :offset-assert 512)
(track-target handle :offset-assert 528)
(size-t float :offset-assert 536)
(result-array handle 16 :offset-assert 544)
(charge-sound sound-id :offset-assert 672)
(fire-sound sound-id :offset-assert 676)
(trail-sound sound-id :offset-assert 680)
(explode-sound sound-id :offset-assert 684)
(start-pilot? basic :offset-assert 688)
)
:heap-base #x240
:method-count-assert 42
:size-assert #x2b4
:flag-assert #x2a024002b4
(:methods
(startup () _type_ :state 40)
(fizzle () _type_ :state 41)
)
)
(defbehavior target-gun-fire-dark target ()
(let ((s5-0 (-> self gun))
(gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))
)
(set! (-> gp-0 ent) (-> self entity))
(set! (-> gp-0 charge) (-> s5-0 fire-charge))
(set! (-> gp-0 options) (projectile-options))
(set! (-> gp-0 pos quad) (-> s5-0 fire-point quad))
(set! (-> gp-0 vel quad) (-> s5-0 fire-dir-out quad))
(set! (-> gp-0 notify-handle) (the-as handle #f))
(set! (-> gp-0 owner-handle) (the-as handle #f))
(set! (-> gp-0 ignore-handle) (process->handle (the-as process (send-event self 'get-vehicle))))
(let* ((v1-8 *game-info*)
(a0-11 (+ (-> v1-8 attack-id) 1))
)
(set! (-> v1-8 attack-id) a0-11)
(set! (-> gp-0 attack-id) a0-11)
)
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
(set! (-> gp-0 timeout) (seconds 4))
(let ((v0-1 (spawn-projectile gun-dark-shot gp-0 (ppointer->process (-> s5-0 gun)) *default-dead-pool*)))
(when v0-1
(set! (-> (the-as gun-dark-shot (-> v0-1 0)) track-target) (-> self gun track-target 0 handle))
(set! (-> self gun charge-active?) (ppointer->handle v0-1))
)
v0-1
)
)
)
(defmethod init-proj-settings! gun-dark-shot ((obj gun-dark-shot))
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
"Init relevant settings for the [[projectile]] such as gravity, speed, timeout, etc"
(set! (-> obj attack-mode) 'eco-dark)
(vector-normalize! (-> obj root transv) (+ 225280.0 (* 225280.0 (-> obj charge-level))))
(set! (-> obj part) (create-launch-control (-> *part-group-id-table* 72) obj))
(set! (-> obj blast-radius) 40960.0)
(set! (-> obj size-t) 0.0)
(set! (-> obj charge-sound) (new-sound-id))
(set! (-> obj fire-sound) (new-sound-id))
(set! (-> obj trail-sound) (new-sound-id))
(set! (-> obj explode-sound)
(add-process *gui-control* obj (gui-channel background) (gui-action queue) "pmkrxplo" -99.0 0)
)
(set-falloff! *gui-control* (-> obj explode-sound) #t 50 150 11)
(set! (-> obj start-pilot?) (the-as basic (and *target* (focus-test? *target* pilot))))
((method-of-type projectile init-proj-settings!) obj)
0
(none)
)
(defmethod spawn-impact-particles gun-dark-shot ((obj gun-dark-shot))
"Spawns associated particles with the projectile if applicable"
(cond
((and (and (-> obj next-state) (= (-> obj next-state name) 'startup))
(and *target* (focus-test? *target* in-head))
)
(kill-and-free-particles (-> obj part))
)
(else
(set! (-> *part-id-table* 219 init-specs 2 initial-valuef) (lerp 409.6 9216.0 (-> obj size-t)))
(set! (-> *part-id-table* 219 init-specs 8 initial-valuef) (lerp 0.0 32.0 (-> obj size-t)))
(set! (-> *part-id-table* 220 init-specs 2 initial-valuef) (lerp 409.6 32768.0 (-> obj size-t)))
(set! (-> *part-id-table* 220 init-specs 8 initial-valuef) (lerp 0.0 16.0 (-> obj size-t)))
(set! (-> *part-id-table* 218 init-specs 2 initial-valuef) (lerp 409.6 8192.0 (-> obj size-t)))
(set! (-> *part-id-table* 217 init-specs 1 initial-valuef) (lerp 0.1 1.0 (-> obj size-t)))
(set! (-> *part-id-table* 217 init-specs 2 initial-valuef) (lerp 409.6 3686.4 (-> obj size-t)))
(spawn (-> obj part) (-> obj root trans))
)
)
(ja-post)
(none)
)
(defmethod go-moving! gun-dark-shot ((obj gun-dark-shot))
(go (method-of-object obj startup))
0
(none)
)
(defstate startup (gun-dark-shot)
:virtual #t
:exit (behavior ()
(send-event (ppointer->process (-> self parent)) 'release)
(set! (-> self size-t) 1.0)
(let ((v1-6 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> v1-6 command) (sound-command set-param))
(set! (-> v1-6 id) (-> self charge-sound))
(set! (-> v1-6 params volume) -4)
(set! (-> v1-6 auto-time) 24)
(set! (-> v1-6 auto-from) 2)
(set! (-> v1-6 params mask) (the-as uint 17))
(-> v1-6 id)
)
)
:code (behavior ()
(set! (-> self state-time) (current-time))
(until #f
(cond
((or (and *target*
(focus-test? *target* dead grabbed under-water pole flut board mech dark carry indax teleporting)
)
(and *target* (not (logtest? (focus-status in-head gun) (-> *target* focus-status))))
(and *target* (not (-> self start-pilot?)) (focus-test? *target* pilot))
)
(go-virtual dissipate)
)
((or (< (- (current-time) (-> self state-time)) (seconds 0.3)) (cpad-hold? 0 r1))
(set! (-> self size-t) (fmin 1.0 (* 0.016666668 (the float (- (current-time) (-> self state-time))))))
(let ((t9-1 vector<-cspace!)
(a0-13 (-> self root trans))
(v1-26 (-> self parent))
)
(t9-1 a0-13 (-> (the-as process-drawable (if v1-26
(the-as process-drawable (-> v1-26 0 self))
)
)
node-list
data
13
)
)
)
)
((and (logtest? (-> self options) (projectile-options proj-options-8000)) (made-impact? self))
(go-virtual impact)
)
(else
(go-virtual moving)
)
)
(suspend)
)
#f
)
:post (behavior ()
(sound-play "pmkr-charge" :id (-> self charge-sound) :position (-> self root trans))
(spawn-impact-particles self)
)
)
(defstate moving (gun-dark-shot)
:virtual #t
:enter (behavior ()
(let ((t9-0 (-> (method-of-type projectile moving) enter)))
(if t9-0
(t9-0)
)
)
(set! (-> self core-position quad) (-> self root trans quad))
(let ((v1-5 (-> self core-velocity))
(a0-3 (-> self parent))
)
(set! (-> v1-5 quad) (-> (the-as process-drawable (if a0-3
(the-as process-drawable (-> a0-3 0 self))
)
)
node-list
data
13
bone
transform
vector
2
quad
)
)
)
(when (and *target* (focus-test? *target* in-head))
(set! (-> self core-position quad) (-> (camera-pos) quad))
(set! (-> self core-velocity quad) (-> (camera-matrix) vector 2 quad))
)
(set-vector! (-> self spin-vector) (-> self core-velocity z) 0.0 (- (-> self core-velocity x)) 1.0)
(let ((f0-5 (vector-length (-> self spin-vector))))
(if (< f0-5 1.0)
(set-vector! (-> self spin-vector) 1.0 0.0 0.0 1.0)
(vector-float*! (-> self spin-vector) (-> self spin-vector) (/ 1.0 f0-5))
)
)
(set! (-> self state-time) (current-time))
(let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000)))
(when gp-2
(let ((t9-4 (method-of-type part-tracker activate)))
(t9-4
(the-as part-tracker gp-2)
*entity-pool*
(symbol->string (-> part-tracker symbol))
(the-as pointer #x70004000)
)
)
(let ((t9-5 run-function-in-process)
(a0-18 gp-2)
(a1-4 part-tracker-init)
(a2-4 (-> *part-group-id-table* 70))
(a3-1 0)
(t0-0 #f)
(t1-0 #f)
(t2-0 #f)
(t3-0 *launch-matrix*)
)
(set! (-> t3-0 trans quad) (-> self root trans quad))
((the-as (function object object object object object object object object none) t9-5)
a0-18
a1-4
a2-4
a3-1
t0-0
t1-0
t2-0
t3-0
)
)
(-> gp-2 ppointer)
)
)
(draw-beam (-> *part-id-table* 210) (-> self root trans) (-> self core-velocity) #f #t)
)
:trans (behavior ()
(local-vars (at-0 int))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf)
)
(init-vf0-vector)
(let ((gp-0 (new 'stack-no-clear 'vector)))
(let ((s5-0 (new 'stack-no-clear 'matrix)))
(let ((s4-0 (new 'stack-no-clear 'vector)))
(vector-normalize-copy! s4-0 (-> self core-velocity) 1.0)
(let* ((s3-0 (handle->process (-> self track-target)))
(v1-3 (if (type? s3-0 process-drawable)
(the-as process-drawable s3-0)
)
)
)
(when v1-3
(let* ((s3-2 (vector-! (new 'stack-no-clear 'vector) (-> v1-3 root trans) (-> self core-position)))
(f0-0 (vector-normalize-ret-len! s3-2 1.0))
(f0-1 (lerp-scale 182.04445 8192.0 f0-0 61440.0 4096.0))
(s2-0 (new 'stack-no-clear 'matrix))
)
(matrix-from-two-vectors-max-angle! s2-0 s4-0 s3-2 f0-1)
(vector-matrix*! (-> self core-velocity) (-> self core-velocity) s2-0)
)
)
)
(+! (-> self spin-vector x) (-> s4-0 z))
(set! (-> self spin-vector z) (- (-> self spin-vector z) (-> s4-0 x)))
(vector-flatten! (-> self spin-vector) (-> self spin-vector) s4-0)
(matrix-axis-angle! s5-0 s4-0 (* 2002.4889 (-> self clock time-adjust-ratio)))
(vector-matrix*! (-> self spin-vector) (-> self spin-vector) s5-0)
(let ((f0-9 (the float (- (current-time) (-> self state-time))))
(f30-0 0.0)
)
(cond
((< 450.0 f0-9)
(go-virtual impact)
)
((< f0-9 90.0)
(set! f30-0 (lerp-scale 0.0 4096.0 f0-9 0.0 90.0))
)
(else
(set! f30-0 (lerp-scale 4096.0 1228.8 f0-9 30.0 300.0))
)
)
(vector-normalize! (-> self spin-vector) f30-0)
(vector-normalize! (-> self core-velocity) 7372.8)
(set! (-> s5-0 vector 2 quad) (-> s4-0 quad))
(set! (-> s5-0 vector 1 quad) (-> self spin-vector quad))
(vector-float*! (-> s5-0 vector 1) (-> s5-0 vector 1) (/ 1.0 f30-0))
)
)
(vector-cross! (the-as vector (-> s5-0 vector)) (-> s5-0 vector 1) (-> s5-0 vector 2))
(matrix->quaternion (-> self root quat) s5-0)
)
(vector+! (-> self core-position) (-> self core-position) (-> self core-velocity))
(vector+! gp-0 (-> self core-position) (-> self spin-vector))
(vector-! (-> self root transv) gp-0 (-> self root trans))
)
(let ((v1-31 (-> self root transv)))
(.lvf vf1 (&-> (-> self root transv) quad))
(let ((f0-12 (-> self clock frames-per-second)))
(.mov at-0 f0-12)
)
(.mov vf2 at-0)
(.mov.vf vf1 vf0 :mask #b1000)
(.mul.x.vf vf1 vf1 vf2 :mask #b111)
(.svf (&-> v1-31 quad) vf1)
)
(projectile-move-fill-line-sphere self)
(if (logtest? (-> self root status) (collide-status touch-surface))
(go-virtual impact)
)
(sound-play "pmkr-fire" :id (-> self fire-sound) :position (-> self root trans))
(sound-play "pmkr-trail" :id (-> self trail-sound) :position (-> self root trans))
)
)
)
;; WARN: Check prologue - tricky store of a0
(defun process-drawable-shock-effect-bullseye ((arg0 process-focusable)
(arg1 process-focusable)
(arg2 matrix)
(arg3 int)
(arg4 sparticle-launcher)
(arg5 sparticle-launcher)
(arg6 sparticle-launcher)
)
(local-vars (sv-16 process) (sv-32 matrix) (sv-48 process-focusable))
(set! sv-48 arg0)
(let ((s0-0 arg1))
(set! sv-32 arg2)
(let ((gp-0 arg4)
(s2-0 arg5)
(s3-0 arg6)
(s4-0 (get-trans sv-48 3))
(s5-0 (get-trans s0-0 3))
)
(set! sv-16 (get-process *default-dead-pool* lightning-tracker #x4000))
(let ((s1-0 (when sv-16
(let ((t9-3 (method-of-type lightning-tracker activate)))
(t9-3
(the-as lightning-tracker sv-16)
s0-0
(symbol->string (-> lightning-tracker symbol))
(the-as pointer #x70004000)
)
)
(let ((t9-4 run-function-in-process)
(a0-5 sv-16)
(a1-7 lightning-tracker-init)
(a3-2 0)
(t0-1 lightning-probe-callback)
(t2-1 256)
(t3-0 256)
)
((the-as (function object object object object object object object object none) t9-4)
a0-5
a1-7
sv-32
a3-2
t0-1
sv-48
t2-1
t3-0
)
)
(-> sv-16 ppointer)
)
)
)
(when s2-0
(let ((t9-5 sp-launch-particles-var)
(a0-6 *sp-particle-system-2d*)
(a2-4 *launch-matrix*)
)
(set! (-> a2-4 trans quad) (-> s4-0 quad))
(t9-5 a0-6 s2-0 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
)
(when s3-0
(let ((t9-6 sp-launch-particles-var)
(a0-7 *sp-particle-system-2d*)
(a2-5 *launch-matrix*)
)
(set! (-> a2-5 trans quad) (-> s4-0 quad))
(t9-6 a0-7 s3-0 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
)
(when (and gp-0 s1-0)
(let ((v1-15 (get-field-spec-by-id gp-0 (sp-field-id spt-timer))))
(if v1-15
(set! (-> v1-15 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> s1-0 0)) duration)))
)
)
(let ((t9-8 sp-launch-particles-var)
(a0-12 *sp-particle-system-2d*)
(a1-15 gp-0)
(a2-6 *launch-matrix*)
)
(set! (-> a2-6 trans quad) (-> s4-0 quad))
(t9-8 a0-12 a1-15 a2-6 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
(let ((t9-9 sp-launch-particles-var)
(a0-13 *sp-particle-system-2d*)
(a2-7 *launch-matrix*)
)
(set! (-> a2-7 trans quad) (-> s5-0 quad))
(t9-9 a0-13 gp-0 a2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
)
)
)
)
0
(none)
)
(defstate fizzle (gun-dark-shot)
:virtual #t
:enter (behavior ()
(set! (-> self state-time) (current-time))
)
:trans (behavior ()
(if (>= (- (current-time) (-> self state-time)) (seconds 1))
(deactivate self)
)
(process-drawable-shock-effect
self
(-> *lightning-spec-id-table* 11)
lightning-probe-callback
(-> *part-id-table* 429)
256
0
40960.0
)
(launch-particles (-> *part-id-table* 215) (-> self root trans))
(launch-particles (-> *part-id-table* 216) (-> self root trans))
(let ((gp-0 (-> *part-id-table* 430)))
(when gp-0
(let ((v1-14 (get-field-spec-by-id gp-0 (sp-field-id spt-timer))))
(if v1-14
(set! (-> v1-14 initial-valuef) (the-as float #xf))
)
)
(let ((t9-5 sp-launch-particles-var)
(a0-8 *sp-particle-system-2d*)
(a2-3 *launch-matrix*)
)
(set! (-> a2-3 trans quad) (-> self root trans quad))
(t9-5 a0-8 gp-0 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0)
)
)
)
)
:code sleep-code
)
;; WARN: Return type mismatch object vs none.
(defbehavior gun-dark-shot-init-fizzle gun-dark-shot ((arg0 vector))
(let ((s5-0 (new 'process 'collide-shape-moving self (collide-list-enum hit-by-player))))
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s5-0 reaction) cshape-reaction-projectile)
(set! (-> s5-0 no-reaction)
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
)
(let ((v1-6 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
(set! (-> v1-6 prim-core collide-as) (collide-spec projectile))
(set! (-> v1-6 prim-core collide-with)
(collide-spec backgnd crate civilian enemy obstacle vehicle-sphere hit-by-others-list pusher)
)
(set! (-> v1-6 prim-core action) (collide-action solid))
(set-vector! (-> v1-6 local-sphere) 0.0 5324.8 0.0 5324.8)
(set! (-> s5-0 total-prims) (the-as uint 1))
(set! (-> s5-0 root-prim) v1-6)
)
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
(let ((v1-9 (-> s5-0 root-prim)))
(set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as))
(set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with))
)
(set! (-> s5-0 max-iteration-count) (the-as uint 2))
(set! (-> s5-0 event-self) 'touched)
(set! (-> self root) s5-0)
)
(set! (-> self root trans quad) (-> arg0 quad))
(let ((v1-16 (-> self root root-prim)))
(set! (-> v1-16 prim-core collide-as) (collide-spec))
(set! (-> v1-16 prim-core collide-with) (collide-spec))
)
0
(logclear! (-> self mask) (process-mask actor-pause))
(go-virtual fizzle)
(none)
)
(defstate impact (gun-dark-shot)
:virtual #t
:code (behavior ()
(local-vars
(sv-256 collide-shape)
(sv-272 process-drawable)
(sv-288 vector)
(sv-304 process-drawable)
(sv-320 process-drawable)
(sv-336 process-drawable)
)
(if (< (- (current-time) (-> self spawn-time)) (seconds 0.1))
(send-event (ppointer->process (-> self parent)) 'release)
)
(sound-stop (-> self trail-sound))
(let ((v1-10 (get-status *gui-control* (-> self explode-sound))))
(cond
((= v1-10 (gui-status ready))
(set-action!
*gui-control*
(gui-action play)
(-> self explode-sound)
(gui-channel none)
(gui-action none)
(the-as string #f)
(the-as (function gui-connection symbol) #f)
(the-as process #f)
)
)
(else
(set-action!
*gui-control*
(gui-action stop)
(-> self explode-sound)
(gui-channel none)
(gui-action none)
(the-as string #f)
(the-as (function gui-connection symbol) #f)
(the-as process #f)
)
(the-as int (sound-play "explosion" :pitch 2.5))
)
)
)
(let ((v1-16 (-> self root root-prim)))
(set! (-> v1-16 prim-core collide-as) (collide-spec))
(set! (-> v1-16 prim-core collide-with) (collide-spec))
)
0
(let ((gp-1 (new 'stack-no-clear 'explosion-init-params)))
(set! (-> gp-1 spawn-point quad) (-> self root trans quad))
(quaternion-copy! (-> gp-1 spawn-quat) (-> self root quat))
(set! (-> gp-1 radius) 36864.0)
(set! (-> gp-1 group) (-> *part-group-id-table* 71))
(set! (-> gp-1 collide-with)
(collide-spec backgnd crate enemy obstacle vehicle-sphere hit-by-others-list player-list pusher)
)
(set! (-> gp-1 penetrate-using) (penetrate explode))
(explosion-spawn (the-as process-drawable *default-pool*) explosion gp-1)
)
;; og:preserve-this stack array -> pointer
(let (;(s3-0 (the-as (array collide-shape) (new 'stack 'array collide-shape 16)))
(s3-0 (the-as (pointer collide-shape) (new 'stack-no-clear 'array 'collide-shape 16)))
(a1-8 (new 'stack-no-clear 'sphere))
)
(set! (-> a1-8 quad) (-> self root trans quad))
(set! (-> a1-8 r) (-> self blast-radius))
;; og:preserve-this stack array -> pointer
(let ((gp-2 (fill-actor-list-for-sphere *actor-hash* a1-8 s3-0 16)))
(let ((s1-0 (the-as process-drawable #f))
(f30-0 4096000.0)
(s4-0 0)
(s5-1 #t)
)
(countdown (s2-0 gp-2)
(set! sv-256 (-> s3-0 s2-0))
(set! sv-272 (-> sv-256 process))
(let ((s0-0 (if (type? sv-272 process-focusable)
sv-272
)
)
)
(cond
((and (nonzero? (-> sv-256 root-prim prim-core collide-as))
s0-0
(logtest? (process-mask crate enemy collectable guard) (-> s0-0 mask))
(not (focus-test? (the-as process-focusable s0-0) disable dead ignore))
(not (logtest? (process-mask no-track) (-> s0-0 mask)))
)
(set! sv-288 (get-trans (the-as process-focusable s0-0) 3))
(let ((f28-0 (- (vector-vector-distance (-> self root trans) sv-288) (-> sv-288 w))))
(set! sv-304 s0-0)
(if (and (not (if (type? sv-304 crate)
sv-304
)
)
(begin (set! sv-320 s0-0) (not (if (type? sv-320 market-object)
sv-320
)
)
)
(begin (set! sv-336 s0-0) (not (if (type? sv-336 fruit-stand)
sv-336
)
)
)
)
(set! s5-1 #f)
)
(cond
((not s1-0)
(+! gp-2 -1)
(set! f30-0 f28-0)
(set! s1-0 s0-0)
)
((< f28-0 f30-0)
(set! (-> self result-array s4-0) (process->handle s1-0))
(+! s4-0 1)
(set! f30-0 f28-0)
(set! s1-0 s0-0)
)
(else
(set! (-> self result-array s4-0) (process->handle s0-0))
(+! s4-0 1)
)
)
)
)
(else
(+! gp-2 -1)
)
)
)
)
(when s1-0
(set! (-> self result-array s4-0) (process->handle s1-0))
(+! gp-2 1)
(+ s4-0 1)
)
(if (zero? gp-2)
(go-virtual fizzle)
)
(if s5-1
(process-spawn gun-dark-shot :init gun-dark-shot-init-fizzle (-> self root trans))
)
)
(countdown (s5-3 gp-2)
(let* ((s3-1 (handle->process (-> self result-array s5-3)))
(s4-1 (if (type? s3-1 process-focusable)
s3-1
)
)
)
(when s4-1
(send-event s4-1 'attack #f (static-attack-info ((id (new-attack-id)) (mode 'explode) (damage 16.0))))
(process-spawn-function
process
(lambda :behavior gun-dark-shot
((arg0 handle))
(let ((s5-0 (-> self parent))
(s4-0 0)
(s3-0 (current-time))
)
(set! (-> self clock) (-> s5-0 0 clock))
(while (and (nonzero? (-> (the-as process-drawable (-> s5-0 0)) skel))
(let ((v1-30 s5-0))
(and (or (focus-test?
(the-as process-focusable (if v1-30
(the-as process-focusable (-> v1-30 0 self))
)
)
dead
hit
)
(let ((v1-35 s5-0))
(or (and (-> (the-as process (if v1-35
(the-as process (-> v1-35 0 self))
)
)
next-state
)
(let ((v1-39 s5-0))
(= (-> (the-as process (if v1-39
(the-as process (-> v1-39 0 self))
)
)
next-state
name
)
'knocked
)
)
)
(< (- (current-time) s3-0) (seconds 0.1))
)
)
)
(< (- (current-time) s3-0) (seconds 5))
(not (logtest? (-> (the-as process-drawable (-> s5-0 0)) draw status) (draw-control-status no-draw no-draw-temp))
)
)
)
)
(when (>= (- (current-time) (the-as time-frame s4-0)) (seconds 0.05))
(set! s4-0 (the-as int (current-time)))
(if (handle->process arg0)
(process-drawable-shock-effect-bullseye
(the-as process-focusable (handle->process arg0))
(the-as process-focusable (ppointer->process s5-0))
(the-as matrix (-> *lightning-spec-id-table* 12))
(the-as int lightning-probe-callback)
(-> *part-id-table* 430)
(-> *part-id-table* 215)
(-> *part-id-table* 216)
)
)
(process-drawable-shock-effect
(the-as process-drawable (ppointer->process s5-0))
(-> *lightning-spec-id-table* 11)
lightning-probe-callback
(-> *part-id-table* 429)
0
0
40960.0
)
)
(suspend)
)
)
(none)
)
(-> self result-array (+ gp-2 -1))
:to s4-1
)
(let ((s4-2 (current-time)))
(until (>= (- (current-time) s4-2) (seconds 0.1))
(suspend)
)
)
)
)
)
)
)
(let ((gp-3 (current-time)))
(while (or (-> self child)
(and (nonzero? (get-status *gui-control* (-> self explode-sound))) (< (- (current-time) gp-3) (seconds 10)))
)
(suspend)
)
)
(deactivate self)
)
)