;;-*-Lisp-*-
(in-package goal)

;; name: target-darkjak.gc
;; name in dgo: target-darkjak
;; dgos: GAME

(define-extern *darkjak-ball-lightning* lightning-appearance)

;; DECOMP BEGINS

(deftype darkjak-ball (projectile)
  ((impact?             symbol)
   (fire-point          vector  :inline)
   (explode-sound       uint32)
   (bolts               (array lightning-bolt))
   (ball-pos            vector  2 :inline)
   (trail               sparticle-launch-control)
   (ball1               sparticle-launch-control)
   (last-ground-height  float)
   (fire-sound          sound-id)
   )
  (:methods
    (setup-bolts! (_type_ vector vector) none)
    )
  )


(defmethod relocate ((this darkjak-ball) (offset int))
  (dotimes (v1-0 (-> this bolts length))
    (if (nonzero? (-> this bolts v1-0))
        (&+! (-> this bolts v1-0) offset)
        )
    )
  (if (nonzero? (-> this bolts))
      (&+! (-> this bolts) offset)
      )
  (if (nonzero? (-> this trail))
      (&+! (-> this trail) offset)
      )
  (if (nonzero? (-> this ball1))
      (&+! (-> this ball1) offset)
      )
  (call-parent-method this offset)
  )

(defmethod deactivate ((this darkjak-ball))
  "Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
  (sound-stop (-> this fire-sound))
  (if (nonzero? (-> this trail))
      (kill-particles (-> this trail))
      )
  (if (nonzero? (-> this ball1))
      (kill-particles (-> this ball1))
      )
  (call-parent-method this)
  (none)
  )

(defun darkjak-ball-slide-reaction ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector))
  (cshape-reaction-update-state arg0 arg1 arg3)
  (let ((a0-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) arg3 1.0)))
    0.0
    (if (< (vector-dot a0-3 (-> arg0 surface-normal)) -0.3)
        (set! (-> (the-as darkjak-ball (-> arg0 process)) impact?) #t)
        )
    )
  (let ((f0-4 (vector-dot arg3 (-> arg0 surface-normal)))
        (s3-0 (new 'stack-no-clear 'vector))
        (f30-0 (vector-length arg3))
        )
    (vector-float*! s3-0 (-> arg0 surface-normal) (* 1.2 f0-4))
    (vector-! s3-0 arg3 s3-0)
    (vector-normalize! s3-0 1.0)
    (set! (-> s3-0 y) (fmin 0.4 (-> s3-0 y)))
    (set-vector! arg2 (-> arg3 x) (-> s3-0 y) (-> arg3 z) 1.0)
    (vector-normalize! arg2 f30-0)
    )
  (-> arg0 status)
  )

;; WARN: Return type mismatch object vs symbol.
(defmethod deal-damage! ((this darkjak-ball) (arg0 process) (arg1 event-message-block))
  (local-vars (sv-288 process) (sv-304 vector))
  (let ((s4-0 (new 'stack 'attack-info)))
    (let ((v1-1 s4-0))
      (set! (-> v1-1 mode) (-> this attack-mode))
      (set! (-> v1-1 id) (-> this attack-id))
      (set! (-> v1-1 mask) (attack-mask mode id))
      (set! (-> v1-1 penetrate-using) (penetrate dark-smack))
      )
    (when (!= (-> this owner-handle) #f)
      (set! (-> s4-0 attacker) (-> this owner-handle))
      (logior! (-> s4-0 mask) (attack-mask attacker))
      )
    (when (logtest? (-> this options) (projectile-options po13))
      (set! (-> s4-0 attacker-velocity quad) (-> this pre-move-transv quad))
      (logior! (-> s4-0 mask) (attack-mask attacker-velocity))
      )
    (set! (-> s4-0 damage) (-> this damage))
    (set! (-> s4-0 vehicle-damage-factor) (-> this vehicle-damage-factor))
    (set! (-> s4-0 vehicle-impulse-factor) (-> this vehicle-impulse-factor))
    (logior! (-> s4-0 mask) (attack-mask damage vehicle-damage-factor vehicle-impulse-factor))
    (when (logtest? (projectile-options po18) (-> this options))
      (set! (-> s4-0 invinc-time) (-> this invinc-time))
      (logior! (-> s4-0 mask) (attack-mask invinc-time))
      )
    (when arg1
      (let ((s2-0 (new 'stack-no-clear 'vector))
            (s1-0 ((method-of-type touching-shapes-entry prims-touching?)
                   (the-as touching-shapes-entry arg1)
                   (-> this root)
                   (the-as uint -1)
                   )
                  )
            )
        (set! sv-288 arg0)
        (let ((s0-0 (if (type? sv-288 process-focusable)
                        sv-288
                        )
                    )
              )
          (when s0-0
            (set! sv-304 s2-0)
            (let ((v1-27 (-> (get-trans (the-as process-focusable s0-0) 3) quad)))
              (set! (-> sv-304 quad) v1-27)
              )
            (when (not (focus-test? (the-as process-focusable s0-0) hit))
              (if s1-0
                  (get-intersect-point s2-0 s1-0 (-> this root) (the-as touching-shapes-entry arg1))
                  )
              (cond
                ((logtest? (-> *part-group-id-table* 77 flags) (sp-group-flag sp13))
                 (vector-copy! (-> *launch-matrix* trans) s2-0)
                 (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 77))
                 )
                (else
                  (vector-copy! (-> *launch-matrix* trans) s2-0)
                  (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 77))
                  )
                )
              (sound-play "djak-strike-ko")
              )
            )
          )
        )
      )
    (the-as symbol (send-event
                     arg0
                     (if (logtest? (projectile-options po19) (-> this options))
                         'attack-invinc
                         'attack
                         )
                     arg1
                     s4-0
                     )
            )
    )
  )

(defmethod setup-collision! ((this darkjak-ball))
  (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
    (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s5-0 reaction) darkjak-ball-slide-reaction)
    (set! (-> s5-0 no-reaction)
          (the-as (function collide-shape-moving collide-query vector vector object) nothing)
          )
    (set! (-> s5-0 penetrate-using) (penetrate dark-smack))
    (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0)))
      (set! (-> s5-0 total-prims) (the-as uint 3))
      (set! (-> s4-0 prim-core collide-as) (collide-spec projectile))
      (set! (-> s4-0 prim-core collide-with)
            (collide-spec backgnd bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list pusher shield)
            )
      (set! (-> s4-0 prim-core action) (collide-action solid))
      (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 8192.0)
      (set! (-> s5-0 root-prim) s4-0)
      )
    (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-13 prim-core collide-as) (collide-spec projectile))
      (set! (-> v1-13 prim-core collide-with)
            (collide-spec backgnd bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list pusher shield)
            )
      (set! (-> v1-13 prim-core action) (collide-action solid))
      (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2)
      )
    (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0))))
      (set! (-> v1-15 prim-core collide-as) (collide-spec projectile))
      (set! (-> v1-15 prim-core collide-with)
            (collide-spec bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list pusher shield)
            )
      (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 8192.0)
      )
    (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
    (let ((v1-18 (-> s5-0 root-prim)))
      (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as))
      (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with))
      )
    (set! (-> s5-0 max-iteration-count) (the-as uint 1))
    (set! (-> s5-0 event-self) 'touched)
    (set! (-> this root) s5-0)
    )
  (set! (-> this root pat-ignore-mask)
        (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1 :board #x1)
        )
  0
  (none)
  )

(defun darkjak-ball-move ((arg0 darkjak-ball))
  (projectile-move-fill-line-sphere arg0)
  (sound-play "hadouken-loop" :id (-> arg0 fire-sound) :position (-> arg0 root trans))
  (seek! (-> arg0 root transv y) 0.0 (* 81920.0 (seconds-per-frame)))
  (seek! (-> arg0 root root-prim local-sphere w) 24576.0 (* 24576.0 (seconds-per-frame)))
  (let ((v1-16 (-> (the-as collide-shape-prim-group (-> arg0 root root-prim)) child 0))
        (a0-10 (-> (the-as collide-shape-prim-group (-> arg0 root root-prim)) child 1))
        )
    (set! (-> v1-16 local-sphere w) (/ (-> arg0 root root-prim local-sphere w) 10))
    (set! (-> a0-10 local-sphere w) (-> arg0 root root-prim local-sphere w))
    )
  (let ((s5-0 (new 'stack-no-clear 'collide-query))
        (v1-20 (new 'stack-no-clear 'vector))
        (f30-0 (/ (-> arg0 root root-prim local-sphere w) 2))
        )
    (vector-copy! v1-20 (-> arg0 root trans))
    (vector+float*! (-> s5-0 start-pos) v1-20 *up-vector* 0.0)
    (set! (-> s5-0 move-dist quad) (the-as uint128 0))
    (set! (-> s5-0 move-dist y) (- f30-0))
    (let ((v1-22 s5-0))
      (set! (-> v1-22 radius) f30-0)
      (set! (-> v1-22 collide-with) (collide-spec backgnd))
      (set! (-> v1-22 ignore-process0) #f)
      (set! (-> v1-22 ignore-process1) #f)
      (set! (-> v1-22 ignore-pat)
            (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
            )
      (set! (-> v1-22 action-mask) (collide-action solid))
      )
    (when (!= (fill-and-probe-using-line-sphere *collide-cache* s5-0) -100000000.0)
      (set! (-> arg0 last-ground-height) (-> s5-0 best-other-tri intersect y))
      (let ((f0-18 (- (+ (-> s5-0 best-other-tri intersect y) f30-0) (-> arg0 root trans y))))
        (if (< 0.0 f0-18)
            (seek! (-> arg0 root trans y) (+ (-> s5-0 best-other-tri intersect y) f30-0) (* 40960.0 (seconds-per-frame)))
            )
        )
      )
    )
  (if (and (< (fabs (- (-> arg0 root trans y) (-> arg0 fire-point y))) 6144.0)
           (< 16384.0 (vector-length (-> arg0 root transv)))
           )
      (set! (-> arg0 impact?) #f)
      )
  (if (-> arg0 impact?)
      (go (method-of-object arg0 impact))
      )
  (sound-play "djak-bolt-throw" :id (-> arg0 sound-id) :position (-> arg0 root trans))
  0
  (none)
  )

;; WARN: Return type mismatch smush-control vs none.
(defmethod projectile-method-26 ((this darkjak-ball))
  (sound-play "djak-strike-hit")
  (cond
    ((logtest? (-> *part-group-id-table* 76 flags) (sp-group-flag sp13))
     (vector-copy! (-> *launch-matrix* trans) (-> this root trans))
     (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 76))
     )
    (else
      (vector-copy! (-> *launch-matrix* trans) (-> this root trans))
      (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 76))
      )
    )
  (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock))
  (none)
  )

(defstate impact (darkjak-ball)
  :virtual #t
  :enter (behavior ()
    (sound-stop (-> self fire-sound))
    (dotimes (gp-0 (-> self bolts length))
      (lightning-bolt-method-13 (-> self bolts gp-0) 2)
      )
    (when (nonzero? (-> self ball1))
      (kill-particles (-> self ball1))
      (set! (-> self ball1) (the-as sparticle-launch-control 0))
      0
      )
    (when (nonzero? (-> self part))
      (kill-particles (-> self part))
      (set! (-> self part) (the-as sparticle-launch-control 0))
      0
      )
    (call-parent-state-handler enter)
    )
  :trans (behavior ()
    (dotimes (gp-0 (-> self bolts length))
      (lightning-bolt-method-11 (-> self bolts gp-0))
      (lightning-bolt-method-12 (-> self bolts gp-0))
      )
    )
  :code (behavior ()
    (set-time! (-> self state-time))
    (while (and (not (time-elapsed? (-> self state-time) (seconds 10))) (-> self child))
      (suspend)
      )
    (go-virtual die)
    )
  )

(if (or (zero? *darkjak-ball-lightning*) (!= loading-level global))
    (set! *darkjak-ball-lightning* (new 'loading-level 'lightning-appearance))
    )

(set! (-> *darkjak-ball-lightning* base-alpha) 1.0)

(set! (-> *darkjak-ball-lightning* tex-id) (the-as uint #x403f00))

(set! (-> *darkjak-ball-lightning* blend-mode) (the-as uint 1))

(set! (-> *darkjak-ball-lightning* alpha-1-curve) *curve-linear-down*)

(set! (-> *darkjak-ball-lightning* alpha-1-mode) (the-as uint 0))

(set! (-> *darkjak-ball-lightning* alpha-1-repeat-dist) 262144.0)

(set! (-> *darkjak-ball-lightning* alpha-2-curve) #f)

(set! (-> *darkjak-ball-lightning* alpha-2-mode) (the-as uint 3))

(set! (-> *darkjak-ball-lightning* alpha-2-repeat-dist) 4096.0)

(set! (-> *darkjak-ball-lightning* width-curve) *curve-linear-down*)

(set! (-> *darkjak-ball-lightning* width-mode) (the-as uint 3))

(set! (-> *darkjak-ball-lightning* width-repeat-dist) 4096.0)

(set! (-> *darkjak-ball-lightning* uv-repeat-dist) 28672.0)

(set! (-> *darkjak-ball-lightning* regenerate-time-start) (seconds 0.017))

(set! (-> *darkjak-ball-lightning* regenerate-time-end) (seconds 0.05))

(set! (-> *darkjak-ball-lightning* width-range-start) 12288.0)

(set! (-> *darkjak-ball-lightning* width-range-end) 12288.0)

(set! (-> *darkjak-ball-lightning* fade-time) (seconds 0.3))

(set! (-> *darkjak-ball-lightning* uv-shift?) #t)

(set! (-> *darkjak-ball-lightning* uv-shift-speed) (seconds -0.5))

(set! (-> *darkjak-ball-lightning* use-sprite-bucket?) #t)

(set! (-> *darkjak-ball-lightning* use-accurate-interp?) #t)

(defpartgroup group-darkjak-hadouken
  :id 172
  :flags (sp0 sp4)
  :bounds (static-bspherem 0 0 0 20)
  :parts ((sp-item 624 :flags (sp7) :period (seconds 20) :length (seconds 4))
    (sp-item 625 :flags (sp7) :period (seconds 20) :length (seconds 4))
    (sp-item 626 :flags (sp7) :period (seconds 20) :length (seconds 4))
    (sp-item 627 :flags (sp3 sp7))
    )
  )

(defpartgroup group-darkjak-hadouken-trail
  :id 173
  :flags (sp0 sp4)
  :bounds (static-bspherem 0 0 0 20)
  :parts ((sp-item 628 :flags (sp7)))
  )

(defpart 628
  :init-specs ((:texture (redpuff level-default-sprite))
    (:num 1.0)
    (:x (meters -1) (meters 2))
    (:scale-x (meters 1) (meters 1))
    (:scale-y :copy scale-x)
    (:r 0.0 64.0)
    (:g 0.0 64.0)
    (:b 255.0)
    (:a 32.0 32.0)
    (:vel-x (meters -0.0016666667) 2.0 (meters 0.0033333334))
    (:scalevel-y (meters -0.001) (meters -0.006666667))
    (:timer (seconds 4))
    (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-3))
    (:rotate-y (degrees 0))
    )
  )

(defmethod init-proj-settings! ((this darkjak-ball))
  (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 204 (seconds 0.1))
  (set! (-> this attack-mode) 'dark-smack)
  (set! (-> this max-speed) 163840.0)
  (set! (-> this move) darkjak-ball-move)
  (set! (-> this timeout) (seconds 4))
  (set! (-> this sound-id) (new-sound-id))
  (set! (-> this explode-sound) (the-as uint (new-sound-id)))
  (set! (-> this damage) 8.0)
  (set! (-> this vehicle-damage-factor) 2.0)
  (set! (-> this vehicle-impulse-factor) 3.0)
  (logior! (-> this options) (projectile-options po13))
  (set! (-> this part) (create-launch-control (-> *part-group-id-table* 172) this))
  (set! (-> this ball1) (create-launch-control (-> *part-group-id-table* 172) this))
  (set! (-> this trail) (create-launch-control (-> *part-group-id-table* 173) this))
  (set! (-> this impact?) #f)
  (set! (-> this max-hits) 1000)
  (vector-copy! (-> this fire-point) (-> this root trans))
  (set! (-> this bolts) (new 'process 'boxed-array lightning-bolt 3))
  (dotimes (s5-0 (-> this bolts length))
    (set! (-> this bolts s5-0) (new 'process 'lightning-bolt))
    (init! (-> this bolts s5-0) 2 16 *darkjak-ball-lightning*)
    )
  (set! (-> this fire-sound) (new-sound-id))
  (let ((a0-13 (-> this root transv)))
    (vector-copy! a0-13 (-> this root transv))
    (set! (-> a0-13 y) 0.0)
    (vector-normalize! a0-13 1.0)
    )
  (vector-float*! (-> this root transv) (-> this root transv) 245760.0)
  0
  (none)
  )

(define *darkjak-ball-lightning-colors* (new 'static 'boxed-array :type rgba
                                          (new 'static 'rgba :r #xff :g #x20 :b #x80 :a #x80)
                                          (new 'static 'rgba :r #x20 :g #x20 :b #xff :a #x80)
                                          (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
                                          )
        )

;; WARN: Return type mismatch symbol vs none.
(defmethod setup-bolts! ((this darkjak-ball) (arg0 vector) (arg1 vector))
  (dotimes (s3-0 (-> this bolts length))
    (let ((s2-0 (-> this bolts s3-0)))
      (set! (-> s2-0 base-color) (-> *darkjak-ball-lightning-colors* s3-0))
      (set! (-> s2-0 inner-point-travel-time) (seconds 0.085))
      (set! (-> s2-0 snap-inner-points?) #t)
      (set! (-> s2-0 fractal-reduction) 0.7)
      (set! (-> s2-0 generate-mode) (the-as uint 1))
      (set! (-> s2-0 appearance) *darkjak-ball-lightning*)
      (set! (-> s2-0 num-active-spans) 2)
      (set! (-> s2-0 spans data 0 random-offset-size-start) 2048.0)
      (set! (-> s2-0 spans data 1 random-offset-size-start) 2048.0)
      (set! (-> s2-0 spans-internal data 0 num-inner-points) 14)
      (set! (-> s2-0 spans data 0 inner-random-offset-size) 8192.0)
      (set! (-> s2-0 spans data 1 inner-random-offset-size) 8192.0)
      (if arg0
          (set! (-> s2-0 span-pts-start data 0 quad) (-> arg0 quad))
          )
      (if arg1
          (vector-copy! (-> s2-0 span-pts-start data 1) arg1)
          )
      (set! (-> s2-0 spans-internal data 1 num-inner-points) 0)
      (lightning-bolt-method-11 s2-0)
      (lightning-bolt-method-12 s2-0)
      )
    )
  (none)
  )

(defun sparticle-track-hadouken ((arg0 object) (arg1 sparticle-cpuinfo) (arg2 vector))
  (let ((a3-0 (the-as darkjak-ball (-> arg1 key proc)))
        (v1-1 (new 'stack-no-clear 'vector))
        )
    ;; og:preserve-this
    (vector-copy! v1-1 (-> a3-0 ball-pos (-> arg1 user-int32)))
    ;; (set! (-> v1-1 quad)
    ;;       (-> (the-as (pointer uint128) (+ (+ (* (-> arg1 user-float) 16) 556) (the-as int a3-0))))
    ;;       )
    (set! (-> arg2 x) (-> v1-1 x))
    (set! (-> arg2 y) (-> v1-1 y))
    (set! (-> arg2 z) (-> v1-1 z))
    )
  0
  (none)
  )

(defpart 624
  :init-specs ((:texture (colorflash level-default-sprite))
    (:num 2.0)
    (:scale-x (meters 1) (meters 0.5))
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 128.0)
    (:g 128.0)
    (:b 128.0)
    (:a 64.0 64.0)
    (:timer (seconds 0.035))
    (:flags (sp-cpuinfo-flag-3))
    (:userdata 0.0)
    (:func 'sparticle-track-hadouken)
    (:rotate-y (degrees 0))
    )
  )

(defpart 625
  :init-specs ((:texture (splash-foam level-default-sprite))
    (:num 1.0)
    (:scale-x (meters 1) (meters 0.5))
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 255.0)
    (:b 255.0)
    (:a 64.0 64.0)
    (:scalevel-x (meters 0.1) (meters 0.033333335))
    (:scalevel-y :copy scalevel-x)
    (:fade-r -5.12)
    (:fade-g -10.2)
    (:fade-a -2.56)
    (:timer (seconds 0.167))
    (:flags (sp-cpuinfo-flag-3))
    (:userdata 0.0)
    (:func 'sparticle-track-hadouken)
    (:rotate-y (degrees 0))
    )
  )

(defpart 626
  :init-specs ((:texture (water-radiate level-default-sprite))
    (:num 4.0)
    (:scale-x (meters 4))
    (:rot-x 4)
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y (meters 2) (meters 2))
    (:r 0.0 16.0)
    (:g 0.0)
    (:b 255.0)
    (:a 0.0)
    (:vel-y (meters -0.016666668))
    (:scalevel-x (meters -0.033333335) (meters 0.06666667))
    (:rotvel-z (degrees -0.2) (degrees 0.4))
    (:scalevel-y (meters -0.0033333334))
    (:timer (seconds 0.167) (seconds 0.165))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat))
    (:userdata 0.0)
    (:func 'sparticle-track-hadouken)
    (:next-time (seconds 0.017))
    (:next-launcher 629)
    (:conerot-x (degrees -180) (degrees 360))
    (:rotate-y (degrees 0) (degrees 3600))
    )
  )

(defpart 629
  :init-specs ((:a 255.0) (:fade-a -5.12))
  )

(defpart 627
  :init-specs ((:num 1.0)
    (:rot-x 8)
    (:r 32768.0)
    (:g 2048.0)
    (:b 8192.0)
    (:timer (seconds 4))
    (:flags (distort))
    (:userdata 0.0)
    (:func 'sparticle-track-hadouken)
    (:rotate-y (degrees 0))
    )
  )

(defmethod projectile-method-25 ((this darkjak-ball))
  (let* ((f0-0 0.75)
         (f1-0 65536.0)
         (f2-1 (* 0.0033333334 (the float (current-time))))
         (f0-2 (* f1-0 (/ (- f2-1 (* (the float (the int (/ f2-1 f0-0))) f0-0)) f0-0)))
         (s3-0 (vector-rotate-around-y! (new 'stack-no-clear 'vector) *x-vector* f0-2))
         (s5-0 (-> this ball-pos))
         (s4-0 (-> this ball-pos 1))
         )
    (vector-float*! s3-0 s3-0 (* 0.75 (-> this root root-prim local-sphere w)))
    (vector+! (-> s5-0 0) (-> this root trans) s3-0)
    (set! (-> *part-id-table* 625 init-specs 16 initial-valuef) 0.0)
    (set! (-> *part-id-table* 626 init-specs 16 initial-valuef) 0.0)
    (set! (-> *part-id-table* 627 init-specs 7 initial-valuef) 0.0)
    (set! (-> *part-id-table* 624 init-specs 11 initial-valuef) 0.0)
    (spawn (-> this part) (-> s5-0 0))
    (vector+float*! s4-0 (-> this root trans) s3-0 -1.0)
    (set! (-> *part-id-table* 625 init-specs 16 initial-valuef) (the-as float #x1))
    (set! (-> *part-id-table* 626 init-specs 16 initial-valuef) (the-as float #x1))
    (set! (-> *part-id-table* 627 init-specs 7 initial-valuef) (the-as float #x1))
    (set! (-> *part-id-table* 624 init-specs 11 initial-valuef) (the-as float #x1))
    (spawn (-> this ball1) s4-0)
    (let ((s3-1 (new 'stack-no-clear 'vector)))
      (vector-copy! s3-1 (-> this root trans))
      (let ((s2-0 matrix-f-u-compose)
            (s1-0 (new 'stack-no-clear 'matrix))
            (a0-21 (new 'stack-no-clear 'vector))
            )
        (vector-copy! a0-21 (-> this root transv))
        (set! (-> a0-21 y) 0.0)
        (let ((a1-10 (s2-0 s1-0 (vector-normalize! a0-21 1.0) *up-vector*)))
          (set! (-> s3-1 y) (-> this last-ground-height))
          (+! (-> s3-1 y) 1638.4)
          (vector-copy! (-> a1-10 trans) s3-1)
          (spawn-from-mat (-> this trail) a1-10)
          )
        )
      )
    (setup-bolts! this (-> s5-0 0) s4-0)
    )
  (none)
  )

(defbehavior target-darkjak-setup target ((arg0 symbol))
  (when (zero? (-> self darkjak))
    (set! (-> self darkjak) (new 'process 'darkjak-info))
    (set! (-> self darkjak process) (process->ppointer self))
    (let* ((v1-4 (-> self game))
           (a0-5 (+ (-> v1-4 attack-id) 1))
           )
      (set! (-> v1-4 attack-id) a0-5)
      (set! (-> self darkjak attack-id) a0-5)
      )
    (set! (-> self darkjak hud 0) (the-as handle #f))
    (set! (-> self darkjak charge-effect) (the-as handle #f))
    (set! (-> self darkjak tone) (new-sound-id))
    (set! (-> self darkjak-giant-interp) 1.0)
    (set! (-> self darkjak mode-sound-bank) #f)
    (set! (-> self darkjak latch-out-time) 0)
    0
    )
  0
  (none)
  )

(defbehavior want-to-darkjak? target ()
  (and (not *pause-lock*)
       (-> *setting-control* user-current darkjak)
       (logtest? (the-as game-feature (logand (game-feature darkjak) (-> *setting-control* user-current features)))
                 (-> self game features)
                 )
       (not (focus-test?
              self
              dead
              hit
              grabbed
              in-head
              under-water
              edge-grab
              pole
              flut
              tube
              light
              board
              pilot
              mech
              carry
              indax
              teleporting
              )
            )
       (not (and (logtest? (-> self water flags) (water-flag under-water))
                 (not (logtest? (-> self water flags) (water-flag swim-ground)))
                 )
            )
       (and (and (not (and (focus-test? self dark) (nonzero? (-> self darkjak))))
                 (and (time-elapsed? (-> self fact darkjak-start-time) (seconds 0.05)) (< 0.0 (-> self game eco-pill-dark)))
                 )
            (zero? (-> self darkjak latch-out-time))
            )
       )
  )

(let ((v1-56 (copy *walk-mods* 'global)))
  (set! (-> v1-56 name) 'darkjak)
  (set! (-> v1-56 flags) (surface-flag gun-off))
  (set! *darkjak-trans-mods* v1-56)
  )

(defbehavior target-darkjak-end-mode target ((arg0 symbol))
  (when (and (focus-test? self dark) (nonzero? (-> self darkjak)))
    (cond
      (arg0
        (set! (-> self lightjak get-off-lock) #f)
        (set! (-> self darkjak lightning-count) 0)
        (logclear! (-> self focus-status) (focus-status dark))
        (send-event self 'reset-collide)
        (logclear! (-> self target-flags) (target-flags tf4))
        (remove-setting! 'sound-flava)
        (remove-setting! 'string-min-length)
        (remove-setting! 'string-max-length)
        (remove-setting! 'string-spline-max-move)
        (remove-setting! 'string-spline-accel)
        (remove-setting! 'string-spline-max-move-player)
        (remove-setting! 'string-spline-accel-player)
        (setting-control-method-14 *setting-control* (-> self darkjak mode-sound-bank))
        (set! (-> self darkjak mode-sound-bank) #f)
        (sound-stop (-> self darkjak tone))
        (set! (-> self pending-ext-anim) (target-anim default))
        (if (< (-> self game eco-pill-dark) 1.0)
            (send-event self 'get-pickup (pickup-type eco-pill-dark) -1.0)
            )
        (target-invisible-stop)
        (let ((v1-45 (ja-group)))
          (when (not (and (and v1-45
                               (or (= v1-45 jakb-darkjak-get-off-ja)
                                   (= v1-45 jakb-darkjak-get-off-end-ja)
                                   (= v1-45 jakb-darkjak-get-on-fast-ja)
                                   (= v1-45 (-> self draw art-group data 461))
                                   )
                               )
                          (= (-> self skel root-channel 0) (-> self skel channel))
                          )
                     )
            (sound-play "djak-off")
            (countdown (v1-57 (+ (-> self skel active-channels) (-> self skel float-channels)))
              (let ((a0-36 (-> self skel channel v1-57)))
                (cond
                  ((= (-> a0-36 frame-group) (-> self draw art-group data 442))
                   (set! (-> a0-36 frame-group) (the-as art-joint-anim jakb-walk-ja))
                   )
                  ((= (-> a0-36 frame-group) (-> self draw art-group data 443))
                   (set! (-> a0-36 frame-group) (the-as art-joint-anim jakb-run-ja))
                   )
                  )
                )
              )
            (joint-control-cleanup
              (-> self skel)
              (-> self ext-anim-control heap)
              (the-as art-joint-anim jakb-stance-loop-ja)
              )
            (send-event (ppointer->process (-> self sidekick)) 'cleanup)
            )
          )
        (set! (-> self darkjak latch-out-time) 0)
        0
        )
      ((zero? (-> self darkjak latch-out-time))
       (if (!= (-> self darkjak-interp) 0.0)
           (set-time! (-> self darkjak latch-out-time))
           )
       )
      )
    )
  0
  (none)
  )

(defbehavior target-darkjak-process target ()
  (local-vars (a3-3 vector))
  (cond
    ((nonzero? (-> self darkjak latch-out-time))
     (if (time-elapsed? (-> self darkjak latch-out-time) (seconds 0.4))
         (target-darkjak-end-mode #t)
         )
     )
    ((and (focus-test? self dark) (nonzero? (-> self darkjak)))
     (let ((a1-0 'eco-red))
       (target-danger-set! (-> self control danger-mode) a1-0)
       )
     (update-transforms (-> self control))
     (let ((a1-1 (new 'stack-no-clear 'overlaps-others-params)))
       (set! (-> a1-1 options) (overlaps-others-options))
       (set! (-> a1-1 collide-with-filter) (the-as collide-spec -1))
       (set! (-> a1-1 tlist) *touching-list*)
       (find-overlapping-shapes (-> self control) a1-1)
       )
     (target-danger-set! (-> self control danger-mode) #f)
     (update-transforms (-> self control))
     (if (and (or (< (-> self game eco-pill-dark) 1.0)
                  (or (not (logtest? (the-as game-feature (logand (game-feature darkjak) (-> *setting-control* user-current features)))
                                     (-> self game features)
                                     )
                           )
                      (not (-> *setting-control* user-current darkjak))
                      )
                  )
              (not (focus-test? self dead dangerous hit grabbed))
              (not (and (-> self next-state) (let ((v1-37 (-> self next-state name)))
                                               (or (= v1-37 'target-darkjak-get-on) (= v1-37 'target-darkjak-get-off))
                                               )
                        )
                   )
              (or (not (logtest? (-> self darkjak stage) (darkjak-stage force-on endless-dark)))
                  (not (-> *setting-control* user-current darkjak))
                  (not (logtest? (the-as game-feature (logand (game-feature darkjak) (-> *setting-control* user-current features)))
                                 (-> self game features)
                                 )
                       )
                  )
              )
         (go target-darkjak-get-off)
         )
     )
    (else
      (seek! (-> self darkjak-interp) 0.0 (* 2.0 (seconds-per-frame)))
      (if (= (-> self darkjak-interp) 0.0)
          (set! (-> self darkjak-giant-interp) 1.0)
          )
      )
    )
  (seekl! (-> self darkjak lightning-count) 0 1)
  (let ((f30-0 (-> self darkjak-interp)))
    (let ((f28-0 (lerp-scale 1.0 (* 1.05 (-> self darkjak-giant-interp)) f30-0 0.0 1.0))
          (f26-0 (lerp-scale 1.0 (* 0.20000002 (+ 5.0 (-> self darkjak-giant-interp))) f30-0 0.0 1.0))
          )
      (set-vector! (-> self control scale) f28-0 f28-0 f28-0 1.0)
      (let ((a3-2 (new 'stack-no-clear 'vector)))
        (set! (-> a3-2 x) f26-0)
        (set! (-> a3-2 y) 1.0)
        (set! (-> a3-2 z) f26-0)
        (set! (-> a3-2 w) 1.0)
        (trs-set! (-> self upper-body) (the-as vector #f) (the-as quaternion #f) a3-2)
        )
      (let ((f0-15 (* 1.1 f26-0)))
        (cond
          ((= (-> self ext-geo) (target-geo jakb))
           (set! a3-3 (new 'stack-no-clear 'vector))
           (set! (-> a3-3 x) (/ f28-0 (* f28-0 f0-15)))
           (set! (-> a3-3 y) (/ f28-0 f28-0))
           (set! (-> a3-3 z) (/ f28-0 (* f28-0 f0-15)))
           (set! (-> a3-3 w) 1.0)
           )
          (else
            (set! a3-3 (new 'stack-no-clear 'vector))
            (set! (-> a3-3 x) (* 0.95 (/ f28-0 (* f28-0 f0-15))))
            (set! (-> a3-3 y) (* 0.92 (/ f28-0 f28-0)))
            (set! (-> a3-3 z) (* 0.95 (/ f28-0 (* f28-0 f0-15))))
            (set! (-> a3-3 w) 1.0)
            )
          )
        )
      )
    (cond
      ((logtest? (game-secrets little-head) (-> self game secrets))
       (dotimes (v1-73 3)
         (set! (-> a3-3 data v1-73) (* 0.4 (-> a3-3 data v1-73)))
         )
       )
      ((logtest? (game-secrets big-head) (-> self game secrets))
       (dotimes (v1-79 3)
         (set! (-> a3-3 data v1-79) (* 2.0 (-> a3-3 data v1-79)))
         )
       )
      )
    (trs-set! (-> self neck) (the-as vector #f) (the-as quaternion #f) a3-3)
    (let* ((a0-42 (-> self horns))
           (t9-13 (method-of-object a0-42 trs-set!))
           (a1-14 #f)
           (a2-6 #f)
           (a3-4 (new 'stack-no-clear 'vector))
           )
      (set! (-> a3-4 x) f30-0)
      (set! (-> a3-4 y) f30-0)
      (set! (-> a3-4 z) f30-0)
      (set! (-> a3-4 w) 1.0)
      (t9-13 a0-42 (the-as vector a1-14) (the-as quaternion a2-6) a3-4)
      )
    (when (and (>= f30-0 0.5) (and (not (focus-test? self in-head))
                                   (not (logtest? (-> self draw status) (draw-control-status no-draw no-draw-temp)))
                                   (not (movie?))
                                   )
               )
      (if (= (-> self invisible-interp) 0.0)
          (launch-particles
            (-> *part-id-table* 173)
            (process-drawable-random-point! self (new 'stack-no-clear 'vector))
            )
          )
      (cond
        ((!= (-> self invisible-interp) 0.0)
         )
        ((rand-vu-percent? 0.25)
         (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.02))
           (set! (-> self shock-effect-time) (-> *display* game-clock frame-counter))
           (process-drawable-shock-wall-effect
             self
             (-> *lightning-spec-id-table* 9)
             lightning-probe-callback
             (-> *part-id-table* 187)
             )
           )
         )
        ((rand-vu-percent? 0.1)
         (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.02))
           (set! (-> self shock-effect-time) (-> *display* game-clock frame-counter))
           (process-drawable-shock-effect
             self
             (-> *lightning-spec-id-table* 7)
             lightning-probe-callback
             (-> *part-id-table* 187)
             0
             0
             40960.0
             )
           )
         )
        )
      )
    (set-darkjak-texture-morph! (if (logtest? (-> self target-effect) (target-effect te6))
                                    1.0
                                    f30-0
                                    )
                                )
    )
  0
  (none)
  )

(defstate target-darkjak-get-on (target)
  :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
    (case message
      (('darkjak)
       (when (zero? (-> self darkjak want-stage))
         (set! (-> self darkjak want-stage) (the-as darkjak-stage (-> block param 0)))
         #t
         )
       )
      (('touched)
       (if ((method-of-type touching-shapes-entry prims-touching?)
            (the-as touching-shapes-entry (-> block param 0))
            (-> self control)
            (the-as uint 1920)
            )
           (target-send-attack
             proc
             (-> self control danger-mode)
             (the-as touching-shapes-entry (-> block param 0))
             (the-as int (-> self control target-attack-id))
             (the-as int (-> self control attack-count))
             (-> self control penetrate-using)
             )
           (target-generic-event-handler proc argc message block)
           )
       )
      (('attack-invinc)
       (target-attacked
         message
         (the-as attack-info (-> block param 1))
         proc
         (the-as touching-shapes-entry (-> block param 0))
         target-hit
         )
       )
      (else
        (target-generic-event-handler proc argc message block)
        )
      )
    )
  :exit (behavior ()
    (logclear! (-> self target-flags) (target-flags lleg-still rleg-still))
    (set! (-> self darkjak-interp) 1.0)
    (remove-setting! 'bg-r)
    (remove-setting! 'bg-g)
    (remove-setting! 'bg-b)
    (remove-setting! 'bg-a)
    (persist-with-delay *setting-control* 'bg-a-speed (seconds 3) 'bg-a-speed 'abs 0.5 0)
    (target-danger-set! 'harmless #f)
    (remove-setting! 'gun)
    (persist-with-delay *setting-control* 'gun (seconds 0.5) 'gun #f 0.0 0)
    (apply-settings *setting-control*)
    (target-gun-end-mode #t)
    )
  :code (behavior ((arg0 darkjak-stage))
    (send-event (handle->process (-> self notify)) 'notify 'attack 19)
    (set-setting! 'gun #f 0.0 0)
    (apply-settings *setting-control*)
    (target-lightjak-end-mode #t)
    (set! (-> self darkjak latch-out-time) 0)
    (set! (-> self lightjak get-off-lock) #f)
    (set! (-> self darkjak stage) (logior arg0 (darkjak-stage active)))
    (if (logtest? (game-feature darkjak-bomb0) (-> self game features))
        (logior! (-> self darkjak stage) (darkjak-stage bomb0))
        )
    (if (logtest? (game-feature darkjak-bomb1) (-> self game features))
        (logior! (-> self darkjak stage) (darkjak-stage bomb1))
        )
    (if (logtest? (game-feature darkjak-invinc) (-> self game features))
        (logior! (-> self darkjak stage) (darkjak-stage invinc))
        )
    (if (logtest? (game-feature darkjak-tracking) (-> self game features))
        (logior! (-> self darkjak stage) (darkjak-stage tracking))
        )
    (if (logtest? (game-feature darkjak-smack) (-> self game features))
        (logior! (-> self darkjak stage) (darkjak-stage smack))
        )
    (set! (-> self darkjak want-stage) (-> self darkjak stage))
    (set! (-> self neck flex-blend) 0.0)
    (set! (-> self control mod-surface) *darkjak-trans-mods*)
    (set-time! (-> self darkjak start-time))
    (set! (-> self darkjak attack-count) (the-as uint 0))
    (set! (-> self darkjak-giant-interp) 1.0)
    (logior! (-> self focus-status) (focus-status dark))
    (set! (-> self pending-ext-anim) (target-anim dark))
    (set-time! (-> self fact darkjak-start-time))
    (set! (-> self fact darkjak-effect-time) (seconds 20))
    (set! (-> self darkjak mode-sound-bank) (add-setting! 'mode-sound-bank 'modedark 0.0 0))
    (set! (-> self darkjak lightning-count) 0)
    (cond
      ((logtest? (-> self darkjak stage) (darkjak-stage invis))
       (logclear! (-> self target-flags) (target-flags tf4))
       (logclear! (-> self darkjak stage) (darkjak-stage smack bomb0 bomb1 tracking invinc))
       (target-invisible-start (-> *TARGET-bank* invisible-duration))
       (set! (-> self fact darkjak-effect-time) (-> *TARGET-bank* invisible-duration))
       )
      ((logtest? (-> self darkjak stage) (darkjak-stage invinc))
       (logior! (-> self target-flags) (target-flags tf4))
       )
      (else
        (logclear! (-> self target-flags) (target-flags tf4))
        )
      )
    (if (logtest? arg0 (darkjak-stage no-anim))
        (go target-stance)
        )
    (target-start-attack)
    (target-danger-set! 'get-on #f)
    (set-setting! 'bg-r 'abs 0.1 0)
    (set-setting! 'bg-b 'abs 0.1 0)
    (set-forward-vel 0.0)
    (let ((gp-1 0))
      (while (not (logtest? (-> self control status) (collide-status on-surface)))
        (target-falling-anim-trans)
        (+! gp-1 (- (current-time) (-> self clock old-frame-counter)))
        (if (>= gp-1 300)
            (go target-falling #f)
            )
        (suspend)
        )
      )
    (sound-play "djak-transform")
    (ja-channel-push! 1 (seconds 0.1))
    (ja-no-eval :group! jakb-darkjak-get-on-fast-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (set! (-> self darkjak-interp) (lerp-scale 0.0 1.0 (ja-aframe-num 0) 5.0 15.0))
      (set-setting! 'bg-a 'abs (* 0.45 (-> self darkjak-interp)) 0)
      (suspend)
      (ja :num! (seek!))
      )
    (while (!= (-> self ext-anim) (target-anim dark))
      (let ((v1-135 (ja-group)))
        (when (not (and v1-135 (= v1-135 jakb-darkjak-get-on-fast-loop-ja)))
          (ja-channel-push! 1 (seconds 0.05))
          (ja :group! jakb-darkjak-get-on-fast-loop-ja :num! min)
          )
        )
      (suspend)
      (ja :num! (loop!))
      )
    (go target-stance)
    )
  :post (-> target-grab post)
  )

(defstate target-darkjak-get-off (target)
  :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
    (case message
      (('pole-grab 'darkjak 'lightjak 'slide 'wade 'launch 'edge-grab)
       #f
       )
      (('change-mode)
       (case (-> block param 0)
         (('grab)
          (when (not (focus-test? self dead))
            (if (not (-> block param 1))
                #t
                (go target-grab 'stance)
                )
            )
          )
         )
       )
      (('attack-invinc)
       (target-attacked
         message
         (the-as attack-info (-> block param 1))
         proc
         (the-as touching-shapes-entry (-> block param 0))
         target-hit
         )
       )
      (else
        (target-generic-event-handler proc argc message block)
        )
      )
    )
  :enter (behavior ()
    (logior! (-> self target-flags) (target-flags lleg-still rleg-still))
    (set! (-> self neck flex-blend) 0.0)
    (set! (-> self control mod-surface) *darkjak-trans-mods*)
    (kill-persister *setting-control* (the-as engine-pers 'bg-a-speed) 'bg-a-speed)
    )
  :exit (behavior ()
    (logclear! (-> self target-flags) (target-flags lleg-still rleg-still))
    (target-darkjak-end-mode #t)
    )
  :trans (-> target-darkjak-get-on trans)
  :code (behavior ()
    (let ((v1-1 (-> self water flags)))
      (cond
        ((and (logtest? (water-flag touch-water) v1-1)
              (logtest? (water-flag under-water swimming) v1-1)
              (not (logtest? (focus-status mech) (-> self focus-status)))
              )
         (go target-swim-stance)
         )
        ((let ((v1-10 (ja-group)))
           (not (and v1-10 (= v1-10 jakb-darkjak-get-on-fast-ja)))
           )
         (let ((gp-0 0))
           (while (not (logtest? (-> self control status) (collide-status on-surface)))
             (target-falling-anim-trans)
             (+! gp-0 (- (current-time) (-> self clock old-frame-counter)))
             (if (>= gp-0 300)
                 (go target-falling #f)
                 )
             (suspend)
             )
           )
         )
        )
      )
    (cond
      ((logtest? (-> self control status) (collide-status on-water))
       )
      (else
        (let ((v1-30 (ja-group)))
          (cond
            ((and v1-30 (= v1-30 jakb-darkjak-get-on-fast-ja))
             (ja-no-eval :num! (seek! 0.0))
             (while (not (ja-done? 0))
               (seek! (-> self darkjak-interp) 0.0 (* 2.0 (seconds-per-frame)))
               (suspend)
               (ja-eval)
               )
             (ja-channel-push! 1 (seconds 0.1))
             )
            ((let ((v1-43 (ja-group)))
               (and v1-43 (or (= v1-43 (-> self draw art-group data 451))
                              (= v1-43 (-> self draw art-group data 466))
                              (= v1-43 (-> self draw art-group data 467))
                              (= v1-43 (-> self draw art-group data 468))
                              )
                    )
               )
             (sound-play "djak-off")
             (ja-no-eval :group! (-> self draw art-group data 461) :num! (seek!) :frame-num 0.0)
             (until (ja-done? 0)
               (set! (-> self darkjak-interp) (lerp-scale 1.0 0.0 (ja-aframe-num 0) 90.0 115.0))
               (suspend)
               (ja :num! (seek!))
               )
             )
            ((let ((v1-74 (ja-group)))
               (and v1-74 (= v1-74 (-> self draw art-group data 461)))
               )
             (sound-play "djak-off")
             (ja-no-eval :num! (seek!))
             (while (not (ja-done? 0))
               (set! (-> self darkjak-interp) (lerp-scale 1.0 0.0 (ja-aframe-num 0) 90.0 115.0))
               (suspend)
               (ja-eval)
               )
             )
            (else
              (sound-play "djak-off")
              (ja-channel-push! 1 (seconds 0.05))
              (ja-no-eval :group! jakb-darkjak-get-off-ja :num! (seek!) :frame-num 0.0)
              (until (ja-done? 0)
                (set! (-> self darkjak-interp) (lerp-scale 1.0 0.0 (ja-aframe-num 0) 10.0 60.0))
                (if (and (>= (ja-aframe-num 0) 24.0) (!= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0))
                    (goto cfg-79)
                    )
                (suspend)
                (ja :num! (seek!))
                )
              (ja-no-eval :group! jakb-darkjak-get-off-end-ja :num! (seek!) :frame-num 0.0)
              (until (ja-done? 0)
                (set! (-> self darkjak-interp) (lerp-scale 1.0 0.0 (ja-aframe-num 0) 10.0 60.0))
                (if (and (>= (ja-aframe-num 0) 24.0) (!= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0))
                    (goto cfg-79)
                    )
                (suspend)
                (ja :num! (seek!))
                )
              )
            )
          )
        )
      )
    (label cfg-79)
    (vector-reset! (-> self control transv))
    ((-> target-darkjak-get-off exit))
    (go target-stance)
    )
  :post (-> target-grab post)
  )

(defstate target-darkjak-running-attack (target)
  :event (-> target-running-attack event)
  :enter (-> target-running-attack enter)
  :exit (behavior ()
    (remove-setting! 'rapid-tracking)
    ((-> target-running-attack exit))
    )
  :trans (-> target-running-attack trans)
  :code (behavior ()
    (local-vars
      (sv-16 float)
      (sv-20 float)
      (sv-24 int)
      (sv-32 int)
      (sv-40 int)
      (sv-48 float)
      (sv-56 handle)
      (sv-64 int)
      )
    (set-setting! 'rapid-tracking #f 0.0 0)
    ((lambda :behavior target
       ()
       (set! (-> self control bend-target) (/ (-> self control bend-target) 2))
       (if (logtest? (water-flag touch-water) (-> self water flags))
           (sound-play "swim-stroke")
           )
       (set! (-> self control dynam gravity-max) 368640.0)
       (set! (-> self control dynam gravity-length) 368640.0)
       (let ((gp-1 (cond
                     ((zero? (-> self control unknown-word000))
                      (set! (-> self control unknown-word000) 1)
                      (-> self draw art-group data 452)
                      )
                     (else
                       (set! (-> self control unknown-word000) 0)
                       (-> self draw art-group data 459)
                       )
                     )
                   )
             )
         (ja-channel-push! 1 (seconds 0.02))
         (ja-no-eval :group! gp-1 :num! (seek!))
         )
       (target-start-attack)
       (target-danger-set! 'punch #f)
       (if (not (logtest? (-> self darkjak stage) (darkjak-stage force-on endless-dark)))
           (send-event self 'get-pickup (pickup-type eco-pill-dark) (- (-> *FACT-bank* darkjak-punch-inc)))
           )
       (let ((a0-11 (-> self control impact-ctrl))
             (t9-7 (method-of-type impact-control initialize))
             (a1-5 self)
             (v1-44 (ja-group))
             )
         (t9-7
           a0-11
           a1-5
           (if (and v1-44 (= v1-44 (-> self draw art-group data 452)))
               28
               19
               )
           3276.8
           (-> self control root-prim prim-core collide-with)
           )
         )
       )
     )
    (set! sv-16 (the-as float 0.0))
    (set! sv-20 (the-as float 1.0))
    (set! sv-24 0)
    (set! sv-32 0)
    (set! sv-40 0)
    (set! sv-48 (the-as float 1.0))
    (set! sv-56 (the-as handle #f))
    (set! sv-64 0)
    (until (ja-done? 0)
      (if (and (cpad-pressed? (-> self control cpad number) square)
               (not (logtest? (-> self target-flags) (target-flags prevent-jump prevent-attack)))
               (not (logtest? (-> self control current-surface flags) (surface-flag no-attack)))
               (and (focus-test? self dark)
                    (nonzero? (-> self darkjak))
                    (logtest? (-> self darkjak stage) (darkjak-stage active))
                    )
               (< sv-32 2)
               )
          (set! sv-40 (the-as int (current-time)))
          )
      (when (time-elapsed? (the-as time-frame sv-40) (seconds 0.5))
        (set! sv-40 0)
        0
        )
      (if (and (nonzero? sv-40)
               (< (- (the float (+ (-> (ja-group) frames num-frames) -1)) (/ 2.0 (-> (ja-group) artist-step)))
                  (ja-frame-num 0)
                  )
               )
          ((lambda :behavior target
             ((arg0 (pointer float)) (arg1 (pointer int64)) (arg2 (pointer int64)))
             (let ((s3-0 (if (and (focus-test? self dark)
                                  (nonzero? (-> self darkjak))
                                  (logtest? (-> self darkjak stage) (darkjak-stage tracking))
                                  )
                             (combo-tracker-method-13
                               (-> self control unknown-combo-tracker00)
                               (-> self control send-attack-dest)
                               (-> self control trans)
                               24576.0
                               (-> self control c-R-w fvec)
                               65536.0
                               )
                             )
                         )
                   )
               (when #t
                 (+! (-> arg1 0) 1)
                 (if s3-0
                     (combo-tracker-method-12
                       (-> self control unknown-combo-tracker00)
                       (-> self control trans)
                       (get-trans s3-0 3)
                       s3-0
                       (current-time)
                       )
                     )
                 (target-start-attack)
                 (target-danger-set! 'punch #f)
                 (if (not (logtest? (-> self darkjak stage) (darkjak-stage force-on endless-dark)))
                     (send-event self 'get-pickup (pickup-type eco-pill-dark) (- (-> *FACT-bank* darkjak-punch-inc)))
                     )
                 (let ((v1-34 (ja-group)))
                   (cond
                     ((and v1-34 (or (= v1-34 (-> self draw art-group data 452)) (= v1-34 (-> self draw art-group data 459))))
                      (ja-channel-push! 1 (seconds 0.1))
                      (ja-no-eval :group! (-> self draw art-group data 454) :num! (seek!))
                      )
                     (else
                       (ja-channel-push! 1 (seconds 0.1))
                       (ja-no-eval :group! (-> self draw art-group data 463) :num! (seek!))
                       )
                     )
                   )
                 (initialize (-> self control impact-ctrl) self 28 3276.8 (-> self control root-prim prim-core collide-with))
                 (set! (-> arg0 0) (fmax 0.0 (-> arg0 0)))
                 )
               )
             (set! (-> arg2 0) 0)
             0
             )
           (& sv-16)
           (the-as (pointer int64) (& sv-32))
           (the-as (pointer int64) (& sv-40))
           )
          )
      (compute-delta-align! (-> self align))
      (when (not (ja-min? 0))
        (cond
          ((and (>= (ja-frame-num 0) 20.0)
                (and (and (not (logtest? (-> self control status) (collide-status on-surface)))
                          (time-elapsed? (-> self control last-time-on-surface) (-> *TARGET-bank* ground-timeout))
                          (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))
                          (>= (target-height-above-ground) (-> *TARGET-bank* fall-height))
                          )
                     (time-elapsed? (-> self control sliding-start-time) (seconds 0.04))
                     )
                )
           (go target-falling #f)
           )
          ((and (nonzero? sv-32)
                (>= sv-16 -40960.0)
                (let ((v1-83 (ja-group)))
                  (not (and (and v1-83 (= v1-83 jakb-darkjak-attack-combo3-ja)) (>= (ja-aframe-num 0) 77.0)))
                  )
                (send-event (handle->process (-> self control unknown-combo-tracker00 target)) 'combo)
                )
           (let ((gp-0 (as-type (handle->process (-> self control unknown-combo-tracker00 target)) process-focusable)))
             (let ((s5-1 (get-trans (the-as process-focusable gp-0) 3)))
               (when (and (< 2048.0 (vector-vector-distance (-> self control trans) s5-1))
                          (or (and (= gp-0 (handle->process sv-56)) (not (time-elapsed? (the-as time-frame sv-64) (seconds 0.1))))
                              (time-elapsed? (the-as time-frame sv-64) (seconds 1))
                              )
                          )
                 (forward-up-nopitch->quaternion
                   (-> self control dir-targ)
                   (vector-! (new 'stack-no-clear 'vector) s5-1 (-> self control trans))
                   (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control quat))
                   )
                 (let ((v1-124
                         (point-tracker-method-11
                           (-> self control unknown-combo-tracker00)
                           (new 'stack-no-clear 'vector)
                           (-> self control trans)
                           s5-1
                           (* 0.009107469 (the float (- (current-time) (-> self control unknown-combo-tracker00 move-start-time))))
                           )
                         )
                       )
                   (set! sv-16 (fmin 163840.0 (sqrtf (+ (* (-> v1-124 x) (-> v1-124 x)) (* (-> v1-124 z) (-> v1-124 z))))))
                   )
                 (set-forward-vel sv-16)
                 )
               )
             (when (!= gp-0 (handle->process sv-56))
               (set! sv-56 (process->handle gp-0))
               (set! sv-64 (the-as int (current-time)))
               )
             )
           )
          ((< sv-16 0.0)
           (set! sv-16 (seek sv-16 -0.04096 (* 491520.0 (seconds-per-frame))))
           (set-forward-vel sv-16)
           )
          ((and (nonzero? (-> self control unknown-time-frame18))
                (time-elapsed? (-> self control unknown-time-frame18) (seconds 0.04))
                )
           (set-forward-vel 0.0)
           )
          ((and (not (cpad-hold? (-> self control cpad number) square))
                (zero? sv-32)
                (time-elapsed? (-> self control unknown-combo-tracker00 move-start-time) (seconds 0.2))
                )
           (if (= (-> self control ground-pat material) (pat-material ice))
               (set-forward-vel (fmax 32768.0 (* 0.8 (-> self control ctrl-xz-vel))))
               (set-forward-vel (* 0.8 (-> self control ctrl-xz-vel)))
               )
           )
          ((ja-done? 0)
           (set-forward-vel sv-16)
           )
          (else
            (set! sv-16
                  (* (target-align-vel-z-adjust (-> self align delta trans z)) (-> self clock frames-per-second) sv-20)
                  )
            (set-forward-vel sv-16)
            )
          )
        )
      (let ((gp-1 (new-stack-vector0)))
        (vector-matrix*! gp-1 (-> self control transv) (-> self control w-R-c))
        (set! (-> gp-1 y) 0.0)
        (vector-matrix*! (-> self control align-xz-vel) gp-1 (-> self control c-R-w))
        )
      (when (!= (the-as float (-> self control unknown-word04)) 0.0)
        (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock))
        (set! sv-16 (the-as float (-> self control unknown-word04)))
        (set! (-> self control unknown-word04) (the-as uint 0.0))
        )
      (when (and (>= sv-16 0.0)
                 (let ((gp-2 (ja-group))
                       (f30-2 (ja-aframe-num 0))
                       )
                   (if (or (and (= gp-2 (-> self draw art-group data 452))
                                (>= f30-2 11.0)
                                (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 452)) frames num-frames) -1))
                                    (ja-frame-num 0)
                                    )
                                )
                           (and (= gp-2 (-> self draw art-group data 459))
                                (>= f30-2 11.0)
                                (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 459)) frames num-frames) -1))
                                    (ja-frame-num 0)
                                    )
                                )
                           (and (= gp-2 (-> self draw art-group data 454))
                                (>= f30-2 49.0)
                                (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 454)) frames num-frames) -1))
                                    (ja-frame-num 0)
                                    )
                                )
                           (and (= gp-2 jakb-darkjak-attack-combo3-ja)
                                (or (and (>= f30-2 62.0) (>= 77.0 f30-2))
                                    (and (>= f30-2 82.0)
                                         (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3-ja) frames num-frames) -1))
                                             (ja-frame-num 0)
                                             )
                                         )
                                    )
                                )
                           (and (= gp-2 (-> self draw art-group data 463))
                                (>= f30-2 62.0)
                                (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 463)) frames num-frames) -1))
                                    (ja-frame-num 0)
                                    )
                                )
                           )
                       #t
                       )
                   )
                 )
        (let ((gp-3 (new 'stack-no-clear 'collide-query)))
          (when (and (>= (impact-control-method-11
                           (-> self control impact-ctrl)
                           gp-3
                           (the-as process #f)
                           (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
                           )
                         0.0
                         )
                     (>= 0.0 (vector-dot (-> gp-3 best-other-tri normal) (-> self control impact-ctrl dir)))
                     )
            (when (= (-> gp-3 best-other-tri pat mode) (pat-mode wall))
              (cond
                ((logtest? (-> *part-group-id-table* 12 flags) (sp-group-flag sp13))
                 (vector-copy! (-> *launch-matrix* trans) (-> gp-3 best-other-tri intersect))
                 (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 12))
                 )
                (else
                  (vector-copy! (-> *launch-matrix* trans) (-> gp-3 best-other-tri intersect))
                  (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 12))
                  )
                )
              (let ((name (static-sound-name "djak-punch-hit")))
                (play-effect-sound
                  (-> self skel effect)
                  (the-as symbol "punch")
                  -1.0
                  (-> self control impact-ctrl joint)
                  (the-as basic #f)
                  (the-as sound-name name)
                  )
                )
              (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock))
              (set! sv-16 (the-as float -61440.0))
              )
            )
          )
        )
      (let ((gp-6 (ja-group))
            (f0-59 (ja-aframe-num 0))
            )
        (if (and (= gp-6 jakb-darkjak-attack-combo3-ja)
                 (>= f0-59 80.0)
                 (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3-ja) frames num-frames) -1))
                     (ja-frame-num 0)
                     )
                 )
            (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.6 1.0)
            )
        )
      (suspend)
      (ja :num! (seek! max (* (-> self control current-surface align-speed) sv-48)))
      (if (time-elapsed? (-> self state-time) (seconds 0.1))
          (set! (-> *run-attack-mods* turnvv) 0.0)
          )
      (if (< 2 sv-24)
          (set! sv-20 (* sv-20 (fmin 1.0 (-> self control zx-vel-frac))))
          )
      (set! sv-24 (+ sv-24 1))
      )
    (if (and (not (logtest? (-> self control status) (collide-status on-surface)))
             (time-elapsed? (-> self control last-time-on-surface) (-> *TARGET-bank* ground-timeout))
             (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))
             (>= (target-height-above-ground) (-> *TARGET-bank* fall-height))
             )
        (go target-falling #f)
        )
    (go target-stance)
    )
  :post target-post
  )

(defstate target-darkjak-smack-charge (target)
  :event target-standard-event-handler
  :enter (-> (the-as (state target) target-duck-stance) enter)
  :exit (behavior ()
    (remove-setting! 'bg-r)
    (remove-setting! 'bg-g)
    (remove-setting! 'bg-b)
    (remove-setting! 'bg-a)
    (update-rates! (-> *display* entity-clock) 1.0)
    (persist-with-delay *setting-control* 'bg-a-speed (seconds 3) 'bg-a-speed 'abs 0.5 0)
    (let ((gp-0 (handle->process (-> self darkjak charge-effect))))
      (when gp-0
        (let ((v1-18 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
          (set! (-> v1-18 command) (sound-command set-param))
          (set! (-> v1-18 id) (-> self control unknown-sound-id00))
          (set! (-> v1-18 params volume) -4)
          (set! (-> v1-18 auto-time) 120)
          (set! (-> v1-18 auto-from) 2)
          (set! (-> v1-18 params mask) (the-as uint 17))
          (-> v1-18 id)
          )
        (deactivate gp-0)
        )
      )
    ((-> target-duck-stance exit))
    )
  :trans (behavior ()
    ((-> self state-hook))
    (if (and (not (cpad-hold? (-> self control cpad number) r1))
             (and (focus-test? self dark) (nonzero? (-> self darkjak)))
             (= (-> self ext-anim) (target-anim dark))
             (zero? (-> self darkjak latch-out-time))
             (logtest? (the-as game-feature (logand (game-feature darkjak-smack) (-> *setting-control* user-current features)))
                       (-> self game features)
                       )
             (can-hands? #t)
             )
        (go target-darkjak-smack)
        )
    (if (or (or (not (cpad-hold? (-> self control cpad number) r1))
                (logtest? (-> self target-flags) (target-flags prevent-attack prevent-duck))
                )
            (!= (-> self ext-anim) 2)
            )
        (go target-stance)
        )
    (if (want-to-powerjak?)
        (go target-powerjak-get-on)
        )
    (fall-test target-falling (-> *TARGET-bank* fall-height))
    (slide-down-test)
    )
  :code (behavior ()
    (let ((v1-2 (ja-group)))
      (cond
        ((and (and v1-2 (= v1-2 (-> self draw art-group data 478)))
              (= (-> self skel root-channel 0) (-> self skel channel))
              )
         )
        ((and (and (focus-test? self dark) (nonzero? (-> self darkjak))) (= (-> self ext-anim) (target-anim dark)))
         (ja-channel-push! 1 (seconds 0.2))
         )
        (else
          (go target-stance)
          )
        )
      )
    (until #f
      (set-setting! 'bg-r 'abs 0.1 0)
      (set-setting! 'bg-b 'abs 0.1 0)
      (set-setting! 'bg-a 'abs 0.45 0)
      (update-rates! (-> *display* entity-clock) 0.4)
      (ja-no-eval :group! (-> self draw art-group data 478) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (let ((v1-46 (and (= (-> self skel root-channel 0) (-> self skel channel))
                          (not (handle->process (-> self darkjak charge-effect)))
                          )
                     )
              )
          (when v1-46
            (set! (-> self control unknown-sound-id00) (sound-play "djak-bolt-charg"))
            (set! (-> self darkjak charge-effect)
                  (ppointer->handle (if (logtest? (-> *part-group-id-table* 75 flags) (sp-group-flag sp13))
                                        (part-tracker-spawn
                                          part-tracker-subsampler
                                          :to self
                                          :group (-> *part-group-id-table* 75)
                                          :duration -1
                                          :target self
                                          :mat-joint 59
                                          )
                                        (part-tracker-spawn
                                          part-tracker
                                          :to self
                                          :group (-> *part-group-id-table* 75)
                                          :duration -1
                                          :target self
                                          :mat-joint 59
                                          )
                                        )
                                    )
                  )
            )
          )
        (suspend)
        (ja :num! (seek!))
        )
      )
    #f
    )
  :post target-post
  )

(defstate target-darkjak-smack (target)
  :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
    ((-> target-running-attack event) proc argc message block)
    )
  :enter (behavior ()
    ((-> target-running-attack enter))
    (set-setting! 'gun #f 0.0 0)
    (apply-settings *setting-control*)
    )
  :exit (behavior ()
    (update-rates! (-> *display* entity-clock) 1.0)
    (update-rates! (-> *display* bg-clock) 1.0)
    (update-rates! (-> *display* part-clock) 1.0)
    (remove-setting! 'gun)
    ((-> target-darkjak-running-attack exit))
    )
  :trans (-> target-running-attack trans)
  :code (behavior ()
    (target-start-attack)
    (target-danger-set! 'dark-smack #f)
    (if (not (logtest? (-> self darkjak stage) (darkjak-stage force-on endless-dark)))
        (send-event self 'get-pickup (pickup-type eco-pill-dark) (- (-> *FACT-bank* darkjak-smack-inc)))
        )
    (set! (-> self control lightjak-sound-id) (sound-play "djak-pnch-swing"))
    (set! (-> self control dynam gravity-max) 368640.0)
    (set! (-> self control dynam gravity-length) 368640.0)
    (let ((gp-1 (-> self draw art-group data 476)))
      (ja-channel-push! 1 (seconds 0.02))
      (ja-no-eval :group! gp-1 :num! (seek!))
      )
    (initialize (-> self control impact-ctrl) self 28 3276.8 (-> self control root-prim prim-core collide-with))
    (let ((f28-0 (the-as number 0.0)))
      0.8
      (let ((gp-2 0)
            (f30-0 1.0)
            (s5-1 #f)
            (f26-0 0.6)
            )
        (until (ja-done? 0)
          (when (not (ja-min? 0))
            (cond
              ((and (>= (ja-aframe-num 0) 20.0)
                    (and (and (not (logtest? (-> self control status) (collide-status on-surface)))
                              (time-elapsed? (-> self control last-time-on-surface) (-> *TARGET-bank* ground-timeout))
                              (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))
                              (>= (target-height-above-ground) (-> *TARGET-bank* fall-height))
                              )
                         (time-elapsed? (-> self control sliding-start-time) (seconds 0.04))
                         )
                    )
               (go target-falling #f)
               )
              ((< (the-as float f28-0) 0.0)
               (set! f28-0 (seek (the-as float f28-0) -0.04096 (* 491520.0 (seconds-per-frame))))
               (set-forward-vel (the-as float f28-0))
               )
              ((and (nonzero? (-> self control unknown-time-frame18))
                    (time-elapsed? (-> self control unknown-time-frame18) (seconds 0.04))
                    )
               )
              ((ja-done? 0)
               (set-forward-vel (the-as float f28-0))
               )
              (else
                (set-forward-vel (the-as float f28-0))
                )
              )
            )
          (set! f26-0 (seek f26-0 0.3 (* 2.0 (seconds-per-frame))))
          (update-rates! (-> *display* entity-clock) f26-0)
          (update-rates! (-> *display* bg-clock) f26-0)
          (update-rates! (-> *display* part-clock) f26-0)
          (let ((s4-0 (new-stack-vector0)))
            (vector-matrix*! s4-0 (-> self control transv) (-> self control w-R-c))
            (set! (-> s4-0 y) 0.0)
            (vector-matrix*! (-> self control align-xz-vel) s4-0 (-> self control c-R-w))
            )
          (when (!= (the-as float (-> self control unknown-word04)) 0.0)
            (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock))
            (set! f28-0 (-> self control unknown-word04))
            (set! (-> self control unknown-word04) (the-as uint (the-as float 0.0)))
            )
          (let ((v1-96
                  (and (not s5-1)
                       (let ((s4-1 (ja-group))
                             (f0-19 (ja-aframe-num 0))
                             )
                         (if (and (= s4-1 (-> self draw art-group data 476))
                                  (>= f0-19 16.0)
                                  (>= (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 476)) frames num-frames) -1))
                                      (ja-frame-num 0)
                                      )
                                  )
                             #t
                             )
                         )
                       )
                  )
                )
            (when v1-96
              (set! s5-1 #t)
              (let ((s4-2 (new 'stack-no-clear 'projectile-init-by-other-params)))
                (set! (-> s4-2 ent) (-> self entity))
                (set! (-> s4-2 charge) 1.0)
                (set! (-> s4-2 options) (projectile-options))
                (logclear! (-> s4-2 options) (projectile-options po14 po15 po16))
                (vector-copy!
                  (-> s4-2 pos)
                  (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_rhand))
                  )
                (set! (-> s4-2 notify-handle) (the-as handle #f))
                (set! (-> s4-2 owner-handle) (the-as handle #f))
                (set! (-> s4-2 target-handle) (the-as handle #f))
                (set! (-> s4-2 target-pos quad) (the-as uint128 0))
                (set! (-> s4-2 ignore-handle) (process->handle self))
                (let* ((v1-125 *game-info*)
                       (a0-43 (+ (-> v1-125 attack-id) 1))
                       )
                  (set! (-> v1-125 attack-id) a0-43)
                  (set! (-> s4-2 attack-id) a0-43)
                  )
                (set! (-> s4-2 timeout) (seconds 4))
                (vector-float*! (-> s4-2 vel) (-> self control c-R-w fvec) 245760.0)
                (let ((s3-1 (get-process *default-dead-pool* darkjak-ball #x8000 1)))
                  (when s3-1
                    (let ((t9-28 (method-of-type process activate)))
                      (t9-28 s3-1 self "projectile" (the-as pointer #x70004000))
                      )
                    (run-now-in-process s3-1 projectile-init-by-other s4-2)
                    (-> s3-1 ppointer)
                    )
                  )
                )
              )
            )
          (suspend)
          (ja :num! (seek! max f30-0))
          (if (time-elapsed? (-> self state-time) (seconds 0.1))
              (set! (-> *run-attack-mods* turnvv) 0.0)
              )
          (+! gp-2 1)
          )
        )
      )
    (if (and (not (logtest? (-> self control status) (collide-status on-surface)))
             (time-elapsed? (-> self control last-time-on-surface) (-> *TARGET-bank* ground-timeout))
             (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))
             (>= (target-height-above-ground) (-> *TARGET-bank* fall-height))
             )
        (go target-falling #f)
        )
    (go target-stance)
    )
  :post target-post
  )

(defmethod update-clock! ((this darkjak-info) (arg0 int))
  (when (-> this clock-on)
    (+! (-> this clock-pos) (* (-> this clock-vel) (seconds-per-frame)))
    (+! (-> this clock-vel) (* 4.0 (seconds-per-frame)))
    (cond
      ((< 1.0 (-> this clock-pos))
       (set! (-> this clock-pos) 1.0)
       (set! (-> this clock-vel) 0.0)
       )
      ((< (-> this clock-pos) 0.05)
       (set! (-> this clock-pos) 0.05)
       (set! (-> this clock-vel) 1.0)
       )
      )
    (update-rates! (-> *display* entity-clock) (-> this clock-pos))
    (update-rates! (-> *display* bg-clock) (-> this clock-pos))
    (if (= arg0 16)
        (update-rates! (-> *display* target-clock) (-> this clock-pos))
        )
    (when *sound-player-enable*
      (let ((v1-27 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
        (set! (-> v1-27 command) (sound-command set-param))
        (set! (-> v1-27 id) (-> this process 0 control unknown-sound-id00))
        (set! (-> v1-27 params pitch-mod) (the int (* 1524.0 (- (- 1.0 (-> this clock-pos))))))
        (set! (-> v1-27 params mask) (the-as uint 2))
        (-> v1-27 id)
        )
      )
    )
  0
  (none)
  )

(defbehavior target-darkjak-bomb-collide target ((arg0 (pointer float)) (arg1 float))
  (seek! (-> arg0 0) arg1 (* 4.0 (seconds-per-frame)))
  (set! (-> self control bomb-scale) (-> arg0 0))
  (target-danger-set! 'bomb #f)
  (update-transforms (-> self control))
  (let ((a1-2 (new 'stack-no-clear 'overlaps-others-params)))
    (set! (-> a1-2 options) (overlaps-others-options))
    (set! (-> a1-2 collide-with-filter) (the-as collide-spec -1))
    (set! (-> a1-2 tlist) *touching-list*)
    (find-overlapping-shapes (-> self control) a1-2)
    )
  (set! (-> self control bomb-scale) 0.0)
  (target-danger-set! 'bomb #f)
  (update-transforms (-> self control))
  0
  (none)
  )

(defstate target-darkjak-bomb0 (target)
  :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
    (case message
      (('pole-grab 'darkjak 'slide 'wade 'launch 'edge-grab 'jump 'shove 'attack 'attack-or-shove)
       #f
       )
      (('hit)
       (let ((v1-1 (the-as object (-> block param 1))))
         (when (and (= (-> block param 0) 'bomb)
                    (logtest? (process-mask enemy) (-> (the-as process v1-1) mask))
                    (let ((v1-7 (ja-group)))
                      (and v1-7 (= v1-7 (-> self draw art-group data 468)))
                      )
                    (>= (ja-aframe-num 0) 35.0)
                    (not (-> self darkjak clock-on))
                    )
           (set! (-> self darkjak clock-vel) -8.0)
           (let ((v0-0 (the-as object #t)))
             (set! (-> self darkjak clock-on) (the-as symbol v0-0))
             v0-0
             )
           )
         )
       )
      (('change-mode)
       #f
       )
      (('attack 'attack-or-shove 'swim)
       #f
       )
      (else
        (target-dangerous-event-handler proc argc message block)
        )
      )
    )
  :enter (behavior ()
    (logior! (-> self target-flags) (target-flags tf4))
    (set-setting! 'gun #f 0.0 0)
    (apply-settings *setting-control*)
    (set! (-> self darkjak clock-pos) 1.0)
    (set! (-> self darkjak clock-vel) 0.0)
    (set! (-> self darkjak clock-on) #f)
    (set! (-> self control unknown-sound-id00)
          (add-process *gui-control* self (gui-channel jak-effect-1) (gui-action queue) "darkbom0" -99.0 0)
          )
    )
  :exit (behavior ()
    (set-action!
      *gui-control*
      (gui-action fade)
      (-> self control unknown-sound-id00)
      (gui-channel none)
      (gui-action none)
      (the-as string #f)
      (the-as (function gui-connection symbol) #f)
      (the-as process #f)
      )
    (logclear! (-> self target-flags) (target-flags tf6))
    (target-exit)
    (remove-setting! 'music-volume)
    (remove-setting! 'sfx-volume)
    (remove-setting! 'ambient-volume)
    (remove-setting! 'gun)
    (set! (-> self darkjak clock-pos) 1.0)
    (set! (-> self darkjak clock-vel) 0.0)
    (set! (-> self darkjak clock-on) #f)
    (update-rates! (-> *display* entity-clock) 1.0)
    (update-rates! (-> *display* bg-clock) 1.0)
    (update-rates! (-> *display* target-clock) 1.0)
    (if (not (and (-> self next-state) (= (-> self next-state name) 'target-darkjak-get-off)))
        ((-> target-darkjak-get-off exit))
        )
    )
  :trans (behavior ()
    (update-clock! (-> self darkjak) 16)
    )
  :code (behavior ()
    (local-vars
      (v1-100 symbol)
      (sv-16 float)
      (sv-20 float)
      (sv-160 vector)
      (sv-164 (function object :behavior target))
      )
    (set! (-> self darkjak stage) (-> self darkjak want-stage))
    (set! (-> self neck flex-blend) 0.0)
    (set! (-> self control mod-surface) *roll-flip-mods*)
    (vector-copy! (-> self alt-cam-pos) (-> self control trans))
    (set! sv-16 (the-as float 0.0))
    (set! sv-20 (the-as float 1.0))
    (ja-channel-push! 1 (seconds 0.15))
    (when (jump-hit-ground-stuck?)
      (ja-no-eval :group! (-> self draw art-group data 451) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (set! (-> self alt-cam-pos x) (-> self control trans x))
        (set! (-> self alt-cam-pos z) (-> self control trans z))
        (set-forward-vel (* 0.85 (-> self control ctrl-xz-vel)))
        (suspend)
        (ja :num! (seek!))
        )
      )
    (set-setting! 'music-volume 'rel 0.0 0)
    (set-setting! 'sfx-volume 'rel 0.0 0)
    (set-setting! 'ambient-volume 'rel 0.0 0)
    (ja-no-eval :group! (-> self draw art-group data 466) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (compute-delta-align! (-> self align))
      (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0)
      (set! (-> self alt-cam-pos x) (-> self control trans x))
      (set! (-> self alt-cam-pos z) (-> self control trans z))
      (set-forward-vel (* 0.98 (-> self control ctrl-xz-vel)))
      (suspend)
      (ja :num! (seek!))
      )
    (ja-no-eval :group! (-> self draw art-group data 467) :num! (seek!) :frame-num 0.0)
    (let ((f30-0 (the float (target-time-to-ground))))
      (until v1-100
        (set! (-> self alt-cam-pos x) (-> self control trans x))
        (set! (-> self alt-cam-pos z) (-> self control trans z))
        (set-forward-vel (* 0.98 (-> self control ctrl-xz-vel)))
        (let ((v1-92 (new-stack-vector0))
              (f0-35 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))
              )
          0.0
          (vector-! v1-92 (-> self control transv) (vector-float*! v1-92 (-> self control dynam gravity-normal) f0-35))
          (let* ((f1-5 (vector-length v1-92))
                 (f2-0 f1-5)
                 (f0-36 (+ f0-35 (* -491520.0 (seconds-per-frame))))
                 )
            (vector+!
              (-> self control transv)
              (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-36)
              (vector-float*! v1-92 v1-92 (/ f1-5 f2-0))
              )
            )
          )
        (suspend)
        (ja :num! (seek! max (lerp-scale 1.5 0.3 f30-0 30.0 210.0)))
        (set! v1-100 (or (ja-done? 0) (logtest? (-> self control status) (collide-status on-surface))))
        )
      )
    (logclear! (-> self target-flags) (target-flags tf6))
    (while (not (jump-hit-ground-stuck?))
      (let ((v1-105 (new-stack-vector0))
            (f0-42 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))
            )
        0.0
        (vector-!
          v1-105
          (-> self control transv)
          (vector-float*! v1-105 (-> self control dynam gravity-normal) f0-42)
          )
        (let* ((f1-8 (vector-length v1-105))
               (f2-1 f1-8)
               (f0-43 (+ f0-42 (* -491520.0 (seconds-per-frame))))
               )
          (vector+!
            (-> self control transv)
            (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-43)
            (vector-float*! v1-105 v1-105 (/ f1-8 f2-1))
            )
          )
        )
      (ja :num! (seek! (ja-aframe 33.0 0)))
      (suspend)
      )
    (set-forward-vel 0.0)
    (ja-no-eval :group! (-> self draw art-group data 468) :num! (seek! (ja-aframe 35.0 0)) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek! (ja-aframe 35.0 0)))
      )
    (set-action!
      *gui-control*
      (gui-action play)
      (-> self control unknown-sound-id00)
      (gui-channel none)
      (gui-action none)
      (the-as string #f)
      (the-as (function gui-connection symbol) #f)
      (the-as process #f)
      )
    (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5))
    (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock))
    (target-start-attack)
    (target-danger-set! 'bomb #f)
    (send-event self 'get-pickup (pickup-type eco-pill-dark) (- (-> *FACT-bank* darkjak-bomb0-inc)))
    (set! sv-160 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_lhand)))
    (set! sv-164 (lambda :behavior target
                   ()
                   (set-vector! (-> self draw color-mult) 0.0 0.0 0.0 1.0)
                   (cond
                     ((>= 10.0 (ja-aframe-num 0))
                      (let ((v0-1 (the-as vector (-> self draw color-emissive))))
                        (set! (-> (the-as rgbaf v0-1) x) 1.0)
                        (set! (-> (the-as rgbaf v0-1) y) 1.0)
                        (set! (-> (the-as rgbaf v0-1) z) 1.0)
                        (set! (-> (the-as rgbaf v0-1) w) 1.0)
                        v0-1
                        )
                      )
                     ((>= 20.0 (ja-aframe-num 0))
                      (vector-lerp!
                        (-> self draw color-emissive)
                        (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
                        (new 'static 'vector :x 0.5 :z 1.0 :w 1.0)
                        (lerp-scale 0.0 1.0 (ja-aframe-num 0) 10.0 20.0)
                        )
                      )
                     (else
                       (vector-lerp!
                         (-> self draw color-emissive)
                         (new 'static 'vector :x 0.5 :z 1.0 :w 1.0)
                         (new 'static 'vector :w 1.0)
                         (lerp-scale 0.0 1.0 (ja-aframe-num 0) 20.0 30.0)
                         )
                       )
                     )
                   )
          )
    (set! (-> sv-160 y) (-> self control root-prim prim-core world-sphere y))
    (cond
      ((logtest? (-> *part-group-id-table* 71 flags) (sp-group-flag sp13))
       (vector-copy! (-> *launch-matrix* trans) sv-160)
       (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 71))
       )
      (else
        (vector-copy! (-> *launch-matrix* trans) sv-160)
        (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 71))
        )
      )
    (let ((gp-6 (process-spawn
                  manipy
                  :init manipy-init
                  sv-160
                  (-> self entity)
                  (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer level) #f))
                  #f
                  0
                  :name "manipy"
                  :to self
                  :stack-size #x20000
                  )
                )
          )
      (when gp-6
        (send-event (ppointer->process gp-6) 'anim-mode 'play1)
        (send-event (ppointer->process gp-6) 'anim "idle")
        (set-vector! (-> (the-as process-drawable (-> gp-6 0)) root scale) sv-20 1.0 sv-20 1.0)
        (send-event (ppointer->process gp-6) 'trans-hook sv-164)
        )
      )
    (let ((gp-8 (process-spawn
                  manipy
                  :init manipy-init
                  sv-160
                  (-> self entity)
                  (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer level) #f))
                  #f
                  0
                  :name "manipy"
                  :to self
                  :stack-size #x20000
                  )
                )
          )
      (when gp-8
        (send-event (ppointer->process gp-8) 'anim-mode 'play1)
        (send-event (ppointer->process gp-8) 'anim "idle")
        (set-vector! (-> (the-as manipy (-> gp-8 0)) root scale) sv-20 1.0 sv-20 1.0)
        )
      )
    (ja-no-eval :num! (seek! (ja-aframe 38.0 0)))
    (while (not (ja-done? 0))
      (target-darkjak-bomb-collide (& sv-16) sv-20)
      (set-forward-vel 0.0)
      (suspend)
      (ja-eval)
      )
    (ja-no-eval :num! (seek!))
    (while (not (ja-done? 0))
      (target-darkjak-bomb-collide (& sv-16) sv-20)
      (set-forward-vel 0.0)
      (suspend)
      (ja-eval)
      )
    (remove-setting! 'music-volume)
    (remove-setting! 'sfx-volume)
    (remove-setting! 'ambient-volume)
    (ja-no-eval :group! (-> self draw art-group data 461) :num! (seek! (ja-aframe 90.0 0)) :frame-num 0.0)
    (until (ja-done? 0)
      (target-darkjak-bomb-collide (& sv-16) sv-20)
      (suspend)
      (ja :num! (seek! (ja-aframe 90.0 0)))
      )
    (logior! (-> self control status) (collide-status on-surface on-ground touch-surface))
    (send-event (handle->process (-> self notify)) 'notify 'attack 20)
    (go target-darkjak-get-off)
    )
  :post target-no-stick-post
  )

(set! (-> *lightning-spec-id-table* 11) (new 'static 'lightning-spec
                                          :name "lightning-darkjak-bomb1"
                                          :flags (lightning-spec-flags lsf0 lsf4)
                                          :adjust-distance #xa
                                          :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 #x3a :page #x4)
                                          :reduction 0.42
                                          :num-points 80
                                          :box-size 32768.0
                                          :merge-factor 0.2
                                          :merge-count 2
                                          :radius 2048.0
                                          :duration 300.0
                                          :duration-rand 90.0
                                          :sound (static-sound-spec "transform-zap" :group 0)
                                          )
      )

(defbehavior target-bomb1-fire-shot target ((arg0 (array handle)) (arg1 int) (arg2 int))
  (local-vars (sv-128 target) (sv-144 int) (sv-160 vector) (sv-176 vector) (sv-192 vector))
  (rlet ((vf0 :class vf)
         (vf4 :class vf)
         (vf5 :class vf)
         (vf6 :class vf)
         )
    (init-vf0-vector)
    (cond
      ((and (>= arg1 0) (< arg1 (-> arg0 length)))
       (let ((s5-0 (handle->process (-> arg0 arg1))))
         (when s5-0
           (get-trans (the-as process-focusable s5-0) 3)
           (process-spawn
             lightning-tracker
             :init lightning-tracker-init
             (-> *lightning-spec-id-table* 11)
             0
             lightning-probe-callback
             s5-0
             3
             3
             :name "lightning-tracker"
             :to self
             :unk 0
             )
           (send-event
             s5-0
             'attack
             #f
             (static-attack-info :mask (vehicle-impulse-factor) ((id (the-as uint arg2))
                                                                 (damage 15.0)
                                                                 (vehicle-damage-factor 1.0)
                                                                 (vehicle-impulse-factor 1.0)
                                                                 (mode 'ice)
                                                                 (penetrate-using (penetrate touch dark-skin dark-bomb))
                                                                 )
                                 )
             )
           )
         )
       )
      (else
        (let ((gp-1 (get-process *default-dead-pool* lightning-tracker #x4000 0)))
          (when gp-1
            (let ((t9-6 (method-of-type lightning-tracker activate)))
              (t9-6 (the-as lightning-tracker gp-1) self "lightning-tracker" (the-as pointer #x70004000))
              )
            (let ((s5-1 run-function-in-process)
                  (s4-1 gp-1)
                  (s3-0 lightning-tracker-init)
                  (s2-0 (-> *lightning-spec-id-table* 11))
                  (s1-0 0)
                  (s0-0 lightning-probe-callback)
                  )
              (set! sv-128 self)
              (set! sv-144 3)
              (set! sv-192 (new 'stack-no-clear 'vector))
              (set! sv-160 (-> self control trans))
              (set! sv-176 (new 'stack-no-clear 'vector))
              (set! (-> sv-176 x) (rand-vu-float-range -40960.0 40960.0))
              (set! (-> sv-176 y) (rand-vu-float-range -8192.0 8192.0))
              (set! (-> sv-176 z) (rand-vu-float-range -40960.0 40960.0))
              (set! (-> sv-176 w) 1.0)
              (.mov.vf.w vf6 vf0)
              (.lvf vf4 (&-> sv-160 quad))
              (.lvf vf5 (&-> sv-176 quad))
              (.add.vf.xyz vf6 vf4 vf5)
              (.svf (&-> sv-192 quad) vf6)
              ((the-as (function object object object object object object object object none) s5-1)
               s4-1
               s3-0
               s2-0
               s1-0
               s0-0
               sv-128
               sv-144
               sv-192
               )
              )
            (-> gp-1 ppointer)
            )
          )
        #f
        )
      )
    )
  )

(defstate target-darkjak-bomb1 (target)
  :event (-> target-darkjak-bomb0 event)
  :enter (behavior ((arg0 float) (arg1 float))
    ((-> target-attack-uppercut-jump enter) arg0 arg1)
    (set-setting! 'gun #f 0.0 0)
    (apply-settings *setting-control*)
    )
  :exit (-> target-darkjak-bomb0 exit)
  :trans (behavior ()
    (if (logtest? (-> self control status) (collide-status on-surface))
        (go target-darkjak-get-off)
        )
    (mod-var-jump #t #t (cpad-hold? (-> self control cpad number) x) (-> self control transv))
    (if (and (= (-> self control danger-mode) 'uppercut)
             (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) -8192.0)
             )
        (target-danger-set! 'harmless #f)
        )
    (slide-down-test)
    (update-clock! (-> self darkjak) 32)
    )
  :code (behavior ((arg0 float) (arg1 float))
    (local-vars
      (sv-112 (array collide-shape))
      (sv-120 int)
      (sv-128 vector)
      (sv-132 (array handle))
      (sv-136 int)
      (sv-144 time-frame)
      (sv-152 time-frame)
      (sv-160 float)
      (sv-164 float)
      (sv-168 time-frame)
      (sv-176 uint)
      )
    (logior! (-> self target-flags) (target-flags tf4))
    (set! (-> self neck flex-blend) 0.0)
    (set-setting! 'music-volume 'rel 0.0 0)
    (set-setting! 'ambient-volume 'rel 0.0 0)
    (compute-delta-align! (-> self align))
    (set-action!
      *gui-control*
      (gui-action play)
      (-> self control unknown-sound-id00)
      (gui-channel none)
      (gui-action none)
      (the-as string #f)
      (the-as (function gui-connection symbol) #f)
      (the-as process #f)
      )
    (let ((f0-1 0.9))
      (ja-no-eval :num! (seek! max f0-1))
      )
    (while (not (ja-done? 0))
      (compute-delta-align! (-> self align))
      (set! (-> self control turn-go-the-long-way) 1.0)
      (set! (-> self darkjak clock-vel) -4.0)
      (set! (-> self darkjak clock-on) #t)
      (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0)
      (suspend)
      (ja-eval)
      )
    (send-event self 'get-pickup (pickup-type eco-pill-dark) (- (-> *FACT-bank* darkjak-bomb1-inc)))
    (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5))
    (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock))
    (let ((gp-0 (-> self post-hook)))
      (set! (-> self post-hook) target-no-move-post)
      (set! sv-112 (-> self focus-search))
      (set! sv-120 0)
      (set! sv-128 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg main)))
      (set! sv-132 (-> self handle-search))
      (set! (-> sv-132 length) 0)
      (set! (-> sv-128 w) 327680.0)
      (set! sv-120 (fill-actor-list-for-box *actor-hash* sv-128 (-> sv-112 data) (-> sv-112 allocated-length)))
      (set! (-> sv-112 length) sv-120)
      (countdown (s5-0 sv-120)
        (let ((v1-56 (as-type (-> sv-112 s5-0 process) process-focusable)))
          (when (and v1-56 (logtest? (process-mask crate enemy guard vehicle) (-> v1-56 mask)))
            (set! (-> sv-132 (-> sv-132 length)) (process->handle v1-56))
            (+! (-> sv-132 length) 1)
            (if (< (-> sv-132 allocated-length) (-> sv-132 length))
                (set! (-> sv-132 length) (-> sv-132 allocated-length))
                )
            )
          )
        )
      (set! (-> self control mod-surface) (new 'static 'surface
                                            :name 'uppercut
                                            :turnv 524288.0
                                            :turnvf 15.0
                                            :tiltv 32768.0
                                            :tiltvf 150.0
                                            :tiltvv 262144.0
                                            :tiltvvf 15.0
                                            :transv-max 32768.0
                                            :target-speed 32768.0
                                            :fric 0.2
                                            :nonlin-fric-dist 1.0
                                            :slip-factor 1.0
                                            :slide-factor 1.0
                                            :slope-up-factor 1.0
                                            :slope-down-factor 1.0
                                            :slope-slip-angle 1.0
                                            :impact-fric 1.0
                                            :bend-factor 1.0
                                            :bend-speed 1.0
                                            :alignv 1.0
                                            :slope-up-traction 1.0
                                            :align-speed 1.0
                                            :mode 'air
                                            :flags (surface-flag air attack spin gun-off laser-hide)
                                            )
            )
      (set! sv-136 0)
      (set! sv-144 (current-time))
      (set! sv-152 (current-time))
      (set! sv-160 (the-as float 0.0))
      (set! sv-164 (the-as float 0.0))
      (set! sv-168 (current-time))
      (let* ((v1-77 (-> self game))
             (a0-34 (+ (-> v1-77 attack-id) 1))
             )
        (set! (-> v1-77 attack-id) a0-34)
        (set! sv-176 a0-34)
        )
      (ja-channel-push! 2 (seconds 0.05))
      (ja :group! (-> self draw art-group data 469))
      (ja :chan 1 :group! (-> self draw art-group data 470))
      (while (or (< sv-136 (-> sv-132 length)) (not (time-elapsed? sv-152 (seconds 1.5))))
        (let ((v1-84 (new-stack-vector0)))
          (let ((f0-10 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))))
            0.0
            (vector-! v1-84 (-> self control transv) (vector-float*! v1-84 (-> self control dynam gravity-normal) f0-10))
            )
          (let* ((f0-11 (vector-length v1-84))
                 (f1-3 f0-11)
                 (f2-0 0.0)
                 )
            (vector+!
              (-> self control transv)
              (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0)
              (vector-float*! v1-84 v1-84 (/ f0-11 f1-3))
              )
            )
          )
        (set! (-> self darkjak clock-vel) -4.0)
        (set! (-> self darkjak clock-on) #t)
        (send-event *camera* 'joystick -0.25 1.0)
        (when (time-elapsed? sv-144 (seconds 0.1))
          (set! sv-144 (current-time))
          (target-bomb1-fire-shot sv-132 sv-136 (the-as int sv-176))
          (set! sv-136 (+ sv-136 1))
          (if (time-elapsed? (-> self state-time) (seconds 1))
              (set! sv-164 (the-as float 1.0))
              )
          )
        (set! sv-160 (seek sv-160 sv-164 (* 6.0 (seconds-per-frame))))
        (ja :num! (loop!))
        (let ((a0-61 (-> self skel root-channel 1)))
          (let ((f0-21 sv-160))
            (set! (-> a0-61 frame-interp 1) f0-21)
            (set! (-> a0-61 frame-interp 0) f0-21)
            )
          (set! (-> a0-61 param 0) 0.0)
          (joint-control-channel-group-eval! a0-61 (the-as art-joint-anim #f) num-func-chan)
          )
        (suspend)
        )
      (set! (-> self post-hook) gp-0)
      )
    (set! (-> self control mod-surface) *double-jump-mods*)
    (ja-channel-push! 1 (seconds 0.1))
    (ja-no-eval :group! (-> self draw art-group data 471) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (ja-blend-eval)
      (compute-delta-align! (-> self align))
      (set! (-> self control turn-go-the-long-way) 1.0)
      (set! (-> self darkjak clock-vel) 4.0)
      (suspend)
      (ja :num! (seek!))
      )
    (set-time! (-> self gun surpress-time))
    (send-event (handle->process (-> self notify)) 'notify 'attack 21)
    (go target-darkjak-get-off)
    )
  :post target-post
  )
