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

(import "goal_src/jak1/import/robotboss-redeco-ag.gc")
(import "goal_src/jak1/import/robotboss-blueeco-ag.gc")
(import "goal_src/jak1/import/robotboss-yelloweco-ag.gc")

;; definition for method 20 of type robotboss
(defmethod ease-loc-t robotboss ((obj robotboss))
  (parameter-ease-sin-clamp (-> obj loc-t))
  )

;; failed to figure out what this is:
(defskelgroup *robotboss-blueeco-sg* robotboss-blueeco robotboss-blueeco-lod0-jg robotboss-blueeco-idle-ja
              ((robotboss-blueeco-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 200)
              )

;; failed to figure out what this is:
(defskelgroup *robotboss-redeco-sg* robotboss-redeco robotboss-redeco-lod0-jg robotboss-redeco-idle-ja
              ((robotboss-redeco-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 200)
              )

;; failed to figure out what this is:
(defskelgroup *robotboss-yelloweco-sg* robotboss-yelloweco robotboss-yelloweco-lod0-jg robotboss-yelloweco-idle-ja
              ((robotboss-yelloweco-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 200)
              )

;; definition for function robotboss-cut-cam-exit
;; INFO: Return type mismatch symbol vs none.
(defbehavior robotboss-cut-cam-exit robotboss ()
  (set! (-> self valid-frames) 0)
  (if (and *target* (logtest? (-> *target* state-flags) (state-flags grabbed)))
      (process-release? *target*)
      )
  (logclear! (-> self skel status) (janim-status inited))
  (set! (-> self skip-cut) #f)
  (none)
  )

;; definition for function robotboss-cut-cam
;; INFO: Used lq/sq
(defbehavior robotboss-cut-cam robotboss ((arg0 float) (arg1 float) (arg2 int))
  (let ((f0-0 (ja-aframe-num 0)))
    (cond
      ((or (not (ja-group? arg2)) (< f0-0 arg0) (< arg1 f0-0))
       (robotboss-cut-cam-exit)
       )
      ((or (and (logtest? (-> *target* control unknown-surface00 flags) (surface-flags jump))
                (zero? (logand (-> *target* control status) (cshape-moving-flags onsurf)))
                )
           (-> self skip-cut)
           )
       (set! (-> self skip-cut) #t)
       )
      (else
        (logior! (-> self skel status) (janim-status inited))
        (process-grab? *target*)
        (set! (-> *camera-other-root* quad) (-> self root-override trans quad))
        (let ((s5-1 (-> self node-list data 88 bone transform))
              (gp-1 (-> self node-list data 88 bone scale))
              )
          (let ((s4-1 (new 'stack-no-clear 'vector)))
            (vector<-cspace! s4-1 (-> self node-list data 88))
            (set! (-> *camera-other-trans* quad) (-> s4-1 quad))
            )
          (vector-normalize-copy!
            (the-as vector (-> *camera-other-matrix* vector))
            (the-as vector (-> s5-1 vector))
            (the-as float -1.0)
            )
          (set! (-> *camera-other-matrix* vector 0 w) 0.0)
          (vector-normalize-copy! (-> *camera-other-matrix* vector 1) (-> s5-1 vector 1) (the-as float 1.0))
          (set! (-> *camera-other-matrix* vector 1 w) 0.0)
          (vector-normalize-copy! (-> *camera-other-matrix* vector 2) (-> s5-1 vector 2) (the-as float -1.0))
          (set! (-> *camera-other-matrix* vector 2 w) 0.0)
          (vector-reset! (-> *camera-other-matrix* vector 3))
          (othercam-calc (-> gp-1 x))
          )
        (hide-hud-quick)
        (set! *camera-look-through-other* 2)
        (when (< (-> self valid-frames) 2)
          (set-blackout-frames (seconds 0.035))
          (+! (-> self valid-frames) 1)
          )
        )
      )
    )
  (none)
  )

;; definition for function robotboss-always-trans
;; INFO: Return type mismatch object vs none.
(defbehavior robotboss-always-trans robotboss ((arg0 (state robotboss)))
  (when (-> self blue-smoke)
    (let ((s5-0 (new 'stack-no-clear 'vector)))
      (vector<-cspace! s5-0 (-> self node-list data 7))
      (spawn (-> self particle 2) s5-0)
      )
    )
  (when (-> self red-smoke)
    (let ((s5-1 (new 'stack-no-clear 'vector)))
      (vector<-cspace! s5-1 (-> self node-list data 47))
      (spawn (-> self particle 3) s5-1)
      (vector<-cspace! s5-1 (-> self node-list data 51))
      (spawn (-> self particle 3) s5-1)
      )
    )
  (when (-> self yellow-smoke)
    (let ((s5-2 (new 'stack-no-clear 'vector)))
      (vector<-cspace! s5-2 (-> self node-list data 27))
      (spawn (-> self particle 4) s5-2)
      )
    )
  (let* ((f0-1 (- 0.0 (-> self palette-val)))
         (f0-2 (if (< 0.0 f0-1)
                   (fmin 0.1 f0-1)
                   (fmax -0.1 f0-1)
                   )
               )
         )
    (+! (-> self palette-val) f0-2)
    )
  (set! (-> *palette-fade-controls* control 2 fade) (-> self palette-val))
  (b! (not (-> self ignore-camera)) cfg-11 :delay (empty-form))
  (b! #t cfg-66 :delay (nop!))
  (label cfg-11)
  (b! *target* cfg-13 :delay (empty-form))
  (b! #t cfg-66 :delay (nop!))
  (label cfg-13)
  (let ((a1-8 (new 'stack-no-clear 'event-message-block)))
    (set! (-> a1-8 from) self)
    (set! (-> a1-8 num-params) 1)
    (set! (-> a1-8 message) 'query-state)
    (set! (-> a1-8 param 0) (the-as uint cam-eye))
    (b! (not (send-event-function *camera* a1-8)) cfg-15 :delay (empty-form))
    )
  (b! #t cfg-66 :delay (nop!))
  (label cfg-15)
  (let ((a1-9 (new 'stack-no-clear 'event-message-block)))
    (set! (-> a1-9 from) self)
    (set! (-> a1-9 num-params) 1)
    (set! (-> a1-9 message) 'query-state)
    (set! (-> a1-9 param 0) (the-as uint cam-launcher-longfall))
    (b! (not (send-event-function *camera* a1-9)) cfg-19 :delay (empty-form))
    )
  (when (-> *camera* cam-entity)
    (let ((s5-4 *camera-base-mode*))
      (set! *camera-base-mode* cam-launcher-longfall)
      (send-event *camera* 'clear-entity)
      (set! *camera-base-mode* s5-4)
      )
    )
  (b! #t cfg-66 :delay (nop!))
  (label cfg-19)
  (b!
    (not (and (-> self des-cam-entity)
              (or (< (vector-vector-xz-distance (-> self entity extra trans) (target-pos 0)) 188416.0)
                  (and *target*
                       (>= 290816.0 (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)))
                       )
                  )
              )
         )
    cfg-37
    :delay (empty-form)
    )
  (if (or (not (-> *camera* cam-entity))
          (not (string=
                 (-> self des-cam-entity)
                 (res-lump-struct (-> *camera* cam-entity) 'name string :time (the-as float -1000000000.0))
                 )
               )
          )
      (send-event *camera* 'change-to-entity-by-name (-> self des-cam-entity))
      )
  (b! #t cfg-66 :delay (nop!))
  (label cfg-37)
  (b!
    (not (or (< (vector-vector-xz-distance (-> self entity extra trans) (target-pos 0)) 73728.0)
             (and *target*
                  (>= 290816.0 (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)))
                  )
             )
         )
    cfg-49
    :delay (empty-form)
    )
  (when (not (send-event *camera* 'query-state cam-robotboss))
    (send-event *camera* 'change-state cam-robotboss (seconds 1))
    (send-event *camera* 'clear-entity)
    )
  (b! #t cfg-66 :delay (nop!))
  (label cfg-49)
  (when (and (< 196608.0 (vector-vector-xz-distance (-> self entity extra trans) (target-pos 0)))
             (< (vector-vector-xz-distance (-> self entity extra trans) (target-pos 0)) 614400.0)
             (not (and *target*
                       (>= 299008.0 (vector-vector-xz-distance (-> self root-override trans) (-> *target* control trans)))
                       )
                  )
             )
    (when (not (send-event *camera* 'query-state cam-string))
      (send-event *camera* 'point-of-interest #f)
      (send-event *camera* 'force-blend (seconds 1))
      (send-event *camera* 'clear-entity)
      (send-event *camera* 'change-state cam-string (seconds 1))
      )
    )
  (label cfg-66)
  (cond
    ((send-event *camera* 'query-state cam-string)
     )
    ((-> self use-interesting)
     (let ((s5-10 (new 'stack-no-clear 'vector)))
       (vector<-cspace! s5-10 (-> self node-list data 87))
       (send-event *camera* 'point-of-interest s5-10)
       )
     )
    )
  (when (and arg0 *debug-segment* (cpad-pressed? 1 x))
    (logclear! (-> *cpad-list* cpads 1 button0-abs 0) (pad-buttons x))
    (logclear! (-> *cpad-list* cpads 1 button0-rel 0) (pad-buttons x))
    (go arg0)
    )
  (none)
  )

;; definition for function robotboss-shooting-trans
;; INFO: Return type mismatch object vs none.
(defbehavior robotboss-shooting-trans robotboss ((arg0 int))
  (let ((gp-0 (new 'stack-no-clear 'vector)))
    (vector<-cspace! gp-0 (-> self node-list data arg0))
    (send-event (handle->process (-> self shot-attractor)) 'trans gp-0)
    )
  (none)
  )

;; definition for function robotboss-setup-for-hits
(defbehavior robotboss-setup-for-hits robotboss ((arg0 int) (arg1 int))
  (set! (-> self took-hit) #f)
  (set! (-> self hits-to-go) arg1)
  (set! (-> self vulnerable) arg0)
  (let ((gp-0 (new 'stack 'sphere)))
    (set! (-> gp-0 w) 4096.0)
    (set! (-> self shot-attractor)
          (ppointer->handle (manipy-spawn (-> self root-override trans) (-> self entity) *redring-sg* gp-0 :to self))
          )
    )
  (send-event (handle->process (-> self shot-attractor)) 'attackable #t)
  (send-event (handle->process (-> self shot-attractor)) 'draw #f)
  )

;; definition for function robotboss-yellow-eco-off
;; INFO: Return type mismatch entity-perm-status vs none.
(defbehavior robotboss-yellow-eco-off robotboss ()
  (logior! (-> self alts 7 extra perm status) (entity-perm-status bit-9))
  (logior! (-> self alts 8 extra perm status) (entity-perm-status bit-9))
  (logior! (-> self alts 9 extra perm status) (entity-perm-status bit-9))
  (logior! (-> self alts 10 extra perm status) (entity-perm-status bit-9))
  (none)
  )

;; definition for function robotboss-yellow-eco-on
;; INFO: Return type mismatch entity-perm-status vs none.
(defbehavior robotboss-yellow-eco-on robotboss ()
  (logclear! (-> self alts 7 extra perm status) (entity-perm-status bit-9))
  (logclear! (-> self alts 8 extra perm status) (entity-perm-status bit-9))
  (logclear! (-> self alts 9 extra perm status) (entity-perm-status bit-9))
  (logclear! (-> self alts 10 extra perm status) (entity-perm-status bit-9))
  (none)
  )

;; definition for function robotboss-anim-blend-loop
(defbehavior robotboss-anim-blend-loop robotboss ((arg0 art-joint-anim))
  (let ((s5-0 (ja-group)))
    (ja-channel-push! 2 0)
    (ja :group! arg0 :num! min)
    (ja :chan 1 :group! s5-0 :num! min)
    )
  (loop
    (ja :num! (loop!))
    (ja :chan 1 :num! (chan 0) :frame-interp (- 1.0 (ease-loc-t self)))
    (suspend)
    )
  (none)
  )

;; definition for function robotboss-position
;; INFO: Used lq/sq
(defbehavior robotboss-position robotboss ()
  (let ((s5-0 (-> self entity extra trans))
        (gp-0 (new 'stack-no-clear 'vector))
        )
    (let ((s4-0 (new 'stack-no-clear 'matrix)))
      (set! (-> self loc-t) (/ (the float (- (-> *display* game-frame-counter) (-> self loc-t-start)))
                               (the float (-> self loc-t-duration))
                               )
            )
      (set! (-> self loc-t) (fmin 1.0 (-> self loc-t)))
      (vector-lerp! gp-0 (-> self old-loc) (-> self desired-loc) (ease-loc-t self))
      (matrix-rotate-y! s4-0 (-> gp-0 x))
      (set! (-> gp-0 x) 0.0)
      (vector-matrix*! gp-0 gp-0 s4-0)
      (vector+! (-> self root-override trans) gp-0 (-> self entity extra trans))
      (vector-negate! (the-as vector (-> s4-0 vector)) (the-as vector (-> s4-0 vector)))
      (vector-negate! (-> s4-0 vector 2) (-> s4-0 vector 2))
      (matrix->quaternion (-> self root-override quat) s4-0)
      )
    (vector-! gp-0 s5-0 (-> self root-override trans))
    (set! (-> gp-0 y) 0.0)
    (vector-normalize! gp-0 (the-as float 204800.0))
    (set! (-> gp-0 y) 32768.0)
    (vector+! gp-0 gp-0 s5-0)
    (send-event *camera* 'set-pivot gp-0)
    )
  (when (-> self alts 6)
    (let ((a0-16 (-> self alts 6 extra process))
          (f0-10 (+ (-> self entity extra trans y) (-> self desired-pool-y)))
          )
      (when a0-16
        (let ((v1-23 (new 'stack-no-clear 'vector)))
          (set! (-> v1-23 quad) (-> (the-as process-drawable a0-16) root trans quad))
          (cond
            ((< (-> v1-23 y) (+ -204.8 f0-10))
             (set! (-> v1-23 y) (+ 20.48 (-> v1-23 y)))
             )
            ((< (+ 204.8 f0-10) (-> v1-23 y))
             (set! (-> v1-23 y) (+ -20.48 (-> v1-23 y)))
             )
            )
          (send-event a0-16 'move-to v1-23)
          )
        )
      )
    )
  )

;; definition for function robotboss-darkecobomb
;; INFO: Used lq/sq
;; INFO: Return type mismatch (pointer process) vs (pointer part-tracker).
(defbehavior robotboss-darkecobomb robotboss ((arg0 vector) (arg1 float))
  (+! (-> self children-spawned) 1)
  (let ((gp-0 (new 'stack-no-clear 'vector)))
    (let ((s4-0 (new 'stack-no-clear 'vector)))
      (vector<-cspace! gp-0 (-> self node-list data 60))
      (set! (-> s4-0 quad) (-> self entity extra trans quad))
      (vector+! s4-0 s4-0 arg0)
      (process-spawn darkecobomb gp-0 s4-0 61440.0 300 arg1 :to self)
      )
    (process-spawn
      part-tracker
      :init part-tracker-init
      (-> *part-group-id-table* 638)
      300
      #f
      #f
      #f
      gp-0
      :to *entity-pool*
      )
    )
  )

;; definition for function robotboss-bomb-handler
(defbehavior robotboss-bomb-handler robotboss ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
  (local-vars (v0-0 object))
  (case arg2
    (('flash)
     (let ((f0-1 (* 0.0078125 (the-as float (-> arg3 param 0)))))
       (set! (-> self palette-val) f0-1)
       f0-1
       )
     )
    (('bomb-done)
     (set! (-> self des-cam-entity) #f)
     (let ((a1-1 (new 'stack-no-clear 'event-message-block)))
       (set! (-> a1-1 from) self)
       (set! (-> a1-1 num-params) 0)
       (set! (-> a1-1 message) 'hide)
       (let ((t9-0 send-event-function)
             (v1-4 (-> self alts 11))
             )
         (t9-0
           (if v1-4
               (-> v1-4 extra process)
               )
           a1-1
           )
         )
       )
     (set! v0-0 (+ (-> self children-spawned) -2))
     (set! (-> self children-spawned) (the-as int v0-0))
     v0-0
     )
    (('bomb-going)
     (set! (-> self des-cam-entity) #f)
     (set! v0-0 #t)
     (set! (-> self ignore-camera) (the-as symbol v0-0))
     v0-0
     )
    )
  )

;; definition for function robotboss-handler
;; INFO: Return type mismatch number vs object.
(defbehavior robotboss-handler robotboss ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
  (let ((v1-0 arg2))
    (the-as object (cond
                     ((= v1-0 'flash)
                      (let ((f0-1 (* 0.0078125 (the-as float (-> arg3 param 0)))))
                        (set! (-> self palette-val) f0-1)
                        f0-1
                        )
                      )
                     ((= v1-0 'attack)
                      (when (>= arg1 2)
                        (case (-> arg3 param 1)
                          (('eco-yellow)
                           (let ((a0-5 (-> arg3 param 0)))
                             (when (and a0-5 ((method-of-type touching-shapes-entry prims-touching?)
                                              (the-as touching-shapes-entry a0-5)
                                              (-> self root-override)
                                              (the-as uint (-> self vulnerable))
                                              )
                                        )
                               (when (> (-> self hits-to-go) 0)
                                 (set! (-> self took-hit) #t)
                                 (let ((v0-0 (the-as number (+ (-> self hits-to-go) -1))))
                                   (set! (-> self hits-to-go) (the-as int v0-0))
                                   v0-0
                                   )
                                 )
                               )
                             )
                           )
                          )
                        )
                      )
                     )
            )
    )
  )

;; failed to figure out what this is:
(defstate robotboss-yellow-dark-bomb-wait (robotboss)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (let ((v1-0 arg2))
      (the-as object (cond
                       ((= v1-0 'white-eco-picked-up)
                        (close-specific-task! (game-task finalboss-movies) (task-status unknown))
                        (entity-birth-no-kill (-> self alts 5))
                        (let ((a1-2 (new 'stack-no-clear 'event-message-block)))
                          (set! (-> a1-2 from) self)
                          (set! (-> a1-2 num-params) 0)
                          (set! (-> a1-2 message) 'play-anim)
                          (let ((t9-2 send-event-function)
                                (v1-2 (-> self alts 5))
                                )
                            (t9-2
                              (if v1-2
                                  (-> v1-2 extra process)
                                  )
                              a1-2
                              )
                            )
                          )
                        (cleanup-for-death self)
                        (deactivate self)
                        )
                       (else
                         (robotboss-bomb-handler arg0 arg1 arg2 arg3)
                         )
                       )
              )
      )
    )
  :enter (behavior ()
    (set! (-> self state-time) (-> *display* game-frame-counter))
    (set! (-> self children-spawned) 0)
    0
    (none)
    )
  :exit (behavior ()
    (set! (-> self des-cam-entity) #f)
    (let ((a1-0 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-0 from) self)
      (set! (-> a1-0 num-params) 0)
      (set! (-> a1-0 message) 'beam-off)
      (let ((t9-0 send-event-function)
            (v1-1 (-> self alts 3))
            )
        (t9-0
          (if v1-1
              (-> v1-1 extra process)
              )
          a1-0
          )
        )
      )
    (let ((a1-1 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-1 from) self)
      (set! (-> a1-1 num-params) 0)
      (set! (-> a1-1 message) 'beam-off)
      (let ((t9-1 send-event-function)
            (v1-5 (-> self alts 2))
            )
        (t9-1
          (if v1-5
              (-> v1-5 extra process)
              )
          a1-1
          )
        )
      )
    (let ((a1-2 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-2 from) self)
      (set! (-> a1-2 num-params) 0)
      (set! (-> a1-2 message) 'beam-off)
      (let ((t9-2 send-event-function)
            (v1-9 (-> self alts 1))
            )
        (t9-2
          (if v1-9
              (-> v1-9 extra process)
              )
          a1-2
          )
        )
      )
    (let ((a1-3 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-3 from) self)
      (set! (-> a1-3 num-params) 0)
      (set! (-> a1-3 message) 'beam-off)
      (let ((t9-3 send-event-function)
            (v1-13 (-> self alts 4))
            )
        (t9-3
          (if v1-13
              (-> v1-13 extra process)
              )
          a1-3
          )
        )
      )
    (send-event (handle->process (-> self white-eco)) 'beam-off)
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans (the-as (state robotboss) #f))
    (spool-push *art-control* "green-sagecage-outro-beat-boss-a" 0 self (the-as float -1.0))
    (robotboss-position)
    (none)
    )
  :code (behavior ()
    (ja-no-eval :num! (seek!))
    (while (not (ja-done? 0))
      (suspend)
      (ja-eval)
      )
    (ja-channel-push! 1 (seconds 0.1))
    (ja :group! robotboss-dark-shoot-no-yellow-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (when (and (>= (ja-frame-num 0) 15.0) (< (-> self children-spawned) 1))
        (robotboss-darkecobomb (new 'static 'vector :y 40960.0 :z 81920.0) (-> self dda yellow-bomb-time))
        (play-ambient (-> self ambient) "GOL-AM20" #t (the-as vector #f))
        )
      (suspend)
      (ja :num! (seek!))
      )
    (ja-channel-push! 1 (seconds 0.1))
    (ja :group! robotboss-dark-shoot-no-yellow-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (if (and (>= (ja-frame-num 0) 15.0) (< (-> self children-spawned) 2))
          (robotboss-darkecobomb (new 'static 'vector :y 40960.0 :z -81920.0) (+ -150.0 (-> self dda yellow-bomb-time)))
          )
      (suspend)
      (ja :num! (seek!))
      )
    (ja-channel-push! 1 (seconds 0.1))
    (ja :group! robotboss-dark-shoot-no-yellow-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (if (and (>= (ja-frame-num 0) 15.0) (< (-> self children-spawned) 3))
          (robotboss-darkecobomb (new 'static 'vector :x 81920.0 :y 40960.0) (+ -300.0 (-> self dda yellow-bomb-time)))
          )
      (suspend)
      (ja :num! (seek!))
      )
    (ja-channel-push! 1 (seconds 0.1))
    (ja :group! robotboss-dark-shoot-no-yellow-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (when (and (>= (ja-frame-num 0) 15.0) (< (-> self children-spawned) 4))
        (robotboss-darkecobomb (new 'static 'vector :x -81920.0 :y 40960.0) (+ -450.0 (-> self dda yellow-bomb-time)))
        (play-ambient (-> self ambient) "MAI-AM03" #t (the-as vector #f))
        (set! (-> self des-cam-entity) "camera-365")
        )
      (suspend)
      (ja :num! (seek!))
      )
    (loop
      (when (not (ja-group? robotboss-idle-hover-no-yellow-ja))
        (ja-channel-push! 1 (seconds 0.2))
        (ja :group! robotboss-idle-hover-no-yellow-ja)
        )
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; failed to figure out what this is:
(defstate robotboss-daxter-sacrifice-movie (robotboss)
  :code (behavior ()
    (set-blackout-frames (seconds 100))
    (entity-birth-no-kill (-> self alts 5))
    (let ((a1-0 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-0 from) self)
      (set! (-> a1-0 num-params) 0)
      (set! (-> a1-0 message) 'play-anim)
      (let ((t9-2 send-event-function)
            (v1-1 (-> self alts 5))
            )
        (t9-2
          (if v1-1
              (-> v1-1 extra process)
              )
          a1-0
          )
        )
      )
    (suspend)
    (while (movie?)
      (suspend)
      )
    (set-blackout-frames 0)
    (go robotboss-yellow-dark-bomb-wait)
    (none)
    )
  )

;; failed to figure out what this is:
(defstate robotboss-white-eco-movie (robotboss)
  :enter (behavior ()
    (logior! (-> self draw status) (draw-status hidden))
    (set! (-> self children-spawned) 0)
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (ja-post)
    (none)
    )
  :exit (behavior ()
    (logclear! (-> self draw status) (draw-status hidden))
    (none)
    )
  :trans (behavior ()
    (spool-push *art-control* "green-sagecage-daxter-sacrifice" 0 self (the-as float -1.0))
    (when (and (< (-> self children-spawned) 1)
               (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.95))
               )
      (+! (-> self children-spawned) 1)
      (let ((gp-0 (new 'stack-no-clear 'vector)))
        (set! (-> gp-0 quad) (-> self entity extra trans quad))
        (set! (-> gp-0 y) (+ 81920.0 (-> gp-0 y)))
        (set! (-> self white-eco) (ppointer->handle (process-spawn light-eco-mother (-> self entity) gp-0 :to self)))
        )
      )
    (none)
    )
  :code (behavior ()
    (let ((a1-0 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-0 from) self)
      (set! (-> a1-0 num-params) 1)
      (set! (-> a1-0 message) 'open)
      (set! (-> a1-0 param 0) (the-as uint (-> *part-group-id-table* 674)))
      (let ((t9-0 send-event-function)
            (v1-4 (-> self alts 3))
            )
        (t9-0
          (if v1-4
              (-> v1-4 extra process)
              )
          a1-0
          )
        )
      )
    (let ((a1-1 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-1 from) self)
      (set! (-> a1-1 num-params) 1)
      (set! (-> a1-1 message) 'open)
      (set! (-> a1-1 param 0) (the-as uint (-> *part-group-id-table* 675)))
      (let ((t9-1 send-event-function)
            (v1-11 (-> self alts 2))
            )
        (t9-1
          (if v1-11
              (-> v1-11 extra process)
              )
          a1-1
          )
        )
      )
    (let ((a1-2 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-2 from) self)
      (set! (-> a1-2 num-params) 1)
      (set! (-> a1-2 message) 'open)
      (set! (-> a1-2 param 0) (the-as uint (-> *part-group-id-table* 676)))
      (let ((t9-2 send-event-function)
            (v1-18 (-> self alts 1))
            )
        (t9-2
          (if v1-18
              (-> v1-18 extra process)
              )
          a1-2
          )
        )
      )
    (let ((a1-3 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-3 from) self)
      (set! (-> a1-3 num-params) 1)
      (set! (-> a1-3 message) 'open)
      (set! (-> a1-3 param 0) (the-as uint (-> *part-group-id-table* 677)))
      (let ((t9-3 send-event-function)
            (v1-25 (-> self alts 4))
            )
        (t9-3
          (if v1-25
              (-> v1-25 extra process)
              )
          a1-3
          )
        )
      )
    (let ((a1-4 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-4 from) self)
      (set! (-> a1-4 num-params) 3)
      (set! (-> a1-4 message) 'beam-on)
      (set! (-> a1-4 param 0) (the-as uint (-> *part-group-id-table* 666)))
      (set! (-> a1-4 param 1) (the-as uint (-> *part-group-id-table* 666)))
      (set! (-> a1-4 param 2) (the-as uint (-> self entity extra trans)))
      (let ((t9-4 send-event-function)
            (v1-37 (-> self alts 3))
            )
        (t9-4
          (if v1-37
              (-> v1-37 extra process)
              )
          a1-4
          )
        )
      )
    (let ((a1-5 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-5 from) self)
      (set! (-> a1-5 num-params) 3)
      (set! (-> a1-5 message) 'beam-on)
      (set! (-> a1-5 param 0) (the-as uint (-> *part-group-id-table* 672)))
      (set! (-> a1-5 param 1) (the-as uint (-> *part-group-id-table* 672)))
      (set! (-> a1-5 param 2) (the-as uint (-> self entity extra trans)))
      (let ((t9-5 send-event-function)
            (v1-49 (-> self alts 2))
            )
        (t9-5
          (if v1-49
              (-> v1-49 extra process)
              )
          a1-5
          )
        )
      )
    (let ((a1-6 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-6 from) self)
      (set! (-> a1-6 num-params) 3)
      (set! (-> a1-6 message) 'beam-on)
      (set! (-> a1-6 param 0) (the-as uint (-> *part-group-id-table* 668)))
      (set! (-> a1-6 param 1) (the-as uint (-> *part-group-id-table* 668)))
      (set! (-> a1-6 param 2) (the-as uint (-> self entity extra trans)))
      (let ((t9-6 send-event-function)
            (v1-61 (-> self alts 1))
            )
        (t9-6
          (if v1-61
              (-> v1-61 extra process)
              )
          a1-6
          )
        )
      )
    (let ((a1-7 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-7 from) self)
      (set! (-> a1-7 num-params) 3)
      (set! (-> a1-7 message) 'beam-on)
      (set! (-> a1-7 param 0) (the-as uint (-> *part-group-id-table* 670)))
      (set! (-> a1-7 param 1) (the-as uint (-> *part-group-id-table* 670)))
      (set! (-> a1-7 param 2) (the-as uint (-> self entity extra trans)))
      (let ((t9-7 send-event-function)
            (v1-73 (-> self alts 4))
            )
        (t9-7
          (if v1-73
              (-> v1-73 extra process)
              )
          a1-7
          )
        )
      )
    (let ((gp-1 (ppointer->handle (process-spawn finalbosscam (-> self entity) :to self))))
      (send-event (handle->process gp-1) 'play-anim)
      (suspend)
      (while (movie?)
        (suspend)
        )
      (let ((a0-18 (handle->process gp-1)))
        (if a0-18
            (deactivate a0-18)
            )
        )
      )
    (case (get-task-status (game-task finalboss-movies))
      (((task-status unknown))
       (go robotboss-daxter-sacrifice-movie)
       )
      (else
        (go robotboss-yellow-dark-bomb-wait)
        )
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate robotboss-yellow-dark-bomb (robotboss)
  :enter (behavior ()
    (set! (-> self old-loc quad) (-> self desired-loc quad))
    (set-vector! (-> self desired-loc) 16384.0 -81920.0 716800.0 1.0)
    (set! (-> self loc-t) 0.0)
    (set! (-> self loc-t-start) (-> *display* game-frame-counter))
    (set! (-> self loc-t-duration) (seconds 4))
    (set! (-> self desired-pool-y) -16384.0)
    (play-ambient (-> self ambient) "GOL-AM01" #t (the-as vector #f))
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans (the-as (state robotboss) #f))
    (spool-push *art-control* "finalbosscam-white-eco" 0 self (the-as float -1.0))
    (if (>= (-> self loc-t) 1.0)
        (go robotboss-white-eco-movie)
        )
    (robotboss-position)
    (none)
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.2))
    (ja :group! robotboss-dark-reveal-no-yellow-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (when (not (ja-group? robotboss-idle-hover-no-yellow-ja))
      (ja-channel-push! 1 (seconds 0.2))
      (ja :group! robotboss-idle-hover-no-yellow-ja)
      )
    (loop
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; definition for function robotboss-yellowshot
;; INFO: Used lq/sq
;; INFO: Return type mismatch sound-id vs none.
(defbehavior robotboss-yellowshot robotboss ()
  (+! (-> self children-spawned) 1)
  (let ((gp-0 (new 'stack-no-clear 'vector)))
    (let ((s5-0 (new 'stack-no-clear 'vector)))
      (vector<-cspace! gp-0 (-> self node-list data 21))
      (set! (-> gp-0 y) 1972633.6)
      (if *target*
          (set! (-> s5-0 quad) (-> (target-pos 0) quad))
          (set! (-> s5-0 quad) (-> self entity extra trans quad))
          )
      (set! (-> s5-0 y) (+ 8192.0 (-> self entity extra trans y)))
      (vector-! s5-0 s5-0 gp-0)
      (vector-normalize! s5-0 (the-as float 819200.0))
      (vector+! s5-0 s5-0 gp-0)
      (process-spawn yellowshot gp-0 s5-0 0.0 750 :to self)
      )
    (send-event self 'flash 255.0)
    (process-spawn
      part-tracker
      :init part-tracker-init
      (-> *part-group-id-table* 642)
      300
      #f
      #f
      #f
      gp-0
      :to *entity-pool*
      )
    )
  (sound-play "bfg-fire")
  (none)
  )

;; definition for function robotboss-is-yellow-hit
(defbehavior robotboss-is-yellow-hit robotboss ()
  (or (ja-group? robotboss-yellow-hit-ja) (ja-group? robotboss-yellow-last-hit-ja))
  )

;; definition for function robotboss-time-to-shoot-yellow
(defbehavior robotboss-time-to-shoot-yellow robotboss ()
  (>= (- (-> *display* game-frame-counter) (-> self state-time)) (+ (-> self till-next-shot) 750))
  )

;; failed to figure out what this is:
(defstate robotboss-yellow-wait (robotboss)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (case arg2
      (('hit-jak)
       (let ((f0-2 (rand-float-gen)))
         (cond
           ((< 0.75 f0-2)
            (play-ambient (-> self ambient) "GOL-AM10" #t (the-as vector #f))
            )
           ((< 0.5 f0-2)
            (play-ambient (-> self ambient) "GOL-AM12" #t (the-as vector #f))
            )
           ((< 0.25 f0-2)
            (play-ambient (-> self ambient) "GOL-AM15" #t (the-as vector #f))
            )
           (else
             (play-ambient (-> self ambient) "MAI-AM03" #t (the-as vector #f))
             )
           )
         )
       )
      (('missed-jak)
       (let ((f0-5 (rand-float-gen)))
         (if (< 0.5 f0-5)
             (play-ambient (-> self ambient) "GOL-AM14" #t (the-as vector #f))
             (play-ambient (-> self ambient) "MAI-AM02" #t (the-as vector #f))
             )
         )
       )
      (else
        (robotboss-handler arg0 arg1 arg2 arg3)
        )
      )
    )
  :enter (behavior ()
    (set! (-> self hits-to-go) -1)
    (set! (-> self state-time) (-> *display* game-frame-counter))
    (set! (-> self till-next-shot) 300)
    (set! (-> self use-interesting) #t)
    (set! (-> self keep-charging) #f)
    (none)
    )
  :exit (behavior ()
    (let ((a0-1 (handle->process (-> self shot-attractor))))
      (if a0-1
          (deactivate a0-1)
          )
      )
    (let ((a1-1 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-1 from) self)
      (set! (-> a1-1 num-params) 1)
      (set! (-> a1-1 message) 'open)
      (set! (-> a1-1 param 0) (the-as uint (-> *part-group-id-table* 677)))
      (let ((t9-1 send-event-function)
            (v1-10 (-> self alts 4))
            )
        (t9-1
          (if v1-10
              (-> v1-10 extra process)
              )
          a1-1
          )
        )
      )
    (let ((a1-2 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-2 from) self)
      (set! (-> a1-2 num-params) 1)
      (set! (-> a1-2 message) 'open)
      (set! (-> a1-2 param 0) (the-as uint 0.4))
      (let ((t9-2 send-event-function)
            (v1-17 (-> self alts 0))
            )
        (t9-2
          (if v1-17
              (-> v1-17 extra process)
              )
          a1-2
          )
        )
      )
    (set! (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) prims 3 collide-with)
          (collide-kind)
          )
    (set! (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) prims 3 prim-core collide-as)
          (collide-kind)
          )
    (set! (-> self use-interesting) #f)
    (send-event *camera* 'point-of-interest #f)
    (if (nonzero? (-> self yellow-gun))
        (set-mode! (-> self yellow-gun) (joint-mod-handler-mode flex-blend))
        )
    (robotboss-yellow-eco-off)
    (robotboss-cut-cam-exit)
    (stop! (-> self looping-sound 3))
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans robotboss-yellow-dark-bomb)
    (robotboss-shooting-trans 21)
    (cond
      ((zero? (-> self hits-to-go))
       (set! (-> self keep-charging) #f)
       (stop! (-> self looping-sound 3))
       (robotboss-yellow-eco-off)
       (set! (-> self took-hit) #f)
       (+! (-> self hits-to-go) -1)
       (ja-channel-push! 1 (seconds 0.1))
       (ja :group! robotboss-yellow-last-hit-ja)
       (set! (-> self yellow-smoke) #t)
       (let ((gp-0 (new 'stack-no-clear 'vector)))
         (vector<-cspace! gp-0 (-> self node-list data 27))
         (process-spawn
           part-tracker
           :init part-tracker-init
           (-> *part-group-id-table* 653)
           300
           #f
           #f
           #f
           gp-0
           :to *entity-pool*
           )
         )
       (let ((gp-1 (manipy-spawn (-> self root-override trans) (-> self entity) *robotboss-yelloweco-sg* #f :to self)))
         (send-event (ppointer->process (-> self parent)) 'flash 255.0)
         (send-event (ppointer->process gp-1) 'anim-mode 'play1)
         (send-event (ppointer->process gp-1) 'rot-quat (-> self root-override quat))
         (send-event (ppointer->process gp-1) 'art-joint-anim "robotboss-yelloweco-yellow-last-hit")
         )
       )
      ((and (> (-> self hits-to-go) 0) (-> self took-hit))
       (if (not (play-ambient (-> self ambient) "GOL-AM17" #t (the-as vector #f)))
           (play-ambient (-> self ambient) "MAI-AM06" #t (the-as vector #f))
           )
       (set! (-> self took-hit) #f)
       (ja-channel-push! 1 (seconds 0.1))
       (ja :group! robotboss-yellow-hit-ja)
       )
      )
    (robotboss-position)
    (robotboss-cut-cam (the-as float 5.0) (the-as float 50.0) (the-as int robotboss-yellow-roar-ja))
    (when (and (-> self keep-charging)
               (>= (- (-> *display* game-frame-counter) (-> self state-time)) (-> self till-next-shot))
               )
      (let ((gp-2 (new 'stack-no-clear 'vector)))
        (update! (-> self looping-sound 3))
        (vector<-cspace! gp-2 (-> self node-list data 21))
        (spawn (-> self particle 6) gp-2)
        )
      )
    (none)
    )
  :code (behavior ()
    (ja-no-eval :num! (seek!))
    (while (not (ja-done? 0))
      (suspend)
      (ja-eval)
      )
    (robotboss-setup-for-hits 8 (-> self dda yellow-gun-hits))
    (if (nonzero? (-> self yellow-gun))
        (set-mode! (-> self yellow-gun) (joint-mod-handler-mode look-at))
        )
    (loop
      (when (not (robotboss-time-to-shoot-yellow))
        (when (not (ja-group? robotboss-yellow-idle-ja))
          (ja-channel-push! 1 (seconds 0.2))
          (ja :group! robotboss-yellow-idle-ja)
          )
        (if (>= (- (-> *display* game-frame-counter) (-> self state-time)) (-> self till-next-shot))
            (ja :num-func num-func-identity :frame-num 15.0)
            )
        (while (not (or (>= (- (-> *display* game-frame-counter) (-> self state-time)) (-> self till-next-shot))
                        (ja-group? robotboss-yellow-last-hit-ja)
                        )
                    )
          (when (not (ja-group? robotboss-yellow-idle-ja))
            (ja-channel-push! 1 (seconds 0.2))
            (ja :group! robotboss-yellow-idle-ja)
            )
          (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
          (until (ja-done? 0)
            (if (robotboss-is-yellow-hit)
                (goto cfg-36)
                )
            (suspend)
            (ja :num! (seek!))
            )
          )
        (label cfg-36)
        (when (not (robotboss-is-yellow-hit))
          (when (not (ja-group? robotboss-yellow-idle-ja))
            (ja-channel-push! 1 (seconds 0.2))
            (ja :group! robotboss-yellow-idle-ja)
            )
          (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
          (until (ja-done? 0)
            (if (robotboss-is-yellow-hit)
                (goto cfg-55)
                )
            (if (< 15.0 (ja-aframe-num 0))
                (set! (-> self keep-charging) #t)
                )
            (suspend)
            (ja :num! (seek!))
            )
          )
        )
      (label cfg-55)
      (when (and (not (ja-group? robotboss-yellow-last-hit-ja))
                 (or (robotboss-time-to-shoot-yellow) (not (ja-group? robotboss-yellow-hit-ja)))
                 )
        (set! (-> self state-time) (-> *display* game-frame-counter))
        (let ((f30-1 (-> self dda yellow-shot-time-min))
              (f28-0 (-> self dda yellow-shot-time-rnd))
              )
          (set! (-> self till-next-shot) (the int (+ f30-1 (the float (the int (* f28-0 (rand-float-gen)))))))
          )
        (stop! (-> self looping-sound 3))
        (robotboss-yellowshot)
        (robotboss-yellow-eco-on)
        (let ((f0-29 (rand-float-gen)))
          (cond
            ((< 0.8333333 f0-29)
             (play-ambient (-> self ambient) "GOL-AM04" #t (the-as vector #f))
             )
            ((< 0.6666667 f0-29)
             (play-ambient (-> self ambient) "GOL-AM09" #t (the-as vector #f))
             )
            ((< 0.5 f0-29)
             (play-ambient (-> self ambient) "GOL-AM08" #t (the-as vector #f))
             )
            ((< 0.33333334 f0-29)
             (play-ambient (-> self ambient) "GOL-AM10" #t (the-as vector #f))
             )
            ((< 0.16666667 f0-29)
             (play-ambient (-> self ambient) "MAI-AM03" #t (the-as vector #f))
             )
            (else
              (play-ambient (-> self ambient) "MAI-AM02" #t (the-as vector #f))
              )
            )
          )
        (ja-channel-push! 1 (seconds 0.05))
        (ja :group! robotboss-yellow-blast-ja)
        )
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      (when (ja-group? robotboss-yellow-last-hit-ja)
        (ja-no-eval :group! robotboss-yellow-roar-ja :num! (seek!) :frame-num 0.0)
        (until (ja-done? 0)
          (suspend)
          (ja :num! (seek!))
          )
        (go robotboss-yellow-dark-bomb)
        )
      )
    (none)
    )
  :post (behavior ()
    (when *target*
      (if (nonzero? (-> self yellow-gun))
          (set-target! (-> self yellow-gun) (target-pos 5))
          )
      )
    (transform-post)
    (none)
    )
  )

;; failed to figure out what this is:
(defstate robotboss-yellow (robotboss)
  :event robotboss-handler
  :enter (behavior ()
    (set! (-> self old-loc quad) (-> self desired-loc quad))
    (set-vector! (-> self desired-loc) 13653.333 77824.0 491520.0 1.0)
    (set! (-> self loc-t) 0.0)
    (set! (-> self loc-t-start) (-> *display* game-frame-counter))
    (set! (-> self loc-t-duration) (seconds 3))
    (set! (-> self desired-pool-y) -18432.0)
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans robotboss-yellow-wait)
    (if (>= (-> self loc-t) 1.0)
        (go robotboss-yellow-wait)
        )
    (robotboss-position)
    (none)
    )
  :code (behavior ()
    (ja-no-eval :num! (seek!))
    (while (not (ja-done? 0))
      (suspend)
      (ja-eval)
      )
    (ja-channel-push! 1 (seconds 0.2))
    (ja :group! robotboss-dark-return-after-red-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (loop
      (cond
        ((and *target* (< (+ 81920.0 (-> self entity extra trans y)) (-> (target-pos 0) y)))
         (when (not (ja-group? robotboss-idle-hover-lookup-no-red-ja))
           (ja-channel-push! 1 (seconds 0.8))
           (ja :group! robotboss-idle-hover-lookup-no-red-ja)
           )
         )
        ((not (ja-group? robotboss-idle-hover-no-red-ja))
         (ja-channel-push! 1 (seconds 0.2))
         (ja :group! robotboss-idle-hover-no-red-ja)
         )
        )
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; failed to figure out what this is:
(defstate robotboss-red-dark-bomb-wait (robotboss)
  :event robotboss-bomb-handler
  :enter (behavior ()
    (set! (-> self children-spawned) 0)
    (logior! (-> self alts 11 extra perm status) (entity-perm-status bit-3))
    (none)
    )
  :exit (behavior ()
    (set! (-> self ignore-camera) #f)
    (set! (-> self des-cam-entity) #f)
    (logclear! (-> self alts 11 extra perm status) (entity-perm-status bit-3))
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans robotboss-yellow)
    (if (and (< (-> self children-spawned) 0)
             (or (not *target*) (!= (-> *target* control unknown-surface00 name) 'launch-jump))
             )
        (go robotboss-yellow)
        )
    (robotboss-position)
    (none)
    )
  :code (behavior ()
    (ja-no-eval :num! (seek!))
    (while (not (ja-done? 0))
      (suspend)
      (ja-eval)
      )
    (ja-channel-push! 1 (seconds 0.1))
    (ja :group! robotboss-dark-shoot-no-red-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (when (and (>= (ja-frame-num 0) 15.0) (< (-> self children-spawned) 1))
        (robotboss-darkecobomb (new 'static 'vector :y 32768.0) (-> self dda red-bomb-time))
        (set! (-> self des-cam-entity) "camera-365")
        )
      (suspend)
      (ja :num! (seek!))
      )
    (loop
      (when (not (ja-group? robotboss-idle-hover-no-red-ja))
        (ja-channel-push! 1 (seconds 0.2))
        (ja :group! robotboss-idle-hover-no-red-ja)
        )
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; failed to figure out what this is:
(defstate robotboss-red-dark-bomb (robotboss)
  :enter (behavior ()
    (set! (-> self old-loc quad) (-> self desired-loc quad))
    (set-vector! (-> self desired-loc) 0.0 -81920.0 716800.0 1.0)
    (set! (-> self loc-t) 0.0)
    (set! (-> self loc-t-start) (-> *display* game-frame-counter))
    (set! (-> self loc-t-duration) (seconds 3))
    (set! (-> self desired-pool-y) -20480.0)
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans robotboss-red-dark-bomb-wait)
    (robotboss-position)
    (if (>= (-> self loc-t) 1.0)
        (go robotboss-red-dark-bomb-wait)
        )
    (none)
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.2))
    (ja :group! robotboss-dark-reveal-no-red-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (when (not (ja-group? robotboss-idle-hover-no-red-ja))
      (ja-channel-push! 1 (seconds 0.2))
      (ja :group! robotboss-idle-hover-no-red-ja)
      )
    (loop
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; definition of type redshot-launch-info
(deftype redshot-launch-info (structure)
  ((dest        vector     :inline :offset-assert   0)
   (flight-time time-frame         :offset-assert  16)
   (stall-time  time-frame         :offset-assert  24)
   )
  :method-count-assert 9
  :size-assert         #x20
  :flag-assert         #x900000020
  )

;; definition for method 3 of type redshot-launch-info
(defmethod inspect redshot-launch-info ((obj redshot-launch-info))
  (format #t "[~8x] ~A~%" obj 'redshot-launch-info)
  (format #t "~Tdest: #<vector @ #x~X>~%" (-> obj dest))
  (format #t "~Tflight-time: ~D~%" (-> obj flight-time))
  (format #t "~Tstall-time: ~D~%" (-> obj stall-time))
  obj
  )

;; definition of type redshot-launch-array
(deftype redshot-launch-array (structure)
  ((info redshot-launch-info 6 :inline :offset-assert   0)
   )
  :method-count-assert 9
  :size-assert         #xc0
  :flag-assert         #x9000000c0
  )

;; definition for method 3 of type redshot-launch-array
(defmethod inspect redshot-launch-array ((obj redshot-launch-array))
  (format #t "[~8x] ~A~%" obj 'redshot-launch-array)
  (format #t "~Tinfo[6] @ #x~X~%" (-> obj info))
  obj
  )

;; definition for function robotboss-redshot-fill-array
;; INFO: Used lq/sq
;; INFO: Return type mismatch symbol vs none.
(defbehavior robotboss-redshot-fill-array robotboss ((arg0 redshot-launch-array))
  (let ((s2-0 0)
        (s4-0 (new 'stack-no-clear 'vector))
        (s5-0 (new-stack-vector0))
        )
    0.0
    (dotimes (s3-0 6)
      (let ((s1-0 (-> arg0 info s3-0)))
        (let ((f30-0 -40960.0)
              (f28-0 81920.0)
              )
          (set! (-> s1-0 dest x) (+ f30-0 (* f28-0 (rand-float-gen))))
          )
        (set! (-> s1-0 dest y) 0.0)
        (let ((f30-1 -40960.0)
              (f28-1 81920.0)
              )
          (set! (-> s1-0 dest z) (+ f30-1 (* f28-1 (rand-float-gen))))
          )
        (set! (-> s1-0 dest w) 1.0)
        )
      (dotimes (s1-1 s3-0)
        (vector-! s4-0 (the-as vector (-> arg0 info s3-0)) (the-as vector (-> arg0 info s1-1)))
        (let ((f0-13 (vector-length-squared s4-0)))
          (if (< f0-13 1073741800.0)
              (vector+float*!
                (the-as vector (-> arg0 info s3-0))
                (the-as vector (-> arg0 info s1-1))
                s4-0
                (/ 32768.0 (sqrtf f0-13))
                )
              )
          )
        )
      (vector+! s5-0 s5-0 (the-as vector (-> arg0 info s3-0)))
      (let* ((f30-2 60.0)
             (v1-27 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
             (v1-28 (the-as number (logior #x3f800000 v1-27)))
             )
        (set! (-> arg0 info s3-0 flight-time)
              (the-as time-frame (+ (the int (* f30-2 (+ -1.0 (the-as float v1-28)))) 180))
              )
        )
      (let ((s1-3 (max 150 (- (the-as time-frame s2-0) (-> arg0 info s3-0 flight-time))))
            (f30-3 60.0)
            )
        (set! (-> arg0 info s3-0 stall-time) (the-as time-frame (+ (the int (* f30-3 (rand-float-gen))) 300 s1-3)))
        )
      (set! s2-0 (the-as int (+ (-> arg0 info s3-0 flight-time) (-> arg0 info s3-0 stall-time))))
      )
    (vector-float*! s5-0 s5-0 0.16666667)
    (vector-! s5-0 (-> self entity extra trans) s5-0)
    (dotimes (v1-53 6)
      (vector+! (the-as vector (-> arg0 info v1-53)) (the-as vector (-> arg0 info v1-53)) s5-0)
      (set! (-> arg0 info v1-53 dest y) (+ 2048.0 (-> arg0 info v1-53 dest y)))
      )
    )
  (none)
  )

;; definition for function robotboss-redshot
;; INFO: Used lq/sq
;; ERROR: Stack slot load at 64 mismatch: defined as size 4, got size 16
(defbehavior robotboss-redshot robotboss ((arg0 redshot-launch-info) (arg1 symbol))
  (local-vars (sv-32 redshot-launch-info) (sv-48 vector) (sv-64 float) (sv-80 time-frame) (sv-96 time-frame))
  (set! sv-32 arg0)
  (let ((s5-0 arg1))
    (+! (-> self children-spawned) 1)
    (let ((gp-0 (new 'stack-no-clear 'vector)))
      (vector<-cspace! gp-0 (-> self node-list data 40))
      (let ((s4-0 (get-process *default-dead-pool* redshot #x4000)))
        (when s4-0
          (let ((t9-2 (method-of-type redshot activate)))
            (t9-2 (the-as redshot s4-0) self 'redshot (the-as pointer #x70004000))
            )
          (let ((s3-0 run-function-in-process)
                (s2-0 s4-0)
                (s1-0 redshot-init-by-other)
                (s0-0 gp-0)
                )
            (set! sv-48 (-> sv-32 dest))
            (let ((f30-0 20480.0)
                  (f28-0 12288.0)
                  )
              (set! sv-64 (+ f30-0 (* f28-0 (rand-float-gen))))
              )
            (set! sv-80 (-> sv-32 flight-time))
            (set! sv-96 (-> sv-32 stall-time))
            (let* ((f30-1 300.0)
                   (v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
                   (v1-20 (the-as number (logior #x3f800000 v1-19)))
                   (t3-0 (the int (* f30-1 (+ -1.0 (the-as float v1-20)))))
                   )
              ((the-as (function object object object object object object object object none) s3-0)
               s2-0
               s1-0
               s0-0
               sv-48
               sv-64
               sv-80
               sv-96
               t3-0
               )
              )
            )
          (-> s4-0 ppointer)
          )
        )
      (when s5-0
        (process-spawn
          part-tracker
          :init part-tracker-init
          (-> *part-group-id-table* 641)
          300
          #f
          #f
          #f
          gp-0
          :to *entity-pool*
          )
        (sound-play "red-fire")
        )
      )
    )
  )

;; definition for function robotboss-is-red-hit
(defbehavior robotboss-is-red-hit robotboss ()
  (or (ja-group? robotboss-red-hit-ja) (ja-group? robotboss-red-last-hit-ja))
  )

;; failed to figure out what this is:
(defstate robotboss-red-wait (robotboss)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (case arg2
      (('hit-jak)
       (let ((f0-2 (rand-float-gen)))
         (cond
           ((< 0.75 f0-2)
            (play-ambient (-> self ambient) "GOL-AM10" #t (the-as vector #f))
            )
           ((< 0.5 f0-2)
            (play-ambient (-> self ambient) "GOL-AM12" #t (the-as vector #f))
            )
           ((< 0.25 f0-2)
            (play-ambient (-> self ambient) "GOL-AM15" #t (the-as vector #f))
            )
           (else
             (play-ambient (-> self ambient) "MAI-AM03" #t (the-as vector #f))
             )
           )
         )
       )
      (('missed-jak)
       (let ((f0-5 (rand-float-gen)))
         (if (< 0.5 f0-5)
             (play-ambient (-> self ambient) "GOL-AM14" #t (the-as vector #f))
             (play-ambient (-> self ambient) "MAI-AM01" #t (the-as vector #f))
             )
         )
       )
      (else
        (robotboss-handler arg0 arg1 arg2 arg3)
        )
      )
    )
  :enter (behavior ()
    (set! (-> self hits-to-go) -1)
    (set! (-> self des-cam-entity) "camera-390")
    (set! (-> self use-interesting) #t)
    (set! (-> self state-time) (-> *display* game-frame-counter))
    (set! (-> self till-next-shot) 0)
    0
    (none)
    )
  :exit (behavior ()
    (let ((a0-1 (handle->process (-> self shot-attractor))))
      (if a0-1
          (deactivate a0-1)
          )
      )
    (let ((a1-1 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-1 from) self)
      (set! (-> a1-1 num-params) 1)
      (set! (-> a1-1 message) 'open)
      (set! (-> a1-1 param 0) (the-as uint (-> *part-group-id-table* 676)))
      (let ((t9-1 send-event-function)
            (v1-10 (-> self alts 1))
            )
        (t9-1
          (if v1-10
              (-> v1-10 extra process)
              )
          a1-1
          )
        )
      )
    (let ((a1-2 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-2 from) self)
      (set! (-> a1-2 num-params) 1)
      (set! (-> a1-2 message) 'open)
      (set! (-> a1-2 param 0) (the-as uint 0.3))
      (let ((t9-2 send-event-function)
            (v1-17 (-> self alts 0))
            )
        (t9-2
          (if v1-17
              (-> v1-17 extra process)
              )
          a1-2
          )
        )
      )
    (set! (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) prims 5 collide-with)
          (collide-kind)
          )
    (set! (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) prims 5 prim-core collide-as)
          (collide-kind)
          )
    (set! (-> self use-interesting) #f)
    (set! (-> self des-cam-entity) #f)
    (robotboss-yellow-eco-off)
    (let ((a1-3 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-3 from) self)
      (set! (-> a1-3 num-params) 0)
      (set! (-> a1-3 message) 'show)
      (let ((t9-4 send-event-function)
            (v1-27 (-> self alts 11))
            )
        (t9-4
          (if v1-27
              (-> v1-27 extra process)
              )
          a1-3
          )
        )
      )
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans robotboss-red-dark-bomb)
    (robotboss-shooting-trans 40)
    (cond
      ((zero? (-> self hits-to-go))
       (robotboss-yellow-eco-off)
       (let ((a1-0 (new 'stack-no-clear 'event-message-block)))
         (set! (-> a1-0 from) self)
         (set! (-> a1-0 num-params) 0)
         (set! (-> a1-0 message) 'show)
         (let ((t9-3 send-event-function)
               (v1-3 (-> self alts 11))
               )
           (t9-3
             (if v1-3
                 (-> v1-3 extra process)
                 )
             a1-0
             )
           )
         )
       (set! (-> self took-hit) #f)
       (+! (-> self hits-to-go) -1)
       (ja-channel-push! 1 (seconds 0.1))
       (ja :group! robotboss-red-last-hit-ja)
       (set! (-> self red-smoke) #t)
       (let ((gp-0 (new 'stack-no-clear 'vector)))
         (vector<-cspace! gp-0 (-> self node-list data 51))
         (process-spawn
           part-tracker
           :init part-tracker-init
           (-> *part-group-id-table* 649)
           300
           #f
           #f
           #f
           gp-0
           :to *entity-pool*
           )
         )
       (let ((gp-1 (manipy-spawn (-> self root-override trans) (-> self entity) *robotboss-redeco-sg* #f :to self)))
         (send-event (ppointer->process (-> self parent)) 'flash 255.0)
         (send-event (ppointer->process gp-1) 'anim-mode 'play1)
         (send-event (ppointer->process gp-1) 'rot-quat (-> self root-override quat))
         (send-event (ppointer->process gp-1) 'art-joint-anim "robotboss-redeco-red-last-hit")
         )
       )
      ((and (> (-> self hits-to-go) 0) (-> self took-hit))
       (if (not (play-ambient (-> self ambient) "GOL-AM17" #t (the-as vector #f)))
           (play-ambient (-> self ambient) "MAI-AM06" #t (the-as vector #f))
           )
       (set! (-> self took-hit) #f)
       (ja-channel-push! 1 (seconds 0.1))
       (ja :group! robotboss-red-hit-ja)
       )
      )
    (robotboss-position)
    (none)
    )
  :code (behavior ()
    (ja-no-eval :num! (seek!))
    (while (not (ja-done? 0))
      (suspend)
      (ja-eval)
      )
    (robotboss-setup-for-hits 1 5)
    (loop
      (until (or (>= (- (-> *display* game-frame-counter) (-> self state-time)) (-> self till-next-shot))
                 (ja-group? robotboss-red-last-hit-ja)
                 )
        (ja-channel-push! 1 (seconds 0.2))
        (ja :group! robotboss-red-idle-ja)
        (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
        (until (ja-done? 0)
          (if (ja-group? robotboss-red-last-hit-ja)
              (goto cfg-24)
              )
          (suspend)
          (ja :num! (seek!))
          )
        )
      (label cfg-24)
      (set! (-> self state-time) (-> *display* game-frame-counter))
      (let ((f30-0 (-> self dda red-shot-time-min))
            (f28-0 (-> self dda red-shot-time-rnd))
            )
        (set! (-> self till-next-shot) (the int (+ f30-0 (the float (the int (* f28-0 (rand-float-gen)))))))
        )
      (when (not (robotboss-is-red-hit))
        (ja-channel-push! 1 (seconds 0.2))
        (ja :group! robotboss-red-charge-ja)
        (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
        (until (ja-done? 0)
          (update! (-> self looping-sound 2))
          (let ((gp-0 (new 'stack-no-clear 'vector)))
            (vector<-cspace! gp-0 (-> self node-list data 40))
            (spawn (-> self particle 5) gp-0)
            )
          (if (robotboss-is-red-hit)
              (goto cfg-37)
              )
          (suspend)
          (ja :num! (seek!))
          )
        (label cfg-37)
        (stop! (-> self looping-sound 2))
        )
      (when (not (ja-group? robotboss-red-last-hit-ja))
        (let ((f30-1 (rand-float-gen))
              (gp-1 (new 'stack-no-clear 'redshot-launch-array))
              (s5-0 (-> self dda red-shots-min))
              )
          (robotboss-yellow-eco-on)
          (robotboss-redshot-fill-array gp-1)
          (robotboss-redshot (the-as redshot-launch-info (-> gp-1 info)) #t)
          (let* ((v1-127 (+ s5-0 (the int (* f30-1 (the float (-> self dda red-shots-rnd))))))
                 (s5-1 (+ (min 6 v1-127) -1))
                 )
            (dotimes (s4-0 s5-1)
              (robotboss-redshot (-> gp-1 info (+ s4-0 1)) #f)
              )
            )
          )
        )
      (when (not (robotboss-is-red-hit))
        (let ((f0-33 (rand-float-gen)))
          (cond
            ((< 0.8333333 f0-33)
             (play-ambient (-> self ambient) "GOL-AM04" #t (the-as vector #f))
             )
            ((< 0.6666667 f0-33)
             (play-ambient (-> self ambient) "GOL-AM05" #t (the-as vector #f))
             )
            ((< 0.5 f0-33)
             (play-ambient (-> self ambient) "GOL-AM08" #t (the-as vector #f))
             )
            ((< 0.33333334 f0-33)
             (play-ambient (-> self ambient) "GOL-AM10" #t (the-as vector #f))
             )
            ((< 0.16666667 f0-33)
             (play-ambient (-> self ambient) "MAI-AM03" #t (the-as vector #f))
             )
            (else
              (play-ambient (-> self ambient) "MAI-AM02" #t (the-as vector #f))
              )
            )
          )
        (ja :group! robotboss-red-blast-ja)
        )
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      (when (ja-group? robotboss-red-last-hit-ja)
        (ja-no-eval :group! robotboss-red-roar-ja :num! (seek!) :frame-num 0.0)
        (until (ja-done? 0)
          (suspend)
          (ja :num! (seek!))
          )
        (go robotboss-red-dark-bomb)
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; failed to figure out what this is:
(defstate robotboss-red (robotboss)
  :event robotboss-handler
  :enter (behavior ()
    (set! (-> self old-loc quad) (-> self desired-loc quad))
    (set-vector! (-> self desired-loc) 8192.0 -40960.0 327680.0 1.0)
    (set! (-> self loc-t) 0.0)
    (set! (-> self loc-t-start) (-> *display* game-frame-counter))
    (set! (-> self loc-t-duration) (seconds 3))
    (set! (-> self desired-pool-y) -22528.0)
    (set-setting! 'sound-flava #f 40.0 (music-flava finalboss-end))
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans robotboss-red-wait)
    (if (>= (-> self loc-t) 1.0)
        (go robotboss-red-wait)
        )
    (robotboss-position)
    (none)
    )
  :code (behavior ()
    (ja-no-eval :num! (seek!))
    (while (not (ja-done? 0))
      (suspend)
      (ja-eval)
      )
    (ja-channel-push! 1 (seconds 0.2))
    (ja :group! robotboss-dark-return-after-green-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (loop
      (when (not (ja-group? robotboss-idle-hover-no-blue-ja))
        (ja-channel-push! 1 (seconds 0.2))
        (ja :group! robotboss-idle-hover-no-blue-ja)
        )
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; failed to figure out what this is:
(defstate robotboss-green-dark-bomb-wait (robotboss)
  :event robotboss-bomb-handler
  :enter (behavior ()
    (set! (-> self children-spawned) 0)
    0
    (none)
    )
  :exit (behavior ()
    (set! (-> self ignore-camera) #f)
    (set! (-> self des-cam-entity) #f)
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans robotboss-red)
    (if (and (< (-> self children-spawned) 0)
             (or (not *target*) (!= (-> *target* control unknown-surface00 name) 'launch-jump))
             )
        (go robotboss-red)
        )
    (robotboss-position)
    (none)
    )
  :code (behavior ()
    (ja-no-eval :num! (seek!))
    (while (not (ja-done? 0))
      (suspend)
      (ja-eval)
      )
    (ja-channel-push! 1 (seconds 0.1))
    (ja :group! robotboss-dark-shoot-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (when (and (>= (ja-frame-num 0) 15.0) (< (-> self children-spawned) 1))
        (robotboss-darkecobomb (new 'static 'vector :y 32768.0) (-> self dda green-bomb-time))
        (set! (-> self des-cam-entity) "camera-365")
        (play-ambient (-> self ambient) "GOL-AM11" #t (the-as vector #f))
        )
      (suspend)
      (ja :num! (seek!))
      )
    (loop
      (when (not (ja-group? robotboss-idle-hover-no-blue-ja))
        (ja-channel-push! 1 (seconds 0.2))
        (ja :group! robotboss-idle-hover-no-blue-ja)
        )
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; failed to figure out what this is:
(defstate robotboss-green-dark-bomb (robotboss)
  :enter (behavior ()
    (set! (-> self old-loc quad) (-> self desired-loc quad))
    (set-vector! (-> self desired-loc) 16384.0 -81920.0 716800.0 1.0)
    (set! (-> self loc-t) 0.0)
    (set! (-> self loc-t-start) (-> *display* game-frame-counter))
    (set! (-> self loc-t-duration) (seconds 3))
    (set! (-> self desired-pool-y) -24576.0)
    (play-ambient (-> self ambient) "MAI-AM01" #t (the-as vector #f))
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans robotboss-green-dark-bomb-wait)
    (robotboss-position)
    (if (>= (-> self loc-t) 1.0)
        (go robotboss-green-dark-bomb-wait)
        )
    (none)
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.2))
    (ja :group! robotboss-dark-reveal-green-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (when (not (ja-group? robotboss-idle-hover-no-blue-ja))
      (ja-channel-push! 1 (seconds 0.2))
      (ja :group! robotboss-idle-hover-no-blue-ja)
      )
    (loop
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; definition for function robotboss-greenshot
;; INFO: Used lq/sq
;; INFO: Return type mismatch sound-id vs none.
(defbehavior robotboss-greenshot robotboss ((arg0 vector) (arg1 float) (arg2 int) (arg3 symbol))
  (+! (-> self children-spawned) 1)
  (let ((gp-0 (new 'stack-no-clear 'vector)))
    (let ((s2-0 (new 'stack-no-clear 'vector)))
      (vector<-cspace! gp-0 (-> self node-list data 68))
      (set! (-> s2-0 quad) (-> self entity extra trans quad))
      (set! (-> s2-0 y) (+ -40960.0 (-> s2-0 y)))
      (vector+! s2-0 s2-0 arg0)
      (process-spawn greenshot gp-0 s2-0 arg1 arg2 :to self)
      )
    (when arg3
      (process-spawn
        part-tracker
        :init part-tracker-init
        (-> *part-group-id-table* 640)
        300
        #f
        #f
        #f
        gp-0
        :to *entity-pool*
        )
      (sound-play "green-fire")
      )
    )
  (none)
  )

;; failed to figure out what this is:
(defstate robotboss-green-wait (robotboss)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (case arg2
      (('trigger)
       (ja-channel-push! 1 (seconds 0.2))
       (ja :group! robotboss-green-roar-ja)
       (robotboss-yellow-eco-off)
       (let ((a1-2 (new 'stack-no-clear 'event-message-block)))
         (set! (-> a1-2 from) self)
         (set! (-> a1-2 num-params) 0)
         (set! (-> a1-2 message) 'show)
         (let ((t9-2 send-event-function)
               (v1-5 (-> self alts 11))
               )
           (t9-2
             (if v1-5
                 (-> v1-5 extra process)
                 )
             a1-2
             )
           )
         )
       )
      (('hit-jak)
       (let ((f0-2 (rand-float-gen)))
         (cond
           ((< 0.75 f0-2)
            (play-ambient (-> self ambient) "GOL-AM10" #t (the-as vector #f))
            )
           ((< 0.5 f0-2)
            (play-ambient (-> self ambient) "GOL-AM12" #t (the-as vector #f))
            )
           ((< 0.25 f0-2)
            (play-ambient (-> self ambient) "GOL-AM15" #t (the-as vector #f))
            )
           (else
             (play-ambient (-> self ambient) "MAI-AM03" #t (the-as vector #f))
             )
           )
         )
       )
      (('blob-died)
       (let ((f0-5 (rand-float-gen)))
         (cond
           ((< 0.75 f0-5)
            (play-ambient (-> self ambient) "MAI-AM02" #t (the-as vector #f))
            )
           ((< 0.5 f0-5)
            (play-ambient (-> self ambient) "GOL-AM03" #t (the-as vector #f))
            )
           ((< 0.25 f0-5)
            (play-ambient (-> self ambient) "GOL-AM14" #t (the-as vector #f))
            )
           (else
             (play-ambient (-> self ambient) "GOL-AM02" #t (the-as vector #f))
             )
           )
         )
       )
      (else
        (robotboss-handler arg0 arg1 arg2 arg3)
        )
      )
    )
  :enter (behavior ()
    (set! (-> self state-time) (-> *display* game-frame-counter))
    (set! (-> self children-spawned) 0)
    (robotboss-setup-for-hits 2 5)
    (set! (-> self des-cam-entity) "camera-385")
    (none)
    )
  :exit (behavior ()
    (let ((a0-1 (handle->process (-> self shot-attractor))))
      (if a0-1
          (deactivate a0-1)
          )
      )
    (let ((a1-1 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-1 from) self)
      (set! (-> a1-1 num-params) 1)
      (set! (-> a1-1 message) 'open)
      (set! (-> a1-1 param 0) (the-as uint (-> *part-group-id-table* 675)))
      (let ((t9-1 send-event-function)
            (v1-10 (-> self alts 2))
            )
        (t9-1
          (if v1-10
              (-> v1-10 extra process)
              )
          a1-1
          )
        )
      )
    (let ((a1-2 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-2 from) self)
      (set! (-> a1-2 num-params) 1)
      (set! (-> a1-2 message) 'open)
      (set! (-> a1-2 param 0) (the-as uint 0.2))
      (let ((t9-2 send-event-function)
            (v1-17 (-> self alts 0))
            )
        (t9-2
          (if v1-17
              (-> v1-17 extra process)
              )
          a1-2
          )
        )
      )
    (set! (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) prims 9 collide-with)
          (collide-kind)
          )
    (set! (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) prims 9 prim-core collide-as)
          (collide-kind)
          )
    (set! (-> self des-cam-entity) #f)
    (robotboss-yellow-eco-off)
    (let ((a1-3 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-3 from) self)
      (set! (-> a1-3 num-params) 0)
      (set! (-> a1-3 message) 'show)
      (let ((t9-4 send-event-function)
            (v1-27 (-> self alts 11))
            )
        (t9-4
          (if v1-27
              (-> v1-27 extra process)
              )
          a1-3
          )
        )
      )
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans robotboss-green-dark-bomb)
    (cond
      ((and (>= (- (-> *display* game-frame-counter) (-> self state-time)) (seconds 0.4))
            (< (-> self children-spawned) 1)
            )
       (robotboss-greenshot (new 'static 'vector) (the-as float 24576.0) 600 #t)
       (ja-channel-push! 1 (seconds 0.2))
       (ja :group! robotboss-green-spawn-ja)
       )
      ((and (>= (- (-> *display* game-frame-counter) (-> self state-time)) (seconds 1.2))
            (< (-> self children-spawned) 3)
            )
       (robotboss-greenshot (new 'static 'vector :x 8192.0) (the-as float 16384.0) 600 #t)
       (robotboss-greenshot (new 'static 'vector :z 8192.0) (the-as float 32768.0) 660 #f)
       (ja-channel-push! 1 (seconds 0.2))
       (ja :group! robotboss-green-spawn-ja)
       )
      ((and (>= (- (-> *display* game-frame-counter) (-> self state-time)) (seconds 2.6))
            (< (-> self children-spawned) 6)
            )
       (robotboss-greenshot (new 'static 'vector :z 12288.0) (the-as float 20480.0) 600 #t)
       (robotboss-greenshot (new 'static 'vector :x 8192.0) (the-as float 8192.0) 660 #f)
       (robotboss-greenshot (new 'static 'vector) (the-as float 36864.0) 720 #f)
       (ja-channel-push! 1 (seconds 0.2))
       (ja :group! robotboss-green-spawn-ja)
       )
      ((and (>= (- (-> *display* game-frame-counter) (-> self state-time)) (seconds 4))
            (< (-> self children-spawned) 7)
            )
       (robotboss-greenshot (new 'static 'vector) (the-as float 24576.0) 600 #t)
       (ja-channel-push! 1 (seconds 0.2))
       (ja :group! robotboss-green-spawn-ja)
       )
      ((and (>= (- (-> *display* game-frame-counter) (-> self state-time)) (seconds 5.5))
            (< (-> self children-spawned) 9)
            )
       (robotboss-greenshot (new 'static 'vector) (the-as float 12288.0) 600 #t)
       (robotboss-greenshot (new 'static 'vector :x 4096.0 :z 12288.0) (the-as float 32768.0) 600 #f)
       (ja-channel-push! 1 (seconds 0.2))
       (ja :group! robotboss-green-spawn-ja)
       )
      ((and (>= (- (-> *display* game-frame-counter) (-> self state-time)) (seconds 8))
            (< (-> self children-spawned) 10)
            )
       (+! (-> self children-spawned) 1)
       (process-spawn
         green-eco-lurker-gen
         (-> self entity)
         (-> self entity extra trans)
         (-> self dda num-blobs)
         :to self
         )
       (set! (-> self old-loc quad) (-> self desired-loc quad))
       (set-vector! (-> self desired-loc) 24576.0 0.0 655360.0 1.0)
       (set! (-> self loc-t) 0.0)
       (set! (-> self loc-t-start) (-> *display* game-frame-counter))
       (set! (-> self loc-t-duration) (seconds 3))
       (set! (-> self desired-pool-y) -26624.0)
       )
      ((and (>= (- (-> *display* game-frame-counter) (-> self state-time)) (seconds 8.2))
            (< (-> self children-spawned) 11)
            )
       (+! (-> self children-spawned) 1)
       (robotboss-yellow-eco-on)
       )
      )
    (robotboss-position)
    (none)
    )
  :code (behavior ()
    (ja-no-eval :num! (seek!))
    (while (not (ja-done? 0))
      (suspend)
      (ja-eval)
      )
    (loop
      (cond
        ((ja-group? robotboss-green-roar-ja)
         (go robotboss-green-dark-bomb)
         )
        ((not (ja-group? robotboss-idle-hover-no-blue-ja))
         (ja-channel-push! 1 (seconds 0.2))
         (ja :group! robotboss-idle-hover-no-blue-ja)
         )
        )
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; failed to figure out what this is:
(defstate robotboss-green (robotboss)
  :event robotboss-handler
  :enter (behavior ()
    (set! (-> self old-loc quad) (-> self desired-loc quad))
    (set-vector! (-> self desired-loc) 24576.0 0.0 245760.0 1.0)
    (set! (-> self loc-t) 0.0)
    (set! (-> self loc-t-start) (-> *display* game-frame-counter))
    (set! (-> self loc-t-duration) (seconds 3))
    (set! (-> self desired-pool-y) -26624.0)
    (play-ambient (-> self ambient) "GOL-AM01" #t (the-as vector #f))
    (set-setting! 'sound-flava #f 40.0 (music-flava finalboss-middle))
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans robotboss-green-wait)
    (if (>= (-> self loc-t) 1.0)
        (go robotboss-green-wait)
        )
    (robotboss-position)
    (none)
    )
  :code (behavior ()
    (ja-no-eval :num! (seek!))
    (while (not (ja-done? 0))
      (suspend)
      (ja-eval)
      )
    (ja-channel-push! 1 (seconds 0.2))
    (ja :group! robotboss-dark-return-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (loop
      (when (not (ja-group? robotboss-idle-hover-no-blue-ja))
        (ja-channel-push! 1 (seconds 0.2))
        (ja :group! robotboss-idle-hover-no-blue-ja)
        )
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; failed to figure out what this is:
(defstate robotboss-blue-dark-bomb-wait (robotboss)
  :event robotboss-bomb-handler
  :enter (behavior ()
    (set! (-> self children-spawned) 0)
    0
    (none)
    )
  :exit (behavior ()
    (set! (-> self ignore-camera) #f)
    (set! (-> self des-cam-entity) #f)
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans robotboss-green)
    (if (and (< (-> self children-spawned) 0)
             (or (not *target*) (!= (-> *target* control unknown-surface00 name) 'launch-jump))
             )
        (go robotboss-green)
        )
    (robotboss-position)
    (none)
    )
  :code (behavior ()
    (ja-no-eval :num! (seek!))
    (while (not (ja-done? 0))
      (suspend)
      (ja-eval)
      )
    (ja-channel-push! 1 (seconds 0.1))
    (ja :group! robotboss-dark-shoot-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (when (and (>= (ja-frame-num 0) 15.0) (< (-> self children-spawned) 1))
        (robotboss-darkecobomb (new 'static 'vector :y 32768.0) (the-as float 3600.0))
        (set! (-> self des-cam-entity) "camera-365")
        (play-ambient (-> self ambient) "MAI-AM04" #t (the-as vector #f))
        )
      (suspend)
      (ja :num! (seek!))
      )
    (loop
      (cond
        ((and *target* (< (+ 81920.0 (-> self entity extra trans y)) (-> (target-pos 0) y)))
         (when (not (ja-group? robotboss-idle-hover-lookup-no-blue-ja))
           (ja-channel-push! 1 (seconds 0.8))
           (ja :group! robotboss-idle-hover-lookup-no-blue-ja)
           )
         )
        ((not (ja-group? robotboss-idle-hover-no-blue-ja))
         (ja-channel-push! 1 (seconds 0.2))
         (ja :group! robotboss-idle-hover-no-blue-ja)
         )
        )
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; failed to figure out what this is:
(defstate robotboss-blue-dark-bomb (robotboss)
  :enter (behavior ()
    (set! (-> self old-loc quad) (-> self desired-loc quad))
    (set-vector! (-> self desired-loc) 16384.0 -118784.0 614400.0 1.0)
    (set! (-> self loc-t) 0.0)
    (set! (-> self loc-t-start) (-> *display* game-frame-counter))
    (set! (-> self loc-t-duration) (seconds 3))
    (set! (-> self desired-pool-y) -28672.0)
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans robotboss-blue-dark-bomb-wait)
    (robotboss-position)
    (if (>= (-> self loc-t) 1.0)
        (go robotboss-blue-dark-bomb-wait)
        )
    (none)
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.2))
    (ja :group! robotboss-dark-reveal-ja)
    (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (when (not (ja-group? robotboss-idle-hover-no-blue-ja))
      (ja-channel-push! 1 (seconds 0.2))
      (ja :group! robotboss-idle-hover-no-blue-ja)
      )
    (loop
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; definition for function robotboss-blue-beam
;; INFO: Used lq/sq
;; INFO: Return type mismatch object vs none.
(defbehavior robotboss-blue-beam robotboss ((arg0 int) (arg1 symbol))
  (let ((s4-0 (new 'stack-no-clear 'vector))
        (gp-0 (new 'stack-no-clear 'vector))
        )
    (let ((s3-0 (new 'stack-no-clear 'vector)))
      (set! (-> gp-0 quad) (-> self entity extra trans quad))
      (vector<-cspace! s4-0 (-> self node-list data arg0))
      (vector-! s3-0 gp-0 s4-0)
      (let ((f30-0 (vector-y-angle s3-0))
            (f0-1 (- 16384.0 (vector-x-angle s3-0)))
            )
        (set! (-> *part-id-table* 2546 init-specs 14 initial-valuef) f30-0)
        (set! (-> *part-id-table* 2546 init-specs 13 initial-valuef) f0-1)
        (set! (-> *part-id-table* 2548 init-specs 14 initial-valuef) f30-0)
        (set! (-> *part-id-table* 2548 init-specs 13 initial-valuef) f0-1)
        (set! (-> *part-id-table* 2545 init-specs 14 initial-valuef) f30-0)
        (set! (-> *part-id-table* 2545 init-specs 13 initial-valuef) f0-1)
        )
      )
    (cond
      ((and (>= (- (-> *display* game-frame-counter) (-> self state-time)) (seconds 0.4))
            (ja-group? robotboss-idle-blue-ja)
            )
       (spawn (-> self particle 0) s4-0)
       (when (and arg1 (nonzero? (-> self looping-sound 0)))
         (update! (-> self looping-sound 0))
         (when (and *target*
                    (zero? (logand (-> *target* state-flags)
                                   (state-flags being-attacked invulnerable timed-invulnerable invuln-powerup do-not-notice dying)
                                   )
                           )
                    )
           (let ((t2-0 (new 'stack-no-clear 'collide-tri-result))
                 (a2-0 (new 'stack-no-clear 'vector))
                 )
             (vector-! a2-0 gp-0 s4-0)
             (if (>= (fill-and-probe-using-line-sphere
                       *collide-cache*
                       s4-0
                       a2-0
                       (the-as float 4096.0)
                       (collide-kind target)
                       self
                       t2-0
                       (new 'static 'pat-surface :noentity #x1)
                       )
                     0.0
                     )
                 (send-event *target* 'attack #f (static-attack-info ((shove-up (meters 2.5)) (shove-back (meters 7.5)))))
                 )
             )
           )
         )
       )
      ((nonzero? (-> self looping-sound 0))
       (stop! (-> self looping-sound 0))
       )
      )
    (cond
      ((and (>= (- (-> *display* game-frame-counter) (-> self state-time)) (seconds 1.4))
            (not (ja-group? robotboss-blue-roar-ja))
            )
       (spawn (-> self particle 1) gp-0)
       (when (and arg1 (nonzero? (-> self looping-sound 1)))
         (update! (-> self looping-sound 1))
         (if (and *target*
                  (zero? (logand (-> *target* state-flags)
                                 (state-flags being-attacked invulnerable timed-invulnerable invuln-powerup do-not-notice dying)
                                 )
                         )
                  (>= 8192.0 (vector-vector-distance gp-0 (target-pos 0)))
                  )
             (send-event *target* 'attack #f (static-attack-info ((shove-up (meters 2.5)) (shove-back (meters 7.5)))))
             )
         )
       )
      ((nonzero? (-> self looping-sound 1))
       (stop! (-> self looping-sound 1))
       )
      )
    )
  (none)
  )

;; definition for function robotboss-set-dda
;; INFO: Return type mismatch robotboss-dda vs none.
(defbehavior robotboss-set-dda robotboss ()
  0
  (let ((gp-0 (-> self entity extra perm)))
    (logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage))
    (seekl! (-> gp-0 user-int8 0) 255 1)
    (let ((v1-5 (-> gp-0 user-int8 0)))
      (set! (-> self dda) (cond
                            ((< 15 v1-5)
                             (new 'static 'robotboss-dda
                               :blue-bomb-time 4800.0
                               :num-blobs 8
                               :green-bomb-time 4200.0
                               :red-shots-min 3
                               :red-shot-time-min 5400.0
                               :red-shot-time-rnd 600.0
                               :red-bomb-time 3600.0
                               :yellow-shot-time-min 1800.0
                               :yellow-gun-hits 7
                               :yellow-bomb-time 4800.0
                               )
                             )
                            ((< 10 v1-5)
                             (new 'static 'robotboss-dda
                               :blue-bomb-time 4800.0
                               :num-blobs 10
                               :green-bomb-time 4200.0
                               :red-shots-min 4
                               :red-shot-time-min 4800.0
                               :red-shot-time-rnd 600.0
                               :red-bomb-time 3600.0
                               :yellow-shot-time-min 1500.0
                               :yellow-gun-hits 10
                               :yellow-bomb-time 4800.0
                               )
                             )
                            ((< 5 v1-5)
                             (new 'static 'robotboss-dda
                               :blue-bomb-time 4800.0
                               :num-blobs 11
                               :green-bomb-time 4200.0
                               :red-shots-min 4
                               :red-shot-time-min 4200.0
                               :red-shot-time-rnd 600.0
                               :red-bomb-time 3600.0
                               :yellow-shot-time-min 1200.0
                               :yellow-gun-hits 13
                               :yellow-bomb-time 4800.0
                               )
                             )
                            (else
                              (new 'static 'robotboss-dda
                                :blue-bomb-time 4800.0
                                :num-blobs 12
                                :green-bomb-time 4200.0
                                :red-shots-min 5
                                :red-shot-time-min 3600.0
                                :red-shot-time-rnd 600.0
                                :red-bomb-time 3600.0
                                :yellow-shot-time-min 900.0
                                :yellow-gun-hits 16
                                :yellow-bomb-time 4800.0
                                )
                              )
                            )
            )
      )
    )
  (none)
  )

;; definition for function robotboss-blue-done
(defbehavior robotboss-blue-done robotboss ()
  (robotboss-yellow-eco-off)
  (let ((a1-0 (new 'stack-no-clear 'event-message-block)))
    (set! (-> a1-0 from) self)
    (set! (-> a1-0 num-params) 0)
    (set! (-> a1-0 message) 'show)
    (let ((t9-1 send-event-function)
          (v1-1 (-> self alts 11))
          )
      (t9-1
        (if v1-1
            (-> v1-1 extra process)
            )
        a1-0
        )
      )
    )
  )

;; failed to figure out what this is:
(defstate robotboss-blue-wait (robotboss)
  :event robotboss-handler
  :enter (behavior ()
    (set! (-> self state-time) (-> *display* game-frame-counter))
    (robotboss-setup-for-hits 4 5)
    (let ((a1-1 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-1 from) self)
      (set! (-> a1-1 num-params) 0)
      (set! (-> a1-1 message) 'hide)
      (let ((t9-1 send-event-function)
            (v1-3 (-> self alts 11))
            )
        (t9-1
          (if v1-3
              (-> v1-3 extra process)
              )
          a1-1
          )
        )
      )
    (process-entity-status! self (entity-perm-status bit-3) #t)
    (set! (-> self use-interesting) #t)
    (robotboss-yellow-eco-on)
    (none)
    )
  :exit (behavior ()
    (let ((a0-1 (handle->process (-> self shot-attractor))))
      (if a0-1
          (deactivate a0-1)
          )
      )
    (let ((a1-1 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-1 from) self)
      (set! (-> a1-1 num-params) 1)
      (set! (-> a1-1 message) 'open)
      (set! (-> a1-1 param 0) (the-as uint (-> *part-group-id-table* 674)))
      (let ((t9-1 send-event-function)
            (v1-10 (-> self alts 3))
            )
        (t9-1
          (if v1-10
              (-> v1-10 extra process)
              )
          a1-1
          )
        )
      )
    (let ((a1-2 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-2 from) self)
      (set! (-> a1-2 num-params) 1)
      (set! (-> a1-2 message) 'open)
      (set! (-> a1-2 param 0) (the-as uint 0.1))
      (let ((t9-2 send-event-function)
            (v1-17 (-> self alts 0))
            )
        (t9-2
          (if v1-17
              (-> v1-17 extra process)
              )
          a1-2
          )
        )
      )
    (set! (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) prims 0 collide-with)
          (collide-kind)
          )
    (set! (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) prims 0 prim-core collide-as)
          (collide-kind)
          )
    (set! (-> self use-interesting) #f)
    (send-event *camera* 'point-of-interest #f)
    (robotboss-blue-done)
    (if (nonzero? (-> self looping-sound 0))
        (stop! (-> self looping-sound 0))
        )
    (if (nonzero? (-> self looping-sound 1))
        (stop! (-> self looping-sound 1))
        )
    (robotboss-set-dda)
    (robotboss-cut-cam-exit)
    (none)
    )
  :trans (behavior ()
    (robotboss-always-trans robotboss-blue-dark-bomb)
    (robotboss-shooting-trans 9)
    (cond
      ((zero? (-> self hits-to-go))
       (play-ambient (-> self ambient) "GOL-AM06" #t (the-as vector #f))
       (robotboss-blue-done)
       (set! (-> self took-hit) #f)
       (+! (-> self hits-to-go) -1)
       (ja-channel-push! 1 (seconds 0.1))
       (ja :group! robotboss-blue-last-hit-ja)
       (sound-play "explod-eye")
       (set! (-> self blue-smoke) #t)
       (let ((gp-1 (new 'stack-no-clear 'vector)))
         (vector<-cspace! gp-1 (-> self node-list data 7))
         (process-spawn
           part-tracker
           :init part-tracker-init
           (-> *part-group-id-table* 644)
           300
           #f
           #f
           #f
           gp-1
           :to *entity-pool*
           )
         )
       (let ((gp-2 (manipy-spawn (-> self root-override trans) (-> self entity) *robotboss-blueeco-sg* #f :to self)))
         (send-event (ppointer->process (-> self parent)) 'flash 255.0)
         (send-event (ppointer->process gp-2) 'anim-mode 'play1)
         (send-event (ppointer->process gp-2) 'rot-quat (-> self root-override quat))
         (send-event (ppointer->process gp-2) 'art-joint-anim "robotboss-blueeco-blue-last-hit")
         )
       )
      ((-> self took-hit)
       (if (not (play-ambient (-> self ambient) "GOL-AM17" #t (the-as vector #f)))
           (play-ambient (-> self ambient) "MAI-AM06" #t (the-as vector #f))
           )
       (set! (-> self took-hit) #f)
       (ja-channel-push! 1 (seconds 0.1))
       (ja :group! robotboss-blue-hit-ja)
       )
      )
    (when (not (or (ja-group? robotboss-blue-roar-ja) (ja-group? robotboss-blue-last-hit-ja)))
      )
    (robotboss-blue-beam 8 #t)
    (robotboss-blue-beam 9 #f)
    (when (TODO-RENAME-10 (-> self ambient) (new 'stack-no-clear 'vector) (seconds 10) (the-as float 327680.0) self)
      (let ((f0-2 (rand-float-gen)))
        (cond
          ((< 0.8 f0-2)
           (play-ambient (-> self ambient) "GOL-AM02" #t (the-as vector #f))
           )
          ((< 0.6 f0-2)
           (play-ambient (-> self ambient) "GOL-AM10" #t (the-as vector #f))
           )
          ((< 0.4 f0-2)
           (play-ambient (-> self ambient) "MAI-AM08" #t (the-as vector #f))
           )
          ((< 0.2 f0-2)
           (play-ambient (-> self ambient) "MAI-AM03" #t (the-as vector #f))
           )
          (else
            (play-ambient (-> self ambient) "GOL-AM07" #t (the-as vector #f))
            )
          )
        )
      )
    (robotboss-position)
    (robotboss-cut-cam (the-as float 5.0) (the-as float 50.0) (the-as int robotboss-blue-roar-ja))
    (none)
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.4))
    (ja-no-eval :group! robotboss-idle-blue-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (loop
      (when (not (ja-group? robotboss-idle-blue-ja))
        (ja-channel-push! 1 (seconds 0.2))
        (ja :group! robotboss-idle-blue-ja)
        )
      (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      (when (<= (-> self hits-to-go) 0)
        (let ((a1-6 (new 'stack-no-clear 'event-message-block)))
          (set! (-> a1-6 from) self)
          (set! (-> a1-6 num-params) 1)
          (set! (-> a1-6 message) 'target)
          (set! (-> a1-6 param 0) (the-as uint 0.0))
          (let ((t9-8 send-event-function)
                (v1-69 (-> self alts 12))
                )
            (t9-8
              (if v1-69
                  (-> v1-69 extra process)
                  )
              a1-6
              )
            )
          )
        (ja-channel-push! 1 (seconds 0.1))
        (ja :group! robotboss-blue-roar-ja)
        (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
        (until (ja-done? 0)
          (suspend)
          (ja :num! (seek!))
          )
        (go robotboss-blue-dark-bomb)
        )
      )
    (none)
    )
  :post (the-as (function none :behavior robotboss) transform-post)
  )

;; definition for method 11 of type robotboss
;; INFO: Used lq/sq
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! robotboss ((obj robotboss) (arg0 entity-actor))
  (stack-size-set! (-> obj main-thread) 512)
  (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player))))
    (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s4-0 reaction) default-collision-reaction)
    (set! (-> s4-0 no-reaction)
          (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
          )
    (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 19) 0)))
      (set! (-> s3-0 prim-core collide-as) (collide-kind ground-object))
      (set! (-> s3-0 collide-with) (collide-kind target))
      (set! (-> s3-0 prim-core action) (collide-action solid))
      (set! (-> s3-0 transform-index) 0)
      (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 368640.0)
      (set-root-prim! s4-0 s3-0)
      (let ((s2-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 4))))
        (set! (-> s2-0 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-0 collide-with) (collide-kind target))
        (set! (-> s2-0 prim-core action) (collide-action solid))
        (set! (-> s2-0 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-0 transform-index) 7)
        (set-vector! (-> s2-0 local-sphere) 0.0 0.0 0.0 32768.0)
        (append-prim s3-0 s2-0)
        )
      (let ((s2-1 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0))))
        (set! (-> s2-1 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-1 collide-with) (collide-kind target))
        (set! (-> s2-1 prim-core action) (collide-action solid))
        (set! (-> s2-1 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-1 transform-index) 6)
        (set-vector! (-> s2-1 local-sphere) 0.0 0.0 0.0 57344.0)
        (append-prim s3-0 s2-1)
        )
      (let ((s2-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 2) (the-as uint 0))))
        (set! (-> s2-2 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-2 collide-with) (collide-kind target))
        (set! (-> s2-2 prim-core action) (collide-action solid))
        (set! (-> s2-2 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-2 transform-index) 6)
        (set-vector! (-> s2-2 local-sphere) 0.0 -57344.0 61440.0 73728.0)
        (append-prim s3-0 s2-2)
        )
      (let ((s2-3 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 3) (the-as uint 8))))
        (set! (-> s2-3 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-3 collide-with) (collide-kind target))
        (set! (-> s2-3 prim-core action) (collide-action solid))
        (set! (-> s2-3 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-3 transform-index) 16)
        (set-vector! (-> s2-3 local-sphere) 0.0 -20480.0 69632.0 237568.0)
        (append-prim s3-0 s2-3)
        )
      (let ((s2-4 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 4) (the-as uint 0))))
        (set! (-> s2-4 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-4 collide-with) (collide-kind target))
        (set! (-> s2-4 prim-core action) (collide-action solid))
        (set! (-> s2-4 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-4 transform-index) 14)
        (set-vector! (-> s2-4 local-sphere) 0.0 0.0 0.0 81920.0)
        (append-prim s3-0 s2-4)
        )
      (let ((s2-5 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 5) (the-as uint 1))))
        (set! (-> s2-5 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-5 collide-with) (collide-kind target))
        (set! (-> s2-5 prim-core action) (collide-action solid))
        (set! (-> s2-5 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-5 transform-index) 39)
        (set-vector! (-> s2-5 local-sphere) 0.0 0.0 0.0 69632.0)
        (append-prim s3-0 s2-5)
        )
      (let ((s2-6 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 6) (the-as uint 0))))
        (set! (-> s2-6 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-6 collide-with) (collide-kind target))
        (set! (-> s2-6 prim-core action) (collide-action solid))
        (set! (-> s2-6 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-6 transform-index) 31)
        (set-vector! (-> s2-6 local-sphere) 0.0 -57344.0 0.0 90112.0)
        (append-prim s3-0 s2-6)
        )
      (let ((s2-7 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 7) (the-as uint 0))))
        (set! (-> s2-7 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-7 collide-with) (collide-kind target))
        (set! (-> s2-7 prim-core action) (collide-action solid))
        (set! (-> s2-7 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-7 transform-index) 30)
        (set-vector! (-> s2-7 local-sphere) 0.0 24576.0 0.0 81920.0)
        (append-prim s3-0 s2-7)
        )
      (let ((s2-8 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 8) (the-as uint 0))))
        (set! (-> s2-8 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-8 collide-with) (collide-kind target))
        (set! (-> s2-8 prim-core action) (collide-action solid))
        (set! (-> s2-8 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-8 transform-index) 57)
        (set-vector! (-> s2-8 local-sphere) 0.0 0.0 0.0 81920.0)
        (append-prim s3-0 s2-8)
        )
      (let ((s2-9 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 9) (the-as uint 2))))
        (set! (-> s2-9 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-9 collide-with) (collide-kind target))
        (set! (-> s2-9 prim-core action) (collide-action solid))
        (set! (-> s2-9 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-9 transform-index) 68)
        (set-vector! (-> s2-9 local-sphere) 0.0 0.0 0.0 49152.0)
        (append-prim s3-0 s2-9)
        )
      (let ((s2-10 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 10) (the-as uint 0))))
        (set! (-> s2-10 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-10 collide-with) (collide-kind target))
        (set! (-> s2-10 prim-core action) (collide-action solid))
        (set! (-> s2-10 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-10 transform-index) 4)
        (set-vector! (-> s2-10 local-sphere) 0.0 24576.0 0.0 102400.0)
        (append-prim s3-0 s2-10)
        )
      (let ((s2-11 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 11) (the-as uint 0))))
        (set! (-> s2-11 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-11 collide-with) (collide-kind target))
        (set! (-> s2-11 prim-core action) (collide-action solid))
        (set! (-> s2-11 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-11 transform-index) 77)
        (set-vector! (-> s2-11 local-sphere) 0.0 0.0 0.0 73728.0)
        (append-prim s3-0 s2-11)
        )
      (let ((s2-12 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 12) (the-as uint 0))))
        (set! (-> s2-12 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-12 collide-with) (collide-kind target))
        (set! (-> s2-12 prim-core action) (collide-action solid))
        (set! (-> s2-12 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-12 transform-index) 75)
        (set-vector! (-> s2-12 local-sphere) 0.0 24576.0 0.0 81920.0)
        (append-prim s3-0 s2-12)
        )
      (let ((s2-13 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 13) (the-as uint 0))))
        (set! (-> s2-13 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-13 collide-with) (collide-kind target))
        (set! (-> s2-13 prim-core action) (collide-action solid))
        (set! (-> s2-13 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-13 transform-index) 74)
        (set-vector! (-> s2-13 local-sphere) 0.0 40960.0 0.0 73728.0)
        (append-prim s3-0 s2-13)
        )
      (let ((s2-14 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 14) (the-as uint 0))))
        (set! (-> s2-14 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-14 collide-with) (collide-kind target))
        (set! (-> s2-14 prim-core action) (collide-action solid))
        (set! (-> s2-14 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-14 transform-index) 73)
        (set-vector! (-> s2-14 local-sphere) 0.0 32768.0 0.0 61440.0)
        (append-prim s3-0 s2-14)
        )
      (let ((s2-15 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 15) (the-as uint 0))))
        (set! (-> s2-15 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-15 collide-with) (collide-kind target))
        (set! (-> s2-15 prim-core action) (collide-action solid))
        (set! (-> s2-15 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-15 transform-index) 84)
        (set-vector! (-> s2-15 local-sphere) 0.0 40960.0 -8192.0 98304.0)
        (append-prim s3-0 s2-15)
        )
      (let ((s2-16 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 16) (the-as uint 0))))
        (set! (-> s2-16 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-16 collide-with) (collide-kind target))
        (set! (-> s2-16 prim-core action) (collide-action solid))
        (set! (-> s2-16 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-16 transform-index) 83)
        (set-vector! (-> s2-16 local-sphere) 0.0 65536.0 0.0 73728.0)
        (append-prim s3-0 s2-16)
        )
      (let ((s2-17 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 17) (the-as uint 0))))
        (set! (-> s2-17 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-17 collide-with) (collide-kind target))
        (set! (-> s2-17 prim-core action) (collide-action solid))
        (set! (-> s2-17 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-17 transform-index) 82)
        (set-vector! (-> s2-17 local-sphere) 0.0 32768.0 0.0 61440.0)
        (append-prim s3-0 s2-17)
        )
      (let ((s2-18 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 18) (the-as uint 0))))
        (set! (-> s2-18 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s2-18 collide-with) (collide-kind target))
        (set! (-> s2-18 prim-core action) (collide-action solid))
        (set! (-> s2-18 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-18 transform-index) 3)
        (set-vector! (-> s2-18 local-sphere) 0.0 0.0 0.0 61440.0)
        (append-prim s3-0 s2-18)
        )
      )
    (set! (-> s4-0 nav-radius) 4096.0)
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *robotboss-sg* '())
  (aybabtu 2)
  (set! (-> obj nav) (new 'process 'nav-control (-> obj root-override) 16 (the-as float 40960.0)))
  (logior! (-> obj nav flags) (nav-control-flags display-marks navcf3 navcf5 navcf6 navcf7))
  (logclear! (-> obj root-override nav-flags) (nav-flags navf0))
  (set! (-> obj path) (new 'process 'path-control obj 'path (the-as float 0.0)))
  (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text))
  (logclear! (-> obj mask) (process-mask actor-pause))
  (set! (-> obj root-override pause-adjust-distance) 1228800.0)
  (set-vector! (-> obj old-loc) 8192.0 0.0 245760.0 1.0)
  (set! (-> obj desired-loc quad) (-> obj old-loc quad))
  (set! (-> obj loc-t) 1.0)
  (set! (-> obj loc-t-duration) 1)
  (set! (-> obj loc-t-start) 0)
  (set! (-> obj shot-attractor) (the-as handle #f))
  (set! (-> obj white-eco) (the-as handle #f))
  (set! (-> obj desired-pool-y) -30720.0)
  (set! (-> obj des-cam-entity) #f)
  (set! (-> obj use-interesting) #f)
  (set! (-> obj ignore-camera) #f)
  (dotimes (v1-211 13)
    (set! (-> obj alts v1-211) #f)
    )
  (let ((s5-1 (entity-actor-count (-> obj entity) 'alt-actor)))
    (dotimes (s4-1 (min 13 s5-1))
      (set! (-> obj alts s4-1) (entity-actor-lookup (-> obj entity) 'alt-actor s4-1))
      )
    )
  (set! (-> obj particle 0) (create-launch-control (-> *part-group-id-table* 636) obj))
  (set! (-> obj particle 1) (create-launch-control (-> *part-group-id-table* 637) obj))
  (set! (-> obj particle 2) (create-launch-control (-> *part-group-id-table* 645) obj))
  (set! (-> obj particle 3) (create-launch-control (-> *part-group-id-table* 650) obj))
  (set! (-> obj particle 4) (create-launch-control (-> *part-group-id-table* 654) obj))
  (set! (-> obj particle 5) (create-launch-control (-> *part-group-id-table* 646) obj))
  (set! (-> obj particle 6) (create-launch-control (-> *part-group-id-table* 651) obj))
  (set! (-> obj looping-sound 0)
        (new 'process 'ambient-sound (static-sound-spec "robo-blue-lp" :fo-max 80) (-> obj root-override trans))
        )
  (set! (-> obj looping-sound 1)
        (new 'process 'ambient-sound (static-sound-spec "eco-torch" :fo-max 80) (-> obj root-override trans))
        )
  (set! (-> obj looping-sound 2)
        (new 'process 'ambient-sound (static-sound-spec "red-buzz" :fo-max 80) (-> obj root-override trans))
        )
  (set! (-> obj looping-sound 3)
        (new 'process 'ambient-sound (static-sound-spec "bfg-buzz" :fo-max 80) (-> obj root-override trans))
        )
  (set! (-> obj blue-smoke) #f)
  (set! (-> obj red-smoke) #f)
  (set! (-> obj yellow-smoke) #f)
  (dummy-9 (-> obj ambient))
  (set! (-> obj yellow-gun) (new 'process 'joint-mod (joint-mod-handler-mode flex-blend) obj 16))
  (set-vector! (-> obj yellow-gun twist-max) 8192.0 8192.0 0.0 1.0)
  (set! (-> obj yellow-gun up) (the-as uint 1))
  (set! (-> obj yellow-gun nose) (the-as uint 2))
  (set! (-> obj yellow-gun ear) (the-as uint 0))
  (set! (-> obj yellow-gun max-dist) 819200.0)
  (set! (-> obj yellow-gun ignore-angle) 16384.0)
  (set! (-> obj palette-val) 0.0)
  (set! (-> obj dda) (new 'static 'robotboss-dda
                       :blue-bomb-time 4200.0
                       :num-blobs 12
                       :green-bomb-time 4200.0
                       :red-shots-min 5
                       :red-shot-time-min 3600.0
                       :red-shot-time-rnd 600.0
                       :red-bomb-time 3600.0
                       :yellow-shot-time-min 900.0
                       :yellow-shot-time-rnd 600.0
                       :yellow-gun-hits 5
                       :yellow-bomb-time 3600.0
                       )
        )
  (go robotboss-blue-wait)
  (none)
  )
