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

(import "goal_src/jak1/import/snowcam-ag.gc")
(import "goal_src/jak1/import/snow-fort-gate-ag.gc")
(import "goal_src/jak1/import/snow-eggtop-ag.gc")
(import "goal_src/jak1/import/snow-spatula-ag.gc")
(import "goal_src/jak1/import/snow-switch-ag.gc")
(import "goal_src/jak1/import/snow-gears-ag.gc")
(import "goal_src/jak1/import/snowpusher-ag.gc")
(import "goal_src/jak1/import/snow-log-ag.gc")

;; definition of type snowcam
(deftype snowcam (pov-camera)
  ((seq uint64  :offset-assert 224)
   )
  :heap-base #x80
  :method-count-assert 30
  :size-assert         #xe8
  :flag-assert         #x1e008000e8
  )

;; definition for method 3 of type snowcam
(defmethod inspect snowcam ((obj snowcam))
  (let ((t9-0 (method-of-type pov-camera inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tseq: ~D~%" (-> obj seq))
  obj
  )

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

;; definition for method 29 of type snowcam
(defmethod set-stack-size! snowcam ((obj snowcam))
  (stack-size-set! (-> obj main-thread) 512)
  (none)
  )

;; failed to figure out what this is:
(defstate pov-camera-playing (snowcam)
  :virtual #t
  :code (behavior ()
    (let ((v1-0 (-> self seq)))
      (cond
        ((zero? v1-0)
         (ja-no-eval :group! (-> self draw art-group data 2) :num! (seek! max 0.2) :frame-num 0.0)
         (until (ja-done? 0)
           (suspend)
           (ja :num! (seek! max 0.2))
           )
         (ja-no-eval :group! (-> self draw art-group data 3) :num! (seek! max 0.25) :frame-num 0.0)
         (until (ja-done? 0)
           (suspend)
           (ja :num! (seek! max 0.25))
           )
         (ja-no-eval :group! (-> self draw art-group data 4) :num! (seek!) :frame-num 0.0)
         (until (ja-done? 0)
           (suspend)
           (ja :num! (seek!))
           )
         (let ((gp-0 (-> *display* base-frame-counter)))
           (until (>= (- (-> *display* base-frame-counter) gp-0) (seconds 4.5))
             (suspend)
             )
           )
         )
        ((= v1-0 1)
         (let ((gp-2
                 (ppointer->handle
                   (process-spawn
                     fuel-cell
                     :init fuel-cell-init-as-clone
                     (process->handle self)
                     (-> self entity extra perm task)
                     :to (ppointer->process (-> self parent))
                     )
                   )
                 )
               )
           (add-setting! 'music-volume 'abs 0.0 0)
           (add-setting! 'sfx-volume 'rel 50.0 0)
           (ja-play-spooled-anim
             (the-as spool-anim (-> self anim-name))
             (the-as art-joint-anim #f)
             (the-as art-joint-anim #f)
             (the-as (function process-drawable symbol) false-func)
             )
           (remove-setting! 'music-volume)
           (remove-setting! 'sfx-volume)
           (let ((a0-21 (handle->process gp-2)))
             (if a0-21
                 (send-event a0-21 'stop-cloning)
                 )
             )
           )
         )
        ((= v1-0 2)
         (ja-no-eval :group! (-> self draw art-group data 5) :num! (seek!) :frame-num 0.0)
         (until (ja-done? 0)
           (suspend)
           (ja :num! (seek!))
           )
         (send-event (handle->process (-> self notify-handle)) 'notify 'cut)
         (ja-no-eval :group! (-> self draw art-group data 6) :num! (seek!) :frame-num 0.0)
         (until (ja-done? 0)
           (suspend)
           (ja :num! (seek!))
           )
         )
        (else
          (suspend)
          0
          )
        )
      )
    (go-virtual pov-camera-done-playing)
    (none)
    )
  )

;; definition of type snow-eggtop
(deftype snow-eggtop (process-drawable)
  ((root-override collide-shape-moving         :offset        112)
   (spawn-trans   vector               :inline :offset-assert 176)
   (play-sound?   symbol                       :offset-assert 192)
   )
  :heap-base #x60
  :method-count-assert 20
  :size-assert         #xc4
  :flag-assert         #x14006000c4
  (:states
    snow-eggtop-activate
    snow-eggtop-idle-down
    snow-eggtop-idle-up
    )
  )

;; definition for method 3 of type snow-eggtop
(defmethod inspect snow-eggtop ((obj snow-eggtop))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tspawn-trans: #<vector @ #x~X>~%" (-> obj spawn-trans))
  (format #t "~T~Tplay-sound?: ~A~%" (-> obj play-sound?))
  obj
  )

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

;; failed to figure out what this is:
(defpartgroup group-snow-yellow-eco-room-open
  :id 510
  :bounds (static-bspherem 0 -6 0 8)
  :parts ((sp-item 1990 :fade-after (meters 110))
    (sp-item 1991 :fade-after (meters 110))
    (sp-item 1992 :fade-after (meters 110))
    (sp-item 1993 :fade-after (meters 110))
    (sp-item 1994 :fade-after (meters 110))
    )
  )

;; failed to figure out what this is:
(defpartgroup group-snow-yellow-eco-room-activate
  :id 511
  :duration 900
  :bounds (static-bspherem 0 -6 0 8)
  :parts ((sp-item 1994) (sp-item 1994) (sp-item 1995 :flags (bit1) :period 1200 :length 15))
  )

;; failed to figure out what this is:
(defpart 1995
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2 :page #x2))
    (sp-flt spt-num 30.0)
    (sp-flt spt-y (meters -4))
    (sp-rnd-flt spt-scale-x (meters 20) (meters 10) 1.0)
    (sp-int spt-rot-x 4)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-rnd-flt spt-scale-y (meters 5) (meters 2) 1.0)
    (sp-flt spt-r 127.0)
    (sp-flt spt-g 127.0)
    (sp-rnd-flt spt-b 0.0 16.0 1.0)
    (sp-flt spt-a 0.0)
    (sp-rnd-flt spt-rotvel-z (degrees -0.05) (degrees 0.1) 1.0)
    (sp-flt spt-fade-a 0.85333335)
    (sp-int spt-timer 600)
    (sp-cpuinfo-flags bit2 bit3 left-multiply-quat)
    (sp-int spt-next-time 75)
    (sp-launcher-by-id spt-next-launcher 1996)
    )
  )

;; failed to figure out what this is:
(defpart 1996
  :init-specs ((sp-flt spt-fade-a 0.0) (sp-int spt-next-time 225) (sp-launcher-by-id spt-next-launcher 1997))
  )

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

;; failed to figure out what this is:
(defpart 1990
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2))
    (sp-flt spt-num 1.0)
    (sp-flt spt-y (meters -4))
    (sp-rnd-flt spt-scale-x (meters 10) (meters 2) 1.0)
    (sp-rnd-flt spt-scale-y (meters 8) (meters 2) 1.0)
    (sp-flt spt-r 255.0)
    (sp-flt spt-g 255.0)
    (sp-rnd-flt spt-b 0.0 64.0 1.0)
    (sp-rnd-flt spt-a 128.0 128.0 1.0)
    (sp-int spt-timer 5)
    (sp-cpuinfo-flags bit2 bit3)
    )
  )

;; failed to figure out what this is:
(defpart 1991
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2))
    (sp-flt spt-num 1.0)
    (sp-flt spt-y (meters -4))
    (sp-rnd-flt spt-scale-x (meters 3) (meters 2) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-flt spt-r 128.0)
    (sp-flt spt-g 128.0)
    (sp-flt spt-b 128.0)
    (sp-rnd-flt spt-a 128.0 128.0 1.0)
    (sp-int spt-timer 5)
    (sp-cpuinfo-flags bit2 bit3)
    )
  )

;; failed to figure out what this is:
(defpart 1992
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x1f :page #x2))
    (sp-rnd-flt spt-num 0.5 1.0 1.0)
    (sp-flt spt-y (meters -4))
    (sp-rnd-flt spt-scale-x (meters 3) (meters 3) 1.0)
    (sp-int spt-rot-x 4)
    (sp-rnd-flt spt-rot-z (degrees -30.0) (degrees 60.0) 1.0)
    (sp-rnd-flt spt-scale-y (meters 0.7) (meters 0.4) 1.0)
    (sp-flt spt-r 128.0)
    (sp-flt spt-g 128.0)
    (sp-flt spt-b 64.0)
    (sp-flt spt-a 128.0)
    (sp-flt spt-fade-a -1.6)
    (sp-int spt-timer 90)
    (sp-cpuinfo-flags bit2 bit3)
    (sp-int spt-next-time 10)
    (sp-launcher-by-id spt-next-launcher 1998)
    )
  )

;; failed to figure out what this is:
(defpart 1998
  :init-specs ((sp-flt spt-r 64.0)
    (sp-flt spt-g 64.0)
    (sp-flt spt-fade-r -1.0)
    (sp-flt spt-fade-g -1.0)
    (sp-flt spt-fade-a -2.0)
    )
  )

;; failed to figure out what this is:
(defpart 1993
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x1f :page #x2))
    (sp-rnd-flt spt-num 0.5 1.0 1.0)
    (sp-flt spt-y (meters -4))
    (sp-rnd-flt spt-scale-x (meters 3) (meters 3) 1.0)
    (sp-int spt-rot-x 4)
    (sp-rnd-flt spt-rot-z (degrees 150.0) (degrees 60.0) 1.0)
    (sp-rnd-flt spt-scale-y (meters 0.7) (meters 0.4) 1.0)
    (sp-flt spt-r 128.0)
    (sp-flt spt-g 128.0)
    (sp-flt spt-b 64.0)
    (sp-flt spt-a 128.0)
    (sp-flt spt-fade-a -1.6)
    (sp-int spt-timer 90)
    (sp-cpuinfo-flags bit2 bit3)
    (sp-int spt-next-time 10)
    (sp-launcher-by-id spt-next-launcher 1998)
    )
  )

;; failed to figure out what this is:
(defpart 1994
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x1f :page #x2))
    (sp-rnd-flt spt-num 1.0 1.0 1.0)
    (sp-rnd-flt spt-y (meters -6.5) (meters 1) 1.0)
    (sp-rnd-flt spt-scale-x (meters 6) (meters 2) 1.0)
    (sp-int spt-rot-x 4)
    (sp-rnd-flt spt-rot-z (degrees -140.0) (degrees 100.00001) 1.0)
    (sp-rnd-flt spt-scale-y (meters 0.7) (meters 0.4) 1.0)
    (sp-flt spt-r 128.0)
    (sp-flt spt-g 128.0)
    (sp-flt spt-b 64.0)
    (sp-flt spt-a 128.0)
    (sp-flt spt-fade-a -1.6)
    (sp-int spt-timer 90)
    (sp-cpuinfo-flags bit2 bit3)
    (sp-int spt-next-time 10)
    (sp-launcher-by-id spt-next-launcher 1998)
    (sp-flt spt-conerot-x (degrees 90.0))
    (sp-rnd-flt spt-conerot-y (degrees 80.0) (degrees 200.00002) 1.0)
    (sp-flt spt-conerot-radius (meters 4))
    )
  )

;; failed to figure out what this is:
(defstate snow-eggtop-idle-up (snow-eggtop)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (let ((v1-0 arg2))
      (the-as object (when (= v1-0 'notify)
                       (case (-> arg3 param 0)
                         (('pickup)
                          (if (type-type? (-> arg0 type) fuel-cell)
                              (save-reminder (get-task-control (-> self entity extra perm task)) 1 4)
                              )
                          )
                         )
                       )
              )
      )
    )
  :trans (behavior ()
    (if (and (not (-> self child)) (task-complete? *game-info* (-> self entity extra perm task)))
        (go snow-eggtop-activate)
        )
    (spawn (-> self part) (-> self root-override trans))
    (update! (-> self sound))
    (none)
    )
  :code (behavior ()
    (ja-channel-push! 1 0)
    (ja :group! (-> self draw art-group data 2) :num! min)
    (transform-post)
    (loop
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate snow-eggtop-activate (snow-eggtop)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (case arg2
      (('notify)
       (when (= (-> arg0 type) snowcam)
         (cond
           ((= (-> arg3 param 0) 'die)
            (if *target*
                (set! (-> *target* control trans y) (+ 1024.0 (-> *target* control trans y)))
                )
            (go snow-eggtop-idle-down)
            )
           ((= (-> arg3 param 0) 'cut)
            (stop! (-> self sound))
            (set! (-> self play-sound?) #f)
            #f
            )
           )
         )
       )
      )
    )
  :enter (behavior ()
    (logclear! (-> self mask) (process-mask actor-pause))
    (process-entity-status! self (entity-perm-status bit-3) #t)
    (set! (-> self play-sound?) #t)
    (none)
    )
  :exit (behavior ()
    (stop! (-> self sound))
    (logior! (-> self mask) (process-mask actor-pause))
    (process-entity-status! self (entity-perm-status bit-3) #f)
    (none)
    )
  :trans (the-as (function none :behavior snow-eggtop) rider-trans)
  :code (behavior ()
    (process-spawn
      part-tracker
      :init part-tracker-init
      (-> *part-group-id-table* 511)
      -1
      #f
      #f
      #f
      (-> self root-override trans)
      :to *entity-pool*
      )
    (let ((v1-7
            (process-spawn
              snowcam
              :init pov-camera-init-by-other
              (-> self spawn-trans)
              *snowcam-sg*
              "gearstart"
              0
              self
              '((0 ambient camera "gamcam38") (10 alive "ecovent-278"))
              :to self
              )
            )
          )
      (set! (-> (the-as snowcam (-> v1-7 0)) seq) (the-as uint 2))
      )
    (change-sound! (-> self sound) (static-sound-name "snw-eggtop-seq"))
    (save-reminder (get-task-control (-> self entity extra perm task)) 2 4)
    (ja-no-eval :group! (-> self draw art-group data 2) :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (if (-> self play-sound?)
          (update! (-> self sound))
          )
      (suspend)
      (ja :num! (seek!))
      )
    (level-hint-spawn
      (game-text-id snow-eggtop-resolution)
      "sksp0360"
      (the-as entity #f)
      *entity-pool*
      (game-task none)
      )
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (until (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 1.1))
      (if (-> self play-sound?)
          (update! (-> self sound))
          )
      (suspend)
      )
    (process-entity-status! self (entity-perm-status complete) #t)
    (let ((a0-18 (-> self entity)))
      (if (and a0-18 (= self (-> a0-18 extra process)))
          (entity-task-complete-on a0-18)
          )
      )
    (send-event (ppointer->process (-> *hud-parts* fuel-cell)) 'show)
    (loop
      (if (-> self play-sound?)
          (update! (-> self sound))
          )
      (suspend)
      )
    (none)
    )
  :post (the-as (function none :behavior snow-eggtop) rider-post)
  )

;; failed to figure out what this is:
(defstate snow-eggtop-idle-down (snow-eggtop)
  :code (behavior ()
    (process-entity-status! self (entity-perm-status complete) #t)
    (let ((a0-1 (-> self entity)))
      (if (and a0-1 (= self (-> a0-1 extra process)))
          (entity-task-complete-on a0-1)
          )
      )
    (ja-channel-push! 1 0)
    (ja :group! (-> self draw art-group data 2) :num! max)
    (transform-post)
    (logior! (-> self mask) (process-mask sleep-code))
    (suspend)
    0
    (none)
    )
  )

;; definition for method 11 of type snow-eggtop
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(defmethod init-from-entity! snow-eggtop ((obj snow-eggtop) (arg0 entity-actor))
  (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))))
    (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s4-0 reaction) default-collision-reaction)
    (set! (-> s4-0 no-reaction)
          (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
          )
    (alloc-riders s4-0 1)
    (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> s3-0 prim-core collide-as) (collide-kind ground-object))
      (set! (-> s3-0 collide-with) (collide-kind target))
      (set! (-> s3-0 prim-core action) (collide-action solid ca-1))
      (set! (-> s3-0 prim-core offense) (collide-offense indestructible))
      (set! (-> s3-0 transform-index) 4)
      (set-vector! (-> s3-0 local-sphere) 0.0 0.0 -7372.8 18022.4)
      (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 *snow-eggtop-sg* '())
  (logior! (-> obj skel status) (janim-status inited))
  (set! (-> obj spawn-trans quad) (-> obj root-override trans quad))
  (set! (-> obj root-override trans y) (+ -2662.4 (-> obj root-override trans y)))
  (update-transforms! (-> obj root-override))
  (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 510) obj))
  (set! (-> obj sound)
        (new 'process 'ambient-sound (static-sound-spec "electric-loop" :fo-max 40) (-> obj root-override trans))
        )
  (cond
    ((task-complete? *game-info* (-> obj entity extra perm task))
     (go snow-eggtop-idle-down)
     )
    (else
      (let ((a0-17 (new 'stack-no-clear 'vector)))
        (set! (-> a0-17 quad) (-> obj root-override trans quad))
        (set! (-> a0-17 y) (+ 3072.0 (-> a0-17 y)))
        (birth-pickup-at-point
          a0-17
          (pickup-type fuel-cell)
          (the float (-> obj entity extra perm task))
          #f
          obj
          (the-as fact-info #f)
          )
        )
      (go snow-eggtop-idle-up)
      )
    )
  (none)
  )

;; definition of type snowpusher
(deftype snowpusher (process-drawable)
  ((root-override collide-shape-moving         :offset        112)
   (max-frame     float                        :offset-assert 176)
   (open-sound    sound-name                   :offset-assert 192)
   (close-sound   sound-name                   :offset-assert 208)
   (sync          sync-info-paused     :inline :offset-assert 224)
   )
  :heap-base #x80
  :method-count-assert 20
  :size-assert         #xf0
  :flag-assert         #x14008000f0
  (:states
    snowpusher-idle
    )
  )

;; definition for method 3 of type snowpusher
;; Used lq/sq
(defmethod inspect snowpusher ((obj snowpusher))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tmax-frame: ~f~%" (-> obj max-frame))
  (format #t "~T~Topen-sound: ~D~%" (-> obj open-sound))
  (format #t "~T~Tclose-sound: ~D~%" (-> obj close-sound))
  (format #t "~T~Tsync: #<sync-info-paused @ #x~X>~%" (-> obj sync))
  obj
  )

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

;; failed to figure out what this is:
(defstate snowpusher-idle (snowpusher)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (let ((v1-0 arg2))
      (the-as object (when (= v1-0 'touch)
                       (send-event arg0 'no-look-around (seconds 1.5))
                       #f
                       )
              )
      )
    )
  :code (behavior ()
    (let ((gp-0 #f))
      (loop
        (let ((f0-0 (get-current-phase-with-mirror (-> self sync))))
          (ja :num-func num-func-identity :frame-num (* f0-0 (-> self max-frame)))
          (cond
            ((or (= f0-0 0.0) (= f0-0 1.0))
             (set! gp-0 #f)
             )
            (else
              (when (not gp-0)
                (set! gp-0 #t)
                (if (>= f0-0 0.5)
                    (sound-play-by-name (-> self close-sound) (new-sound-id) 1024 0 0 (sound-group sfx) #t)
                    (sound-play-by-name (-> self open-sound) (new-sound-id) 1024 0 0 (sound-group sfx) #t)
                    )
                )
              )
            )
          )
        (suspend)
        )
      )
    (none)
    )
  :post (the-as (function none :behavior snowpusher) pusher-post)
  )

;; definition for method 11 of type snowpusher
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(defmethod init-from-entity! snowpusher ((obj snowpusher) (arg0 entity-actor))
  (local-vars (sv-16 res-tag))
  (set! (-> obj mask) (logior (process-mask enemy platform) (-> obj mask)))
  (let ((s3-0 0)
        (s4-0 0)
        )
    (set! sv-16 (new 'static 'res-tag))
    (let ((v1-3 (res-lump-data (-> obj entity) 'mode (pointer int32) :tag-ptr (& sv-16))))
      (when v1-3
        (set! s3-0 (-> v1-3 0))
        (set! s4-0 (-> v1-3 1))
        )
      )
    (cond
      ((zero? s3-0)
       (set! (-> obj open-sound) (static-sound-name "snow-piston-opn"))
       (set! (-> obj close-sound) (static-sound-name "snow-piston-cls"))
       )
      ((= s3-0 1)
       (set! (-> obj open-sound) (static-sound-name "snow-pist-opn3"))
       (set! (-> obj close-sound) (static-sound-name "snow-pist-cls3"))
       )
      ((= s3-0 2)
       (set! (-> obj open-sound) (static-sound-name "snow-pist-opn2"))
       (set! (-> obj close-sound) (static-sound-name "snow-pist-cls2"))
       )
      )
    (let ((s3-1 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-others))))
      (set! (-> s3-1 dynam) (copy *standard-dynamics* 'process))
      (set! (-> s3-1 reaction) default-collision-reaction)
      (set! (-> s3-1 no-reaction)
            (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
            )
      (let ((s4-1 (new 'process 'collide-shape-prim-mesh s3-1 (the-as uint s4-0) (the-as uint 0))))
        (set! (-> s4-1 prim-core collide-as) (collide-kind ground-object))
        (set! (-> s4-1 collide-with) (collide-kind target))
        (set! (-> s4-1 prim-core action) (collide-action solid ca-1))
        (set! (-> s4-1 prim-core offense) (collide-offense indestructible))
        (set! (-> s4-1 transform-index) 3)
        (set-vector! (-> s4-1 local-sphere) 0.0 20480.0 -12288.0 25600.0)
        (set-root-prim! s3-1 s4-1)
        )
      (set! (-> s3-1 nav-radius) (* 0.75 (-> s3-1 root-prim local-sphere w)))
      (backup-collide-with-as s3-1)
      (set! (-> obj root-override) s3-1)
      )
    )
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *snowpusher-sg* '())
  (let ((s4-2 (-> obj skel root-channel 0)))
    (joint-control-channel-group-eval!
      s4-2
      (the-as art-joint-anim (-> obj draw art-group data 2))
      num-func-identity
      )
    (set! (-> s4-2 frame-num) 0.0)
    )
  (load-params! (-> obj sync) obj (the-as uint 1500) 0.0 0.15 0.15)
  (set! (-> obj max-frame) (* (the float (ja-num-frames 0)) (res-lump-float arg0 'max-frame :default 1.0)))
  (logclear! (-> obj mask) (process-mask actor-pause))
  (go snowpusher-idle)
  (none)
  )

;; definition of type snow-spatula
(deftype snow-spatula (baseplat)
  ((sync     sync-info :inline :offset-assert 228)
   (startmat matrix    :inline :offset-assert 240)
   )
  :heap-base #xc0
  :method-count-assert 27
  :size-assert         #x130
  :flag-assert         #x1b00c00130
  (:states
    snow-spatula-idle
    )
  )

;; definition for method 3 of type snow-spatula
(defmethod inspect snow-spatula ((obj snow-spatula))
  (let ((t9-0 (method-of-type baseplat inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tsync: #<sync-info @ #x~X>~%" (-> obj sync))
  (format #t "~T~Tstartmat: #<matrix @ #x~X>~%" (-> obj startmat))
  obj
  )

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

;; failed to figure out what this is:
(defstate snow-spatula-idle (snow-spatula)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (let ((v1-0 arg2))
      (the-as object (when (= v1-0 'bonk)
                       (dummy-22 self)
                       (sound-play "snow-spat-short" :vol 75 :pitch 0.75)
                       )
              )
      )
    )
  :trans (the-as (function none :behavior snow-spatula) plat-trans)
  :code (behavior ()
    (let ((f28-0 0.0)
          (gp-0 1)
          )
      (loop
        (let ((f30-0 (get-current-phase-with-mirror (-> self sync))))
          (when (!= f30-0 f28-0)
            (let ((v1-3 1))
              (if (< f30-0 f28-0)
                  (set! v1-3 -1)
                  )
              (when (!= v1-3 gp-0)
                (set! gp-0 v1-3)
                (cond
                  ((> v1-3 0)
                   (sound-play "snow-spat-long" :pitch (rand-vu-float-range -0.2 0.2))
                   )
                  (1
                    (sound-play "snow-spat-short" :pitch (rand-vu-float-range -0.2 0.2))
                    )
                  )
                )
              )
            (set! f28-0 f30-0)
            )
          (let ((s5-2 (new 'stack-no-clear 'matrix)))
            (matrix-rotate-y! s5-2 (* 16384.0 f30-0))
            (matrix*! s5-2 s5-2 (-> self startmat))
            (matrix->quaternion (-> self root-override quat) s5-2)
            )
          )
        (suspend)
        )
      )
    (none)
    )
  :post (the-as (function none :behavior snow-spatula) plat-post)
  )

;; definition for method 11 of type snow-spatula
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! snow-spatula ((obj snow-spatula) (arg0 entity-actor))
  (set! (-> obj mask) (logior (process-mask platform) (-> obj mask)))
  (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))))
    (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s4-0 reaction) default-collision-reaction)
    (set! (-> s4-0 no-reaction)
          (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
          )
    (alloc-riders s4-0 1)
    (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> s3-0 prim-core collide-as) (collide-kind ground-object))
      (set! (-> s3-0 collide-with) (collide-kind target))
      (set! (-> s3-0 prim-core action) (collide-action solid ca-1))
      (set! (-> s3-0 prim-core offense) (collide-offense indestructible))
      (set! (-> s3-0 transform-index) 3)
      (set-vector! (-> s3-0 local-sphere) 0.0 49152.0 -16384.0 16384.0)
      (set-root-prim! s4-0 s3-0)
      )
    (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *snow-spatula-sg* '())
  (logior! (-> obj skel status) (janim-status inited))
  (load-params! (-> obj sync) obj (the-as uint 1500) 0.0 0.15 0.15)
  (quaternion->matrix (-> obj startmat) (-> obj root-override quat))
  (dummy-21 obj)
  (go snow-spatula-idle)
  (none)
  )

;; definition of type snow-fort-gate
(deftype snow-fort-gate (process-drawable)
  ((root-override collide-shape                    :offset        112)
   (part2         sparticle-launch-control         :offset-assert 176)
   (part3         sparticle-launch-control         :offset-assert 180)
   (open-trans    vector                   :inline :offset-assert 192)
   (closed-trans  vector                   :inline :offset-assert 208)
   )
  :heap-base #x70
  :method-count-assert 20
  :size-assert         #xe0
  :flag-assert         #x14007000e0
  (:states
    snow-fort-gate-activate
    snow-fort-gate-idle-closed
    snow-fort-gate-idle-open
    )
  )

;; definition for method 3 of type snow-fort-gate
(defmethod inspect snow-fort-gate ((obj snow-fort-gate))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tpart2: ~A~%" (-> obj part2))
  (format #t "~T~Tpart3: ~A~%" (-> obj part3))
  (format #t "~T~Topen-trans: #<vector @ #x~X>~%" (-> obj open-trans))
  (format #t "~T~Tclosed-trans: #<vector @ #x~X>~%" (-> obj closed-trans))
  obj
  )

;; failed to figure out what this is:
(defskelgroup *snow-fort-gate-sg* snow-fort-gate snow-fort-gate-lod0-jg -1
              ((snow-fort-gate-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 15 0 24)
              :longest-edge (meters 12.8)
              )

;; failed to figure out what this is:
(defpartgroup group-snow-fort-gate-coming-down
  :id 512
  :flags (use-local-clock)
  :bounds (static-bspherem 0 0 0 8)
  :parts ((sp-item 1896))
  )

;; failed to figure out what this is:
(defpart 1896
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2))
    (sp-rnd-flt spt-num 0.5 1.0 1.0)
    (sp-rnd-flt spt-x (meters -10) (meters 20) 1.0)
    (sp-rnd-flt spt-y (meters 0.5) (meters 1) 1.0)
    (sp-rnd-flt spt-scale-x (meters 10.5) (meters 8.5) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-copy-from-other spt-scale-y -4)
    (sp-flt spt-r 96.0)
    (sp-flt spt-g 96.0)
    (sp-rnd-flt spt-b 96.0 16.0 1.0)
    (sp-flt spt-a 0.0)
    (sp-rnd-flt spt-vel-x (meters -0.026666667) (meters 0.053333335) 1.0)
    (sp-rnd-flt spt-vel-z (meters -0.053333335) (meters 0.053333335) 1.0)
    (sp-rnd-flt spt-rotvel-z (degrees -0.4) (degrees 0.8) 1.0)
    (sp-flt spt-fade-a 0.42666668)
    (sp-flt spt-accel-y -2.7306666)
    (sp-flt spt-friction 0.98)
    (sp-int spt-timer 450)
    (sp-cpuinfo-flags bit2)
    (sp-int-plain-rnd spt-next-time 75 74 1)
    (sp-launcher-by-id spt-next-launcher 1897)
    (sp-flt spt-rotate-y (degrees 0.0))
    )
  )

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

;; failed to figure out what this is:
(defpartgroup group-snow-fort-gate-hits-bottom
  :id 513
  :flags (use-local-clock)
  :bounds (static-bspherem 0 0 0 8)
  :parts ((sp-item 1898))
  )

;; failed to figure out what this is:
(defpart 1898
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #x2))
    (sp-flt spt-num 64.0)
    (sp-rnd-flt spt-x (meters -10) (meters 20) 1.0)
    (sp-rnd-flt spt-y (meters 0.5) (meters 1) 1.0)
    (sp-flt spt-z (meters -3))
    (sp-rnd-flt spt-scale-x (meters 4) (meters 8) 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 128.0)
    (sp-flt spt-g 128.0)
    (sp-rnd-flt spt-b 128.0 16.0 1.0)
    (sp-flt spt-a 0.0)
    (sp-rnd-flt spt-vel-x (meters -0.013333334) (meters 0.026666667) 1.0)
    (sp-rnd-flt spt-vel-z (meters -0.053333335) (meters 0.046666667) 1.0)
    (sp-rnd-flt spt-rotvel-z (degrees -0.4) (degrees 0.8) 1.0)
    (sp-flt spt-fade-a 0.42666668)
    (sp-flt spt-accel-y -0.68266666)
    (sp-flt spt-friction 0.98)
    (sp-int spt-timer 750)
    (sp-cpuinfo-flags bit2)
    (sp-int-plain-rnd spt-next-time 75 74 1)
    (sp-launcher-by-id spt-next-launcher 1899)
    (sp-flt spt-rotate-y (degrees 0.0))
    )
  )

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

;; failed to figure out what this is:
(defpartgroup group-snow-fort-gate-snowdrops
  :id 514
  :bounds (static-bspherem 0 -16 0 32)
  :parts ((sp-item 2271 :fade-after (meters 100) :falloff-to (meters 130) :period 1200 :length 150)
    (sp-item 2271 :fade-after (meters 100) :falloff-to (meters 130) :period 1200 :length 100)
    (sp-item 2271 :fade-after (meters 100) :falloff-to (meters 130) :period 1200 :length 60)
    (sp-item 2271 :fade-after (meters 100) :falloff-to (meters 130) :period 1200 :length 30)
    (sp-item 2271 :fade-after (meters 100) :falloff-to (meters 130) :period 1200 :length 10)
    (sp-item 2272 :fade-after (meters 100) :falloff-to (meters 100) :period 1200 :length 200)
    (sp-item 2272 :fade-after (meters 100) :falloff-to (meters 100) :period 1200 :length 150)
    (sp-item 2272 :fade-after (meters 100) :falloff-to (meters 100) :period 1200 :length 100)
    (sp-item 2272 :fade-after (meters 100) :falloff-to (meters 100) :period 1200 :length 50)
    (sp-item 2272 :fade-after (meters 100) :falloff-to (meters 100) :period 1200 :length 20)
    (sp-item 2273 :fade-after (meters 80) :falloff-to (meters 80) :period 1200 :length 170)
    (sp-item 2273 :fade-after (meters 80) :falloff-to (meters 80) :period 1200 :length 115)
    (sp-item 2273 :fade-after (meters 80) :falloff-to (meters 80) :period 1200 :length 70)
    (sp-item 2273 :fade-after (meters 80) :falloff-to (meters 80) :period 1200 :length 35)
    (sp-item 2273 :fade-after (meters 80) :falloff-to (meters 80) :period 1200 :length 10)
    )
  )

;; failed to figure out what this is:
(defpart 2271
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x4 :page #x2))
    (sp-flt spt-num 0.25)
    (sp-rnd-flt spt-x (meters -1) (meters 2) 1.0)
    (sp-rnd-flt spt-z (meters -1) (meters 2) 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.5) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-rnd-flt spt-scale-y (meters 0.5) (meters 0.25) 1.0)
    (sp-flt spt-r 150.0)
    (sp-flt spt-g 150.0)
    (sp-rnd-flt spt-b 150.0 55.0 1.0)
    (sp-flt spt-a 128.0)
    (sp-flt spt-vel-y (meters -0.006666667))
    (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0)
    (sp-rnd-flt spt-accel-y -2.7306666 -1.3653333 1.0)
    (sp-int spt-timer 900)
    (sp-cpuinfo-flags bit2 bit12)
    (sp-int spt-next-time 600)
    (sp-launcher-by-id spt-next-launcher 2274)
    )
  )

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

;; failed to figure out what this is:
(defpart 2272
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x4 :page #x2))
    (sp-flt spt-num 1.0)
    (sp-rnd-flt spt-x (meters -0.5) (meters 1) 1.0)
    (sp-flt spt-y (meters 1))
    (sp-rnd-flt spt-z (meters -0.5) (meters 1) 1.0)
    (sp-rnd-flt spt-scale-x (meters 0.25) (meters 0.25) 1.0)
    (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0)
    (sp-rnd-flt spt-scale-y (meters 0.25) (meters 0.1) 1.0)
    (sp-flt spt-r 150.0)
    (sp-flt spt-g 150.0)
    (sp-rnd-flt spt-b 150.0 55.0 1.0)
    (sp-rnd-flt spt-a 96.0 32.0 1.0)
    (sp-flt spt-vel-y (meters -0.006666667))
    (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0)
    (sp-rnd-flt spt-accel-y -2.048 -1.3653333 1.0)
    (sp-int spt-timer 900)
    (sp-cpuinfo-flags bit2 bit12)
    (sp-int spt-next-time 600)
    (sp-launcher-by-id spt-next-launcher 2274)
    )
  )

;; failed to figure out what this is:
(defpart 2273
  :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xb :page #x2))
    (sp-flt spt-num 0.25)
    (sp-rnd-flt spt-x (meters -0.5) (meters 1) 1.0)
    (sp-flt spt-y (meters 1))
    (sp-rnd-flt spt-z (meters -0.5) (meters 1) 1.0)
    (sp-rnd-flt spt-scale-x (meters 1) (meters 0.25) 1.0)
    (sp-rnd-flt spt-scale-y (meters 2.5) (meters 1) 1.0)
    (sp-flt spt-r 150.0)
    (sp-flt spt-g 150.0)
    (sp-rnd-flt spt-b 150.0 55.0 1.0)
    (sp-rnd-flt spt-a 32.0 96.0 1.0)
    (sp-flt spt-vel-y (meters -0.006666667))
    (sp-flt spt-fade-a -0.14222223)
    (sp-rnd-flt spt-accel-y -2.048 -1.3653333 1.0)
    (sp-int spt-timer 900)
    (sp-cpuinfo-flags bit2 bit12)
    )
  )

;; failed to figure out what this is:
(defstate snow-fort-gate-idle-closed (snow-fort-gate)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (case arg2
      (('notice)
       (go snow-fort-gate-activate)
       )
      )
    )
  :trans (behavior ()
    (when (and *target* (>= 61440.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))))
      (level-hint-spawn (game-text-id snow-fort-hint) "sksp0345" (the-as entity #f) *entity-pool* (game-task none))
      (close-specific-task! (game-task snow-fort) (task-status need-hint))
      )
    (none)
    )
  :code (behavior ()
    (ja :group! (-> self draw art-group data 2) :num! min)
    (set! (-> self root-override trans quad) (-> self closed-trans quad))
    (transform-post)
    (suspend)
    (loop
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate snow-fort-gate-activate (snow-fort-gate)
  :enter (behavior ()
    (logclear! (-> self mask) (process-mask actor-pause))
    (none)
    )
  :exit (behavior ()
    (stop! (-> self sound))
    (logior! (-> self mask) (process-mask actor-pause))
    (none)
    )
  :code (behavior ()
    (let ((gp-0 #f))
      (loop
        (let ((a1-0 (new 'stack-no-clear 'vector)))
          (set! (-> a1-0 quad) (-> self closed-trans quad))
          (set! (-> a1-0 y) (+ -12288.0 (-> a1-0 y)))
          (set! (-> a1-0 z) (+ -12288.0 (-> a1-0 z)))
          (spawn (-> self part) a1-0)
          )
        (let ((s5-0 (new 'stack-no-clear 'vector)))
          (set! (-> s5-0 quad) (-> self root-override trans quad))
          (let ((f30-0 (vector-vector-distance-squared s5-0 (-> self open-trans))))
            (when (and (not gp-0) (>= 1048576.0 f30-0))
              (set! gp-0 #t)
              (let ((a1-2 (new 'stack-no-clear 'vector)))
                (set! (-> a1-2 quad) (-> self open-trans quad))
                (set! (-> a1-2 y) (+ -26624.0 (-> a1-2 y)))
                (set! (-> a1-2 z) (+ -3072.0 (-> a1-2 z)))
                (spawn (-> self part2) a1-2)
                )
              )
            (when (>= 1677.7216 f30-0)
              (sound-play "lodge-close")
              (activate! *camera-smush-control* 819.2 37 150 1.0 0.99)
              (go snow-fort-gate-idle-open)
              )
            )
          (vector-seek-3d-smooth! s5-0 (-> self open-trans) (* 16384.0 (-> *display* seconds-per-frame)) 0.9)
          (move-to-point! (-> self root-override) s5-0)
          )
        (let ((a1-7 (new 'stack-no-clear 'vector)))
          (set! (-> a1-7 quad) (-> self root-override trans quad))
          (set! (-> a1-7 x) (+ 20480.0 (-> a1-7 x)))
          (set! (-> a1-7 y) (+ 106496.0 (-> a1-7 y)))
          (set! (-> a1-7 z) (+ -32768.0 (-> a1-7 z)))
          (spawn (-> self part3) a1-7)
          )
        (update! (-> self sound))
        (suspend)
        )
      )
    (none)
    )
  :post (the-as (function none :behavior snow-fort-gate) transform-post)
  )

;; failed to figure out what this is:
(defstate snow-fort-gate-idle-open (snow-fort-gate)
  :code (behavior ()
    (ja :group! (-> self draw art-group data 2) :num! min)
    (set! (-> self root-override trans quad) (-> self open-trans quad))
    (transform-post)
    (suspend)
    (transform-post)
    (loop
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    (none)
    )
  )

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

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

;; definition for method 11 of type snow-fort-gate
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(defmethod init-from-entity! snow-fort-gate ((obj snow-fort-gate) (arg0 entity-actor))
  (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-others))))
    (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> s3-0 prim-core collide-as) (collide-kind ground-object))
      (set! (-> s3-0 collide-with) (collide-kind target))
      (set! (-> s3-0 prim-core action) (collide-action solid))
      (set! (-> s3-0 prim-core offense) (collide-offense indestructible))
      (set! (-> s3-0 transform-index) 0)
      (set-vector! (-> s3-0 local-sphere) 0.0 61440.0 0.0 99123.2)
      (set-root-prim! s4-0 s3-0)
      )
    (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *snow-fort-gate-sg* '())
  (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 512) obj))
  (set! (-> obj part2) (create-launch-control (-> *part-group-id-table* 513) obj))
  (set! (-> obj part3) (create-launch-control (-> *part-group-id-table* 514) obj))
  (set! (-> obj open-trans quad) (-> obj root-override trans quad))
  (set! (-> obj closed-trans quad) (-> obj open-trans quad))
  (set! (-> obj open-trans y) (+ -141312.0 (-> obj open-trans y)))
  (set! (-> obj open-trans z) (+ 32768.0 (-> obj open-trans z)))
  (set! (-> obj sound)
        (new 'process 'ambient-sound (static-sound-spec "lodge-door-mov" :fo-max 80) (-> obj open-trans))
        )
  (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)
    )
  (cond
    ((task-complete? *game-info* (game-task snow-ball))
     (set! (-> obj root-override trans quad) (-> obj open-trans quad))
     (transform-post)
     (go snow-fort-gate-idle-open)
     )
    (else
      (set! (-> obj root-override trans quad) (-> obj closed-trans quad))
      (transform-post)
      (go snow-fort-gate-idle-closed)
      )
    )
  (none)
  )

;; definition of type snow-gears
(deftype snow-gears (process-drawable)
  ()
  :heap-base #x40
  :method-count-assert 21
  :size-assert         #xb0
  :flag-assert         #x15004000b0
  (:methods
    (TODO-RENAME-20 (_type_) none 20)
    )
  (:states
    snow-gears-activate
    snow-gears-halt
    snow-gears-idle
    snow-gears-stopped
    )
  )

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

;; failed to figure out what this is:
(defskelgroup *snow-gears-sg* snow-gears snow-gears-lod0-jg snow-gears-idle-ja
              ((snow-gears-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 60)
              :longest-edge (meters 12.1)
              )

;; failed to figure out what this is:
(defpartgroup group-snow-gears-dripping
  :id 515
  :flags (use-local-clock)
  :bounds (static-bspherem 0 -4 0 16)
  :parts ((sp-item 1900) (sp-item 1901))
  )

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

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

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

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

;; definition for method 20 of type snow-gears
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(defmethod TODO-RENAME-20 snow-gears ((obj snow-gears))
  (let ((a1-0 (new 'stack-no-clear 'vector)))
    (set! (-> a1-0 quad) (-> obj root trans quad))
    (set! (-> a1-0 y) (+ 61440.0 (-> a1-0 y)))
    (spawn (-> obj part) a1-0)
    )
  (none)
  )

;; failed to figure out what this is:
(defstate snow-gears-idle (snow-gears)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (case arg2
      (('notice)
       (logclear! (-> self mask) (process-mask actor-pause))
       (process-entity-status! self (entity-perm-status bit-3) #t)
       (go snow-gears-activate)
       )
      )
    )
  :code (behavior ()
    (ja :group! (-> self draw art-group data 2) :num! min)
    (ja-post)
    (loop
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate snow-gears-activate (snow-gears)
  :trans (behavior ()
    (TODO-RENAME-20 self)
    (none)
    )
  :code (behavior ()
    (sound-play "eng-start-up")
    (ja-no-eval :group! (-> self draw art-group data 3) :num! (seek! max 0.85) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek! max 0.85))
      )
    (ja-no-eval :group! (-> self draw art-group data 4) :num! (seek! max 0.35) :frame-num 0.0)
    (until (ja-done? 0)
      (update! (-> self sound))
      (suspend)
      (ja :num! (seek! max 0.35))
      )
    (set! (-> self state-time) (-> *display* base-frame-counter))
    (ja :group! (-> self draw art-group data 2) :num! min)
    (until (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 2))
      (update! (-> self sound))
      (suspend)
      )
    (go snow-gears-halt)
    (none)
    )
  :post (the-as (function none :behavior snow-gears) ja-post)
  )

;; failed to figure out what this is:
(defstate snow-gears-halt (snow-gears)
  :exit (behavior ()
    (stop! (-> self sound))
    (none)
    )
  :trans (behavior ()
    (TODO-RENAME-20 self)
    (none)
    )
  :code (behavior ()
    (ja-no-eval :group! (-> self draw art-group data 4) :num! (seek! max 0.35) :frame-num 0.0)
    (until (ja-done? 0)
      (update! (-> self sound))
      (suspend)
      (ja :num! (seek! max 0.35))
      )
    (stop! (-> self sound))
    (sound-play "eng-shut-down")
    (ja-no-eval :group! (-> self draw art-group data 5) :num! (seek! max 0.85) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek! max 0.85))
      )
    (go snow-gears-stopped)
    (none)
    )
  :post (the-as (function none :behavior snow-gears) ja-post)
  )

;; failed to figure out what this is:
(defstate snow-gears-stopped (snow-gears)
  :code (behavior ()
    (logior! (-> self mask) (process-mask actor-pause))
    (process-entity-status! self (entity-perm-status bit-3) #f)
    (loop
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    (none)
    )
  )

;; definition for method 11 of type snow-gears
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! snow-gears ((obj snow-gears) (arg0 entity-actor))
  (set! (-> obj root) (new 'process 'trsqv))
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *snow-gears-sg* '())
  (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 515) obj))
  (set! (-> obj sound)
        (new 'process 'ambient-sound (static-sound-spec "snow-engine" :fo-max 300) (-> obj root trans))
        )
  (go snow-gears-idle)
  (none)
  )

;; definition of type snow-switch
(deftype snow-switch (process-drawable)
  ((root-override collide-shape-moving         :offset        112)
   (pressed?      symbol                       :offset-assert 176)
   (fcell-handle  handle                       :offset-assert 184)
   (orig-trans    vector               :inline :offset-assert 192)
   )
  :heap-base #x60
  :method-count-assert 20
  :size-assert         #xd0
  :flag-assert         #x14006000d0
  (:states
    snow-switch-activate
    snow-switch-idle-down
    snow-switch-idle-up
    )
  )

;; definition for method 3 of type snow-switch
(defmethod inspect snow-switch ((obj snow-switch))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tpressed?: ~A~%" (-> obj pressed?))
  (format #t "~T~Tfcell-handle: ~D~%" (-> obj fcell-handle))
  (format #t "~T~Torig-trans: #<vector @ #x~X>~%" (-> obj orig-trans))
  obj
  )

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

;; definition for function snow-switch-event-handler
(defbehavior snow-switch-event-handler snow-switch ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
  (local-vars (v0-0 object))
  (case arg2
    (('notify)
     (cond
       ((= (-> arg0 type) fuel-cell)
        (when (= (-> arg3 param 0) 'pickup)
          (set! (-> self pressed?) #t)
          (process-entity-status! self (entity-perm-status bit-3) #t)
          (logclear! (-> self mask) (process-mask actor-pause))
          (go snow-switch-activate)
          )
        )
       ((= (-> arg0 type) snowcam)
        (if (= (-> arg3 param 0) 'die)
            (go snow-switch-idle-down)
            )
        )
       )
     )
    (('query)
     (return (-> self pressed?))
     v0-0
     )
    )
  )

;; failed to figure out what this is:
(defstate snow-switch-idle-up (snow-switch)
  :event snow-switch-event-handler
  :code (behavior ()
    (loop
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate snow-switch-activate (snow-switch)
  :event snow-switch-event-handler
  :exit (behavior ()
    (process-entity-status! self (entity-perm-status bit-3) #f)
    (logior! (-> self mask) (process-mask actor-pause))
    (none)
    )
  :trans (the-as (function none :behavior snow-switch) rider-trans)
  :code (behavior ()
    (local-vars (v1-1 symbol))
    (until v1-1
      (suspend)
      (set! v1-1 (or (not *target*) (zero? (logand (-> *target* state-flags) (state-flags grabbed)))))
      )
    (sound-play "prec-button1" :pitch -1)
    (let ((gp-1 (get-process *default-dead-pool* snowcam #x4000)))
      (set! (-> (the-as snowcam (-> (when gp-1
                                      (let ((t9-3 (method-of-type snowcam activate)))
                                        (t9-3 (the-as snowcam gp-1) self 'snowcam (the-as pointer #x70004000))
                                        )
                                      (run-now-in-process
                                        gp-1
                                        pov-camera-init-by-other
                                        (new 'static 'vector :x 3411656.8 :y 779689.56 :z -13573010.0 :w 1.0)
                                        *snowcam-sg*
                                        "gearstart"
                                        0
                                        self
                                        '()
                                        )
                                      (-> gp-1 ppointer)
                                      )
                                    0
                                    )
                        )
                seq
                )
            (the-as uint 0)
            )
      )
    0
    (let ((gp-2 #f))
      (loop
        (let ((s5-1 (new 'stack-no-clear 'vector))
              (f0-1 (+ -1433.6 (-> self orig-trans y)))
              )
          (set! (-> s5-1 quad) (-> self root-override trans quad))
          (cond
            ((= (-> s5-1 y) f0-1)
             (when (not gp-2)
               (set! gp-2 #t)
               (send-to-all (-> self link) 'notice)
               )
             )
            (else
              (set! (-> s5-1 y)
                    (seek-with-smooth (-> self root-override trans y) f0-1 (* 6144.0 (-> *display* seconds-per-frame)) 0.2 204.8)
                    )
              (move-to-point! (-> self root-override) s5-1)
              )
            )
          )
        (suspend)
        )
      )
    (none)
    )
  :post (the-as (function none :behavior snow-switch) rider-post)
  )

;; failed to figure out what this is:
(defstate snow-switch-idle-down (snow-switch)
  :event snow-switch-event-handler
  :code (behavior ()
    (set! (-> self pressed?) #t)
    (set! (-> self root-override trans quad) (-> self orig-trans quad))
    (set! (-> self root-override trans y) (+ -1433.6 (-> self root-override trans y)))
    (transform-post)
    (loop
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    (none)
    )
  )

;; definition for method 11 of type snow-switch
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(defmethod init-from-entity! snow-switch ((obj snow-switch) (arg0 entity-actor))
  (set! (-> obj pressed?) #f)
  (set! (-> obj fcell-handle) (the-as handle #f))
  (set! (-> obj link) (new 'process 'actor-link-info obj))
  (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))))
    (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s4-0 reaction) default-collision-reaction)
    (set! (-> s4-0 no-reaction)
          (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
          )
    (alloc-riders s4-0 1)
    (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> s3-0 prim-core collide-as) (collide-kind ground-object))
      (set! (-> s3-0 collide-with) (collide-kind target))
      (set! (-> s3-0 prim-core action) (collide-action solid ca-1))
      (set! (-> s3-0 prim-core offense) (collide-offense indestructible))
      (set! (-> s3-0 transform-index) 3)
      (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 8192.0)
      (set-root-prim! s4-0 s3-0)
      )
    (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *snow-switch-sg* '())
  (logior! (-> obj skel status) (janim-status inited))
  (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)
    )
  (transform-post)
  (set! (-> obj orig-trans quad) (-> obj root-override trans quad))
  (let ((s5-2 (task-complete? *game-info* (game-task snow-ball))))
    (set! (-> obj pressed?) s5-2)
    (when (not s5-2)
      (let ((a0-17 (new 'stack-no-clear 'vector)))
        (set! (-> a0-17 quad) (-> obj orig-trans quad))
        (set! (-> a0-17 y) (+ 12288.0 (-> a0-17 y)))
        (set! (-> obj fcell-handle) (ppointer->handle (birth-pickup-at-point
                                                        a0-17
                                                        (pickup-type fuel-cell)
                                                        (the float (-> obj entity extra perm task))
                                                        #f
                                                        obj
                                                        (the-as fact-info #f)
                                                        )
                                                      )
              )
        )
      )
    (if s5-2
        (go snow-switch-idle-down)
        (go snow-switch-idle-up)
        )
    )
  (none)
  )

;; definition of type snow-log
(deftype snow-log (process-drawable)
  ((root-override collide-shape-moving  :offset        112)
   (master        entity-actor          :offset-assert 176)
   )
  :heap-base #x50
  :method-count-assert 20
  :size-assert         #xb4
  :flag-assert         #x14005000b4
  (:states
    snow-log-activate
    snow-log-active
    snow-log-hidden
    snow-log-wait-for-master
    )
  )

;; definition for method 3 of type snow-log
(defmethod inspect snow-log ((obj snow-log))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tmaster: ~A~%" (-> obj master))
  obj
  )

;; failed to figure out what this is:
(defskelgroup *snow-log-sg* snow-log snow-log-lod0-jg -1
              ((snow-log-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 5 0 9)
              )

;; failed to figure out what this is:
(defstate snow-log-wait-for-master (snow-log)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (case arg2
      (('trigger)
       (go snow-log-activate)
       )
      )
    )
  :code (behavior ()
    (loop
      (while (let ((v1-0 (-> self master)))
               (not (if v1-0
                        (-> v1-0 extra process)
                        )
                    )
               )
        (suspend)
        )
      (suspend)
      (let* ((v1-3 (-> self master))
             (a0-1 (if v1-3
                       (-> v1-3 extra process)
                       )
                   )
             )
        (when a0-1
          (cond
            ((send-event a0-1 'query)
             (logclear! (-> self mask) (process-mask actor-pause))
             (process-entity-status! self (entity-perm-status bit-3) #t)
             (go snow-log-active)
             )
            (else
              (go snow-log-hidden)
              )
            )
          )
        )
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate snow-log-hidden (snow-log)
  :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
    (case arg2
      (('trigger)
       (logclear! (-> self mask) (process-mask actor-pause))
       (process-entity-status! self (entity-perm-status bit-3) #t)
       (go snow-log-activate)
       )
      )
    )
  :code (behavior ()
    (ja-channel-push! 1 0)
    (ja :group! (-> self draw art-group data 2) :num! min)
    (transform-post)
    (logior! (-> self mask) (process-mask sleep-code))
    (suspend)
    0
    (none)
    )
  )

;; failed to figure out what this is:
(defstate snow-log-activate (snow-log)
  :enter (behavior ()
    (logclear! (-> self mask) (process-mask actor-pause))
    (process-entity-status! self (entity-perm-status bit-3) #t)
    (logclear! (-> self draw status) (draw-status hidden))
    (none)
    )
  :exit (behavior ()
    (logior! (-> self mask) (process-mask actor-pause))
    (process-entity-status! self (entity-perm-status bit-3) #f)
    (none)
    )
  :trans (the-as (function none :behavior snow-log) rider-trans)
  :code (behavior ()
    (activate! *camera-smush-control* 819.2 37 150 1.0 0.99)
    (ja-channel-push! 1 0)
    (let ((gp-0 #f))
      (ja-no-eval :group! (-> self draw art-group data 2) :num! (seek!) :frame-num 0.0)
      (until (ja-done? 0)
        (when (and (not gp-0) (>= (ja-frame-num 0) 5.0))
          (set! gp-0 #t)
          (sound-play "explosion" :vol 40 :pitch 0.9)
          (sound-play "snow-spat-short" :pitch 0.25)
          )
        (suspend)
        (ja :num! (seek!))
        )
      )
    (go snow-log-active)
    (none)
    )
  :post (the-as (function none :behavior snow-log) rider-post)
  )

;; failed to figure out what this is:
(defstate snow-log-active (snow-log)
  :trans (the-as (function none :behavior snow-log) rider-trans)
  :code (behavior ()
    (logior! (-> self mask) (process-mask actor-pause))
    (process-entity-status! self (entity-perm-status bit-3) #f)
    (logclear! (-> self draw status) (draw-status hidden))
    (ja-channel-push! 1 (seconds 0.075))
    (let ((gp-0 #t)
          (s5-0 #t)
          )
      (loop
        (ja-no-eval :group! (-> self draw art-group data 3) :num! (seek! max 0.25) :frame-num 0.0)
        (until (ja-done? 0)
          (let ((f0-4 (ja-aframe-num 0)))
            (cond
              ((and gp-0 (< f0-4 1.0))
               (set! gp-0 #f)
               (set! s5-0 #t)
               (sound-play "snow-spat-long" :vol 85 :pitch (rand-vu-float-range -0.2 0.2))
               )
              ((and s5-0 (>= f0-4 11.0))
               (set! s5-0 #f)
               (set! gp-0 #t)
               (sound-play "snow-spat-short" :vol 85 :pitch (rand-vu-float-range -0.2 0.2))
               )
              )
            )
          (suspend)
          (ja :num! (seek! max 0.25))
          )
        )
      )
    (none)
    )
  :post (the-as (function none :behavior snow-log) rider-post)
  )

;; definition for method 11 of type snow-log
;; INFO: Return type mismatch object vs none.
(defmethod init-from-entity! snow-log ((obj snow-log) (arg0 entity-actor))
  (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))))
    (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s4-0 reaction) default-collision-reaction)
    (set! (-> s4-0 no-reaction)
          (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
          )
    (alloc-riders s4-0 1)
    (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> s3-0 prim-core collide-as) (collide-kind ground-object))
      (set! (-> s3-0 collide-with) (collide-kind target))
      (set! (-> s3-0 prim-core action) (collide-action solid ca-1))
      (set! (-> s3-0 prim-core offense) (collide-offense indestructible))
      (set! (-> s3-0 transform-index) 3)
      (set-vector! (-> s3-0 local-sphere) 0.0 20480.0 0.0 36864.0)
      (set-root-prim! s4-0 s3-0)
      )
    (set! (-> s4-0 nav-radius) 11264.0)
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *snow-log-sg* '())
  (logior! (-> obj skel status) (janim-status inited))
  (logior! (-> obj draw status) (draw-status hidden))
  (set! (-> obj root-override trans x) (+ -1024.0 (-> obj root-override trans x)))
  (set! (-> obj root-override trans y) (+ -4915.2 (-> obj root-override trans y)))
  (set-vector! (-> obj root-override scale) 1.5 1.0 1.5 1.0)
  (nav-mesh-connect obj (-> obj root-override) (the-as nav-control #f))
  (set! (-> obj master) (entity-actor-lookup arg0 'alt-actor 0))
  (set! (-> obj draw origin-joint-index) (the-as uint 3))
  (go snow-log-wait-for-master)
  (none)
  )

;; definition of type snow-log-button
(deftype snow-log-button (process-drawable)
  ((root-override collide-shape-moving         :offset        112)
   (log           entity-actor                 :offset-assert 176)
   (orig-trans    vector               :inline :offset-assert 192)
   )
  :heap-base #x60
  :method-count-assert 20
  :size-assert         #xd0
  :flag-assert         #x14006000d0
  (:states
    snow-log-button-activate
    snow-log-button-idle-down
    snow-log-button-idle-up
    )
  )

;; definition for method 3 of type snow-log-button
(defmethod inspect snow-log-button ((obj snow-log-button))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tlog: ~A~%" (-> obj log))
  (format #t "~T~Torig-trans: #<vector @ #x~X>~%" (-> obj orig-trans))
  obj
  )

;; definition for function snow-log-button-event-handler
;; INFO: Return type mismatch basic vs object.
(defbehavior snow-log-button-event-handler snow-log-button ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
  (local-vars (v0-2 basic))
  (case arg2
    (('touch 'bonk 'attack)
     (when (and (= (-> arg0 type) target)
                (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete))))
                (>= 6553.6 (vector-vector-xz-distance (target-pos 0) (-> self root-override trans)))
                )
       (process-entity-status! self (entity-perm-status complete) #t)
       (logclear! (-> self mask) (process-mask actor-pause))
       (process-entity-status! self (entity-perm-status bit-3) #t)
       (go snow-log-button-activate)
       (return (the-as object #f))
       v0-2
       )
     )
    (('query)
     (when (= (-> arg0 type) snow-log)
       (return (the-as
                 object
                 (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete)))
                 )
               )
       v0-2
       )
     )
    )
  )

;; failed to figure out what this is:
(defstate snow-log-button-idle-up (snow-log-button)
  :event snow-log-button-event-handler
  :code (behavior ()
    (loop
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    (none)
    )
  )

;; failed to figure out what this is:
(defstate snow-log-button-activate (snow-log-button)
  :event snow-log-button-event-handler
  :exit (behavior ()
    (logior! (-> self mask) (process-mask actor-pause))
    (process-entity-status! self (entity-perm-status bit-3) #f)
    (none)
    )
  :trans (the-as (function none :behavior snow-log-button) rider-trans)
  :code (behavior ()
    (sound-play "prec-button1")
    (loop
      (let ((f30-0 (+ -1433.6 (-> self orig-trans y))))
        (when (= (-> self root-override trans y) f30-0)
          (let ((a1-1 (new 'stack-no-clear 'event-message-block)))
            (set! (-> a1-1 from) self)
            (set! (-> a1-1 num-params) 0)
            (set! (-> a1-1 message) 'trigger)
            (let ((t9-2 send-event-function)
                  (v1-4 (-> self log))
                  )
              (t9-2
                (if v1-4
                    (-> v1-4 extra process)
                    )
                a1-1
                )
              )
            )
          (go snow-log-button-idle-down)
          )
        (set! (-> self root-override trans y) (seek-with-smooth
                                                (-> self root-override trans y)
                                                f30-0
                                                (* 12288.0 (-> *display* seconds-per-frame))
                                                0.2
                                                204.8
                                                )
              )
        )
      (suspend)
      )
    (none)
    )
  :post (the-as (function none :behavior snow-log-button) rider-post)
  )

;; failed to figure out what this is:
(defstate snow-log-button-idle-down (snow-log-button)
  :event snow-log-button-event-handler
  :code (behavior ()
    (set! (-> self root-override trans quad) (-> self orig-trans quad))
    (set! (-> self root-override trans y) (+ -1433.6 (-> self root-override trans y)))
    (transform-post)
    (loop
      (logior! (-> self mask) (process-mask sleep-code))
      (suspend)
      )
    (none)
    )
  )

;; definition for method 11 of type snow-log-button
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(defmethod init-from-entity! snow-log-button ((obj snow-log-button) (arg0 entity-actor))
  (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))))
    (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s4-0 reaction) default-collision-reaction)
    (set! (-> s4-0 no-reaction)
          (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
          )
    (alloc-riders s4-0 1)
    (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0))))
      (set! (-> s3-0 prim-core collide-as) (collide-kind ground-object))
      (set! (-> s3-0 collide-with) (collide-kind target))
      (set! (-> s3-0 prim-core action) (collide-action solid ca-1))
      (set! (-> s3-0 prim-core offense) (collide-offense indestructible))
      (set! (-> s3-0 transform-index) 3)
      (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 8192.0)
      (set-root-prim! s4-0 s3-0)
      )
    (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
    (backup-collide-with-as s4-0)
    (set! (-> obj root-override) s4-0)
    )
  (process-drawable-from-entity! obj arg0)
  (initialize-skeleton obj *snow-switch-sg* '())
  (logior! (-> obj skel status) (janim-status inited))
  (ja-channel-push! 1 0)
  (let ((s4-1 (-> obj skel root-channel 0)))
    (joint-control-channel-group-eval!
      s4-1
      (the-as art-joint-anim (-> obj draw art-group data 2))
      num-func-identity
      )
    (set! (-> s4-1 frame-num) 0.0)
    )
  (transform-post)
  (set! (-> obj orig-trans quad) (-> obj root-override trans quad))
  (set! (-> obj log) (entity-actor-lookup arg0 'alt-actor 0))
  (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status complete)))
      (go snow-log-button-idle-down)
      (go snow-log-button-idle-up)
      )
  (none)
  )
