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

;; name: stadiuma-mood.gc
;; name in dgo: stadiuma-mood
;; dgos: STAA

;; DECOMP BEGINS

(deftype stadiumb-states (structure)
  ((light  light-state   :inline)
   (flame  flames-state  :inline)
   )
  )


(defbehavior update-mood-stadiumb time-of-day-proc ((arg0 mood-context) (arg1 float) (arg2 int))
  (copy-mood-exterior arg0)
  (when (and (= (-> *level* level arg2 status) 'active)
             (< (the-as uint (-> *time-of-day-context* mode)) (the-as uint 9))
             )
    (-> arg0 state)
    (set! (-> arg0 times 5 w) 1.0)
    (update-mood-flames arg0 6 1 8 1.0 0.000390625 1.5)
    (set! (-> arg0 times 7 w) 1.0)
    )
  0
  (none)
  )

(deftype stadiuma-states (structure)
  ((light        light-state        :inline)
   (electricity  electricity-state  2 :inline)
   (pad          uint8              16)
   )
  )


;; WARN: Return type mismatch float vs none.
(defun init-mood-stadiuma ((arg0 mood-context))
  (let ((v1-0 (-> arg0 state)))
    (set! (-> v1-0 3) (the-as uint 1.0))
    (set! (-> v1-0 7) (the-as uint 1.0))
    )
  (none)
  )

(defbehavior update-mood-stadiuma time-of-day-proc ((arg0 mood-context) (arg1 float) (arg2 int))
  (copy-mood-exterior arg0)
  (when (and (= (-> *level* level arg2 status) 'active)
             (< (the-as uint (-> *time-of-day-context* mode)) (the-as uint 9))
             )
    (-> arg0 state)
    (set! (-> arg0 times 5 w) 1.0)
    (update-mood-electricity arg0 6 8 1.2 1.7)
    (update-mood-electricity arg0 7 24 1.2 1.7)
    )
  0
  (none)
  )

(defun set-stadiuma-electricity-scale! ((arg0 float) (arg1 int) (arg2 symbol))
  (let ((v1-1 (level-get *level* 'stadiuma)))
    (when v1-1
      (let ((v1-2 (the-as object (-> v1-1 mood-context state))))
        (set! (-> (the-as stadiuma-states (+ (the-as uint v1-2) (* arg1 16))) electricity 0 scale) arg0)
        )
      )
    )
  (let ((v1-5 (level-get *level* 'rubblea2)))
    (when (and v1-5 (or (not arg2) (= arg2 (-> v1-5 name))))
      (let ((v1-6 (the-as object (-> v1-5 mood-context state))))
        (set! (-> (the-as stadiuma-states (+ (the-as uint v1-6) (* arg1 16))) electricity 0 scale) arg0)
        )
      )
    )
  (let ((v1-9 (level-get *level* 'rubbleb)))
    (when (and v1-9 (or (not arg2) (= arg2 (-> v1-9 name))))
      (let ((v1-10 (the-as object (-> v1-9 mood-context state))))
        (set! (-> (the-as stadiuma-states (+ (the-as uint v1-10) (* arg1 16))) electricity 0 scale) arg0)
        )
      )
    )
  (let ((v1-13 (level-get *level* 'rubblec)))
    (when (and v1-13 (or (not arg2) (= arg2 (-> v1-13 name))))
      (let ((v1-14 (the-as object (-> v1-13 mood-context state))))
        (set! (-> (the-as stadiuma-states (+ (the-as uint v1-14) (* arg1 16))) electricity 0 scale) arg0)
        )
      )
    )
  (let ((v1-17 (level-get *level* 'rublcst)))
    (when (and v1-17 (or (not arg2) (= arg2 (-> v1-17 name)) (= arg2 'rubblec)))
      (let ((v1-18 (the-as object (-> v1-17 mood-context state))))
        (set! (-> (the-as stadiuma-states (+ (the-as uint v1-18) (* arg1 16))) electricity 0 scale) arg0)
        )
      )
    )
  0
  )
