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

;; definition of type ripple-merc-query
(deftype ripple-merc-query (inline-array-class)
  ((start-vertex int32                   :offset-assert  16)
   (vertex-skip  int32                   :offset-assert  20)
   (vertex-count int32                   :offset-assert  24)
   (current-loc  int32                   :offset-assert  28)
   (data         vector :inline :dynamic :offset-assert  32)
   )
  :method-count-assert 9
  :size-assert         #x20
  :flag-assert         #x900000020
  )

;; definition for method 3 of type ripple-merc-query
(defmethod inspect ripple-merc-query ((obj ripple-merc-query))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tlength: ~D~%" (-> obj length))
  (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length))
  (format #t "~Tstart-vertex: ~D~%" (-> obj start-vertex))
  (format #t "~Tvertex-skip: ~D~%" (-> obj vertex-skip))
  (format #t "~Tvertex-count: ~D~%" (-> obj vertex-count))
  (format #t "~Tcurrent-loc: ~D~%" (-> obj current-loc))
  (format #t "~Tdata[0] @ #x~X~%" (-> obj data))
  obj
  )

;; failed to figure out what this is:
(set! (-> ripple-merc-query heap-base) (the-as uint 16))

;; definition of type merc-byte-header
(deftype merc-byte-header (structure)
  ((srcdest-off        uint8    :offset-assert   0)
   (rgba-off           uint8    :offset-assert   1)
   (lump-off           uint8    :offset-assert   2)
   (fp-off             uint8    :offset-assert   3)
   (mat1-cnt           uint8    :offset-assert   4)
   (mat2-cnt           uint8    :offset-assert   5)
   (mat3-cnt           uint8    :offset-assert   6)
   (samecopy-cnt       uint8    :offset-assert   7)
   (crosscopy-cnt      uint8    :offset-assert   8)
   (strip-len          uint8    :offset-assert   9)
   (mm-quadword-fp-off uint8    :offset-assert  10)
   (mm-quadword-size   uint8    :offset-assert  11)
   (perc-off           uint8    :offset-assert  12)
   (mat-slot           uint8 10 :offset-assert  13)
   )
  :method-count-assert 9
  :size-assert         #x17
  :flag-assert         #x900000017
  )

;; definition for method 3 of type merc-byte-header
(defmethod inspect merc-byte-header ((obj merc-byte-header))
  (format #t "[~8x] ~A~%" obj 'merc-byte-header)
  (format #t "~Tsrcdest-off: ~D~%" (-> obj srcdest-off))
  (format #t "~Trgba-off: ~D~%" (-> obj rgba-off))
  (format #t "~Tlump-off: ~D~%" (-> obj lump-off))
  (format #t "~Tfp-off: ~D~%" (-> obj fp-off))
  (format #t "~Tmat1-cnt: ~D~%" (-> obj mat1-cnt))
  (format #t "~Tmat2-cnt: ~D~%" (-> obj mat2-cnt))
  (format #t "~Tmat3-cnt: ~D~%" (-> obj mat3-cnt))
  (format #t "~Tsamecopy-cnt: ~D~%" (-> obj samecopy-cnt))
  (format #t "~Tcrosscopy-cnt: ~D~%" (-> obj crosscopy-cnt))
  (format #t "~Tstrip-len: ~D~%" (-> obj strip-len))
  (format #t "~Tmm-quadword-fp-off: ~D~%" (-> obj mm-quadword-fp-off))
  (format #t "~Tmm-quadword-size: ~D~%" (-> obj mm-quadword-size))
  (format #t "~Tperc-off: ~D~%" (-> obj perc-off))
  (format #t "~Tmat-slot[10] @ #x~X~%" (-> obj mat-slot))
  obj
  )

;; definition of type merc-fragment
(deftype merc-fragment (structure)
  ((header merc-byte-header :inline :offset-assert   0)
   (rest   uint8            1       :offset-assert  23)
   )
  :method-count-assert 10
  :size-assert         #x18
  :flag-assert         #xa00000018
  (:methods
    (login-adgifs (_type_) none 9)
    )
  )

;; definition for method 3 of type merc-fragment
(defmethod inspect merc-fragment ((obj merc-fragment))
  (format #t "[~8x] ~A~%" obj 'merc-fragment)
  (format #t "~Theader: #<merc-byte-header @ #x~X>~%" (-> obj header))
  (format #t "~Trest[1] @ #x~X~%" (-> obj rest))
  obj
  )

;; definition of type merc-vtx
(deftype merc-vtx (structure)
  ((mat-0 uint8  :offset-assert   0)
   (mat-1 uint8  :offset-assert   1)
   (nrm-x uint8  :offset-assert   2)
   (pos-x uint8  :offset-assert   3)
   (dst-0 uint8  :offset-assert   4)
   (dst-1 uint8  :offset-assert   5)
   (nrm-y uint8  :offset-assert   6)
   (pos-y uint8  :offset-assert   7)
   (tex-s uint8  :offset-assert   8)
   (tex-t uint8  :offset-assert   9)
   (nrm-z uint8  :offset-assert  10)
   (pos-z uint8  :offset-assert  11)
   )
  :method-count-assert 9
  :size-assert         #xc
  :flag-assert         #x90000000c
  )

;; definition for method 3 of type merc-vtx
(defmethod inspect merc-vtx ((obj merc-vtx))
  (format #t "[~8x] ~A~%" obj 'merc-vtx)
  (format #t "~Tmat-0: ~D~%" (-> obj mat-0))
  (format #t "~Tmat-1: ~D~%" (-> obj mat-1))
  (format #t "~Tnrm-x: ~D~%" (-> obj nrm-x))
  (format #t "~Tpos-x: ~D~%" (-> obj pos-x))
  (format #t "~Tdst-0: ~D~%" (-> obj dst-0))
  (format #t "~Tdst-1: ~D~%" (-> obj dst-1))
  (format #t "~Tnrm-y: ~D~%" (-> obj nrm-y))
  (format #t "~Tpos-y: ~D~%" (-> obj pos-y))
  (format #t "~Ttex-s: ~D~%" (-> obj tex-s))
  (format #t "~Ttex-t: ~D~%" (-> obj tex-t))
  (format #t "~Tnrm-z: ~D~%" (-> obj nrm-z))
  (format #t "~Tpos-z: ~D~%" (-> obj pos-z))
  obj
  )

;; definition of type merc-fp-header
(deftype merc-fp-header (structure)
  ((x-add            float  :offset-assert   0)
   (y-add            float  :offset-assert   4)
   (z-add            float  :offset-assert   8)
   (shader-cnt       uint8  :offset-assert  12)
   (kick-info-offset uint8  :offset-assert  13)
   (kick-info-step   uint8  :offset-assert  14)
   (hword-cnt        uint8  :offset-assert  15)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type merc-fp-header
(defmethod inspect merc-fp-header ((obj merc-fp-header))
  (format #t "[~8x] ~A~%" obj 'merc-fp-header)
  (format #t "~Tx-add: ~f~%" (-> obj x-add))
  (format #t "~Ty-add: ~f~%" (-> obj y-add))
  (format #t "~Tz-add: ~f~%" (-> obj z-add))
  (format #t "~Tshader-cnt: ~D~%" (-> obj shader-cnt))
  (format #t "~Tkick-info-offset: ~D~%" (-> obj kick-info-offset))
  (format #t "~Tkick-info-step: ~D~%" (-> obj kick-info-step))
  (format #t "~Thword-cnt: ~D~%" (-> obj hword-cnt))
  obj
  )

;; definition for function merc-fragment-fp-data
;; INFO: Return type mismatch int vs merc-fp-header.
(defun merc-fragment-fp-data ((arg0 merc-fragment))
  (the-as merc-fp-header (+ (the-as uint arg0) (* (-> arg0 header mm-quadword-fp-off) 16)))
  )

;; definition of type merc-mat-dest
(deftype merc-mat-dest (structure)
  ((matrix-number uint8  :offset-assert   0)
   (matrix-dest   uint8  :offset-assert   1)
   )
  :pack-me
  :method-count-assert 9
  :size-assert         #x2
  :flag-assert         #x900000002
  )

;; definition for method 3 of type merc-mat-dest
(defmethod inspect merc-mat-dest ((obj merc-mat-dest))
  (format #t "[~8x] ~A~%" obj 'merc-mat-dest)
  (format #t "~Tmatrix-number: ~D~%" (-> obj matrix-number))
  (format #t "~Tmatrix-dest: ~D~%" (-> obj matrix-dest))
  obj
  )

;; definition of type merc-fragment-control
(deftype merc-fragment-control (structure)
  ((unsigned-four-count uint8                          :offset-assert   0)
   (lump-four-count     uint8                          :offset-assert   1)
   (fp-qwc              uint8                          :offset-assert   2)
   (mat-xfer-count      uint8                          :offset-assert   3)
   (mat-dest-data       merc-mat-dest :inline :dynamic :offset-assert   4)
   )
  :method-count-assert 9
  :size-assert         #x4
  :flag-assert         #x900000004
  )

;; definition for method 3 of type merc-fragment-control
;; INFO: this function exists in multiple non-identical object files
(defmethod inspect merc-fragment-control ((obj merc-fragment-control))
  (format #t "[~8x] ~A~%" obj 'merc-fragment-control)
  (format #t "~Tunsigned-four-count: ~D~%" (-> obj unsigned-four-count))
  (format #t "~Tlump-four-count: ~D~%" (-> obj lump-four-count))
  (format #t "~Tfp-qwc: ~D~%" (-> obj fp-qwc))
  (format #t "~Tmat-xfer-count: ~D~%" (-> obj mat-xfer-count))
  (format #t "~Tmat-dest-data[0] @ #x~X~%" (-> obj mat-dest-data))
  obj
  )

;; definition of type merc-blend-data
(deftype merc-blend-data (structure)
  ((int8-data int8 :dynamic :offset-assert   0)
   )
  :method-count-assert 9
  :size-assert         #x0
  :flag-assert         #x900000000
  )

;; definition for method 3 of type merc-blend-data
(defmethod inspect merc-blend-data ((obj merc-blend-data))
  (format #t "[~8x] ~A~%" obj 'merc-blend-data)
  (format #t "~Tint8-data[0] @ #x~X~%" (-> obj int8-data))
  obj
  )

;; definition of type merc-blend-ctrl
(deftype merc-blend-ctrl (structure)
  ((blend-vtx-count     uint8          :offset-assert   0)
   (nonzero-index-count uint8          :offset-assert   1)
   (bt-index            uint8 :dynamic :offset-assert   2)
   )
  :method-count-assert 9
  :size-assert         #x2
  :flag-assert         #x900000002
  )

;; definition for method 3 of type merc-blend-ctrl
(defmethod inspect merc-blend-ctrl ((obj merc-blend-ctrl))
  (format #t "[~8x] ~A~%" obj 'merc-blend-ctrl)
  (format #t "~Tblend-vtx-count: ~D~%" (-> obj blend-vtx-count))
  (format #t "~Tnonzero-index-count: ~D~%" (-> obj nonzero-index-count))
  (format #t "~Tbt-index[0] @ #x~X~%" (-> obj bt-index))
  obj
  )

;; definition of type mei-envmap-tint
(deftype mei-envmap-tint (structure)
  ((fade0 float   :offset-assert   0)
   (fade1 float   :offset-assert   4)
   (tint  uint32  :offset-assert   8)
   (dummy int32   :offset-assert  12)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type mei-envmap-tint
(defmethod inspect mei-envmap-tint ((obj mei-envmap-tint))
  (format #t "[~8x] ~A~%" obj 'mei-envmap-tint)
  (format #t "~Tfade0: ~f~%" (-> obj fade0))
  (format #t "~Tfade1: ~f~%" (-> obj fade1))
  (format #t "~Ttint: ~D~%" (-> obj tint))
  (format #t "~Tdummy: ~D~%" (-> obj dummy))
  obj
  )

;; definition of type mei-texture-scroll
(deftype mei-texture-scroll (structure)
  ((max-dist     float   :offset-assert   0)
   (st-int-scale uint8   :offset-assert   4)
   (time-factor  uint8   :offset-assert   5)
   (scroll-dir   uint8   :offset-assert   6)
   (cached-time  uint8   :offset-assert   7)
   (time-delta   uint8   :offset-assert   8)
   (dummy        uint8 7 :offset-assert   9)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type mei-texture-scroll
(defmethod inspect mei-texture-scroll ((obj mei-texture-scroll))
  (format #t "[~8x] ~A~%" obj 'mei-texture-scroll)
  (format #t "~Tmax-dist: ~f~%" (-> obj max-dist))
  (format #t "~Tst-int-scale: ~D~%" (-> obj st-int-scale))
  (format #t "~Ttime-factor: ~D~%" (-> obj time-factor))
  (format #t "~Tscroll-dir: ~D~%" (-> obj scroll-dir))
  (format #t "~Tcached-time: ~D~%" (-> obj cached-time))
  (format #t "~Ttime-delta: ~D~%" (-> obj time-delta))
  (format #t "~Tdummy[7] @ #x~X~%" (-> obj dummy))
  obj
  )

;; definition of type mei-ripple
(deftype mei-ripple (structure)
  ((x-base    float  :offset-assert   0)
   (z-base    float  :offset-assert   4)
   (grid-size float  :offset-assert   8)
   (angle     float  :offset-assert  12)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type mei-ripple
(defmethod inspect mei-ripple ((obj mei-ripple))
  (format #t "[~8x] ~A~%" obj 'mei-ripple)
  (format #t "~Tx-base: ~f~%" (-> obj x-base))
  (format #t "~Tz-base: ~f~%" (-> obj z-base))
  (format #t "~Tgrid-size: ~f~%" (-> obj grid-size))
  (format #t "~Tangle: ~f~%" (-> obj angle))
  obj
  )

;; definition of type merc-extra-info
(deftype merc-extra-info (structure)
  ((envmap-tint-offset    uint8    :offset-assert   0)
   (shader-offset         uint8    :offset-assert   1)
   (texture-scroll-offset uint8    :offset-assert   2)
   (ripple-offset         uint8    :offset-assert   3)
   (dummy                 uint8 12 :offset-assert   4)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type merc-extra-info
(defmethod inspect merc-extra-info ((obj merc-extra-info))
  (format #t "[~8x] ~A~%" obj 'merc-extra-info)
  (format #t "~Tenvmap-tint-offset: ~D~%" (-> obj envmap-tint-offset))
  (format #t "~Tshader-offset: ~D~%" (-> obj shader-offset))
  (format #t "~Ttexture-scroll-offset: ~D~%" (-> obj texture-scroll-offset))
  (format #t "~Tripple-offset: ~D~%" (-> obj ripple-offset))
  (format #t "~Tdummy[12] @ #x~X~%" (-> obj dummy))
  obj
  )

;; definition of type merc-effect
(deftype merc-effect (structure)
  ((frag-geo         merc-fragment           :offset-assert   0)
   (frag-ctrl        merc-fragment-control   :offset-assert   4)
   (blend-data       merc-blend-data         :offset-assert   8)
   (blend-ctrl       merc-blend-ctrl         :offset-assert  12)
   (dummy0           uint8                   :offset-assert  16)
   (effect-bits      uint8                   :offset-assert  17)
   (frag-count       uint16                  :offset-assert  18)
   (blend-frag-count uint16                  :offset-assert  20)
   (tri-count        uint16                  :offset-assert  22)
   (dvert-count      uint16                  :offset-assert  24)
   (dummy1           uint8                   :offset-assert  26)
   (envmap-usage     uint8                   :offset-assert  27)
   (extra-info       merc-extra-info         :offset-assert  28)
   (data             uint64                4 :offset          0)
   )
  :method-count-assert 10
  :size-assert         #x20
  :flag-assert         #xa00000020
  (:methods
    (login-adgifs (_type_) none 9)
    )
  )

;; definition for method 3 of type merc-effect
(defmethod inspect merc-effect ((obj merc-effect))
  (format #t "[~8x] ~A~%" obj 'merc-effect)
  (format #t "~Tfrag-geo: #<merc-fragment @ #x~X>~%" (-> obj frag-geo))
  (format #t "~Tfrag-ctrl: #<merc-fragment-control @ #x~X>~%" (-> obj frag-ctrl))
  (format #t "~Tblend-data: #<merc-blend-data @ #x~X>~%" (-> obj blend-data))
  (format #t "~Tblend-ctrl: #<merc-blend-ctrl @ #x~X>~%" (-> obj blend-ctrl))
  (format #t "~Tdummy0: ~D~%" (-> obj dummy0))
  (format #t "~Teffect-bits: ~D~%" (-> obj effect-bits))
  (format #t "~Tfrag-count: ~D~%" (-> obj frag-count))
  (format #t "~Tblend-frag-count: ~D~%" (-> obj blend-frag-count))
  (format #t "~Ttri-count: ~D~%" (-> obj tri-count))
  (format #t "~Tdvert-count: ~D~%" (-> obj dvert-count))
  (format #t "~Tdummy1: ~D~%" (-> obj dummy1))
  (format #t "~Tenvmap-usage: ~D~%" (-> obj envmap-usage))
  (format #t "~Textra-info: #<merc-extra-info @ #x~X>~%" (-> obj extra-info))
  obj
  )

;; definition of type merc-eye-ctrl
(deftype merc-eye-ctrl (structure)
  ((eye-slot      int8                   :offset-assert   0)
   (shader-offset int8                   :offset-assert   1)
   (shader-count  int8                   :offset-assert   2)
   (iris-shader   adgif-shader :inline   :offset-assert  16)
   (pupil-shader  adgif-shader :inline   :offset-assert  96)
   (lid-shader    adgif-shader :inline   :offset-assert 176)
   (shader        adgif-shader 3 :inline :offset         16)
   )
  :method-count-assert 9
  :size-assert         #x100
  :flag-assert         #x900000100
  )

;; definition for method 3 of type merc-eye-ctrl
(defmethod inspect merc-eye-ctrl ((obj merc-eye-ctrl))
  (format #t "[~8x] ~A~%" obj 'merc-eye-ctrl)
  (format #t "~Teye-slot: ~D~%" (-> obj eye-slot))
  (format #t "~Tshader-offset: ~D~%" (-> obj shader-offset))
  (format #t "~Tshader-count: ~D~%" (-> obj shader-count))
  (format #t "~Tshader[3] @ #x~X~%" (-> obj iris-shader))
  (format #t "~Tiris-shader: #<adgif-shader @ #x~X>~%" (-> obj iris-shader))
  (format #t "~Tpupil-shader: #<adgif-shader @ #x~X>~%" (-> obj pupil-shader))
  (format #t "~Tlid-shader: #<adgif-shader @ #x~X>~%" (-> obj lid-shader))
  obj
  )

;; definition of type merc-eye-anim-frame
(deftype merc-eye-anim-frame (structure)
  ((pupil-trans-x int8    :offset-assert   0)
   (pupil-trans-y int8    :offset-assert   1)
   (blink         int8    :offset-assert   2)
   (iris-scale    int8    :offset          4)
   (pupil-scale   int8    :offset-assert   5)
   (lid-scale     int8    :offset-assert   6)
   (dword         uint64  :offset          0)
   )
  :pack-me
  :method-count-assert 9
  :size-assert         #x8
  :flag-assert         #x900000008
  )

;; definition for method 3 of type merc-eye-anim-frame
(defmethod inspect merc-eye-anim-frame ((obj merc-eye-anim-frame))
  (format #t "[~8x] ~A~%" obj 'merc-eye-anim-frame)
  (format #t "~Tpupil-trans-x: ~D~%" (-> obj pupil-trans-x))
  (format #t "~Tpupil-trans-y: ~D~%" (-> obj pupil-trans-y))
  (format #t "~Tblink: ~D~%" (-> obj blink))
  (format #t "~Tiris-scale: ~D~%" (-> obj iris-scale))
  (format #t "~Tpupil-scale: ~D~%" (-> obj pupil-scale))
  (format #t "~Tlid-scale: ~D~%" (-> obj lid-scale))
  (format #t "~Tdword: ~D~%" (-> obj dword))
  obj
  )

;; definition of type merc-eye-anim-block
(deftype merc-eye-anim-block (structure)
  ((max-frame int16                                :offset-assert   0)
   (data      merc-eye-anim-frame :inline :dynamic :offset          8)
   )
  :method-count-assert 9
  :size-assert         #x8
  :flag-assert         #x900000008
  )

;; definition for method 3 of type merc-eye-anim-block
(defmethod inspect merc-eye-anim-block ((obj merc-eye-anim-block))
  (format #t "[~8x] ~A~%" obj 'merc-eye-anim-block)
  (format #t "~Tmax-frame: ~D~%" (-> obj max-frame))
  (format #t "~Tdata[0] @ #x~X~%" (-> obj data))
  obj
  )

;; definition of type merc-ctrl-header
(deftype merc-ctrl-header (structure)
  ((xyz-scale              float            :offset-assert   0)
   (st-magic               uint32           :offset-assert   4)
   (st-out-a               uint32           :offset-assert   8)
   (st-out-b               uint32           :offset-assert  12)
   (st-vif-add             uint32           :offset-assert  16)
   (st-int-off             uint16           :offset-assert  20)
   (st-int-scale           uint16           :offset-assert  22)
   (effect-count           uint32           :offset-assert  24)
   (blend-target-count     uint32           :offset-assert  28)
   (fragment-count         uint16           :offset-assert  32)
   (tri-count              uint16           :offset-assert  34)
   (matrix-count           uint8            :offset-assert  36)
   (shader-count           uint8            :offset-assert  37)
   (transform-vertex-count uint16           :offset-assert  38)
   (dvert-count            uint16           :offset-assert  40)
   (one-mat-count          uint16           :offset-assert  42)
   (two-mat-count          uint16           :offset-assert  44)
   (two-mat-reuse-count    uint16           :offset-assert  46)
   (three-mat-count        uint16           :offset-assert  48)
   (three-mat-reuse-count  uint16           :offset-assert  50)
   (shader-upload-count    uint8            :offset-assert  52)
   (matrix-upload-count    uint8            :offset-assert  53)
   (same-copy-count        uint16           :offset-assert  54)
   (cross-copy-count       uint16           :offset-assert  56)
   (num-verts              uint16           :offset-assert  58)
   (longest-edge           float            :offset-assert  60)
   (eye-ctrl               merc-eye-ctrl    :offset-assert  64)
   (masks                  uint32        3  :offset-assert  68)
   (dummy-bytes            uint8         48 :offset         32)
   (envmap-tint            uint32           :offset         32)
   (query                  basic            :offset         36)
   (needs-clip             uint8            :offset         40)
   (use-isometric          uint8            :offset         41)
   (use-attached-shader    uint8            :offset         42)
   (display-triangles      uint8            :offset         43)
   (death-vertex-skip      uint16           :offset         44)
   (death-start-vertex     uint16           :offset         46)
   (death-effect           uint32           :offset         48)
   (use-translucent        uint8            :offset         52)
   (display-this-fragment  uint8            :offset         53)
   )
  :method-count-assert 9
  :size-assert         #x50
  :flag-assert         #x900000050
  )

;; definition for method 3 of type merc-ctrl-header
(defmethod inspect merc-ctrl-header ((obj merc-ctrl-header))
  (format #t "[~8x] ~A~%" obj 'merc-ctrl-header)
  (format #t "~Txyz-scale: #x~X~%" (-> obj xyz-scale))
  (format #t "~Tst-magic: #x~X~%" (-> obj st-magic))
  (format #t "~Tst-out-a: #x~X~%" (-> obj st-out-a))
  (format #t "~Tst-out-b: #x~X~%" (-> obj st-out-b))
  (format #t "~Tst-vif-add: #x~X~%" (-> obj st-vif-add))
  (format #t "~Tst-int-off: ~D~%" (-> obj st-int-off))
  (format #t "~Tst-int-scale: ~D~%" (-> obj st-int-scale))
  (format #t "~Teffect-count: ~D~%" (-> obj effect-count))
  (format #t "~Tblend-target-count: ~D~%" (-> obj blend-target-count))
  (format #t "~Tfragment-count: ~D~%" (-> obj fragment-count))
  (format #t "~Ttri-count: ~D~%" (-> obj tri-count))
  (format #t "~Tmatrix-count: ~D~%" (-> obj matrix-count))
  (format #t "~Tshader-count: ~D~%" (-> obj shader-count))
  (format #t "~Ttransform-vertex-count: ~D~%" (-> obj transform-vertex-count))
  (format #t "~Tdvert-count: ~D~%" (-> obj dvert-count))
  (format #t "~Tone-mat-count: ~D~%" (-> obj one-mat-count))
  (format #t "~Ttwo-mat-count: ~D~%" (-> obj two-mat-count))
  (format #t "~Ttwo-mat-reuse-count: ~D~%" (-> obj two-mat-reuse-count))
  (format #t "~Tthree-mat-count: ~D~%" (-> obj three-mat-count))
  (format #t "~Tthree-mat-reuse-count: ~D~%" (-> obj three-mat-reuse-count))
  (format #t "~Tshader-upload-count: ~D~%" (-> obj shader-upload-count))
  (format #t "~Tmatrix-upload-count: ~D~%" (-> obj matrix-upload-count))
  (format #t "~Tsame-copy-count: ~D~%" (-> obj same-copy-count))
  (format #t "~Tcross-copy-count: ~D~%" (-> obj cross-copy-count))
  (format #t "~Tnum-verts: ~D~%" (-> obj num-verts))
  (format #t "~Tlongest-edge: ~f~%" (-> obj longest-edge))
  (format #t "~Teye-ctrl: #<merc-eye-ctrl @ #x~X>~%" (-> obj eye-ctrl))
  (format #t "~Tmasks[3] @ #x~X~%" (-> obj masks))
  (format #t "~Tdummy-bytes[48] @ #x~X~%" (&-> obj fragment-count))
  (format #t "~Tenvmap-tint: ~D~%" (-> obj envmap-tint))
  (format #t "~Tquery: ~A~%" (-> obj query))
  (format #t "~Tneeds-clip: ~D~%" (-> obj needs-clip))
  (format #t "~Tuse-isometric: ~D~%" (-> obj use-isometric))
  (format #t "~Tuse-attached-shader: ~D~%" (-> obj use-attached-shader))
  (format #t "~Tdisplay-triangles: ~D~%" (-> obj display-triangles))
  (format #t "~Tdeath-vertex-skip: ~D~%" (-> obj two-mat-count))
  (format #t "~Tdeath-start-vertex: ~D~%" (-> obj two-mat-reuse-count))
  (format #t "~Tdeath-effect: ~D~%" (-> obj death-effect))
  (format #t "~Tuse-translucent: ~D~%" (-> obj shader-upload-count))
  (format #t "~Tdisplay-this-fragment: ~D~%" (-> obj matrix-upload-count))
  obj
  )

;; definition of type merc-ctrl
(deftype merc-ctrl (art-element)
  ((num-joints int32                             :offset         20)
   (header     merc-ctrl-header :inline          :offset-assert  32)
   (effect     merc-effect      :inline :dynamic :offset-assert 112)
   )
  :method-count-assert 13
  :size-assert         #x70
  :flag-assert         #xd00000070
  )

;; definition for method 3 of type merc-ctrl
;; INFO: this function exists in multiple non-identical object files
(defmethod inspect merc-ctrl ((obj merc-ctrl))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tname: ~A~%" (-> obj name))
  (format #t "~Tlength: ~D~%" (-> obj length))
  (format #t "~Textra: ~A~%" (-> obj extra))
  (format #t "~Tnum-joints: ~D~%" (-> obj num-joints))
  (format #t "~Theader: #<merc-ctrl-header @ #x~X>~%" (-> obj header))
  (format #t "~Teffect[0] @ #x~X~%" (-> obj effect))
  obj
  )

;; definition of type merc-vu1-low-mem
(deftype merc-vu1-low-mem (structure)
  ((tri-strip-gif gs-gif-tag :inline :offset-assert   0)
   (ad-gif        gs-gif-tag :inline :offset-assert  16)
   (hvdf-offset   vector     :inline :offset-assert  32)
   (perspective   uint128    4       :offset-assert  48)
   (fog           vector     :inline :offset-assert 112)
   )
  :method-count-assert 9
  :size-assert         #x80
  :flag-assert         #x900000080
  )

;; definition for method 3 of type merc-vu1-low-mem
(defmethod inspect merc-vu1-low-mem ((obj merc-vu1-low-mem))
  (format #t "[~8x] ~A~%" obj 'merc-vu1-low-mem)
  (format #t "~Ttri-strip-gif: #<qword @ #x~X>~%" (-> obj tri-strip-gif))
  (format #t "~Tad-gif: #<qword @ #x~X>~%" (-> obj ad-gif))
  (format #t "~Thvdf-offset: #<vector @ #x~X>~%" (-> obj hvdf-offset))
  (format #t "~Tperspective[4] @ #x~X~%" (-> obj perspective))
  (format #t "~Tfog: #<vector @ #x~X>~%" (-> obj fog))
  obj
  )

;; definition of type ripple-wave
(deftype ripple-wave (structure)
  ((scale float  :offset-assert   0)
   (offs  float  :offset-assert   4)
   (xdiv  int16  :offset-assert   8)
   (zdiv  int16  :offset-assert  10)
   (speed float  :offset-assert  12)
   (xmul  float  :offset-assert  16)
   (zmul  float  :offset-assert  20)
   (delta float  :offset-assert  24)
   )
  :pack-me
  :method-count-assert 9
  :size-assert         #x1c
  :flag-assert         #x90000001c
  )

;; definition for method 3 of type ripple-wave
(defmethod inspect ripple-wave ((obj ripple-wave))
  (format #t "[~8x] ~A~%" obj 'ripple-wave)
  (format #t "~Tscale: ~f~%" (-> obj scale))
  (format #t "~Toffs: ~f~%" (-> obj offs))
  (format #t "~Txdiv: ~D~%" (-> obj xdiv))
  (format #t "~Tzdiv: ~D~%" (-> obj zdiv))
  (format #t "~Tspeed: ~f~%" (-> obj speed))
  (format #t "~Txmul: ~f~%" (-> obj xmul))
  (format #t "~Tzmul: ~f~%" (-> obj zmul))
  (format #t "~Tdelta: ~f~%" (-> obj delta))
  obj
  )

;; definition of type ripple-wave-set
(deftype ripple-wave-set (basic)
  ((count        int32                 :offset-assert   4)
   (converted    basic                 :offset-assert   8)
   (frame-save   uint32                :offset-assert  12)
   (normal-scale float                 :offset-assert  16)
   (wave         ripple-wave 4 :inline :offset-assert  20)
   )
  :method-count-assert 9
  :size-assert         #x84
  :flag-assert         #x900000084
  )

;; definition for method 3 of type ripple-wave-set
(defmethod inspect ripple-wave-set ((obj ripple-wave-set))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tcount: ~D~%" (-> obj count))
  (format #t "~Tconverted: ~A~%" (-> obj converted))
  (format #t "~Tframe-save: ~D~%" (-> obj frame-save))
  (format #t "~Tnormal-scale: ~f~%" (-> obj normal-scale))
  (format #t "~Twave[4] @ #x~X~%" (-> obj wave))
  obj
  )

;; definition of type ripple-control
(deftype ripple-control (basic)
  ((global-scale            float              :offset-assert   4)
   (last-frame-scale        float              :offset-assert   8)
   (close-fade-dist         float              :offset-assert  12)
   (far-fade-dist           float              :offset-assert  16)
   (faded-scale             float              :offset-assert  20)
   (individual-normal-scale float              :offset-assert  24)
   (waveform                ripple-wave-set    :offset-assert  28)
   (send-query              symbol             :offset-assert  32)
   (query                   ripple-merc-query  :offset-assert  36)
   )
  :method-count-assert 9
  :size-assert         #x28
  :flag-assert         #x900000028
  (:methods
    (new (symbol type) _type_ 0)
    )
  )

;; definition for method 3 of type ripple-control
(defmethod inspect ripple-control ((obj ripple-control))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tglobal-scale: ~f~%" (-> obj global-scale))
  (format #t "~Tlast-frame-scale: ~f~%" (-> obj last-frame-scale))
  (format #t "~Tclose-fade-dist: ~f~%" (-> obj close-fade-dist))
  (format #t "~Tfar-fade-dist: ~f~%" (-> obj far-fade-dist))
  (format #t "~Tfaded-scale: ~f~%" (-> obj faded-scale))
  (format #t "~Tindividual-normal-scale: ~f~%" (-> obj individual-normal-scale))
  (format #t "~Twaveform: ~A~%" (-> obj waveform))
  (format #t "~Tsend-query: ~A~%" (-> obj send-query))
  (format #t "~Tquery: ~A~%" (-> obj query))
  obj
  )

;; definition for method 0 of type ripple-control
(defmethod new ripple-control ((allocation symbol) (type-to-make type))
  (let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
    (set! (-> obj global-scale) 0.0)
    (set! (-> obj last-frame-scale) -0.001)
    (set! (-> obj close-fade-dist) 4096000000.0)
    (set! (-> obj far-fade-dist) 8192000000.0)
    (set! (-> obj faded-scale) -0.001)
    (set! (-> obj waveform) #f)
    (set! (-> obj individual-normal-scale) 1.0)
    (set! (-> obj send-query) #f)
    (set! (-> obj query) #f)
    obj
    )
  )

;; failed to figure out what this is:
0
