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

;; name: stadium-obs.gc
;; name in dgo: stadium-obs
;; dgos: STAA

;; DECOMP BEGINS

(deftype stadium-flag-base (process-drawable)
  ()
  (:state-methods
    idle
    )
  (:methods
    (get-skel (_type_) art-group)
    (stadium-flag-base-method-22 (_type_) none)
    )
  )


(defstate idle (stadium-flag-base)
  :virtual #t
  :enter (behavior ()
    (ja :num-func num-func-identity :frame-num (the float (rand-vu-int-count (ja-num-frames 0))))
    )
  :trans (behavior ()
    (ja :num! (loop!))
    (if (ja-done? 0)
        (stadium-flag-base-method-22 self)
        )
    )
  :code sleep-code
  :post ja-post
  )

(defmethod stadium-flag-base-method-22 ((this stadium-flag-base))
  0
  (none)
  )

(defmethod init-from-entity! ((this stadium-flag-base) (arg0 entity-actor))
  "Set up a newly created process from the entity that created it."
  (set! (-> this root) (new 'process 'trsqv))
  (process-drawable-from-entity! this arg0)
  (initialize-skeleton this (the-as skeleton-group (get-skel this)) (the-as pair 0))
  (logclear! (-> this mask) (process-mask actor-pause))
  (go (method-of-object this idle))
  )

(deftype stadium-sails-left (stadium-flag-base)
  ()
  )


(defskelgroup skel-stadium-sails-left stadium-sails-left stadium-sails-left-lod0-jg stadium-sails-left-idle-ja
              ((stadium-sails-left-lod0-mg (meters 20)) (stadium-sails-left-lod1-mg (meters 999999)))
              :bounds (static-spherem -40 30 0 60)
              )

(defmethod get-skel ((this stadium-sails-left))
  (art-group-get-by-name *level* "skel-stadium-sails-left" (the-as (pointer level) #f))
  )

(deftype stadium-sails-right (stadium-flag-base)
  ()
  )


(defskelgroup skel-stadium-sails-right stadium-sails-right stadium-sails-right-lod0-jg stadium-sails-right-idle-ja
              ((stadium-sails-right-lod0-mg (meters 20)) (stadium-sails-right-lod1-mg (meters 999999)))
              :bounds (static-spherem -40 30 -30 60)
              )

(defmethod get-skel ((this stadium-sails-right))
  (art-group-get-by-name *level* "skel-stadium-sails-right" (the-as (pointer level) #f))
  )

(deftype rub-dark-jak-door (process-drawable)
  ((root          collide-shape :override)
   (played-hint?  symbol)
   (block?        symbol)
   )
  (:state-methods
    idle
    explode
    )
  (:methods
    (rub-dark-jak-door-method-22 (_type_) none)
    )
  )


(defskelgroup skel-rub-dark-jak-door rub-dark-jak-door rub-dark-jak-door-lod0-jg rub-dark-jak-door-idle-ja
              ((rub-dark-jak-door-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 4 0 8)
              )

(defstate idle (rub-dark-jak-door)
  :virtual #t
  :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
    (case message
      (('attack)
       (case (-> (the-as attack-info (-> block param 1)) mode)
         (('dark-smack)
          (if (not (-> self block?))
              (go-virtual explode)
              )
          )
         (else
           (when (not (-> self played-hint?))
             (if (not (-> self block?))
                 (talker-spawn-func (-> *talker-speech* 353) *entity-pool* (target-pos 0) (the-as region #f))
                 )
             (let ((v0-0 (the-as object #t)))
               (set! (-> self played-hint?) (the-as symbol v0-0))
               v0-0
               )
             )
           )
         )
       )
      )
    )
  :enter (behavior ()
    (set-time! (-> self state-time))
    )
  :trans (behavior ()
    (when (and (not (-> self played-hint?))
               (time-elapsed? (-> self state-time) (seconds 15))
               (< (if *target*
                      (vector-vector-xz-distance (-> self root trans) (-> *target* control trans))
                      4096000.0
                      )
                  102400.0
                  )
               )
      (if (not (-> self block?))
          (talker-spawn-func (-> *talker-speech* 353) *entity-pool* (target-pos 0) (the-as region #f))
          )
      (set! (-> self played-hint?) #t)
      )
    )
  :code (behavior ()
    (ja :group! (ja-group) :num! min)
    (transform-post)
    (sleep-code)
    )
  :post (behavior ()
    (when (not (-> self block?))
      (let ((gp-0 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> self root quat))))
        (matrix<-trans gp-0 (-> self root trans))
        (spawn-from-mat (-> self part) gp-0)
        )
      )
    )
  )

(defstate explode (rub-dark-jak-door)
  :virtual #t
  :code (behavior ()
    (let ((v1-1 (-> self root root-prim)))
      (set! (-> v1-1 prim-core collide-as) (collide-spec))
      (set! (-> v1-1 prim-core collide-with) (collide-spec))
      )
    0
    (sound-play "door-blow")
    (cond
      ((logtest? (-> *part-group-id-table* 1001 flags) (sp-group-flag sp13))
       (vector-copy! (-> *launch-matrix* trans) (-> self node-list data 3 bone transform trans))
       (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 1001))
       )
      (else
        (vector-copy! (-> *launch-matrix* trans) (-> self node-list data 3 bone transform trans))
        (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 1001))
        )
      )
    (ja-no-eval :group! rub-dark-jak-door-break-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (cleanup-for-death self)
    )
  :post transform-post
  )

(defmethod rub-dark-jak-door-method-22 ((this rub-dark-jak-door))
  (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player))))
    (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 1) 0)))
      (set! (-> s5-0 total-prims) (the-as uint 2))
      (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle camera-blocker))
      (set! (-> s4-0 prim-core action) (collide-action solid))
      (set! (-> s4-0 transform-index) 3)
      (set-vector! (-> s4-0 local-sphere) 0.0 8192.0 0.0 49152.0)
      (set! (-> s5-0 root-prim) s4-0)
      )
    (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle camera-blocker))
      (set! (-> v1-8 prim-core collide-with) (collide-spec jak player-list))
      (set! (-> v1-8 prim-core action) (collide-action solid))
      (set! (-> v1-8 transform-index) 3)
      (set-vector! (-> v1-8 local-sphere) 0.0 8192.0 0.0 49152.0)
      )
    (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
    (let ((v1-11 (-> s5-0 root-prim)))
      (set! (-> s5-0 backup-collide-as) (-> v1-11 prim-core collide-as))
      (set! (-> s5-0 backup-collide-with) (-> v1-11 prim-core collide-with))
      )
    (set! (-> this root) s5-0)
    )
  0
  (none)
  )

(defmethod init-from-entity! ((this rub-dark-jak-door) (arg0 entity-actor))
  "Set up a newly created process from the entity that created it."
  (when (and (task-node-closed? (game-task-node palace-ruins-patrol-resolution))
             (not (task-node-closed? (game-task-node palace-ruins-attack-resolution)))
             )
    (cleanup-for-death this)
    (return #f)
    )
  (rub-dark-jak-door-method-22 this)
  (process-drawable-from-entity! this arg0)
  (initialize-skeleton
    this
    (the-as skeleton-group (art-group-get-by-name *level* "skel-rub-dark-jak-door" (the-as (pointer level) #f)))
    (the-as pair 0)
    )
  (set! (-> this played-hint?) #f)
  (set! (-> this part) (create-launch-control (-> *part-group-id-table* 1002) this))
  (set! (-> this block?) (and (string= (-> this name) "rub-dark-jak-door-2")
                              (task-node-closed? (game-task-node desert-final-boss-resolution))
                              )
        )
  (go (method-of-object this idle))
  )

(deftype rub-falling-step (process-drawable)
  ((root  collide-shape :override)
   (mat   matrix         :inline)
   )
  (:state-methods
    idle
    drop
    fade-in
    )
  )


(defskelgroup skel-rub-falling-step rub-falling-step rub-falling-step-lod0-jg rub-falling-step-idle-ja
              ((rub-falling-step-lod0-mg (meters 20)) (rub-falling-step-lod1-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 8)
              )

(defstate idle (rub-falling-step)
  :virtual #t
  :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
    (case message
      (('ridden)
       (go-virtual drop)
       )
      )
    )
  :enter (behavior ()
    (set! (-> self draw force-lod) 1)
    (ja-no-eval :group! rub-falling-step-idle-ja :num! zero)
    (transform-post)
    )
  :trans rider-trans
  :code sleep-code
  )

(defstate drop (rub-falling-step)
  :virtual #t
  :enter (behavior ()
    (set! (-> self draw force-lod) 0)
    (set-time! (-> self state-time))
    (sound-play "falling-step")
    )
  :trans (behavior ()
    (if (time-elapsed? (-> self state-time) (seconds 0.2))
        (logclear! (-> self root root-prim prim-core action) (collide-action rideable))
        )
    (rider-trans)
    )
  :code (behavior ()
    (set! (-> self draw bounds w) 1228800.0)
    (ja-no-eval :group! rub-falling-step-break-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (until #f
      (if (< 28672.0 (vector-vector-distance (target-pos 0) (-> self root trans)))
          (go-virtual fade-in)
          )
      (suspend)
      )
    #f
    )
  :post rider-post
  )

(defstate fade-in (rub-falling-step)
  :virtual #t
  :enter (behavior ()
    (set-time! (-> self state-time))
    (logior! (-> self root root-prim prim-core action) (collide-action rideable))
    (set! (-> self draw force-lod) 1)
    )
  :exit (behavior ()
    (logclear! (-> self draw status) (draw-control-status force-fade))
    )
  :trans (behavior ()
    (let* ((f1-2 (* 0.0033333334 (the float (- (current-time) (-> self state-time)))))
           (f0-2 (fmax 0.0 (fmin 1.0 f1-2)))
           )
      (logior! (-> self draw status) (draw-control-status force-fade))
      (set! (-> self draw force-fade) (the-as uint (the int (* 128.0 f0-2))))
      (if (= f0-2 1.0)
          (go-virtual idle)
          )
      )
    (rider-trans)
    )
  :code (behavior ()
    (ja :group! rub-falling-step-idle-ja :num! zero)
    (sleep-code)
    )
  :post rider-post
  )

(defmethod init-from-entity! ((this rub-falling-step) (arg0 entity-actor))
  "Set up a newly created process from the entity that created it."
  (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player))))
    (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s4-0 reaction) cshape-reaction-default)
    (set! (-> s4-0 no-reaction)
          (the-as (function collide-shape-moving collide-query vector vector object) nothing)
          )
    (set! (-> s4-0 penetrated-by) (penetrate))
    (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 24) 0)))
      (set! (-> s4-0 total-prims) (the-as uint 25))
      (set! (-> s3-0 prim-core collide-as) (collide-spec pusher))
      (set! (-> s3-0 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> s3-0 prim-core action) (collide-action solid rideable))
      (set! (-> s3-0 transform-index) 2)
      (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 24576.0)
      (set! (-> s4-0 root-prim) s3-0)
      )
    (pusher-init s4-0)
    (let ((v1-15 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> v1-15 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-15 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-15 prim-core action) (collide-action solid rideable))
      (set! (-> v1-15 transform-index) 3)
      (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-17 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0))))
      (set! (-> v1-17 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-17 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-17 prim-core action) (collide-action solid rideable))
      (set! (-> v1-17 transform-index) 4)
      (set-vector! (-> v1-17 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-19 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 2) (the-as uint 0))))
      (set! (-> v1-19 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-19 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-19 prim-core action) (collide-action solid rideable))
      (set! (-> v1-19 transform-index) 5)
      (set-vector! (-> v1-19 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-21 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 3) (the-as uint 0))))
      (set! (-> v1-21 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-21 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-21 prim-core action) (collide-action solid rideable))
      (set! (-> v1-21 transform-index) 6)
      (set-vector! (-> v1-21 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-23 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 4) (the-as uint 0))))
      (set! (-> v1-23 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-23 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-23 prim-core action) (collide-action solid rideable))
      (set! (-> v1-23 transform-index) 7)
      (set-vector! (-> v1-23 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-25 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 5) (the-as uint 0))))
      (set! (-> v1-25 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-25 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-25 prim-core action) (collide-action solid rideable))
      (set! (-> v1-25 transform-index) 8)
      (set-vector! (-> v1-25 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-27 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 6) (the-as uint 0))))
      (set! (-> v1-27 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-27 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-27 prim-core action) (collide-action solid rideable))
      (set! (-> v1-27 transform-index) 9)
      (set-vector! (-> v1-27 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-29 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 7) (the-as uint 0))))
      (set! (-> v1-29 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-29 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-29 prim-core action) (collide-action solid rideable))
      (set! (-> v1-29 transform-index) 10)
      (set-vector! (-> v1-29 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-31 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 8) (the-as uint 0))))
      (set! (-> v1-31 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-31 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-31 prim-core action) (collide-action solid rideable))
      (set! (-> v1-31 transform-index) 11)
      (set-vector! (-> v1-31 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-33 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 9) (the-as uint 0))))
      (set! (-> v1-33 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-33 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-33 prim-core action) (collide-action solid rideable))
      (set! (-> v1-33 transform-index) 12)
      (set-vector! (-> v1-33 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-35 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 10) (the-as uint 0))))
      (set! (-> v1-35 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-35 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-35 prim-core action) (collide-action solid rideable))
      (set! (-> v1-35 transform-index) 13)
      (set-vector! (-> v1-35 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-37 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 11) (the-as uint 0))))
      (set! (-> v1-37 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-37 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-37 prim-core action) (collide-action solid rideable))
      (set! (-> v1-37 transform-index) 14)
      (set-vector! (-> v1-37 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-39 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 12) (the-as uint 0))))
      (set! (-> v1-39 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-39 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-39 prim-core action) (collide-action solid rideable))
      (set! (-> v1-39 transform-index) 15)
      (set-vector! (-> v1-39 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-41 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 13) (the-as uint 0))))
      (set! (-> v1-41 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-41 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-41 prim-core action) (collide-action solid rideable))
      (set! (-> v1-41 transform-index) 16)
      (set-vector! (-> v1-41 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-43 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 14) (the-as uint 0))))
      (set! (-> v1-43 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-43 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-43 prim-core action) (collide-action solid rideable))
      (set! (-> v1-43 transform-index) 17)
      (set-vector! (-> v1-43 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-45 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 15) (the-as uint 0))))
      (set! (-> v1-45 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-45 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-45 prim-core action) (collide-action solid rideable))
      (set! (-> v1-45 transform-index) 18)
      (set-vector! (-> v1-45 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-47 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 16) (the-as uint 0))))
      (set! (-> v1-47 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-47 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-47 prim-core action) (collide-action solid rideable))
      (set! (-> v1-47 transform-index) 19)
      (set-vector! (-> v1-47 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-49 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 17) (the-as uint 0))))
      (set! (-> v1-49 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-49 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-49 prim-core action) (collide-action solid rideable))
      (set! (-> v1-49 transform-index) 20)
      (set-vector! (-> v1-49 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-51 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 18) (the-as uint 0))))
      (set! (-> v1-51 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-51 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-51 prim-core action) (collide-action solid rideable))
      (set! (-> v1-51 transform-index) 21)
      (set-vector! (-> v1-51 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-53 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 19) (the-as uint 0))))
      (set! (-> v1-53 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-53 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-53 prim-core action) (collide-action solid rideable))
      (set! (-> v1-53 transform-index) 22)
      (set-vector! (-> v1-53 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-55 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 20) (the-as uint 0))))
      (set! (-> v1-55 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-55 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-55 prim-core action) (collide-action solid rideable))
      (set! (-> v1-55 transform-index) 23)
      (set-vector! (-> v1-55 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-57 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 21) (the-as uint 0))))
      (set! (-> v1-57 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-57 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-57 prim-core action) (collide-action solid rideable))
      (set! (-> v1-57 transform-index) 24)
      (set-vector! (-> v1-57 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-59 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 22) (the-as uint 0))))
      (set! (-> v1-59 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-59 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-59 prim-core action) (collide-action solid rideable))
      (set! (-> v1-59 transform-index) 25)
      (set-vector! (-> v1-59 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (let ((v1-61 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 23) (the-as uint 0))))
      (set! (-> v1-61 prim-core collide-as) (collide-spec pusher))
      (set! (-> v1-61 prim-core collide-with) (collide-spec jak hit-by-others-list player-list))
      (set! (-> v1-61 prim-core action) (collide-action solid rideable))
      (set! (-> v1-61 transform-index) 26)
      (set-vector! (-> v1-61 local-sphere) 0.0 0.0 0.0 24576.0)
      )
    (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
    (let ((v1-64 (-> s4-0 root-prim)))
      (set! (-> s4-0 backup-collide-as) (-> v1-64 prim-core collide-as))
      (set! (-> s4-0 backup-collide-with) (-> v1-64 prim-core collide-with))
      )
    (set! (-> this root) s4-0)
    )
  (process-drawable-from-entity! this arg0)
  (initialize-skeleton
    this
    (the-as skeleton-group (art-group-get-by-name *level* "skel-rub-falling-step" (the-as (pointer level) #f)))
    (the-as pair 0)
    )
  (set! (-> this part) (create-launch-control (-> *part-group-id-table* 150) this))
  (quaternion->matrix (-> this mat) (-> this root quat))
  (vector-copy! (-> this mat trans) (-> this root trans))
  (go (method-of-object this idle))
  )

(deftype rub-rhino-door (process-focusable)
  ()
  (:state-methods
    idle
    explode
    )
  (:methods
    (init-collision! (_type_) none)
    (impact-breaks-door? (_type_ rigid-body-impact wvehicle) symbol)
    (go-explode (_type_) none)
    (do-explode (_type_) none)
    )
  )


(defskelgroup skel-rub-rhino-door rub-rhino-door rub-rhino-door-lod0-jg rub-rhino-door-idle-ja
              ((rub-rhino-door-lod0-mg (meters 999999)))
              :bounds (static-spherem -2 0 0 30)
              :origin-joint-index 3
              )

(define *rub-rhino-door-exploder-params*
  (new 'static 'joint-exploder-static-params
    :joints (new 'static 'boxed-array :type joint-exploder-static-joint-params
      (new 'static 'joint-exploder-static-joint-params :joint-index 3 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 4 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 5 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 6 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 7 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 8 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 9 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 10 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 11 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 12 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 13 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 14 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 15 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 16 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 17 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 18 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 19 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 20 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 21 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 22 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 23 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 24 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 25 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 26 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 27 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 28 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 29 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 30 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 31 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 32 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 33 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 34 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 35 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 36 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 37 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 38 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 39 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 40 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 41 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 42 :parent-joint-index -1)
      )
    :collide-spec (collide-spec backgnd)
    :art-level #f
    )
  )

(defstate idle (rub-rhino-door)
  :virtual #t
  :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
    (case message
      (('trigger)
       (go-virtual explode)
       )
      (('impact-impulse)
       (let ((a1-4 (-> block param 0)))
         (impact-breaks-door? self (the-as rigid-body-impact a1-4) (the-as wvehicle proc))
         )
       )
      )
    )
  :code (behavior ()
    (ja :group! (ja-group) :num! min)
    (transform-post)
    (sleep-code)
    )
  )

(defstate explode (rub-rhino-door)
  :virtual #t
  :code (behavior ()
    (process-entity-status! self (entity-perm-status subtask-complete) #t)
    (do-explode self)
    (if (logtest? (-> *part-group-id-table* 1003 flags) (sp-group-flag sp13))
        (part-tracker-spawn
          part-tracker-subsampler
          :to *entity-pool*
          :group (-> *part-group-id-table* 1003)
          :mat-joint (-> self node-list data 3 bone transform)
          )
        (part-tracker-spawn
          part-tracker
          :to *entity-pool*
          :group (-> *part-group-id-table* 1003)
          :mat-joint (-> self node-list data 3 bone transform)
          )
        )
    (suspend)
    (when (type? (-> self root) collide-shape)
      (let ((v1-36 (-> self root root-prim)))
        (set! (-> v1-36 prim-core collide-as) (collide-spec))
        (set! (-> v1-36 prim-core collide-with) (collide-spec))
        )
      0
      )
    (logior! (-> self draw status) (draw-control-status no-draw))
    (transform-post)
    (while (-> self child)
      (suspend)
      )
    (cleanup-for-death self)
    )
  )

(defmethod get-inv-mass ((this rub-rhino-door))
  0.01
  )

(defmethod go-explode ((this rub-rhino-door))
  (logclear! (-> this mask) (process-mask actor-pause))
  (let ((v1-3 (-> this root root-prim)))
    (set! (-> v1-3 prim-core collide-as) (collide-spec))
    (set! (-> v1-3 prim-core collide-with) (collide-spec))
    )
  0
  (logior! (-> this root penetrated-by) (penetrate vehicle))
  (sound-play "ruins-door-bust")
  (go (method-of-object this explode))
  0
  (none)
  )

(defmethod impact-breaks-door? ((this rub-rhino-door) (arg0 rigid-body-impact) (arg1 wvehicle))
  (let ((v1-0 (as-type arg1 wvehicle)))
    (when (or (< 2457600.0 (-> arg0 impulse))
              (and v1-0 (logtest? (-> v1-0 controls flags) (vehicle-controls-flag vcf2)))
              )
      (go-explode this)
      #t
      )
    )
  )

(defmethod do-explode ((this rub-rhino-door))
  (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 1))))
    (vector-copy! (-> gp-0 fountain-rand-transv-lo) (target-pos 0))
    (set! (-> gp-0 fountain-rand-transv-hi x) 122880.0)
    (set! (-> gp-0 fountain-rand-transv-hi y) 245760.0)
    (set! (-> gp-0 fountain-rand-transv-hi z) 4096.0)
    (set! (-> gp-0 fountain-rand-transv-hi w) 16384.0)
    (set! (-> gp-0 friction) 0.95)
    (set! (-> gp-0 duration) (seconds 4))
    (process-spawn
      joint-exploder
      (art-group-get-by-name *level* "skel-rub-rhino-door" (the-as (pointer level) #f))
      2
      gp-0
      *rub-rhino-door-exploder-params*
      :name "joint-exploder"
      :to this
      )
    )
  0
  (none)
  )

(defmethod init-collision! ((this rub-rhino-door))
  (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player))))
    (set! (-> s5-0 penetrated-by) (penetrate))
    (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 1) 0)))
      (set! (-> s5-0 total-prims) (the-as uint 2))
      (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle camera-blocker))
      (set! (-> s4-0 prim-core action) (collide-action solid))
      (set! (-> s4-0 transform-index) 3)
      (set-vector! (-> s4-0 local-sphere) -8192.0 0.0 0.0 122880.0)
      (set! (-> s5-0 root-prim) s4-0)
      )
    (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle camera-blocker))
      (set! (-> v1-8 prim-core collide-with) (collide-spec jak player-list))
      (set! (-> v1-8 prim-core action) (collide-action solid))
      (set! (-> v1-8 transform-index) 3)
      (set-vector! (-> v1-8 local-sphere) -8192.0 0.0 0.0 122880.0)
      )
    (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
    (let ((v1-11 (-> s5-0 root-prim)))
      (set! (-> s5-0 backup-collide-as) (-> v1-11 prim-core collide-as))
      (set! (-> s5-0 backup-collide-with) (-> v1-11 prim-core collide-with))
      )
    (set! (-> this root) s5-0)
    )
  0
  (none)
  )

(defmethod init-from-entity! ((this rub-rhino-door) (arg0 entity-actor))
  "Set up a newly created process from the entity that created it."
  (when (logtest? (-> this entity extra perm status) (entity-perm-status subtask-complete))
    (cleanup-for-death this)
    (return #f)
    )
  (init-collision! this)
  (process-drawable-from-entity! this arg0)
  (initialize-skeleton
    this
    (the-as skeleton-group (art-group-get-by-name *level* "skel-rub-rhino-door" (the-as (pointer level) #f)))
    (the-as pair 0)
    )
  (go (method-of-object this idle))
  )

(defpartgroup group-mh-tower-smoke-stda
  :id 1004
  :flags (sp0 sp4 sp11)
  :bounds (static-bspherem 0 0 0 1000)
  :parts ((sp-item 3659 :fade-after (meters 10000) :falloff-to (meters 10000) :flags (sp7)))
  )

(defpart 3659
  :init-specs ((:texture (topglow level-default-sprite))
    (:num 0.001 0.05)
    (:x (meters -10) (meters 20))
    (:y (meters -30))
    (:z (meters -10) (meters 20))
    (:scale-x (meters 40) (meters 10))
    (:rot-z (degrees 160) (degrees 40))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 100.0)
    (:b 10.0)
    (:a 0.0)
    (:vel-y (meters 0.1))
    (:scalevel-x (meters 0.006666667) (meters 0.033333335))
    (:rotvel-z (degrees -0.033333335) (degrees 0.06666667))
    (:scalevel-y :copy scalevel-x)
    (:fade-a 0.13333334 0.26666668)
    (:accel-x (meters 0.00016666666))
    (:friction 0.997)
    (:timer (seconds 166.67))
    (:flags (sp-cpuinfo-flag-2 launch-along-z))
    (:next-time (seconds 1))
    (:next-launcher 3660)
    (:rotate-y (degrees 0))
    )
  )

(defpart 3660
  :init-specs ((:scalevel-x (meters 0.026666667) (meters 0.013333334))
    (:scalevel-y :copy scalevel-x)
    (:fade-a 0.0)
    (:next-time (seconds 2))
    (:next-launcher 3661)
    )
  )

(defpart 3661
  :init-specs ((:scalevel-x (meters 0.016666668) (meters 0.01))
    (:scalevel-y :copy scalevel-x)
    (:fade-r -0.14222223)
    (:fade-g 0.031111112)
    (:fade-b 0.13111112)
    (:next-time (seconds 2))
    (:next-launcher 3662)
    )
  )

(defpart 3662
  :init-specs ((:fade-r 0.0) (:fade-g 0.0) (:fade-b 0.0) (:fade-a -0.006 -0.0024))
  )

(deftype mh-tower-smoke-stda (process-drawable)
  ()
  (:state-methods
    idle
    )
  )


(defmethod deactivate ((this mh-tower-smoke-stda))
  "Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
  (if (nonzero? (-> this part))
      (kill-particles (-> this part))
      )
  ((method-of-type process-drawable deactivate) this)
  (none)
  )

(defstate idle (mh-tower-smoke-stda)
  :virtual #t
  :code sleep-code
  :post (behavior ()
    (spawn (-> self part) (-> self root trans))
    )
  )

(defmethod run-logic? ((this mh-tower-smoke-stda))
  "Should this process be run? Checked by execute-process-tree."
  #t
  )

(defmethod init-from-entity! ((this mh-tower-smoke-stda) (arg0 entity-actor))
  "Set up a newly created process from the entity that created it."
  (set! (-> this root) (new 'process 'trsqv))
  (process-drawable-from-entity! this arg0)
  (logclear! (-> this mask) (process-mask actor-pause))
  (set! (-> this part) (create-launch-control (-> *part-group-id-table* 1004) this))
  (go (method-of-object this idle))
  )
