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

(import "goal_src/jak1/import/geologist-ag.gc")

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

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

;; failed to figure out what this is:
(defskelgroup *geologist-sg* geologist geologist-lod0-jg geologist-idle-ja
              ((geologist-lod0-mg (meters 20)) (geologist-lod1-mg (meters 40)) (geologist-lod2-mg (meters 999999)))
              :bounds (static-spherem 0 0 0 4)
              :shadow geologist-shadow-mg
              )

;; definition for method 32 of type geologist
(defmethod play-anim! geologist ((obj geologist) (arg0 symbol))
  (set! (-> obj talk-message) (game-text-id press-to-talk))
  (case (current-status (-> obj tasks))
    (((task-status need-hint) (task-status need-introduction))
     (when arg0
       (close-status! (-> obj tasks) (task-status need-introduction))
       (close-specific-task! (game-task village2-geologist-money) (task-status need-introduction))
       )
     (new 'static 'spool-anim
       :name "geologist-introduction"
       :index 6
       :parts 13
       :command-list '((0 want-levels village2 rolling)
         (199 joint "cameraB")
         (325 joint "camera")
         (520 alive "racer-2")
         (544 joint "cameraB")
         (546 dead "racer-2")
         (809 joint "camera")
         (1031 joint "cameraB")
         (1229 joint "camera")
         )
       )
     )
    (((task-status need-reminder))
     (set! (-> obj skippable) #t)
     (cond
       ((closed? (-> obj tasks) (game-task rolling-moles) (task-status need-reward-speech))
        (new 'static 'spool-anim :name "geologist-reminder-money" :index 8 :parts 2 :command-list '())
        )
       ((closed? (-> obj tasks) (game-task village2-geologist-money) (task-status need-reward-speech))
        (new 'static 'spool-anim :name "geologist-reminder-moles" :index 7 :parts 3 :command-list '())
        )
       ((zero? (get-reminder (-> obj tasks) 0))
        (if arg0
            (save-reminder (-> obj tasks) 1 0)
            )
        (new 'static 'spool-anim :name "geologist-reminder-moles" :index 7 :parts 3 :command-list '())
        )
       (else
         (if arg0
             (save-reminder (-> obj tasks) 0 0)
             )
         (new 'static 'spool-anim :name "geologist-reminder-money" :index 8 :parts 2 :command-list '())
         )
       )
     )
    (((task-status need-reward-speech))
     (if (not arg0)
         (set! (-> obj will-talk) #t)
         )
     (case (current-task (-> obj tasks))
       (((game-task rolling-moles))
        (when arg0
          (set! (-> obj cell-for-task) (current-task (-> obj tasks)))
          (close-current! (-> obj tasks))
          )
        (new 'static 'spool-anim :name "geologist-resolution-moles" :index 9 :parts 3 :command-list '())
        )
       (else
         (cond
           (arg0
             (set! (-> obj cell-for-task) (current-task (-> obj tasks)))
             (close-current! (-> obj tasks))
             (send-event *target* 'get-pickup 5 (- (-> *GAME-bank* money-task-inc)))
             )
           (else
             (set! (-> obj talk-message) (game-text-id press-to-trade-money))
             )
           )
         (new 'static 'spool-anim :name "geologist-resolution-money" :index 10 :parts 2 :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 5)
      )
    )
  )

;; definition for method 31 of type geologist
(defmethod get-art-elem geologist ((obj geologist))
  (-> obj draw art-group data 5)
  )

;; definition for method 43 of type geologist
(defmethod TODO-RENAME-43 geologist ((obj geologist))
  (when (TODO-RENAME-10 (-> obj ambient) (new 'stack-no-clear 'vector) (seconds 30) 122880.0 obj)
    (let ((f0-2 (rand-float-gen)))
      (cond
        ((< 0.8888889 f0-2)
         (play-ambient (-> obj ambient) "GEO-AM01" #f (-> obj root-override trans))
         )
        ((< 0.7777778 f0-2)
         (if (not (closed? (-> obj tasks) (game-task rolling-moles) (task-status need-reminder)))
             (play-ambient (-> obj ambient) "GEO-AM02" #f (-> obj root-override trans))
             )
         )
        ((< 0.6666667 f0-2)
         (play-ambient (-> obj ambient) "GEO-AM03" #f (-> obj root-override trans))
         )
        ((< 0.5555556 f0-2)
         (if (closed? (-> obj tasks) (game-task village2-geologist-money) (task-status need-introduction))
             (play-ambient (-> obj ambient) "GEO-AM04" #f (-> obj root-override trans))
             )
         )
        ((< 0.44444445 f0-2)
         (play-ambient (-> obj ambient) "GEO-AM05" #f (-> obj root-override trans))
         )
        ((< 0.33333334 f0-2)
         (play-ambient (-> obj ambient) "GEO-AM06" #f (-> obj root-override trans))
         )
        ((< 0.22222222 f0-2)
         (if (not (closed? (-> obj tasks) (game-task rolling-moles) (task-status need-reminder)))
             (play-ambient (-> obj ambient) "GEO-AM07" #f (-> obj root-override trans))
             )
         )
        ((< 0.11111111 f0-2)
         (play-ambient (-> obj ambient) "GEO-LO02" #f (-> obj root-override trans))
         )
        ((closed? (-> obj tasks) (game-task village2-geologist-money) (task-status need-resolution))
         (play-ambient (-> obj ambient) "GEO-AM08" #f (-> obj root-override trans))
         )
        (else
          (play-ambient (-> obj ambient) "GEO-LO01" #f (-> obj root-override trans))
          )
        )
      )
    )
  )

;; definition for method 11 of type geologist
(defmethod init-from-entity! geologist ((obj geologist) (arg0 entity-actor))
  (dummy-40 obj arg0 *geologist-sg* 3 45 (new 'static 'vector :w 4096.0) 5)
  (set! (-> obj tasks) (get-task-control (game-task rolling-moles)))
  (set! (-> obj sound-flava) (music-flava geologist))
  (set! (-> obj draw light-index) (the-as uint 2))
  (dummy-42 obj)
  (none)
  )
