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

;; name: h-torpedo.gc
;; name in dgo: h-torpedo
;; dgos: LCTYPATK

(define-extern *growing-curve-torpedo* curve2d-piecewise)
(define-extern *water-simple-alpha-curve-fade-out-torpedo* curve2d-piecewise)
(define-extern *color-curve-tan-brown-torpedo* curve-color-piecewise)
(define-extern *water-simple-alpha-curve-in-torpedo* curve2d-piecewise)
(define-extern *torpedo-wake-trail* light-trail-composition)
(define-extern *range-torp-explo-color* curve-color-fast)
(define-extern *range-torp-explo-alpha* curve2d-fast)
(define-extern *range-torp-explo-scale-x* curve2d-fast)
(define-extern *range-torp-explo-scale-y* curve2d-fast)
(define-extern *curve-torp-explo-alpha* curve2d-fast)
(define-extern *curve-torp-explo-scale-x* curve2d-fast)
(define-extern *curve-torp-explo-scale-y* curve2d-fast)

;; DECOMP BEGINS

(defpartgroup group-daxter-missile-heathaze
  :id 526
  :flags (sp0 sp4 sp12)
  :bounds (static-bspherem 0 0 0 640)
  :parts ((sp-item 2065 :flags (sp7)))
  )

(defpart 2065
  :init-specs ((:texture (glow level-default-sprite))
    (:num 20.0)
    (:x (meters 0) (meters 0.3))
    (:z (meters -0.05))
    (:scale-x (meters 0.3) (meters 0.2))
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 128.0)
    (:g 32.0 64.0)
    (:b 0.0 32.0)
    (:a 64.0 64.0)
    (:timer (seconds 0.017) (seconds 0.015))
    (:flags (sp-cpuinfo-flag-3))
    (:func 'spt-func-relative-pos)
    (:rotate-y (degrees 0))
    (:rotate-z (degrees 0) (degrees 3600))
    )
  )

(defpartgroup group-nuke-water-wake
  :id 527
  :flags (sp0 sp4 sp13)
  :bounds (static-bspherem 0 0 0 100)
  :parts ((sp-item 2066 :flags (sp7)) (sp-item 2067 :flags (sp7)))
  )

(when (or (zero? *growing-curve-torpedo*) (!= loading-level global))
  (set! *growing-curve-torpedo* (new 'loading-level 'curve2d-piecewise))
  (allocate! *growing-curve-torpedo* 2 'loading-level #f)
  )

(set! (-> *growing-curve-torpedo* pts data 0 first) 0.0)

(set! (-> *growing-curve-torpedo* pts data 0 second) 1.0)

(set! (-> *growing-curve-torpedo* pts data 1 first) 1.0)

(set! (-> *growing-curve-torpedo* pts data 1 second) 10.0)

(when (or (zero? *water-simple-alpha-curve-fade-out-torpedo*) (!= loading-level global))
  (set! *water-simple-alpha-curve-fade-out-torpedo* (new 'loading-level 'curve2d-piecewise))
  (allocate! *water-simple-alpha-curve-fade-out-torpedo* 2 'loading-level #f)
  )

(set! (-> *water-simple-alpha-curve-fade-out-torpedo* pts data 0 first) 0.0)

(set! (-> *water-simple-alpha-curve-fade-out-torpedo* pts data 0 second) 1.0)

(set! (-> *water-simple-alpha-curve-fade-out-torpedo* pts data 1 first) 1.0)

(set! (-> *water-simple-alpha-curve-fade-out-torpedo* pts data 1 second) 0.0)

(when (or (zero? *color-curve-tan-brown-torpedo*) (!= loading-level global))
  (set! *color-curve-tan-brown-torpedo* (new 'loading-level 'curve-color-piecewise))
  (allocate! *color-curve-tan-brown-torpedo* 2 'loading-level #f)
  )

(set! (-> *color-curve-tan-brown-torpedo* pts data 0 first) 0.0)

(set! (-> *color-curve-tan-brown-torpedo* pts data 0 second x) 1.0)

(set! (-> *color-curve-tan-brown-torpedo* pts data 0 second y) 1.171875)

(set! (-> *color-curve-tan-brown-torpedo* pts data 0 second z) 1.171875)

(set! (-> *color-curve-tan-brown-torpedo* pts data 0 second w) 0.5)

(set! (-> *color-curve-tan-brown-torpedo* pts data 1 first) 1.0)

(set! (-> *color-curve-tan-brown-torpedo* pts data 1 second x) 0.78125)

(set! (-> *color-curve-tan-brown-torpedo* pts data 1 second y) 1.015625)

(set! (-> *color-curve-tan-brown-torpedo* pts data 1 second z) 1.015625)

(set! (-> *color-curve-tan-brown-torpedo* pts data 1 second w) 0.5)

(when (or (zero? *water-simple-alpha-curve-in-torpedo*) (!= loading-level global))
  (set! *water-simple-alpha-curve-in-torpedo* (new 'loading-level 'curve2d-piecewise))
  (allocate! *water-simple-alpha-curve-in-torpedo* 2 'loading-level #f)
  )

(set! (-> *water-simple-alpha-curve-in-torpedo* pts data 0 first) 0.0)

(set! (-> *water-simple-alpha-curve-in-torpedo* pts data 0 second) 0.0)

(set! (-> *water-simple-alpha-curve-in-torpedo* pts data 1 first) 1.0)

(set! (-> *water-simple-alpha-curve-in-torpedo* pts data 1 second) 1.0)

(if (or (zero? *torpedo-wake-trail*) (!= loading-level global))
    (set! *torpedo-wake-trail* (new 'loading-level 'light-trail-composition))
    )

(set! (-> *torpedo-wake-trail* color-mode) (the-as uint 0))

(set! (-> *torpedo-wake-trail* color-repeat-dist) 40960.0)

(set! (-> *torpedo-wake-trail* alpha-1-mode) (the-as uint 1))

(set! (-> *torpedo-wake-trail* alpha-2-mode) (the-as uint 6))

(set! (-> *torpedo-wake-trail* base-alpha) 0.6)

(set! (-> *torpedo-wake-trail* alpha-repeat-dist) 40960.0)

(set! (-> *torpedo-wake-trail* width-mode) (the-as uint 1))

(set! (-> *torpedo-wake-trail* base-width) 10240.0)

(set! (-> *torpedo-wake-trail* width-repeat-dist) 204800.0)

(set! (-> *torpedo-wake-trail* uv-mode) (the-as uint 3))

(set! (-> *torpedo-wake-trail* uv-repeat-dist) 81920.0)

(set! (-> *torpedo-wake-trail* lie-mode) (lie-mode appearance1))

(set! (-> *torpedo-wake-trail* max-age) (seconds 0.3))

(if #f
    (set! (-> *torpedo-wake-trail* tex-id) (lookup-texture-id-by-name (the-as string #f) (the-as string #f)))
    (set! (-> *torpedo-wake-trail* tex-id) (new 'static 'texture-id :index #x8 :page #x5))
    )

(set! (-> *torpedo-wake-trail* width-curve) *growing-curve-torpedo*)

(set! (-> *torpedo-wake-trail* color-curve) *color-curve-tan-brown-torpedo*)

(set! (-> *torpedo-wake-trail* alpha-curve-1) *water-simple-alpha-curve-in-torpedo*)

(set! (-> *torpedo-wake-trail* alpha-curve-2) #f)

(set! (-> *torpedo-wake-trail* zbuffer?) #f)

(vector-copy! (-> *torpedo-wake-trail* lie-vector) *up-vector*)

(set! (-> *torpedo-wake-trail* use-tape-mode?) #t)

(set! (-> *torpedo-wake-trail* blend-mode) (the-as uint 0))

(set! (-> *torpedo-wake-trail* frame-stagger) (the-as uint 1))

(defpartgroup group-nuke-water-splash
  :id 528
  :duration (seconds 5)
  :flags (sp0 sp4 sp9)
  :bounds (static-bspherem 0 0 0 100)
  :parts ((sp-item 2068 :flags (sp7) :period (seconds 20) :length (seconds 0.1))
    (sp-item 2069 :flags (sp7) :period (seconds 20) :length (seconds 0.1))
    )
  )

(defpart 2068
  :init-specs ((:texture (water-drops level-default-sprite))
    (:num 60.0)
    (:y (meters 0))
    (:scale-x (meters 0.5) (meters 0.5))
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 128.0)
    (:g 128.0)
    (:b 128.0)
    (:a 32.0 32.0)
    (:vel-y (meters 0.01) (meters 0.033333335))
    (:vel-z (meters 0.23333333) (meters 0.06666667))
    (:scalevel-x (meters 0.0033333334) (meters 0.006666667))
    (:rotvel-z (degrees -0.1) (degrees 0.2))
    (:scalevel-y :copy scalevel-x)
    (:fade-a -0.10666667 -0.10666667)
    (:accel-y (meters -0.0016666667))
    (:friction 0.97 0.02)
    (:timer (seconds 3.335))
    (:flags (sp-cpuinfo-flag-13 sp-cpuinfo-flag-14 launch-along-z))
    (:next-time (seconds 0.5))
    (:next-launcher 2070)
    (:conerot-x (degrees -10) (degrees -10))
    (:conerot-z (degrees -20) (degrees 40))
    (:rotate-y (degrees 0))
    )
  )

(defpart 2070
  :init-specs ((:friction 0.9))
  )

(defpart 2069
  :init-specs ((:texture (water-drops level-default-sprite))
    (:num 30.0)
    (:y (meters 0))
    (:scale-x (meters 0.5) (meters 0.5))
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 128.0)
    (:g 128.0)
    (:b 128.0)
    (:a 32.0 32.0)
    (:omega (degrees 0.09))
    (:vel-y (meters 0.01) (meters 0.033333335))
    (:vel-z (meters 0.2) (meters 0.06666667))
    (:scalevel-x (meters 0.0033333334) (meters 0.006666667))
    (:rotvel-z (degrees -0.1) (degrees 0.2))
    (:scalevel-y :copy scalevel-x)
    (:fade-a -0.21333334 -0.21333334)
    (:accel-y (meters -0.0016666667))
    (:friction 0.97 0.02)
    (:timer (seconds 0.5))
    (:flags (sp-cpuinfo-flag-13 sp-cpuinfo-flag-14 launch-along-z))
    (:func 'spt-func-nuke-water-splash)
    (:next-time (seconds 0.335))
    (:next-launcher 2071)
    (:conerot-x (degrees -10) (degrees -10))
    (:conerot-z (degrees -20) (degrees 40))
    (:rotate-y (degrees 0))
    )
  )

(defpart 2071
  :init-specs ((:omega (degrees 0.1575)) (:friction 0.9))
  )

(defun spt-func-nuke-water-splash ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo))
  (sparticle-motion-blur arg0 arg1 (-> arg2 launchrot))
  (sparticle-2d-spline-align-instant arg0 arg1 (the-as sprite-vec-data-2d arg2))
  (none)
  )

(defpartgroup group-torpedo-explosion
  :id 529
  :duration (seconds 4)
  :flags (sp0 sp5)
  :bounds (static-bspherem 0 0 0 15)
  :parts ((sp-item 2072 :flags (sp3) :period (seconds 30) :length (seconds 0.017))
    (sp-item 2073 :period (seconds 30) :length (seconds 0.035))
    (sp-item 2074 :flags (sp3) :period (seconds 30) :length (seconds 0.017))
    (sp-item 2075 :flags (sp3) :period (seconds 30) :length (seconds 0.017))
    (sp-item 2076 :period (seconds 30) :length (seconds 0.167))
    (sp-item 2077 :period (seconds 30) :length (seconds 0.5))
    )
  )

(defpart 2072
  :init-specs ((:texture (glow-soft level-default-sprite))
    (:num 1.0)
    (:scale-x (meters 20))
    (:rot-x (degrees 225))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 128.0)
    (:b 40.0)
    (:a 64.0)
    (:fade-a -0.21333334)
    (:timer (seconds 1))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
    (:userdata 40960.0)
    )
  )

(defpart 2073
  :init-specs ((:texture (hotdot level-default-sprite))
    (:num 10.0 10.0)
    (:scale-x (meters 0.8) (meters 1.2))
    (:rot-y (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 128.0)
    (:g 80.0 20.0)
    (:b 30.0)
    (:a 128.0)
    (:vel-y (meters 0.16666667) (meters 0.33333334))
    (:scalevel-x (meters -0.0016666667))
    (:scalevel-y :copy scalevel-x)
    (:fade-g -0.17777778)
    (:fade-b -0.06666667)
    (:fade-a -0.28444445 -0.28444445)
    (:friction 0.9)
    (:timer (seconds 1.5))
    (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-3))
    (:conerot-x (degrees 0) (degrees 360))
    (:rotate-y (degrees 0) (degrees 3600))
    )
  )

(defpart 2074
  :init-specs ((:texture (explosion-nebula level-default-sprite))
    (:num 30.0)
    (:scale-x (meters 3) (meters 2))
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 160.0)
    (:b 40.0)
    (:a 128.0)
    (:vel-y (meters 0) (meters 0.06666667))
    (:scalevel-x (meters 0.016666668))
    (:scalevel-y :copy scalevel-x)
    (:fade-g -0.22857143)
    (:fade-b -0.08571429)
    (:fade-a -0.36571428 -0.36571428)
    (:friction 0.93)
    (:timer (seconds 1.167))
    (:flags (sp-cpuinfo-flag-3))
    (:conerot-x (degrees 0) (degrees 360))
    (:rotate-y (degrees 0) (degrees 3600))
    )
  )

(defpart 2076
  :init-specs ((:texture (explosion-edge level-default-sprite))
    (:num 5.0)
    (:scale-x (meters 3) (meters 2))
    (:rot-y (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 128.0)
    (:g 80.0 20.0)
    (:b 30.0)
    (:a 128.0)
    (:vel-y (meters 0.33333334) (meters 0.13333334))
    (:scalevel-x (meters 0.033333335))
    (:scalevel-y :copy scalevel-x)
    (:fade-g -0.17777778)
    (:fade-b -0.06666667)
    (:fade-a -0.28444445 -0.28444445)
    (:friction 0.7)
    (:timer (seconds 1.5))
    (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-3))
    (:func 'sparticle-2d-spline-align-instant)
    (:conerot-x (degrees 0) (degrees 360))
    (:rotate-y (degrees 0) (degrees 3600))
    )
  )

(defpart 2077
  :init-specs ((:texture (explo-texture level-default-sprite))
    (:birth-func 'birth-func-curve)
    (:num 8.0)
    (:x (meters -1) (meters 2))
    (:y (meters 0) (meters 2))
    (:scale-x (meters 1))
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 128.0)
    (:g 128.0)
    (:b 128.0)
    (:a 128.0)
    (:vel-y (meters 0.06666667) (meters 0.033333335))
    (:friction 0.9)
    (:timer (seconds 1))
    (:flags ())
    (:userdata 0.0)
    (:func 'live-func-curve)
    (:conerot-x (degrees 20) (degrees 90))
    (:rotate-y (degrees 0) (degrees 3600))
    )
  )

(if #t
    (set! *range-torp-explo-color* (new 'static 'curve-color-fast
                                     :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0)
                                     :ys (new 'static 'inline-array vector 4
                                       (new 'static 'vector :x 255.0 :y 255.0 :z 255.0 :w 128.0)
                                       (new 'static 'vector :x 255.0 :y 255.0 :z 255.0 :w 128.0)
                                       (new 'static 'vector :x 255.0 :y 255.0 :z 255.0 :w 128.0)
                                       (new 'static 'vector :x 255.0 :y 255.0 :z 255.0 :w 128.0)
                                       )
                                     :one-over-x-deltas (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
                                     )
          )
    )

(if #t
    (set! *range-torp-explo-alpha* (new 'static 'curve2d-fast
                                     :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0)
                                     :ys (new 'static 'vector :x 32.0 :y 128.0 :z 129.0 :w 130.0)
                                     :one-over-x-deltas (new 'static 'vector :x 96.0 :y 1.0 :z 1.0 :w 1.0)
                                     )
          )
    )

(if #t
    (set! *range-torp-explo-scale-x* (new 'static 'curve2d-fast
                                       :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0)
                                       :ys (new 'static 'vector :x 3.0 :y 7.0 :z 8.0 :w 9.0)
                                       :one-over-x-deltas (new 'static 'vector :x 4.0 :y 1.0 :z 1.0 :w 1.0)
                                       )
          )
    )

(if #t
    (set! *range-torp-explo-scale-y* (new 'static 'curve2d-fast
                                       :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0)
                                       :ys (new 'static 'vector :x 3.0 :y 7.0 :z 8.0 :w 9.0)
                                       :one-over-x-deltas (new 'static 'vector :x 4.0 :y 1.0 :z 1.0 :w 1.0)
                                       )
          )
    )

(if #t
    (set! *curve-torp-explo-alpha* (new 'static 'curve2d-fast
                                     :xs (new 'static 'vector :y -0.05 :z -0.7 :w -1.0)
                                     :ys (new 'static 'vector :y 1.0 :z 0.8)
                                     :one-over-x-deltas (new 'static 'vector :x 20.0 :y -0.3076923 :z -2.6666665 :w 1.0)
                                     )
          )
    )

(if #t
    (set! *curve-torp-explo-scale-x* (new 'static 'curve2d-fast
                                       :xs (new 'static 'vector :y -0.8 :z -1.0 :w -2.0)
                                       :ys (new 'static 'vector :y 2.0 :z 2.5 :w 3.5)
                                       :one-over-x-deltas (new 'static 'vector :x 2.5 :y 2.5000002 :z 1.0 :w 1.0)
                                       )
          )
    )

(if #t
    (set! *curve-torp-explo-scale-y* (new 'static 'curve2d-fast
                                       :xs (new 'static 'vector :y -0.8 :z -1.0 :w -2.0)
                                       :ys (new 'static 'vector :y 2.0 :z 2.5 :w 3.5)
                                       :one-over-x-deltas (new 'static 'vector :x 2.5 :y 2.5000002 :z 1.0 :w 1.0)
                                       )
          )
    )

(define *part-torpedo-explosion-texture-curve-settings* (new 'static 'particle-curve-settings
                                                          :lifetime-base (seconds 0.1)
                                                          :lifetime-offset (seconds 0.6)
                                                          :flags (particle-curve-flags pcf0)
                                                          )
        )

(set! (-> *part-id-table* 2077 init-specs 16 initial-valuef)
      (the-as float *part-torpedo-explosion-texture-curve-settings*)
      )

(set! (-> *part-torpedo-explosion-texture-curve-settings* color-start) *range-torp-explo-color*)

(set! (-> *part-torpedo-explosion-texture-curve-settings* alpha-start) *range-torp-explo-alpha*)

(set! (-> *part-torpedo-explosion-texture-curve-settings* scale-x-start) *range-torp-explo-scale-x*)

(set! (-> *part-torpedo-explosion-texture-curve-settings* scale-y-start) *range-torp-explo-scale-y*)

(set! (-> *part-torpedo-explosion-texture-curve-settings* r-scalar) #f)

(set! (-> *part-torpedo-explosion-texture-curve-settings* g-scalar) #f)

(set! (-> *part-torpedo-explosion-texture-curve-settings* b-scalar) #f)

(set! (-> *part-torpedo-explosion-texture-curve-settings* a-scalar) *curve-torp-explo-alpha*)

(set! (-> *part-torpedo-explosion-texture-curve-settings* scale-x-scalar) *curve-torp-explo-scale-x*)

(set! (-> *part-torpedo-explosion-texture-curve-settings* scale-y-scalar) *curve-torp-explo-scale-y*)

(defpart 2075
  :init-specs ((:texture (starflash level-default-sprite))
    (:num 1.0)
    (:scale-x (meters 20))
    (:rot-x (degrees 2.25))
    (:rot-z (degrees 0) (degrees 360))
    (:scale-y :copy scale-x)
    (:r 128.0)
    (:g 80.0)
    (:b 40.0)
    (:a 128.0)
    (:omega (degrees 6767.9995))
    (:scalevel-x (meters -0.33333334))
    (:scalevel-y :copy scalevel-x)
    (:timer (seconds 0.135))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
    (:userdata 4096.0)
    )
  )

(deftype htorpedo (h-bike-c)
  ((speed                  float)
   (target-speed           float)
   (pitch                  float)
   (target-pitch           float)
   (max-pitch              float)
   (roll                   float)
   (target-roll            float)
   (turn-rate              float)
   (target-turn-rate       float)
   (ground-height          float)
   (ground-offset          float)
   (down-force             float)
   (want-jump?             symbol)
   (jump-state             uint8       :offset 1360)
   (on-water?              symbol)
   (cam-pitch              float)
   (cam-roll               float)
   (target-cam-roll        float)
   (based-cam-roll         float)
   (last-quat              quaternion  :inline)
   (override-camera?       symbol)
   (under-water?           symbol)
   (next-bob-cam-time      time-frame)
   (thrust-sound           sound-id)
   (ground-sound           sound-id)
   (reverb-dest            float)
   (pitch-current          float)
   (ground-vol-current     float)
   (last-slice-val         float)
   (evasive-sound          sound-id)
   (evasive-volume         float)
   (stopping-evasive?      symbol)
   (spawn-splash?          symbol)
   (wake-sound             sound-id)
   (heat-haze              sparticle-launch-control)
   (last-land-speech-time  time-frame)
   (last-jump-speech-time  time-frame)
   )
  (:state-methods
    undefined0
    hide
    )
  (:methods
    (htorpedo-method-164 () none)
    (find-ground-height (_type_) float)
    (htorpedo-method-166 (_type_ float) none)
    (htorpedo-method-167 (_type_ float) float)
    (htorpedo-method-168 (_type_ float) float)
    (probe-ground (_type_ vector float) float)
    (update-sound (_type_) none)
    )
  )


(defmethod find-ground-height ((this htorpedo))
  (let ((s5-0 (new 'stack-no-clear 'collide-query)))
    (let ((f1-0 225280.0)
          (f2-0 8192.0)
          (f0-0 1024.0)
          )
      (vector-copy! (-> s5-0 start-pos) (-> this rbody position))
      (+! (-> s5-0 start-pos y) f2-0)
      (vector-reset! (-> s5-0 move-dist))
      (set! (-> s5-0 move-dist y) (- (+ f2-0 f1-0)))
      (let ((v1-6 s5-0))
        (set! (-> v1-6 radius) f0-0)
        (set! (-> v1-6 collide-with) (collide-spec backgnd))
        (set! (-> v1-6 ignore-process0) this)
        (set! (-> v1-6 ignore-process1) #f)
        (set! (-> v1-6 ignore-pat) (-> this root pat-ignore-mask))
        (set! (-> v1-6 action-mask) (collide-action solid))
        )
      )
    (let ((v1-9 (>= (probe-using-line-sphere *collide-cache* s5-0) 0.0)))
      (set! (-> this on-water?) #f)
      (when (not v1-9)
        (let ((s5-1 (new 'stack-no-clear 'water-info)))
          (water-info-init! (-> this root) s5-1 (collide-action solid semi-solid))
          (cond
            ((logtest? (water-flag over-water) (-> s5-1 flags))
             (set! (-> this ground-height) (-> s5-1 base-height))
             (set! (-> this on-water?) #t)
             )
            (else
              (set! (-> this ground-height) -40960000.0)
              )
            )
          )
        (return 0.0)
        )
      )
    (set! (-> this ground-height) (-> s5-0 best-other-tri intersect y))
    )
  )

(defmethod probe-ground ((this htorpedo) (arg0 vector) (arg1 float))
  (let ((s4-0 (new 'stack-no-clear 'collide-query)))
    (vector+float*! (-> s4-0 start-pos) arg0 *up-vector* 24576.0)
    (set! (-> s4-0 move-dist quad) (the-as uint128 0))
    (set! (-> s4-0 move-dist y) -49152.0)
    (let ((v1-4 s4-0))
      (set! (-> v1-4 radius) 40.96)
      (set! (-> v1-4 collide-with) (collide-spec backgnd))
      (set! (-> v1-4 ignore-process0) #f)
      (set! (-> v1-4 ignore-process1) #f)
      (set! (-> v1-4 ignore-pat)
            (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1)
            )
      (set! (-> v1-4 action-mask) (collide-action solid))
      )
    (if (>= (probe-using-line-sphere *collide-cache* s4-0) 0.0)
        (-> s4-0 best-other-tri intersect y)
        (- (-> arg0 y) (-> this ground-offset))
        )
    )
  )

;; WARN: Function (method 166 htorpedo) has a return type of none, but the expression builder found a return statement.
(defmethod htorpedo-method-166 ((this htorpedo) (arg0 float))
  (set! (-> this target-pitch) 0.0)
  (+ (-> this ground-height) (-> this ground-offset))
  (-> this rbody position y)
  (when #t
    (cond
      ((< 0.0 (-> this down-force))
       (let* ((f1-3 (/ (-> this down-force) (meters 100)))
              (f0-7 (fmax 0.0 (fmin 1.0 f1-3)))
              )
         (set! (-> this target-pitch) (lerp 0.0 -7281.778 f0-7))
         )
       )
      (else
        (let* ((f1-6 (/ (-> this down-force) (meters -100)))
               (f0-11 (fmax 0.0 (fmin 1.0 f1-6)))
               )
          (set! (-> this target-pitch) (lerp 0.0 7281.778 f0-11))
          )
        )
      )
    )
  (when (or (!= (-> this jump-state) 0) (-> this on-water?))
    (set! (-> this pitch) (lerp (-> this pitch) (-> this target-pitch) (* 2.0 arg0)))
    (return 0)
    )
  (let* ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat)))
         (f30-0 32768.0)
         (s3-0 (new 'stack-no-clear 'vector))
         (v1-16 s3-0)
         (a0-7 (-> this rbody position))
         (a1-5 s4-0)
         (a2-3 6144.0)
         )
    (vector+float*! v1-16 a0-7 a1-5 a2-3)
    (set! (-> s4-0 y) 0.0)
    (vector-normalize! s4-0 1.0)
    (let* ((s2-1 (vector+float*! (new 'stack-no-clear 'vector) s3-0 s4-0 (/ f30-0 2)))
           (s1-1 (vector+float*! (new 'stack-no-clear 'vector) s3-0 s4-0 (/ f30-0 -2)))
           (f28-0 (probe-ground this s2-1 a2-3))
           (f0-24 (probe-ground this s1-1 a2-3))
           )
      (set! (-> s2-1 y) f28-0)
      (set! (-> s1-1 y) f0-24)
      (let* ((f0-26 (- (+ f28-0 (-> this ground-offset)) (+ f0-24 (-> this ground-offset))))
             (f0-28 (asin (/ f0-26 f30-0)))
             )
        (set! (-> this target-pitch) (- (fmax 0.0 f0-28)))
        )
      )
    )
  (set! (-> this pitch) (lerp (-> this pitch) (-> this target-pitch) (* 30.0 arg0)))
  (set! (-> this cam-pitch) (lerp (-> this cam-pitch) (-> this target-pitch) (* 3.0 arg0)))
  0
  (none)
  )

(define PHYSICS_SCALAR 2.0)

(defmethod htorpedo-method-167 ((this htorpedo) (arg0 float))
  (set! (-> this target-pitch) (* (-> this max-pitch)
                                  (-> this controls lean-z)
                                  (fabs (-> this controls lean-z))
                                  (fabs (-> this controls lean-z))
                                  )
        )
  (let ((f1-6 (+ 40960.0 (-> this flight-level)))
        (f0-6 (+ -49152.0 (-> this flight-level)))
        )
    0.0
    (let* ((f2-2 (-> this rbody position y))
           (f3-1 (* 0.5 (+ f1-6 f0-6)))
           (f1-8 (/ (- f1-6 f2-2) (- f1-6 f3-1)))
           )
      0.0
      0.0
      (let* ((f0-8 (/ (- f2-2 f0-6) (- f3-1 f0-6)))
             (f1-9 (fmin 1.0 f1-8))
             (f0-9 (fmin 1.0 f0-8))
             (f30-0 (- 1.0 (* (- 1.0 f1-9) (- 1.0 f1-9))))
             (f0-12 (- 1.0 (* (- 1.0 f0-9) (- 1.0 f0-9))))
             (f28-0 (lerp 0.0 (-> this max-pitch) f0-12))
             (f1-14 (lerp 0.0 (- (-> this max-pitch)) f30-0))
             )
        (set! (-> this target-pitch) (fmax (fmin (-> this target-pitch) f28-0) f1-14))
        (let ((f0-18 1.0))
          (if (or (< f28-0 0.0) (< 0.0 f1-14))
              (set! f0-18 2.0)
              )
          (set! (-> this pitch) (lerp (-> this pitch) (-> this target-pitch) (* arg0 PHYSICS_SCALAR f0-18)))
          )
        )
      )
    )
  )

(define *torpedo-speech-list* (new 'static 'inline-array talker-speech-class 5
                                (new 'static 'talker-speech-class :name "none")
                                (new 'static 'talker-speech-class
                                  :name "dax563"
                                  :channel (gui-channel daxter)
                                  :speech #x1
                                  :neg #x1
                                  :on-close #f
                                  :camera #f
                                  )
                                (new 'static 'talker-speech-class
                                  :name "dax564"
                                  :channel (gui-channel daxter)
                                  :speech #x2
                                  :neg #x1
                                  :on-close #f
                                  :camera #f
                                  )
                                (new 'static 'talker-speech-class
                                  :name "dax566"
                                  :channel (gui-channel daxter)
                                  :speech #x3
                                  :neg #x1
                                  :on-close #f
                                  :camera #f
                                  )
                                (new 'static 'talker-speech-class
                                  :name "dax578"
                                  :channel (gui-channel daxter)
                                  :speech #x4
                                  :neg #x1
                                  :on-close #f
                                  :camera #f
                                  )
                                )
        )

(define *torpedo-jump-speech* (new 'static 'boxed-array :type uint16 #x1 #x2 #x3))

(define *torpedo-land-speech* (new 'static 'boxed-array :type uint16 #x4))

(defmethod htorpedo-method-168 ((this htorpedo) (arg0 float))
  (set! (-> this spawn-splash?) #f)
  (find-ground-height this)
  (when (logtest? (-> this root status) (collide-status touch-wall))
    )
  (let ((f30-0 (+ (-> this ground-height) (-> this ground-offset)))
        (f28-0 (-> this rbody position y))
        )
    (when (and (-> this next-state) (= (-> this next-state name) 'player-control))
      (when (and (-> this want-jump?)
                 (= (-> this jump-state) 0)
                 (time-elapsed? (the-as time-frame (the int (-> this jump-time))) (seconds 0.2))
                 )
        (set! (-> this down-force) 368640.0)
        (set! (-> this jump-state) (the-as uint 1))
        (set! (-> this jump-time) (the float (current-time)))
        (set! (-> *target* pilot jumping?) #t)
        )
      (when (= (-> this jump-state) 1)
        (if (and (cpad-hold? 0 x) (not (time-elapsed? (the-as time-frame (the int (-> this jump-time))) (seconds 0.3))))
            (+! (-> this down-force) (* 245760.0 arg0))
            )
        (when (time-elapsed? (the-as time-frame (the int (-> this jump-time))) (seconds 0.3))
          (when (and (time-elapsed? (-> this last-jump-speech-time) (seconds 10))
                     (time-elapsed? (-> this last-land-speech-time) (seconds 4))
                     (not (logtest? (rand-uint31-gen *random-generator*) 1))
                     (>= (fabs (-> this controls steering)) 1.0)
                     )
            (talker-spawn-func
              (-> *torpedo-speech-list*
                  (-> *torpedo-jump-speech*
                      (mod (the-as int (rand-uint31-gen *random-generator*)) (-> *torpedo-jump-speech* length))
                      )
                  )
              *entity-pool*
              (target-pos 0)
              (the-as region #f)
              )
            (set-time! (-> this last-jump-speech-time))
            )
          (set! (-> *target* pilot jumping?) #f)
          (set! (-> this jump-state) (the-as uint 2))
          )
        )
      (when (and (= (-> this jump-state) 2) (< (+ -12288.0 f28-0) f30-0))
        (set! (-> this jump-state) (the-as uint 0))
        (set! (-> this jump-time) (the float (current-time)))
        )
      )
    (cond
      ((< f30-0 f28-0)
       (set! (-> this down-force) (- (-> this down-force) (* 737280.0 arg0)))
       (set! (-> this under-water?) #f)
       (when (< -8192.0 (-> this down-force))
         (if (< (+ f28-0 (* (-> this down-force) arg0)) f30-0)
             (set! (-> this down-force) 0.0)
             )
         )
       )
      (else
        (if (not (-> this under-water?))
            (set! (-> this down-force) (* 0.6 (-> this down-force)))
            )
        (set! (-> this under-water?) #t)
        (when (zero? (-> this jump-state))
          (let ((f26-0 5.0))
            (when (not (-> this on-water?))
              (set! f26-0 10.0)
              (when (< (-> this down-force) -204800.0)
                (let* ((f1-11 (/ (-> this down-force) (meters -200)))
                       (f24-0 (fmax 0.0 (fmin 1.0 f1-11)))
                       )
                  (cpad-set-buzz!
                    (-> *cpad-list* cpads 0)
                    1
                    (the int (* 255.0 (lerp 0.6 1.0 f24-0)))
                    (the-as time-frame (the int (* 120.0 f24-0)))
                    )
                  (let ((f22-2 (fmin 1.0 (lerp 0.6 1.4 f24-0))))
                    (sound-play-by-name
                      (static-sound-name "rocket-bounce")
                      (new-sound-id)
                      (the int (* 1024.0 f22-2))
                      0
                      0
                      (sound-group)
                      #t
                      )
                    )
                  (when (and (time-elapsed? (-> this last-land-speech-time) (seconds 10))
                             (time-elapsed? (-> this last-jump-speech-time) (seconds 4))
                             (not (logtest? (rand-uint31-gen *random-generator*) 3))
                             )
                    (talker-spawn-func
                      (-> *torpedo-speech-list*
                          (-> *torpedo-land-speech*
                              (mod (the-as int (rand-uint31-gen *random-generator*)) (-> *torpedo-land-speech* length))
                              )
                          )
                      *entity-pool*
                      (target-pos 0)
                      (the-as region #f)
                      )
                    (set-time! (-> this last-land-speech-time))
                    )
                  (if (< 0.2 f24-0)
                      (activate! *camera-smush-control* 819.2 45 75 1.0 0.9 (-> *display* camera-clock))
                      )
                  )
                )
              )
            (when (-> this on-water?)
              (let ((f0-42 (/ (-> this down-force) (meters -200))))
                (if (< 0.1 f0-42)
                    (set! (-> this spawn-splash?) #t)
                    )
                )
              )
            (when (and (-> this on-water?) (>= (current-time) (-> this next-bob-cam-time)))
              (let ((f0-44 (/ (-> this down-force) (meters -200))))
                (cond
                  ((< 0.2 f0-44)
                   (let ((f24-1 (fmax 0.0 (fmin 1.0 f0-44)))
                         (s4-6 (+ (logand 0 (rand-uint31-gen *random-generator*)) 450))
                         )
                     (set! (-> this next-bob-cam-time) (+ (current-time) (the-as time-frame s4-6)))
                     (activate!
                       *camera-smush-control*
                       (* 6553.6 (lerp 0.2 1.0 f24-1))
                       (+ (mod (the-as int (rand-uint31-gen *random-generator*)) 61) 180)
                       (the-as int s4-6)
                       1.0
                       0.95
                       (-> *display* camera-clock)
                       )
                     )
                   )
                  (else
                    300
                    )
                  )
                )
              )
            (let ((f1-22 (+ (* 80.0 (- f30-0 f28-0) f26-0) (* -5.0 (-> this down-force) f26-0))))
              (set! (-> this down-force) (+ (-> this down-force) (* arg0 f1-22)))
              )
            )
          )
        )
      )
    )
  )

;; WARN: Function (method 31 htorpedo) has a return type of none, but the expression builder found a return statement.
(defmethod apply-gravity! ((this htorpedo) (arg0 float))
  (cond
    ((and (-> this next-state) (= (-> this next-state name) 'hide))
     (set! (-> this rbody lin-momentum quad) (the-as uint128 0))
     )
    ((and (-> this next-state) (= (-> this next-state name) 'waiting))
     (set! (-> this rbody lin-momentum quad) (the-as uint128 0))
     (return 0)
     )
    ((not (and (-> this next-state) (= (-> this next-state name) 'player-control)))
     (call-parent-method this arg0)
     )
    (else
      (update-sound this)
      (cond
        (#t
          (htorpedo-method-168 this arg0)
          (htorpedo-method-166 this arg0)
          )
        (else
          (htorpedo-method-167 this arg0)
          )
        )
      (set! (-> this target-turn-rate)
            (* 10922.667 (fabs (-> this controls steering)) (-> this controls steering) PHYSICS_SCALAR)
            )
      (seek! (-> this speed) (-> this target-speed) (* 163840.0 (seconds-per-frame) PHYSICS_SCALAR))
      (set! (-> this turn-rate) (lerp (-> this turn-rate) (-> this target-turn-rate) (* 1.5 PHYSICS_SCALAR arg0)))
      (set! (-> this target-roll) (* -0.5625 (-> this turn-rate)))
      (seek! (-> this roll) (-> this target-roll) (* 10012.444 arg0 PHYSICS_SCALAR))
      (set! (-> this based-cam-roll)
            (lerp (-> this based-cam-roll) (-> this target-turn-rate) (* PHYSICS_SCALAR arg0))
            )
      (set! (-> this target-cam-roll) (* -0.75 (/ 1.0 PHYSICS_SCALAR) (-> this based-cam-roll)))
      (seek! (-> this cam-roll) (-> this target-cam-roll) (* 10012.444 arg0 PHYSICS_SCALAR))
      (let ((s3-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this last-quat)))
            (s4-0 (new 'stack-no-clear 'vector))
            )
        (set! (-> s3-0 y) 0.0)
        (vector-normalize! s3-0 1.0)
        (quaternion-look-at! (the-as quaternion (-> this rbody rot)) s3-0 *up-vector*)
        (quaternion-rotate-y!
          (the-as quaternion (-> this rbody rot))
          (the-as quaternion (-> this rbody rot))
          (* arg0 (-> this turn-rate))
          )
        (quaternion-rotate-local-x!
          (the-as quaternion (-> this rbody rot))
          (the-as quaternion (-> this rbody rot))
          (-> this pitch)
          )
        (vector-z-quaternion! s4-0 (the-as quaternion (-> this rbody rot)))
        (vector-float*! (-> this rbody lin-momentum) s4-0 (* (-> this speed) (-> this info info mass)))
        )
      (+! (-> this rbody lin-momentum y) (* (/ (-> this down-force) 2) (-> this info info mass)))
      (if (< (-> this rbody position y) -6144.0)
          (set! (-> this rbody lin-momentum y) (fmax 0.0 (-> this rbody lin-momentum y)))
          )
      (quaternion-rotate-local-z!
        (the-as quaternion (-> this rbody rot))
        (the-as quaternion (-> this rbody rot))
        (-> this roll)
        )
      (quaternion-copy! (-> this last-quat) (the-as quaternion (-> this rbody rot)))
      )
    )
  0
  (none)
  )

;; WARN: Return type mismatch object vs none.
(defmethod vehicle-method-132 ((this htorpedo) (arg0 traffic-object-spawn-params))
  (set! (-> this speed) 0.0)
  (set! (-> this target-speed) 286720.0)
  (set! (-> this max-pitch) 3640.889)
  (set! (-> this roll) 0.0)
  (set! (-> this target-roll) 0.0)
  (set! (-> this target-pitch) 0.0)
  (set! (-> this pitch) 0.0)
  (set! (-> this cam-pitch) 0.0)
  (set! (-> this down-force) 0.0)
  (set! (-> this ground-offset) 12288.0)
  (quaternion-copy! (the-as quaternion (-> this rbody rot)) (-> this root quat))
  (quaternion-copy! (-> this last-quat) (the-as quaternion (-> this rbody rot)))
  (go (method-of-object this idle))
  (none)
  )

(defstate waiting (htorpedo)
  :virtual #t
  :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
    (case message
      (('boost)
       (set! (-> self target-speed) (+ (-> self target-speed) (the-as float (-> block param 0))))
       )
      (else
        (vehicle-event-handler proc argc message block)
        )
      )
    )
  :trans (behavior ()
    '()
    )
  )

(defstate hide (htorpedo)
  :virtual #t
  :event vehicle-event-handler
  :enter (behavior ()
    (set-time! (-> self state-time))
    )
  :trans (behavior ()
    (if (time-elapsed? (-> self state-time) (seconds 2))
        (logior! (-> self draw status) (draw-control-status no-draw))
        )
    )
  :code sleep-code
  :post (behavior ()
    (ja-post)
    )
  )

(defstate player-control (htorpedo)
  :virtual #t
  :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
    (case message
      (('boost)
       (+! (-> self target-speed) (the-as float (-> block param 0)))
       (set! (-> self target-speed) (fmin 335872.0 (-> self target-speed)))
       (format 0 "Current speed is ~f~%" (-> self target-speed))
       )
      (('hide)
       (go-virtual hide)
       )
      (else
        (vehicle-event-handler proc argc message block)
        )
      )
    )
  :enter (behavior ()
    (call-parent-state-handler enter)
    (set! (-> self speed) 0.0)
    (set! (-> self jump-state) (the-as uint 2))
    (set! (-> self jump-time) 0.0)
    (set! (-> *target* pilot jumping?) #f)
    )
  :trans (behavior ()
    (call-parent-state-handler trans)
    )
  :post (behavior ()
    (control-hook-player self)
    (vehicle-method-117 self)
    )
  )

(defstate explode (htorpedo)
  :virtual #t
  :enter (behavior ()
    (set-time! (-> self state-time))
    (dotimes (gp-0 (-> self info rider seat-count))
      (send-event
        (handle->process (-> self rider-array gp-0))
        'attack-invinc
        #f
        (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id))
                                                            (damage 2.0)
                                                            (vehicle-damage-factor 1.0)
                                                            (vehicle-impulse-factor 1.0)
                                                            (mode 'instant-death)
                                                            )
                            )
        )
      (put-rider-in-seat self gp-0 (the-as process #f))
      )
    (logior! (-> *target* draw status) (draw-control-status no-draw))
    (logior! (-> self focus-status) (focus-status dead))
    (set! (-> self crash-level) 3)
    (set! (-> self force-level) 3)
    (logclear! (-> self v-flags) (vehicle-flag persistent player-driving net-player-driving))
    (set! (-> self v-flags) (the-as vehicle-flag (logior (vehicle-flag lights-dead) (-> self v-flags))))
    (vehicle-method-126 self)
    (sound-play "rocket-explode")
    (vehicle-method-106 self)
    (vehicle-method-100 self)
    (sound-stop (-> self thrust-sound))
    (sound-stop (-> self ground-sound))
    (sound-stop (-> self evasive-sound))
    (sound-stop (-> self wake-sound))
    (let ((v1-45
            (cond
              ((logtest? (-> *part-group-id-table* 529 flags) (sp-group-flag sp13))
               (vector-copy! (-> *launch-matrix* trans) (-> self root trans))
               (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 529))
               )
              (else
                (vector-copy! (-> *launch-matrix* trans) (-> self root trans))
                (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 529))
                )
              )
            )
          )
      (send-event (ppointer->process v1-45) 'clock self)
      )
    (go-virtual die)
    )
  )

(define *h-torpedo-constants*
  (new 'static 'rigid-body-vehicle-constants
    :info (new 'static 'rigid-body-info
      :mass 50.0
      :inv-mass 0.02
      :linear-damping 0.995
      :angular-damping 0.995
      :bounce-factor 0.4
      :friction-factor 0.05
      :bounce-mult-factor 1.22
      :cm-offset-joint (new 'static 'vector :z 2457.6 :w 1.0)
      :inertial-tensor-box (new 'static 'array meters 3 (meters 3) (meters 4) (meters 6))
      )
    :extra (new 'static 'rigid-body-object-extra-info
      :max-time-step 0.033333335
      :gravity (meters 40)
      :idle-distance (meters 50)
      :attack-force-scale 1.0
      )
    :name '*h-torpedo-constants*
    :flags #x400
    :object-type (traffic-type civilian-bike-c)
    :guard-type #xb
    :vehicle-type (vehicle-type-u8 vt27)
    :transmission (new 'static 'vehicle-transmission-info :gear-count 1)
    :handling (new 'static 'vehicle-handling-info
      :max-engine-thrust (meters 50)
      :inv-max-engine-thrust 0.0000048828124
      :engine-response-rate 60.0
      :engine-intake-factor 1.5
      :brake-factor 3.5
      :turbo-boost-factor 1.0
      :turbo-boost-duration (seconds 1)
      :max-xz-speed (meters 40)
      :player-turn-anim-min -1.0
      :player-turn-anim-max 1.0
      :pilot-y-accel-factor 1.0
      :pilot-z-accel-factor 1.0
      :ground-probe-distance (meters 5)
      :cos-ground-effect-angle 0.42261827
      :spring-lift-factor 0.3
      :air-drag-factor 1.0
      :steering-thruster-factor 5.0
      :steering-thruster-max-gain 4.0
      :steering-thruster-half-gain-speed (meters 15)
      :tire-steering-speed-factor 61440.0
      :tire-friction-factor 0.5
      :tire-static-friction 0.55
      :tire-dynamic-friction 0.4
      :tire-dynamic-friction-speed (meters 2)
      :tire-inv-max-friction-speed 0.000024414063
      :airfoil-factor 1.0
      :drag-force-factor 1.0
      :speed-scrubbing-drag 10.0
      :speed-limiting-drag 0.75
      :pitch-control-factor 1.0
      :roll-control-factor 1.0
      :jump-thrust-factor 0.625
      :buoyancy-factor 1.0
      :water-drag-factor 1.0
      :player-weight 163840.0
      :player-shift-x (meters 0.6)
      :player-shift-z (meters 1)
      :air-angular-damping 1.0
      :ground-torque-scale 1.0
      :ai-steering-factor 1.0
      :ai-throttle-factor 1.0
      )
    :target-speed-offset (meters 4)
    :turning-accel (meters 25)
    :camera (new 'static 'vehicle-camera-info
      :string-min-height (meters 4.5)
      :string-max-height (meters 4.5)
      :string-min-length (meters 5)
      :string-max-length (meters 12.5)
      :min-fov 17294.223
      :max-fov 18204.445
      :head-offset 8192.0
      :foot-offset 4096.0
      :normal-max-angle-offset 3640.889
      :air-max-angle-offset 5461.3335
      :max-lookaround-speed 40960.0
      :look-pos-array (new 'static 'inline-array vector 4
        (new 'static 'vector :y 8192.0 :z -10240.0 :w 1.0)
        (new 'static 'vector :x -10240.0 :y 8192.0 :w 1.0)
        (new 'static 'vector :x 10240.0 :y 8192.0 :w 1.0)
        (new 'static 'vector :y 8192.0 :z 10240.0 :w 1.0)
        )
      )
    :sound (new 'static 'vehicle-sound-info
      :engine-pitch-scale 0.25
      :engine-pitch-offset -0.25
      :engine-pitch-mod-amp 0.05
      :engine-sound-select 1
      :thrust-sound (static-sound-name "bike-thrust")
      :scrape-sound (static-sound-name "bike-scrape-stn")
      :glance-sound (static-sound-name "bike-glance-stn")
      :impact-sound (static-sound-name "bike-impact-stn")
      :explode-sound (static-sound-name "vehicle-explode")
      :explode2-sound (static-sound-name "vehicle-explo-b")
      :extra-sound (static-sound-name "bike-by-1")
      :bank-replace '()
      :idle-pitch-scale 1.0
      :idle-crossover-rpm 1000.0
      :engine-crossover-rpm 4000.0
      :start-sound (static-sound-name "vehicl-ignition")
      :susp-speed-threshold 40960.0
      :tire-roll-sounds (new 'static 'inline-array vehicle-sound-loop-info 4
        (new 'static 'vehicle-sound-loop-info
          :speed 409600.0
          :max-speed 409600.0
          :pitch-scale 1.0
          :min-pitch -10.0
          :max-pitch 10.0
          )
        (new 'static 'vehicle-sound-loop-info
          :speed 409600.0
          :max-speed 409600.0
          :pitch-scale 1.0
          :min-pitch -10.0
          :max-pitch 10.0
          )
        (new 'static 'vehicle-sound-loop-info
          :speed 409600.0
          :max-speed 409600.0
          :pitch-scale 1.0
          :min-pitch -10.0
          :max-pitch 10.0
          )
        (new 'static 'vehicle-sound-loop-info
          :speed 409600.0
          :max-speed 409600.0
          :pitch-scale 1.0
          :min-pitch -10.0
          :max-pitch 10.0
          )
        )
      :tire-slide-sounds (new 'static 'inline-array vehicle-sound-loop-info 2
        (new 'static 'vehicle-sound-loop-info
          :speed 409600.0
          :max-speed 409600.0
          :pitch-scale 1.0
          :min-pitch -10.0
          :max-pitch 10.0
          )
        (new 'static 'vehicle-sound-loop-info
          :speed 409600.0
          :max-speed 409600.0
          :pitch-scale 1.0
          :min-pitch -10.0
          :max-pitch 10.0
          )
        )
      )
    :particles (new 'static 'vehicle-particle-info
      :thruster-flame-width (meters 0.25)
      :thruster-flame-length (meters 4)
      :thruster-local-pos (new 'static 'inline-array vector 2 (new 'static 'vector :w 1.0) (new 'static 'vector :w 1.0))
      :exhaust-local-pos (new 'static 'inline-array vector 2 (new 'static 'vector :w 1.0) (new 'static 'vector :w 1.0))
      :exhaust-local-dir (new 'static 'inline-array vector 2 (new 'static 'vector :z -1.0 :w 1.0) (new 'static 'vector :z -1.0 :w 1.0))
      :smoke-local-pos (new 'static 'inline-array vector 2 (new 'static 'vector :w 1.0) (new 'static 'vector :w 1.0))
      :smoke-local-vel (new 'static 'inline-array vector 2 (new 'static 'vector :w 1.0) (new 'static 'vector :w 1.0))
      )
    :damage (new 'static 'vehicle-damage-info
      :inv-toughness-factor 1.0
      :hit-points 60.0
      :inv-hit-points 0.016666668
      :hit-threshold 122880.0
      :hit-small 122880.0
      :hit-big 122880.0
      :hit-deadly 122880.0
      :impact-damage-factor 1.0
      :section-count 2
      :section-array (new 'static 'inline-array vehicle-section-info 4
        (new 'static 'vehicle-section-info
          :damage-seg-array (new 'static 'array uint64 3 #x20 #x8 #x2)
          :damage-seg-count 3
          )
        (new 'static 'vehicle-section-info
          :damage-seg-array (new 'static 'array uint64 3 #x40 #x10 #x4)
          :damage-seg-count 3
          )
        (new 'static 'vehicle-section-info)
        (new 'static 'vehicle-section-info)
        )
      )
    :physics-model (new 'static 'vehicle-physics-model-info
      :lift-thruster-count 2
      :roll-thruster-count 2
      :stabilizer-count 4
      :inv-lift-thruster-count 0.5
      :lift-thruster-array (new 'static 'inline-array vehicle-attach-point 4
        (new 'static 'vehicle-attach-point
          :local-pos (new 'static 'vector :z 7372.8003 :w 1.0)
          :rot (new 'static 'vector :y -1.0 :w 1.0)
          )
        (new 'static 'vehicle-attach-point
          :local-pos (new 'static 'vector :z -2457.6 :w 1.0)
          :rot (new 'static 'vector :y -1.0 :w 1.0)
          )
        (new 'static 'vehicle-attach-point)
        (new 'static 'vehicle-attach-point)
        )
      :roll-thruster-array (new 'static 'inline-array vehicle-attach-point 2
        (new 'static 'vehicle-attach-point
          :local-pos (new 'static 'vector :x 6963.2 :y 819.2 :z 2457.6 :w 1.0)
          :rot (new 'static 'vector :x 0.3 :y -0.6 :w 1.0)
          )
        (new 'static 'vehicle-attach-point
          :local-pos (new 'static 'vector :x -6963.2 :y 819.2 :z 2457.6 :w 1.0)
          :rot (new 'static 'vector :x -0.3 :y -0.6 :w 1.0)
          )
        )
      :stabilizer-array (new 'static 'inline-array vehicle-attach-point 6
        (new 'static 'vehicle-attach-point
          :local-pos (new 'static 'vector :z -5734.4 :w 1.0)
          :rot (new 'static 'vector :x 1.0 :w 1.0)
          )
        (new 'static 'vehicle-attach-point
          :local-pos (new 'static 'vector :z 10649.6 :w 1.0)
          :rot (new 'static 'vector :x 1.0 :w 0.5)
          )
        (new 'static 'vehicle-attach-point
          :local-pos (new 'static 'vector :z 2457.6 :w 1.0)
          :rot (new 'static 'vector :x 1.0 :w 2.0)
          )
        (new 'static 'vehicle-attach-point
          :local-pos (new 'static 'vector :z -5734.4 :w 1.0)
          :rot (new 'static 'vector :y 1.0 :w 1.0)
          )
        (new 'static 'vehicle-attach-point)
        (new 'static 'vehicle-attach-point)
        )
      :engine-thrust-local-pos (new 'static 'vector :z -3276.7998 :w 1.0)
      :brake-local-pos (new 'static 'vector :z -3276.7998 :w 1.0)
      :wheel-count 4
      :drive-wheel-count 2
      :front-wheel (new 'static 'vehicle-wheel-info
        :local-pos (new 'static 'vector :w 1.0)
        :inertia 1.0
        :radius 4096.0
        :scale 1.0
        :travel 2048.0
        :width 4096.0
        :suspension-spring 0.5
        :suspension-damping 0.5
        :forward-grip 1.0
        :side-grip 1.0
        :max-brake-torque 1.0
        :settle-pos 0.8
        :probe-radius 409.6
        :tread-texture "common-white"
        )
      :rear-wheel (new 'static 'vehicle-wheel-info
        :local-pos (new 'static 'vector :w 1.0)
        :inertia 1.0
        :radius 4096.0
        :scale 1.0
        :travel 2048.0
        :width 4096.0
        :suspension-spring 0.5
        :suspension-damping 0.5
        :forward-grip 1.0
        :side-grip 1.0
        :max-brake-torque 1.0
        :settle-pos 0.8
        :probe-radius 409.6
        :tread-texture "common-white"
        )
      )
    :setup (new 'static 'vehicle-setup-info
      :settle-height 6144.0
      :shadow-bot-clip -40960.0
      :shadow-locus-dist 409600.0
      :color-option-count 3
      :color (new 'static 'inline-array vector 3
        (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
        (new 'static 'vector :x 1.0 :y 0.7 :z 1.0 :w 1.0)
        (new 'static 'vector :x 1.0 :y 0.7 :z 0.7 :w 1.0)
        )
      :gun-yaw-min -65536.0
      :gun-yaw-max 65536.0
      :gun-pitch-min -16384.0
      :gun-pitch-max 16384.0
      )
    :rider (new 'static 'vehicle-rider-info
      :seat-count 2
      :grab-rail-count 2
      :grab-rail-array (new 'static 'inline-array vehicle-grab-rail-info 2
        (new 'static 'vehicle-grab-rail-info
          :local-pos (new 'static 'inline-array vector 2
            (new 'static 'vector :x 2048.0 :w 1.0)
            (new 'static 'vector :x 2048.0 :z 8192.0 :w 1.0)
            )
          :normal (new 'static 'vector :x 1.0 :w 1.0)
          )
        (new 'static 'vehicle-grab-rail-info
          :local-pos (new 'static 'inline-array vector 2
            (new 'static 'vector :x -2048.0 :z 8192.0 :w 1.0)
            (new 'static 'vector :x -2048.0 :w 1.0)
            )
          :normal (new 'static 'vector :x -1.0 :w 1.0)
          )
        )
      :seat-array (new 'static 'inline-array vehicle-seat-info 4
        (new 'static 'vehicle-seat-info
          :position (new 'static 'vector :y -327.68 :z 1318.912 :w (the-as float #x10000))
          )
        (new 'static 'vehicle-seat-info
          :position (new 'static 'vector :y 2048.0 :z -4096.0 :w (the-as float #x40000))
          )
        (new 'static 'vehicle-seat-info)
        (new 'static 'vehicle-seat-info)
        )
      :rider-hand-offset (new 'static 'inline-array vector 2
        (new 'static 'vector :x 2457.6 :y 409.6 :z 4710.4 :w 1.0)
        (new 'static 'vector :x -2457.6 :y 409.6 :z 4710.4 :w 1.0)
        )
      :attach-point-array #f
      )
    :explosion #f
    :explosion-part #xdb
    :debris #f
    )
  )

(set! (-> *h-torpedo-constants* explosion) *h-bike-explosion-info*)

(defskelgroup skel-h-torpedo cty-dax-missile cty-dax-missile-lod0-jg cty-dax-missile-idle-ja
              ((cty-dax-missile-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 5.4)
              :origin-joint-index 3
              )

(deftype light-trail-tracker-torpedo (light-trail-tracker)
  ()
  )


(defmethod should-track? ((this light-trail-tracker-torpedo) (arg0 process-focusable))
  (let ((v1-0 arg0))
    (and (-> (the-as htorpedo v1-0) on-water?) (< (-> v1-0 root trans y) 20480.0))
    )
  )

(defmethod get-tracked-object-pos ((this light-trail-tracker-torpedo) (arg0 process-focusable) (arg1 vector))
  (let ((v1-0 arg0))
    (when v1-0
      (vector-copy! arg1 (-> v1-0 root trans))
      (set! (-> arg1 y) 4505.6)
      (vector+float*! arg1 arg1 (-> v1-0 node-list data 0 bone transform fvec) 49152.0)
      )
    )
  arg1
  )

;; WARN: Return type mismatch (pointer process) vs none.
(defmethod init-rbody-control! ((this htorpedo))
  (with-pp
    (set! (-> pp level) (level-get *level* 'lctypatk))
    (initialize-skeleton
      this
      (the-as skeleton-group (art-group-get-by-name *level* "skel-h-torpedo" (the-as (pointer level) #f)))
      (the-as pair 0)
      )
    (set! (-> this override-camera?) #f)
    (logior! (-> *h-torpedo-constants* flags) 1024)
    (alloc-rbody-control! this *h-torpedo-constants*)
    (set! (-> this draw lod-set lod 0 dist) 1228800.0)
    (set! (-> this thrust-sound) (new-sound-id))
    (set! (-> this ground-sound) (new-sound-id))
    (set! (-> this evasive-sound) (new-sound-id))
    (set! (-> this wake-sound) (new-sound-id))
    (set! (-> this heat-haze) (create-launch-control (-> *part-group-id-table* 526) this))
    (let* ((s5-1 (-> this heat-haze))
           (s4-1 (method-of-object s5-1 set-local-space-info))
           (s3-0 (add-connection *part-local-space-engine* this local-space-proc-joint 0 0 0))
           )
      (let ((v1-19 (process->handle this)))
        (if (= v1-19 #f)
            (set! v1-19 (process->handle this))
            )
        (set! (-> (the-as particle-local-space-info s3-0) hand) (the-as handle v1-19))
        )
      (matrix-identity! (-> (the-as particle-local-space-info s3-0) mat-new))
      (matrix-identity! (-> (the-as particle-local-space-info s3-0) mat-prev))
      (set! (-> (the-as particle-local-space-info s3-0) flags) (part-local-space-flags))
      (s4-1 s5-1 (the-as particle-local-space-info s3-0))
      )
    (let ((s5-2 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
      (set! (-> s5-2 tracked-obj) (process->handle this))
      (set! (-> s5-2 appearance) *torpedo-wake-trail*)
      (set! (-> s5-2 max-num-crumbs) (the int (* 0.5 (the float (-> s5-2 appearance max-age)))))
      (set! (-> s5-2 track-immediately?) #t)
      (let* ((v1-34 (estimate-light-trail-mem-usage
                      (the-as uint (-> s5-2 max-num-crumbs))
                      (the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips)))
                      )
                    )
             (s4-2 (get-process *default-dead-pool* light-trail-tracker-torpedo (+ v1-34 8192) 1))
             )
        (when s4-2
          (let ((t9-15 (method-of-type process activate)))
            (t9-15 s4-2 this "light-trail" (the-as pointer #x70004000))
            )
          (run-now-in-process s4-2 light-trail-tracker-init-by-other s5-2)
          (-> s4-2 ppointer)
          )
        )
      )
    (none)
    )
  )

;; WARN: Return type mismatch symbol vs none.
(defmethod vehicle-method-88 ((this htorpedo) (arg0 vehicle-controls))
  (call-parent-method this arg0)
  (set! (-> this v-flags) (the-as vehicle-flag (logior (vehicle-flag camera-look-mode) (-> this v-flags))))
  (if (cpad-pressed? 0 x)
      (set! (-> this want-jump?) #t)
      (set! (-> this want-jump?) #f)
      )
  (none)
  )

;; WARN: Return type mismatch object vs none.
;; WARN: Function (method 78 htorpedo) has a return type of none, but the expression builder found a return statement.
(defmethod vehicle-method-78 ((this htorpedo))
  (if (not (and (-> this next-state) (= (-> this next-state name) 'player-control)))
      (return 0)
      )
  (when (and (-> this on-water?) (= (-> this jump-state) 0))
    )
  (when (-> this spawn-splash?)
    (if (logtest? (-> *part-group-id-table* 528 flags) (sp-group-flag sp13))
        (part-tracker-spawn
          part-tracker-subsampler
          :to *entity-pool*
          :group (-> *part-group-id-table* 528)
          :target this
          :mat-joint (the-as object 0)
          )
        (part-tracker-spawn
          part-tracker
          :to *entity-pool*
          :group (-> *part-group-id-table* 528)
          :target this
          :mat-joint (the-as object 0)
          )
        )
    (sound-play "rocket-splash")
    (set! (-> this spawn-splash?) #f)
    )
  (if (and (-> this on-water?) (< (-> this root trans y) 20480.0))
      (sound-play "rocket-wake" :id (-> this wake-sound))
      (sound-stop (-> this wake-sound))
      )
  (spawn-from-mat (-> this heat-haze) (-> this node-list data 0 bone transform))
  (none)
  )

;; WARN: Return type mismatch number vs none.
;; WARN: Function (method 94 htorpedo) has a return type of none, but the expression builder found a return statement.
(defmethod vehicle-method-94 ((this htorpedo))
  (if (-> this override-camera?)
      (return 0)
      )
  0.0
  (let ((a0-1 *camera*))
    (when a0-1
      (let ((a0-2 (-> a0-1 slave)))
        (if a0-2
            (-> a0-2 0 saved-pt y)
            )
        )
      )
    )
  (call-parent-method this)
  (when (logtest? (vehicle-flag camera-look-mode) (-> this v-flags))
    (let ((gp-0 *camera*))
      (when gp-0
        (let ((s3-0 (-> gp-0 slave)))
          (when s3-0
            (let ((s5-0 (new 'stack-no-clear 'matrix)))
              (let ((s1-0 (new 'stack-no-clear 'quaternion))
                    (s2-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (the-as quaternion (-> this rbody rot))))
                    )
                (set! (-> s2-0 y) 0.0)
                (vector-normalize! s2-0 1.0)
                (quaternion-look-at! s1-0 s2-0 *up-vector*)
                (quaternion-rotate-local-x! s1-0 s1-0 (-> this cam-pitch))
                (quaternion-rotate-local-z! s1-0 s1-0 (-> this cam-roll))
                (quaternion-normalize! s1-0)
                (quaternion->matrix s5-0 s1-0)
                (vector-copy! (-> s5-0 trans) (-> this rbody matrix trans))
                (vector-matrix*! (-> s3-0 0 saved-pt) (-> this info camera look-pos-array 0) s5-0)
                (vector+float*! (-> s3-0 0 saved-pt) (-> s3-0 0 saved-pt) s2-0 0.0)
                )
              (let ((v1-18 (-> s3-0 0 tracking)))
                (set! (-> v1-18 inv-mat rvec quad) (-> s5-0 rvec quad))
                (vector-copy! (-> v1-18 inv-mat uvec) (-> s5-0 uvec))
                (vector-copy! (-> v1-18 inv-mat fvec) (-> s5-0 fvec))
                )
              )
            (set! (-> gp-0 slave 0 saved-pt y) (fmax 6144.0 (-> gp-0 slave 0 saved-pt y)))
            )
          )
        )
      )
    )
  (none)
  )

(defmethod rbody-event-handler ((this htorpedo) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
  (local-vars (v0-0 object))
  (with-pp
    (when (= arg2 'pilot-on)
      (nop!)
      0
      )
    (case arg2
      (('attack)
       (if (not (and (-> this next-state) (= (-> this next-state name) 'player-control)))
           (return #f)
           )
       (call-parent-method this arg0 arg1 arg2 arg3)
       )
      (('hide)
       (set! v0-0 (logior (-> this draw status) (draw-control-status no-draw)))
       (set! (-> this draw status) (the-as draw-control-status v0-0))
       v0-0
       )
      (('show)
       (set! v0-0 (logclear (-> this draw status) (draw-control-status no-draw)))
       (set! (-> this draw status) (the-as draw-control-status v0-0))
       v0-0
       )
      (('touch 'touched)
       (cond
         ((or (type? arg0 krimson-wall) (type? arg0 blocking-plane))
          (let ((a1-6 (new 'stack-no-clear 'event-message-block)))
            (set! (-> a1-6 from) (process->ppointer pp))
            (set! (-> a1-6 num-params) 1)
            (set! (-> a1-6 message) 'nuke-hit)
            (set! (-> a1-6 param 0) (the-as uint #t))
            (let ((t9-4 send-event-function)
                  (v1-23 (-> *game-info* sub-task-list (game-task-node city-port-attack-resolution)))
                  )
              (t9-4
                (handle->process (if (-> v1-23 manager)
                                     (-> v1-23 manager manager)
                                     (the-as handle #f)
                                     )
                                 )
                a1-6
                )
              )
            )
          )
         ((type? arg0 crimson-guard)
          (sound-play "crims-nuke-hit")
          )
         )
       (call-parent-method this arg0 arg1 arg2 arg3)
       )
      (('allow-dismount)
       (set! v0-0 (logand -1025 (-> *h-torpedo-constants* flags)))
       (set! (-> *h-torpedo-constants* flags) (the-as uint v0-0))
       v0-0
       )
      (('override-camera)
       (set! v0-0 (-> arg3 param 0))
       (set! (-> this override-camera?) (the-as symbol v0-0))
       v0-0
       )
      (else
        (call-parent-method this arg0 arg1 arg2 arg3)
        )
      )
    )
  )

(defmethod init-collision! ((this htorpedo))
  (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player))))
    (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s5-0 reaction) cshape-reaction-default)
    (set! (-> s5-0 no-reaction)
          (the-as (function collide-shape-moving collide-query vector vector object) nothing)
          )
    (set! (-> s5-0 penetrate-using) (penetrate vehicle))
    (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0)))
      (set! (-> s5-0 total-prims) (the-as uint 3))
      (set! (-> s4-0 prim-core action) (collide-action solid))
      (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 13312.0)
      (set! (-> s5-0 root-prim) s4-0)
      )
    (let ((v1-11 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 1))))
      (set! (-> v1-11 prim-core action) (collide-action solid nav-sphere))
      (set! (-> v1-11 transform-index) 0)
      (set-vector! (-> v1-11 local-sphere) 0.0 0.0 4505.6 4300.8)
      (set! (-> v1-11 nav-radius) 7577.6)
      )
    (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 1))))
      (set! (-> v1-13 prim-core action) (collide-action solid))
      (set! (-> v1-13 transform-index) 0)
      (set-vector! (-> v1-13 local-sphere) 0.0 0.0 9011.2 3686.4)
      )
    (set! (-> s5-0 nav-radius) 16384.0)
    (let ((v1-15 (-> s5-0 root-prim)))
      (set! (-> s5-0 backup-collide-as) (-> v1-15 prim-core collide-as))
      (set! (-> s5-0 backup-collide-with) (-> v1-15 prim-core collide-with))
      )
    (set! (-> s5-0 nav-flags) (nav-flags has-child-spheres))
    (set! (-> this root) s5-0)
    )
  0
  (none)
  )

;; WARN: Return type mismatch connection vs none.
(defmethod update-sound ((this htorpedo))
  (let ((f30-0 0.0))
    (set! f30-0 (cond
                  ((not (-> this on-water?))
                   (let ((f30-1 (- (-> this root trans y) (-> this ground-height))))
                     0.0
                     (let* ((f1-3 (* 0.000061035156 (+ -12288.0 f30-1)))
                            (f0-4 (fmax 0.0 (fmin 1.0 f1-3)))
                            (f0-5 (- 1.0 f0-4))
                            (f0-6 (lerp 0.0 0.15 f0-5))
                            )
                       (seek! (-> this reverb-dest) f0-6 (* 2.0 (seconds-per-frame)))
                       )
                     (let* ((f1-10 (* 0.000013563368 (+ -12288.0 f30-1)))
                            (f0-12 (fmax 0.0 (fmin 1.0 f1-10)))
                            )
                       (- 1.0 f0-12)
                       )
                     )
                   )
                  (else
                    (seek! (-> this reverb-dest) 0.0 (* 0.1 (seconds-per-frame)))
                    f30-0
                    )
                  )
          )
    (if (< f30-0 (-> this ground-vol-current))
        (seek! (-> this ground-vol-current) f30-0 (* 0.4 (seconds-per-frame)))
        (seek! (-> this ground-vol-current) f30-0 (* 5.4 (seconds-per-frame)))
        )
    )
  (let* ((f0-27 (/ (-> this rbody lin-momentum y) (meters 2000)))
         (f0-29 (fmax -1.0 (fmin 1.0 f0-27)))
         (f0-30 (/ f0-29 2))
         )
    (if (< f0-30 (-> this pitch-current))
        (seek! (-> this pitch-current) f0-30 (* 0.25 (seconds-per-frame)))
        (seek! (-> this pitch-current) f0-30 (* 4.0 (seconds-per-frame)))
        )
    )
  (let* ((f1-25 (/ (-> this rbody lin-momentum y) (meters 2000)))
         (f30-2 (fmax 0.0 (fmin 1.0 f1-25)))
         )
    (sound-play-by-name
      (static-sound-name "rocket-ground")
      (-> this ground-sound)
      (the int (* 1024.0 (-> this ground-vol-current)))
      0
      0
      (sound-group)
      #t
      )
    (sound-play-by-name
      (static-sound-name "rocket-thrust")
      (-> this thrust-sound)
      (the int (* 1024.0 (lerp 0.75 1.0 f30-2)))
      (the int (* 1524.0 (-> this pitch-current)))
      0
      (sound-group)
      #t
      )
    )
  (let ((f0-49 (if (< 0.0 (-> this controls steering))
                   1.0
                   -1.0
                   )
               )
        (f30-3 0.0)
        )
    (let ((f1-30 (-> this controls steering)))
      (set! f30-3 (cond
                    ((!= (-> this last-slice-val) 0.0)
                     (let ((f1-32 (fabs (- (-> this last-slice-val) f1-30))))
                       (cond
                         ((< 1.0 f1-32)
                          (set! (-> this last-slice-val) 0.0)
                          f30-3
                          )
                         (else
                           (set! (-> this last-slice-val) f0-49)
                           (lerp 1.0 0.0 f1-32)
                           )
                         )
                       )
                     )
                    (else
                      (when (< 0.15 (fabs f1-30))
                        (set! (-> this last-slice-val) f0-49)
                        (set! f30-3 1.0)
                        )
                      f30-3
                      )
                    )
            )
      )
    (cond
      ((< 0.0 f30-3)
       (let ((f28-1 (lerp 0.0 1.0 f30-3))
             (f30-4 (lerp 0.0 0.2 f30-3))
             )
         (let ((f0-53 (- 1.0 (* (- 1.0 f28-1) (- 1.0 f28-1)))))
           (if (< (-> this evasive-volume) f0-53)
               (set! (-> this evasive-volume) f0-53)
               (seek! (-> this evasive-volume) f0-53 (seconds-per-frame))
               )
           )
         (sound-play-by-name
           (static-sound-name "rocket-slice")
           (-> this evasive-sound)
           (the int (* 1024.0 (-> this evasive-volume)))
           (the int (* 1524.0 f30-4))
           0
           (sound-group)
           #t
           )
         )
       )
      (else
        (seek! (-> this evasive-volume) 0.0 (seconds-per-frame))
        (sound-stop (-> this evasive-sound))
        )
      )
    )
  (set-setting! 'sound-reverb 'abs (-> this reverb-dest) 0)
  (none)
  )

(defmethod vehicle-method-129 ((this htorpedo))
  (when (and (logtest? (vehicle-flag player-driving) (-> this v-flags)) *target* (!= (-> this crash-level) 3))
    (if (focus-test? *target* pilot-riding)
        (vehicle-method-134 this)
        )
    )
  0
  (none)
  )

(defmethod deactivate ((this htorpedo))
  "Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
  (if (nonzero? (-> this heat-haze))
      (kill-particles (-> this heat-haze))
      )
  (call-parent-method this)
  (none)
  )

(defmethod relocate ((this htorpedo) (offset int))
  (if (nonzero? (-> this heat-haze))
      (&+! (-> this heat-haze) offset)
      )
  (call-parent-method this offset)
  )

(defmethod rigid-body-object-method-38 ((this htorpedo))
  0
  (none)
  )

(defmethod attack-handler ((this htorpedo) (arg0 process-drawable) (arg1 attack-info) (arg2 touching-shapes-entry) (arg3 penetrate))
  (local-vars (v0-0 symbol))
  (cond
    ((logtest? (penetrate jak-dark-nuke) arg3)
     (return #f)
     v0-0
     )
    (else
      (call-parent-method this arg0 arg1 arg2 arg3)
      )
    )
  )
