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

;; name: forest-ring-chase.gc
;; name in dgo: forest-ring-chase
;; dgos: FRSTA

;; DECOMP BEGINS

;; WARN: Return type mismatch symbol vs none.
(defun-debug print-ring-positions ()
  (let ((gp-0 (level-get *level* 'lforring)))
    (when gp-0
      (format #t "~%")
      (let ((gp-1 (-> gp-0 bsp actors)))
        (when (nonzero? gp-1)
          (dotimes (s5-0 (-> gp-1 length))
            (let* ((s4-0 (-> gp-1 data s5-0 actor))
                   (s3-0 ((method-of-type res-lump get-property-struct)
                          s4-0
                          'name
                          'interp
                          -1000000000.0
                          ""
                          (the-as (pointer res-tag) #f)
                          *res-static-buf*
                          )
                         )
                   )
              (when (string-prefix= "for-race-ring" (the-as string s3-0))
                (let ((s4-1 (-> s4-0 extra trans)))
                  (format #t "~s~%" s3-0)
                  (format #t "~T(static-vectorm ~M ~M ~M)~%" (-> s4-1 x) (-> s4-1 y) (-> s4-1 z))
                  )
                (format #t "~%")
                )
              )
            )
          )
        )
      )
    )
  (none)
  )

(defpartgroup group-forest-ring
  :id 589
  :duration (seconds 218.45)
  :linger-duration (seconds 0)
  :bounds (static-bspherem 0 0 0 8)
  :parts ((sp-item 2291 :flags (is-3d sp3 sp6 sp7))
    (sp-item 2291 :flags (is-3d sp3 sp6 sp7))
    (sp-item 2291 :flags (is-3d sp3 sp6 sp7))
    (sp-item 2291 :flags (is-3d sp3 sp6 sp7))
    (sp-item 2291 :flags (is-3d sp3 sp6 sp7))
    (sp-item 2291 :flags (is-3d sp3 sp6 sp7))
    (sp-item 2292 :flags (is-3d sp7))
    (sp-item 2292 :flags (is-3d sp7))
    )
  )

(defpart 2291
  :init-specs ((:texture (racegate lforring-sprite))
    (:num 1.0)
    (:scale-x (meters 12))
    (:scale-y :copy scale-x)
    (:r 40.0)
    (:g 80.0)
    (:b 255.0)
    (:a 64.0)
    (:rotvel-y (degrees 0.026666665) (degrees 0.033333335))
    (:timer (seconds -0.005))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
    (:rotate-x (degrees -90) 1 (degrees 180))
    (:rotate-z (degrees -90) (degrees 180))
    )
  )

(defpart 2292
  :init-specs ((:texture (splash-foam level-default-sprite))
    (:num 0.0 0.5)
    (:scale-x (meters 12) (meters 1))
    (:scale-y :copy scale-x)
    (:r 10.0)
    (:g 0.0 64.0)
    (:b 255.0)
    (:a 0.0)
    (:scalevel-x (meters -0.093333334))
    (:scalevel-y :copy scalevel-x)
    (:fade-a 6.4)
    (:timer (seconds 0.5))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat))
    (:next-time (seconds 0.067))
    (:next-launcher 2293)
    (:rotate-x (degrees -90))
    (:rotate-z (degrees -90) (degrees 180))
    )
  )

(defpart 2293
  :init-specs ((:fade-a -1.28))
  )

(defpartgroup group-forest-ring-final
  :id 590
  :duration (seconds 218.45)
  :linger-duration (seconds 0)
  :bounds (static-bspherem 0 0 0 8)
  :parts ((sp-item 2294 :flags (is-3d sp3 sp6 sp7))
    (sp-item 2294 :flags (is-3d sp3 sp6 sp7))
    (sp-item 2294 :flags (is-3d sp3 sp6 sp7))
    (sp-item 2294 :flags (is-3d sp3 sp6 sp7))
    (sp-item 2294 :flags (is-3d sp3 sp6 sp7))
    (sp-item 2294 :flags (is-3d sp3 sp6 sp7))
    (sp-item 2295 :flags (is-3d sp7))
    (sp-item 2295 :flags (is-3d sp7))
    )
  )

(defpart 2294
  :init-specs ((:texture (racegate lforring-sprite))
    (:num 1.0)
    (:scale-x (meters 12))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 80.0)
    (:b 40.0)
    (:a 64.0)
    (:rotvel-y (degrees 0.026666665) (degrees 0.033333335))
    (:timer (seconds -0.005))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
    (:rotate-x (degrees -90) 1 (degrees 180))
    (:rotate-z (degrees -90) (degrees 180))
    )
  )

(defpart 2295
  :init-specs ((:texture (splash-foam level-default-sprite))
    (:num 0.0 0.5)
    (:scale-x (meters 12) (meters 1))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 0.0 64.0)
    (:b 10.0)
    (:a 0.0)
    (:scalevel-x (meters -0.093333334))
    (:scalevel-y :copy scalevel-x)
    (:fade-a 6.4)
    (:timer (seconds 0.5))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat))
    (:next-time (seconds 0.067))
    (:next-launcher 2293)
    (:rotate-x (degrees -90))
    (:rotate-z (degrees -90) (degrees 180))
    )
  )

(defpartgroup group-forest-ring-explode
  :id 591
  :duration (seconds 0.067)
  :linger-duration (seconds 0.5)
  :flags (sp0 sp4)
  :bounds (static-bspherem 0 0 0 8)
  :parts ((sp-item 2296 :flags (sp3 sp7)) (sp-item 2297 :flags (sp6 sp7)))
  )

(defpart 2296
  :init-specs ((:texture (middot level-default-sprite))
    (:num 200.0)
    (:x (meters 5.8))
    (:scale-x (meters 0.3))
    (:scale-y :copy scale-x)
    (:r 40.0)
    (:g 80.0)
    (:b 255.0)
    (:a 64.0)
    (:omega (degrees 0.225))
    (:vel-x (meters 0.06666667) (meters 0.06666667))
    (:friction 0.9)
    (:timer (seconds 1))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3))
    (:func 'sparticle-motion-blur)
    (:rotate-y (degrees 0))
    (:rotate-z (degrees 0) (degrees 3600))
    )
  )

(defpart 2297
  :init-specs ((:texture (glow-soft level-default-sprite))
    (:num 1.0)
    (:scale-x (meters 36))
    (:scale-y :copy scale-x)
    (:r 120.0)
    (:g 120.0)
    (:b 120.0)
    (:a 20.0)
    (:fade-r -17.0)
    (:fade-g -8.5)
    (:fade-b 0.0)
    (:fade-a -0.6666667)
    (:timer (seconds 0.1))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
    (:userdata 0.0)
    (:rotate-x (degrees -90))
    )
  )

(defpartgroup group-forest-ring-explode-final
  :id 592
  :duration (seconds 0.067)
  :linger-duration (seconds 0.5)
  :flags (sp0 sp4)
  :bounds (static-bspherem 0 0 0 8)
  :parts ((sp-item 2298 :flags (sp3 sp7)) (sp-item 2299 :flags (sp6 sp7)))
  )

(defpart 2298
  :init-specs ((:texture (middot level-default-sprite))
    (:num 200.0)
    (:x (meters 5.8))
    (:scale-x (meters 0.3))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 80.0)
    (:b 40.0)
    (:a 64.0)
    (:omega (degrees 0.225))
    (:vel-x (meters 0.06666667) (meters 0.06666667))
    (:friction 0.9)
    (:timer (seconds 1))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3))
    (:func 'sparticle-motion-blur)
    (:rotate-y (degrees 0))
    (:rotate-z (degrees 0) (degrees 3600))
    )
  )

(defpart 2299
  :init-specs ((:texture (glow-soft level-default-sprite))
    (:num 1.0)
    (:scale-x (meters 36))
    (:scale-y :copy scale-x)
    (:r 120.0)
    (:g 120.0)
    (:b 120.0)
    (:a 20.0)
    (:fade-r -17.0)
    (:fade-g -8.5)
    (:fade-b 0.0)
    (:fade-a -0.6666667)
    (:timer (seconds 0.1))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow))
    (:userdata 0.0)
    (:rotate-x (degrees -90))
    )
  )

(defpartgroup group-forest-ring-birth
  :id 593
  :duration (seconds 0.067)
  :linger-duration (seconds 0.5)
  :flags (sp0 sp4)
  :bounds (static-bspherem 0 0 0 8)
  :parts ((sp-item 2300 :flags (sp3 sp7)) (sp-item 2297 :flags (sp6 sp7)))
  )

(defpart 2300
  :init-specs ((:texture (middot level-default-sprite))
    (:num 100.0)
    (:x (meters 0.1))
    (:scale-x (meters 0.3))
    (:scale-y :copy scale-x)
    (:r 40.0)
    (:g 80.0)
    (:b 255.0)
    (:a 64.0)
    (:omega (degrees 0.225))
    (:vel-x (meters 0.28333333) (meters 0.006666667))
    (:scalevel-x (meters 0.013333334))
    (:scalevel-y :copy scalevel-x)
    (:fade-a -0.256 -0.256)
    (:friction 0.8)
    (:timer (seconds 0.835))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3))
    (:func 'sparticle-motion-blur)
    (:next-time (seconds 0.3))
    (:next-launcher 2301)
    (:rotate-y (degrees 0))
    (:rotate-z (degrees 0) (degrees 3600))
    )
  )

(defpart 2301
  :init-specs ((:func 'none))
  )

(defpart 2302
  :init-specs ((:texture (racegate lforring-sprite))
    (:num 1.0)
    (:r 40.0)
    (:g 80.0)
    (:b 255.0)
    (:a 64.0)
    (:scalevel-x (meters 0.1))
    (:rotvel-y (degrees 0.026666665) (degrees 0.033333335))
    (:scalevel-y :copy scalevel-x)
    (:fade-a 0.53333336)
    (:timer (seconds 0.4))
    (:flags (sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
    (:rotate-x (degrees -90))
    (:rotate-z (degrees -90) (degrees 180))
    )
  )

(defpartgroup group-forest-ring-birth-final
  :id 594
  :duration (seconds 0.067)
  :linger-duration (seconds 0.5)
  :flags (sp0 sp4)
  :bounds (static-bspherem 0 0 0 8)
  :parts ((sp-item 2303 :flags (sp3 sp7)) (sp-item 2299 :flags (sp6 sp7)))
  )

(defpart 2303
  :init-specs ((:texture (middot level-default-sprite))
    (:num 100.0)
    (:x (meters 0.1))
    (:scale-x (meters 0.3))
    (:scale-y :copy scale-x)
    (:r 255.0)
    (:g 80.0)
    (:b 40.0)
    (:a 64.0)
    (:omega (degrees 0.225))
    (:vel-x (meters 0.28333333) (meters 0.006666667))
    (:scalevel-x (meters 0.013333334))
    (:scalevel-y :copy scalevel-x)
    (:fade-a -0.256 -0.256)
    (:friction 0.8)
    (:timer (seconds 0.835))
    (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3))
    (:func 'sparticle-motion-blur)
    (:next-time (seconds 0.3))
    (:next-launcher 2301)
    (:rotate-y (degrees 0))
    (:rotate-z (degrees 0) (degrees 3600))
    )
  )

(defpart 2304
  :init-specs ((:texture (racegate lforring-sprite))
    (:num 1.0)
    (:r 255.0)
    (:g 80.0)
    (:b 40.0)
    (:a 64.0)
    (:scalevel-x (meters 0.1))
    (:rotvel-y (degrees 0.026666665) (degrees 0.033333335))
    (:scalevel-y :copy scalevel-x)
    (:fade-a 0.53333336)
    (:timer (seconds 0.4))
    (:flags (sp-cpuinfo-flag-3 sp-cpuinfo-flag-14))
    (:rotate-x (degrees -90))
    (:rotate-z (degrees -90) (degrees 180))
    )
  )

(deftype for-race-ring-finder (process-drawable)
  ((path-pos           float)
   (sound-id           sound-id)
   (ring-finder-speed  float)
   (part-subsampler    sparticle-subsampler)
   )
  (:state-methods
    find
    die
    )
  (:methods
    (for-race-ring-finder-method-22 (_type_) vector)
    )
  )


(defmethod for-race-ring-finder-method-22 ((this for-race-ring-finder))
  (with-pp
    (let ((a1-0 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-0 from) (process->ppointer pp))
      (set! (-> a1-0 num-params) 0)
      (set! (-> a1-0 message) 'get-path)
      (let ((s5-0 (the-as path-control (send-event-function (ppointer->process (-> this parent)) a1-0))))
        0.0
        (let ((f30-0 90.0))
          1.0
          (when s5-0
            (let* ((f0-4 (/ f30-0 (* 0.00024414062 (total-distance s5-0))))
                   (f1-1 (* (-> this ring-finder-speed) f0-4))
                   (f30-1 (fmax 0.0 (fmin 245760.0 f1-1)))
                   )
              (set! (-> this path-pos) (path-control-method-26 s5-0 (-> this path-pos) (* f30-1 (seconds-per-frame))))
              (let ((s5-1 (get-point-at-percent-along-path! s5-0 (new 'stack-no-clear 'vector) (-> this path-pos) 'interp)))
                (let ((f0-11 (vector-vector-distance-squared s5-1 (-> this root trans))))
                  (when (and (= (-> this path-pos) 1.0) (let ((f1-4 4096.0))
                                                          (< f0-11 (* f1-4 f1-4))
                                                          )
                             )
                    (send-event (ppointer->process (-> this parent)) 'found-ring)
                    (let ((a1-5 (new 'stack-no-clear 'event-message-block)))
                      (set! (-> a1-5 from) (process->ppointer pp))
                      (set! (-> a1-5 num-params) 0)
                      (set! (-> a1-5 message) 'get-current-ring-ent)
                      (let ((s4-0 (the-as entity-actor (send-event-function (ppointer->process (-> this parent)) a1-5))))
                        (cond
                          ((send-event (ppointer->process (-> this parent)) 'last-ring?)
                           (send-event
                             (if s4-0
                                 (-> s4-0 extra process)
                                 )
                             'trigger-final
                             )
                           )
                          (else
                            (let ((a1-8 (new 'stack-no-clear 'event-message-block)))
                              (set! (-> a1-8 from) (process->ppointer pp))
                              (set! (-> a1-8 num-params) 0)
                              (set! (-> a1-8 message) 'trigger)
                              (let ((v1-41 s4-0))
                                (send-event-function
                                  (if v1-41
                                      (-> v1-41 extra process)
                                      )
                                  a1-8
                                  )
                                )
                              )
                            )
                          )
                        )
                      )
                    (cond
                      ((logtest? (-> group-for-ring-finder-explosion flags) (sp-group-flag sp13))
                       (vector-copy! (-> *launch-matrix* trans) (-> this root trans))
                       (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-for-ring-finder-explosion)
                       )
                      (else
                        (vector-copy! (-> *launch-matrix* trans) (-> this root trans))
                        (part-tracker-spawn part-tracker :to *entity-pool* :group group-for-ring-finder-explosion)
                        )
                      )
                    (go (method-of-object this die))
                    )
                  )
                (spawn (-> this part) (-> this root trans))
                (init-with-vec! (-> this part-subsampler) (-> this root trans))
                (cond
                  ((< (-> this path-pos) 0.8)
                   (let ((s3-0 (new 'stack-no-clear 'vector))
                         (s4-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this root transv) 1.0))
                         )
                     0.0
                     0.0
                     (vector-! s3-0 s5-1 (-> this root trans))
                     (vector-length s3-0)
                     (vector-normalize! s3-0 1.0)
                     (let ((f0-18 (vector-dot s3-0 s4-3)))
                       (cond
                         ((< 0.9999 f0-18)
                          (vector-copy! s4-3 s3-0)
                          )
                         (else
                           (let ((s5-2 (new 'stack-no-clear 'vector))
                                 (f28-1 0.0)
                                 (f26-0 (acos f0-18))
                                 )
                             (vector-cross! s5-2 s3-0 s4-3)
                             (vector-normalize! s5-2 1.0)
                             (let ((f0-21 (deg-seek f28-1 f26-0 (* 49152.0 (seconds-per-frame)))))
                               (vector-rotate-around-axis! s4-3 s4-3 (* -1.0 f0-21) s5-2)
                               )
                             )
                           )
                         )
                       )
                     (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> this root trans) s4-3 (meters 1) *color-yellow*)
                     (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> this root trans) s3-0 (meters 1) *color-dark-yellow*)
                     (vector-copy! (-> this root transv) s4-3)
                     )
                   (vector-normalize! (-> this root transv) f30-1)
                   )
                  (else
                    (vector-normalize! (vector-normalize! (vector-! (-> this root transv) s5-1 (-> this root trans)) 1.0) f30-1)
                    )
                  )
                )
              )
            (vector-v++! (-> this root trans) (-> this root transv))
            )
          )
        )
      )
    )
  )

(defstate find (for-race-ring-finder)
  :virtual #t
  :trans (behavior ()
    (for-race-ring-finder-method-22 self)
    )
  :code sleep-code
  :post (behavior ()
    (sound-play-by-name
      (static-sound-name "flying-pixie")
      (-> self sound-id)
      1024
      (the int (* 1524.0 (doppler-pitch-shift (-> self root trans) (-> self root transv))))
      0
      (sound-group)
      #t
      )
    )
  )

(defstate die (for-race-ring-finder)
  :virtual #t
  :code (behavior ()
    (if (nonzero? (-> self sound-id))
        (sound-stop (-> self sound-id))
        )
    (suspend-for (seconds 8)
      )
    )
  )

(defmethod run-logic? ((this for-race-ring-finder))
  "Should this process be run? Checked by execute-process-tree."
  #t
  )

(defmethod deactivate ((this for-race-ring-finder))
  "Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
  (if (nonzero? (-> this sound-id))
      (sound-stop (-> this sound-id))
      )
  ((method-of-type process-drawable deactivate) this)
  (none)
  )

;; WARN: Return type mismatch float vs object.
(defmethod init-from-entity! ((this for-race-ring-finder) (arg0 entity-actor))
  "Set up a newly created process from the entity that created it."
  (process-entity-status! this (entity-perm-status dead) #t)
  (set! (-> this ring-finder-speed) 163840.0)
  )

(defbehavior for-race-ring-finder-init-by-other for-race-ring-finder ((arg0 vector) (arg1 entity))
  (process-entity-set! self arg1)
  (set! (-> self root) (new 'process 'trsqv))
  (vector-copy! (-> self root trans) arg0)
  (logclear! (-> self mask) (process-mask actor-pause))
  (set! (-> self path-pos) 0.0)
  (set! (-> self ring-finder-speed) 163840.0)
  (let ((a1-2 (new 'stack-no-clear 'event-message-block)))
    (set! (-> a1-2 from) (process->ppointer self))
    (set! (-> a1-2 num-params) 0)
    (set! (-> a1-2 message) 'get-path)
    (let ((a0-7 (the-as path-control (send-event-function (ppointer->process (-> self parent)) a1-2))))
      (if a0-7
          (displacement-between-points-at-percent-normalized! a0-7 (-> self root transv) (-> self path-pos))
          )
      )
    )
  (set! (-> self part) (create-launch-control group-for-ring-finder self))
  self
  (set! (-> self part-subsampler)
        (new 'process 'sparticle-subsampler *sp-particle-system-2d* (-> *part-id-table* 2254) 3.0)
        )
  (set! (-> self sound-id) (new-sound-id))
  (go-virtual find)
  )

;; WARN: Return type mismatch process-drawable vs for-race-ring-finder.
(defmethod relocate ((this for-race-ring-finder) (offset int))
  (if (nonzero? (-> this part-subsampler))
      (&+! (-> this part-subsampler) offset)
      )
  (the-as for-race-ring-finder ((method-of-type process-drawable relocate) this offset))
  )

(deftype for-race-ring (process-drawable)
  ((mat         matrix  :inline)
   (taskman     handle)
   (is-final?   symbol)
   (part-final  sparticle-launch-control)
   )
  (:state-methods
    dormant
    idle
    die
    )
  (:methods
    (for-race-ring-method-23 (_type_) none)
    )
  )


(defun for-race-ring-cleared? ((arg0 quaternion) (arg1 vector))
  (let ((s5-0 (new 'stack-no-clear 'vector)))
    (and (< (fabs (vector-dot (vector-x-quaternion! s5-0 arg0) arg1)) 24576.0)
         (< (fabs (vector-dot (vector-y-quaternion! s5-0 arg0) arg1)) 24576.0)
         (< (fabs (vector-dot (vector-z-quaternion! s5-0 arg0) arg1)) 4096.0)
         )
    )
  )

(defstate dormant (for-race-ring)
  :virtual #t
  :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
    (case message
      (('trigger)
       (go-virtual idle)
       )
      (('trigger-final)
       (set! (-> self is-final?) #t)
       (go-virtual idle)
       )
      )
    )
  :trans (behavior ()
    0
    )
  :code sleep-code
  :post (behavior ()
    0
    )
  )

(defstate idle (for-race-ring)
  :virtual #t
  :enter (behavior ()
    (let ((v1-2 (-> *game-info* sub-task-list (game-task-node forest-ring-chase-statues))))
      (set! (-> self taskman) (if (-> v1-2 manager)
                                  (-> v1-2 manager manager)
                                  (the-as handle #f)
                                  )
            )
      )
    (cond
      ((-> self is-final?)
       (if (logtest? (-> group-forest-ring-birth-final flags) (sp-group-flag sp13))
           (part-tracker-spawn
             part-tracker-subsampler
             :to self
             :group group-forest-ring-birth-final
             :mat-joint (-> self mat)
             )
           (part-tracker-spawn part-tracker :to self :group group-forest-ring-birth-final :mat-joint (-> self mat))
           )
       )
      ((logtest? (-> group-forest-ring-birth flags) (sp-group-flag sp13))
       (part-tracker-spawn part-tracker-subsampler :to self :group group-forest-ring-birth :mat-joint (-> self mat))
       )
      (else
        (part-tracker-spawn part-tracker :to self :group group-forest-ring-birth :mat-joint (-> self mat))
        )
      )
    (sound-play "ring-create")
    (set-time! (-> self state-time))
    )
  :trans (behavior ()
    (when (handle->process (-> self taskman))
      (let ((v1-3 *target*)
            (a1-1 (new 'stack-no-clear 'vector))
            )
        (when v1-3
          (cond
            ((focus-test? v1-3 pilot)
             (let ((a2-1 (handle->process (-> v1-3 pilot vehicle))))
               (vector-copy!
                 a1-1
                 (-> (the-as collide-shape (-> (the-as process-drawable a2-1) root)) root-prim prim-core world-sphere)
                 )
               )
             )
            (else
              (vector-copy! a1-1 (-> v1-3 control trans))
              (+! (-> a1-1 y) 8192.0)
              )
            )
          (vector-! a1-1 a1-1 (-> self root trans))
          (let ((a0-16 (-> self root quat)))
            (when (and (for-race-ring-cleared? a0-16 a1-1) (>= (-> *game-info* timer) (seconds 0.25)))
              (cond
                ((-> self is-final?)
                 (sound-play "ring-final")
                 (if (logtest? (-> group-forest-ring-explode-final flags) (sp-group-flag sp13))
                     (part-tracker-spawn
                       part-tracker-subsampler
                       :to self
                       :group group-forest-ring-explode-final
                       :mat-joint (-> self mat)
                       )
                     (part-tracker-spawn part-tracker :to self :group group-forest-ring-explode-final :mat-joint (-> self mat))
                     )
                 (if (nonzero? (-> self part-final))
                     (kill-particles (-> self part-final))
                     )
                 )
                (else
                  (sound-play "ring-pass")
                  (if (logtest? (-> group-forest-ring-explode flags) (sp-group-flag sp13))
                      (part-tracker-spawn
                        part-tracker-subsampler
                        :to self
                        :group group-forest-ring-explode
                        :mat-joint (-> self mat)
                        )
                      (part-tracker-spawn part-tracker :to self :group group-forest-ring-explode :mat-joint (-> self mat))
                      )
                  (if (nonzero? (-> self part))
                      (kill-particles (-> self part))
                      )
                  )
                )
              (send-event (handle->process (-> self taskman)) 'ring-hit)
              (go-virtual die)
              )
            )
          )
        )
      )
    )
  :code sleep-code
  :post (behavior ()
    (when (time-elapsed? (-> self state-time) (seconds 0.4))
      (cond
        ((-> self is-final?)
         (if (nonzero? (-> self part-final))
             (spawn-from-mat (-> self part-final) (-> self mat))
             )
         )
        (else
          (if (nonzero? (-> self part))
              (spawn-from-mat (-> self part) (-> self mat))
              )
          )
        )
      )
    )
  )

(defstate die (for-race-ring)
  :virtual #t
  :code (behavior ()
    (while (-> self child)
      (suspend)
      )
    )
  )

(defmethod run-logic? ((this for-race-ring))
  "Should this process be run? Checked by execute-process-tree."
  #t
  )

(defmethod for-race-ring-method-23 ((this for-race-ring))
  (set! (-> this root) (new 'process 'trsqv))
  0
  (none)
  )

;; WARN: Return type mismatch process-drawable vs for-race-ring.
(defmethod relocate ((this for-race-ring) (offset int))
  (if (nonzero? (-> this part-final))
      (&+! (-> this part-final) offset)
      )
  (the-as for-race-ring ((method-of-type process-drawable relocate) this offset))
  )

(defmethod deactivate ((this for-race-ring))
  "Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
  (if (nonzero? (-> this part-final))
      (kill-particles (-> this part-final))
      )
  ((method-of-type process-drawable deactivate) this)
  (none)
  )

(defmethod init-from-entity! ((this for-race-ring) (arg0 entity-actor))
  "Set up a newly created process from the entity that created it."
  (for-race-ring-method-23 this)
  (process-drawable-from-entity! this arg0)
  (quaternion->matrix (-> this mat) (-> this root quat))
  (vector-copy! (-> this mat trans) (-> this root trans))
  (set! (-> this part) (create-launch-control group-forest-ring this))
  (set! (-> this part-final) (create-launch-control group-forest-ring-final this))
  (logclear! (-> this mask) (process-mask actor-pause))
  (set! (-> this is-final?) #f)
  (go (method-of-object this dormant))
  )

(define *for-statue-played-hint?* (the-as object #f))

(deftype for-statue (process-drawable)
  ((root       collide-shape :override)
   (id         int32)
   (sound-id   sound-id)
   (part-eyes  sparticle-launch-control)
   (alpha      float)
   )
  (:state-methods
    dormant
    idle
    rise
    active
    open-eyes
    complete
    explode
    )
  (:methods
    (for-statue-method-27 (_type_) none)
    (for-statue-method-28 (_type_) none)
    )
  )


(defskelgroup skel-for-statue for-statue for-statue-lod0-jg for-statue-idle-ja
              ((for-statue-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 4 0 10)
              :origin-joint-index 3
              )

(defskelgroup skel-for-statue-debris-arrow for-statue for-statue-debris-arrow-lod0-jg -1
              ((for-statue-debris-arrow-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 5)
              )

(defskelgroup skel-for-statue-debris-chunk for-statue for-statue-debris-chunk-lod0-jg -1
              ((for-statue-debris-chunk-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 5)
              )

(defskelgroup skel-for-statue-debris-eye for-statue for-statue-debris-eye-lod0-jg -1
              ((for-statue-debris-eye-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 5)
              )

(define *for-statue-debris-params*
  (new 'static 'debris-static-params
    :joints (new 'static 'boxed-array :type debris-static-joint-params
      (new 'static 'debris-static-joint-params :parent-joint-index 5 :group "skel-for-statue-debris-eye")
      (new 'static 'debris-static-joint-params :parent-joint-index 7 :group "skel-for-statue-debris-eye")
      (new 'static 'debris-static-joint-params :parent-joint-index 4 :group "skel-for-statue-debris-arrow")
      (new 'static 'debris-static-joint-params :parent-joint-index 3 :group "skel-for-statue-debris-chunk")
      (new 'static 'debris-static-joint-params :parent-joint-index 4 :group "skel-for-statue-debris-chunk")
      (new 'static 'debris-static-joint-params :parent-joint-index 6 :group "skel-for-statue-debris-chunk")
      (new 'static 'debris-static-joint-params :parent-joint-index 8 :group "skel-for-statue-debris-chunk")
      )
    :collide-spec (collide-spec backgnd)
    )
  )

(defstate dormant (for-statue)
  :virtual #t
  :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
    (case message
      (('trigger)
       (go-virtual idle)
       )
      )
    )
  :enter (behavior ()
    (+! (-> self root trans y) -32768.0)
    )
  :code (behavior ()
    (ja :group! (ja-group) :num! min)
    (transform-and-sleep-code)
    )
  )

(defstate idle (for-statue)
  :virtual #t
  :trans (behavior ()
    (if (and *target* (and (>= 122880.0 (vector-vector-distance (-> self root trans) (-> *target* control trans)))
                           (not (logtest? (focus-status teleporting) (-> *target* focus-status)))
                           )
             )
        (go-virtual rise)
        )
    )
  :code sleep-code
  )

(defstate rise (for-statue)
  :virtual #t
  :enter (behavior ()
    (sound-play "statue-rise")
    )
  :trans (behavior ()
    (let ((f30-0 (-> self entity extra trans y)))
      (set! (-> self root trans y)
            (seek-ease (-> self root trans y) f30-0 (* 8192.0 (seconds-per-frame)) 4096.0 (* 4096.0 (seconds-per-frame)))
            )
      (if (= (-> self root trans y) f30-0)
          (go-virtual active)
          )
      )
    )
  :code sleep-code
  :post (behavior ()
    (rider-post)
    (spawn (-> self part) (-> self entity extra trans))
    )
  )

(defstate active (for-statue)
  :virtual #t
  :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
    (case message
      (('open-eyes)
       (go-virtual open-eyes)
       )
      (('attack)
       (-> block param 1)
       (let* ((gp-0 (the-as touching-shapes-entry (-> block param 0)))
              (s5-0 (if gp-0
                        (-> gp-0 head)
                        (the-as touching-prims-entry #f)
                        )
                    )
              )
         (while s5-0
           (let ((v1-7 (get-touched-prim s5-0 (-> self root) gp-0)))
             (when (= (-> v1-7 prim-id) #xf15717)
               (sound-play "punch-statue")
               (go-virtual open-eyes)
               )
             )
           (set! s5-0 (-> s5-0 next))
           )
         )
       #f
       )
      (('explode)
       (go-virtual explode)
       )
      )
    )
  :enter (behavior ()
    (set-time! (-> self state-time))
    )
  :trans (behavior ()
    (when (and (not *for-statue-played-hint?*)
               (time-elapsed? (-> self state-time) (seconds 10))
               (< (if *target*
                      (vector-vector-xz-distance (-> self root trans) (-> *target* control trans))
                      4096000.0
                      )
                  102400.0
                  )
               )
      (talker-spawn-func (-> *talker-speech* 105) *entity-pool* (target-pos 0) (the-as region #f))
      (set! *for-statue-played-hint?* #t)
      )
    )
  :code (behavior ()
    (ja :group! (ja-group) :num! min)
    (transform-and-sleep-code)
    )
  )

(defstate open-eyes (for-statue)
  :virtual #t
  :code (behavior ()
    (ja-no-eval :group! for-statue-open-eyes-ja :num! (seek!) :frame-num 0.0)
    (until (ja-done? 0)
      (suspend)
      (ja :num! (seek!))
      )
    (go-virtual complete)
    )
  :post (behavior ()
    (when (nonzero? (-> self part-eyes))
      (seek! (-> self alpha) 64.0 (* 128.0 (seconds-per-frame)))
      (set! (-> *part-id-table* 2290 init-specs 8 initial-valuef) (-> self alpha))
      (spawn-from-cspace (-> self part-eyes) (joint-node for-statue-lod0-jg L_eyelid_bottom))
      (spawn-from-cspace (-> self part-eyes) (joint-node for-statue-lod0-jg R_eyelid_bottom))
      )
    (transform-post)
    )
  )

(defstate complete (for-statue)
  :virtual #t
  :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
    (case message
      (('explode 'trigger)
       (go-virtual explode)
       )
      )
    )
  :enter (behavior ()
    (set! (-> *part-id-table* 2290 init-specs 8 initial-valuef) 64.0)
    (set! (-> *part-id-table* 2290 init-specs 8 random-rangef) 4.0)
    )
  :trans (behavior ()
    (when (nonzero? (-> self part-eyes))
      (spawn-from-cspace (-> self part-eyes) (joint-node for-statue-lod0-jg L_eyelid_bottom))
      (spawn-from-cspace (-> self part-eyes) (joint-node for-statue-lod0-jg R_eyelid_bottom))
      )
    )
  :code (behavior ()
    (process-entity-status! self (entity-perm-status subtask-complete) #t)
    (ja :group! for-statue-open-eyes-ja :num! max)
    (transform-and-sleep-code)
    )
  )

(defstate explode (for-statue)
  :virtual #t
  :code (behavior ()
    (cond
      ((logtest? (-> group-for-statue-buildup flags) (sp-group-flag sp13))
       (vector-copy! (-> *launch-matrix* trans) (-> self node-list data 3 bone transform trans))
       (part-tracker-spawn part-tracker-subsampler :to self :group group-for-statue-buildup :duration (seconds 1))
       )
      (else
        (vector-copy! (-> *launch-matrix* trans) (-> self node-list data 3 bone transform trans))
        (part-tracker-spawn part-tracker :to self :group group-for-statue-buildup :duration (seconds 1))
        )
      )
    (suspend-for (seconds 1)
      (if (nonzero? (-> self sound-id))
          (sound-play "statue-expl-bu" :id (-> self sound-id))
          )
      )
    (if (nonzero? (-> self sound-id))
        (sound-stop (-> self sound-id))
        )
    (cond
      ((logtest? (-> group-for-statue-explode flags) (sp-group-flag sp13))
       (vector-copy! (-> *launch-matrix* trans) (-> self node-list data 3 bone transform trans))
       (part-tracker-spawn
         part-tracker-subsampler
         :to *entity-pool*
         :group group-for-statue-explode
         :duration (seconds 1)
         )
       )
      (else
        (vector-copy! (-> *launch-matrix* trans) (-> self node-list data 3 bone transform trans))
        (part-tracker-spawn part-tracker :to *entity-pool* :group group-for-statue-explode :duration (seconds 1))
        )
      )
    (when (type? (-> self root) collide-shape)
      (let ((v1-78 (-> self root root-prim)))
        (set! (-> v1-78 prim-core collide-as) (collide-spec))
        (set! (-> v1-78 prim-core collide-with) (collide-spec))
        )
      0
      )
    (logior! (-> self draw status) (draw-control-status no-draw))
    (transform-post)
    (sound-play "statue-explode")
    (for-statue-method-28 self)
    (suspend-for (seconds 3)
      )
    (cleanup-for-death self)
    (let ((a1-15 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-15 from) (process->ppointer self))
      (set! (-> a1-15 num-params) 0)
      (set! (-> a1-15 message) 'statue-explode)
      (let ((t9-20 send-event-function)
            (v1-97 (-> *game-info* sub-task-list (game-task-node forest-ring-chase-statues)))
            )
        (t9-20
          (handle->process (if (-> v1-97 manager)
                               (-> v1-97 manager manager)
                               (the-as handle #f)
                               )
                           )
          a1-15
          )
        )
      )
    (while (-> self child)
      (suspend)
      )
    )
  )

(defmethod for-statue-method-28 ((this for-statue))
  (let ((a1-1 (new 'stack 'debris-tuning (the-as uint 0))))
    (set! (-> a1-1 scale-rand-lo) 1.0)
    (set! (-> a1-1 scale-rand-hi) 1.0)
    (set! (-> a1-1 duration) (seconds 4))
    (debris-spawn this a1-1 *for-statue-debris-params* (the-as process-drawable #f))
    )
  0
  (none)
  )

(defmethod for-statue-method-27 ((this for-statue))
  (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player))))
    (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
    (set! (-> s5-0 reaction) cshape-reaction-default)
    (set! (-> s5-0 no-reaction)
          (the-as (function collide-shape-moving collide-query vector vector object) nothing)
          )
    (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0)))
      (set! (-> s5-0 total-prims) (the-as uint 3))
      (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle camera-blocker))
      (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list))
      (set! (-> s4-0 prim-core action) (collide-action solid rideable pull-rider-can-collide))
      (set! (-> s4-0 transform-index) 3)
      (set-vector! (-> s4-0 local-sphere) 0.0 16384.0 0.0 40960.0)
      (set! (-> s5-0 root-prim) s4-0)
      )
    (let ((v1-13 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint #xf15717))))
      (set! (-> v1-13 prim-core collide-as) (collide-spec obstacle camera-blocker))
      (set! (-> v1-13 prim-core collide-with) (collide-spec jak player-list))
      (set! (-> v1-13 prim-core action) (collide-action solid))
      (set! (-> v1-13 transform-index) 4)
      (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 8192.0)
      )
    (let ((v1-15 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0))))
      (set! (-> v1-15 prim-core collide-as) (collide-spec obstacle camera-blocker))
      (set! (-> v1-15 prim-core collide-with) (collide-spec jak player-list))
      (set! (-> v1-15 prim-core action) (collide-action solid rideable pull-rider-can-collide))
      (set! (-> v1-15 transform-index) 3)
      (set-vector! (-> v1-15 local-sphere) 0.0 16384.0 0.0 40960.0)
      )
    (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
    (let ((v1-18 (-> s5-0 root-prim)))
      (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as))
      (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with))
      )
    (set! (-> this root) s5-0)
    )
  0
  (none)
  )

(defmethod deactivate ((this for-statue))
  "Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
  (if (nonzero? (-> this sound-id))
      (sound-stop (-> this sound-id))
      )
  (if (nonzero? (-> this part-eyes))
      (kill-particles (-> this part-eyes))
      )
  ((method-of-type process-drawable deactivate) this)
  (none)
  )

;; WARN: Return type mismatch process-drawable vs for-statue.
(defmethod relocate ((this for-statue) (offset int))
  (if (nonzero? (-> this part-eyes))
      (&+! (-> this part-eyes) offset)
      )
  (the-as for-statue ((method-of-type process-drawable relocate) this offset))
  )

(defmethod init-from-entity! ((this for-statue) (arg0 entity-actor))
  "Set up a newly created process from the entity that created it."
  (with-pp
    (for-statue-method-27 this)
    (process-drawable-from-entity! this arg0)
    (initialize-skeleton
      this
      (the-as skeleton-group (art-group-get-by-name *level* "skel-for-statue" (the-as (pointer level) #f)))
      (the-as pair 0)
      )
    (logclear! (-> this mask) (process-mask actor-pause))
    (set! (-> this id)
          (res-lump-value (-> this entity) 'extra-id int :default (the-as uint128 -1) :time -1000000000.0)
          )
    (set! (-> this part-eyes) (create-launch-control group-for-statue-eyes this))
    (when (or (and (= (-> this id) 1) (task-node-closed? (game-task-node forest-ring-chase-statue-1)))
              (and (= (-> this id) 2) (task-node-closed? (game-task-node forest-ring-chase-statue-2)))
              (and (= (-> this id) 3) (task-node-closed? (game-task-node forest-ring-chase-statue-3)))
              (and (= (-> this id) 4) (task-node-closed? (game-task-node forest-ring-chase-statue-4)))
              (and (= (-> this id) 5) (task-node-closed? (game-task-node forest-ring-chase-statue-5)))
              )
      (process-entity-status! this (entity-perm-status dead) #t)
      (return #f)
      )
    (if (= (-> this id) 4)
        (set! (-> this part) (create-launch-control group-for-statue-rise-no-rocks this))
        (set! (-> this part) (create-launch-control group-for-statue-rise this))
        )
    (set! (-> this sound-id) (new-sound-id))
    (let ((a1-9 (new 'stack-no-clear 'event-message-block)))
      (set! (-> a1-9 from) (process->ppointer pp))
      (set! (-> a1-9 num-params) 0)
      (set! (-> a1-9 message) 'chase-started?)
      (let ((t9-15 send-event-function)
            (v1-39 (-> *game-info* sub-task-list (game-task-node forest-ring-chase-statues)))
            )
        (if (and (not (t9-15
                        (handle->process (if (-> v1-39 manager)
                                             (-> v1-39 manager manager)
                                             (the-as handle #f)
                                             )
                                         )
                        a1-9
                        )
                      )
                 (or (and (= (-> this id) 1) (task-node-closed? (game-task-node forest-ring-chase-statues)))
                     (and (= (-> this id) 2) (task-node-closed? (game-task-node forest-ring-chase-statue-1)))
                     (and (= (-> this id) 3) (task-node-closed? (game-task-node forest-ring-chase-statue-2)))
                     (and (= (-> this id) 4) (task-node-closed? (game-task-node forest-ring-chase-statue-3)))
                     (and (= (-> this id) 5) (task-node-closed? (game-task-node forest-ring-chase-statue-4)))
                     )
                 )
            (go (method-of-object this active))
            )
        )
      )
    (if (logtest? (-> this entity extra perm status) (entity-perm-status subtask-complete))
        (go (method-of-object this complete))
        (go (method-of-object this dormant))
        )
    )
  )

(deftype hud-forest-ring-chase (hud)
  ()
  )


(defmethod draw ((this hud-forest-ring-chase))
  (set-hud-piece-position! (-> this sprites 0) (the int (+ 462.0 (* 130.0 (-> this offset)))) 150)
  (format (clear (-> this strings 0 text)) "~D" (-> this values 0 current))
  (set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) 5 55)
  ((method-of-type hud draw) this)
  0
  (none)
  )

(defmethod update-values! ((this hud-forest-ring-chase))
  (set! (-> this values 0 target) (the int (-> *game-info* counter)))
  ((method-of-type hud update-values!) this)
  0
  (none)
  )

(defmethod init-callback ((this hud-forest-ring-chase))
  (set! (-> this level) (level-get *level* 'foresta))
  (set! (-> this gui-id)
        (add-process *gui-control* this (gui-channel hud-lower-right) (gui-action hidden) (-> this name) 81920.0 0)
        )
  (logior! (-> this flags) (hud-flags show))
  (set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-chase-statues-01 foresta-minimap)))
  (set! (-> this sprites 0 flags) (hud-sprite-flags hsf2))
  (set! (-> this sprites 0 scale-x) 1.0)
  (set! (-> this sprites 0 scale-y) 1.0)
  (alloc-string-if-needed this 0)
  (set! (-> this strings 0 scale) 1.0)
  (set! (-> this strings 0 flags) (font-flags kerning middle large))
  0
  (none)
  )

(define *for-ring-times*
  (the-as (array (array float))
    (new 'static 'boxed-array :type array
      (new 'static 'boxed-array :type float 10.0 8.0 7.0 9.0 8.0 7.0 6.0 6.0)
      (new 'static 'boxed-array :type float 10.0 7.0 6.0 5.0 8.0 7.0 6.0 6.0 5.0)
      (new 'static 'boxed-array :type float 10.0 7.0 7.0 6.0 9.0 9.0 8.0 10.0 10.0 10.0 8.0 7.0 7.0 9.0 7.0 7.0)
      (new 'static 'boxed-array :type float 10.0 8.0 6.0 7.0 7.0 6.0 7.0 6.0 5.0 7.0 7.0 6.0 5.0 6.0 6.0 6.0)
      (new 'static 'boxed-array :type float 10.0 7.0 6.0 6.0 7.0 7.0 7.0 7.0 7.0 6.0 7.0 7.0 6.0 6.0 5.0 5.0 7.0)
      )
    )
  )

(define *forest-path-array-lengths* (new 'static 'boxed-array :type int32 9 10 17 17 18))

(deftype forest-path-points-static (structure)
  ((points  (inline-array vector))
   )
  )


(deftype forest-path-array-static (structure)
  ((paths  (array forest-path-points-static))
   )
  )


(define *forest-path-point-lengths*
  (the-as (array (array int32)) (new 'static 'boxed-array :type array
                                  (new 'static 'boxed-array :type int32 3 4 5 7 4 4 5 4 2)
                                  (new 'static 'boxed-array :type int32 5 8 4 3 4 3 3 3 4 2)
                                  (new 'static 'boxed-array :type int32 9 3 2 3 4 7 5 5 4 2 5 4 4 4 5 3 2)
                                  (new 'static 'boxed-array :type int32 3 5 4 3 5 3 3 4 3 3 5 3 2 5 4 4 2)
                                  (new 'static 'boxed-array :type int32 2 4 3 2 4 4 4 5 5 3 3 3 2 3 3 4 3 2)
                                  )
                                )
  )

(define *forest-ring-paths* (new 'static 'boxed-array :type forest-path-array-static
                              (new 'static 'forest-path-array-static
                                :paths (new 'static 'boxed-array :type forest-path-points-static
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -2529528.8 :y 110690.305 :z 3928903.8 :w 1.0)
                                      (new 'static 'vector :x -2454179.5 :y 103296.2 :z 4023737.2 :w 1.0)
                                      (new 'static 'vector :x -2371444.8 :y 128800.766 :z 3799609.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2371444.8 :y 128800.766 :z 3799609.0 :w 1.0)
                                      (new 'static 'vector :x -2321019.8 :y 137154.97 :z 3749187.5 :w 1.0)
                                      (new 'static 'vector :x -2243308.0 :y 142055.42 :z 3762255.8 :w 1.0)
                                      (new 'static 'vector :x -2220261.5 :y 135154.48 :z 3949432.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 5
                                      (new 'static 'vector :x -2220261.5 :y 135154.48 :z 3949432.5 :w 1.0)
                                      (new 'static 'vector :x -2232402.0 :y 133611.52 :z 4050247.8 :w 1.0)
                                      (new 'static 'vector :x -2211267.5 :y 109772.8 :z 4135420.0 :w 1.0)
                                      (new 'static 'vector :x -2162196.5 :y 95762.43 :z 4201480.0 :w 1.0)
                                      (new 'static 'vector :x -2196565.5 :y 101670.09 :z 4239042.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 7
                                      (new 'static 'vector :x -2187534.2 :y 97191.94 :z 4250448.5 :w 1.0)
                                      (new 'static 'vector :x -2249431.8 :y 100070.195 :z 4246101.5 :w 1.0)
                                      (new 'static 'vector :x -2326028.0 :y 98022.195 :z 4196720.5 :w 1.0)
                                      (new 'static 'vector :x -2378958.8 :y 94438.195 :z 4118799.2 :w 1.0)
                                      (new 'static 'vector :x -2415336.8 :y 98068.89 :z 4117762.0 :w 1.0)
                                      (new 'static 'vector :x -2451368.0 :y 106249.01 :z 4133267.0 :w 1.0)
                                      (new 'static 'vector :x -2514705.5 :y 152267.58 :z 4241044.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2516998.2 :y 144748.95 :z 4240296.5 :w 1.0)
                                      (new 'static 'vector :x -2547597.0 :y 170826.55 :z 4326122.5 :w 1.0)
                                      (new 'static 'vector :x -2552627.2 :y 159948.8 :z 4376125.5 :w 1.0)
                                      (new 'static 'vector :x -2644577.0 :y 140661.14 :z 4418219.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2652074.8 :y 118546.02 :z 4415260.5 :w 1.0)
                                      (new 'static 'vector :x -2739955.2 :y 107407.36 :z 4442837.0 :w 1.0)
                                      (new 'static 'vector :x -2783588.0 :y 94954.29 :z 4407034.5 :w 1.0)
                                      (new 'static 'vector :x -2778501.0 :y 121220.305 :z 4337928.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 5
                                      (new 'static 'vector :x -2778501.0 :y 121220.305 :z 4337928.0 :w 1.0)
                                      (new 'static 'vector :x -2725252.8 :y 117820.62 :z 4293178.0 :w 1.0)
                                      (new 'static 'vector :x -2666680.0 :y 101187.99 :z 4260607.0 :w 1.0)
                                      (new 'static 'vector :x -2653374.5 :y 103951.56 :z 4234320.0 :w 1.0)
                                      (new 'static 'vector :x -2667700.2 :y 122297.14 :z 4186690.2 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2632306.8 :y 110863.16 :z 4191153.2 :w 1.0)
                                      (new 'static 'vector :x -2660977.5 :y 115283.555 :z 4152452.0 :w 1.0)
                                      (new 'static 'vector :x -2710159.2 :y 127467.52 :z 4065157.0 :w 1.0)
                                      (new 'static 'vector :x -2676600.8 :y 110863.56 :z 3992617.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 2
                                      (new 'static 'vector :x -2676600.8 :y 110863.56 :z 3992617.0 :w 1.0)
                                      (new 'static 'vector :x -2512806.8 :y 104334.13 :z 3911332.8 :w 1.0)
                                      )
                                    )
                                  )
                                )
                              (new 'static 'forest-path-array-static
                                :paths (new 'static 'boxed-array :type forest-path-points-static
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 5
                                      (new 'static 'vector :x -2855218.0 :y 119275.52 :z 4506519.0 :w 1.0)
                                      (new 'static 'vector :x -2872429.8 :y 127950.85 :z 4485952.0 :w 1.0)
                                      (new 'static 'vector :x -2916258.2 :y 113423.56 :z 4448938.0 :w 1.0)
                                      (new 'static 'vector :x -2991182.2 :y 114626.97 :z 4416028.0 :w 1.0)
                                      (new 'static 'vector :x -3109048.0 :y 136978.02 :z 4327185.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 8
                                      (new 'static 'vector :x -3137320.5 :y 151663.83 :z 4299247.5 :w 1.0)
                                      (new 'static 'vector :x -3230999.2 :y 116180.99 :z 4193557.0 :w 1.0)
                                      (new 'static 'vector :x -3278071.0 :y 141952.61 :z 4154522.0 :w 1.0)
                                      (new 'static 'vector :x -3305283.5 :y 109772.8 :z 4128963.5 :w 1.0)
                                      (new 'static 'vector :x -3319400.8 :y 127027.61 :z 4127901.2 :w 1.0)
                                      (new 'static 'vector :x -3324899.0 :y 113536.62 :z 4120683.8 :w 1.0)
                                      (new 'static 'vector :x -3313919.5 :y 112976.69 :z 4098966.0 :w 1.0)
                                      (new 'static 'vector :x -3390875.2 :y 126345.625 :z 4109499.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -3411205.8 :y 119147.31 :z 4094660.5 :w 1.0)
                                      (new 'static 'vector :x -3473564.0 :y 121529.96 :z 4073830.5 :w 1.0)
                                      (new 'static 'vector :x -3499253.8 :y 114278.4 :z 4036608.0 :w 1.0)
                                      (new 'static 'vector :x -3494781.0 :y 116228.914 :z 3960819.8 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -3467776.5 :y 127582.21 :z 3918196.8 :w 1.0)
                                      (new 'static 'vector :x -3408770.8 :y 142644.42 :z 3846177.2 :w 1.0)
                                      (new 'static 'vector :x -3376706.0 :y 141518.84 :z 3823855.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -3375933.8 :y 140029.95 :z 3824903.2 :w 1.0)
                                      (new 'static 'vector :x -3351980.8 :y 132402.38 :z 3804621.2 :w 1.0)
                                      (new 'static 'vector :x -3256969.2 :y 100988.93 :z 3804616.8 :w 1.0)
                                      (new 'static 'vector :x -3132064.2 :y 105752.164 :z 3804487.8 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -3067314.2 :y 103167.59 :z 3839685.5 :w 1.0)
                                      (new 'static 'vector :x -2972199.8 :y 118327.3 :z 3866676.5 :w 1.0)
                                      (new 'static 'vector :x -2832124.0 :y 118712.73 :z 3904680.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -2832124.0 :y 118712.73 :z 3904680.0 :w 1.0)
                                      (new 'static 'vector :x -2745753.5 :y 108216.32 :z 3962347.5 :w 1.0)
                                      (new 'static 'vector :x -2701923.0 :y 112963.586 :z 4063826.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -2699260.8 :y 115281.1 :z 4064414.5 :w 1.0)
                                      (new 'static 'vector :x -2670134.5 :y 112962.766 :z 4243775.5 :w 1.0)
                                      (new 'static 'vector :x -2720300.8 :y 123023.77 :z 4299491.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2720300.8 :y 123023.77 :z 4299491.5 :w 1.0)
                                      (new 'static 'vector :x -2805646.5 :y 106197.81 :z 4337587.5 :w 1.0)
                                      (new 'static 'vector :x -2780699.5 :y 129294.74 :z 4386838.0 :w 1.0)
                                      (new 'static 'vector :x -2823415.8 :y 122188.59 :z 4435996.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 2
                                      (new 'static 'vector :x -2823415.8 :y 122188.59 :z 4435996.0 :w 1.0)
                                      (new 'static 'vector :x -2849108.8 :y 113574.3 :z 4529855.5 :w 1.0)
                                      )
                                    )
                                  )
                                )
                              (new 'static 'forest-path-array-static
                                :paths (new 'static 'boxed-array :type forest-path-points-static
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 9
                                      (new 'static 'vector :x -3182430.2 :y 152579.28 :z 3887052.5 :w 1.0)
                                      (new 'static 'vector :x -3169274.8 :y 149056.72 :z 3906439.2 :w 1.0)
                                      (new 'static 'vector :x -3168916.8 :y 144957.84 :z 3929646.8 :w 1.0)
                                      (new 'static 'vector :x -3192997.5 :y 150320.75 :z 3964537.2 :w 1.0)
                                      (new 'static 'vector :x -3204778.0 :y 158730.66 :z 4016146.0 :w 1.0)
                                      (new 'static 'vector :x -3222077.5 :y 147339.67 :z 4017812.8 :w 1.0)
                                      (new 'static 'vector :x -3230182.2 :y 148699.14 :z 4050299.8 :w 1.0)
                                      (new 'static 'vector :x -3221514.8 :y 150747.14 :z 4084620.5 :w 1.0)
                                      (new 'static 'vector :x -3233800.2 :y 135530.9 :z 4180599.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -3214330.8 :y 150747.14 :z 4212587.0 :w 1.0)
                                      (new 'static 'vector :x -3173223.8 :y 146651.14 :z 4282641.0 :w 1.0)
                                      (new 'static 'vector :x -3110842.2 :y 135591.94 :z 4372297.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 2
                                      (new 'static 'vector :x -3084615.2 :y 151259.14 :z 4418157.0 :w 1.0)
                                      (new 'static 'vector :x -3029309.8 :y 153423.47 :z 4534769.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -3017322.5 :y 156379.14 :z 4565711.5 :w 1.0)
                                      (new 'static 'vector :x -2948470.2 :y 156379.14 :z 4583792.5 :w 1.0)
                                      (new 'static 'vector :x -2857102.5 :y 154275.02 :z 4590543.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2799628.0 :y 141068.28 :z 4566268.0 :w 1.0)
                                      (new 'static 'vector :x -2770437.0 :y 135003.34 :z 4559372.5 :w 1.0)
                                      (new 'static 'vector :x -2743294.8 :y 135003.34 :z 4544018.5 :w 1.0)
                                      (new 'static 'vector :x -2694426.2 :y 149365.97 :z 4518274.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 7
                                      (new 'static 'vector :x -2687904.5 :y 127327.44 :z 4516198.5 :w 1.0)
                                      (new 'static 'vector :x -2653281.5 :y 120120.94 :z 4488530.5 :w 1.0)
                                      (new 'static 'vector :x -2630982.0 :y 117863.625 :z 4466334.0 :w 1.0)
                                      (new 'static 'vector :x -2632700.8 :y 124723.2 :z 4439777.0 :w 1.0)
                                      (new 'static 'vector :x -2706328.0 :y 106292.016 :z 4458380.5 :w 1.0)
                                      (new 'static 'vector :x -2759784.0 :y 96816.336 :z 4492627.0 :w 1.0)
                                      (new 'static 'vector :x -2871167.5 :y 124497.1 :z 4468734.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 5
                                      (new 'static 'vector :x -2871167.8 :y 119852.65 :z 4468736.0 :w 1.0)
                                      (new 'static 'vector :x -2959993.8 :y 97155.07 :z 4461325.0 :w 1.0)
                                      (new 'static 'vector :x -3026974.0 :y 125827.07 :z 4446839.0 :w 1.0)
                                      (new 'static 'vector :x -3108078.0 :y 110680.06 :z 4384777.5 :w 1.0)
                                      (new 'static 'vector :x -3158724.2 :y 136264.1 :z 4334314.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 5
                                      (new 'static 'vector :x -3158724.2 :y 136264.1 :z 4334314.0 :w 1.0)
                                      (new 'static 'vector :x -3219604.2 :y 126519.3 :z 4170997.8 :w 1.0)
                                      (new 'static 'vector :x -3209377.8 :y 126007.3 :z 4086785.8 :w 1.0)
                                      (new 'static 'vector :x -3157495.5 :y 135735.3 :z 4012648.8 :w 1.0)
                                      (new 'static 'vector :x -3074944.5 :y 146590.52 :z 3933297.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -3050293.2 :y 158545.1 :z 3929692.5 :w 1.0)
                                      (new 'static 'vector :x -2973008.2 :y 146257.1 :z 3904919.5 :w 1.0)
                                      (new 'static 'vector :x -2895120.0 :y 133457.1 :z 3884309.8 :w 1.0)
                                      (new 'static 'vector :x -2804707.2 :y 120154.11 :z 3855057.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 2
                                      (new 'static 'vector :x -2738390.8 :y 128849.1 :z 3844396.8 :w 1.0)
                                      (new 'static 'vector :x -2599311.0 :y 117824.305 :z 3843407.8 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 5
                                      (new 'static 'vector :x -2599311.0 :y 117824.305 :z 3843407.8 :w 1.0)
                                      (new 'static 'vector :x -2544777.8 :y 100446.21 :z 3795515.0 :w 1.0)
                                      (new 'static 'vector :x -2545984.8 :y 107260.73 :z 3771264.5 :w 1.0)
                                      (new 'static 'vector :x -2555624.8 :y 115481.4 :z 3752881.0 :w 1.0)
                                      (new 'static 'vector :x -2660030.8 :y 151147.72 :z 3722585.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2660030.8 :y 151147.72 :z 3722585.0 :w 1.0)
                                      (new 'static 'vector :x -2765126.5 :y 152612.05 :z 3781683.5 :w 1.0)
                                      (new 'static 'vector :x -2846692.2 :y 152612.05 :z 3779890.5 :w 1.0)
                                      (new 'static 'vector :x -2993975.2 :y 156889.9 :z 3768586.2 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -3008816.0 :y 162340.05 :z 3770353.8 :w 1.0)
                                      (new 'static 'vector :x -3088793.5 :y 167170.05 :z 3761902.0 :w 1.0)
                                      (new 'static 'vector :x -3168028.2 :y 171778.05 :z 3741402.8 :w 1.0)
                                      (new 'static 'vector :x -3322323.0 :y 158736.8 :z 3725926.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -3331431.8 :y 168706.05 :z 3724702.0 :w 1.0)
                                      (new 'static 'vector :x -3412981.2 :y 168706.05 :z 3729643.0 :w 1.0)
                                      (new 'static 'vector :x -3477291.5 :y 177410.05 :z 3777730.5 :w 1.0)
                                      (new 'static 'vector :x -3501542.5 :y 174406.86 :z 3818956.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 5
                                      (new 'static 'vector :x -3496967.2 :y 169592.83 :z 3810989.2 :w 1.0)
                                      (new 'static 'vector :x -3527142.2 :y 164984.83 :z 3867611.2 :w 1.0)
                                      (new 'static 'vector :x -3533428.2 :y 163960.83 :z 3916297.0 :w 1.0)
                                      (new 'static 'vector :x -3477206.8 :y 167503.47 :z 3971054.0 :w 1.0)
                                      (new 'static 'vector :x -3386474.5 :y 161982.47 :z 4014364.8 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -3386474.5 :y 161982.47 :z 4014364.8 :w 1.0)
                                      (new 'static 'vector :x -3256080.5 :y 134555.64 :z 4005596.8 :w 1.0)
                                      (new 'static 'vector :x -3231772.8 :y 145534.97 :z 3918008.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 2
                                      (new 'static 'vector :x -3231772.8 :y 145534.97 :z 3918008.0 :w 1.0)
                                      (new 'static 'vector :x -3190184.0 :y 146162.08 :z 3864884.8 :w 1.0)
                                      )
                                    )
                                  )
                                )
                              (new 'static 'forest-path-array-static
                                :paths (new 'static 'boxed-array :type forest-path-points-static
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -3382840.0 :y 124531.914 :z 4257997.0 :w 1.0)
                                      (new 'static 'vector :x -3367767.2 :y 119960.78 :z 4238386.5 :w 1.0)
                                      (new 'static 'vector :x -3284807.8 :y 107961.96 :z 4116084.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 5
                                      (new 'static 'vector :x -3277863.8 :y 115864.78 :z 4117204.5 :w 1.0)
                                      (new 'static 'vector :x -3216588.8 :y 134635.52 :z 4093010.0 :w 1.0)
                                      (new 'static 'vector :x -3120919.8 :y 112280.78 :z 4077047.0 :w 1.0)
                                      (new 'static 'vector :x -3040706.2 :y 112280.78 :z 4064636.5 :w 1.0)
                                      (new 'static 'vector :x -2896358.5 :y 107961.96 :z 4037042.2 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2882118.5 :y 116888.78 :z 4064251.5 :w 1.0)
                                      (new 'static 'vector :x -2824969.0 :y 97484.8 :z 4090749.2 :w 1.0)
                                      (new 'static 'vector :x -2817174.8 :y 97484.8 :z 4148081.5 :w 1.0)
                                      (new 'static 'vector :x -2812080.2 :y 107960.73 :z 4243558.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -2769315.5 :y 112792.78 :z 4250020.5 :w 1.0)
                                      (new 'static 'vector :x -2690354.0 :y 112792.78 :z 4269936.0 :w 1.0)
                                      (new 'static 'vector :x -2541566.2 :y 107960.73 :z 4240306.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 5
                                      (new 'static 'vector :x -2533757.8 :y 113034.85 :z 4243615.5 :w 1.0)
                                      (new 'static 'vector :x -2452084.0 :y 113034.85 :z 4245367.5 :w 1.0)
                                      (new 'static 'vector :x -2388646.0 :y 113034.85 :z 4292519.0 :w 1.0)
                                      (new 'static 'vector :x -2362736.8 :y 98795.52 :z 4344135.5 :w 1.0)
                                      (new 'static 'vector :x -2358742.8 :y 107960.73 :z 4407390.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -2328564.0 :y 113034.85 :z 4436375.0 :w 1.0)
                                      (new 'static 'vector :x -2251352.0 :y 113034.85 :z 4463288.5 :w 1.0)
                                      (new 'static 'vector :x -2186301.5 :y 107960.73 :z 4506128.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -2200575.5 :y 113034.85 :z 4576720.5 :w 1.0)
                                      (new 'static 'vector :x -2222148.5 :y 113034.85 :z 4655698.0 :w 1.0)
                                      (new 'static 'vector :x -2251075.2 :y 118924.49 :z 4745491.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2251075.5 :y 109840.38 :z 4745493.0 :w 1.0)
                                      (new 'static 'vector :x -2285800.8 :y 108426.85 :z 4803645.5 :w 1.0)
                                      (new 'static 'vector :x -2318172.2 :y 104693.76 :z 4861419.5 :w 1.0)
                                      (new 'static 'vector :x -2417775.5 :y 97667.484 :z 4855576.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -2429198.0 :y 102282.85 :z 4857832.0 :w 1.0)
                                      (new 'static 'vector :x -2508615.8 :y 101258.85 :z 4879408.5 :w 1.0)
                                      (new 'static 'vector :x -2586242.8 :y 97667.484 :z 4918337.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -2627391.0 :y 101258.85 :z 4984615.5 :w 1.0)
                                      (new 'static 'vector :x -2683308.8 :y 101258.85 :z 5040581.5 :w 1.0)
                                      (new 'static 'vector :x -2826494.0 :y 109787.55 :z 5035676.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 5
                                      (new 'static 'vector :x -2844914.0 :y 102412.695 :z 5035674.5 :w 1.0)
                                      (new 'static 'vector :x -2925089.2 :y 102996.375 :z 5040980.5 :w 1.0)
                                      (new 'static 'vector :x -2986683.2 :y 109266.945 :z 5049073.0 :w 1.0)
                                      (new 'static 'vector :x -3061180.8 :y 106588.98 :z 5079689.0 :w 1.0)
                                      (new 'static 'vector :x -3149134.8 :y 97667.484 :z 5019307.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -3193835.0 :y 101980.98 :z 4993555.5 :w 1.0)
                                      (new 'static 'vector :x -3266472.0 :y 105564.98 :z 4957140.0 :w 1.0)
                                      (new 'static 'vector :x -3380424.8 :y 103401.88 :z 4943404.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 2
                                      (new 'static 'vector :x -3420399.2 :y 118364.98 :z 4979722.5 :w 1.0)
                                      (new 'static 'vector :x -3501493.8 :y 134401.64 :z 5054037.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 5
                                      (new 'static 'vector :x -3534608.0 :y 130682.47 :z 5053798.0 :w 1.0)
                                      (new 'static 'vector :x -3503079.8 :y 149946.78 :z 4965631.0 :w 1.0)
                                      (new 'static 'vector :x -3496706.0 :y 154070.22 :z 4884046.5 :w 1.0)
                                      (new 'static 'vector :x -3516570.5 :y 157160.66 :z 4804857.5 :w 1.0)
                                      (new 'static 'vector :x -3544350.8 :y 151007.64 :z 4699158.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -3544350.8 :y 151007.64 :z 4699158.0 :w 1.0)
                                      (new 'static 'vector :x -3514245.0 :y 139878.4 :z 4645110.0 :w 1.0)
                                      (new 'static 'vector :x -3462144.0 :y 140328.95 :z 4588380.0 :w 1.0)
                                      (new 'static 'vector :x -3368591.2 :y 151007.64 :z 4510411.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -3353423.5 :y 148456.66 :z 4489753.0 :w 1.0)
                                      (new 'static 'vector :x -3326665.0 :y 139980.8 :z 4441515.0 :w 1.0)
                                      (new 'static 'vector :x -3350128.8 :y 152552.66 :z 4410126.5 :w 1.0)
                                      (new 'static 'vector :x -3368353.5 :y 108873.32 :z 4300857.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 2
                                      (new 'static 'vector :x -3368353.5 :y 108873.32 :z 4300857.0 :w 1.0)
                                      (new 'static 'vector :x -3404533.2 :y 115598.13 :z 4265278.0 :w 1.0)
                                      )
                                    )
                                  )
                                )
                              (new 'static 'forest-path-array-static
                                :paths (new 'static 'boxed-array :type forest-path-points-static
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 2
                                      (new 'static 'vector :x -2857514.5 :y 230099.36 :z 4713237.5 :w 1.0)
                                      (new 'static 'vector :x -2834352.2 :y 240645.73 :z 4678872.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2834352.2 :y 240645.73 :z 4678872.5 :w 1.0)
                                      (new 'static 'vector :x -2779754.0 :y 186164.84 :z 4661419.0 :w 1.0)
                                      (new 'static 'vector :x -2718794.2 :y 160570.98 :z 4624373.0 :w 1.0)
                                      (new 'static 'vector :x -2662038.8 :y 145092.2 :z 4590277.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -2628241.0 :y 156252.56 :z 4545156.0 :w 1.0)
                                      (new 'static 'vector :x -2572451.5 :y 156252.56 :z 4485468.0 :w 1.0)
                                      (new 'static 'vector :x -2541503.8 :y 145092.2 :z 4388527.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 2
                                      (new 'static 'vector :x -2525866.0 :y 151644.56 :z 4330410.5 :w 1.0)
                                      (new 'static 'vector :x -2497541.2 :y 142866.84 :z 4188686.8 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2497541.2 :y 142866.84 :z 4188686.8 :w 1.0)
                                      (new 'static 'vector :x -2455238.2 :y 130140.57 :z 4097427.5 :w 1.0)
                                      (new 'static 'vector :x -2434082.0 :y 115804.57 :z 4018044.0 :w 1.0)
                                      (new 'static 'vector :x -2414796.0 :y 112422.914 :z 3860467.8 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2424043.0 :y 115804.57 :z 3860653.8 :w 1.0)
                                      (new 'static 'vector :x -2472111.8 :y 115804.57 :z 3794679.5 :w 1.0)
                                      (new 'static 'vector :x -2540595.5 :y 132188.56 :z 3750790.8 :w 1.0)
                                      (new 'static 'vector :x -2675137.0 :y 145014.38 :z 3745763.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2698701.5 :y 150880.67 :z 3757491.8 :w 1.0)
                                      (new 'static 'vector :x -2775628.2 :y 151490.56 :z 3779519.8 :w 1.0)
                                      (new 'static 'vector :x -2857271.0 :y 151490.56 :z 3776823.0 :w 1.0)
                                      (new 'static 'vector :x -2988377.8 :y 156889.9 :z 3784315.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 5
                                      (new 'static 'vector :x -2994563.0 :y 160620.95 :z 3784922.0 :w 1.0)
                                      (new 'static 'vector :x -3073605.2 :y 162716.47 :z 3764547.2 :w 1.0)
                                      (new 'static 'vector :x -3153552.2 :y 162716.47 :z 3747344.5 :w 1.0)
                                      (new 'static 'vector :x -3234944.2 :y 162716.47 :z 3736506.2 :w 1.0)
                                      (new 'static 'vector :x -3335389.2 :y 158736.8 :z 3733941.8 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 5
                                      (new 'static 'vector :x -3335389.2 :y 158736.8 :z 3733941.8 :w 1.0)
                                      (new 'static 'vector :x -3393699.8 :y 149504.0 :z 3730595.8 :w 1.0)
                                      (new 'static 'vector :x -3437936.8 :y 147947.52 :z 3749970.0 :w 1.0)
                                      (new 'static 'vector :x -3508591.8 :y 172382.2 :z 3834896.5 :w 1.0)
                                      (new 'static 'vector :x -3554799.5 :y 170262.53 :z 3898077.2 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -3555722.8 :y 176073.11 :z 3924401.0 :w 1.0)
                                      (new 'static 'vector :x -3545402.2 :y 176073.11 :z 4006104.8 :w 1.0)
                                      (new 'static 'vector :x -3523530.2 :y 151994.78 :z 4156884.2 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -3520937.2 :y 161225.11 :z 4166888.8 :w 1.0)
                                      (new 'static 'vector :x -3503278.5 :y 158153.11 :z 4247361.0 :w 1.0)
                                      (new 'static 'vector :x -3490947.0 :y 151994.78 :z 4347957.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -3450616.8 :y 158153.11 :z 4394886.5 :w 1.0)
                                      (new 'static 'vector :x -3384994.5 :y 158851.48 :z 4444763.5 :w 1.0)
                                      (new 'static 'vector :x -3296063.5 :y 151994.78 :z 4499090.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 2
                                      (new 'static 'vector :x -3239110.2 :y 158851.48 :z 4514561.0 :w 1.0)
                                      (new 'static 'vector :x -3115434.8 :y 151994.78 :z 4533591.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -3087346.0 :y 158851.48 :z 4565256.0 :w 1.0)
                                      (new 'static 'vector :x -3046370.5 :y 173699.48 :z 4636244.5 :w 1.0)
                                      (new 'static 'vector :x -3002067.2 :y 178988.64 :z 4730666.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -3002067.2 :y 178988.64 :z 4730666.0 :w 1.0)
                                      (new 'static 'vector :x -2967525.5 :y 188035.48 :z 4776569.0 :w 1.0)
                                      (new 'static 'vector :x -2869068.5 :y 176718.23 :z 4825758.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 4
                                      (new 'static 'vector :x -2869068.5 :y 176718.23 :z 4825758.0 :w 1.0)
                                      (new 'static 'vector :x -2812928.0 :y 181370.88 :z 4818698.0 :w 1.0)
                                      (new 'static 'vector :x -2756157.5 :y 178298.88 :z 4785684.5 :w 1.0)
                                      (new 'static 'vector :x -2743505.0 :y 176718.23 :z 4732742.5 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 3
                                      (new 'static 'vector :x -2757800.2 :y 186157.47 :z 4713618.0 :w 1.0)
                                      (new 'static 'vector :x -2811383.0 :y 189741.47 :z 4655141.0 :w 1.0)
                                      (new 'static 'vector :x -2943844.0 :y 214610.33 :z 4731594.0 :w 1.0)
                                      )
                                    )
                                  (new 'static 'forest-path-points-static
                                    :points (new 'static 'inline-array vector 2
                                      (new 'static 'vector :x -2943844.0 :y 214610.33 :z 4731594.0 :w 1.0)
                                      (new 'static 'vector :x -2852400.0 :y 225392.23 :z 4736103.5 :w 1.0)
                                      )
                                    )
                                  )
                                )
                              )
        )

(deftype forest-ring-path-control (path-control)
  ()
  (:methods
    (new (symbol type process int int) _type_)
    )
  )


(defmethod new forest-ring-path-control ((allocation symbol) (type-to-make type) (arg0 process) (arg1 int) (arg2 int))
  0
  (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
    (set! (-> v0-0 process) (the-as process-drawable arg0))
    (set! (-> v0-0 name) #f)
    (set! (-> v0-0 curve num-cverts) (-> *forest-path-point-lengths* arg1 arg2))
    (set! (-> v0-0 curve cverts) (-> *forest-ring-paths* arg1 paths arg2 points))
    v0-0
    )
  )

(deftype forest-path-array (structure)
  ((paths  (array forest-ring-path-control))
   )
  :allow-misaligned
  )


(deftype task-manager-forest-ring-chase (task-manager)
  ((ring-manager-entity  entity)
   (actor-group          (pointer actor-group))
   (actor-group-count    int32)
   (current-statue       uint8)
   (current-ring         uint8)
   (check-timer          time-frame)
   (use-camera?          symbol)
   (path-ctrl            forest-path-array  5 :inline)
   (ring-finder          handle             :offset 352)
   (found-ring?          symbol)
   (cam-timer            time-frame)
   (cam-timer-set?       symbol)
   )
  (:methods
    (init-actor-group! (_type_) none)
    )
  )


;; WARN: disable def twice: 329. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare.
(defmethod taskman-event-handler ((this task-manager-forest-ring-chase) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
  (local-vars (v0-1 object))
  (with-pp
    (case arg2
      (('statue-explode)
       (+! (-> this current-statue) 1)
       (set! (-> this current-ring) (the-as uint 0))
       (set! (-> this found-ring?) #f)
       (when (< (-> this current-statue) (the-as uint (-> this actor-group 0 length)))
         (let ((a1-1 (new 'stack-no-clear 'event-message-block)))
           (set! (-> a1-1 from) (process->ppointer pp))
           (set! (-> a1-1 num-params) 0)
           (set! (-> a1-1 message) 'trigger)
           (let ((t9-0 send-event-function)
                 (v1-11 (-> this actor-group 0 data (-> this current-statue) actor))
                 )
             (t9-0
               (if v1-11
                   (-> v1-11 extra process)
                   )
               a1-1
               )
             )
           )
         )
       (set! v0-1 #t)
       (set! (-> this use-camera?) (the-as symbol v0-1))
       v0-1
       )
      (('ring-hit)
       (when (-> this ring-manager-entity)
         (+! (-> this current-ring) 1)
         (cond
           ((= (-> this current-ring) (-> this actor-group (+ (-> this current-statue) 2) length))
            (if (< (-> this current-statue) (the-as uint (-> this actor-group 1 length)))
                0
                )
            (when (logtest? (-> this info mask) (task-manager-mask time-limit))
              (logclear! (-> this info mask) (task-manager-mask time-limit))
              (send-event (handle->process (-> this hud-timer)) 'hide-and-die)
              )
            (let ((s5-0 (-> this actor-group (+ (-> this current-statue) 2) data (+ (-> this current-ring) -1) actor))
                  (s4-0 (get-process *default-dead-pool* for-race-ring-finder #x4000 1))
                  )
              (set! v0-1
                    (ppointer->handle
                      (when s4-0
                        (let ((t9-3 (method-of-type for-race-ring-finder activate)))
                          (t9-3 (the-as for-race-ring-finder s4-0) this "for-race-ring-finder" (the-as pointer #x70004000))
                          )
                        (run-now-in-process s4-0 for-race-ring-finder-init-by-other (-> s5-0 extra trans) s5-0)
                        (-> s4-0 ppointer)
                        )
                      )
                    )
              )
            (set! (-> this ring-finder) (the-as handle v0-1))
            v0-1
            )
           (else
             (let ((s5-1 (-> this actor-group (+ (-> this current-statue) 2) data (+ (-> this current-ring) -1) actor)))
               (-> this actor-group (+ (-> this current-statue) 2) data (-> this current-ring) actor)
               (set! (-> this ring-finder)
                     (ppointer->handle
                       (process-spawn for-race-ring-finder (-> s5-1 extra trans) s5-1 :name "for-race-ring-finder" :to this)
                       )
                     )
               )
             (set! (-> this found-ring?) #f)
             (when (logtest? (-> this info mask) (task-manager-mask time-limit))
               (set-time! (-> this start-time))
               (set! (-> this time-limit)
                     (the-as time-frame (the int (* 300.0 (-> *for-ring-times* (-> this current-statue) (-> this current-ring)))))
                     )
               )
             0
             )
           )
         )
       )
      (('get-path)
       (cond
         ((and (< (-> this current-statue) (the-as uint (-> this actor-group 0 length)))
               (< (-> this current-ring) (the-as uint (-> this actor-group (+ (-> this current-statue) 2) length)))
               )
          (set! v0-1 (-> this path-ctrl (-> this current-statue) paths (-> this current-ring)))
          (cond
            ((the-as forest-ring-path-control v0-1)
             (empty)
             v0-1
             )
            (else
              #f
              )
            )
          )
         ((= (-> this current-ring) (-> this actor-group (+ (-> this current-statue) 2) length))
          (set! v0-1 (-> this path-ctrl (-> this current-statue) paths (-> this current-ring)))
          (cond
            ((the-as forest-ring-path-control v0-1)
             (empty)
             v0-1
             )
            (else
              #f
              )
            )
          )
         )
       )
      (('get-current-ring-ent)
       (cond
         ((and (-> this ring-manager-entity)
               (< (-> this current-statue) (the-as uint (-> this actor-group 0 length)))
               (< (-> this current-ring) (the-as uint (-> this actor-group (+ (-> this current-statue) 2) length)))
               )
          (-> this actor-group (+ (-> this current-statue) 2) data (-> this current-ring) actor)
          )
         ((= (-> this current-ring) (-> this actor-group (+ (-> this current-statue) 2) length))
          (-> this actor-group 0 data (-> this current-statue) actor)
          )
         )
       )
      (('found-ring)
       (set! v0-1 #t)
       (set! (-> this found-ring?) (the-as symbol v0-1))
       v0-1
       )
      (('chase-started?)
       (or (and (nonzero? (-> this found-ring?)) (-> this found-ring?))
           (and (nonzero? (-> this ring-finder)) (handle->process (-> this ring-finder)))
           )
       )
      (('last-ring?)
       (= (-> this current-ring) (+ (-> this actor-group (+ (-> this current-statue) 2) length) -1))
       )
      (else
        ((method-of-type task-manager taskman-event-handler) this arg0 arg1 arg2 arg3)
        )
      )
    )
  )

;; WARN: Return type mismatch time-frame vs none.
(defmethod task-manager-method-26 ((this task-manager-forest-ring-chase))
  (with-pp
    (let ((t9-0 (method-of-type task-manager task-manager-method-26)))
      (t9-0 this)
      )
    (when (and (-> this ring-manager-entity)
               (< (-> this current-statue) (the-as uint (-> this actor-group 0 length)))
               (< (-> this current-ring) (the-as uint (-> this actor-group (+ (-> this current-statue) 2) length)))
               )
      (let ((a0-14 (-> this path-ctrl (-> this current-statue) paths (-> this current-ring))))
        (if a0-14
            (debug-draw a0-14)
            )
        )
      )
    (when (time-elapsed? (-> this check-timer) (seconds 0.1))
      (if (not (-> this ring-manager-entity))
          (init-actor-group! this)
          )
      (when (-> this use-camera?)
        (when (logtest? (-> this actor-group 0 data (+ (-> this current-statue) -1) actor extra perm status)
                        (entity-perm-status dead)
                        )
          (when (not (-> *setting-control* cam-current entity-name))
            (case (-> this current-statue)
              ((1)
               (set-setting! 'entity-name "camera-345" 0.0 0)
               )
              ((2)
               (set-setting! 'entity-name "camera-325" 0.0 0)
               )
              ((3)
               (set-setting! 'entity-name "camera-390" 0.0 0)
               )
              ((4)
               (set-setting! 'entity-name "camera-389" 0.0 0)
               )
              ((5)
               (set-setting! 'entity-name "camera-388" 0.0 0)
               )
              )
            )
          (if (and *target* (not (logtest? (-> *target* focus-status) (focus-status grabbed))))
              (process-grab? *target* #f)
              )
          (let ((s5-0 (-> this actor-group 1 data (+ (-> this current-statue) -1) actor)))
            (when (zero? (-> *camera-combiner* tracking-status))
              (let ((a1-9 (new 'stack-no-clear 'event-message-block)))
                (set! (-> a1-9 from) (process->ppointer pp))
                (set! (-> a1-9 num-params) 0)
                (set! (-> a1-9 message) 'trigger)
                (let ((t9-9 send-event-function)
                      (v1-57 s5-0)
                      )
                  (t9-9
                    (if v1-57
                        (-> v1-57 extra process)
                        )
                    a1-9
                    )
                  )
                )
              )
            (when (and (logtest? (-> s5-0 extra perm status) (entity-perm-status subtask-complete))
                       (not (-> this cam-timer-set?))
                       )
              (set-time! (-> this cam-timer))
              (set! (-> this cam-timer-set?) #t)
              )
            )
          (when (and (-> this cam-timer-set?) (time-elapsed? (-> this cam-timer) (seconds 1.5)))
            (set! (-> this cam-timer) 0)
            (set! (-> this cam-timer-set?) #f)
            (set-setting! 'interp-time 'abs 0.0 0)
            (remove-setting! 'entity-name)
            (case (-> this current-statue)
              ((1)
               (task-node-close! (game-task-node forest-ring-chase-statue-1) 'event)
               )
              ((2)
               (task-node-close! (game-task-node forest-ring-chase-statue-2) 'event)
               )
              ((3)
               (task-node-close! (game-task-node forest-ring-chase-statue-3) 'event)
               )
              ((4)
               (task-node-close! (game-task-node forest-ring-chase-statue-4) 'event)
               )
              )
            (if (and *target* (focus-test? *target* grabbed))
                (process-release? *target*)
                )
            (set! (-> this use-camera?) #f)
            )
          )
        )
      (when (and (< (-> this current-statue) (the-as uint (-> this actor-group 0 length)))
                 (< (-> this current-ring) (the-as uint (-> this actor-group (+ (-> this current-statue) 2) length)))
                 )
        (let* ((s5-1 (-> this actor-group 0 data (-> this current-statue) actor))
               (v1-98 s5-1)
               (s3-0 (if v1-98
                         (-> v1-98 extra process)
                         )
                     )
               (s4-0 (+ (-> this current-statue) 2))
               )
          (when (and (not (handle->process (-> this arrow)))
                     (not (logtest? (-> s5-1 extra perm status) (entity-perm-status subtask-complete)))
                     )
            (let ((s2-0 (new 'stack-no-clear 'task-arrow-params)))
              (vector-copy!
                (-> s2-0 pos)
                (vector+! (new 'stack-no-clear 'vector) (-> s5-1 extra trans) (new 'static 'vector :y -4096.0 :w 1.0))
                )
              (quaternion-identity! (-> s2-0 quat))
              (set! (-> s2-0 flags) (task-arrow-flags taf8))
              (set! (-> s2-0 map-icon) (the-as uint 13))
              (set! (-> this arrow) (process->handle (task-arrow-spawn s2-0 this)))
              )
            (send-event (handle->process (-> this arrow)) 'set-scale #x41400000)
            )
          (cond
            ((and s3-0 (-> s3-0 next-state) (= (-> s3-0 next-state name) 'dormant))
             (send-event s3-0 'trigger)
             )
            ((and (logtest? (-> s5-1 extra perm status) (entity-perm-status subtask-complete))
                  (< (the-as int s4-0) (-> this actor-group-count))
                  )
             (when (handle->process (-> this arrow))
               (send-event (handle->process (-> this arrow)) 'die)
               (set! (-> this arrow) (the-as handle #f))
               )
             (when (-> this found-ring?)
               (let* ((v1-152 (-> this actor-group s4-0 data (-> this current-ring) actor))
                      (a1-27 v1-152)
                      (a0-107 (if a1-27
                                  (-> a1-27 extra process)
                                  )
                              )
                      )
                 (when (and a0-107
                            (not (logtest? (-> v1-152 extra perm status) (entity-perm-status subtask-complete)))
                            (-> a0-107 next-state)
                            (= (-> a0-107 next-state name) 'dormant)
                            )
                   (if (= (-> this current-ring) (+ (-> this actor-group (+ (-> this current-statue) 2) length) -1))
                       (send-event a0-107 'trigger-final)
                       (send-event a0-107 'trigger)
                       )
                   (when (-> *setting-control* user-current airlock)
                     (set-setting! 'airlock #f 0.0 0)
                     (task-node-close! (game-task-node forest-ring-chase-statues) 'event)
                     )
                   )
                 )
               )
             (when (and (not (handle->process (-> this ring-finder))) (not (-> this found-ring?)))
               (when (not (logtest? (-> this info mask) (task-manager-mask time-limit)))
                 (set-time! (-> this start-time))
                 (set! (-> this time-limit)
                       (the-as time-frame (the int (* 300.0 (-> *for-ring-times* (-> this current-statue) (-> this current-ring)))))
                       )
                 (logior! (-> this info mask) (task-manager-mask time-limit))
                 )
               (set! (-> this ring-finder)
                     (ppointer->handle
                       (process-spawn for-race-ring-finder (-> s5-1 extra trans) s5-1 :name "for-race-ring-finder" :to this)
                       )
                     )
               (set! (-> this found-ring?) #f)
               )
             )
            )
          )
        )
      (when (= (-> *game-info* counter) 1.0)
        )
      (set! (-> *game-info* counter)
            (the float (- (-> this actor-group 0 length) (the-as int (-> this current-statue))))
            )
      (set-time! (-> this check-timer))
      )
    (none)
    )
  )

(defstate active (task-manager-forest-ring-chase)
  :virtual #t
  :enter (behavior ()
    (let ((t9-0 (-> (method-of-type task-manager active) enter)))
      (if t9-0
          (t9-0)
          )
      )
    (set-time! (-> self check-timer))
    )
  :code (behavior ()
    (until (and (-> self ring-manager-entity) (= (-> *game-info* counter) 0.0))
      (when (-> self ring-manager-entity)
        (when (and (< (-> self current-statue) (the-as uint (-> self actor-group 0 length)))
                   (< (-> self current-ring) (the-as uint (-> self actor-group (+ (-> self current-statue) 2) length)))
                   )
          (let ((gp-0 format)
                (s5-0 *stdebug*)
                (s4-0 "current statue: ~d     ring: ~d     path length: ~m~%")
                (s3-0 (+ (-> self current-statue) 1))
                (s2-0 (+ (-> self current-ring) 1))
                )
            (gp-0 s5-0 s4-0 s3-0 s2-0 (total-distance (the-as path-control (send-event self 'get-path))))
            )
          )
        )
      (suspend)
      )
    (suspend-for (seconds 3)
      (format *stdebug* "task-manager-forest-ring-chase: done!~%")
      )
    (while (-> self use-camera?)
      (suspend)
      )
    (send-event self 'complete)
    (sleep-code)
    )
  )

(defmethod init-actor-group! ((this task-manager-forest-ring-chase))
  (local-vars (sv-16 res-tag))
  (let ((a0-2 (entity-by-name "for-ring-chase-manager-1")))
    (when a0-2
      (set! (-> this ring-manager-entity) a0-2)
      (set! sv-16 (new 'static 'res-tag))
      (let ((v1-1 (res-lump-data a0-2 'actor-groups pointer :tag-ptr (& sv-16))))
        (cond
          ((and v1-1 (>= (-> sv-16 elt-count) 0))
           (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count)))
           (set! (-> this actor-group) (the-as (pointer actor-group) v1-1))
           )
          (else
            (format 0 "ERROR: ~s: entity missing actor-group!~%" (game-task->string (-> this node-info task)))
            )
          )
        )
      (set! (-> this hud-counter)
            (ppointer->handle
              (process-spawn hud-forest-ring-chase :init hud-init-by-other :name "hud-forest-ring-chase" :to this)
              )
            )
      )
    )
  (none)
  )

(defmethod task-manager-method-25 ((this task-manager-forest-ring-chase))
  ((method-of-type task-manager task-manager-method-25) this)
  (remove-setting! 'airlock)
  (none)
  )

;; WARN: Return type mismatch task-manager vs task-manager-forest-ring-chase.
(defmethod relocate ((this task-manager-forest-ring-chase) (offset int))
  (dotimes (s4-0 5)
    (dotimes (s3-0 (length (-> this path-ctrl s4-0 paths)))
      (if (nonzero? (-> this path-ctrl s4-0 paths s3-0))
          (&+! (-> this path-ctrl s4-0 paths s3-0) offset)
          )
      )
    (if (nonzero? (-> this path-ctrl s4-0 paths))
        (&+! (-> this path-ctrl s4-0 paths) offset)
        )
    )
  (the-as task-manager-forest-ring-chase ((method-of-type task-manager relocate) this offset))
  )

;; WARN: Return type mismatch symbol vs none.
(defmethod init! ((this task-manager-forest-ring-chase))
  (let ((t9-0 (method-of-type task-manager init!)))
    (t9-0 this)
    )
  (dotimes (s5-0 5)
    (set! (-> this path-ctrl s5-0 paths)
          (new 'process 'boxed-array forest-ring-path-control (-> *forest-path-array-lengths* s5-0))
          )
    (dotimes (s4-0 (length (-> this path-ctrl s5-0 paths)))
      (set! (-> this path-ctrl s5-0 paths s4-0) (new 'process 'forest-ring-path-control this s5-0 s4-0))
      (logior! (-> this path-ctrl s5-0 paths s4-0 flags) (path-control-flag display draw-line draw-point draw-text))
      )
    )
  (none)
  )

;; WARN: Return type mismatch symbol vs none.
(defmethod set-time-limit ((this task-manager-forest-ring-chase))
  (let ((t9-0 (method-of-type task-manager set-time-limit)))
    (t9-0 this)
    )
  (set-setting! 'timer-warn-seconds #f 0.0 4)
  (set! (-> this ring-manager-entity) #f)
  (set! (-> this actor-group-count) 0)
  (cond
    ((task-node-closed? (game-task-node forest-ring-chase-statue-5))
     (set! (-> this current-statue) (the-as uint 5))
     )
    ((task-node-closed? (game-task-node forest-ring-chase-statue-4))
     (set! (-> this current-statue) (the-as uint 4))
     )
    ((task-node-closed? (game-task-node forest-ring-chase-statue-3))
     (set! (-> this current-statue) (the-as uint 3))
     )
    ((task-node-closed? (game-task-node forest-ring-chase-statue-2))
     (set! (-> this current-statue) (the-as uint 2))
     )
    ((task-node-closed? (game-task-node forest-ring-chase-statue-1))
     (set! (-> this current-statue) (the-as uint 1))
     )
    )
  (set! (-> this use-camera?) #f)
  (set! (-> this ring-finder) (the-as handle #f))
  (set! (-> this found-ring?) #f)
  (set! (-> this cam-timer-set?) #f)
  (logclear! (-> this info mask) (task-manager-mask time-limit))
  (set! *for-statue-played-hint?* (the-as object #f))
  (none)
  )

(deftype task-manager-forest-ring-resolution (task-manager)
  ()
  )


(defstate active (task-manager-forest-ring-resolution)
  :virtual #t
  :code (behavior ()
    (until *scene-player*
      (suspend)
      )
    (let ((a0-1 (handle->process (-> self arrow))))
      (when a0-1
        (send-event a0-1 'die)
        (set! (-> self arrow) (the-as handle #f))
        )
      )
    (while *scene-player*
      (suspend)
      )
    (send-event self 'complete)
    (sleep-code)
    )
  )

(defmethod set-time-limit ((this task-manager-forest-ring-resolution))
  (let ((t9-0 (method-of-type task-manager set-time-limit)))
    (t9-0 this)
    )
  (set-setting! 'airlock #f 0.0 0)
  (let ((s5-0 (new 'stack-no-clear 'task-arrow-params)))
    (vector-copy! (-> s5-0 pos) (new 'static 'vector :x -2937746.8 :y 249443.12 :z 4155934.0 :w 1.0))
    (quaternion-identity! (-> s5-0 quat))
    (set! (-> s5-0 flags) (task-arrow-flags))
    (set! (-> s5-0 map-icon) (the-as uint 12))
    (set! (-> this arrow) (process->handle (task-arrow-spawn s5-0 this)))
    )
  (none)
  )
