;;-*-Lisp-*-
(in-package goal)
(bundles "ENGINE.CGO" "GAME.CGO")
(require "engine/ui/hud-h.gc")
(require "engine/gfx/sprite/sparticle/sparticle-launcher.gc")
(require "engine/anim/joint-h.gc")

;; DECOMP BEGINS

(defun part-progress-hud-left-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
  (let ((v1-0 *progress-process*))
    (set! (-> arg2 vector 0 w) (-> v1-0 0 left-side-x-scale))
    (set! (-> arg2 vector 1 w) (-> v1-0 0 left-side-y-scale)))
  (none))

(defun part-progress-hud-right-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
  (let ((v1-0 *progress-process*))
    (set! (-> arg2 vector 0 w) (-> v1-0 0 right-side-x-scale))
    (set! (-> arg2 vector 1 w) (-> v1-0 0 right-side-y-scale)))
  (none))

(defun part-progress-hud-orb-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
  ;; og:preserve-this
  (#cond
    (PC_PORT
     (unless (and *pc-settings* (not (-> *pc-settings* use-vis?)))
       (set! (-> arg2 vector 0 w) (/ 5324.8 (-> *progress-process* 0 sides-x-scale)))
       (set! (-> arg2 vector 1 w) (/ 5324.8 (-> *progress-process* 0 sides-x-scale)))))
    (#t
     (set! (-> arg2 vector 0 w) (/ 5324.8 (-> *progress-process* 0 sides-x-scale)))
     (set! (-> arg2 vector 1 w) (/ 5324.8 (-> *progress-process* 0 sides-x-scale)))))
  (none))

(defun part-progress-hud-buzzer-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
  ;; og:preserve-this
  (#cond
    (PC_PORT
     (unless (and *pc-settings* (not (-> *pc-settings* use-vis?)))
       (set! (-> arg2 vector 0 w) (/ 6144.0 (-> *progress-process* 0 sides-x-scale)))
       (set! (-> arg2 vector 1 w) (/ 6144.0 (-> *progress-process* 0 sides-x-scale)))))
    (#t
     (set! (-> arg2 vector 0 w) (/ 6144.0 (-> *progress-process* 0 sides-x-scale)))
     (set! (-> arg2 vector 1 w) (/ 6144.0 (-> *progress-process* 0 sides-x-scale)))))
  (none))

(defun part-progress-hud-button-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
  ;; og:preserve-this
  (#cond
    (PC_PORT
     (unless (and *pc-settings* (not (-> *pc-settings* use-vis?)))
       (set! (-> arg2 vector 0 w) (/ 6553.6 (-> *progress-process* 0 sides-x-scale)))
       (set! (-> arg2 vector 1 w) (/ 6553.6 (-> *progress-process* 0 sides-x-scale)))))
    (#t
     (set! (-> arg2 vector 0 w) (/ 6553.6 (-> *progress-process* 0 sides-x-scale)))
     (set! (-> arg2 vector 1 w) (/ 6553.6 (-> *progress-process* 0 sides-x-scale)))))
  (none))

(defun part-progress-hud-tint-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
  (set! (-> arg2 vector 2 w) (the float (- 64 (sar (* 63 (-> *progress-process* 0 in-out-position)) 12))))
  ;; og:preserve-this
  (#when PC_PORT
    (if (and *pc-settings* (not (-> *pc-settings* use-vis?)))
      (set! (-> arg2 vector 0 w) (* (meters 15) (-> *pc-settings* aspect-ratio-scale)))))
  0
  (none))

(defun part-progress-card-slot-01-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
  (set! (-> arg2 vector 2 w) (if (zero? (-> *progress-process* 0 option-index)) 64.0 32.0))
  (set! (-> arg2 vector 1 w) (-> *progress-process* 0 slot-scale))
  0
  (none))

(defun part-progress-card-slot-02-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
  (set! (-> arg2 vector 2 w) (if (= (-> *progress-process* 0 option-index) 1) 64.0 32.0))
  (set! (-> arg2 vector 1 w) (-> *progress-process* 0 slot-scale))
  0
  (none))

(defun part-progress-card-slot-03-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
  (set! (-> arg2 vector 2 w) (if (= (-> *progress-process* 0 option-index) 2) 64.0 32.0))
  (set! (-> arg2 vector 1 w) (-> *progress-process* 0 slot-scale))
  0
  (none))

(defun part-progress-card-slot-04-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
  (set! (-> arg2 vector 2 w) (if (= (-> *progress-process* 0 option-index) 3) 64.0 32.0))
  (set! (-> arg2 vector 1 w) (-> *progress-process* 0 slot-scale))
  0
  (none))

(defun part-progress-card-cell-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
  (let ((f0-1 (* 2.0 (+ -0.5 (-> *progress-process* 0 transition-percentage-invert)))))
    (if (< f0-1 0.0) (set! f0-1 0.0))
    (set! (-> arg2 vector 2 w) (* 128.0 f0-1)))
  0
  (none))

(defun part-progress-save-icon-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
  (let ((f0-1 (* 6144.0 (-> *progress-process* 0 transition-percentage-invert))))
    (set! (-> arg2 vector 0 w) f0-1)
    (set! (-> arg2 vector 1 w) f0-1))
  0
  (none))

(defun fuel-cell-progress-hud-orbit-callback ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
  (let* ((a0-1 (-> arg1 key))
         (s5-0 (the-as progress (-> a0-1 proc)))
         (v1-0 (the int (the-as float (-> arg1 user-float))))
         (s4-0 -1))
    (let ((a1-1 0))
      (dotimes (a2-1 (-> *progress-process* 0 nb-of-particles))
        (if (= (-> a0-1 matrix) (-> s5-0 particles a1-1 part matrix)) (set! s4-0 a1-1))
        (+! a1-1 1)))
    (cond
      ((= v1-0 3)
       (if (= (-> s5-0 particle-state s4-0) 1) (set! (-> arg2 vector 2 w) 42.0) (set! (-> arg2 vector 2 w) 128.0))
       0)
      (else
       (let ((s3-0 (new 'stack-no-clear 'vector))
             (s2-0 (new 'stack-no-clear 'vector)))
         (cond
           ((or (= s4-0 -1) (= (-> s5-0 particle-state s4-0) 2) (= (-> s5-0 particle-state s4-0) 1))
            (set! (-> arg2 vector 0 x) 245760.0))
           ((= v1-0 -1) (set! (-> arg2 vector 0 x) 0.0) (set! (-> arg2 vector 0 y) 0.0))
           (else
            (vector<-cspace! s3-0 (-> s5-0 icons (logand s4-0 3) icon 0 node-list data v1-0))
            (vector<-cspace! s2-0 (-> s5-0 icons (logand s4-0 3) icon 0 node-list data 3))
            (vector-! s3-0 s3-0 s2-0)
            ;; og:preserve-this
            (#when PC_PORT
              (when (not (-> *pc-settings* use-vis?))
                (*! (-> s3-0 x) (-> *video-parms* relative-x-scale))))
            (set! (-> arg2 vector 0 x) (* 48.0 (-> s3-0 x)))
            (set! (-> arg2 vector 0 y) (* 60.0 (-> s3-0 y)))
            (set! (-> arg2 vector 0 z) (* 32.0 (-> s3-0 z))))))
       0)))
  0
  (none))

(defpartgroup group-part-progress-hud-previous
  :id 85
  :flags (use-local-clock screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 332 :flags (launch-asap))))

(defpartgroup group-part-progress-hud-next
  :id 86
  :flags (use-local-clock screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 333 :flags (launch-asap))))

(defpartgroup group-part-progress-hud-selector
  :id 87
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 334 :flags (launch-asap))))

(defpartgroup group-part-progress-hud-left
  :id 88
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 335 :flags (launch-asap))))

(defpartgroup group-part-progress-hud-right
  :id 89
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 336 :flags (launch-asap))))

(defpartgroup group-part-progress-hud-tint
  :id 90
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 337 :flags (launch-asap))))

(defpartgroup group-part-progress-card-cell
  :id 91
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 2190 :flags (launch-asap)) (sp-item 2191 :flags (launch-asap)) (sp-item 2192 :flags (launch-asap))))

(defpartgroup group-part-progress-button-x
  :id 570
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 2336 :flags (launch-asap))))

(defpartgroup group-part-progress-button-square
  :id 571
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 2337 :flags (launch-asap))))

(defpartgroup group-part-progress-button-triangle
  :id 572
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 2338 :flags (launch-asap))))

(defpartgroup group-part-progress-button-circle
  :id 573
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 2339 :flags (launch-asap))))

(defpartgroup group-part-progress-card-slot-01
  :id 92
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 2142 :flags (launch-asap))))

(defpartgroup group-part-progress-card-slot-02
  :id 93
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 2143 :flags (launch-asap))))

(defpartgroup group-part-progress-card-slot-03
  :id 94
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 2144 :flags (launch-asap))))

(defpartgroup group-part-progress-card-slot-04
  :id 95
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 1)
  :parts ((sp-item 2145 :flags (launch-asap))))

(defpartgroup group-part-progress-hud-power-cell-center
  :id 96
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 100)
  :parts ((sp-item 338 :flags (launch-asap))))

(defpart 337
  :init-specs
  ((:texture (p-white effects))
   (:num 1.0)
   (:scale-x (meters 15))
   (:scale-y (meters 11.5))
   (:r 128.0)
   (:g 32.0)
   (:b 0.0)
   (:a 64.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))
   (:func 'part-progress-hud-tint-func)))

(defpart 2190
  :init-specs
  ((:texture (powercell-icon common))
   (:num 1.0)
   (:scale-x (meters 0.8))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))
   (:func 'part-progress-card-cell-func)))

(defpart 2191
  :init-specs
  ((:texture (egg-icon common))
   (:num 1.0)
   (:x (meters 1.05))
   (:scale-x (meters 0.8))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))
   (:func 'part-progress-card-cell-func)))

(defpart 2192
  :init-specs
  ((:texture (buzzerfly-icon common))
   (:num 1.0)
   (:x (meters 2.3))
   (:scale-x (meters 0.8))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))
   (:func 'part-progress-card-cell-func)))

(defpart 2336
  :init-specs
  ((:texture (headhud-button-01 Hud))
   (:num 1.0)
   (:scale-x (meters 1.6))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))
   (:func 'part-progress-hud-button-func)))

(defpart 2337
  :init-specs
  ((:texture (headhud-button-02 Hud))
   (:num 1.0)
   (:scale-x (meters 1.6))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))
   (:func 'part-progress-hud-button-func)))

(defpart 2338
  :init-specs
  ((:texture (headhud-button-03 Hud))
   (:num 1.0)
   (:scale-x (meters 1.6))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))
   (:func 'part-progress-hud-button-func)))

(defpart 2339
  :init-specs
  ((:texture (headhud-button-04 Hud))
   (:num 1.0)
   (:scale-x (meters 1.6))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))
   (:func 'part-progress-hud-button-func)))

(defpart 2142
  :init-specs
  ((:texture (p-white effects))
   (:num 1.0)
   (:scale-x (meters 9.2))
   (:scale-y (meters 2))
   (:r 0.0)
   (:g 0.0)
   (:b 0.0)
   (:a 64.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))
   (:func 'part-progress-card-slot-01-func)))

(defpart 2143
  :init-specs
  ((:texture (p-white effects))
   (:num 1.0)
   (:scale-x (meters 9.2))
   (:scale-y (meters 2))
   (:r 0.0)
   (:g 0.0)
   (:b 0.0)
   (:a 64.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))
   (:func 'part-progress-card-slot-02-func)))

(defpart 2144
  :init-specs
  ((:texture (p-white effects))
   (:num 1.0)
   (:scale-x (meters 9.2))
   (:scale-y (meters 2))
   (:r 0.0)
   (:g 0.0)
   (:b 0.0)
   (:a 64.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))
   (:func 'part-progress-card-slot-03-func)))

(defpart 2145
  :init-specs
  ((:texture (p-white effects))
   (:num 1.0)
   (:scale-x (meters 9.2))
   (:scale-y (meters 2))
   (:r 0.0)
   (:g 0.0)
   (:b 0.0)
   (:a 64.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))
   (:func 'part-progress-card-slot-04-func)))

(defpart 332
  :init-specs
  ((:texture (previous Hud))
   (:num 1.0)
   (:scale-x (meters 1.2))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))))

(defpart 333
  :init-specs
  ((:texture (next Hud))
   (:num 1.0)
   (:scale-x (meters 1.2))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))))

(defpart 334
  :init-specs
  ((:texture (selector Hud))
   (:num 1.0)
   (:scale-x (meters 1.8))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))))

(defpart 335
  :init-specs
  ((:texture (left Hud))
   (:num 1.0)
   (:scale-x (meters 3.5))
   (:scale-y (meters 13))
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))
   (:func 'part-progress-hud-left-func)))

(defpart 336
  :init-specs
  ((:texture (right Hud))
   (:num 1.0)
   (:scale-x (meters 6))
   (:scale-y (meters 13))
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))
   (:func 'part-progress-hud-right-func)))

(defpart 339
  :init-specs
  ((:texture (hud-powercell-orbit effects))
   (:num 1.0)
   (:scale-x (meters 0.3))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))
   (:userdata 4.0)
   (:func 'fuel-cell-progress-hud-orbit-callback)))

(defpart 340
  :init-specs
  ((:texture (hud-powercell-orbit effects))
   (:num 1.0)
   (:scale-x (meters 0.3))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))
   (:userdata 5.0)
   (:func 'fuel-cell-progress-hud-orbit-callback)))

(defpart 341
  :init-specs
  ((:texture (hud-powercell-orbit effects))
   (:num 1.0)
   (:scale-x (meters 0.3))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))
   (:userdata 6.0)
   (:func 'fuel-cell-progress-hud-orbit-callback)))

(defpart 342
  :init-specs
  ((:texture (hud-powercell-orbit effects))
   (:num 1.0)
   (:scale-x (meters 0.3))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))
   (:userdata 7.0)
   (:func 'fuel-cell-progress-hud-orbit-callback)))

(defpart 343
  :init-specs
  ((:texture (hud-powercell-orbit effects))
   (:num 1.0)
   (:scale-x (meters 0.2))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))
   (:userdata 9.0)
   (:func 'fuel-cell-progress-hud-orbit-callback)))

(defpart 338
  :init-specs
  ((:texture (hud-powercell effects))
   (:num 1.0)
   (:scale-x (meters 1.2))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))
   (:userdata 3.0)
   (:func 'fuel-cell-progress-hud-orbit-callback)))

(defpart 344
  :init-specs ((:fade-a -0.53333336)))

(defpart 345
  :init-specs
  ((:texture (flare effects))
   (:num 0.5)
   (:z (meters 0.52734375))
   (:scale-x (meters 0.25))
   (:rot-x 4)
   (:rot-z (degrees 0) (degrees 360))
   (:scale-y (meters 0.07) (meters 0.46))
   (:r 0.0 1 255.0)
   (:g 0.0 1 255.0)
   (:b 0.0 1 255.0)
   (:a 0.0)
   (:scalevel-x (meters 0.009765625))
   (:rotvel-z (degrees -0.15) (degrees 0.3))
   (:scalevel-y (meters 0.009765625))
   (:fade-a 0.35555556)
   (:timer (seconds -0.005))
   (:flags (bit2 bit3 bit9 bit13))
   (:userdata -1.0)
   (:func 'fuel-cell-progress-hud-orbit-callback)
   (:next-time (seconds 0.3))
   (:next-launcher 232)))

(defpart 346
  :init-specs
  ((:texture (flare effects))
   (:num 0.06)
   (:z (meters 0.52734375))
   (:scale-x (meters 1) (meters 0.25))
   (:rot-x 4)
   (:rot-z (degrees 0) (degrees 360))
   (:scale-y (meters 0.1))
   (:r 0.0 1 255.0)
   (:g 0.0 1 255.0)
   (:b 0.0 1 255.0)
   (:a 0.0)
   (:scalevel-x (meters 0.009765625))
   (:rotvel-z (degrees -0.15) (degrees 0.3))
   (:fade-a 0.32)
   (:timer (seconds -0.005))
   (:flags (bit2 bit3 bit9 bit13))
   (:userdata -1.0)
   (:func 'fuel-cell-progress-hud-orbit-callback)
   (:next-time (seconds 0.25))
   (:next-launcher 232)))

(defpart 347
  :init-specs
  ((:texture (starflash effects))
   (:num 1.0)
   (:z (meters 0.52734375))
   (:scale-x (meters 2))
   (:rot-z (degrees 0) (degrees 360))
   (:scale-y (meters 1.8))
   (:r 192.0)
   (:g 192.0)
   (:b 0.0 128.0)
   (:a 64.0)
   (:rotvel-z (degrees -0.4))
   (:timer (seconds -0.005))
   (:flags (bit2 bit3 bit9 bit13))
   (:userdata -1.0)
   (:func 'fuel-cell-progress-hud-orbit-callback)))

(defpart 348
  :init-specs
  ((:texture (starflash effects))
   (:num 1.0)
   (:z (meters 0.52734375))
   (:scale-x (meters 2.4))
   (:rot-z (degrees 0) (degrees 360))
   (:scale-y (meters 2))
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 64.0)
   (:rotvel-z (degrees 0.3))
   (:timer (seconds -0.005))
   (:flags (bit2 bit3 bit9 bit13))
   (:userdata -1.0)
   (:func 'fuel-cell-progress-hud-orbit-callback)))

(defpartgroup group-part-progress-hud-power-cell-whole
  :id 97
  :flags (use-local-clock screen-space)
  :bounds (static-bspherem 0 0 0 100)
  :parts
  ((sp-item 338 :flags (launch-asap))
   (sp-item 347 :flags (launch-asap) :period (seconds 12) :length (seconds 0.017))
   (sp-item 348 :flags (launch-asap) :period (seconds 12) :length (seconds 0.017))
   (sp-item 343 :flags (launch-asap))
   (sp-item 339 :flags (launch-asap))
   (sp-item 340 :flags (launch-asap))
   (sp-item 341 :flags (launch-asap))
   (sp-item 342 :flags (launch-asap))))

(defpartgroup group-part-progress-buzzer
  :id 98
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 100)
  :parts ((sp-item 1982 :flags (launch-asap) :binding 1981) (sp-item 1981 :flags (start-dead launch-asap))))

(defpart 1982
  :init-specs
  ((:texture (hud-buzzer effects))
   (:num 1.0)
   (:scale-x (meters 2.2))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 0.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))))

(defpart 1981
  :init-specs
  ((:texture (hud-buzzer effects))
   (:num 1.0)
   (:x (meters 0))
   (:y (meters 1.3333334))
   (:z (meters 0.1))
   (:scale-x (meters 2))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:omega 0.0)
   (:vel-x (meters 0.053333335))
   (:vel-z (meters 0))
   (:timer (seconds -0.005))
   (:flags (bit2 bit7 bit9 bit13))))

(defpartgroup group-part-progress-orb
  :id 99
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 100)
  :parts ((sp-item 1983 :flags (launch-asap))))

(defpart 1983
  :init-specs
  ((:texture (hud-egg effects))
   (:num 1.0)
   (:scale-x (meters 2.2))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))))

(defpartgroup group-part-progress-buzzer-small
  :id 100
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 100)
  :parts ((sp-item 1985 :flags (launch-asap) :binding 1984) (sp-item 1984 :flags (start-dead launch-asap))))

(defpart 1985
  :init-specs
  ((:texture (hud-buzzer effects))
   (:num 1.0)
   (:scale-x (meters 1))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 0.0)
   (:timer (seconds -0.005))
   (:flags (bit9 bit13))))

(defpart 1984
  :init-specs
  ((:texture (hud-buzzer effects))
   (:num 1.0)
   (:x (meters 0))
   (:y (meters 1.3333334))
   (:z (meters 0.05))
   (:scale-x (meters 1.5))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:omega 0.0)
   (:vel-x (meters 0.05037037))
   (:vel-z (meters 0))
   (:timer (seconds -0.005))
   (:flags (bit2 bit7 bit9 bit13))
   (:func 'part-progress-hud-buzzer-func)))

(defpartgroup group-part-progress-orb-small
  :id 101
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 100)
  :parts ((sp-item 1986 :flags (launch-asap))))

(defpart 1986
  :init-specs
  ((:texture (hud-egg effects))
   (:num 1.0)
   (:scale-x (meters 1.3))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))
   (:func 'part-progress-hud-orb-func)))

(defpartgroup group-part-progress-save-icon
  :id 615
  :flags (screen-space)
  :bounds (static-bspherem 0 0 0 100)
  :parts ((sp-item 2478 :flags (launch-asap))))

(defpart 2478
  :init-specs
  ((:texture (checkpoint common))
   (:num 1.0)
   (:scale-x (meters 1.8))
   (:scale-y :copy scale-x)
   (:r 128.0)
   (:g 128.0)
   (:b 128.0)
   (:a 128.0)
   (:timer (seconds -0.005))
   (:flags (bit2 bit9 bit13))
   (:func 'part-progress-save-icon-func)))

(defmacro progress-new-particle (&key part &key x &key y &key z)
  `(when (< (-> this nb-of-particles) (-> this max-nb-of-particles))
    (let ((part-nb (-> this nb-of-particles)))
      (set! (-> this particles part-nb) (new 'static 'hud-particle))
      (set! (-> this particles part-nb part) (create-launch-control (-> *part-group-id-table* ,part) this))
      (set! (-> this particles part-nb init-pos x) ,x)
      (set! (-> this particles part-nb init-pos y) ,y)
      (set! (-> this particles part-nb init-pos z) ,z)
      (set! (-> this particles part-nb part matrix) -1))
    (+! (-> this nb-of-particles) 1)))

(defmethod initialize-particles ((this progress))
  (progress-new-particle :part 90 :x 256.0 :y 224.0 :z 16.0) ;; tint
  (progress-new-particle :part 88 :x -42.0 :y (#if PC_PORT 256.0 254.0) :z 5.0) ;; left
  (progress-new-particle :part 89 :x 610.0 :y (#if PC_PORT 256.0 254.0) :z 5.0) ;; right
  (progress-new-particle :part 85 :x -320.0 :y 40.0 :z 14.0) ;; prev
  (progress-new-particle :part 86 :x -320.0 :y 400.0 :z 14.0) ;; next
  (progress-new-particle :part 87 :x -320.0 :y 194.0 :z 15.0)
  (progress-new-particle :part 97 :x -320.0 :y 194.0 :z 14.0)
  (progress-new-particle :part 97 :x -320.0 :y 194.0 :z 14.0)
  (progress-new-particle :part 97 :x -320.0 :y 194.0 :z 14.0)
  (progress-new-particle :part 97 :x -320.0 :y 194.0 :z 14.0)
  (progress-new-particle :part 97 :x -320.0 :y 194.0 :z 14.0)
  (progress-new-particle :part 97 :x -320.0 :y 194.0 :z 14.0)
  (progress-new-particle :part 97 :x -320.0 :y 194.0 :z 14.0)
  (progress-new-particle :part 97 :x -320.0 :y 194.0 :z 14.0)
  (progress-new-particle :part 98 :x -320.0 :y 224.0 :z 14.0)
  (progress-new-particle :part 99 :x -320.0 :y 224.0 :z 14.0)
  (progress-new-particle :part 97 :x -320.0 :y 112.0 :z 4.0) ;; powercell
  (progress-new-particle :part 100 :x -320.0 :y 193.0 :z 4.0) ;; scout fly
  (progress-new-particle :part 101 :x -320.0 :y 40.0 :z 4.0) ;; orb glow
  (progress-new-particle :part 92 :x -320.0 :y 90.0 :z 16.0)
  (progress-new-particle :part 93 :x -320.0 :y 172.0 :z 16.0)
  (progress-new-particle :part 94 :x -320.0 :y 254.0 :z 16.0)
  (progress-new-particle :part 95 :x -320.0 :y 336.0 :z 16.0)
  (progress-new-particle :part 91 :x -320.0 :y 102.0 :z 13.0)
  (progress-new-particle :part 91 :x -320.0 :y 184.0 :z 13.0)
  (progress-new-particle :part 91 :x -320.0 :y 266.0 :z 13.0)
  (progress-new-particle :part 91 :x -320.0 :y 348.0 :z 13.0)
  (progress-new-particle :part 570 :x -320.0 :y 338.0 :z 4.0)
  (progress-new-particle :part 571 :x -320.0 :y 338.0 :z 4.0)
  (progress-new-particle :part 572 :x -320.0 :y 338.0 :z 4.0)
  (progress-new-particle :part 573 :x -320.0 :y 338.0 :z 4.0)
  (progress-new-particle :part 615 :x -320.0 :y 180.0 :z 4.0)
  (#when PC_PORT
    (progress-new-particle :part 85 :x -320.0 :y 32.0 :z 14.0) ;; prev
    (progress-new-particle :part 86 :x -320.0 :y 412.0 :z 14.0) ;; next
    )
  0
  (none))
