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

;; definition of type pat-surface
(deftype pat-surface (uint32)
  ((skip          uint8        :offset   0 :size   3)
   (mode          pat-mode     :offset   3 :size   3)
   (material      pat-material :offset   6 :size   6)
   (camera        uint8        :offset  12 :size   2)
   (event         pat-event    :offset  14 :size   6)
   (noentity      uint8        :offset   0 :size   1)
   (nocamera      uint8        :offset   1 :size   1)
   (noedge        uint8        :offset   2 :size   1)
   (nolineofsight uint8        :offset  12 :size   1)
   (unknown-bit   uint8        :offset  15 :size   1)
   )
  :method-count-assert 9
  :size-assert         #x4
  :flag-assert         #x900000004
  )

;; definition for method 3 of type pat-surface
(defmethod inspect pat-surface ((obj pat-surface))
  (format #t "[~8x] ~A~%" obj 'pat-surface)
  (format #t "~Tskip: ~D~%" (-> obj skip))
  (format #t "~Tmode: ~D~%" (-> obj mode))
  (format #t "~Tmaterial: ~D~%" (-> obj material))
  (format #t "~Tcamera: ~D~%" (-> obj camera))
  (format #t "~Tevent: ~D~%" (-> obj event))
  (format #t "~Tnoentity: ~D~%" (-> obj noentity))
  (format #t "~Tnocamera: ~D~%" (-> obj nocamera))
  (format #t "~Tnoedge: ~D~%" (-> obj noedge))
  (format #t "~Tnolineofsight: ~D~%" (-> obj nolineofsight))
  obj
  )

;; definition (debug) for function pat-material->string
(defun-debug pat-material->string ((arg0 pat-surface))
  (case (-> arg0 material)
    (((pat-material neutral))
     "neutral"
     )
    (((pat-material rotate))
     "rotate"
     )
    (((pat-material stopproj))
     "stopproj"
     )
    (((pat-material swamp))
     "swamp"
     )
    (((pat-material tube))
     "tube"
     )
    (((pat-material straw))
     "straw"
     )
    (((pat-material metal))
     "metal"
     )
    (((pat-material dirt))
     "dirt"
     )
    (((pat-material gravel))
     "gravel"
     )
    (((pat-material crwood))
     "crwood"
     )
    (((pat-material lava))
     "lava"
     )
    (((pat-material hotcoals))
     "hotcoals"
     )
    (((pat-material deepsnow))
     "deepsnow"
     )
    (((pat-material snow))
     "snow"
     )
    (((pat-material pcmetal))
     "pcmetal"
     )
    (((pat-material grass))
     "grass"
     )
    (((pat-material wood))
     "wood"
     )
    (((pat-material sand))
     "sand"
     )
    (((pat-material tar))
     "tar"
     )
    (((pat-material waterbottom))
     "waterbottom"
     )
    (((pat-material quicksand))
     "quicksand"
     )
    (((pat-material ice))
     "ice"
     )
    (((pat-material stone))
     "stone"
     )
    (else
      "*unknown*"
      )
    )
  )

;; definition (debug) for function pat-mode->string
(defun-debug pat-mode->string ((arg0 pat-surface))
  (case (-> arg0 mode)
    (((pat-mode obstacle))
     "obstacle"
     )
    (((pat-mode wall))
     "wall"
     )
    (((pat-mode ground))
     "ground"
     )
    (else
      "*unknown*"
      )
    )
  )

;; definition (debug) for function pat-event->string
(defun-debug pat-event->string ((arg0 pat-surface))
  (case (-> arg0 event)
    (((pat-event melt))
     "melt"
     )
    (((pat-event burnup))
     "burnup"
     )
    (((pat-event deadlyup))
     "deadlyup"
     )
    (((pat-event burn))
     "burn"
     )
    (((pat-event endlessfall))
     "endlessfall"
     )
    (((pat-event deadly))
     "deadly"
     )
    (((pat-event none))
     "none"
     )
    (else
      "*unknown*"
      )
    )
  )

;; definition of type pat-mode-info
(deftype pat-mode-info (structure)
  ((name         string  :offset-assert   0)
   (wall-angle   float   :offset-assert   4)
   (color        rgba    :offset-assert   8)
   (hilite-color rgba    :offset-assert  12)
   )
  :method-count-assert 9
  :size-assert         #x10
  :flag-assert         #x900000010
  )

;; definition for method 3 of type pat-mode-info
(defmethod inspect pat-mode-info ((obj pat-mode-info))
  (format #t "[~8x] ~A~%" obj 'pat-mode-info)
  (format #t "~Tname: ~A~%" (-> obj name))
  (format #t "~Twall-angle: ~f~%" (-> obj wall-angle))
  (format #t "~Tcolor: ~D~%" (-> obj color))
  (format #t "~Thilite-color: ~D~%" (-> obj hilite-color))
  obj
  )

;; definition for symbol *pat-mode-info*, type (inline-array pat-mode-info)
(define *pat-mode-info* (new 'static 'inline-array pat-mode-info 4
                          (new 'static 'pat-mode-info
                            :name "ground"
                            :wall-angle 0.2
                            :color (new 'static 'rgba :r #x7f :a #x40)
                            :hilite-color (new 'static 'rgba :r #xff :a #x80)
                            )
                          (new 'static 'pat-mode-info
                            :name "wall"
                            :wall-angle 2.0
                            :color (new 'static 'rgba :b #x7f :a #x40)
                            :hilite-color (new 'static 'rgba :b #xff :a #x80)
                            )
                          (new 'static 'pat-mode-info
                            :name "obstacle"
                            :wall-angle 0.82
                            :color (new 'static 'rgba :r #x7f :b #x7f :a #x40)
                            :hilite-color (new 'static 'rgba :r #xff :b #xff :a #x80)
                            )
                          (new 'static 'pat-mode-info
                            :name "pole"
                            :wall-angle 2.0
                            :color (new 'static 'rgba :r #x7f :g #x7f :a #x40)
                            :hilite-color (new 'static 'rgba :r #xff :g #xff :a #x80)
                            )
                          )
        )

;; failed to figure out what this is:
0
