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

(import "goal_src/jak1/import/ecoventrock-ag.gc")
(import "goal_src/jak1/import/beachcam-ag.gc")
(import "goal_src/jak1/import/windmill-one-ag.gc")
(import "goal_src/jak1/import/kickrock-ag.gc")
(import "goal_src/jak1/import/harvester-ag.gc")
(import "goal_src/jak1/import/flutflutegg-ag.gc")
(import "goal_src/jak1/import/grottopole-ag.gc")
(import "goal_src/jak1/import/flutflut-ag.gc")
(import "goal_src/jak1/import/bladeassm-ag.gc")

;; failed to figure out what this is:
(defskelgroup *beachcam-sg* beachcam beachcam-lod0-jg beachcam-anim-ja
              ((beachcam-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 60)
              )

;; definition of type windmill-one
(deftype windmill-one (process-drawable)
  ((root-override collide-shape-moving  :offset        112)
   (sound-id      sound-id              :offset-assert 176)
   )
  :heap-base #x50
  :method-count-assert 20
  :size-assert         #xb4
  :flag-assert         #x14005000b4
  (:states
    windmill-one-idle
    )
  )

;; definition for method 3 of type windmill-one
(defmethod inspect windmill-one ((obj windmill-one))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tsound-id: ~D~%" (-> obj sound-id))
  obj
  )

;; failed to figure out what this is:
(defskelgroup *windmill-one-sg* windmill-one windmill-one-lod0-jg windmill-one-idle-ja
              ((windmill-one-lod0-mg (meters 20)) (windmill-one-lod1-mg (meters 40)) (windmill-one-lod2-mg (meters 999999)))
              :bounds (static-spherem -12 -8 -1 16)
              :longest-edge (meters 7.5)
              )

;; failed to figure out what this is:
(defstate windmill-one-idle (windmill-one)
  :exit (behavior ()
    (sound-stop (-> self sound-id))
    (none)
    )
  :trans (behavior ()
    (rider-trans)
    (let ((t2-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 4))))
      (if (!= (+ (-> t2-0 x) (-> t2-0 y) (-> t2-0 z)) 0.0)
          (sound-play "gears-rumble" :id (-> self sound-id) :position (the-as symbol t2-0))
          )
      )
    (none)
    )
  :code (behavior ()
    (loop
      (ja-no-eval :group! (-> self draw art-group data 4) :num! (seek! max 0.5) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek! max 0.5))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior windmill-one) rider-post)
  )

;; definition for method 11 of type windmill-one
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! windmill-one ((obj windmill-one) (arg0 entity-actor))
  (set! (-> obj mask) (logior (process-mask platform) (-> obj mask)))
  (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum 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)
          )
    (alloc-riders s4-0 1)
    (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 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 ca-1))
      (set! (-> s3-0 transform-index) 0)
      (set-vector! (-> s3-0 local-sphere) -40960.0 -40960.0 32768.0 69632.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 0))))
        (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 ca-1))
        (set! (-> s2-0 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-0 transform-index) 8)
        (set-vector! (-> s2-0 local-sphere) 4915.2 0.0 -4915.2 13516.8)
        (append-prim s3-0 s2-0)
        )
      (let ((s2-1 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (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 ca-1))
        (set! (-> s2-1 prim-core offense) (collide-offense indestructible))
        (set! (-> s2-1 transform-index) 9)
        (set-vector! (-> s2-1 local-sphere) 4915.2 0.0 -4915.2 13516.8)
        (append-prim s3-0 s2-1)
        )
      )
    (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (set! (-> obj root-override pause-adjust-distance) 409600.0)
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *windmill-one-sg* '())
  (logior! (-> obj skel status) (janim-status inited))
  (update-transforms! (-> obj root-override))
  (set! (-> obj sound-id) (new-sound-id))
  (go windmill-one-idle)
  (none)
  )

;; failed to figure out what this is:
(defpartgroup group-beach-grotto-pole-rocks
  :id 155
  :flags (use-local-clock)
  :bounds (static-bspherem 0 -12 0 14)
  :parts ((sp-item 539 :period 1500 :length 15)
    (sp-item 539 :period 1500 :length 30)
    (sp-item 539 :period 1500 :length 45)
    (sp-item 539 :period 1500 :length 75)
    (sp-item 539 :period 1500 :length 150)
    (sp-item 539 :period 1500 :length 300)
    (sp-item 540 :period 1500 :length 30)
    )
  )

;; failed to figure out what this is:
(defpart 539
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x1d :page #x2))
    (sp-flt spt-num 0.5)
    (sp-rnd-flt spt-x (meters -9) (meters 18) 1.0)
    (sp-flt spt-y (meters -6))
    (sp-rnd-flt spt-z (meters -9) (meters 18) 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.5) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 32.0 40.0 1.0)
    (sp-rnd-flt spt-g 32.0 40.0 1.0)
    (sp-rnd-flt spt-b 32.0 40.0 1.0)
    (sp-flt spt-a 128.0)
    (sp-rnd-flt spt-vel-y (meters 0) (meters -0.04) 1.0)
    (sp-rnd-flt spt-rotvel-z (degrees -0.3) (degrees 0.6) 1.0)
    (sp-rnd-flt spt-accel-y -6.826667 -0.68266666 1.0)
    (sp-int spt-timer 390)
    (sp-cpuinfo-flags bit2)
    (sp-flt spt-userdata 0.0)
    (sp-func spt-func 'check-water-level-drop)
    )
  )

;; failed to figure out what this is:
(defpart 540
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2))
    (sp-flt spt-num 12.0)
    (sp-flt spt-y (meters -7))
    (sp-rnd-flt spt-scale-x (meters 3) (meters 4.5) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 48.0 16.0 1.0)
    (sp-flt spt-g 48.0)
    (sp-flt spt-b 48.0)
    (sp-flt spt-a 0.0)
    (sp-rnd-flt spt-vel-y (meters 0) (meters 0.006666667) 1.0)
    (sp-rnd-flt spt-rotvel-z (degrees -0.3) (degrees 0.6) 1.0)
    (sp-flt spt-fade-a 1.0666667)
    (sp-flt spt-accel-y 0.06826667)
    (sp-int spt-timer 1200)
    (sp-cpuinfo-flags bit2 bit12)
    (sp-int spt-next-time 60)
    (sp-launcher-by-id spt-next-launcher 541)
    (sp-rnd-flt spt-conerot-x (degrees 90.0) (degrees 10.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    (sp-rnd-flt spt-conerot-radius (meters 3.5) (meters 6) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 541
  :init-specs ((sp-flt spt-fade-a 0.0) (sp-int-plain-rnd spt-next-time 450 239 1) (sp-launcher-by-id spt-next-launcher 542))
  )

;; failed to figure out what this is:
(defpart 542
  :init-specs ((sp-flt spt-fade-a -0.14222223))
  )

;; definition of type grottopole
(deftype grottopole (process-drawable)
  ((root-override       collide-shape  :offset        112)
   (speed               meters         :offset-assert 176)
   (distance            meters         :offset-assert 180)
   (position            int32          :offset-assert 184)
   (max-position        int32          :offset-assert 188)
   (incomming-attack-id uint64         :offset-assert 192)
   )
  :heap-base #x60
  :method-count-assert 20
  :size-assert         #xc8
  :flag-assert         #x14006000c8
  (:states
    grottopole-idle
    grottopole-moving-down
    grottopole-moving-up
    )
  )

;; definition for method 3 of type grottopole
(defmethod inspect grottopole ((obj grottopole))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tspeed: (meters ~m)~%" (-> obj speed))
  (format #t "~T~Tdistance: (meters ~m)~%" (-> obj distance))
  (format #t "~T~Tposition: ~D~%" (-> obj position))
  (format #t "~T~Tmax-position: ~D~%" (-> obj max-position))
  (format #t "~T~Tincomming-attack-id: ~D~%" (-> obj incomming-attack-id))
  obj
  )

;; failed to figure out what this is:
(defskelgroup *grottopole-sg* grottopole grottopole-lod0-jg grottopole-idle-ja
              ((grottopole-lod0-mg (meters 20)) (grottopole-lod1-mg (meters 999999)))
              :bounds (static-spherem 0 -8 0 9)
              )

;; failed to figure out what this is:
(defstate grottopole-idle (grottopole)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (when (= (-> arg0 type) target)
      (case arg2
        (('attack)
         (let ((v1-2 (-> arg3 param 2)))
           (when (!= v1-2 (-> self incomming-attack-id))
             (set! (-> self incomming-attack-id) v1-2)
             (case (-> arg3 param 1)
               (('uppercut)
                (when (and (< (-> *target* control trans y) (+ -40960.0 (-> self root-override trans y)))
                           (< (-> self position) (-> self max-position))
                           ((method-of-type touching-shapes-entry prims-touching?)
                            (the-as touching-shapes-entry (-> arg3 param 0))
                            (the-as collide-shape-moving (-> self root-override))
                            (the-as uint 2)
                            )
                           )
                  (sound-play "grotto-pole-hit")
                  (sound-play "dirt-crumble")
                  (increment-success-for-hint (game-text-id beach-grottopole-increment))
                  (go grottopole-moving-up)
                  )
                )
               (('flop)
                (when (and (< (+ -40960.0 (-> self root-override trans y)) (-> *target* control trans y))
                           (> (-> self position) 0)
                           ((method-of-type touching-shapes-entry prims-touching?)
                            (the-as touching-shapes-entry (-> arg3 param 0))
                            (the-as collide-shape-moving (-> self root-override))
                            (the-as uint 1)
                            )
                           )
                  (sound-play "grotto-pole-hit")
                  (sound-play "dirt-crumble")
                  (go grottopole-moving-down)
                  )
                )
               )
             )
           )
         )
        )
      )
    )
  :code (behavior ()
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (ja :group! (-> self draw art-group data 3) :num! min)
    (transform-post)
    (suspend)
    (loop
      (logior! (-> self mask) (process-mask sleep))
      (suspend)
      )
    (none)
    )
  )

;; definition for function move-grottopole
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defun move-grottopole ((arg0 grottopole) (arg1 float))
  (let ((f30-0 0.0)
        (s4-0 (new-stack-vector0))
        (s3-0 (new-stack-vector0))
        (s2-0 #f)
        )
    (set! (-> arg0 part local-clock) 0)
    (set-vector! s4-0 0.0 0.0 0.0 1.0)
    (while (and (not s2-0) (< f30-0 (-> arg0 distance)))
      (let ((f28-0 (* (-> arg0 speed) (-> *display* seconds-per-frame))))
        (when (< (-> arg0 distance) (+ f30-0 f28-0))
          (set! f28-0 (- (-> arg0 distance) f30-0))
          (set! s2-0 #t)
          )
        (set! (-> s4-0 y) (* f28-0 arg1))
        (move-by-vector! (-> arg0 root-override) s4-0)
        (+! f30-0 f28-0)
        )
      (set! (-> s3-0 quad) (-> arg0 entity extra trans quad))
      (set! (-> s3-0 y) (+ -4096.0 (-> s3-0 y)))
      (spawn (-> arg0 part) s3-0)
      (suspend)
      0
      )
    )
  0
  (none)
  )

;; definition for function move-grottopole-to-position
;; INFO: Return type mismatch int vs none.
(defun move-grottopole-to-position ((arg0 grottopole))
  (let ((a1-0 (new 'stack-no-clear 'vector)))
    (set-vector! a1-0 0.0 (* (-> arg0 distance) (the float (-> arg0 position))) 0.0 1.0)
    (move-by-vector! (-> arg0 root-override) a1-0)
    )
  0
  (none)
  )

;; failed to figure out what this is:
(defstate grottopole-moving-up (grottopole)
  :code (behavior ()
    (+! (-> self position) 1)
    (let ((v1-4 (-> self entity extra perm)))
      (logior! (-> v1-4 status) (entity-perm-status user-set-from-cstage))
      (set! (-> v1-4 user-int16 0) (-> self position))
      )
    (move-grottopole self 1.0)
    (go grottopole-idle)
    (none)
    )
  :post (the-as (function none :behavior grottopole) transform-post)
  )

;; failed to figure out what this is:
(defstate grottopole-moving-down (grottopole)
  :code (behavior ()
    (+! (-> self position) -1)
    (let ((v1-4 (-> self entity extra perm)))
      (logior! (-> v1-4 status) (entity-perm-status user-set-from-cstage))
      (set! (-> v1-4 user-int16 0) (-> self position))
      )
    (move-grottopole self -1.0)
    (go grottopole-idle)
    (none)
    )
  :post (the-as (function none :behavior grottopole) transform-post)
  )

;; definition for method 11 of type grottopole
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! grottopole ((obj grottopole) (arg0 entity-actor))
  (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-others))))
    (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 3) 0)))
      (set! (-> s3-0 prim-core collide-as) (collide-kind wall-object))
      (set! (-> s3-0 collide-with) (collide-kind target))
      (set! (-> s3-0 prim-core action) (collide-action solid))
      (set-vector! (-> s3-0 local-sphere) 0.0 -20480.0 0.0 40960.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 1))))
        (set! (-> s2-0 prim-core collide-as) (collide-kind wall-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) 3)
        (set-vector! (-> s2-0 local-sphere) 0.0 -20480.0 0.0 40960.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 wall-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) 3)
        (set-vector! (-> s2-1 local-sphere) 0.0 -20480.0 0.0 40960.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 2))))
        (set! (-> s2-2 prim-core collide-as) (collide-kind wall-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) 3)
        (set-vector! (-> s2-2 local-sphere) 0.0 -20480.0 0.0 40960.0)
        (append-prim s3-0 s2-2)
        )
      )
    (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *grottopole-sg* '())
  (set! (-> obj speed) (res-lump-float arg0 'speed :default 81920.0))
  (set! (-> obj distance) (res-lump-float arg0 'distance :default 3072.0))
  (set! (-> obj position) 0)
  (set! (-> obj max-position) (res-lump-value arg0 'num-positions int :default (the-as uint128 3)))
  (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 155) obj))
  (set! (-> obj position) (-> obj entity extra perm user-int16 0))
  (move-grottopole-to-position obj)
  (go grottopole-idle)
  (none)
  )

;; definition of type ecoventrock
(deftype ecoventrock (process-drawable)
  ((root-override collide-shape  :offset 112)
   )
  :heap-base #x40
  :method-count-assert 20
  :size-assert         #xb0
  :flag-assert         #x14004000b0
  (:states
    (ecoventrock-break symbol)
    ecoventrock-idle
    )
  )

;; definition for method 3 of type ecoventrock
(defmethod inspect ecoventrock ((obj ecoventrock))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  obj
  )

;; failed to figure out what this is:
(defskelgroup *ecoventrock-sg* ecoventrock ecoventrock-lod0-jg ecoventrock-idle-ja
              ((ecoventrock-lod0-mg (meters 20)) (ecoventrock-lod1-mg (meters 999999)))
              :bounds (static-spherem 0 1 0 3)
              )

;; failed to figure out what this is:
(defpartgroup group-beach-harvester-rock-explosion
  :id 156
  :duration 600
  :flags (use-local-clock)
  :bounds (static-bspherem 0 0 0 8)
  :parts ((sp-item 543 :period 1500 :length 5)
    (sp-item 544 :period 1500 :length 5)
    (sp-item 545 :period 1500 :length 5)
    (sp-item 546 :period 1500 :length 5)
    (sp-item 547 :period 1500 :length 5)
    (sp-item 548 :period 1500 :length 15)
    )
  )

;; failed to figure out what this is:
(defpart 547
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 1.0)
    (sp-flt spt-scale-x (meters 15))
    (sp-copy-from-other spt-scale-y -4)
    (sp-flt spt-r 130.0)
    (sp-flt spt-g 64.0)
    (sp-flt spt-b 54.0)
    (sp-flt spt-a 128.0)
    (sp-flt spt-fade-a -2.1333334)
    (sp-int spt-timer 60)
    (sp-cpuinfo-flags bit2 bit3)
    )
  )

;; failed to figure out what this is:
(defpart 543
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x1d :page #x2))
    (sp-rnd-flt spt-num 4.0 6.0 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.3) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 70.0 16.0 1.0)
    (sp-rnd-flt spt-g 70.0 16.0 1.0)
    (sp-flt spt-b 70.0)
    (sp-flt spt-a 128.0)
    (sp-flt spt-vel-y (meters 0.06666667))
    (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 2.4) 1.0)
    (sp-flt spt-accel-y -10.922667)
    (sp-flt spt-friction 0.99)
    (sp-int spt-timer 300)
    (sp-cpuinfo-flags bit2)
    (sp-int spt-next-time 174)
    (sp-launcher-by-id spt-next-launcher 549)
    (sp-flt spt-conerot-x (degrees 45.0))
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 544
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x1d :page #x2))
    (sp-rnd-flt spt-num 4.0 6.0 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.3) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 70.0 16.0 1.0)
    (sp-rnd-flt spt-g 70.0 16.0 1.0)
    (sp-flt spt-b 70.0)
    (sp-flt spt-a 128.0)
    (sp-flt spt-vel-y (meters 0.04))
    (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 2.4) 1.0)
    (sp-flt spt-accel-y -10.922667)
    (sp-flt spt-friction 0.99)
    (sp-int spt-timer 300)
    (sp-cpuinfo-flags bit2)
    (sp-int spt-next-time 125)
    (sp-launcher-by-id spt-next-launcher 549)
    (sp-flt spt-conerot-x (degrees 30.0))
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 545
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x1d :page #x2))
    (sp-rnd-flt spt-num 4.0 6.0 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.3) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 80.0 16.0 1.0)
    (sp-rnd-flt spt-g 80.0 16.0 1.0)
    (sp-flt spt-b 80.0)
    (sp-flt spt-a 128.0)
    (sp-flt spt-vel-y (meters 0.08))
    (sp-rnd-flt spt-rotvel-z (degrees -1.2) (degrees 2.4) 1.0)
    (sp-flt spt-accel-y -10.922667)
    (sp-flt spt-friction 0.99)
    (sp-int spt-timer 300)
    (sp-cpuinfo-flags bit2)
    (sp-int spt-next-time 195)
    (sp-launcher-by-id spt-next-launcher 549)
    (sp-flt spt-conerot-x (degrees 35.0))
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 549
  :init-specs ((sp-flt spt-vel-y (meters 0.026666667))
    (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668)
    (sp-flt spt-fade-a -1.0666667)
    )
  )

;; failed to figure out what this is:
(defpart 548
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2))
    (sp-flt spt-num 16.0)
    (sp-rnd-flt spt-y (meters 0.5) (meters 1) 1.0)
    (sp-rnd-flt spt-scale-x (meters 2.5) (meters 1.5) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 96.0 64.0 1.0)
    (sp-rnd-flt spt-g 64.0 48.0 1.0)
    (sp-rnd-flt spt-b 64.0 16.0 1.0)
    (sp-rnd-flt spt-a 16.0 32.0 1.0)
    (sp-rnd-flt spt-vel-y (meters 0.016666668) (meters 0.016666668) 1.0)
    (sp-flt spt-scalevel-x (meters 0.013333334))
    (sp-flt spt-scalevel-y (meters 0.0033333334))
    (sp-flt spt-accel-y -1.0922667)
    (sp-flt spt-friction 0.95)
    (sp-int spt-timer 600)
    (sp-cpuinfo-flags bit2 bit12)
    (sp-int-plain-rnd spt-next-time 30 299 1)
    (sp-launcher-by-id spt-next-launcher 550)
    (sp-rnd-flt spt-conerot-x (degrees 70.0) (degrees 20.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 550
  :init-specs ((sp-flt spt-fade-a -0.2))
  )

;; failed to figure out what this is:
(defstate ecoventrock-idle (ecoventrock)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (case arg2
      (('attack)
       (sound-play "cannon-shot")
       (increment-success-for-hint (game-text-id sidekick-hint-ecorocks))
       (go ecoventrock-break #f)
       )
      )
    )
  :code (behavior ()
    (transform-post)
    (loop
      (logior! (-> self mask) (process-mask sleep))
      (suspend)
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate ecoventrock-break (ecoventrock)
  :event (the-as
    (function process int symbol event-message-block object :behavior ecoventrock)
    process-drawable-fuel-cell-handler
    )
  :enter (behavior ((arg0 symbol))
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (none)
    )
  :code (behavior ((arg0 symbol))
    (local-vars (sv-128 symbol))
    (ja-channel-set! 0)
    (clear-collide-with-as (-> self root-override))
    (ja-post)
    (process-entity-status! self (entity-perm-status complete) #t)
    (let ((v1-2 (entity-actor-lookup (-> self entity) 'alt-actor 0)))
      (send-event
        (if v1-2
            (-> v1-2 extra process)
            )
        'update
        )
      )
    (when (not arg0)
      (process-spawn
        part-tracker
        :init part-tracker-init
        (-> *part-group-id-table* 156)
        -1
        #f
        #f
        #f
        (-> self root-override root-prim prim-core)
        :to *entity-pool*
        )
      (let* ((s5-1 (-> self root-override trans))
             (v1-14 (target-pos 0))
             (f0-1 (- (-> s5-1 x) (-> v1-14 x)))
             (f1-2 (- (-> s5-1 z) (-> v1-14 z)))
             (f2-1 7372.8)
             (f30-0 5734.4)
             (f2-2 (/ f2-1 (sqrtf (+ (* f0-1 f0-1) (* f1-2 f1-2)))))
             (f28-0 (* f0-1 f2-2))
             (f26-0 (* f1-2 f2-2))
             (s4-0 (new-stack-vector0))
             (s3-0 (new-stack-vector0))
             )
        (set-vector! s3-0 f28-0 f30-0 f26-0 1.0)
        (set-vector! s4-0 (+ (-> s5-1 x) (-> s3-0 x)) (-> s5-1 y) (+ (-> s5-1 z) (-> s3-0 z)) 1.0)
        (vector-float*! s3-0 s3-0 10.0)
        (spawn-flying-rock s4-0 s3-0 1.0 (-> self entity))
        (let ((f20-0 (rand-vu-float-range 90.0 130.0))
              (f24-0 (rand-vu-float-range 230.0 270.0))
              )
          (let ((f22-0 (cos (* 182.04445 f20-0)))
                (f0-14 (sin (* 182.04445 f20-0)))
                )
            (set-vector! s3-0 (+ (* f26-0 f0-14) (* f28-0 f22-0)) f30-0 (+ (* f28-0 (- f0-14)) (* f26-0 f22-0)) 1.0)
            )
          (set-vector! s4-0 (+ (-> s5-1 x) (-> s3-0 x)) (-> s5-1 y) (+ (-> s5-1 z) (-> s3-0 z)) 1.0)
          (vector-float*! s3-0 s3-0 10.0)
          (spawn-flying-rock s4-0 s3-0 1.0 (-> self entity))
          (let ((f22-1 (cos (* 182.04445 f24-0)))
                (f0-30 (sin (* 182.04445 f24-0)))
                )
            (set-vector! s3-0 (+ (* f26-0 f0-30) (* f28-0 f22-1)) f30-0 (+ (* f28-0 (- f0-30)) (* f26-0 f22-1)) 1.0)
            )
          )
        (set-vector! s4-0 (+ (-> s5-1 x) (-> s3-0 x)) (-> s5-1 y) (+ (-> s5-1 z) (-> s3-0 z)) 1.0)
        (vector-float*! s3-0 s3-0 10.0)
        (spawn-flying-rock s4-0 s3-0 1.0 (-> self entity))
        (set-vector! s3-0 (+ (* -0.866 f26-0) (* 0.5 f28-0)) (* 0.5 f30-0) (+ (* 0.866 f28-0) (* 0.5 f26-0)) 1.0)
        (set-vector! s4-0 (-> s5-1 x) (+ 3276.8 (-> s5-1 y)) (-> s5-1 z) 1.0)
        (vector-float*! s3-0 s3-0 10.0)
        (spawn-flying-rock s4-0 s3-0 1.0 (-> self entity))
        )
      )
    (when (or (-> self link prev) (-> self link next))
      (set! sv-128 (the-as symbol #f))
      (apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128))
      (when sv-128
        (let ((s5-2 (-> *display* base-frame-counter)))
          (until (>= (- (-> *display* base-frame-counter) s5-2) (seconds 0.5))
            (suspend)
            )
          )
        (let ((gp-1
                (cond
                  (arg0
                    (the-as int #f)
                    )
                  (else
                    (ambient-hint-spawn "gamcam10" (the-as vector #f) *entity-pool* 'camera)
                    (ppointer->handle
                      (process-spawn pov-camera (-> self root-override trans) *beachcam-sg* (-> self name) 0 #f '() :to self)
                      )
                    )
                  )
                )
              )
          (process-drawable-birth-fuel-cell (the-as entity #f) (the-as vector #f) #f)
          (while (handle->process (the-as handle gp-1))
            (suspend)
            )
          )
        (while (-> self child)
          (suspend)
          )
        )
      )
    (process-entity-status! self (entity-perm-status dead) #t)
    (deactivate self)
    (none)
    )
  )

;; definition for method 11 of type ecoventrock
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! ecoventrock ((obj ecoventrock) (arg0 entity-actor))
  (set! (-> obj mask) (logior (process-mask enemy) (-> obj mask)))
  (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player))))
    (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> s3-0 prim-core collide-as) (collide-kind enemy))
      (set! (-> s3-0 collide-with) (collide-kind target))
      (set! (-> s3-0 prim-core action) (collide-action solid))
      (set! (-> s3-0 prim-core offense) (collide-offense indestructible))
      (set! (-> s3-0 transform-index) 0)
      (set-vector! (-> s3-0 local-sphere) 0.0 2457.6 0.0 6963.2)
      (set-root-prim! s4-0 s3-0)
      )
    (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *ecoventrock-sg* '())
  (set! (-> obj link) (new 'process 'actor-link-info obj))
  (transform-post)
  (nav-mesh-connect obj (-> obj root-override) (the-as nav-control #f))
  (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status complete)))
      (go ecoventrock-break #t)
      (go ecoventrock-idle)
      )
  (none)
  )

;; definition of type flying-rock
(deftype flying-rock (process-drawable)
  ((root-override collide-shape-moving         :offset        112)
   (tumble        quaternion           :inline :offset-assert 176)
   )
  :heap-base #x50
  :method-count-assert 20
  :size-assert         #xc0
  :flag-assert         #x14005000c0
  (:states
    flying-rock-idle
    flying-rock-rolling
    )
  )

;; definition for method 3 of type flying-rock
(defmethod inspect flying-rock ((obj flying-rock))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Ttumble: #<quaternion @ #x~X>~%" (-> obj tumble))
  obj
  )

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

;; failed to figure out what this is:
(defstate flying-rock-rolling (flying-rock)
  :enter (behavior ()
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (none)
    )
  :code (behavior ()
    (let ((gp-0 #f)
          (f30-0 0.99)
          (s5-0 0)
          )
      (while (< s5-0 2)
        (cond
          ((logtest? (-> self root-override status) (cshape-moving-flags onsurf))
           (when (not gp-0)
             (+! s5-0 1)
             (set! f30-0 0.8)
             (set! gp-0 #t)
             )
           )
          (else
            (when gp-0
              (set! f30-0 0.99)
              (set! gp-0 #f)
              )
            )
          )
        (vector-float*! (-> self root-override transv) (-> self root-override transv) f30-0)
        (set! (-> self root-override transv w) 1.0)
        (if (not gp-0)
            (vector-v++!
              (-> self root-override transv)
              (compute-acc-due-to-gravity (-> self root-override) (new-stack-vector0) 1.0)
              )
            )
        (update-transforms! (-> self root-override))
        (fill-cache-integrate-and-collide!
          (-> self root-override)
          (-> self root-override transv)
          (collide-kind background)
          )
        (quaternion*! (-> self root-override quat) (-> self root-override quat) (-> self tumble))
        (suspend)
        )
      )
    (while (< 2048.0 (vector-length (-> self root-override transv)))
      (cond
        ((logtest? (-> self root-override status) (cshape-moving-flags onsurf))
         (vector-float*! (-> self root-override transv) (-> self root-override transv) 0.8)
         )
        (else
          (vector-float*! (-> self root-override transv) (-> self root-override transv) 0.99)
          (vector-v++!
            (-> self root-override transv)
            (compute-acc-due-to-gravity (-> self root-override) (new-stack-vector0) 1.0)
            )
          )
        )
      (set! (-> self root-override transv w) 1.0)
      (update-transforms! (-> self root-override))
      (fill-cache-integrate-and-collide!
        (-> self root-override)
        (-> self root-override transv)
        (collide-kind background)
        )
      (let ((gp-2 (new 'stack-no-clear 'vector))
            (f30-1 (vector-length (-> self root-override transv)))
            )
        (set-vector! gp-2 (-> self root-override transv z) 0.0 (- (-> self root-override transv x)) 1.0)
        (vector-normalize! gp-2 1.0)
        (let ((f0-12 (* 0.00061035156 (-> *display* seconds-per-frame) f30-1)))
          (quaternion-vector-angle! (-> self tumble) gp-2 (* 10430.379 f0-12))
          )
        )
      (quaternion*! (-> self root-override quat) (-> self tumble) (-> self root-override quat))
      (suspend)
      )
    (go flying-rock-idle)
    (none)
    )
  :post (behavior ()
    (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 3))
        (go flying-rock-idle)
        )
    (ja-post)
    (none)
    )
  )

;; failed to figure out what this is:
(defstate flying-rock-idle (flying-rock)
  :code (behavior ()
    (clear-collide-with-as (-> self root-override))
    (while (or (logtest? (-> self draw status) (draw-status was-drawn))
               (and *target*
                    (>= 204800.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans)))
                    )
               )
      (suspend)
      )
    (deactivate self)
    (none)
    )
  :post (the-as (function none :behavior flying-rock) ja-post)
  )

;; definition for function flying-rock-init-by-other
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(defbehavior flying-rock-init-by-other flying-rock ((arg0 vector) (arg1 vector) (arg2 float) (arg3 entity-actor))
  (set! (-> self entity) arg3)
  (let ((s3-0 (new 'process 'collide-shape-moving self (collide-list-enum hit-by-player))))
    (set! (-> s3-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s3-0 reaction) simple-collision-reaction)
    (set! (-> s3-0 no-reaction)
          (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
          )
    (let ((s2-0 (new 'process 'collide-shape-prim-sphere s3-0 (the-as uint 0))))
      (set! (-> s2-0 prim-core collide-as) (collide-kind enemy))
      (set! (-> s2-0 collide-with) (collide-kind background target))
      (set! (-> s2-0 prim-core action) (collide-action solid))
      (set! (-> s2-0 prim-core offense) (collide-offense indestructible))
      (set! (-> s2-0 transform-index) 0)
      (set-vector! (-> s2-0 local-sphere) 0.0 0.0 0.0 (* 409.6 arg2))
      (set-root-prim! s3-0 s2-0)
      )
    (set! (-> s3-0 nav-radius) (* 0.75 (-> s3-0 root-prim local-sphere w)))
    (backup-collide-with-as s3-0)
    (set! (-> self root-override) s3-0)
    )
  (set! (-> self root-override trans quad) (-> arg0 quad))
  (set-vector! (-> self root-override scale) arg2 arg2 arg2 1.0)
  (let ((s5-1 (new-stack-vector0)))
    (set-vector!
      s5-1
      (rand-vu-float-range -1.0 1.0)
      (rand-vu-float-range -1.0 1.0)
      (rand-vu-float-range -1.0 1.0)
      1.0
      )
    (vector-normalize! s5-1 1.0)
    (quaternion-vector-angle! (-> self tumble) s5-1 (rand-vu-float-range 0.0 1820.4445))
    )
  (quaternion-axis-angle! (-> self root-override quat) 0.0 1.0 0.0 (rand-vu-float-range 0.0 65536.0))
  (initialize-skeleton self *kickrock-sg* '())
  (set! (-> self root-override transv quad) (-> arg1 quad))
  (go flying-rock-rolling)
  (none)
  )

;; definition for function spawn-flying-rock
;; INFO: Return type mismatch int vs none.
(defun spawn-flying-rock ((arg0 vector) (arg1 vector) (arg2 float) (arg3 entity))
  (process-spawn flying-rock arg0 arg1 arg2 arg3 :to *entity-pool*)
  0
  (none)
  )

;; definition of type bladeassm
(deftype bladeassm (process-drawable)
  ((root-override collide-shape-moving  :offset        112)
   (angle         float                 :offset-assert 176)
   )
  :heap-base #x50
  :method-count-assert 20
  :size-assert         #xb4
  :flag-assert         #x14005000b4
  (:states
    bladeassm-idle
    )
  )

;; definition for method 3 of type bladeassm
(defmethod inspect bladeassm ((obj bladeassm))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tangle: ~f~%" (-> obj angle))
  obj
  )

;; failed to figure out what this is:
(defskelgroup *bladeassm-sg* bladeassm bladeassm-lod0-jg bladeassm-idle-ja
              ((bladeassm-lod0-mg (meters 20)) (bladeassm-lod1-mg (meters 40)) (bladeassm-lod2-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 10)
              :longest-edge (meters 10)
              )

;; failed to figure out what this is:
(defstate bladeassm-idle (bladeassm)
  :code (behavior ()
    (loop
      (+! (-> self angle) (* 3640.889 (-> *display* seconds-per-frame)))
      (set! (-> self angle) (the float (sar (shl (the int (-> self angle)) 48) 48)))
      (pusher-post)
      (suspend)
      )
    (none)
    )
  )

;; definition for function bladeassm-prebind-function
;; INFO: Return type mismatch int vs object.
(defun bladeassm-prebind-function ((arg0 process-drawable) (arg1 int) (arg2 bladeassm) (arg3 event-message-block))
  (let ((v1-0 arg2))
    (quaternion-axis-angle! (the-as quaternion (&-> arg0 link)) 0.0 0.0 1.0 (-> v1-0 angle))
    )
  (the-as object 0)
  )

;; definition for method 11 of type bladeassm
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! bladeassm ((obj bladeassm) (arg0 entity-actor))
  (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask)))
  (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum 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-mesh s4-0 (the-as uint 0) (the-as uint 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 prim-core offense) (collide-offense indestructible))
      (set! (-> s3-0 transform-index) 3)
      (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 49152.0)
      (set-root-prim! s4-0 s3-0)
      )
    (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *bladeassm-sg* '())
  (set! (-> obj skel prebind-function)
        (the-as (function pointer int process-drawable none) bladeassm-prebind-function)
        )
  (logclear! (-> obj mask) (process-mask actor-pause))
  (go bladeassm-idle)
  (none)
  )

;; definition of type flutflutegg
(deftype flutflutegg (process-drawable)
  ((root-override       collide-shape-moving         :offset        112)
   (fall-dist           meters                       :offset-assert 176)
   (start               vector               :inline :offset-assert 192)
   (dir                 vector               :inline :offset-assert 208)
   (pos                 float                        :offset-assert 224)
   (vel                 float                        :offset-assert 228)
   (wobbler             wobbler                      :offset-assert 232)
   (last-impulse-time   int32                        :offset-assert 236)
   (incomming-attack-id uint64                       :offset-assert 240)
   (ambients-played     int32                        :offset-assert 248)
   (ambient             ambient-control      :inline :offset-assert 256)
   )
  :heap-base #xa0
  :method-count-assert 21
  :size-assert         #x110
  :flag-assert         #x1500a00110
  (:methods
    (dummy-20 (_type_ float float float) none 20)
    )
  (:states
    (flutflutegg-break symbol)
    flutflutegg-idle
    flutflutegg-physics
    flutflutegg-physics-fall
    )
  )

;; definition for method 3 of type flutflutegg
(defmethod inspect flutflutegg ((obj flutflutegg))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tfall-dist: (meters ~m)~%" (-> obj fall-dist))
  (format #t "~T~Tstart: ~`vector`P~%" (-> obj start))
  (format #t "~T~Tdir: ~`vector`P~%" (-> obj dir))
  (format #t "~T~Tpos: ~f~%" (-> obj pos))
  (format #t "~T~Tvel: ~f~%" (-> obj vel))
  (format #t "~T~Twobbler: ~A~%" (-> obj wobbler))
  (format #t "~T~Tlast-impulse-time: ~D~%" (-> obj last-impulse-time))
  (format #t "~T~Tincomming-attack-id: ~D~%" (-> obj incomming-attack-id))
  (format #t "~T~Tambients-played: ~D~%" (-> obj ambients-played))
  (format #t "~T~Tambient: #<ambient-control @ #x~X>~%" (-> obj ambient))
  obj
  )

;; failed to figure out what this is:
(defskelgroup *flutflutegg-sg* flutflutegg flutflutegg-lod0-jg flutflutegg-idle-ja
              ((flutflutegg-lod0-mg (meters 20)) (flutflutegg-lod1-mg (meters 40)) (flutflutegg-lod2-mg (meters 999999)))
              :bounds (static-spherem 0 3.5 0 3.5)
              )

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

;; definition for method 7 of type flutflutegg
;; INFO: Return type mismatch process-drawable vs flutflutegg.
(defmethod relocate flutflutegg ((obj flutflutegg) (arg0 int))
  (if (nonzero? (-> obj wobbler))
      (&+! (-> obj wobbler) arg0)
      )
  (the-as
    flutflutegg
    ((the-as (function process-drawable int process-drawable) (find-parent-method flutflutegg 7)) obj arg0)
    )
  )

;; definition for method 20 of type flutflutegg
;; INFO: Return type mismatch int vs none.
;; WARN: Expression building failed: Function (method 20 flutflutegg) has a return type of none, but the expression builder found a return statement.
(defmethod dummy-20 flutflutegg ((obj flutflutegg) (arg0 float) (arg1 float) (arg2 float))
  (if (< (- (-> *display* base-frame-counter) (the-as time-frame (-> obj last-impulse-time))) (seconds 0.5))
      (return 0)
      )
  (set! (-> obj last-impulse-time) (the-as int (-> *display* base-frame-counter)))
  (+! (-> obj vel) arg0)
  (inc-xy-vel! (-> obj wobbler) arg1 arg2)
  0
  (none)
  )

;; definition for function flutflutegg-hit-sounds
;; INFO: Return type mismatch int vs none.
(defbehavior flutflutegg-hit-sounds flutflutegg ()
  (sound-play "egg-hit")
  (cond
    ((not (task-closed? (game-task beach-flutflut) (task-status need-introduction)))
     )
    ((zero? (logand (-> self ambients-played) 8))
     (if (play-ambient (-> self ambient) "BIR-AM04" #f (the-as vector #f))
         (logior! (-> self ambients-played) 8)
         )
     )
    ((zero? (logand (-> self ambients-played) 512))
     (if (play-ambient (-> self ambient) "BIR-AM10" #f (the-as vector #f))
         (logior! (-> self ambients-played) 512)
         )
     )
    )
  (none)
  )

;; failed to figure out what this is:
(defstate flutflutegg-idle (flutflutegg)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (when (and (= arg2 'attack)
               (or (= (-> arg3 param 1) 'punch) (= (-> arg3 param 1) 'spin) (= (-> arg3 param 1) 'spin-air))
               (!= (-> self incomming-attack-id) (-> arg3 param 2))
               )
      (set! (-> self incomming-attack-id) (-> arg3 param 2))
      (flutflutegg-hit-sounds)
      (let ((s5-1
              (vector-! (new-stack-vector0) (-> (the-as process-drawable arg0) root trans) (-> self root-override trans))
              )
            )
        (set! (-> s5-1 y) 0.0)
        (vector-normalize! s5-1 1.0)
        (let ((f0-2 (vector-dot s5-1 (-> self dir)))
              (f1-2 (- (* (-> s5-1 x) (-> self dir z)) (* (-> s5-1 z) (-> self dir x))))
              )
          (if (< f0-2 -0.7)
              (dummy-20 self 24576.0 (* -8192.0 f1-2) (* -8192.0 f0-2))
              (dummy-20 self 0.0 (* -8192.0 f1-2) (* -8192.0 f0-2))
              )
          )
        )
      (go flutflutegg-physics)
      )
    )
  :trans (behavior ()
    (let* ((gp-0 (TODO-RENAME-10 (-> self ambient) (new 'stack-no-clear 'vector) (seconds 3) 368640.0 self))
           (v1-2 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
           (v1-3 (the-as number (logior #x3f800000 v1-2)))
           (f30-0 (+ -1.0 (the-as float v1-3)))
           )
      (cond
        ((not (task-closed? (game-task beach-flutflut) (task-status need-introduction)))
         )
        ((not gp-0)
         )
        ((< 327680.0 (vector-length gp-0))
         (set! (-> self ambients-played) 0)
         0
         )
        ((and (zero? (logand (-> self ambients-played) 1)) (< (vector-length gp-0) 327680.0) (< -61440.0 (-> gp-0 y)))
         (if (play-ambient (-> self ambient) "BIR-AM01" #f (the-as vector #f))
             (logior! (-> self ambients-played) 1)
             )
         )
        ((and (zero? (logand (-> self ambients-played) 2)) (< (vector-length gp-0) 163840.0) (< -40960.0 (-> gp-0 y)))
         (if (play-ambient (-> self ambient) "BIR-AM02" #f (the-as vector #f))
             (logior! (-> self ambients-played) 2)
             )
         )
        ((and (zero? (logand (-> self ambients-played) 16)) (< (vector-length gp-0) 81920.0) (< -24576.0 (-> gp-0 y)))
         (if (play-ambient (-> self ambient) "BIR-AM05" #f (the-as vector #f))
             (logior! (-> self ambients-played) 16)
             )
         )
        ((and (zero? (logand (-> self ambients-played) 4)) (< (vector-length gp-0) 40960.0) (< -24576.0 (-> gp-0 y)))
         (if (play-ambient (-> self ambient) "BIR-AM03" #f (the-as vector #f))
             (logior! (-> self ambients-played) 4)
             )
         )
        ((< (-> gp-0 y) -24576.0)
         )
        ((< (- (-> *display* base-frame-counter) (-> self ambient last-ambient-time)) (seconds 30))
         )
        ((< 0.8 f30-0)
         (play-ambient (-> self ambient) "BIR-AM07" #f (-> self root-override trans))
         )
        ((< 0.6 f30-0)
         (play-ambient (-> self ambient) "BIR-AM08" #f (-> self root-override trans))
         )
        ((< 0.4 f30-0)
         (play-ambient (-> self ambient) "BIR-AM09" #f (-> self root-override trans))
         )
        ((< 0.2 f30-0)
         (play-ambient (-> self ambient) "BIR-AM12" #f (-> self root-override trans))
         )
        (else
          (play-ambient (-> self ambient) "BIR-AM13" #f (-> self root-override trans))
          )
        )
      )
    (none)
    )
  :code (behavior ()
    (ja-post)
    (loop
      (suspend)
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate flutflutegg-physics (flutflutegg)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (the-as
      object
      (when (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.5))
                 (= arg2 'attack)
                 (or (= (-> arg3 param 1) 'punch) (= (-> arg3 param 1) 'spin) (= (-> arg3 param 1) 'spin-air))
                 (!= (-> self incomming-attack-id) (-> arg3 param 2))
                 )
        (set! (-> self incomming-attack-id) (-> arg3 param 2))
        (flutflutegg-hit-sounds)
        (let ((s5-1
                (vector-! (new-stack-vector0) (-> (the-as process-drawable arg0) root trans) (-> self root-override trans))
                )
              )
          (set! (-> s5-1 y) 0.0)
          (vector-normalize! s5-1 1.0)
          (let ((f0-2 (vector-dot s5-1 (-> self dir)))
                (f1-2 (- (* (-> s5-1 x) (-> self dir z)) (* (-> s5-1 z) (-> self dir x))))
                )
            (if (< f0-2 -0.7)
                (dummy-20 self 24576.0 (* -8192.0 f1-2) (* -8192.0 f0-2))
                (dummy-20 self 0.0 (* -8192.0 f1-2) (* -8192.0 f0-2))
                )
            )
          )
        )
      )
    )
  :code (behavior ()
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (loop
      (+! (-> self pos) (* (-> self vel) (-> *display* seconds-per-frame)))
      (set! (-> self vel) (* 0.95 (-> self vel)))
      (move! (-> self wobbler))
      (let ((a1-0 (new 'stack-no-clear 'vector)))
        (vector-float*! a1-0 (-> self dir) (-> self pos))
        (vector+! a1-0 a1-0 (-> self start))
        (move-to-point! (-> self root-override) a1-0)
        )
      (TODO-RENAME-12 (-> self wobbler) (-> self root-override quat))
      (let ((a2-3 (quaternion-axis-angle! (new 'stack-no-clear 'quaternion) 0.0 1.0 0.0 -18204.445)))
        (quaternion*! (-> self root-override quat) (-> self root-override quat) a2-3)
        )
      (suspend)
      (when (>= (-> self pos) (-> self fall-dist))
        (when (task-closed? (game-task beach-flutflut) (task-status need-introduction))
          (if (play-ambient (-> self ambient) "BIR-AM06" #f (the-as vector #f))
              (logior! (-> self ambients-played) 32)
              )
          )
        (go flutflutegg-physics-fall)
        )
      )
    (none)
    )
  :post (the-as (function none :behavior flutflutegg) ja-post)
  )

;; failed to figure out what this is:
(defstate flutflutegg-physics-fall (flutflutegg)
  :code (behavior ()
    (local-vars (v1-25 symbol))
    (process-spawn
      camera-tracker
      :init camera-tracker-init
      (lambda :behavior camera-tracker
        ()
        (while (not (process-grab? *target*))
          (suspend)
          )
        (camera-change-to "camera-135" 0 #f)
        (camera-look-at (the-as pair (ppointer->process (-> self parent))) (the-as uint 9))
        (let ((gp-0 (-> *display* base-frame-counter)))
          (until (>= (- (-> *display* base-frame-counter) gp-0) (seconds 4))
            (suspend)
            )
          )
        (while (not (process-release? (handle->process (-> self grab-target))))
          (suspend)
          )
        (camera-look-at (the-as pair *target*) (the-as uint 0))
        (send-event *camera* 'blend-from-as-fixed)
        (camera-change-to (the-as string 'base) 75 #f)
        (none)
        )
      :to self
      )
    (close-specific-task! (game-task beach-flutflut) (task-status need-reminder))
    (loop
      (vector-float*! (-> self root-override transv) (-> self dir) (-> self vel))
      (set! (-> self state-time) (-> *display* base-frame-counter))
      (until v1-25
        (vector-v++!
          (-> self root-override transv)
          (compute-acc-due-to-gravity (-> self root-override) (new-stack-vector0) 0.0)
          )
        (integrate-for-enemy-with-move-to-ground!
          (-> self root-override)
          (-> self root-override transv)
          (collide-kind background)
          8192.0
          #f
          #f
          #f
          )
        (move! (-> self wobbler))
        (TODO-RENAME-12 (-> self wobbler) (-> self root-override quat))
        (let ((a2-6 (quaternion-axis-angle! (new 'stack-no-clear 'quaternion) 0.0 1.0 0.0 -18204.445)))
          (quaternion*! (-> self root-override quat) (-> self root-override quat) a2-6)
          )
        (suspend)
        (set! v1-25 (and (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.5))
                         (logtest? (-> self root-override status) (cshape-moving-flags onsurf))
                         )
              )
        )
      (sound-play "sack-land" :vol 200)
      (go flutflutegg-break #f)
      )
    (none)
    )
  :post (the-as (function none :behavior flutflutegg) ja-post)
  )

;; failed to figure out what this is:
(defstate flutflutegg-break (flutflutegg)
  :code (behavior ((arg0 symbol))
    (when arg0
      (set-vector! (-> self root-override trans) -231190.94 64559.105 -1164727.5 1.0)
      (quaternion-axis-angle! (-> self root-override quat) 0.0 1.0 0.0 -18204.445)
      )
    (suspend)
    (update-transforms! (-> self root-override))
    (when (not arg0)
      (ja-no-eval :group! (-> self draw art-group data 5) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (ja :group! (-> self draw art-group data 5) :num! max)
    (while (and (not (task-closed? (game-task beach-flutflut) (task-status need-reward-speech)))
                (zero? (logand (-> self ambients-played) 1024))
                )
      (if (play-ambient (-> self ambient) "BIR-AM11" #f (the-as vector #f))
          (logior! (-> self ambients-played) 1024)
          )
      (suspend)
      )
    (let ((gp-2 (-> *display* base-frame-counter)))
      (while (not (task-closed? (game-task beach-flutflut) (task-status need-reward-speech)))
        (if (>= (- (-> *display* base-frame-counter) gp-2) (seconds 10))
            (level-hint-spawn
              (game-text-id beach-flutflutegg-hint)
              "sksp0029"
              (the-as entity #f)
              *entity-pool*
              (game-task none)
              )
            )
        (suspend)
        )
      )
    (ja-channel-set! 0)
    (while (not (task-closed? (game-task beach-flutflut) (task-status need-resolution)))
      (suspend)
      )
    (ja-channel-set! 1)
    (set-vector! (-> self root-override trans) -231190.94 64559.105 -1164727.5 1.0)
    (quaternion-axis-angle! (-> self root-override quat) 0.0 1.0 0.0 0.0)
    (ja :group! (-> self draw art-group data 6) :num! max)
    (loop
      (logior! (-> self mask) (process-mask sleep))
      (suspend)
      )
    (none)
    )
  :post (the-as (function none :behavior flutflutegg) ja-post)
  )

;; definition for method 11 of type flutflutegg
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(defmethod init-from-entity! flutflutegg ((obj flutflutegg) (arg0 entity-actor))
  (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum 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 2) 0)))
      (set! (-> s3-0 prim-core collide-as) (collide-kind enemy))
      (set! (-> s3-0 collide-with) (collide-kind target))
      (set! (-> s3-0 prim-core action) (collide-action solid))
      (set! (-> s3-0 prim-core offense) (collide-offense indestructible))
      (set-vector! (-> s3-0 local-sphere) 0.0 12288.0 0.0 12288.0)
      (set-root-prim! s4-0 s3-0)
      (let ((s2-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0))))
        (set! (-> s2-0 prim-core collide-as) (collide-kind enemy))
        (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-vector! (-> s2-0 local-sphere) 0.0 8192.0 0.0 8192.0)
        (append-prim s3-0 s2-0)
        )
      (let ((s2-1 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0))))
        (set! (-> s2-1 prim-core collide-as) (collide-kind enemy))
        (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-vector! (-> s2-1 local-sphere) 0.0 16384.0 0.0 7782.4)
        (append-prim s3-0 s2-1)
        )
      )
    (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *flutflutegg-sg* '())
  (vector-z-quaternion! (-> obj dir) (-> obj root-override quat))
  (set! (-> obj start quad) (-> obj root-override trans quad))
  (set! (-> obj fall-dist) 20480.0)
  (set-yaw-angle-clear-roll-pitch! (-> obj root-override) (+ -16384.0 (y-angle (-> obj root-override))))
  (set! (-> obj pos) 0.0)
  (set! (-> obj vel) 0.0)
  (set! (-> obj wobbler) (new 'process 'wobbler))
  (reset! (-> obj wobbler) 0.1 0.98 4096.0)
  (set! (-> obj last-impulse-time) 0)
  (set! (-> obj ambients-played) 0)
  (if (task-closed? (game-task beach-flutflut) (task-status need-reminder))
      (go flutflutegg-break #t)
      (go flutflutegg-idle)
      )
  (none)
  )

;; definition of type harvester
(deftype harvester (process-drawable)
  ((root-override collide-shape  :offset        112)
   (alt-actor     entity-actor   :offset-assert 176)
   )
  :heap-base #x50
  :method-count-assert 20
  :size-assert         #xb4
  :flag-assert         #x14005000b4
  (:states
    harvester-idle
    (harvester-inflate symbol)
    )
  )

;; definition for method 3 of type harvester
(defmethod inspect harvester ((obj harvester))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Talt-actor: ~A~%" (-> obj alt-actor))
  obj
  )

;; failed to figure out what this is:
(defskelgroup *harvester-sg* harvester harvester-lod0-jg harvester-idle-ja
              ((harvester-lod0-mg (meters 20)) (harvester-lod1-mg (meters 40)) (harvester-lod2-mg (meters 999999)))
              :bounds (static-spherem 0 7 0 11)
              )

;; failed to figure out what this is:
(defstate harvester-idle (harvester)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (case arg2
      (('update)
       (if (and (-> self alt-actor) (logtest? (-> self alt-actor extra perm status) (entity-perm-status complete)))
           (go harvester-inflate #f)
           )
       )
      )
    )
  :code (behavior ()
    (if (and (-> self alt-actor) (logtest? (-> self alt-actor extra perm status) (entity-perm-status complete)))
        (go harvester-inflate #t)
        )
    (ja :group! (-> self draw art-group data 5) :num! (identity (ja-aframe 1.0 0)))
    (ja-post)
    (loop
      (logior! (-> self mask) (process-mask sleep))
      (suspend)
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate harvester-inflate (harvester)
  :code (behavior ((arg0 symbol))
    (when (not arg0)
      (ja-no-eval :group! (-> self draw art-group data 5) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (loop
      (ja-no-eval :group! (-> self draw art-group data 4) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior harvester) ja-post)
  )

;; definition for method 11 of type harvester
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! harvester ((obj harvester) (arg0 entity-actor))
  (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask)))
  (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player))))
    (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 5) 0)))
      (set! (-> s3-0 prim-core collide-as) (collide-kind background))
      (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 20480.0 0.0 40960.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 0))))
        (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) 4)
        (set-vector! (-> s2-0 local-sphere) 0.0 6144.0 0.0 24576.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) 4)
        (set-vector! (-> s2-1 local-sphere) 16384.0 -20480.0 16384.0 20480.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) 4)
        (set-vector! (-> s2-2 local-sphere) 16384.0 -20480.0 -16384.0 20480.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 0))))
        (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) 4)
        (set-vector! (-> s2-3 local-sphere) -16384.0 -20480.0 -16384.0 20480.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) 4)
        (set-vector! (-> s2-4 local-sphere) -16384.0 -20480.0 16384.0 20480.0)
        (append-prim s3-0 s2-4)
        )
      )
    (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *harvester-sg* '())
  (set! (-> obj alt-actor) (entity-actor-lookup (-> obj entity) 'alt-actor 0))
  (go harvester-idle)
  (none)
  )

;; definition of type beachcam
(deftype beachcam (process-hidden)
  ()
  :method-count-assert 15
  :size-assert         #x70
  :flag-assert         #xf00000070
  )

;; definition for method 3 of type beachcam
(defmethod inspect beachcam ((obj beachcam))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tname: ~A~%" (-> obj name))
  (format #t "~Tmask: ~D~%" (-> obj mask))
  (format #t "~Tparent: #x~X~%" (-> obj parent))
  (format #t "~Tbrother: #x~X~%" (-> obj brother))
  (format #t "~Tchild: #x~X~%" (-> obj child))
  (format #t "~Tppointer: #x~X~%" (-> obj ppointer))
  (format #t "~Tself: ~A~%" (-> obj self))
  (format #t "~Tpool: ~A~%" (-> obj pool))
  (format #t "~Tstatus: ~A~%" (-> obj status))
  (format #t "~Tpid: ~D~%" (-> obj pid))
  (format #t "~Tmain-thread: ~A~%" (-> obj main-thread))
  (format #t "~Ttop-thread: ~A~%" (-> obj top-thread))
  (format #t "~Tentity: ~A~%" (-> obj entity))
  (format #t "~Tstate: ~A~%" (-> obj state))
  (format #t "~Ttrans-hook: ~A~%" (-> obj trans-hook))
  (format #t "~Tpost-hook: ~A~%" (-> obj post-hook))
  (format #t "~Tevent-hook: ~A~%" (-> obj event-hook))
  (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length))
  (format #t "~Tnext-state: ~A~%" (-> obj next-state))
  (format #t "~Theap-base: #x~X~%" (-> obj heap-base))
  (format #t "~Theap-top: #x~X~%" (-> obj heap-top))
  (format #t "~Theap-cur: #x~X~%" (-> obj heap-cur))
  (format #t "~Tstack-frame-top: ~A~%" (-> obj stack-frame-top))
  (format #t "~Theap: #<kheap @ #x~X>~%" (&-> obj heap-base))
  (format #t "~Tconnection-list: ~`'connectable`P~%" (-> obj connection-list))
  (format #t "~Tstack[0] @ #x~X~%" (-> obj stack))
  obj
  )

;; definition for function beachcam-spawn
;; INFO: Return type mismatch int vs none.
(defun beachcam-spawn ()
  (with-pp
    (let ((gp-0 (entity-actor-lookup (-> pp entity) 'alt-actor 0)))
      (when gp-0
        (let* ((gp-1
                 (ppointer->handle (process-spawn
                                     pov-camera
                                     (-> gp-0 extra trans)
                                     *beachcam-sg*
                                     (new 'static 'spool-anim :name "beachcam-cannon" :index 3 :parts 1 :command-list '())
                                     0
                                     #f
                                     '()
                                     :to pp
                                     )
                                   )
                 )
               (s5-2 (ppointer->handle
                       (process-spawn fuel-cell :init fuel-cell-init-as-clone gp-1 (-> pp entity extra perm task) :to pp)
                       )
                     )
               )
          (let ((v1-13 (handle->process gp-1)))
            (if v1-13
                (set! (-> (the-as pov-camera v1-13) notify-handle) (the-as handle s5-2))
                )
            )
          (while (handle->process gp-1)
            (suspend)
            )
          (send-event (handle->process s5-2) 'stop-cloning)
          )
        )
      )
    0
    (none)
    )
  )
