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

;; definition of type collide-history
(deftype collide-history (structure)
  ((intersect      vector                :inline :offset-assert   0)
   (trans          vector                :inline :offset-assert  16)
   (transv         vector                :inline :offset-assert  32)
   (transv-out     vector                :inline :offset-assert  48)
   (local-normal   vector                :inline :offset-assert  64)
   (surface-normal vector                :inline :offset-assert  80)
   (time           time-frame                    :offset-assert  96)
   (status         cshape-moving-flags           :offset-assert 104)
   (pat            pat-surface                   :offset-assert 112)
   (reaction-flag  cshape-reaction-flags         :offset-assert 116)
   )
  :method-count-assert 10
  :size-assert         #x78
  :flag-assert         #xa00000078
  (:methods
    (update! (_type_ collide-shape-moving vector vector vector) _type_ 9)
    )
  )

;; definition for method 3 of type collide-history
(defmethod inspect collide-history ((obj collide-history))
  (format #t "[~8x] ~A~%" obj 'collide-history)
  (format #t "~Tintersect: ~`vector`P~%" (-> obj intersect))
  (format #t "~Ttrans: ~`vector`P~%" (-> obj trans))
  (format #t "~Ttransv: ~`vector`P~%" (-> obj transv))
  (format #t "~Ttransv-out: ~`vector`P~%" (-> obj transv-out))
  (format #t "~Tlocal-normal: ~`vector`P~%" (-> obj local-normal))
  (format #t "~Tsurface-normal: ~`vector`P~%" (-> obj surface-normal))
  (format #t "~Ttime: ~D~%" (-> obj time))
  (format #t "~Tstatus: ~D~%" (-> obj status))
  (format #t "~Tpat: ~D~%" (-> obj pat))
  (format #t "~Treaction-flag: ~D~%" (-> obj reaction-flag))
  obj
  )

;; definition of type control-info
(deftype control-info (collide-shape-moving)
  ((unknown-vector00          vector                    :inline     :offset        448)
   (unknown-vector01          vector                    :inline     :offset        464)
   (unknown-vector02          vector                    :inline     :offset        480)
   (unknown-quaternion00      quaternion                :inline     :offset        496)
   (unknown-quaternion01      quaternion                :inline     :offset        512)
   (unknown-float00           float                                 :offset        528)
   (unknown-float01           float                                 :offset        532)
   (unknown-float02           float                                 :offset        536)
   (unknown-vector10          vector                    :inline     :offset        544)
   (unknown-vector11          vector                    :inline     :offset        560)
   (unknown-vector12          vector                    :inline     :offset        576)
   (unknown-vector13          vector                    :inline     :offset        592)
   (unknown-vector14          vector                    :inline     :offset        608)
   (unknown-vector15          vector                    :inline     :offset        624)
   (unknown-vector16          vector                    :inline     :offset        640)
   (unknown-dynamics00        dynamics                              :offset        656)
   (unknown-surface00         surface                               :offset        660)
   (unknown-surface01         surface                               :offset        664)
   (unknown-cpad-info00       cpad-info                             :offset        668)
   (unknown-float10           float                                 :offset        672)
   (unknown-float11           float                                 :offset        676)
   (unknown-float12           float                                 :offset        680)
   (unknown-float13           float                                 :offset        684)
   (unknown-vector20          vector                    :inline     :offset        688)
   (unknown-vector21          vector                    :inline     :offset        704)
   (unknown-vector22          vector                    :inline     :offset        720)
   (unknown-vector23          vector                    :inline     :offset        736)
   (unknown-vector-array00    vector                    7 :inline   :offset        752)
   (unknown-vector30          vector                    :inline     :offset        880)
   (unknown-vector31          vector                    :inline     :offset        896)
   (unknown-float20           float                                 :offset        912)
   (unknown-float21           float                                 :offset        916)
   (unknown-dword00           uint64                                :offset        920)
   (unknown-matrix00          matrix                    :inline     :offset        928)
   (unknown-matrix01          matrix                    :inline     :offset        992)
   (unknown-matrix02          matrix                    :inline     :offset        1056)
   (unknown-qword00           uint128                               :offset        1136)
   (unknown-float30           float                                 :offset        1140)
   (unknown-vector40          vector                    :inline     :offset        1152)
   (unknown-float40           float                                 :offset        1172)
   (unknown-float41           float                                 :offset        1176)
   (unknown-int00             int32                                 :offset        1180)
   (unknown-float50           float                                 :offset        1168)
   (unknown-vector50          vector                    :inline     :offset        1184)
   (unknown-vector51          vector                    :inline     :offset        1200)
   (unknown-vector52          vector                    :inline     :offset        1216)
   (unknown-vector53          vector                    :inline     :offset        1232)
   (last-known-safe-ground    vector                    :inline     :offset        1248)
   (unknown-vector55          vector                    :inline     :offset        1264)
   (unknown-dword10           time-frame                            :offset        1280)
   (unknown-dword11           time-frame                            :offset        1288)
   (unknown-float60           float                                 :offset        1300)
   (unknown-float61           float                                 :offset        1304)
   (unknown-float62           float                                 :offset        1308)
   (unknown-float63           float                                 :offset        1312)
   (unknown-float64           float                                 :offset        1316)
   (unknown-dword20           time-frame                            :offset        1320)
   (unknown-dword21           time-frame                            :offset        1328)
   (unknown-dword-coverage    int64                                 :offset        1336)
   (unknown-float-coverage-0  float                                 :offset        1344)
   (unknown-float-coverage-1  float                                 :offset        1348)
   (unknown-float-coverage-2  float                                 :offset        1352)
   (unknown-u32-coverage-0    uint32                                :offset        1356)
   (unknown-vector-coverage-0 vector                    :inline     :offset        1376)
   (unknown-vector-coverage-1 vector                    :inline     :offset        1392)
   (unknown-vector-coverage-2 vector                    :inline     :offset        1440)
   (unknown-vector-coverage-3 vector                    :inline     :offset        1472)
   (unknown-vector60          vector                    :inline     :offset        1456)
   (unknown-vector61          vector                    :inline     :offset        1504)
   (unknown-float70           float                                 :offset        1520)
   (unknown-float71           float                                 :offset        1524)
   (unknown-vector70          vector                    :inline     :offset        1536)
   (unknown-vector71          vector                    :inline     :offset        1552)
   (unknown-vector72          vector                    :inline     :offset        1568)
   (unknown-vector73          vector                    :inline     :offset        1584)
   (unknown-handle00          handle                                :offset        1600)
   (unknown-sphere-array00    collide-shape-prim-sphere 3           :offset        1608)
   (unknown-sphere00          collide-shape-prim-sphere             :offset        1632)
   (unknown-sphere01          collide-shape-prim-sphere             :offset        1636)
   (unknown-sphere02          collide-shape-prim-sphere             :offset        1640)
   (unknown-int50             int32                                 :offset        1656)
   (unknown-dword30           time-frame                            :offset        1664)
   (unknown-dword31           time-frame                            :offset        1672)
   (unknown-dword32           time-frame                            :offset        1680)
   (unknown-dword33           time-frame                            :offset        1688)
   (unknown-dword34           time-frame                            :offset        1696)
   (unknown-dword35           time-frame                            :offset        1704)
   (unknown-dword36           time-frame                            :offset        1712)
   (unknown-float80           float                                 :offset        1724)
   (unknown-float81           float                                 :offset        1728)
   (unknown-float82           float                                 :offset        1732)
   (unknown-vector80          vector                    :inline     :offset        1744)
   (unknown-cspace00          cspace                    :inline     :offset        1760)
   (unknown-vector90          vector                    :inline     :offset        1776)
   (unknown-vector91          vector                    :inline     :offset        1792)
   (unknown-vector92          vector                    :inline     :offset        1824)
   (unknown-cspace10          cspace                    :inline     :offset        1808)
   (unknown-symbol00          symbol                                :offset        1840)
   (unknown-float90           float                                 :offset        1844)
   (unknown-float91           float                                 :offset        1848)
   (unknown-vector-array10    vector                    16 :inline  :offset        1856)
   (unknown-float100          float                                 :offset        2112)
   (unknown-int10             int32                                 :offset        2116)
   (unknown-float110          float                                 :offset        2120)
   (unknown-vector100         vector                    :inline     :offset        2128)
   (unknown-vector101         vector                    :inline     :offset        2144)
   (unknown-dword40           time-frame                            :offset        2160)
   (unknown-dword41           time-frame                            :offset        2168)
   (unknown-handle10          handle                                :offset        2176)
   (unknown-uint20            uint32                                :offset        2184)
   (unknown-spoolanim00       spool-anim                            :offset        2184)
   (unknown-int20             int32                                 :offset        2184)
   (unknown-symbol20          symbol                                :offset        2184)
   (unknown-float120          float                                 :offset        2184)
   (unknown-int21             int32                                 :offset        2188)
   (unknown-uint30            uint32                                :offset        2188)
   (unknown-float121          float                                 :offset        2188)
   (unknown-uint31            uint32                                :offset        2192)
   (unknown-int37             int32                                 :offset        2192)
   (unknown-float122          float                                 :offset        2196)
   (unknown-float123          float                                 :offset        2200)
   (unknown-float124          float                                 :offset        2204)
   (unknown-vector102         vector                    :inline     :offset        2224)
   (unknown-vector103         vector                    :inline     :offset        2240)
   (unknown-quaternion02      quaternion                :inline     :offset        2256)
   (unknown-quaternion03      quaternion                :inline     :offset        2272)
   (unknown-smush00           smush-control             :inline     :offset        2288)
   (unknown-vector110         vector                    :inline     :offset        2320)
   (unknown-vector111         vector                    :inline     :offset        2336)
   (unknown-symbol30          symbol                                :offset        2384)
   (unknown-int31             uint32                                :offset        2384)
   (unknown-dword50           int64                                 :offset        2392)
   (unknown-dword51           int64                                 :offset        2400)
   (unknown-pointer00         pointer                               :offset        2416)
   (unknown-symbol40          symbol                                :offset        2428)
   (unknown-dword60           int64                                 :offset        2432)
   (unknown-dword61           int64                                 :offset        2440)
   (unknown-dword62           int64                                 :offset        2448)
   (unknown-dword63           int64                                 :offset        2456)
   (unknown-halfword00        int16                                 :offset        2488)
   (history-length            int16                                 :offset        2490)
   (history-data              collide-history           128 :inline :offset-assert 2496)
   (unknown-float140          float                                 :offset        18944)
   (unknown-dword70           time-frame                            :offset        18952)
   (unknown-int40             int32                                 :offset        18880)
   (unknown-dword80           time-frame                            :offset        18888)
   (unknown-dword81           time-frame                            :offset        18896)
   (unknown-float130          float                                 :offset        18904)
   (unknown-float131          float                                 :offset        18908)
   (unknown-dword82           time-frame                            :offset        18912)
   (unknown-vector120         vector                    :inline     :offset        18928)
   (unknown-float150          float                                 :offset        18944)
   (unknown-vector121         vector                    :inline     :offset        18960)
   (wall-pat                  pat-surface                           :offset        18976)
   (unknown-soundid00         sound-id                              :offset        18980)
   (unknown-float141          float                                 :offset        18984)
   (unknown-soundid01         sound-id                              :offset        18988)
   (unknown-int34             int32                                 :offset        18992)
   (unknown-int35             int32                                 :offset        18996)
   (unknown-int36             int32                                 :offset        19000)
   )
  :method-count-assert 65
  :size-assert         #x4a3c
  :flag-assert         #x4100004a3c
  )

;; definition for method 9 of type collide-history
;; Used lq/sq
(defmethod update! collide-history ((obj collide-history) (cshape collide-shape-moving) (xs vector) (transv vector) (transv-out vector))
  (set! (-> obj intersect quad) (-> xs quad))
  (set! (-> obj transv quad) (-> transv quad))
  (set! (-> obj transv-out quad) (-> transv-out quad))
  (set! (-> obj trans quad) (-> cshape trans quad))
  (set! (-> obj local-normal quad) (-> cshape local-normal quad))
  (set! (-> obj surface-normal quad) (-> cshape surface-normal quad))
  (set! (-> obj time) (-> *display* base-frame-counter))
  (set! (-> obj status) (-> cshape status))
  (set! (-> obj reaction-flag) (-> cshape reaction-flag))
  (set! (-> obj pat) (-> cshape cur-pat))
  obj
  )
