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

;; definition of type mother-spider-leg
(deftype mother-spider-leg (process-drawable)
  ((gravity     float          :offset-assert 176)
   (transv      vector :inline :offset-assert 192)
   (facing-rot  vector :inline :offset-assert 208)
   (facing-rotv vector :inline :offset-assert 224)
   )
  :heap-base #x80
  :method-count-assert 20
  :size-assert         #xf0
  :flag-assert         #x14008000f0
  (:states
    mother-spider-leg-flying
    )
  )

;; definition for method 3 of type mother-spider-leg
(defmethod inspect mother-spider-leg ((obj mother-spider-leg))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tgravity: ~f~%" (-> obj gravity))
  (format #t "~T~Ttransv: #<vector @ #x~X>~%" (-> obj transv))
  (format #t "~T~Tfacing-rot: #<vector @ #x~X>~%" (-> obj facing-rot))
  (format #t "~T~Tfacing-rotv: #<vector @ #x~X>~%" (-> obj facing-rotv))
  obj
  )

;; definition of type mother-spider-thread
(deftype mother-spider-thread (structure)
  ((joint-index int32  :offset-assert   0)
   (trans-u     float  :offset-assert   4)
   (swing-arc-u float  :offset-assert   8)
   )
  :pack-me
  :method-count-assert 9
  :size-assert         #xc
  :flag-assert         #x90000000c
  )

;; definition for method 3 of type mother-spider-thread
(defmethod inspect mother-spider-thread ((obj mother-spider-thread))
  (format #t "[~8x] ~A~%" obj 'mother-spider-thread)
  (format #t "~Tjoint-index: ~D~%" (-> obj joint-index))
  (format #t "~Ttrans-u: ~f~%" (-> obj trans-u))
  (format #t "~Tswing-arc-u: ~f~%" (-> obj swing-arc-u))
  obj
  )

;; definition of type mother-spider-leg-info
(deftype mother-spider-leg-info (structure)
  ((joint-index0 int32  :offset-assert   0)
   (joint-index1 int32  :offset-assert   4)
   (cprim-index  int32  :offset-assert   8)
   )
  :method-count-assert 9
  :size-assert         #xc
  :flag-assert         #x90000000c
  )

;; definition for method 3 of type mother-spider-leg-info
(defmethod inspect mother-spider-leg-info ((obj mother-spider-leg-info))
  (format #t "[~8x] ~A~%" obj 'mother-spider-leg-info)
  (format #t "~Tjoint-index0: ~D~%" (-> obj joint-index0))
  (format #t "~Tjoint-index1: ~D~%" (-> obj joint-index1))
  (format #t "~Tcprim-index: ~D~%" (-> obj cprim-index))
  obj
  )

;; definition of type mother-spider-history
(deftype mother-spider-history (structure)
  ((trans vector :inline :offset-assert   0)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type mother-spider-history
(defmethod inspect mother-spider-history ((obj mother-spider-history))
  (format #t "[~8x] ~A~%" obj 'mother-spider-history)
  (format #t "~Ttrans: #<vector @ #x~X>~%" (-> obj trans))
  obj
  )

;; definition of type mother-spider-history-array
(deftype mother-spider-history-array (inline-array-class)
  ((data mother-spider-history :dynamic :offset-assert  16)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type mother-spider-history-array
(defmethod inspect mother-spider-history-array ((obj mother-spider-history-array))
  (format #t "[~8x] ~A~%" obj (-> obj type))
  (format #t "~Tlength: ~D~%" (-> obj length))
  (format #t "~Tallocated-length: ~D~%" (-> obj allocated-length))
  (format #t "~Tdata[0] @ #x~X~%" (-> obj data))
  obj
  )

;; failed to figure out what this is:
(set! (-> mother-spider-history-array heap-base) (the-as uint 16))

;; definition of type mother-spider
(deftype mother-spider (process-drawable)
  ((root-override                  collide-shape                       :offset        112)
   (mode                           uint64                              :offset-assert 176)
   (damage                         int32                               :offset-assert 184)
   (baby-count                     int32                               :offset-assert 188)
   (max-baby-count                 int32                               :offset-assert 192)
   (birthing-counter               int32                               :offset-assert 196)
   (spit-counter                   int32                               :offset-assert 200)
   (leg-socket-part-mask           int32                               :offset-assert 204)
   (dist-from-anchor               float                               :offset-assert 208)
   (targ-dist-from-anchor          float                               :offset-assert 212)
   (idle-dist-from-anchor          float                               :offset-assert 216)
   (player-sticky-dist-from-anchor float                               :offset-assert 220)
   (max-dist-from-anchor           float                               :offset-assert 224)
   (activate-xz-dist               float                               :offset-assert 228)
   (deactivate-xz-dist             float                               :offset-assert 232)
   (max-spit-xz-dist               float                               :offset-assert 236)
   (max-swing-radius               float                               :offset-assert 240)
   (spin-vel                       float                               :offset-assert 244)
   (thread-speed                   float                               :offset-assert 248)
   (thread-vel                     float                               :offset-assert 252)
   (history                        mother-spider-history-array         :offset-assert 256)
   (history-len                    int32                               :offset-assert 260)
   (history-next-index             int32                               :offset-assert 264)
   (hit?                           symbol                              :offset-assert 268)
   (going-up?                      symbol                              :offset-assert 272)
   (check-z-thresh?                symbol                              :offset-assert 276)
   (activate-z-thresh              float                               :offset-assert 280)
   (deactivate-z-thresh            float                               :offset-assert 284)
   (spawned-time                   time-frame                          :offset-assert 288)
   (last-update-time               time-frame                          :offset-assert 296)
   (spin-time                      time-frame                          :offset-assert 304)
   (last-spit-time                 time-frame                          :offset-assert 312)
   (last-player-in-air-time        time-frame                          :offset-assert 320)
   (started-birthing-time          time-frame                          :offset-assert 328)
   (neck                           joint-mod                           :offset-assert 336)
   (player-attack-id               uint64                              :offset-assert 344)
   (leg-socket-part-time           time-frame                  6       :offset-assert 352)
   (orient-rot                     vector                      :inline :offset-assert 400)
   (anchor-trans                   vector                      :inline :offset-assert 416)
   (thread-min-trans               vector                      :inline :offset-assert 432)
   (swing-pos                      vector                      :inline :offset-assert 448)
   (swing-base-pos                 vector                      :inline :offset-assert 464)
   (swing-vel                      vector                      :inline :offset-assert 480)
   )
  :heap-base #x180
  :method-count-assert 32
  :size-assert         #x1f0
  :flag-assert         #x20018001f0
  (:methods
    (TODO-RENAME-20 (_type_ vector vector) symbol 20)
    (TODO-RENAME-21 (_type_ vector float symbol) symbol 21)
    (dummy-22 (_type_ matrix vector) float 22)
    (TODO-RENAME-23 (_type_) none 23)
    (TODO-RENAME-24 (_type_) number 24)
    (letgo-player? (_type_) symbol 25)
    (grab-player? (_type_) symbol 26)
    (STUB-27 (_type_) none 27)
    (STUB-28 (_type_) none 28)
    (TODO-RENAME-29 (_type_ symbol symbol) none 29)
    (spawn-child (_type_ vector vector symbol) int 30)
    (is-player-stuck? (_type_) symbol 31)
    )
  (:states
    mother-spider-birth-baby
    mother-spider-birthing
    mother-spider-die
    mother-spider-die-from-uppercut
    mother-spider-die-wait-for-children
    mother-spider-hit-while-birthing
    mother-spider-hit-while-tracking
    mother-spider-idle
    mother-spider-spit
    mother-spider-stop-traveling
    mother-spider-tracking
    (mother-spider-traveling uint)
    wait-for-children
    )
  )

;; definition for method 3 of type mother-spider
(defmethod inspect mother-spider ((obj mother-spider))
  (let ((t9-0 (method-of-type process-drawable inspect)))
    (t9-0 obj)
    )
  (format #t "~T~Tmode: ~D~%" (-> obj mode))
  (format #t "~T~Tdamage: ~D~%" (-> obj damage))
  (format #t "~T~Tbaby-count: ~D~%" (-> obj baby-count))
  (format #t "~T~Tmax-baby-count: ~D~%" (-> obj max-baby-count))
  (format #t "~T~Tbirthing-counter: ~D~%" (-> obj birthing-counter))
  (format #t "~T~Tspit-counter: ~D~%" (-> obj spit-counter))
  (format #t "~T~Tleg-socket-part-mask: ~D~%" (-> obj leg-socket-part-mask))
  (format #t "~T~Tdist-from-anchor: ~f~%" (-> obj dist-from-anchor))
  (format #t "~T~Ttarg-dist-from-anchor: ~f~%" (-> obj targ-dist-from-anchor))
  (format #t "~T~Tidle-dist-from-anchor: ~f~%" (-> obj idle-dist-from-anchor))
  (format #t "~T~Tplayer-sticky-dist-from-anchor: ~f~%" (-> obj player-sticky-dist-from-anchor))
  (format #t "~T~Tmax-dist-from-anchor: ~f~%" (-> obj max-dist-from-anchor))
  (format #t "~T~Tactivate-xz-dist: ~f~%" (-> obj activate-xz-dist))
  (format #t "~T~Tdeactivate-xz-dist: ~f~%" (-> obj deactivate-xz-dist))
  (format #t "~T~Tmax-spit-xz-dist: ~f~%" (-> obj max-spit-xz-dist))
  (format #t "~T~Tmax-swing-radius: ~f~%" (-> obj max-swing-radius))
  (format #t "~T~Tspin-vel: ~f~%" (-> obj spin-vel))
  (format #t "~T~Tthread-speed: ~f~%" (-> obj thread-speed))
  (format #t "~T~Tthread-vel: ~f~%" (-> obj thread-vel))
  (format #t "~T~Thistory: ~A~%" (-> obj history))
  (format #t "~T~Thistory-len: ~D~%" (-> obj history-len))
  (format #t "~T~Thistory-next-index: ~D~%" (-> obj history-next-index))
  (format #t "~T~Thit?: ~A~%" (-> obj hit?))
  (format #t "~T~Tgoing-up?: ~A~%" (-> obj going-up?))
  (format #t "~T~Tcheck-z-thresh?: ~A~%" (-> obj check-z-thresh?))
  (format #t "~T~Tactivate-z-thresh: ~f~%" (-> obj activate-z-thresh))
  (format #t "~T~Tdeactivate-z-thresh: ~f~%" (-> obj deactivate-z-thresh))
  (format #t "~T~Tspawned-time: ~D~%" (-> obj spawned-time))
  (format #t "~T~Tlast-update-time: ~D~%" (-> obj last-update-time))
  (format #t "~T~Tspin-time: ~D~%" (-> obj spin-time))
  (format #t "~T~Tlast-spit-time: ~D~%" (-> obj last-spit-time))
  (format #t "~T~Tlast-player-in-air-time: ~D~%" (-> obj last-player-in-air-time))
  (format #t "~T~Tstarted-birthing-time: ~D~%" (-> obj started-birthing-time))
  (format #t "~T~Tneck: ~A~%" (-> obj neck))
  (format #t "~T~Tplayer-attack-id: ~D~%" (-> obj player-attack-id))
  (format #t "~T~Tleg-socket-part-time[6] @ #x~X~%" (-> obj leg-socket-part-time))
  (format #t "~T~Torient-rot: #<vector @ #x~X>~%" (-> obj orient-rot))
  (format #t "~T~Tanchor-trans: #<vector @ #x~X>~%" (-> obj anchor-trans))
  (format #t "~T~Tthread-min-trans: #<vector @ #x~X>~%" (-> obj thread-min-trans))
  (format #t "~T~Tswing-pos: #<vector @ #x~X>~%" (-> obj swing-pos))
  (format #t "~T~Tswing-base-pos: #<vector @ #x~X>~%" (-> obj swing-base-pos))
  (format #t "~T~Tswing-vel: #<vector @ #x~X>~%" (-> obj swing-vel))
  obj
  )

;; failed to figure out what this is:
0
