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

(import "goal_src/jak1/import/windmill-sail-ag.gc")
(import "goal_src/jak1/import/medres-beach3-ag.gc")
(import "goal_src/jak1/import/mayorgears-ag.gc")
(import "goal_src/jak1/import/medres-village11-ag.gc")
(import "goal_src/jak1/import/revcycleprop-ag.gc")
(import "goal_src/jak1/import/medres-jungle2-ag.gc")
(import "goal_src/jak1/import/revcycle-ag.gc")
(import "goal_src/jak1/import/medres-misty-ag.gc")
(import "goal_src/jak1/import/sagesail-ag.gc")
(import "goal_src/jak1/import/windspinner-ag.gc")
(import "goal_src/jak1/import/medres-jungle1-ag.gc")
(import "goal_src/jak1/import/medres-village12-ag.gc")
(import "goal_src/jak1/import/hutlamp-ag.gc")
(import "goal_src/jak1/import/medres-jungle-ag.gc")
(import "goal_src/jak1/import/medres-village13-ag.gc")
(import "goal_src/jak1/import/medres-beach2-ag.gc")
(import "goal_src/jak1/import/villa-starfish-ag.gc")
(import "goal_src/jak1/import/medres-training-ag.gc")
(import "goal_src/jak1/import/medres-beach-ag.gc")
(import "goal_src/jak1/import/reflector-middle-ag.gc")
(import "goal_src/jak1/import/medres-beach1-ag.gc")

;; failed to figure out what this is:
(defskelgroup *med-res-jungle-sg* medres-jungle medres-jungle-lod0-jg medres-jungle-idle-ja
              ((medres-jungle-lod0-mg (meters 999999)))
              :bounds (static-spherem -80 0 -80 240)
              :longest-edge (meters 0.01)
              )

;; failed to figure out what this is:
(defskelgroup *med-res-jungle1-sg* medres-jungle1 medres-jungle1-lod0-jg medres-jungle1-idle-ja
              ((medres-jungle1-lod0-mg (meters 999999)))
              :bounds (static-spherem 30 0 -40 230)
              :longest-edge (meters 0.01)
              )

;; failed to figure out what this is:
(defskelgroup *med-res-jungle2-sg* medres-jungle2 medres-jungle2-lod0-jg medres-jungle2-idle-ja
              ((medres-jungle2-lod0-mg (meters 999999)))
              :bounds (static-spherem 90 0 130 110)
              :longest-edge (meters 0.01)
              )

;; failed to figure out what this is:
(defskelgroup *med-res-beach-sg* medres-beach medres-beach-lod0-jg medres-beach-idle-ja
              ((medres-beach-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 -140 200)
              :longest-edge (meters 0.01)
              )

;; failed to figure out what this is:
(defskelgroup *med-res-beach1-sg* medres-beach1 medres-beach1-lod0-jg medres-beach1-idle-ja
              ((medres-beach1-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 -360 200)
              :longest-edge (meters 0.01)
              )

;; failed to figure out what this is:
(defskelgroup *med-res-beach2-sg* medres-beach2 medres-beach2-lod0-jg medres-beach2-idle-ja
              ((medres-beach2-lod0-mg (meters 999999)))
              :bounds (static-spherem -200 0 -450 180)
              :longest-edge (meters 0.01)
              )

;; failed to figure out what this is:
(defskelgroup *med-res-beach3-sg* medres-beach3 medres-beach3-lod0-jg medres-beach3-idle-ja
              ((medres-beach3-lod0-mg (meters 999999)))
              :bounds (static-spherem 75 70 -480 100)
              :longest-edge (meters 0.01)
              )

;; failed to figure out what this is:
(defskelgroup *med-res-misty-sg* medres-misty medres-misty-lod0-jg medres-misty-idle-ja
              ((medres-misty-lod0-mg (meters 999999)))
              :bounds (static-spherem -40 0 -20 260)
              :longest-edge (meters 0.01)
              )

;; failed to figure out what this is:
(defskelgroup *med-res-village11-sg* medres-village11 medres-village11-lod0-jg medres-village11-idle-ja
              ((medres-village11-lod0-mg (meters 999999)))
              :bounds (static-spherem -100 0 90 200)
              :longest-edge (meters 0.01)
              )

;; failed to figure out what this is:
(defskelgroup *med-res-village12-sg* medres-village12 medres-village12-lod0-jg medres-village12-idle-ja
              ((medres-village12-lod0-mg (meters 999999)))
              :bounds (static-spherem 40 0 -50 155)
              :longest-edge (meters 0.01)
              )

;; failed to figure out what this is:
(defskelgroup *med-res-village13-sg* medres-village13 medres-village13-lod0-jg medres-village13-idle-ja
              ((medres-village13-lod0-mg (meters 999999)))
              :bounds (static-spherem 180 -40 -40 180)
              :longest-edge (meters 0.01)
              )

;; failed to figure out what this is:
(defskelgroup *med-res-training-sg* medres-training medres-training-lod0-jg medres-training-idle-ja
              ((medres-training-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 -60 220)
              :longest-edge (meters 0.01)
              )

;; failed to figure out what this is:
(defpart 368
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 2.5)
    (sp-flt spt-x (meters 0.8))
    (sp-flt spt-scale-x (meters 1.7))
    (sp-copy-from-other spt-scale-y -4)
    (sp-flt spt-r 64.0)
    (sp-rnd-flt spt-g 0.0 128.0 1.0)
    (sp-flt spt-b 255.0)
    (sp-flt spt-a 64.0)
    (sp-flt spt-scalevel-x (meters -0.0020833334))
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-r -0.08888889)
    (sp-flt spt-accel-y -0.13653333)
    (sp-int spt-timer 720)
    (sp-cpuinfo-flags bit2 bit3)
    (sp-rnd-int-flt spt-conerot-x (degrees 0.0) 3 16384.0)
    (sp-rnd-flt spt-conerot-radius (meters 2) (meters 17.5) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 369
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 3.0)
    (sp-flt spt-x (meters 4))
    (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 64.0)
    (sp-rnd-flt spt-g 0.0 128.0 1.0)
    (sp-flt spt-b 255.0)
    (sp-flt spt-a 128.0)
    (sp-rnd-flt spt-vel-x (meters -0.01) (meters 0.02) 1.0)
    (sp-flt spt-vel-y (meters 0.050666668))
    (sp-rnd-flt spt-vel-z (meters -0.01) (meters 0.02) 1.0)
    (sp-flt spt-scalevel-x (meters 0.0016666667))
    (sp-rnd-flt spt-rotvel-z (degrees -3.0000002) (degrees 6.0000005) 1.0)
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-r -0.35555556)
    (sp-flt spt-fade-g -0.35555556)
    (sp-flt spt-fade-a 0.35555556)
    (sp-int spt-timer 165)
    (sp-cpuinfo-flags bit2 bit3)
    (sp-rnd-int-flt spt-conerot-x (degrees -45.0) 3 16384.0)
    (sp-flt spt-conerot-radius (meters 2))
    )
  )

;; failed to figure out what this is:
(defpart 370
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 5.0)
    (sp-flt spt-x (meters 4))
    (sp-flt spt-scale-x (meters 1.7))
    (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 64.0)
    (sp-rnd-flt spt-g 0.0 128.0 1.0)
    (sp-flt spt-b 255.0)
    (sp-flt spt-a 64.0)
    (sp-rnd-flt spt-vel-x (meters -0.026666667) (meters 0.07666667) 1.0)
    (sp-flt spt-vel-y (meters -0.006666667))
    (sp-rnd-flt spt-vel-z (meters -0.05) (meters 0.1) 1.0)
    (sp-flt spt-scalevel-x (meters -0.008333334))
    (sp-rnd-flt spt-rotvel-z (degrees -3.0000002) (degrees 6.0000005) 1.0)
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-r -0.17777778)
    (sp-flt spt-accel-y -4.096)
    (sp-int spt-timer 180)
    (sp-cpuinfo-flags bit2 bit3)
    (sp-rnd-int-flt spt-conerot-x (degrees -45.0) 3 16384.0)
    (sp-flt spt-conerot-radius (meters 10.6))
    )
  )

;; failed to figure out what this is:
(defpart 371
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 3.8)
    (sp-flt spt-x (meters 5.5))
    (sp-rnd-flt spt-scale-x (meters 1) (meters 1) 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 32.0)
    (sp-rnd-flt spt-g 0.0 64.0 1.0)
    (sp-flt spt-b 255.0)
    (sp-flt spt-a 196.0)
    (sp-rnd-flt spt-vel-x (meters -0.006666667) (meters 0.026666667) 1.0)
    (sp-flt spt-vel-y (meters 0.0073333336))
    (sp-flt spt-scalevel-x (meters -0.008333334))
    (sp-rnd-flt spt-rotvel-z (degrees -0.99999994) (degrees 1.9999999) 1.0)
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-r -0.17777778)
    (sp-flt spt-fade-a -1.0888889)
    (sp-int spt-timer 165)
    (sp-cpuinfo-flags bit2 bit3)
    (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0)
    (sp-rnd-flt spt-conerot-radius (meters 0) (meters 2.3) 1.0)
    )
  )

;; definition of type windmill-sail
(deftype windmill-sail (process-drawable)
  ((root-override trsq                             :offset        112)
   (sync          sync-info                :inline :offset-assert 176)
   (blade-normal  vector                   :inline :offset-assert 192)
   (orig-quat     quaternion               :inline :offset-assert 208)
   (alt-actor     entity-actor                     :offset-assert 224)
   (part2         sparticle-launch-control         :offset-assert 228)
   )
  :heap-base #x80
  :method-count-assert 20
  :size-assert         #xe8
  :flag-assert         #x14008000e8
  (:states
    windmill-sail-idle
    )
  )

;; definition for method 3 of type windmill-sail
(defmethod inspect windmill-sail ((obj windmill-sail))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tsync: #<sync-info @ #x~X>~%" (-> obj sync))
  (format #t "~T~Tblade-normal: #<vector @ #x~X>~%" (-> obj blade-normal))
  (format #t "~T~Torig-quat: #<quaternion @ #x~X>~%" (-> obj orig-quat))
  (format #t "~T~Talt-actor: ~A~%" (-> obj alt-actor))
  (format #t "~T~Tpart2: ~A~%" (-> obj part2))
  obj
  )

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

;; definition for method 10 of type windmill-sail
(defmethod deactivate windmill-sail ((obj windmill-sail))
  (if (nonzero? (-> obj part2))
      (kill-and-free-particles (-> obj part2))
      )
  ((method-of-type process-drawable deactivate) obj)
  (none)
  )

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

;; failed to figure out what this is:
(defpartgroup group-win-wind-mill
  :id 123
  :bounds (static-bspherem 0 0 0 20)
  :parts ((sp-item 368 :fade-after (meters 100))
    (sp-item 369 :fade-after (meters 100))
    (sp-item 370 :fade-after (meters 200))
    (sp-item 371 :fade-after (meters 200))
    )
  )

;; failed to figure out what this is:
(defpartgroup group-win-wind-mill-hires
  :id 124
  :bounds (static-bspherem 0 0 0 20)
  :parts ((sp-item 368) (sp-item 369) (sp-item 370) (sp-item 371))
  )

;; failed to figure out what this is:
(defstate windmill-sail-idle (windmill-sail)
  :trans (behavior ()
    (cond
      ((task-closed? (game-task jungle-lurkerm) (task-status need-reminder))
       (let ((f30-0 (get-current-value (-> self sync) 65536.0)))
         (set! (-> self sync period) (the-as uint 4800))
         (quaternion-axis-angle!
           (-> self root-override quat)
           (-> self blade-normal x)
           (-> self blade-normal y)
           (-> self blade-normal z)
           f30-0
           )
         (quaternion*! (-> self root-override quat) (-> self root-override quat) (-> self orig-quat))
         (quaternion-normalize! (-> self root-override quat))
         (set! (-> *part-id-table* 368 init-specs 15 initial-valuef) f30-0)
         )
       (spawn
         (if (movie?)
             (-> self part2)
             (-> self part)
             )
         (-> self root-override trans)
         )
       (if (nonzero? (-> self sound))
           (change-sound! (-> self sound) (static-sound-name "mayors-gears"))
           )
       )
      (else
        (set! (-> self sync period) (the-as uint #x15f90))
        (let ((f0-3 (get-current-value (-> self sync) 65536.0)))
          (quaternion-axis-angle!
            (-> self root-override quat)
            (-> self blade-normal x)
            (-> self blade-normal y)
            (-> self blade-normal z)
            f0-3
            )
          )
        (quaternion*! (-> self root-override quat) (-> self root-override quat) (-> self orig-quat))
        (quaternion-normalize! (-> self root-override quat))
        )
      )
    (if (nonzero? (-> self sound))
        (update! (-> self sound))
        )
    (if (= (-> self draw cur-lod) (-> self draw lod-set max-lod))
        (logior! (-> self draw status) (draw-status do-not-check-distance))
        (logclear! (-> self draw status) (draw-status do-not-check-distance))
        )
    (none)
    )
  :code (the-as (function none :behavior windmill-sail) anim-loop)
  :post (the-as (function none :behavior windmill-sail) ja-post)
  )

;; definition for method 11 of type windmill-sail
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! windmill-sail ((obj windmill-sail) (arg0 entity-actor))
  (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask)))
  (load-params! (-> obj sync) obj (the-as uint 4800) 0.0 0.15 0.15)
  (set! (-> obj root-override) (new 'process 'trsq))
  (process-drawable-from-entity! obj arg0)
  (logclear! (-> obj mask) (process-mask actor-pause))
  (initialize-skeleton obj *windmill-sail-sg* '())
  (quaternion-copy! (-> obj orig-quat) (-> obj root-override quat))
  (vector-x-quaternion! (-> obj blade-normal) (-> obj root-override quat))
  (vector-normalize! (-> obj blade-normal) 1.0)
  (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 123) obj))
  (set! (-> obj part2) (create-launch-control (-> *part-group-id-table* 124) obj))
  (set! (-> obj sound) (new 'process 'ambient-sound arg0 (-> obj root-override trans)))
  (go windmill-sail-idle)
  (none)
  )

;; definition of type sagesail
(deftype sagesail (process-drawable)
  ((root-override trsq               :offset        112)
   (sync          sync-info  :inline :offset-assert 176)
   (blade-normal  vector     :inline :offset-assert 192)
   (orig-quat     quaternion :inline :offset-assert 208)
   )
  :heap-base #x70
  :method-count-assert 20
  :size-assert         #xe0
  :flag-assert         #x14007000e0
  (:states
    sagesail-idle
    )
  )

;; definition for method 3 of type sagesail
(defmethod inspect sagesail ((obj sagesail))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tsync: #<sync-info @ #x~X>~%" (-> obj sync))
  (format #t "~T~Tblade-normal: #<vector @ #x~X>~%" (-> obj blade-normal))
  (format #t "~T~Torig-quat: #<quaternion @ #x~X>~%" (-> obj orig-quat))
  obj
  )

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

;; failed to figure out what this is:
(defstate sagesail-idle (sagesail)
  :trans (behavior ()
    (let ((f0-0 (get-current-value (-> self sync) 65536.0)))
      (quaternion-axis-angle!
        (-> self root-override quat)
        (-> self blade-normal x)
        (-> self blade-normal y)
        (-> self blade-normal z)
        f0-0
        )
      )
    (quaternion*! (-> self root-override quat) (-> self root-override quat) (-> self orig-quat))
    (quaternion-normalize! (-> self root-override quat))
    (none)
    )
  :code (the-as (function none :behavior sagesail) anim-loop)
  :post (the-as (function none :behavior sagesail) ja-post)
  )

;; definition for method 11 of type sagesail
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! sagesail ((obj sagesail) (arg0 entity-actor))
  (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask)))
  (load-params! (-> obj sync) obj (the-as uint 3000) 0.0 0.15 0.15)
  (set! (-> obj root-override) (new 'process 'trsq))
  (process-drawable-from-entity! obj arg0)
  (logclear! (-> obj mask) (process-mask actor-pause))
  (initialize-skeleton obj *sagesail-sg* '())
  (quaternion-copy! (-> obj orig-quat) (-> obj root-override quat))
  (vector-z-quaternion! (-> obj blade-normal) (-> obj root-override quat))
  (vector-normalize! (-> obj blade-normal) 1.0)
  (go sagesail-idle)
  (none)
  )

;; definition of type windspinner
(deftype windspinner (process-drawable)
  ((blade-normal vector     :inline :offset-assert 176)
   (orig-quat    quaternion :inline :offset-assert 192)
   (angle        float              :offset-assert 208)
   (angle-vel    float              :offset-assert 212)
   )
  :heap-base #x70
  :method-count-assert 20
  :size-assert         #xd8
  :flag-assert         #x14007000d8
  (:states
    windspinner-idle
    )
  )

;; definition for method 3 of type windspinner
(defmethod inspect windspinner ((obj windspinner))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tblade-normal: #<vector @ #x~X>~%" (-> obj blade-normal))
  (format #t "~T~Torig-quat: #<quaternion @ #x~X>~%" (-> obj orig-quat))
  (format #t "~T~Tangle: ~f~%" (-> obj angle))
  (format #t "~T~Tangle-vel: ~f~%" (-> obj angle-vel))
  obj
  )

;; definition for method 12 of type windspinner
(defmethod run-logic? windspinner ((obj windspinner))
  (or (zero? (logand (-> obj mask) (process-mask actor-pause)))
      (or (and (nonzero? (-> obj draw))
               (logtest? (-> obj draw status) (draw-status was-drawn))
               (>= (+ (-> *ACTOR-bank* pause-dist) (-> obj root pause-adjust-distance))
                   (vector-vector-distance (-> obj root trans) (math-camera-pos))
                   )
               )
          (and (nonzero? (-> obj skel)) (!= (-> obj skel root-channel 0) (-> obj skel channel)))
          (and (nonzero? (-> obj draw)) (logtest? (-> obj draw status) (draw-status no-skeleton-update)))
          )
      )
  )

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

;; failed to figure out what this is:
(defstate windspinner-idle (windspinner)
  :trans (behavior ()
    (let* ((f0-0 0.992)
           (f1-0 0.008090864)
           (a0-0 (-> self root trans))
           (f0-1
             (* f0-0
                (+ (* f1-0
                      (-> *wind-work*
                          wind-force
                          (logand (+ (the int (-> a0-0 x)) (the int (-> a0-0 z)) (-> *wind-work* wind-time)) 63)
                          )
                      )
                   (-> self angle-vel)
                   )
                )
             )
           )
      (if (< 291.27112 f0-1)
          (set! f0-1 291.27112)
          )
      (set! (-> self angle-vel) f0-1)
      )
    (let ((f0-3 (+ (-> self angle) (-> self angle-vel))))
      (set! (-> self angle) (- f0-3 (* (the float (the int (/ f0-3 65536.0))) 65536.0)))
      )
    (quaternion-axis-angle!
      (-> self root quat)
      (-> self blade-normal x)
      (-> self blade-normal y)
      (-> self blade-normal z)
      (-> self angle)
      )
    (quaternion*! (-> self root quat) (-> self root quat) (-> self orig-quat))
    (quaternion-normalize! (-> self root quat))
    (none)
    )
  :code (the-as (function none :behavior windspinner) anim-loop)
  :post (the-as (function none :behavior windspinner) ja-post)
  )

;; definition for method 11 of type windspinner
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! windspinner ((obj windspinner) (arg0 entity-actor))
  (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask)))
  (set! (-> obj angle) 0.0)
  (set! (-> obj angle-vel) 145.63556)
  (set! (-> obj root) (the-as trsqv (new 'process 'trsq)))
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *windspinner-sg* '())
  (set! (-> obj root pause-adjust-distance) 819200.0)
  (quaternion-copy! (-> obj orig-quat) (-> obj root quat))
  (vector-y-quaternion! (-> obj blade-normal) (-> obj root quat))
  (vector-normalize! (-> obj blade-normal) 1.0)
  (go windspinner-idle)
  (none)
  )

;; definition of type mayorgears
(deftype mayorgears (process-drawable)
  ((alt-actor entity-actor  :offset-assert 176)
   )
  :heap-base #x50
  :method-count-assert 20
  :size-assert         #xb4
  :flag-assert         #x14005000b4
  (:states
    mayorgears-idle
    )
  )

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

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

;; failed to figure out what this is:
(defstate mayorgears-idle (mayorgears)
  :code (behavior ()
    (loop
      (if (task-closed? (game-task jungle-lurkerm) (task-status need-reminder))
          (ja :num! (loop!))
          (ja :num! (loop! 0.0))
          )
      (suspend)
      )
    (none)
    )
  :post (the-as (function none :behavior mayorgears) ja-post)
  )

;; definition for method 11 of type mayorgears
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! mayorgears ((obj mayorgears) (arg0 entity-actor))
  (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask)))
  (set! (-> obj root) (new 'process 'trsqv))
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *mayorgears-sg* '())
  (set! (-> obj draw shadow-mask) (the-as uint 255))
  (go mayorgears-idle)
  (none)
  )

;; definition of type reflector-middle
(deftype reflector-middle (process-drawable)
  ((reflector-trans      vector :inline :offset-assert 176)
   (next-reflector-trans vector :inline :offset-assert 192)
   )
  :heap-base #x60
  :method-count-assert 20
  :size-assert         #xd0
  :flag-assert         #x14006000d0
  (:states
    reflector-middle-idle
    )
  )

;; definition for method 3 of type reflector-middle
(defmethod inspect reflector-middle ((obj reflector-middle))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Treflector-trans: ~`vector`P~%" (-> obj reflector-trans))
  (format #t "~T~Tnext-reflector-trans: ~`vector`P~%" (-> obj next-reflector-trans))
  obj
  )

;; failed to figure out what this is:
(defskelgroup *reflector-middle-sg* reflector-middle reflector-middle-geo-jg reflector-middle-idle-ja
              ((reflector-middle-geo-mg (meters 999999)))
              :bounds (static-spherem 0 17 0 17)
              )

;; failed to figure out what this is:
(defstate reflector-middle-idle (reflector-middle)
  :trans (behavior ()
    (when (task-closed? (game-task jungle-lurkerm) (task-status need-reminder))
      (process-entity-status! self (entity-perm-status complete) #t)
      (draw-eco-beam (-> self reflector-trans) (-> self next-reflector-trans))
      )
    (none)
    )
  :code (the-as (function none :behavior reflector-middle) anim-loop)
  :post (the-as (function none :behavior reflector-middle) ja-post)
  )

;; definition for method 11 of type reflector-middle
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(defmethod init-from-entity! reflector-middle ((obj reflector-middle) (arg0 entity-actor))
  (set! (-> obj root) (new 'process 'trsqv))
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *reflector-middle-sg* '())
  (logclear! (-> obj mask) (process-mask actor-pause))
  (set! (-> obj link) (new 'process 'actor-link-info obj))
  (set! (-> obj reflector-trans quad) (-> obj root trans quad))
  (+! (-> obj reflector-trans y) (res-lump-float arg0 'height-info))
  (let ((a0-10 (-> obj link next)))
    (when a0-10
      (set! (-> obj next-reflector-trans quad) (-> a0-10 extra trans quad))
      (+! (-> obj next-reflector-trans y) (res-lump-float a0-10 'height-info))
      )
    )
  (logior! (-> obj draw status) (draw-status do-not-check-distance))
  (go reflector-middle-idle)
  (none)
  )

;; definition of type reflector-end
(deftype reflector-end (process-drawable)
  ()
  :heap-base #x40
  :method-count-assert 20
  :size-assert         #xb0
  :flag-assert         #x14004000b0
  (:states
    reflector-end-idle
    )
  )

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

;; failed to figure out what this is:
(defstate reflector-end-idle (reflector-end)
  :code (the-as (function none :behavior reflector-end) anim-loop)
  )

;; definition for method 11 of type reflector-end
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! reflector-end ((obj reflector-end) (arg0 entity-actor))
  (set! (-> obj root) (new 'process 'trsqv))
  (process-drawable-from-entity! obj arg0)
  (go reflector-end-idle)
  (none)
  )

;; definition of type villa-starfish
(deftype villa-starfish (process-drawable)
  ((child-count int8  :offset-assert 176)
   )
  :heap-base #x50
  :method-count-assert 20
  :size-assert         #xb1
  :flag-assert         #x14005000b1
  (:states
    villa-starfish-idle
    )
  )

;; definition for method 3 of type villa-starfish
(defmethod inspect villa-starfish ((obj villa-starfish))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tchild-count: ~D~%" (-> obj child-count))
  obj
  )

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

;; definition of type starfish
(deftype starfish (nav-enemy)
  ()
  :heap-base #x120
  :method-count-assert 76
  :size-assert         #x190
  :flag-assert         #x4c01200190
  (:states
    starfish-idle
    starfish-patrol
    )
  )

;; definition for method 3 of type starfish
(defmethod inspect starfish ((obj starfish))
  (let ((t9-0 (method-of-type nav-enemy inspect)))
    (t9-0 obj)
    )
  obj
  )

;; failed to figure out what this is:
(defstate starfish-idle (starfish)
  :enter (behavior ()
    (move-to-ground (-> self collide-info) 40960.0 40960.0 #t (collide-kind background))
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (ja-channel-set! 0)
    (none)
    )
  :exit (behavior ()
    (ja-channel-set! 1)
    (none)
    )
  :trans (behavior ()
    (if (and *target* (>= 163840.0 (vector-vector-distance (-> self collide-info trans) (-> *target* control trans))))
        (go starfish-patrol)
        )
    (none)
    )
  :code (behavior ()
    (loop
      (suspend)
      )
    (none)
    )
  :post (the-as (function none :behavior starfish) ja-post)
  )

;; failed to figure out what this is:
(defstate starfish-patrol (starfish)
  :enter (behavior ()
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (set! (-> self nav flags) (logior (nav-control-flags navcf19) (-> self nav flags)))
    (none)
    )
  :trans (behavior ()
    (when (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 1))
      (if (or (not *target*)
              (< 204800.0 (vector-vector-distance (-> self collide-info trans) (-> *target* control trans)))
              )
          (go starfish-idle)
          )
      )
    (none)
    )
  :code (behavior ()
    (set! (-> self target-speed) 4096.0)
    (set! (-> self rotate-speed) 12743.111)
    (set! (-> self turn-time) (seconds 0.5))
    (loop
      (ja-no-eval :group! (-> self draw art-group data 2) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (suspend)
        (ja :num! (seek!))
        )
      )
    (none)
    )
  :post (the-as (function none :behavior starfish) nav-enemy-patrol-post)
  )

;; definition for symbol *starfish-nav-enemy-info*, type nav-enemy-info
(define *starfish-nav-enemy-info* (new 'static 'nav-enemy-info
                                    :idle-anim -1
                                    :walk-anim -1
                                    :turn-anim -1
                                    :notice-anim -1
                                    :run-anim -1
                                    :jump-anim -1
                                    :jump-land-anim -1
                                    :victory-anim -1
                                    :taunt-anim -1
                                    :die-anim -1
                                    :neck-joint -1
                                    :player-look-at-joint 5
                                    :run-travel-speed (meters 1)
                                    :run-rotate-speed (degrees 70.0)
                                    :run-acceleration (meters 1)
                                    :run-turn-time (seconds 0.5)
                                    :walk-travel-speed (meters 1)
                                    :walk-rotate-speed (degrees 70.0)
                                    :walk-acceleration (meters 1)
                                    :walk-turn-time (seconds 0.5)
                                    :attack-shove-back (meters 3)
                                    :attack-shove-up (meters 2)
                                    :shadow-size (meters 1)
                                    :nav-nearest-y-threshold (meters 10)
                                    :notice-distance (meters 30)
                                    :stop-chase-distance (meters 40)
                                    :frustration-distance (meters 8)
                                    :frustration-time (seconds 4)
                                    :die-anim-hold-frame 10000000000.0
                                    :jump-land-anim-end-frame 10000000000.0
                                    :jump-height-min (meters 1)
                                    :jump-height-factor 0.5
                                    :jump-start-anim-speed 1.0
                                    :shadow-max-y (meters 1)
                                    :shadow-min-y (meters -1)
                                    :shadow-locus-dist (meters 150)
                                    :use-align #f
                                    :draw-shadow #f
                                    :move-to-ground #t
                                    :hover-if-no-ground #f
                                    :use-momentum #f
                                    :use-flee #f
                                    :use-proximity-notice #f
                                    :use-jump-blocked #f
                                    :use-jump-patrol #f
                                    :gnd-collide-with (collide-kind background)
                                    :debug-draw-neck #f
                                    :debug-draw-jump #f
                                    )
        )

;; definition for method 47 of type starfish
;; INFO: Return type mismatch int vs none.
(defmethod initialize-collision starfish ((obj starfish))
  (set! (-> obj mask) (logior (process-mask enemy) (-> obj mask)))
  (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-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 0))))
      (set! (-> s4-0 prim-core offense) (collide-offense normal-attack))
      (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 2457.6)
      (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 collide-info) s5-0)
    )
  0
  (none)
  )

;; definition for method 48 of type starfish
;; INFO: Return type mismatch int vs none.
(defmethod TODO-RENAME-48 starfish ((obj starfish))
  (initialize-skeleton obj *starfish-sg* '())
  (TODO-RENAME-45 obj *starfish-nav-enemy-info*)
  0
  (none)
  )

;; definition for function starfish-init-by-other
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(defbehavior starfish-init-by-other starfish ((arg0 starfish) (arg1 vector))
  (initialize-collision self)
  (logior! (-> self mask) (process-mask actor-pause))
  (set! (-> self collide-info trans quad) (-> arg1 quad))
  (quaternion-copy! (-> self collide-info quat) (-> arg0 collide-info quat))
  (vector-identity! (-> self collide-info scale))
  (set! (-> self entity) (-> arg0 entity))
  (TODO-RENAME-48 self)
  (go starfish-idle)
  (none)
  )

;; definition for function process-drawable-child-count
(defbehavior process-drawable-child-count process-drawable ()
  (let ((v0-0 0))
    (let ((v1-0 (-> self child)))
      (while v1-0
        (+! v0-0 1)
        (set! v1-0 (-> v1-0 0 brother))
        (nop!)
        (nop!)
        )
      )
    v0-0
    )
  )

;; definition for function starfish-spawn-child
;; INFO: Return type mismatch (pointer process) vs (pointer starfish).
;; Used lq/sq
(defbehavior starfish-spawn-child starfish ()
  (let ((gp-0 (new-stack-vector0)))
    (get-random-point (-> self path) gp-0)
    (process-spawn starfish self gp-0 :to self)
    )
  )

;; failed to figure out what this is:
(defstate villa-starfish-idle (villa-starfish)
  :code (behavior ()
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (loop
      (when (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.5))
        (set! (-> self state-time) (-> *display* base-frame-counter))
        (if (and (and *target* (>= 204800.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))))
                 (< (process-drawable-child-count) (-> self child-count))
                 )
            (starfish-spawn-child)
            )
        )
      (suspend)
      )
    (none)
    )
  :post (the-as (function none :behavior villa-starfish) #f)
  )

;; definition for method 11 of type villa-starfish
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! villa-starfish ((obj villa-starfish) (arg0 entity-actor))
  (set! (-> obj root) (new 'process 'trsqv))
  (process-drawable-from-entity! obj arg0)
  (let ((a1-4 (res-lump-value arg0 'num-lurkers uint128 :default (the-as uint128 3))))
    (set! (-> obj child-count) (max 1 (min 8 (the-as int a1-4))))
    )
  (set! (-> obj path) (new 'process 'path-control obj 'path 0.0))
  (go villa-starfish-idle)
  (none)
  )

;; definition of type village-fish
(deftype village-fish (process-drawable)
  ((child-count int8  :offset-assert 176)
   )
  :heap-base #x50
  :method-count-assert 20
  :size-assert         #xb1
  :flag-assert         #x14005000b1
  (:states
    village-fish-idle
    )
  )

;; definition for method 3 of type village-fish
(defmethod inspect village-fish ((obj village-fish))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tchild-count: ~D~%" (-> obj child-count))
  obj
  )

;; failed to figure out what this is:
(defstate village-fish-idle (village-fish)
  :code (behavior ()
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (loop
      (suspend)
      )
    (none)
    )
  :post (the-as (function none :behavior village-fish) #f)
  )

;; definition for method 11 of type village-fish
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! village-fish ((obj village-fish) (arg0 entity-actor))
  (set! (-> obj root) (new 'process 'trsqv))
  (process-drawable-from-entity! obj arg0)
  (go village-fish-idle)
  (none)
  )

;; definition of type villa-fisha
(deftype villa-fisha (village-fish)
  ()
  :heap-base #x50
  :method-count-assert 20
  :size-assert         #xb1
  :flag-assert         #x14005000b1
  )

;; definition for method 3 of type villa-fisha
(defmethod inspect villa-fisha ((obj villa-fisha))
  (let ((t9-0 (method-of-type village-fish inspect)))
    (t9-0 obj)
    )
  obj
  )

;; definition of type villa-fishb
(deftype villa-fishb (village-fish)
  ()
  :heap-base #x50
  :method-count-assert 20
  :size-assert         #xb1
  :flag-assert         #x14005000b1
  )

;; definition for method 3 of type villa-fishb
(defmethod inspect villa-fishb ((obj villa-fishb))
  (let ((t9-0 (method-of-type village-fish inspect)))
    (t9-0 obj)
    )
  obj
  )

;; definition of type cyclegen
(deftype cyclegen (structure)
  ((output float  :offset-assert   0)
   (inc    float  :offset-assert   4)
   )
  :pack-me
  :method-count-assert 9
  :size-assert         #x8
  :flag-assert         #x900000008
  )

;; definition for method 3 of type cyclegen
(defmethod inspect cyclegen ((obj cyclegen))
  (format #t "[~8x] ~A~%" obj 'cyclegen)
  (format #t "~Toutput: ~f~%" (-> obj output))
  (format #t "~Tinc: ~f~%" (-> obj inc))
  obj
  )

;; definition for function set-period
(defun set-period ((arg0 cyclegen) (arg1 int))
  (let ((f0-1 (/ 5.0 (the float arg1))))
    (set! (-> arg0 inc) f0-1)
    f0-1
    )
  )

;; definition for function update-clock
(defun update-clock ((arg0 cyclegen))
  (let ((f0-1 (+ (-> arg0 output) (* (-> arg0 inc) (-> *display* time-adjust-ratio)))))
    (set! (-> arg0 output) (- f0-1 (the float (the int f0-1))))
    )
  (-> arg0 output)
  )

;; definition of type hutlamp
(deftype hutlamp (process-drawable)
  ((pivot joint-mod-set-local         :offset-assert 176)
   (clock cyclegen            :inline :offset-assert 180)
   )
  :heap-base #x50
  :method-count-assert 20
  :size-assert         #xbc
  :flag-assert         #x14005000bc
  (:states
    hutlamp-idle
    )
  )

;; definition for method 3 of type hutlamp
(defmethod inspect hutlamp ((obj hutlamp))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tpivot: ~A~%" (-> obj pivot))
  (format #t "~T~Tclock: #<cyclegen @ #x~X>~%" (-> obj clock))
  obj
  )

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

;; failed to figure out what this is:
(defskelgroup *hutlamp-sg* hutlamp hutlamp-lod0-jg hutlamp-idle-ja
              ((hutlamp-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 1 0 1.2)
              :longest-edge (meters 0.7)
              )

;; failed to figure out what this is:
(defstate hutlamp-idle (hutlamp)
  :code (behavior ()
    (loop
      (let ((f0-3 (* 1820.4445 (sin (* 65536.0 (update-clock (-> self clock)))))))
        (quaternion-vector-angle! (-> self pivot transform quat) *x-vector* f0-3)
        )
      (suspend)
      )
    (none)
    )
  :post (the-as (function none :behavior hutlamp) ja-post)
  )

;; definition for method 11 of type hutlamp
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! hutlamp ((obj hutlamp) (arg0 entity-actor))
  (set! (-> obj root) (new 'process 'trsqv))
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *hutlamp-sg* '())
  (set! (-> obj pivot) (new 'process 'joint-mod-set-local obj 3 #f #t #f))
  (set-period (-> obj clock) 900)
  (set! (-> obj clock output) (rand-vu))
  (go hutlamp-idle)
  (none)
  )

;; definition of type revcycleprop
(deftype revcycleprop (process-drawable)
  ()
  :heap-base #x40
  :method-count-assert 21
  :size-assert         #xb0
  :flag-assert         #x15004000b0
  (:methods
    (idle () _type_ :state 20)
    )
  )

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

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

;; failed to figure out what this is:
(defstate idle (revcycleprop)
  :virtual #t
  :code (the-as (function none :behavior revcycleprop) anim-loop)
  :post (the-as (function none :behavior revcycleprop) ja-post)
  )

;; definition for method 11 of type revcycleprop
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! revcycleprop ((obj revcycleprop) (arg0 entity-actor))
  (set! (-> obj root) (new 'process 'trsqv))
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *revcycleprop-sg* '())
  (set! (-> obj draw light-index) (the-as uint 1))
  (go (method-of-object obj idle))
  (none)
  )

;; definition of type revcycle
(deftype revcycle (process-drawable)
  ()
  :heap-base #x40
  :method-count-assert 21
  :size-assert         #xb0
  :flag-assert         #x15004000b0
  (:methods
    (idle () _type_ :state 20)
    )
  )

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

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

;; failed to figure out what this is:
(defstate idle (revcycle)
  :virtual #t
  :code (the-as (function none :behavior revcycle) anim-loop)
  :post (the-as (function none :behavior revcycle) ja-post)
  )

;; definition for method 11 of type revcycle
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! revcycle ((obj revcycle) (arg0 entity-actor))
  (set! (-> obj root) (new 'process 'trsqv))
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *revcycle-sg* '())
  (set! (-> obj draw light-index) (the-as uint 1))
  (go (method-of-object obj idle))
  (none)
  )

;; definition of type villagea-water
(deftype villagea-water (water-anim)
  ()
  :heap-base #x70
  :method-count-assert 30
  :size-assert         #xdc
  :flag-assert         #x1e007000dc
  )

;; definition for method 3 of type villagea-water
(defmethod inspect villagea-water ((obj villagea-water))
  (let ((t9-0 (method-of-type water-anim inspect)))
    (t9-0 obj)
    )
  obj
  )

;; definition for symbol ripple-for-villagea-water, type ripple-wave-set
(define ripple-for-villagea-water (new 'static 'ripple-wave-set
                                    :count 3
                                    :converted #f
                                    :normal-scale 4.0
                                    :wave (new 'static 'inline-array ripple-wave 4
                                      (new 'static 'ripple-wave :scale 10.0 :xdiv 1 :speed 1.5)
                                      (new 'static 'ripple-wave :scale 10.0 :xdiv -1 :zdiv 1 :speed 1.5)
                                      (new 'static 'ripple-wave :scale 5.0 :xdiv 5 :zdiv 3 :speed 0.75)
                                      (new 'static 'ripple-wave)
                                      )
                                    )
        )

;; definition for method 22 of type villagea-water
;; INFO: Return type mismatch ripple-wave-set vs none.
(defmethod TODO-RENAME-22 villagea-water ((obj villagea-water))
  (let ((t9-0 (method-of-type water-anim TODO-RENAME-22)))
    (t9-0 obj)
    )
  (let ((v1-2 (new 'process 'ripple-control)))
    (set! (-> obj draw ripple) v1-2)
    (set-vector! (-> obj draw color-mult) 0.01 0.45 0.5 0.75)
    (set! (-> v1-2 global-scale) 3072.0)
    (set! (-> v1-2 close-fade-dist) 163840.0)
    (set! (-> v1-2 far-fade-dist) 245760.0)
    (set! (-> v1-2 waveform) ripple-for-villagea-water)
    )
  (none)
  )
