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

;; definition of type eye
(deftype eye (structure)
  ((data        vector 2 :inline :offset-assert   0)
   (x           float            :offset          0)
   (y           float            :offset          4)
   (lid         float            :offset          8)
   (iris-scale  float            :offset         16)
   (pupil-scale float            :offset         20)
   (lid-scale   float            :offset         24)
   )
  :method-count-assert 9
  :size-assert         #x20
  :flag-assert         #x900000020
  )

;; definition for method 3 of type eye
(defmethod inspect eye ((obj eye))
  (format #t "[~8x] ~A~%" obj 'eye)
  (format #t "~Tdata[2] @ #x~X~%" (-> obj data))
  (format #t "~Tx: ~f~%" (-> obj data 0 x))
  (format #t "~Ty: ~f~%" (-> obj data 0 y))
  (format #t "~Tlid: ~f~%" (-> obj data 0 z))
  (format #t "~Tiris-scale: ~f~%" (-> obj data 1 x))
  (format #t "~Tpupil-scale: ~f~%" (-> obj data 1 y))
  (format #t "~Tlid-scale: ~f~%" (-> obj data 1 z))
  obj
  )

;; definition of type eye-control
(deftype eye-control (structure)
  ((process     handle                              :offset-assert   0)
   (random-time uint16                              :offset-assert   8)
   (level       uint16                              :offset-assert  10)
   (blink       float                               :offset-assert  12)
   (shaders     (inline-array adgif-shader)         :offset-assert  16)
   (left        eye                         :inline :offset-assert  32)
   (right       eye                         :inline :offset-assert  64)
   )
  :method-count-assert 9
  :size-assert         #x60
  :flag-assert         #x900000060
  )

;; definition for method 3 of type eye-control
(defmethod inspect eye-control ((obj eye-control))
  (format #t "[~8x] ~A~%" obj 'eye-control)
  (format #t "~Tprocess: ~D~%" (-> obj process))
  (format #t "~Trandom-time: ~D~%" (-> obj random-time))
  (format #t "~Tlevel: ~D~%" (-> obj level))
  (format #t "~Tblink: ~f~%" (-> obj blink))
  (format #t "~Tshaders: #x~X~%" (-> obj shaders))
  (format #t "~Tleft: #<eye @ #x~X>~%" (-> obj left))
  (format #t "~Tright: #<eye @ #x~X>~%" (-> obj right))
  obj
  )

;; definition of type eye-control-array
(deftype eye-control-array (basic)
  ((data eye-control 11 :inline :offset-assert  16)
   )
  :method-count-assert 9
  :size-assert         #x430
  :flag-assert         #x900000430
  )

;; definition for method 3 of type eye-control-array
(defmethod inspect eye-control-array ((obj eye-control-array))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tdata[11] @ #x~X~%" (-> obj data))
  obj
  )

;; definition of type eye-work
(deftype eye-work (structure)
  ((sprite-tmpl  dma-gif-packet :inline :offset-assert   0)
   (sprite-tmpl2 dma-gif-packet :inline :offset-assert  32)
   (adgif-tmpl   dma-gif-packet :inline :offset-assert  64)
   (blink-table  float          10      :offset-assert  96)
   )
  :method-count-assert 9
  :size-assert         #x88
  :flag-assert         #x900000088
  )

;; definition for method 3 of type eye-work
(defmethod inspect eye-work ((obj eye-work))
  (format #t "[~8x] ~A~%" obj 'eye-work)
  (format #t "~Tsprite-tmpl: #<dma-gif-packet @ #x~X>~%" (-> obj sprite-tmpl))
  (format #t "~Tsprite-tmpl2: #<dma-gif-packet @ #x~X>~%" (-> obj sprite-tmpl2))
  (format #t "~Tadgif-tmpl: #<dma-gif-packet @ #x~X>~%" (-> obj adgif-tmpl))
  (format #t "~Tblink-table[10] @ #x~X~%" (-> obj blink-table))
  obj
  )

;; definition for symbol *eye-control-array*, type eye-control-array
(define *eye-control-array* (new 'static 'eye-control-array))

;; failed to figure out what this is:
(dotimes (v1-5 11)
  (set! (-> *eye-control-array* data v1-5 process) (the-as handle #f))
  (set! (-> *eye-control-array* data v1-5 shaders) (the-as (inline-array adgif-shader) #f))
  (set! (-> *eye-control-array* data v1-5 random-time) (the-as uint 60))
  (set! (-> *eye-control-array* data v1-5 blink) 0.0)
  )

;; failed to figure out what this is:
0
