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

;; definition of type mud
(deftype mud (water-anim)
  ()
  :heap-base #x70
  :method-count-assert 30
  :size-assert         #xdc
  :flag-assert         #x1e007000dc
  )

;; definition for method 3 of type mud
(defmethod inspect mud ((obj mud))
  (let ((t9-0 (method-of-type water-anim inspect)))
    (t9-0 obj)
    )
  obj
  )

;; definition for symbol ripple-for-mud, type ripple-wave-set
(define ripple-for-mud (new 'static 'ripple-wave-set
                         :count 3
                         :converted #f
                         :normal-scale 1.0
                         :wave (new 'static 'inline-array ripple-wave 4
                           (new 'static 'ripple-wave :scale 40.0 :xdiv 1 :speed 1.5)
                           (new 'static 'ripple-wave :scale 40.0 :xdiv -1 :zdiv 1 :speed 1.5)
                           (new 'static 'ripple-wave :scale 20.0 :xdiv 5 :zdiv 3 :speed 0.75)
                           (new 'static 'ripple-wave)
                           )
                         )
        )

;; definition for symbol ripple-for-small-mud, type ripple-wave-set
(define ripple-for-small-mud (new 'static 'ripple-wave-set
                               :count 3
                               :converted #f
                               :normal-scale 1.0
                               :wave (new 'static 'inline-array ripple-wave 4
                                 (new 'static 'ripple-wave :scale 20.0 :xdiv 2 :speed 0.5)
                                 (new 'static 'ripple-wave :scale 20.0 :xdiv -2 :zdiv 2 :speed 0.5)
                                 (new 'static 'ripple-wave :scale 20.0 :xdiv 5 :zdiv 3 :speed 0.75)
                                 (new 'static 'ripple-wave)
                                 )
                               )
        )

;; definition for method 22 of type mud
;; INFO: Return type mismatch ripple-wave-set vs none.
(defmethod TODO-RENAME-22 mud ((obj mud))
  (let ((t9-0 (method-of-type water-anim TODO-RENAME-22)))
    (t9-0 obj)
    )
  (logclear! (-> obj flags) (water-flags wt23))
  (set! (-> obj flags) (logior (water-flags wt18) (-> obj flags)))
  (let ((gp-0 (new 'process 'ripple-control)))
    (set! (-> obj draw ripple) gp-0)
    (set! (-> gp-0 global-scale) 3072.0)
    (set! (-> gp-0 waveform) ripple-for-mud)
    (let ((v1-9 (res-lump-data (-> obj entity) 'water-anim-fade-dist (pointer float))))
      (when v1-9
        (set! (-> gp-0 close-fade-dist) (-> v1-9 0))
        (set! (-> gp-0 far-fade-dist) (-> v1-9 1))
        )
      )
    (case (-> obj look)
      ((21 25 29)
       (set! (-> gp-0 close-fade-dist) 4096000000.0)
       (set! (-> gp-0 far-fade-dist) 8192000000.0)
       )
      )
    (case (-> obj look)
      ((22 25 24 27 26 31)
       (set! (-> gp-0 waveform) ripple-for-small-mud)
       )
      )
    )
  (none)
  )
