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

;; name: kor-task.gc
;; name in dgo: kor-task
;; dgos: CTYKORA

;; DECOMP BEGINS

(defmethod reset-task! ((this kort-wait-spot))
  (set! (-> this check-done) #f)
  (set! (-> this which-spot) -1)
  (set! (-> this num-spots) (the-as uint 0))
  0
  (none)
  )

;; WARN: Return type mismatch symbol vs none.
(defmethod ai-task-method-11 ((this kort-wait-spot) (arg0 bot))
  (let ((s4-0 (-> this which-spot)))
    (when (>= s4-0 0)
      (let ((s3-0 (-> arg0 course spots (-> this spot-indexes s4-0))))
        (if (and (not (outside-spot-radius? arg0 s3-0 (the-as vector #f) #f)) (player-blocking-spot? arg0 s3-0))
            (set! s4-0 -1)
            )
        )
      )
    (when (< s4-0 0)
      (set! s4-0 (choose-spot arg0 (the-as int (-> this num-spots)) (the-as (pointer uint) (-> this spot-indexes))))
      (set! (-> this which-spot) s4-0)
      (mem-copy!
        (the-as pointer (-> arg0 spot))
        (the-as pointer (-> arg0 course spots (-> this spot-indexes s4-0)))
        20
        )
      )
    (if (logtest? *display-bot-marks* (bot-marks-controls bmc16))
        (bot-debug-draw-spot-sphere
          arg0
          (the-as int (-> this num-spots))
          (the-as (pointer uint) (-> this spot-indexes))
          (the-as int (-> this spot-indexes s4-0))
          )
        )
    )
  ((-> this check-done) this (the-as kor arg0))
  (none)
  )
