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

(import "goal_src/jak1/import/bird-lady-ag.gc")

;; definition of type bird-lady
(deftype bird-lady (process-taskable)
  ()
  :heap-base #x110
  :method-count-assert 53
  :size-assert         #x17c
  :flag-assert         #x350110017c
  )

;; definition for method 3 of type bird-lady
(defmethod inspect bird-lady ((obj bird-lady))
  (let ((t9-0 (method-of-type process-taskable inspect)))
    (t9-0 obj)
    )
  obj
  )

;; failed to figure out what this is:
(defskelgroup *bird-lady-sg* bird-lady bird-lady-lod0-jg bird-lady-idle-ja
              ((bird-lady-lod0-mg (meters 999999)))
              :bounds (static-spherem 0 1 0 2.5)
              :shadow bird-lady-shadow-mg
              )

;; definition for method 52 of type bird-lady
;; INFO: Return type mismatch shadow-flags vs none.
(defmethod dummy-52 bird-lady ((obj bird-lady))
  (let ((v1-1 (-> obj draw shadow-ctrl)))
    (when v1-1
      (let ((f0-0 (-> obj root-override trans y)))
        (let ((a0-2 v1-1))
          (set! (-> a0-2 settings bot-plane w) (- (+ -1024.0 f0-0)))
          )
        0
        (let ((a0-4 v1-1))
          (set! (-> a0-4 settings top-plane w) (- (+ 4096.0 f0-0)))
          )
        )
      0
      (logclear! (-> v1-1 settings flags) (shadow-flags shdf03))
      )
    )
  (none)
  )

;; definition for method 48 of type bird-lady
(defmethod draw-npc-shadow bird-lady ((obj bird-lady))
  (-> obj draw shadow-ctrl)
  (cond
    ((and (-> obj draw shadow)
          (zero? (-> obj draw cur-lod))
          (logtest? (-> obj draw status) (draw-status was-drawn))
          )
     (let ((v1-9 (-> obj draw shadow-ctrl)))
       (logclear! (-> v1-9 settings flags) (shadow-flags disable-draw))
       )
     0
     (update-direction-from-time-of-day (-> obj draw shadow-ctrl))
     )
    (else
      (let ((v1-14 (-> obj draw shadow-ctrl)))
        (logior! (-> v1-14 settings flags) (shadow-flags disable-draw))
        )
      0
      )
    )
  (none)
  )

;; definition for method 32 of type bird-lady
(defmethod play-anim! bird-lady ((obj bird-lady) (arg0 symbol))
  (case (current-status (-> obj tasks))
    (((task-status need-hint) (task-status need-introduction))
     (if arg0
         (close-status! (-> obj tasks) (task-status need-introduction))
         )
     (new 'static 'spool-anim
       :name "bird-lady-introduction"
       :index 4
       :parts 11
       :command-list '((0 want-levels village1 beach)
         (49 joint "cameraB")
         (101 display-level beach special)
         (101 kill "yakow-8")
         (101 kill "yakow-9")
         (101 kill "yakow-10")
         (101 kill "yakow-11")
         (101 kill "yakow-12")
         (102 joint "camera")
         (125 joint "cameraB")
         (251 joint "camera")
         (326 joint "cameraB")
         (649 display-level beach movie)
         (649 want-force-vis beach #t)
         (650 alive "flutflutegg-1")
         (651 joint "camera")
         (1041 joint "cameraB")
         (1046 dead "flutflutegg-1")
         (1046 display-level beach display)
         (1046 want-force-vis beach #f)
         )
       )
     )
    (((task-status need-reminder))
     (set! (-> obj skippable) #t)
     (cond
       ((zero? (get-reminder (-> obj tasks) 0))
        (if arg0
            (save-reminder (-> obj tasks) 1 0)
            )
        (new 'static 'spool-anim :name "bird-lady-reminder-1" :index 5 :parts 4 :command-list '())
        )
       (else
         (if arg0
             (save-reminder (-> obj tasks) 0 0)
             )
         (new 'static 'spool-anim :name "bird-lady-reminder-2" :index 6 :parts 5 :command-list '())
         )
       )
     )
    (else
      (if arg0
          (format
            0
            "ERROR: <GMJ>: ~S playing anim for task status ~S~%"
            (-> obj name)
            (task-status->string (current-status (-> obj tasks)))
            )
          )
      (-> obj draw art-group data 3)
      )
    )
  )

;; definition for method 31 of type bird-lady
(defmethod get-art-elem bird-lady ((obj bird-lady))
  (-> obj draw art-group data 3)
  )

;; definition for method 43 of type bird-lady
(defmethod TODO-RENAME-43 bird-lady ((obj bird-lady))
  (when (TODO-RENAME-10 (-> obj ambient) (new 'stack-no-clear 'vector) (seconds 30) 122880.0 obj)
    (let ((f0-2 (rand-float-gen)))
      (cond
        ((< 0.66 f0-2)
         (play-ambient (-> obj ambient) "BIR-LO02" #f (-> obj root-override trans))
         )
        ((< 0.33 f0-2)
         (play-ambient (-> obj ambient) "BIR-LO03" #f (-> obj root-override trans))
         )
        (else
          (play-ambient (-> obj ambient) "BIR-am08" #f (-> obj root-override trans))
          )
        )
      )
    )
  )

;; definition for method 47 of type bird-lady
;; INFO: Return type mismatch basic vs symbol.
(defmethod target-above-threshold? bird-lady ((obj bird-lady))
  (the-as symbol (and *target* (< (-> (target-pos 0) z) -81920.0)))
  )

;; definition for method 11 of type bird-lady
(defmethod init-from-entity! bird-lady ((obj bird-lady) (arg0 entity-actor))
  (dummy-40 obj arg0 *bird-lady-sg* 3 51 (new 'static 'vector :y 4096.0 :w 4096.0) 5)
  (set! (-> obj tasks) (get-task-control (game-task beach-flutflut)))
  (set! (-> obj sound-flava) (music-flava birdlady))
  (set! (-> obj draw light-index) (the-as uint 4))
  (if (closed? (-> obj tasks) (game-task beach-flutflut) (task-status need-reminder))
      (cleanup-for-death obj)
      (go (method-of-object obj idle))
      )
  (none)
  )
