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

(import "goal_src/jak1/import/balloonlurker-ag.gc")

;; failed to figure out what this is:
(defpartgroup group-balloonlurker-pilot-death
  :id 203
  :duration 5
  :linger-duration 600
  :flags (use-local-clock)
  :bounds (static-bspherem 0 0 0 12)
  :parts ((sp-item 2015))
  )

;; failed to figure out what this is:
(defpart 2015
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 1.0)
    (sp-flt spt-y (meters 1))
    (sp-flt spt-scale-x (meters 16))
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-flt spt-r 196.0)
    (sp-flt spt-g 196.0)
    (sp-flt spt-b 196.0)
    (sp-flt spt-a 128.0)
    (sp-flt spt-fade-a -3.2)
    (sp-int spt-timer 25)
    (sp-cpuinfo-flags bit2 bit3)
    )
  )

;; failed to figure out what this is:
(defpartgroup group-balloonlurker-mine-explosion
  :id 204
  :duration 600
  :flags (use-local-clock)
  :bounds (static-bspherem 0 0 0 16)
  :parts ((sp-item 964 :period 1200 :length 30)
    (sp-item 965 :fade-after (meters 60) :period 1200 :length 15)
    (sp-item 966 :period 1200 :length 15 :offset 15)
    (sp-item 967 :period 1200 :length 15)
    (sp-item 968 :fade-after (meters 80) :period 1200 :length 30 :binding 963)
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    (sp-item 963 :flags (start-dead))
    )
  )

;; failed to figure out what this is:
(defpart 964
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2))
    (sp-flt spt-num 1.5)
    (sp-rnd-flt spt-y (meters 0.5) (meters 0.5) 1.0)
    (sp-rnd-flt spt-scale-x (meters 2.5) (meters 1.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-flt spt-r 70.0)
    (sp-flt spt-g 70.0)
    (sp-rnd-flt spt-b 70.0 16.0 1.0)
    (sp-flt spt-a 96.0)
    (sp-rnd-flt spt-vel-y (meters 0.006666667) (meters 0.033333335) 1.0)
    (sp-flt spt-scalevel-x (meters 0.006))
    (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0)
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-accel-y 0.2048)
    (sp-flt spt-friction 0.92)
    (sp-int spt-timer 900)
    (sp-cpuinfo-flags bit2 bit12 bit14)
    (sp-int-plain-rnd spt-next-time 30 299 1)
    (sp-launcher-by-id spt-next-launcher 969)
    (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)
    (sp-flt spt-conerot-radius (meters 2))
    )
  )

;; failed to figure out what this is:
(defpart 969
  :init-specs ((sp-flt spt-scalevel-x (meters 0)) (sp-copy-from-other spt-scalevel-y -4) (sp-flt spt-fade-a -0.32))
  )

;; failed to figure out what this is:
(defpart 965
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2 :page #x2))
    (sp-flt spt-num 6.0)
    (sp-flt spt-y (meters 0.75))
    (sp-rnd-flt spt-scale-x (meters 8) (meters 8) 1.0)
    (sp-int spt-rot-x 4)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-rnd-flt spt-scale-y (meters 1.2) (meters 3) 1.0)
    (sp-flt spt-r 192.0)
    (sp-flt spt-g 192.0)
    (sp-rnd-flt spt-b 64.0 128.0 1.0)
    (sp-flt spt-a 0.0)
    (sp-flt spt-scalevel-x (meters 0.009765625))
    (sp-rnd-flt spt-rotvel-z (degrees -0.15) (degrees 0.3) 1.0)
    (sp-flt spt-scalevel-y (meters 0.009765625))
    (sp-flt spt-fade-a 2.1333334)
    (sp-int spt-timer 30)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    (sp-int spt-next-time 15)
    (sp-launcher-by-id spt-next-launcher 970)
    (sp-flt spt-rotate-y (degrees 0.0))
    )
  )

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

;; failed to figure out what this is:
(defpart 966
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 1.0)
    (sp-flt spt-y (meters 1))
    (sp-rnd-flt spt-scale-x (meters 24) (meters 16) 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-flt spt-r 196.0)
    (sp-flt spt-g 196.0)
    (sp-flt spt-b 196.0)
    (sp-flt spt-a 64.0)
    (sp-int spt-timer 5)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    )
  )

;; failed to figure out what this is:
(defpart 967
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 1.0)
    (sp-flt spt-y (meters 1))
    (sp-rnd-flt spt-scale-x (meters 24) (meters 16) 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-flt spt-r 196.0)
    (sp-flt spt-g 32.0)
    (sp-flt spt-b 32.0)
    (sp-flt spt-a 64.0)
    (sp-int spt-timer 5)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    )
  )

;; failed to figure out what this is:
(defpart 968
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2))
    (sp-rnd-flt spt-num 5.0 10.0 1.0)
    (sp-rnd-flt spt-x (meters -0.5) (meters 1) 1.0)
    (sp-rnd-flt spt-y (meters 0.25) (meters 1.5) 1.0)
    (sp-rnd-flt spt-z (meters -0.5) (meters 1) 1.0)
    (sp-flt spt-scale-x (meters 0.5))
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-flt spt-r 255.0)
    (sp-rnd-int spt-g 1123942400 1 127.0)
    (sp-flt spt-b 0.0)
    (sp-flt spt-a 127.0)
    (sp-rnd-flt spt-vel-y (meters 0.06666667) (meters 0.06666667) 1.0)
    (sp-flt spt-fade-g -4.266667)
    (sp-flt spt-fade-b -2.8444445)
    (sp-flt spt-accel-y -16.384)
    (sp-flt spt-friction 0.97)
    (sp-int spt-timer 90)
    (sp-cpuinfo-flags bit2 bit3)
    (sp-int-plain-rnd spt-next-time 5 38 1)
    (sp-launcher-by-id spt-next-launcher 971)
    (sp-rnd-flt spt-conerot-x (degrees 40.0) (degrees 30.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 971
  :init-specs ((sp-flt spt-scalevel-x (meters -0.0033333334))
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-r -4.266667)
    (sp-flt spt-fade-g 0.7111111)
    (sp-flt spt-fade-b 1.4222223)
    (sp-flt spt-fade-a -2.8444445)
    )
  )

;; failed to figure out what this is:
(defpart 963
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2))
    (sp-flt spt-num 2.0)
    (sp-rnd-flt spt-x (meters -0.25) (meters 0.5) 1.0)
    (sp-rnd-flt spt-y (meters -0.25) (meters 0.5) 1.0)
    (sp-rnd-flt spt-z (meters -0.25) (meters 0.5) 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.5) (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-flt spt-r 70.0)
    (sp-flt spt-g 70.0)
    (sp-rnd-flt spt-b 70.0 16.0 1.0)
    (sp-rnd-flt spt-a 20.0 8.0 1.0)
    (sp-flt spt-scalevel-x (meters 0.0033333334))
    (sp-rnd-flt spt-rotvel-z (degrees -0.3) (degrees 0.6) 1.0)
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-a -0.11666667)
    (sp-int spt-timer 300)
    (sp-cpuinfo-flags bit2 bit12)
    )
  )

;; definition of type balloonlurker-bank
(deftype balloonlurker-bank (basic)
  ((buoyancy-depth-offset       meters  :offset-assert   4)
   (player-mass                 float   :offset-assert   8)
   (rudder-factor               float   :offset-assert  12)
   (max-engine-thrust           float   :offset-assert  16)
   (max-rudder-deflection-angle float   :offset-assert  20)
   (throttle-factor             float   :offset-assert  24)
   (throttle-distance           float   :offset-assert  28)
   (throttle-close-distance     float   :offset-assert  32)
   (explosion-force             float   :offset-assert  36)
   (mine-weight                 float   :offset-assert  40)
   )
  :method-count-assert 9
  :size-assert         #x2c
  :flag-assert         #x90000002c
  )

;; definition for method 3 of type balloonlurker-bank
(defmethod inspect balloonlurker-bank ((obj balloonlurker-bank))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tbuoyancy-depth-offset: (meters ~m)~%" (-> obj buoyancy-depth-offset))
  (format #t "~Tplayer-mass: ~f~%" (-> obj player-mass))
  (format #t "~Trudder-factor: ~f~%" (-> obj rudder-factor))
  (format #t "~Tmax-engine-thrust: ~f~%" (-> obj max-engine-thrust))
  (format #t "~Tmax-rudder-deflection-angle: ~f~%" (-> obj max-rudder-deflection-angle))
  (format #t "~Tthrottle-factor: ~f~%" (-> obj throttle-factor))
  (format #t "~Tthrottle-distance: ~f~%" (-> obj throttle-distance))
  (format #t "~Tthrottle-close-distance: ~f~%" (-> obj throttle-close-distance))
  (format #t "~Texplosion-force: ~f~%" (-> obj explosion-force))
  (format #t "~Tmine-weight: ~f~%" (-> obj mine-weight))
  obj
  )

;; definition for symbol *BALLOONLURKER-bank*, type balloonlurker-bank
(define *BALLOONLURKER-bank* (new 'static 'balloonlurker-bank
                               :buoyancy-depth-offset (meters 30)
                               :player-mass 20.0
                               :rudder-factor 32.0
                               :max-engine-thrust 409600.0
                               :max-rudder-deflection-angle 8192.0
                               :throttle-factor 0.5
                               :throttle-distance 53248.0
                               :throttle-close-distance 81920.0
                               :explosion-force 24576000.0
                               :mine-weight 53248.0
                               )
        )

;; definition for symbol *balloonlurker-constants*, type rigid-body-platform-constants
(define *balloonlurker-constants* (new 'static 'rigid-body-platform-constants
                                    :drag-factor 1.6
                                    :buoyancy-factor 1.2
                                    :max-buoyancy-depth (meters 15)
                                    :gravity-factor 1.0
                                    :gravity (meters 60)
                                    :player-weight (meters 6.6)
                                    :player-bonk-factor 1.0
                                    :player-dive-factor 1.0
                                    :player-force-distance (meters 1000)
                                    :player-force-clamp (meters 1000000)
                                    :player-force-timeout (seconds 0.1)
                                    :explosion-force (meters 1000)
                                    :linear-damping 1.0
                                    :angular-damping 1.0
                                    :control-point-count 7
                                    :mass 2.0
                                    :inertial-tensor-x (meters 12)
                                    :inertial-tensor-y (meters 12)
                                    :inertial-tensor-z (meters 20)
                                    :cm-joint-y (meters 9)
                                    :idle-distance (meters 50)
                                    :platform #f
                                    :sound-name #f
                                    )
        )

;; definition of type balloonlurker
(deftype balloonlurker (rigid-body-platform)
  ((explosion-force-position    vector              :inline :offset-assert 736)
   (explosion-force             vector              :inline :offset-assert 752)
   (explosion                   symbol                      :offset-assert 768)
   (explosion-joint-index       uint16              2       :offset-assert 772)
   (explosion-joint-index-bytes int8                4       :offset        772)
   (vulnerable                  symbol                      :offset-assert 776)
   (water-y                     float                       :offset-assert 780)
   (propeller                   joint-mod-spinner           :offset-assert 784)
   (rudder                      joint-mod-set-local         :offset-assert 788)
   (mine                        joint-mod-set-world 2       :offset-assert 792)
   (buoyancy-factor             float                       :offset-assert 800)
   (rudder-control              float                       :offset-assert 804)
   (throttle-control            float                       :offset-assert 808)
   (engine-thrust               float                       :offset-assert 812)
   (dest-point                  vector              :inline :offset-assert 816)
   (dest-point-old              vector              :inline :offset-assert 832)
   (dest-index                  int8                        :offset-assert 848)
   (auto-pilot                  symbol                      :offset-assert 852)
   (dead                        symbol                      :offset-assert 856)
   (anim-frame                  float                       :offset-assert 860)
   (engine-sound-id             sound-id                    :offset-assert 864)
   (pedal-sound-id              sound-id                    :offset-assert 868)
   (frame-count                 int8                        :offset-assert 872)
   )
  :heap-base #x300
  :method-count-assert 35
  :size-assert         #x369
  :flag-assert         #x2303000369
  (:states
    balloonlurker-die
    (balloonlurker-mine-explode int)
    balloonlurker-patrol
    )
  )

;; definition for method 3 of type balloonlurker
(defmethod inspect balloonlurker ((obj balloonlurker))
  (let ((t9-0 (method-of-type rigid-body-platform inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Texplosion-force-position: #<vector @ #x~X>~%" (-> obj explosion-force-position))
  (format #t "~T~Texplosion-force: #<vector @ #x~X>~%" (-> obj explosion-force))
  (format #t "~T~Texplosion: ~A~%" (-> obj explosion))
  (format #t "~T~Texplosion-joint-index[2] @ #x~X~%" (-> obj explosion-joint-index-bytes))
  (format #t "~T~Tvulnerable: ~A~%" (-> obj vulnerable))
  (format #t "~T~Twater-y: ~f~%" (-> obj water-y))
  (format #t "~T~Tpropeller: ~A~%" (-> obj propeller))
  (format #t "~T~Trudder: ~A~%" (-> obj rudder))
  (format #t "~T~Tmine[2] @ #x~X~%" (-> obj mine))
  (format #t "~T~Tbuoyancy-factor: ~f~%" (-> obj buoyancy-factor))
  (format #t "~T~Trudder-control: ~f~%" (-> obj rudder-control))
  (format #t "~T~Tthrottle-control: ~f~%" (-> obj throttle-control))
  (format #t "~T~Tengine-thrust: ~f~%" (-> obj engine-thrust))
  (format #t "~T~Tdest-point: #<vector @ #x~X>~%" (-> obj dest-point))
  (format #t "~T~Tdest-point-old: #<vector @ #x~X>~%" (-> obj dest-point-old))
  (format #t "~T~Tdest-index: ~D~%" (-> obj dest-index))
  (format #t "~T~Tauto-pilot: ~A~%" (-> obj auto-pilot))
  (format #t "~T~Tdead: ~A~%" (-> obj dead))
  (format #t "~T~Tanim-frame: ~f~%" (-> obj anim-frame))
  (format #t "~T~Tengine-sound-id: ~D~%" (-> obj engine-sound-id))
  (format #t "~T~Tpedal-sound-id: ~D~%" (-> obj pedal-sound-id))
  (format #t "~T~Tframe-count: ~D~%" (-> obj frame-count))
  obj
  )

;; definition of type balloonlurker-pilot
(deftype balloonlurker-pilot (process-drawable)
  ((parent-override (pointer balloonlurker)  :offset  12)
   (root-override   collide-shape-moving     :offset 112)
   )
  :heap-base #x40
  :method-count-assert 22
  :size-assert         #xb0
  :flag-assert         #x16004000b0
  (:methods
    (dummy-20 (_type_) none 20)
    (dummy-21 (_type_) none 21)
    )
  (:states
    balloonlurker-pilot-die
    balloonlurker-pilot-idle
    )
  )

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

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

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

;; definition for function balloonlurker-get-path-point
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defbehavior balloonlurker-get-path-point balloonlurker ((arg0 int))
  (if (<= (-> self path curve num-cverts) 0)
      (go process-drawable-art-error "no path")
      )
  (set! (-> self dest-index) arg0)
  (set! (-> self dest-point-old quad) (-> self dest-point quad))
  (eval-path-curve-div! (-> self path) (-> self dest-point) (the float arg0) 'interp)
  0
  (none)
  )

;; definition for function balloonlurker-get-next-path-point
;; INFO: Return type mismatch int vs none.
(defbehavior balloonlurker-get-next-path-point balloonlurker ()
  (if (<= (-> self path curve num-cverts) 0)
      (go process-drawable-art-error "no path")
      )
  (let ((a0-1 (+ (-> self dest-index) 1)))
    (if (= a0-1 (-> self path curve num-cverts))
        (set! a0-1 0)
        )
    (balloonlurker-get-path-point a0-1)
    )
  0
  (none)
  )

;; definition for function balloonlurker-snap-to-path-point
;; Used lq/sq
(defbehavior balloonlurker-snap-to-path-point balloonlurker ((arg0 int))
  (let ((s4-0 (new 'stack-no-clear 'vector))
        (gp-0 (new 'stack-no-clear 'vector))
        )
    (eval-path-curve-div! (-> self path) s4-0 (the float arg0) 'interp)
    (set! (-> self root-overlay trans quad) (-> s4-0 quad))
    (TODO-RENAME-12 (-> self path) gp-0 (the float arg0))
    (set! (-> gp-0 y) 0.0)
    (vector-normalize! gp-0 1.0)
    (forward-up-nopitch->quaternion (-> self root-overlay quat) gp-0 *up-vector*)
    )
  )

;; definition for function balloonlurker-find-nearest-path-point
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defbehavior balloonlurker-find-nearest-path-point balloonlurker ()
  (let ((gp-0 0))
    (let ((f30-0 409600000.0)
          (s5-0 (new 'stack-no-clear 'vector))
          )
      (dotimes (s4-0 (-> self path curve num-cverts))
        (eval-path-curve-div! (-> self path) s5-0 (the float s4-0) 'interp)
        (let ((f0-2 (vector-vector-xz-distance (-> self root-overlay trans) s5-0)))
          (when (< f0-2 f30-0)
            (set! f30-0 f0-2)
            (set! gp-0 s4-0)
            )
          )
        )
      )
    (balloonlurker-get-path-point gp-0)
    )
  (set! (-> self dest-point-old quad) (-> self dest-point quad))
  0
  (none)
  )

;; definition for function balloonlurker-player-impulse
;; Used lq/sq
(defbehavior balloonlurker-player-impulse balloonlurker ()
  (when *target*
    (set! (-> self player-impulse) (the-as collide-shape-prim-mesh #t))
    (set! (-> self player-force-position quad) (-> *target* control trans quad))
    (vector-! (-> self player-force) (-> self player-velocity) (-> *target* control transv))
    (vector-float*! (-> self player-force) (-> self player-force) (-> *BALLOONLURKER-bank* player-mass))
    )
  )

;; definition for function balloonlurker-event-handler
;; Used lq/sq
(defbehavior balloonlurker-event-handler balloonlurker ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
  (case arg2
    (('touch 'attack)
     (balloonlurker-player-impulse)
     (when ((method-of-type touching-shapes-entry prims-touching?)
            (the-as touching-shapes-entry (-> arg3 param 0))
            (-> self root-overlay)
            (the-as uint 1)
            )
       (do-push-aways! (-> self root-overlay))
       (send-event
         arg0
         'shove
         (-> arg3 param 0)
         (static-attack-info ((shove-back (meters 2)) (shove-up (meters 0.5))))
         )
       )
     (dotimes (s4-0 2)
       (let ((s3-0 (if (zero? s4-0)
                       8
                       16
                       )
                   )
             )
         (when ((method-of-type touching-shapes-entry prims-touching?)
                (the-as touching-shapes-entry (-> arg3 param 0))
                (-> self root-overlay)
                (the-as uint s3-0)
                )
           (let ((a0-10 (find-prim-by-id (-> self root-overlay) (the-as uint s3-0))))
             (when a0-10
               (set! (-> self explosion-force-position quad) (-> a0-10 prim-core world-sphere quad))
               (if (send-event arg0 'attack (-> arg3 param 0) (static-attack-info ((mode 'balloonlurker))))
                   (level-hint-spawn
                     (game-text-id misty-bike-mines-hint)
                     "sksp0063"
                     (the-as entity #f)
                     *entity-pool*
                     (game-task none)
                     )
                   )
               (go balloonlurker-mine-explode s4-0)
               )
             )
           )
         )
       )
     #f
     )
    (('die)
     (go balloonlurker-die)
     )
    )
  )

;; definition for method 23 of type balloonlurker
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defmethod TODO-RENAME-23 balloonlurker ((obj balloonlurker) (arg0 float))
  (let ((s5-0 (new 'stack-no-clear 'vector)))
    (let ((s3-0 (new 'stack-no-clear 'vector))
          (s4-0 (-> obj rbody matrix))
          )
      (dotimes (s2-0 4)
        (let ((s1-0 (-> obj control-point-array data s2-0)))
          (vector-matrix*! (-> s1-0 world-pos) (-> s1-0 local-pos) s4-0)
          (TODO-RENAME-17 (-> obj rbody) (-> s1-0 world-pos) (-> s1-0 velocity))
          (let* ((f30-0 (vector-vector-xz-distance (-> obj dest-point) (-> obj root-overlay trans)))
                 (f0-0 (vector-vector-xz-distance (-> obj dest-point-old) (-> obj root-overlay trans)))
                 (f0-6
                   (/ (- (+ (/ (+ (* f30-0 (-> obj dest-point-old y)) (* f0-0 (-> obj dest-point y))) (fmax 409.6 (+ f30-0 f0-0)))
                            (-> *BALLOONLURKER-bank* buoyancy-depth-offset)
                            )
                         (-> s1-0 world-pos y)
                         )
                      (-> obj info max-buoyancy-depth)
                      )
                   )
                 )
            (vector-float*!
              s5-0
              *y-vector*
              (* 0.25
                 (-> obj buoyancy-factor)
                 (-> obj info gravity-factor)
                 (fmax 0.3 (fmin 1.0 f0-6))
                 (-> obj info gravity)
                 (-> obj rbody mass)
                 )
              )
            )
          (TODO-RENAME-13 (-> obj rbody) (-> s1-0 world-pos) s5-0)
          (vector-float*! s5-0 (-> s1-0 velocity) (* -1.0 (-> obj info drag-factor)))
          (TODO-RENAME-13 (-> obj rbody) (-> s1-0 world-pos) s5-0)
          )
        0
        )
      (let ((s2-1 (-> obj control-point-array data 4)))
        (let ((f30-1 (* (-> *BALLOONLURKER-bank* max-rudder-deflection-angle) (-> obj rudder-control))))
          (vector-matrix*! (-> s2-1 world-pos) (-> s2-1 local-pos) s4-0)
          (TODO-RENAME-17 (-> obj rbody) (-> s2-1 world-pos) (-> s2-1 velocity))
          (set-vector! s3-0 (cos f30-1) 0.0 (sin f30-1) 1.0)
          )
        (vector-rotate*! s3-0 s3-0 s4-0)
        (vector-float*!
          s5-0
          s3-0
          (* -1.0 (-> *BALLOONLURKER-bank* rudder-factor) (vector-dot s3-0 (-> s2-1 velocity)))
          )
        (TODO-RENAME-13 (-> obj rbody) (-> s2-1 world-pos) s5-0)
        )
      0
      (let ((s3-1 (-> obj control-point-array data 5)))
        (vector-matrix*! (-> s3-1 world-pos) (-> s3-1 local-pos) s4-0)
        (set! (-> s3-1 world-pos quad) (-> s3-1 world-pos quad))
        (vector-float*! s5-0 (-> s4-0 vector 2) (-> obj engine-thrust))
        (TODO-RENAME-13 (-> obj rbody) (-> s3-1 world-pos) s5-0)
        )
      )
    (dotimes (s4-1 2)
      (when (-> obj mine s4-1 enable)
        (let ((v1-43 (-> obj control-point-array data (if (zero? s4-1)
                                                          5
                                                          4
                                                          )
                         )
                     )
              )
          (vector-float*! s5-0 *y-vector* (-> *BALLOONLURKER-bank* mine-weight))
          (TODO-RENAME-13 (-> obj rbody) (-> v1-43 world-pos) s5-0)
          )
        )
      )
    (vector-float*!
      s5-0
      *y-vector*
      (* -1.0 (-> obj info gravity-factor) (-> obj info gravity) (-> obj rbody mass))
      )
    (TODO-RENAME-15 (-> obj rbody) s5-0)
    )
  (when (or (-> obj player-impulse) (-> obj player-contact))
    (set! (-> obj player-impulse) #f)
    (TODO-RENAME-13 (-> obj rbody) (-> obj player-force-position) (-> obj player-force))
    )
  (when (-> obj explosion)
    (set! (-> obj explosion) #f)
    (TODO-RENAME-13 (-> obj rbody) (-> obj explosion-force-position) (-> obj explosion-force))
    )
  0
  (none)
  )

;; definition for symbol *balloonlurker-rudder-joint-home*, type vector
(define *balloonlurker-rudder-joint-home* (new 'static 'vector :x 0.5 :y -0.5 :z -0.5 :w 0.5))

;; definition for function balloonlurker-play-sounds
;; INFO: Return type mismatch int vs none.
(defbehavior balloonlurker-play-sounds balloonlurker ()
  (cond
    ((not (-> self dead))
     (if (zero? (-> self engine-sound-id))
         (set! (-> self engine-sound-id) (new-sound-id))
         )
     (if (zero? (-> self pedal-sound-id))
         (set! (-> self pedal-sound-id) (new-sound-id))
         )
     (when (< (vector-vector-distance (-> self root-overlay trans) (ear-trans)) 286720.0)
       (let* ((f0-2 (/ (-> self engine-thrust) (-> *BALLOONLURKER-bank* max-engine-thrust)))
              (f1-2 100.0)
              (f0-3 (* 3.0 f0-2))
              )
         (sound-play
           "propeller"
           :id (-> self engine-sound-id)
           :vol f1-2
           :pitch f0-3
           :position (the-as symbol (-> self node-list data 4 bone transform vector 3))
           )
         )
       (sound-play "pedals" :id (-> self pedal-sound-id) :position (the-as symbol (-> self root-overlay trans)))
       )
     )
    (else
      (when (nonzero? (-> self engine-sound-id))
        (sound-stop (-> self engine-sound-id))
        (set! (-> self engine-sound-id) (new 'static 'sound-id))
        0
        )
      (when (nonzero? (-> self pedal-sound-id))
        (sound-stop (-> self pedal-sound-id))
        (set! (-> self pedal-sound-id) (new 'static 'sound-id))
        0
        )
      )
    )
  (none)
  )

;; definition for function balloonlurker-post
;; Used lq/sq
(defbehavior balloonlurker-post balloonlurker ()
  (set! (-> self anim-frame) (ja-frame-num 0))
  (cond
    ((and (-> self auto-pilot) (not (-> self dead)))
     (let* ((s4-0 (-> self rbody matrix vector 2))
            (s5-0 (-> self rbody matrix))
            (gp-0 (-> self rbody position))
            (f30-0 (vector-vector-xz-distance (-> self dest-point) gp-0))
            )
       (when (< f30-0 (-> *BALLOONLURKER-bank* throttle-close-distance))
         (balloonlurker-get-next-path-point)
         (set! f30-0 (vector-vector-xz-distance (-> self dest-point) gp-0))
         )
       (let ((f0-4 (- (vector-dot s4-0 (-> self dest-point)) (vector-dot s4-0 gp-0)))
             (f2-2 (- (vector-dot (the-as vector s5-0) (-> self dest-point)) (vector-dot (the-as vector s5-0) gp-0)))
             )
         (seek!
           (-> self rudder-control)
           (fmax -1.0 (fmin 1.0 (/ f2-2 (fmax 4096.0 f0-4))))
           (* 4.0 (-> *display* seconds-per-frame))
           )
         )
       (let ((f0-12 0.0)
             (f1-7 1.0)
             (f2-4 (* (-> *BALLOONLURKER-bank* throttle-factor) (- f30-0 (-> *BALLOONLURKER-bank* throttle-distance))))
             (f3-3 (-> *BALLOONLURKER-bank* throttle-distance))
             )
         (set! (-> self throttle-control) (fmax f0-12 (fmin f1-7 (* f2-4 (/ 1.0 f3-3)))))
         )
       )
     0
     )
    (else
      (let ((f0-14 (analog-input (the-as int (-> *cpad-list* cpads 1 leftx)) 128.0 48.0 110.0 -1.0)))
        (seek! (-> self rudder-control) f0-14 (* 2.0 (-> *display* seconds-per-frame)))
        )
      (if (cpad-hold? 1 x)
          (seek! (-> self throttle-control) 1.0 (-> *display* seconds-per-frame))
          (seek! (-> self throttle-control) 0.0 (* 0.25 (-> *display* seconds-per-frame)))
          )
      )
    )
  (seek!
    (-> self engine-thrust)
    (* (-> self throttle-control) (-> *BALLOONLURKER-bank* max-engine-thrust))
    (* 0.005 (-> *BALLOONLURKER-bank* max-engine-thrust))
    )
  (let ((f0-31 60.0)
        (f1-14 1820.4445)
        (f2-6 6735.6445)
        (f3-6 (-> *BALLOONLURKER-bank* max-engine-thrust))
        )
    (set! (-> self propeller spin-rate) (* f0-31 (+ f1-14 (* f2-6 (/ 1.0 f3-6) (-> self engine-thrust)))))
    )
  (let ((f0-34 (* (-> *BALLOONLURKER-bank* max-rudder-deflection-angle) (-> self rudder-control)))
        (gp-1 (new 'stack-no-clear 'quaternion))
        )
    (quaternion-vector-angle! gp-1 *x-vector* f0-34)
    (quaternion*! (-> self rudder transform quat) (the-as quaternion *balloonlurker-rudder-joint-home*) gp-1)
    )
  (TODO-RENAME-28 self)
  (quaternion-copy! (-> self root-overlay quat) (-> self rbody rotation))
  (TODO-RENAME-18 (-> self rbody) (-> self root-overlay trans))
  (balloonlurker-play-sounds)
  (when (nonzero? (-> self draw))
    (cond
      ((or (logtest? (-> self draw status) (draw-status no-skeleton-update))
           (logtest? (-> self draw status) (draw-status was-drawn))
           )
       (logclear! (-> self draw status) (draw-status skip-bones))
       (update-transforms! (-> self root-overlay))
       (ja-post)
       )
      (else
        (set! (-> self draw origin quad) (-> self root-overlay trans quad))
        (logior! (-> self draw status) (draw-status skip-bones))
        )
      )
    )
  (none)
  )

;; failed to figure out what this is:
(defstate balloonlurker-patrol (balloonlurker)
  :event balloonlurker-event-handler
  :trans (behavior ()
    (ja :num! (loop!))
    (set! (-> self anim-frame) (ja-frame-num 0))
    (none)
    )
  :code (behavior ()
    (when (not (ja-group? balloonlurker-idle-ja))
      (ja-channel-push! 1 (seconds 0.07))
      (ja :group! balloonlurker-idle-ja)
      (ja :num-func num-func-identity :frame-num 0.0)
      )
    (ja-post)
    (anim-loop)
    (none)
    )
  :post balloonlurker-post
  )

;; failed to figure out what this is:
(defstate balloonlurker-mine-explode (balloonlurker)
  :event balloonlurker-event-handler
  :code (behavior ((arg0 int))
    (set! (-> self explosion-force-position quad)
          (-> self node-list data (-> self explosion-joint-index-bytes arg0) bone transform vector 3 quad)
          )
    (process-spawn
      part-tracker
      :init part-tracker-init
      (-> *part-group-id-table* 204)
      -1
      #f
      #f
      #f
      (-> self explosion-force-position)
      :to *entity-pool*
      )
    (sound-play "explosion")
    (set! (-> self explosion) #t)
    (vector-! (-> self explosion-force) (-> self rbody position) (-> self explosion-force-position))
    (set! (-> self explosion-force y) (* 2.0 (-> self explosion-force y)))
    (vector-length (-> self explosion-force))
    (vector-normalize! (-> self explosion-force) (-> *BALLOONLURKER-bank* explosion-force))
    (suspend)
    (ja :num! (loop!))
    (let ((v1-16 (-> self mine arg0)))
      (set! (-> v1-16 enable) #t)
      (set-vector! (-> v1-16 transform scale) 0.0 0.0 0.0 1.0)
      )
    (if (-> self dead)
        (go balloonlurker-die)
        (go balloonlurker-patrol)
        )
    (none)
    )
  :post balloonlurker-post
  )

;; failed to figure out what this is:
(defstate balloonlurker-die (balloonlurker)
  :event (the-as (function process int symbol event-message-block object :behavior balloonlurker) #f)
  :enter (behavior ()
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (set! (-> self vulnerable) #f)
    (set! (-> self dead) #t)
    (none)
    )
  :code (behavior ()
    (local-vars (v1-27 symbol) (sv-16 symbol) (sv-20 (pointer process-tree)) (sv-24 entity-actor))
    (process-entity-status! self (entity-perm-status bit-4) #t)
    (process-entity-status! self (entity-perm-status dead) #t)
    (when (or (-> self link prev) (-> self link next))
      (set! sv-16 (the-as symbol #f))
      (set! sv-20 (-> self child))
      (set! sv-24 (entity-actor-lookup (-> self entity) 'alt-actor 0))
      (entity-birth-no-kill sv-24)
      (apply-all (-> self link) actor-link-dead-hook (& sv-16))
      (when (and sv-16 sv-24)
        (process-grab? *target*)
        (let ((gp-0 (-> *display* base-frame-counter)))
          (until (>= (- (-> *display* base-frame-counter) gp-0) (seconds 1))
            (suspend)
            )
          )
        (process-release? *target*)
        (while (let ((a1-4 (new 'stack-no-clear 'event-message-block)))
                 (set! (-> a1-4 from) self)
                 (set! (-> a1-4 num-params) 0)
                 (set! (-> a1-4 message) 'task-complete)
                 (let ((t9-7 send-event-function)
                       (v1-17 sv-24)
                       )
                   (not (t9-7
                          (if v1-17
                              (-> v1-17 extra process)
                              )
                          a1-4
                          )
                        )
                   )
                 )
          (suspend)
          )
        )
      )
    (set! (-> self buoyancy-factor) (* 4.0 (-> self buoyancy-factor)))
    (until v1-27
      (suspend)
      (ja :num! (loop!))
      (set! v1-27 (or (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 30))
                      (< 819200.0 (- (-> self root-overlay trans y) (-> self water-y)))
                      )
            )
      )
    (cleanup-for-death self)
    (while (-> self child)
      (suspend)
      )
    (none)
    )
  :post balloonlurker-post
  )

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

;; failed to figure out what this is:
(defstate balloonlurker-pilot-idle (balloonlurker-pilot)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (case arg2
      (('attack)
       (send-event (ppointer->process (-> self parent-override)) 'die)
       (go balloonlurker-pilot-die)
       )
      )
    )
  :code (behavior ()
    (ja-channel-push! 1 (seconds 0.1))
    (ja :group! balloonlurker-pilot-idle-ja)
    (ja :num-func num-func-identity :frame-num 0.0)
    (loop
      (suspend)
      (ja :num-func num-func-identity :frame-num (-> self parent-override 0 anim-frame))
      )
    (none)
    )
  :post (behavior ()
    (set! (-> self root-override trans quad) (-> self parent-override 0 root-overlay trans quad))
    (quaternion-copy! (-> self root-override quat) (-> self parent-override 0 root-overlay quat))
    (update-transforms! (-> self root-override))
    (ja-post)
    (none)
    )
  )

;; failed to figure out what this is:
(defstate balloonlurker-pilot-die (balloonlurker-pilot)
  :event (the-as
    (function process int symbol event-message-block object :behavior balloonlurker-pilot)
    process-drawable-death-event-handler
    )
  :code (behavior ()
    (process-spawn
      part-tracker
      :init part-tracker-init
      (-> *part-group-id-table* 203)
      -1
      #f
      #f
      #f
      (-> self root-override trans)
      :to *entity-pool*
      )
    (TODO-RENAME-17
      (-> self parent-override 0 rbody)
      (-> self root-override trans)
      (-> self root-override transv)
      )
    (clear-collide-with-as (-> self root-override))
    (ja-channel-push! 1 (seconds 0.1))
    (ja-no-eval :group! balloonlurker-pilot-death-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (cleanup-for-death self)
    (none)
    )
  :post (behavior ()
    (vector-v++!
      (-> self root-override transv)
      (compute-acc-due-to-gravity (-> self root-override) (new-stack-vector0) 0.0)
      )
    (integrate-no-collide! (-> self root-override) (-> self root-override transv))
    (ja-post)
    (none)
    )
  )

;; definition for method 20 of type balloonlurker-pilot
;; INFO: Return type mismatch int vs none.
(defmethod dummy-20 balloonlurker-pilot ((obj balloonlurker-pilot))
  (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))))
    (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s5-0 reaction) default-collision-reaction)
    (set! (-> s5-0 no-reaction)
          (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
          )
    (let ((s4-0 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 2))))
      (set! (-> s4-0 prim-core collide-as) (collide-kind enemy))
      (set! (-> s4-0 collide-with) (collide-kind target))
      (set! (-> s4-0 prim-core offense) (collide-offense touch))
      (set! (-> s4-0 transform-index) 6)
      (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 10240.0)
      (set-root-prim! s5-0 s4-0)
      )
    (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
    (backup-collide-with-as s5-0)
    (set! (-> obj root-override) s5-0)
    )
  0
  (none)
  )

;; definition for method 21 of type balloonlurker-pilot
;; INFO: Return type mismatch int vs none.
(defmethod dummy-21 balloonlurker-pilot ((obj balloonlurker-pilot))
  (initialize-skeleton obj *balloonlurker-pilot-sg* '())
  (set! (-> obj draw origin-joint-index) (the-as uint 6))
  0
  (none)
  )

;; definition for function balloonlurker-pilot-init-by-other
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(defbehavior balloonlurker-pilot-init-by-other balloonlurker-pilot ((arg0 balloonlurker))
  (set! (-> self mask) (logior (process-mask enemy) (-> self mask)))
  (dummy-20 self)
  (logclear! (-> self mask) (process-mask actor-pause))
  (set! (-> self fact)
        (new 'process 'fact-info-enemy self (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc))
        )
  (set! (-> self root-override trans quad) (-> arg0 root-overlay trans quad))
  (set! (-> self root-override quat vec quad) (-> arg0 root-overlay quat vec quad))
  (set! (-> self root-override scale quad) (-> arg0 root-overlay scale quad))
  (dummy-21 self)
  (go balloonlurker-pilot-idle)
  (none)
  )

;; definition for method 30 of type balloonlurker
;; INFO: Return type mismatch int vs none.
(defmethod TODO-RENAME-30 balloonlurker ((obj balloonlurker))
  (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))))
    (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s5-0 reaction) default-collision-reaction)
    (set! (-> s5-0 no-reaction)
          (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
          )
    (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 4) 0)))
      (set! (-> s4-0 prim-core collide-as) (collide-kind enemy))
      (set! (-> s4-0 collide-with) (collide-kind target))
      (set! (-> s4-0 prim-core action) (collide-action solid))
      (set-vector! (-> s4-0 local-sphere) 0.0 40960.0 0.0 61440.0)
      (set-root-prim! s5-0 s4-0)
      (let ((s3-0 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 1))))
        (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 57344.0 0.0 28672.0)
        (append-prim s4-0 s3-0)
        )
      (let ((s3-1 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 4))))
        (set! (-> s3-1 prim-core collide-as) (collide-kind enemy))
        (set! (-> s3-1 collide-with) (collide-kind target))
        (set! (-> s3-1 prim-core offense) (collide-offense normal-attack))
        (set! (-> s3-1 transform-index) 4)
        (set-vector! (-> s3-1 local-sphere) 0.0 0.0 -8192.0 10240.0)
        (append-prim s4-0 s3-1)
        )
      (let ((s3-2 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 8))))
        (set! (-> s3-2 prim-core collide-as) (collide-kind enemy))
        (set! (-> s3-2 collide-with) (collide-kind target))
        (set! (-> s3-2 prim-core offense) (collide-offense normal-attack))
        (set! (-> s3-2 transform-index) 10)
        (set-vector! (-> s3-2 local-sphere) 0.0 -8192.0 0.0 6144.0)
        (append-prim s4-0 s3-2)
        )
      (let ((s3-3 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 16))))
        (set! (-> s3-3 prim-core collide-as) (collide-kind enemy))
        (set! (-> s3-3 collide-with) (collide-kind target))
        (set! (-> s3-3 prim-core offense) (collide-offense normal-attack))
        (set! (-> s3-3 transform-index) 7)
        (set-vector! (-> s3-3 local-sphere) 0.0 -8192.0 0.0 6144.0)
        (append-prim s4-0 s3-3)
        )
      )
    (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
    (backup-collide-with-as s5-0)
    (set! (-> s5-0 max-iteration-count) (the-as uint 1))
    (set! (-> obj root-overlay) s5-0)
    )
  0
  (none)
  )

;; definition for method 31 of type balloonlurker
;; INFO: Return type mismatch int vs none.
;; Used lq/sq
(defmethod TODO-RENAME-31 balloonlurker ((obj balloonlurker))
  (logclear! (-> obj mask) (process-mask actor-pause))
  (initialize-skeleton obj *balloonlurker-sg* '())
  (set! (-> obj root-overlay pause-adjust-distance) 1228800.0)
  (set! (-> obj fact)
        (new 'process 'fact-info-enemy obj (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc))
        )
  (set! (-> obj water-y) (-> obj root-overlay trans y))
  (set! (-> obj path) (new 'process 'path-control obj 'path 0.0))
  (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text))
  (set! (-> obj link) (new 'process 'actor-link-info obj))
  (balloonlurker-find-nearest-path-point)
  (balloonlurker-snap-to-path-point (-> obj dest-index))
  (TODO-RENAME-29 obj *balloonlurker-constants*)
  (dotimes (s5-0 4)
    (let ((s4-0 (-> obj control-point-array data s5-0)))
      (let ((f30-0 (* 16384.0 (the float (logand s5-0 3)))))
        (set! (-> s4-0 local-pos x) (* 24576.0 (cos f30-0)))
        (set! (-> s4-0 local-pos y) 61440.0)
        (set! (-> s4-0 local-pos z) (* 36864.0 (sin f30-0)))
        )
      (set! (-> s4-0 local-pos w) 1.0)
      )
    )
  (let ((v1-22 (-> obj control-point-array data 4)))
    (set! (-> v1-22 local-pos x) 0.0)
    (set! (-> v1-22 local-pos y) 61440.0)
    (set! (-> v1-22 local-pos z) -40960.0)
    (set! (-> v1-22 local-pos w) 1.0)
    )
  (let ((v1-24 (-> obj control-point-array data 5)))
    (set! (-> v1-24 local-pos x) 0.0)
    (set! (-> v1-24 local-pos y) 61440.0)
    (set! (-> v1-24 local-pos z) 40960.0)
    (set! (-> v1-24 local-pos w) 1.0)
    )
  (let ((v1-26 (-> obj control-point-array data 6)))
    (set! (-> v1-26 local-pos x) 0.0)
    (set! (-> v1-26 local-pos y) 0.0)
    (set! (-> v1-26 local-pos z) 0.0)
    (set! (-> v1-26 local-pos w) 1.0)
    )
  (set! (-> obj buoyancy-factor) (-> obj info buoyancy-factor))
  (set! (-> obj player-impulse) #f)
  (set! (-> obj player-contact) #f)
  (set! (-> obj auto-pilot) #t)
  (set! (-> obj vulnerable) #t)
  (set! (-> obj dead) #f)
  (set! (-> obj explosion) #f)
  (set! (-> obj propeller) (new 'process 'joint-mod-spinner obj 4 (new 'static 'vector :z -1.0 :w 1.0) 8192.0))
  (set! (-> obj rudder) (new 'process 'joint-mod-set-local obj 12 #f #t #f))
  (set! (-> obj mine 0) (new 'process 'joint-mod-set-world obj 8 #f))
  (set! (-> obj mine 1) (new 'process 'joint-mod-set-world obj 5 #f))
  (set! (-> obj explosion-joint-index-bytes 0) 10)
  (set! (-> obj explosion-joint-index-bytes 1) 7)
  (set! (-> obj engine-sound-id) (new 'static 'sound-id))
  (set! (-> obj pedal-sound-id) (new 'static 'sound-id))
  (set! (-> obj player-force quad) (-> *null-vector* quad))
  (set! (-> obj player-velocity quad) (-> *null-vector* quad))
  0
  (none)
  )

;; definition for method 11 of type balloonlurker
;; INFO: Return type mismatch object vs none.
;; WARN: Expression building failed: Function (method 11 balloonlurker) has a return type of none, but the expression builder found a return statement.
(defmethod init-from-entity! balloonlurker ((obj balloonlurker) (arg0 entity-actor))
  (set! (-> obj mask) (logior (process-mask enemy) (-> obj mask)))
  (TODO-RENAME-30 obj)
  (process-drawable-from-entity! obj arg0)
  (TODO-RENAME-31 obj)
  (cond
    ((logtest? (-> (entity-actor-lookup (-> obj entity) 'alt-actor 0) extra perm status)
               (entity-perm-status complete)
               )
     (process-entity-status! obj (entity-perm-status dead) #t)
     (return #f)
     )
    (else
      (process-spawn balloonlurker-pilot obj :to obj)
      (go balloonlurker-patrol)
      )
    )
  (none)
  )
