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

;; definition of type prototype-bucket
(deftype prototype-bucket (basic)
  ((name          string           :offset-assert   4)
   (flags         uint32           :offset-assert   8)
   (in-level      uint16           :offset-assert  12)
   (utextures     uint16           :offset-assert  14)
   (geometry      drawable 4       :offset-assert  16)
   (dists         vector   :inline :offset-assert  32)
   (rdists        vector   :inline :offset-assert  48)
   (next          uint32   4       :offset-assert  64)
   (count         uint16   4       :offset-assert  80)
   (near-plane    meters           :offset         32)
   (near-stiff    meters           :offset         36)
   (mid-plane     meters           :offset         40)
   (far-plane     meters           :offset         44)
   (rlength-near  float            :offset         48)
   (rlength-stiff float            :offset         52)
   (rlength-mid   float            :offset         56)
   (stiffness     float            :offset         60)
   (next-clear    uint128          :offset         64)
   (next-clear-1  int32            :offset         64)
   (next-clear-2  int32            :offset         68)
   (next-clear-3  int32            :offset         72)
   (next-clear-4  int32            :offset         76)
   (count-clear   uint64           :offset         80)
   )
  :method-count-assert 9
  :size-assert         #x58
  :flag-assert         #x900000058
  )

;; definition for method 3 of type prototype-bucket
;; INFO: Used lq/sq
(defmethod inspect prototype-bucket ((obj prototype-bucket))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tname: ~A~%" (-> obj name))
  (format #t "~Tflags: ~D~%" (-> obj flags))
  (format #t "~Tin-level: ~D~%" (-> obj in-level))
  (format #t "~Tutextures: ~D~%" (-> obj utextures))
  (format #t "~Tgeometry[4] @ #x~X~%" (-> obj geometry))
  (format #t "~Tdists: #<vector @ #x~X>~%" (-> obj dists))
  (format #t "~Trdists: #<vector @ #x~X>~%" (-> obj rdists))
  (format #t "~Tnext[4] @ #x~X~%" (-> obj next))
  (format #t "~Tcount[4] @ #x~X~%" (-> obj count))
  (format #t "~Tnear-plane: (meters ~m)~%" (-> obj dists x))
  (format #t "~Tnear-stiff: (meters ~m)~%" (-> obj dists y))
  (format #t "~Tmid-plane: (meters ~m)~%" (-> obj dists z))
  (format #t "~Tfar-plane: (meters ~m)~%" (-> obj dists w))
  (format #t "~Trlength-near: ~f~%" (-> obj rdists x))
  (format #t "~Trlength-stiff: ~f~%" (-> obj rdists y))
  (format #t "~Trlength-mid: ~f~%" (-> obj rdists z))
  (format #t "~Tstiffness: ~f~%" (-> obj rdists w))
  (format #t "~Tnext-clear: ~D~%" (-> obj next-clear))
  (format #t "~Tcount-clear: ~D~%" (-> obj count-clear))
  obj
  )

;; definition of type prototype-bucket-shrub
(deftype prototype-bucket-shrub (prototype-bucket)
  ((mod-count         uint16     4 :offset-assert  88)
   (last              dma-packet 4 :offset-assert  96)
   (count-clear-qword uint128      :offset         80)
   (last-clear        uint128      :offset         96)
   )
  :method-count-assert 9
  :size-assert         #x70
  :flag-assert         #x900000070
  )

;; definition for method 3 of type prototype-bucket-shrub
;; INFO: Used lq/sq
(defmethod inspect prototype-bucket-shrub ((obj prototype-bucket-shrub))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tname: ~A~%" (-> obj name))
  (format #t "~Tflags: ~D~%" (-> obj flags))
  (format #t "~Tin-level: ~D~%" (-> obj in-level))
  (format #t "~Tutextures: ~D~%" (-> obj utextures))
  (format #t "~Tgeometry[4] @ #x~X~%" (-> obj geometry))
  (format #t "~Tdists: #<vector @ #x~X>~%" (-> obj dists))
  (format #t "~Trdists: #<vector @ #x~X>~%" (-> obj rdists))
  (format #t "~Tnext[4] @ #x~X~%" (-> obj next))
  (format #t "~Tcount[4] @ #x~X~%" (-> obj count))
  (format #t "~Tnear-plane: (meters ~m)~%" (-> obj dists x))
  (format #t "~Tnear-stiff: (meters ~m)~%" (-> obj dists y))
  (format #t "~Tmid-plane: (meters ~m)~%" (-> obj dists z))
  (format #t "~Tfar-plane: (meters ~m)~%" (-> obj dists w))
  (format #t "~Trlength-near: ~f~%" (-> obj rdists x))
  (format #t "~Trlength-stiff: ~f~%" (-> obj rdists y))
  (format #t "~Trlength-mid: ~f~%" (-> obj rdists z))
  (format #t "~Tstiffness: ~f~%" (-> obj rdists w))
  (format #t "~Tnext-clear: ~D~%" (-> obj next-clear))
  (format #t "~Tcount-clear: ~D~%" (-> obj count-clear))
  (format #t "~Tmod-count[4] @ #x~X~%" (-> obj mod-count))
  (format #t "~Tlast[4] @ #x~X~%" (-> obj last))
  (format #t "~Tlast-clear: ~D~%" (-> obj last-clear))
  obj
  )

;; definition of type prototype-inline-array-shrub
(deftype prototype-inline-array-shrub (drawable)
  ((length int16                            :offset          6)
   (data   prototype-bucket-shrub 1 :inline :offset         32)
   (_pad   uint32                           :offset-assert 144)
   )
  :method-count-assert 18
  :size-assert         #x94
  :flag-assert         #x1200000094
  )

;; definition for method 3 of type prototype-inline-array-shrub
(defmethod inspect prototype-inline-array-shrub ((obj prototype-inline-array-shrub))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tid: ~D~%" (-> obj id))
  (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere))
  (format #t "~Tlength: ~D~%" (-> obj length))
  (format #t "~Tdata[1] @ #x~X~%" (-> obj data))
  obj
  )

;; definition of type prototype-array-shrub-info
(deftype prototype-array-shrub-info (basic)
  ((prototype-inline-array-shrub prototype-inline-array-shrub  :offset-assert   4)
   (wind-vectors                 uint32                        :offset-assert   8)
   )
  :method-count-assert 9
  :size-assert         #xc
  :flag-assert         #x90000000c
  )

;; definition for method 3 of type prototype-array-shrub-info
(defmethod inspect prototype-array-shrub-info ((obj prototype-array-shrub-info))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tprototype-inline-array-shrub: ~A~%" (-> obj prototype-inline-array-shrub))
  (format #t "~Twind-vectors: #x~X~%" (-> obj wind-vectors))
  obj
  )

;; definition of type prototype-bucket-tie
(deftype prototype-bucket-tie (prototype-bucket)
  ((generic-count       uint16                                 4        :offset-assert  88)
   (generic-next        uint32                                 4        :offset-assert  96)
   (frag-count          uint8                                  4        :offset-assert 112)
   (index-start         uint8                                  4        :offset-assert 116)
   (base-qw             uint16                                 4        :offset-assert 120)
   (envmap-rfade        float                                           :offset-assert 128)
   (envmap-fade-far     float                                           :offset-assert 132)
   (envmap-shader       adgif-shader                                    :offset-assert 136)
   (collide-frag        drawable-inline-array-collide-fragment          :offset-assert 140)
   (tie-colors          time-of-day-palette                             :offset-assert 144)
   (data                uint32                                 :dynamic :offset-assert 148)
   (color-index-qwc     uint32                                 :dynamic :offset-assert 148)
   (generic-next-clear  uint128                                         :offset         96)
   (generic-count-clear uint128                                         :offset         80)
   (geometry-override   prototype-tie                          4        :offset         16)
   )
  :method-count-assert 9
  :size-assert         #x94
  :flag-assert         #x900000094
  )

;; definition for method 3 of type prototype-bucket-tie
;; INFO: Used lq/sq
(defmethod inspect prototype-bucket-tie ((obj prototype-bucket-tie))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tname: ~A~%" (-> obj name))
  (format #t "~Tflags: ~D~%" (-> obj flags))
  (format #t "~Tin-level: ~D~%" (-> obj in-level))
  (format #t "~Tutextures: ~D~%" (-> obj utextures))
  (format #t "~Tgeometry[4] @ #x~X~%" (-> obj geometry-override))
  (format #t "~Tdists: #<vector @ #x~X>~%" (-> obj dists))
  (format #t "~Trdists: #<vector @ #x~X>~%" (-> obj rdists))
  (format #t "~Tnext[4] @ #x~X~%" (-> obj next))
  (format #t "~Tcount[4] @ #x~X~%" (-> obj count))
  (format #t "~Tnear-plane: (meters ~m)~%" (-> obj dists x))
  (format #t "~Tnear-stiff: (meters ~m)~%" (-> obj dists y))
  (format #t "~Tmid-plane: (meters ~m)~%" (-> obj dists z))
  (format #t "~Tfar-plane: (meters ~m)~%" (-> obj dists w))
  (format #t "~Trlength-near: ~f~%" (-> obj rdists x))
  (format #t "~Trlength-stiff: ~f~%" (-> obj rdists y))
  (format #t "~Trlength-mid: ~f~%" (-> obj rdists z))
  (format #t "~Tstiffness: ~f~%" (-> obj rdists w))
  (format #t "~Tnext-clear: ~D~%" (-> obj next-clear))
  (format #t "~Tcount-clear: ~D~%" (-> obj count-clear))
  (format #t "~Tgeneric-count[4] @ #x~X~%" (-> obj generic-count))
  (format #t "~Tgeneric-next[4] @ #x~X~%" (-> obj generic-next))
  (format #t "~Tfrag-count[4] @ #x~X~%" (-> obj frag-count))
  (format #t "~Tindex-start[4] @ #x~X~%" (-> obj index-start))
  (format #t "~Tbase-qw[4] @ #x~X~%" (-> obj base-qw))
  (format #t "~Tenvmap-rfade: ~f~%" (-> obj envmap-rfade))
  (format #t "~Tenvmap-fade-far: ~f~%" (-> obj envmap-fade-far))
  (format #t "~Tenvmap-shader: #<adgif-shader @ #x~X>~%" (-> obj envmap-shader))
  (format #t "~Tcollide-frag: ~A~%" (-> obj collide-frag))
  (format #t "~Ttie-colors: ~A~%" (-> obj tie-colors))
  (format #t "~Tdata[0] @ #x~X~%" (-> obj data))
  (format #t "~Tcolor-index-qwc[0] @ #x~X~%" (-> obj data))
  (format #t "~Tgeneric-next-clear: ~D~%" (-> obj generic-next-clear))
  (format #t "~Tgeneric-count-clear: ~D~%" (-> obj generic-count-clear))
  obj
  )

;; definition of type prototype-array-tie
(deftype prototype-array-tie (array)
  ((array-data prototype-bucket-tie :dynamic :offset  16)
   )
  :method-count-assert 10
  :size-assert         #x10
  :flag-assert         #xa00000010
  (:methods
    (login (_type_) none 9)
    )
  )

;; definition for method 3 of type prototype-array-tie
(defmethod inspect prototype-array-tie ((obj prototype-array-tie))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Ttype: ~A~%" (-> obj type))
  (format #t "~Tlength: ~D~%" (-> obj length))
  (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length))
  (format #t "~Tcontent-type: ~A~%" (-> obj content-type))
  obj
  )

;; definition of type proxy-prototype-array-tie
(deftype proxy-prototype-array-tie (basic)
  ((prototype-array-tie prototype-array-tie  :offset-assert   4)
   (wind-vectors        uint32               :offset-assert   8)
   )
  :method-count-assert 9
  :size-assert         #xc
  :flag-assert         #x90000000c
  )

;; definition for method 3 of type proxy-prototype-array-tie
(defmethod inspect proxy-prototype-array-tie ((obj proxy-prototype-array-tie))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tprototype-array-tie: ~A~%" (-> obj prototype-array-tie))
  (format #t "~Twind-vectors: #x~X~%" (-> obj wind-vectors))
  obj
  )

;; definition of type instance
(deftype instance (drawable)
  ((bucket-index   uint16                           :offset          6)
   (error          (pointer drawable-error)         :offset          8)
   (origin         matrix4h                 :inline :offset-assert  32)
   (unknown-vector vector                   :inline :offset         32)
   (wind-index     uint16                           :offset         62)
   )
  :method-count-assert 18
  :size-assert         #x40
  :flag-assert         #x1200000040
  )

;; definition for method 3 of type instance
(defmethod inspect instance ((obj instance))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tid: ~D~%" (-> obj id))
  (format #t "~Tbsphere: ~`vector`P~%" (-> obj bsphere))
  (format #t "~Tbucket-index: ~D~%" (-> obj bucket-index))
  (format #t "~Torigin: #<matrix4h @ #x~X>~%" (-> obj origin))
  (format #t "~Twind-index: ~D~%" (-> obj wind-index))
  obj
  )

;; failed to figure out what this is:
0
