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

(import "goal_src/jak1/import/dark-crystal-ag.gc")

;; definition of type dark-crystal
(deftype dark-crystal (process-drawable)
  ((root-override         collide-shape         :offset        112)
   (crystal-num           int32                 :offset-assert 176)
   (underwater?           symbol                :offset-assert 180)
   (explode-danger-radius float                 :offset-assert 184)
   (lit-color-mult        vector        :inline :offset-assert 192)
   (lit-color-emissive    vector        :inline :offset-assert 208)
   (unlit-color-mult      vector        :inline :offset-assert 224)
   (unlit-color-emissive  vector        :inline :offset-assert 240)
   )
  :heap-base #x90
  :method-count-assert 22
  :size-assert         #x100
  :flag-assert         #x1600900100
  (:methods
    (dummy-20 (_type_) none 20)
    (dummy-21 (_type_) symbol 21)
    )
  (:states
    dark-crystal-activate
    dark-crystal-explode
    dark-crystal-idle
    dark-crystal-spawn-fuel-cell
    )
  )

;; definition for method 3 of type dark-crystal
(defmethod inspect dark-crystal ((obj dark-crystal))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tcrystal-num: ~D~%" (-> obj crystal-num))
  (format #t "~T~Tunderwater?: ~A~%" (-> obj underwater?))
  (format #t "~T~Texplode-danger-radius: ~f~%" (-> obj explode-danger-radius))
  (format #t "~T~Tlit-color-mult: #<vector @ #x~X>~%" (-> obj lit-color-mult))
  (format #t "~T~Tlit-color-emissive: #<vector @ #x~X>~%" (-> obj lit-color-emissive))
  (format #t "~T~Tunlit-color-mult: #<vector @ #x~X>~%" (-> obj unlit-color-mult))
  (format #t "~T~Tunlit-color-emissive: #<vector @ #x~X>~%" (-> obj unlit-color-emissive))
  obj
  )

;; failed to figure out what this is:
(defskelgroup *dark-crystal-sg* dark-crystal dark-crystal-lod0-jg -1
              ((dark-crystal-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 3.4 0 3.8)
              )

;; failed to figure out what this is:
(defskelgroup *dark-crystal-explode-sg* dark-crystal dark-crystal-explode-lod0-jg -1
              ((dark-crystal-explode-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 -15 0 50)
              )

;; definition for symbol *dark-crystal-flash-delays*, type (array int32)
(define *dark-crystal-flash-delays*
  (the-as (array int32) (new 'static 'boxed-array :type int32 #xb4 #x96 #x78 90 60 30 15 7 3))
  )

;; definition for symbol *dark-crystal-exploder-params*, type joint-exploder-static-params
(define *dark-crystal-exploder-params*
  (new 'static 'joint-exploder-static-params
    :joints (new 'static 'boxed-array :type joint-exploder-static-joint-params
      (new 'static 'joint-exploder-static-joint-params :joint-index 3 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 4 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 5 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 6 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 7 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 8 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 9 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 10 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 11 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 12 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 13 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 14 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 15 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 16 :parent-joint-index -1)
      (new 'static 'joint-exploder-static-joint-params :joint-index 17 :parent-joint-index -1)
      )
    )
  )

;; failed to figure out what this is:
(defpartgroup group-dark-crystal-gnd-explode
  :id 322
  :duration 75
  :flags (use-local-clock)
  :bounds (static-bspherem 0 0 0 16)
  :parts ((sp-item 2153 :fade-after (meters 100) :period 600 :length 5 :binding 296)
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 296 :flags (start-dead launch-asap) :binding 297)
    (sp-item 297 :fade-after (meters 80) :falloff-to (meters 100) :flags (start-dead))
    (sp-item 2154 :period 600 :length 5)
    (sp-item 2155 :period 600 :length 40)
    (sp-item 2156 :period 600 :length 20)
    (sp-item 2157 :period 600 :length 20)
    )
  )

;; failed to figure out what this is:
(defpart 2153
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 32.0)
    (sp-rnd-flt spt-x (meters -2) (meters 4) 1.0)
    (sp-rnd-flt spt-y (meters 1) (meters 2) 1.0)
    (sp-rnd-flt spt-z (meters -2) (meters 4) 1.0)
    (sp-flt spt-scale-x (meters 0.1))
    (sp-copy-from-other spt-scale-y -4)
    (sp-flt spt-a 0.0)
    (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.026666667) 1.0)
    (sp-flt spt-accel-y -1.3653333)
    (sp-flt spt-friction 0.94)
    (sp-int spt-timer 240)
    (sp-cpuinfo-flags bit3)
    (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 140.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 2155
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2))
    (sp-flt spt-num 24.0)
    (sp-rnd-flt spt-y (meters 1) (meters 3) 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.4) (meters 0.8) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 128.0 128.0 1.0)
    (sp-rnd-flt spt-g 0.0 32.0 1.0)
    (sp-rnd-flt spt-b 128.0 64.0 1.0)
    (sp-rnd-flt spt-a 32.0 96.0 1.0)
    (sp-rnd-flt spt-vel-y (meters 0.04) (meters 0.16) 1.0)
    (sp-flt spt-scalevel-x (meters -0.0026666666))
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0)
    (sp-flt spt-friction 0.9)
    (sp-int spt-timer 300)
    (sp-cpuinfo-flags bit2 bit14)
    (sp-int-plain-rnd spt-next-time 30 89 1)
    (sp-launcher-by-id spt-next-launcher 2158)
    (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 120.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    (sp-rnd-flt spt-conerot-radius (meters 2) (meters 4) 1.0)
    )
  )

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

;; failed to figure out what this is:
(defpart 2157
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2))
    (sp-flt spt-num 12.0)
    (sp-rnd-flt spt-y (meters 1) (meters 3) 1.0)
    (sp-flt spt-scale-x (meters 0.3))
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 180.0) 1.0)
    (sp-flt spt-scale-y (meters 12))
    (sp-rnd-flt spt-r 64.0 192.0 1.0)
    (sp-rnd-flt spt-g 0.0 32.0 1.0)
    (sp-rnd-flt spt-b 128.0 64.0 1.0)
    (sp-rnd-flt spt-a 32.0 64.0 1.0)
    (sp-flt spt-scalevel-y (meters 1.04))
    (sp-flt spt-fade-a -1.6)
    (sp-int spt-timer 60)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    )
  )

;; failed to figure out what this is:
(defpart 2154
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 1.0)
    (sp-flt spt-y (meters 2))
    (sp-flt spt-scale-x (meters 24))
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 192.0 64.0 1.0)
    (sp-rnd-flt spt-g 0.0 32.0 1.0)
    (sp-rnd-flt spt-b 128.0 64.0 1.0)
    (sp-flt spt-a 128.0)
    (sp-flt spt-fade-a -2.3272727)
    (sp-int spt-timer 54)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    )
  )

;; failed to figure out what this is:
(defpart 2156
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2))
    (sp-flt spt-num 16.0)
    (sp-rnd-flt spt-y (meters 1) (meters 3) 1.0)
    (sp-rnd-flt spt-scale-x (meters 3) (meters 1.5) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 0.0 96.0 1.0)
    (sp-rnd-flt spt-g 0.0 32.0 1.0)
    (sp-rnd-flt spt-b 64.0 32.0 1.0)
    (sp-rnd-flt spt-a 64.0 64.0 1.0)
    (sp-rnd-flt spt-vel-y (meters 0.08) (meters 0.04) 1.0)
    (sp-flt spt-scalevel-x (meters 0.02))
    (sp-rnd-flt spt-rotvel-z (degrees -0.6) (degrees 1.2) 1.0)
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-a -0.28444445)
    (sp-rnd-flt spt-accel-y 0.68266666 0.68266666 1.0)
    (sp-flt spt-friction 0.8)
    (sp-int spt-timer 510)
    (sp-cpuinfo-flags bit2 bit14)
    (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 120.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    (sp-rnd-flt spt-conerot-radius (meters 0) (meters 4) 1.0)
    )
  )

;; failed to figure out what this is:
(defpartgroup group-dark-crystal-water-explode
  :id 323
  :duration 75
  :linger-duration 12000
  :flags (use-local-clock)
  :bounds (static-bspherem 0 0 0 16)
  :parts ((sp-item 2159 :period 600 :length 5)
    (sp-item 2160 :period 600 :length 40)
    (sp-item 2161 :period 600 :length 20)
    (sp-item 2162 :period 600 :length 20)
    (sp-item 2163 :period 600 :length 75)
    (sp-item 2164 :period 600 :length 75)
    )
  )

;; failed to figure out what this is:
(defpart 2160
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2))
    (sp-flt spt-num 24.0)
    (sp-rnd-flt spt-y (meters 1) (meters 3) 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.4) (meters 0.8) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 128.0 128.0 1.0)
    (sp-rnd-flt spt-g 128.0 32.0 1.0)
    (sp-rnd-flt spt-b 128.0 64.0 1.0)
    (sp-rnd-flt spt-a 32.0 96.0 1.0)
    (sp-rnd-flt spt-vel-y (meters 0.04) (meters 0.16) 1.0)
    (sp-flt spt-scalevel-x (meters -0.0026666666))
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-g -0.4)
    (sp-rnd-flt spt-accel-y -0.68266666 -0.68266666 1.0)
    (sp-flt spt-friction 0.9)
    (sp-int spt-timer 300)
    (sp-cpuinfo-flags bit2 bit14)
    (sp-int-plain-rnd spt-next-time 30 89 1)
    (sp-launcher-by-id spt-next-launcher 2158)
    (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 120.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    (sp-rnd-flt spt-conerot-radius (meters 2) (meters 4) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 2162
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2))
    (sp-flt spt-num 12.0)
    (sp-rnd-flt spt-y (meters 1) (meters 3) 1.0)
    (sp-flt spt-scale-x (meters 0.3))
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 180.0) 1.0)
    (sp-flt spt-scale-y (meters 12))
    (sp-rnd-flt spt-r 128.0 128.0 1.0)
    (sp-rnd-flt spt-g 128.0 32.0 1.0)
    (sp-rnd-flt spt-b 128.0 64.0 1.0)
    (sp-rnd-flt spt-a 32.0 64.0 1.0)
    (sp-flt spt-scalevel-y (meters 1.04))
    (sp-flt spt-fade-r -1.0666667)
    (sp-flt spt-fade-g -2.1333334)
    (sp-flt spt-fade-a -1.6)
    (sp-int spt-timer 60)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    )
  )

;; failed to figure out what this is:
(defpart 2159
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x12 :page #x2))
    (sp-flt spt-num 1.0)
    (sp-flt spt-y (meters 2))
    (sp-flt spt-scale-x (meters 24))
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 192.0 64.0 1.0)
    (sp-rnd-flt spt-g 128.0 32.0 1.0)
    (sp-rnd-flt spt-b 128.0 64.0 1.0)
    (sp-flt spt-a 128.0)
    (sp-flt spt-fade-g -2.0)
    (sp-flt spt-fade-a -2.3272727)
    (sp-int spt-timer 54)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    )
  )

;; failed to figure out what this is:
(defpart 2161
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2))
    (sp-flt spt-num 16.0)
    (sp-rnd-flt spt-y (meters 1) (meters 3) 1.0)
    (sp-rnd-flt spt-scale-x (meters 3) (meters 1.5) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-rnd-flt spt-r 128.0 96.0 1.0)
    (sp-rnd-flt spt-g 128.0 32.0 1.0)
    (sp-rnd-flt spt-b 128.0 32.0 1.0)
    (sp-rnd-flt spt-a 64.0 64.0 1.0)
    (sp-rnd-flt spt-vel-y (meters 0.08) (meters 0.04) 1.0)
    (sp-flt spt-scalevel-x (meters 0.02))
    (sp-rnd-flt spt-rotvel-z (degrees -0.6) (degrees 1.2) 1.0)
    (sp-copy-from-other spt-scalevel-y -4)
    (sp-flt spt-fade-r -0.2)
    (sp-flt spt-fade-g -0.2)
    (sp-flt spt-fade-b 0.0)
    (sp-flt spt-fade-a -0.28444445)
    (sp-rnd-flt spt-accel-y 0.68266666 0.68266666 1.0)
    (sp-flt spt-friction 0.8)
    (sp-int spt-timer 510)
    (sp-cpuinfo-flags bit2 bit14)
    (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 120.0) 1.0)
    (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
    (sp-rnd-flt spt-conerot-radius (meters 0) (meters 4) 1.0)
    )
  )

;; failed to figure out what this is:
(defpart 2163
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2))
    (sp-flt spt-num 32.0)
    (sp-rnd-flt spt-x (meters -4) (meters 8) 1.0)
    (sp-rnd-flt spt-y (meters 1) (meters 6) 1.0)
    (sp-rnd-flt spt-z (meters -4) (meters 8) 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.15) (meters 0.05) 1.0)
    (sp-rnd-flt spt-scale-y (meters 0.125) (meters 0.025) 1.0)
    (sp-flt spt-r 255.0)
    (sp-flt spt-g 255.0)
    (sp-flt spt-b 255.0)
    (sp-flt spt-a 0.0)
    (sp-rnd-flt spt-vel-y (meters 0.013333334) (meters 0.006666667) 1.0)
    (sp-flt spt-fade-a 0.8)
    (sp-int spt-timer 12000)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    (sp-flt spt-userdata 143360.0)
    (sp-func spt-func 'check-water-level-above-and-die)
    (sp-int-plain-rnd spt-next-time 30 29 1)
    (sp-launcher-by-id spt-next-launcher 2165)
    (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

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

;; failed to figure out what this is:
(defpart 2164
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2))
    (sp-flt spt-num 4.0)
    (sp-rnd-flt spt-x (meters -4) (meters 8) 1.0)
    (sp-rnd-flt spt-y (meters 1) (meters 6) 1.0)
    (sp-rnd-flt spt-z (meters -4) (meters 8) 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.15) 1.0)
    (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.1) 1.0)
    (sp-flt spt-r 255.0)
    (sp-flt spt-g 255.0)
    (sp-flt spt-b 255.0)
    (sp-flt spt-a 0.0)
    (sp-rnd-flt spt-vel-y (meters 0.013333334) (meters 0.006666667) 1.0)
    (sp-flt spt-fade-a 0.8)
    (sp-int spt-timer 12000)
    (sp-cpuinfo-flags bit2 bit3 bit14)
    (sp-flt spt-userdata 143360.0)
    (sp-func spt-func 'check-water-level-above-and-die)
    (sp-int-plain-rnd spt-next-time 30 29 1)
    (sp-launcher-by-id spt-next-launcher 2165)
    (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0)
    )
  )

;; failed to figure out what this is:
(defstate dark-crystal-idle (dark-crystal)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (case arg2
      (('touch 'attack)
       (if (= (-> arg0 type) target)
           (level-hint-spawn
             (game-text-id cave-dark-crystals-flee)
             "sksp0334"
             (the-as entity #f)
             *entity-pool*
             (game-task none)
             )
           )
       (close-specific-task! (game-task cave-dark-crystals) (task-status need-hint))
       (go dark-crystal-activate)
       )
      )
    )
  :code (behavior ()
    (loop
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate dark-crystal-activate (dark-crystal)
  :code (behavior ()
    (logclear! (-> self mask) (process-mask actor-pause))
    (dotimes (gp-0 (-> *dark-crystal-flash-delays* length))
      (sound-play "warning")
      (set! (-> self draw color-mult quad) (-> self lit-color-mult quad))
      (set! (-> self draw color-emissive quad) (-> self lit-color-emissive quad))
      (set! (-> self state-time) (-> *display* base-frame-counter))
      (until (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.1))
        (suspend)
        )
      (set! (-> self draw color-mult quad) (-> self unlit-color-mult quad))
      (set! (-> self draw color-emissive quad) (-> self unlit-color-emissive quad))
      (set! (-> self state-time) (-> *display* base-frame-counter))
      (let ((s5-1 (-> *dark-crystal-flash-delays* gp-0)))
        (until (>= (- (-> *display* base-frame-counter) (-> self state-time)) s5-1)
          (suspend)
          )
        )
      )
    (go dark-crystal-explode)
    (none)
    )
  )

;; failed to figure out what this is:
(defstate dark-crystal-explode (dark-crystal)
  :code (behavior ()
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (logclear! (-> self mask) (process-mask actor-pause))
    (clear-collide-with-as (-> self root-override))
    (let ((gp-0 (new 'stack 'joint-exploder-tuning 0)))
      (when (-> self underwater?)
        (set! (-> gp-0 duration) (seconds 4))
        (set! (-> gp-0 gravity) -20480.0)
        (set! (-> gp-0 rot-speed) 4.2)
        (set-vector! (-> gp-0 fountain-rand-transv-lo) -40960.0 20480.0 -40960.0 1.0)
        (set-vector! (-> gp-0 fountain-rand-transv-hi) 40960.0 49152.0 40960.0 1.0)
        )
      (process-spawn joint-exploder *dark-crystal-explode-sg* 5 gp-0 *dark-crystal-exploder-params* :to self)
      )
    (activate! *camera-smush-control* 819.2 37 210 1.0 0.995)
    (let ((gp-1 (dummy-21 self)))
      (suspend)
      (ja-channel-set! 0)
      (ja-post)
      (logior! (-> self draw status) (draw-status hidden))
      (dummy-20 self)
      (if (-> self underwater?)
          (sound-play "water-explosion")
          (sound-play "crystal-explode")
          )
      (process-spawn
        part-tracker
        :init part-tracker-init
        (if (-> self underwater?)
            (-> *part-group-id-table* 323)
            (-> *part-group-id-table* 322)
            )
        -1
        #f
        #f
        #f
        (-> self root-override trans)
        :to *entity-pool*
        )
      (let ((s5-4 (-> *display* base-frame-counter)))
        (until (>= (- (-> *display* base-frame-counter) s5-4) (seconds 0.25))
          (suspend)
          )
        )
      (if gp-1
          (go dark-crystal-spawn-fuel-cell)
          )
      )
    (cleanup-for-death self)
    (until (not (-> self child))
      (suspend)
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate dark-crystal-spawn-fuel-cell (dark-crystal)
  :event (the-as
    (function process int symbol event-message-block object :behavior dark-crystal)
    process-drawable-fuel-cell-handler
    )
  :code (behavior ()
    (logclear! (-> self mask) (process-mask actor-pause))
    (clear-collide-with-as (-> self root-override))
    (level-hint-spawn
      (game-text-id cave-dark-crystals-resolution)
      "sksp0327"
      (the-as entity #f)
      *entity-pool*
      (game-task none)
      )
    (ja-channel-set! 0)
    (ja-post)
    (logior! (-> self draw status) (draw-status hidden))
    (if (not (task-complete? *game-info* (-> self entity extra perm task)))
        (birth-pickup-at-point
          (-> self root-override trans)
          (pickup-type fuel-cell)
          (the float (-> self entity extra perm task))
          #t
          self
          (the-as fact-info #f)
          )
        )
    (suspend)
    (until (not (-> self child))
      (suspend)
      )
    (aybabtu 2)
    (cleanup-for-death self)
    (none)
    )
  )

;; definition for method 20 of type dark-crystal
;; INFO: Used lq/sq
;; INFO: Return type mismatch object vs none.
(defmethod dummy-20 dark-crystal ((obj dark-crystal))
  (when *target*
    (let ((s5-0 (new 'stack-no-clear 'vector))
          (s3-0 (new 'stack-no-clear 'vector))
          (s4-0 (new 'stack-no-clear 'vector))
          )
      (set! (-> s5-0 quad) (-> obj root-override trans quad))
      (set! (-> s5-0 y) (+ 6144.0 (-> s5-0 y)))
      (set! (-> s3-0 quad) (-> (target-pos 0) quad))
      (set! (-> s3-0 y) (+ 6144.0 (-> s3-0 y)))
      (when (>= (-> obj explode-danger-radius) (vector-vector-distance s5-0 s3-0))
        (vector-! s4-0 s3-0 s5-0)
        (let ((t2-0 (new 'stack-no-clear 'collide-tri-result)))
          (if (< (fill-and-probe-using-line-sphere
                   *collide-cache*
                   s5-0
                   s4-0
                   819.2
                   (collide-kind background)
                   obj
                   t2-0
                   (new 'static 'pat-surface :noentity #x1)
                   )
                 0.0
                 )
              (send-event *target* 'attack #f (new 'static 'attack-info))
              )
          )
        )
      )
    )
  (none)
  )

;; definition for method 21 of type dark-crystal
(defmethod dummy-21 dark-crystal ((obj dark-crystal))
  (let ((s5-0 #f))
    (when (nonzero? (-> obj crystal-num))
      (let* ((s4-0 (get-task-control (game-task cave-dark-crystals)))
             (s3-0 (logior (get-reminder s4-0 3) (ash 1 (-> obj crystal-num))))
             )
        (save-reminder s4-0 s3-0 3)
        (when (= s3-0 62)
          (set! s5-0 #t)
          (process-entity-status! obj (entity-perm-status complete) #t)
          )
        )
      )
    s5-0
    )
  )

;; definition for method 11 of type dark-crystal
;; INFO: Used lq/sq
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! dark-crystal ((obj dark-crystal) (arg0 entity-actor))
  (set-vector! (-> obj unlit-color-mult) 0.5 0.5 0.5 1.0)
  (set-vector! (-> obj unlit-color-emissive) 0.0 0.0 0.0 0.0)
  (set-vector! (-> obj lit-color-mult) 1.0 1.0 1.0 1.0)
  (set-vector! (-> obj lit-color-emissive) 1.0 1.0 1.0 0.0)
  (set! (-> obj mask) (logior (process-mask enemy) (-> obj mask)))
  (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player))))
    (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> s3-0 prim-core collide-as) (collide-kind wall-object))
      (set! (-> s3-0 collide-with) (collide-kind target))
      (set! (-> s3-0 prim-core action) (collide-action solid))
      (set! (-> s3-0 prim-core offense) (collide-offense indestructible))
      (set! (-> s3-0 transform-index) 0)
      (set-vector! (-> s3-0 local-sphere) 0.0 6963.2 0.0 15564.8)
      (set-root-prim! s4-0 s3-0)
      )
    (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *dark-crystal-sg* '())
  (set! (-> obj mask) (logior (process-mask attackable) (-> obj mask)))
  (set! (-> obj draw color-mult quad) (-> obj unlit-color-mult quad))
  (set! (-> obj draw color-emissive quad) (-> obj unlit-color-emissive quad))
  (set! (-> obj underwater?) (= (res-lump-value arg0 'mode uint128) 1))
  (set! (-> obj explode-danger-radius) (res-lump-float arg0 'extra-radius :default 28672.0))
  (set! (-> obj crystal-num) (res-lump-value arg0 'extra-id int))
  (set-vector! (-> obj root-override scale) 2.0 2.0 2.0 1.0)
  (ja-channel-push! 1 0)
  (let ((s5-1 (-> obj skel root-channel 0)))
    (joint-control-channel-group-eval!
      s5-1
      (the-as art-joint-anim (-> obj draw art-group data 2))
      num-func-identity
      )
    (set! (-> s5-1 frame-num) 0.0)
    )
  (ja-post)
  (update-transforms! (-> obj root-override))
  (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status complete)))
      (go dark-crystal-spawn-fuel-cell)
      (go dark-crystal-idle)
      )
  (none)
  )
