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

;; definition for symbol *footstep-surface*, type int
(define *footstep-surface* 448)

;; definition for symbol *debug-effect-control*, type symbol
(define *debug-effect-control* #f)

;; definition for function sound-name-with-material
(defun sound-name-with-material ((arg0 symbol) (arg1 pat-surface) (arg2 string))
  (let ((gp-0 format)
        (a0-2 (clear *temp-string*))
        (a1-1 "~S-~S~S")
        (v1-1 (-> arg1 material))
        )
    (gp-0
      a0-2
      a1-1
      arg0
      (cond
        ((= v1-1 (pat-material sand))
         "sand"
         )
        ((= v1-1 (pat-material wood))
         "wood"
         )
        ((= v1-1 (pat-material crwood))
         "crwood"
         )
        ((or (= v1-1 (pat-material tube)) (= v1-1 (pat-material pcmetal)))
         "pcmetal"
         )
        ((or (= v1-1 (pat-material metal)) (= v1-1 (pat-material rotate)))
         "metal"
         )
        ((= v1-1 (pat-material snow))
         "snow"
         )
        ((= v1-1 (pat-material deepsnow))
         "dpsnow"
         )
        ((= v1-1 (pat-material gravel))
         "gravel"
         )
        ((= v1-1 (pat-material dirt))
         "dirt"
         )
        ((= v1-1 (pat-material stone))
         "stone"
         )
        ((= v1-1 (pat-material waterbottom))
         "water"
         )
        ((= v1-1 (pat-material tar))
         "tar"
         )
        ((= v1-1 (pat-material straw))
         "straw"
         )
        ((= v1-1 (pat-material ice))
         "ice"
         )
        ((= v1-1 (pat-material swamp))
         "swamp"
         )
        ((= v1-1 (pat-material neutral))
         "neutral"
         )
        (else
          "grass"
          )
        )
      arg2
      )
    )
  (string->sound-name *temp-string*)
  )

;; definition for function effect-param->sound-spec
(defun effect-param->sound-spec ((arg0 sound-spec) (arg1 (pointer float)) (arg2 int))
  (while (> arg2 0)
    (case (the int (-> arg1 0))
      ((3)
       (logior! (-> arg0 mask) (sound-mask volume))
       (set! (-> arg0 volume) (the int (* 10.24 (-> arg1 1))))
       )
      ((4)
       (logior! (-> arg0 mask) (sound-mask volume))
       (+! (-> arg0 volume) (the int (* 10.24 (* (-> arg1 1) (rand-vu)))))
       )
      ((5)
       (logior! (-> arg0 mask) (sound-mask pitch))
       (set! (-> arg0 pitch-mod) (the int (* 1524.0 (-> arg1 1))))
       )
      ((6)
       (logior! (-> arg0 mask) (sound-mask pitch))
       (+! (-> arg0 pitch-mod) (the int (* 1524.0 (* (-> arg1 1) (rand-vu)))))
       )
      ((9)
       (logior! (-> arg0 mask) (sound-mask bend))
       (set! (-> arg0 bend) (the int (* 327.66998 (-> arg1 1))))
       )
      ((10)
       (logior! (-> arg0 mask) (sound-mask bend))
       (+! (-> arg0 bend) (the int (* 327.66998 (* (-> arg1 1) (rand-vu)))))
       )
      ((11)
       (logior! (-> arg0 mask) (sound-mask fo-min))
       (set! (-> arg0 fo-min) (the int (-> arg1 1)))
       )
      ((12)
       (logior! (-> arg0 mask) (sound-mask fo-max))
       (set! (-> arg0 fo-max) (the int (-> arg1 1)))
       )
      ((13)
       (logior! (-> arg0 mask) (sound-mask fo-curve))
       (set! (-> arg0 fo-curve) (the int (-> arg1 1)))
       )
      ((19)
       (set! (-> arg0 priority) (the int (-> arg1 1)))
       )
      )
    (+! arg2 -2)
    (set! arg1 (&-> arg1 2))
    )
  arg0
  )

;; definition for method 9 of type effect-control
;; INFO: Used lq/sq
;; INFO: Return type mismatch int vs none.
(defmethod TODO-RENAME-9 effect-control ((obj effect-control))
  (let* ((a0-1 (-> obj process skel))
         (v1-3 (if (< (-> obj channel-offset) (-> a0-1 active-channels))
                   (-> a0-1 root-channel (-> obj channel-offset))
                   (the-as joint-control-channel #f)
                   )
               )
         )
    (cond
      ((and v1-3 (-> v1-3 frame-group))
       (let* ((s5-0 (-> v1-3 frame-group))
              (f30-0 (+ (* (-> v1-3 frame-num) (-> s5-0 artist-step)) (-> s5-0 artist-base)))
              )
         (let ((a0-3 (-> a0-1 root-channel 0 num-func)))
           (cond
             ((!= s5-0 (-> obj last-frame-group))
              (set! (-> obj res) (-> s5-0 extra))
              (let ((v1-6 (-> (lookup-tag-idx (-> s5-0 extra) 'effect-name 'base -1000000000.0) lo)))
                (set! (-> obj name) (if (>= (the-as int v1-6) 0)
                                        (&-> (-> s5-0 extra tag) v1-6)
                                        (the-as (pointer res-tag) #f)
                                        )
                      )
                )
              (if (and (-> obj name) (= (-> obj name 0 key-frame) -1000000000.0))
                  (set! (-> obj name) (&-> (-> obj name) 1))
                  )
              (TODO-RENAME-14 obj f30-0 f30-0 f30-0)
              )
             ((or (not (-> obj name)) (= f30-0 (-> obj last-frame-num)))
              )
             (else
               (let ((f28-0 (-> obj last-frame-num))
                     (f26-0 f30-0)
                     )
                 (cond
                   ((= a0-3 num-func-seek!)
                    (let ((f0-6 (+ (* (-> v1-3 param 0) (-> s5-0 artist-step)) (-> s5-0 artist-base))))
                      (cond
                        ((< f26-0 f28-0)
                         (if (>= f28-0 f0-6)
                             (TODO-RENAME-14 obj f26-0 f28-0 f30-0)
                             )
                         )
                        (else
                          (if (>= f0-6 f28-0)
                              (TODO-RENAME-14 obj f28-0 f26-0 f30-0)
                              )
                          )
                        )
                      )
                    )
                   ((= a0-3 num-func-loop!)
                    (cond
                      ((>= (-> v1-3 param 0) 0.0)
                       (cond
                         ((< f26-0 f28-0)
                          (TODO-RENAME-14 obj f28-0 9999999.0 f30-0)
                          (TODO-RENAME-14 obj -100000000.0 f26-0 9999999.0)
                          )
                         (else
                           (TODO-RENAME-14 obj f28-0 f26-0 f30-0)
                           )
                         )
                       )
                      ((< f28-0 f26-0)
                       (TODO-RENAME-14 obj f26-0 9999999.0 f30-0)
                       (TODO-RENAME-14 obj -100000000.0 f28-0 9999999.0)
                       )
                      (else
                        (TODO-RENAME-14 obj f26-0 f28-0 f30-0)
                        )
                      )
                    )
                   ((= a0-3 num-func-+!)
                    (if (>= (-> v1-3 param 0) 0.0)
                        (TODO-RENAME-14 obj f28-0 f26-0 f30-0)
                        (TODO-RENAME-14 obj f26-0 f28-0 f30-0)
                        )
                    )
                   ((= a0-3 num-func-identity)
                    (TODO-RENAME-14 obj f30-0 f30-0 f30-0)
                    )
                   )
                 )
               )
             )
           )
         (set! (-> obj last-frame-group) s5-0)
         (set! (-> obj last-frame-num) f30-0)
         )
       )
      (else
        (set! (-> obj last-frame-group) #f)
        )
      )
    )
  0
  (none)
  )

;; definition for method 14 of type effect-control
;; INFO: Used lq/sq
;; INFO: Return type mismatch int vs none.
(defmethod TODO-RENAME-14 effect-control ((obj effect-control) (arg0 float) (arg1 float) (arg2 float))
  (let ((s2-0 (-> obj name)))
    (while (= (-> s2-0 0 name) 'effect-name)
      (let ((f0-0 (-> s2-0 0 key-frame)))
        (when (or (and (< f0-0 arg1) (< arg0 f0-0)) (= f0-0 arg2))
          (let* ((a0-1 obj)
                 (t9-0 (method-of-object a0-1 dummy-10))
                 (v1-7 (-> obj res))
                 (a1-1 (-> s2-0 0))
                 )
            (t9-0
              a0-1
              (the-as symbol (-> (the-as (pointer uint32) (&+ (-> v1-7 data-base) (-> a1-1 data-offset)))))
              f0-0
              -1
              )
            )
          )
        )
      (set! s2-0 (&-> s2-0 1))
      )
    )
  0
  (none)
  )

;; definition for method 10 of type effect-control
;; INFO: Used lq/sq
;; INFO: Return type mismatch int vs object.
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 205]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 217]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 237]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 343]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 364]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 450]
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 469]
(defmethod dummy-10 effect-control ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int))
  (local-vars
    (sv-160 int)
    (sv-176 symbol)
    (sv-192 symbol)
    (sv-208 symbol)
    (sv-224 int)
    (sv-240 symbol)
    (sv-256 symbol)
    (sv-272 symbol)
    (sv-288 res-lump)
    )
  (let ((s3-0 (-> arg0 value))
        (s5-0 (cond
                ((< arg2 0)
                 (let ((v0-0 (get-property-value
                               (-> obj res)
                               'effect-joint
                               'exact
                               arg1
                               (the-as uint128 0)
                               (the-as (pointer res-tag) #f)
                               *res-static-buf*
                               )
                             )
                       )
                   (if (zero? v0-0)
                       0
                       (the-as int (+ v0-0 1))
                       )
                   )
                 )
                (else
                  (empty)
                  arg2
                  )
                )
              )
        )
    (when (logtest? (-> obj flags) 1)
      (if (send-event (-> obj process) 'effect arg0 arg1 s5-0)
          (return (the-as object 0))
          )
      )
    (let ((v1-10 (symbol->string arg0)))
      (cond
        ((and (= (-> v1-10 data 0) 101)
              (= (-> v1-10 data 1) 102)
              (= (-> v1-10 data 2) 102)
              (= (-> v1-10 data 3) 101)
              (= (-> v1-10 data 4) 99)
              (= (-> v1-10 data 5) 116)
              (= (-> v1-10 data 6) 45)
              )
         (let* ((s3-1 (-> obj process root))
                (v1-14 (if (and (nonzero? s3-1) (type-type? (-> s3-1 type) collide-shape-moving))
                           s3-1
                           )
                       )
                (t1-1 (if v1-14
                          (the-as int (-> (the-as collide-shape-moving v1-14) ground-pat))
                          *footstep-surface*
                          )
                      )
                )
           (dummy-11 obj arg0 arg1 s5-0 (-> obj res) (the-as pat-surface t1-1))
           )
         )
        ((let ((v1-18 (symbol->string arg0)))
           (and (= (-> v1-18 data 0) 103)
                (= (-> v1-18 data 1) 114)
                (= (-> v1-18 data 2) 111)
                (= (-> v1-18 data 3) 117)
                (= (-> v1-18 data 4) 112)
                (= (-> v1-18 data 5) 45)
                )
           )
         (set! s3-0 (cond
                      ((zero? s3-0)
                       (let ((v0-5 (lookup-part-group-pointer-by-name (symbol->string arg0))))
                         (when v0-5
                           (set! (-> arg0 value) v0-5)
                           (set! s3-0 (-> v0-5 0))
                           )
                         )
                       (the-as (pointer sparticle-launch-group) s3-0)
                       )
                      (else
                        (-> (the-as (pointer sparticle-launch-group) s3-0) 0)
                        )
                      )
               )
         (when (and (nonzero? s3-0) (= (-> (the-as sparticle-launch-group s3-0) type) sparticle-launch-group))
           (if *debug-effect-control*
               (format
                 #t
                 "(~5D) effect group ~A ~A frame ~F joint ~D~%"
                 (-> *display* base-frame-counter)
                 (-> obj process name)
                 arg0
                 arg1
                 s5-0
                 )
               )
           (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000)))
             (when s4-1
               (let ((t9-7 (method-of-type part-tracker activate)))
                 (t9-7 (the-as part-tracker s4-1) (-> obj process) 'part-tracker (the-as pointer #x70004000))
                 )
               (let ((s2-1 run-function-in-process)
                     (s1-0 s4-1)
                     (s0-0 part-tracker-init)
                     )
                 (set! sv-160 -1)
                 (set! sv-176 (the-as symbol #f))
                 (set! sv-192 (the-as symbol #f))
                 (set! sv-208 (the-as symbol #f))
                 (let ((t3-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0))))
                   ((the-as (function object object object object object object object object none) s2-1)
                    s1-0
                    s0-0
                    (the-as sparticle-launch-group s3-0)
                    sv-160
                    sv-176
                    sv-192
                    sv-208
                    t3-0
                    )
                   )
                 )
               (-> s4-1 ppointer)
               )
             )
           )
         )
        ((= arg0 'camera-shake)
         (activate! *camera-smush-control* 819.2 37 600 1.0 0.995)
         )
        ((zero? s3-0)
         (dummy-12 obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0)))
         )
        ((= (-> (the-as basic s3-0) type) sparticle-launcher)
         (if *debug-effect-control*
             (format
               #t
               "(~5D) effect part  ~A ~A frame ~F joint ~D~%"
               (-> *display* base-frame-counter)
               (-> obj process name)
               arg0
               arg1
               s5-0
               )
             )
         (format
           #t
           "-----> (~5D) effect part  ~A ~A frame ~F joint ~D~%"
           (-> *display* base-frame-counter)
           (-> obj process name)
           arg0
           arg1
           s5-0
           )
         (sp-launch-particles-var
           *sp-particle-system-2d*
           (the-as sparticle-launcher s3-0)
           (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0))
           (the-as sparticle-launch-state #f)
           (the-as sparticle-launch-control #f)
           1.0
           )
         )
        ((= (-> (the-as basic s3-0) type) sparticle-launch-group)
         (if *debug-effect-control*
             (format
               #t
               "(~5D) effect group ~A ~A frame ~F joint ~D~%"
               (-> *display* base-frame-counter)
               (-> obj process name)
               arg0
               arg1
               s5-0
               )
             )
         (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000)))
           (when s4-3
             (let ((t9-19 (method-of-type part-tracker activate)))
               (t9-19 (the-as part-tracker s4-3) (-> obj process) 'part-tracker (the-as pointer #x70004000))
               )
             (let ((s2-3 run-function-in-process)
                   (s1-2 s4-3)
                   (s0-2 part-tracker-init)
                   )
               (set! sv-224 -1)
               (set! sv-240 (the-as symbol #f))
               (set! sv-256 (the-as symbol #f))
               (set! sv-272 (the-as symbol #f))
               (let ((t3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0))))
                 ((the-as (function object object object object object object object object none) s2-3)
                  s1-2
                  s0-2
                  s3-0
                  sv-224
                  sv-240
                  sv-256
                  sv-272
                  t3-1
                  )
                 )
               )
             (-> s4-3 ppointer)
             )
           )
         )
        ((= (-> (the-as basic s3-0) type) sound-spec)
         (sound-play-by-spec
           (the-as sound-spec s3-0)
           (new-sound-id)
           (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0))
           )
         )
        ((= (-> (the-as basic s3-0) type) death-info)
         (let ((v1-67 (-> obj process draw)))
           (let ((a1-42 (-> (the-as death-info s3-0) vertex-skip))
                 (a0-55
                   (max
                     2
                     (the-as int (/ (-> (the-as death-info s3-0) timer) (the-as uint (the int (-> *display* time-factor)))))
                     )
                   )
                 )
             (when (= (-> *setting-control* current video-mode) 'pal)
               (if (< (the-as uint 1) a1-42)
                   (set! a1-42 (/ (the-as uint (* (the-as uint 50) a1-42)) (the-as uint 60)))
                   )
               )
             (let ((a2-29 (-> *display* frames (-> *display* last-screen) frame run-time)))
               (cond
                 ((< 9000 a2-29)
                  (set! a1-42 (* a1-42 4))
                  )
                 ((< 7000 a2-29)
                  (set! a1-42 (* a1-42 2))
                  )
                 )
               )
             (set! (-> v1-67 death-vertex-skip) a1-42)
             (set! (-> v1-67 death-effect) (-> (the-as death-info s3-0) effect))
             (set! (-> v1-67 death-timer) (+ a0-55 1))
             )
           (set! (-> v1-67 death-timer-org) (-> v1-67 death-timer))
           (set! (-> v1-67 death-draw-overlap) (-> (the-as death-info s3-0) overlap))
           )
         (when (-> (the-as death-info s3-0) sound)
           (let* ((s2-5 obj)
                  (s1-3 (method-of-object s2-5 dummy-12))
                  (s0-3 (-> (the-as death-info s3-0) sound))
                  )
             (set! sv-288 (-> obj res))
             (let ((t1-11 (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound)))))
               (s1-3 s2-5 s0-3 arg1 s5-0 sv-288 t1-11)
               )
             )
           )
         (send-event (-> obj process) 'death-start (the-as death-info s3-0))
         )
        (else
          (dummy-12 obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0)))
          )
        )
      )
    )
  0
  )

;; definition for method 11 of type effect-control
;; INFO: Used lq/sq
;; INFO: Return type mismatch int vs none.
(defmethod dummy-11 effect-control ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 pat-surface))
  (local-vars
    (sv-48
      (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none)
      )
    (sv-64 sparticle-system)
    (sv-80
      (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none)
      )
    (sv-96 sparticle-system)
    )
  (let ((s1-0 (the-as sound-name #f)))
    (let ((a0-4 (-> *display* frames (-> *display* last-screen) frame run-time)))
      (case arg0
        (('effect-walk-step-left 'effect-run-step-left)
         (set! s1-0 (sound-name-with-material 'walk arg4 "1"))
         )
        (('effect-walk-step-right 'effect-run-step-right)
         (set! s1-0 (sound-name-with-material 'walk arg4 "2"))
         )
        (('effect-roll)
         (set! s1-0 (sound-name-with-material 'roll arg4 ""))
         )
        (('effect-slide)
         (set! s1-0 (sound-name-with-material 'slide arg4 ""))
         )
        (('effect-land)
         (set! s1-0 (sound-name-with-material 'land arg4 ""))
         )
        (('effect-zoom-land)
         (set! s1-0 (sound-name-with-material 'zoom-land arg4 ""))
         )
        (('effect-zoom-hit)
         (set! s1-0 (sound-name-with-material 'zoom-hit arg4 ""))
         )
        (('effect-flut-land)
         (set! s1-0 (sound-name-with-material 'flut-land arg4 ""))
         )
        (('effect-land-poof)
         (when (< a0-4 9000)
           (let* ((a0-13 obj)
                  (t9-8 (method-of-object a0-13 dummy-10))
                  (v1-15 (-> arg4 material))
                  )
             (t9-8
               a0-13
               (cond
                 ((= v1-15 (pat-material sand))
                  'group-land-poof-sand
                  )
                 ((= v1-15 (pat-material wood))
                  'group-land-poof-wood
                  )
                 ((= v1-15 (pat-material crwood))
                  'group-land-poof-crwood
                  )
                 ((or (= v1-15 (pat-material tube)) (= v1-15 (pat-material pcmetal)))
                  'group-land-poof-pcmetal
                  )
                 ((or (= v1-15 (pat-material metal)) (= v1-15 (pat-material rotate)))
                  'group-land-poof-metal
                  )
                 ((= v1-15 (pat-material ice))
                  'group-land-poof-ice
                  )
                 ((= v1-15 (pat-material snow))
                  'group-land-poof-snow
                  )
                 ((= v1-15 (pat-material deepsnow))
                  'group-land-poof-dpsnow
                  )
                 ((= v1-15 (pat-material gravel))
                  'group-land-poof-gravel
                  )
                 ((= v1-15 (pat-material dirt))
                  'group-land-poof-dirt
                  )
                 ((= v1-15 (pat-material stone))
                  'group-land-poof-stone
                  )
                 ((= v1-15 (pat-material waterbottom))
                  'group-land-poof-water
                  )
                 ((= v1-15 (pat-material tar))
                  'group-land-poof-tar
                  )
                 ((= v1-15 (pat-material straw))
                  'group-land-poof-straw
                  )
                 ((= v1-15 (pat-material swamp))
                  'group-land-poof-swamp
                  )
                 ((= v1-15 (pat-material neutral))
                  'group-land-poof-neutral
                  )
                 (else
                   'group-land-poof-grass
                   )
                 )
               arg1
               -1
               )
             )
           )
         )
        (('effect-run-poof)
         (when (< a0-4 9000)
           (let* ((a0-14 obj)
                  (t9-9 (method-of-object a0-14 dummy-10))
                  (v1-20 (-> arg4 material))
                  )
             (t9-9
               a0-14
               (cond
                 ((= v1-20 (pat-material sand))
                  'group-run-poof-sand
                  )
                 ((= v1-20 (pat-material wood))
                  'group-run-poof-wood
                  )
                 ((= v1-20 (pat-material crwood))
                  'group-run-poof-crwood
                  )
                 ((or (= v1-20 (pat-material tube)) (= v1-20 (pat-material pcmetal)))
                  'group-run-poof-pcmetal
                  )
                 ((or (= v1-20 (pat-material metal)) (= v1-20 (pat-material rotate)))
                  'group-run-poof-metal
                  )
                 ((= v1-20 (pat-material ice))
                  'group-run-poof-ice
                  )
                 ((= v1-20 (pat-material snow))
                  'group-run-poof-snow
                  )
                 ((= v1-20 (pat-material deepsnow))
                  'group-run-poof-dpsnow
                  )
                 ((= v1-20 (pat-material gravel))
                  'group-run-poof-gravel
                  )
                 ((= v1-20 (pat-material dirt))
                  'group-run-poof-dirt
                  )
                 ((= v1-20 (pat-material stone))
                  'group-run-poof-stone
                  )
                 ((= v1-20 (pat-material waterbottom))
                  'group-run-poof-water
                  )
                 ((= v1-20 (pat-material tar))
                  'group-run-poof-tar
                  )
                 ((= v1-20 (pat-material straw))
                  'group-run-poof-straw
                  )
                 ((= v1-20 (pat-material swamp))
                  'group-run-poof-swamp
                  )
                 ((= v1-20 (pat-material neutral))
                  'group-run-poof-neutral
                  )
                 (else
                   'group-run-poof-grass
                   )
                 )
               arg1
               -1
               )
             )
           )
         )
        (('effect-just-footprint)
         (let* ((a0-15 obj)
                (t9-10 (method-of-object a0-15 dummy-10))
                (v1-24 (-> arg4 material))
                )
           (t9-10
             a0-15
             (cond
               ((= v1-24 (pat-material sand))
                'group-just-footprint-sand
                )
               ((= v1-24 (pat-material wood))
                'group-just-footprint-wood
                )
               ((= v1-24 (pat-material crwood))
                'group-just-footprint-crwood
                )
               ((or (= v1-24 (pat-material tube)) (= v1-24 (pat-material pcmetal)))
                'group-just-footprint-pcmetal
                )
               ((or (= v1-24 (pat-material metal)) (= v1-24 (pat-material rotate)))
                'group-just-footprint-metal
                )
               ((= v1-24 (pat-material ice))
                'group-just-footprint-ice
                )
               ((= v1-24 (pat-material snow))
                'group-just-footprint-snow
                )
               ((= v1-24 (pat-material deepsnow))
                'group-just-footprint-dpsnow
                )
               ((= v1-24 (pat-material gravel))
                'group-just-footprint-gravel
                )
               ((= v1-24 (pat-material dirt))
                'group-just-footprint-dirt
                )
               ((= v1-24 (pat-material stone))
                'group-just-footprint-stone
                )
               ((= v1-24 (pat-material waterbottom))
                'group-just-footprint-water
                )
               ((= v1-24 (pat-material tar))
                'group-just-footprint-tar
                )
               ((= v1-24 (pat-material straw))
                'group-just-footprint-straw
                )
               ((= v1-24 (pat-material swamp))
                'group-just-footprint-swamp
                )
               ((= v1-24 (pat-material neutral))
                'group-just-footprint-neutral
                )
               (else
                 'group-just-footprint-grass
                 )
               )
             arg1
             -1
             )
           )
         )
        (('effect-just-poof)
         (when (< a0-4 9000)
           (let* ((a0-16 obj)
                  (t9-11 (method-of-object a0-16 dummy-10))
                  (v1-29 (-> arg4 material))
                  )
             (t9-11
               a0-16
               (cond
                 ((= v1-29 (pat-material sand))
                  'group-just-poof-sand
                  )
                 ((= v1-29 (pat-material wood))
                  'group-just-poof-wood
                  )
                 ((= v1-29 (pat-material crwood))
                  'group-just-poof-crwood
                  )
                 ((or (= v1-29 (pat-material tube)) (= v1-29 (pat-material pcmetal)))
                  'group-just-poof-pcmetal
                  )
                 ((or (= v1-29 (pat-material metal)) (= v1-29 (pat-material rotate)))
                  'group-just-poof-metal
                  )
                 ((= v1-29 (pat-material ice))
                  'group-just-poof-ice
                  )
                 ((= v1-29 (pat-material snow))
                  'group-just-poof-snow
                  )
                 ((= v1-29 (pat-material deepsnow))
                  'group-just-poof-dpsnow
                  )
                 ((= v1-29 (pat-material gravel))
                  'group-just-poof-gravel
                  )
                 ((= v1-29 (pat-material dirt))
                  'group-just-poof-dirt
                  )
                 ((= v1-29 (pat-material stone))
                  'group-just-poof-stone
                  )
                 ((= v1-29 (pat-material waterbottom))
                  'group-just-poof-water
                  )
                 ((= v1-29 (pat-material tar))
                  'group-just-poof-tar
                  )
                 ((= v1-29 (pat-material straw))
                  'group-just-poof-straw
                  )
                 ((= v1-29 (pat-material swamp))
                  'group-just-poof-swamp
                  )
                 ((= v1-29 (pat-material neutral))
                  'group-just-poof-neutral
                  )
                 (else
                   'group-just-poof-grass
                   )
                 )
               arg1
               -1
               )
             )
           )
         )
        (('effect-slide-poof)
         (let* ((a0-19 obj)
                (t9-12 (method-of-object a0-19 dummy-10))
                (v1-33 (-> arg4 material))
                )
           (t9-12
             a0-19
             (cond
               ((= v1-33 (pat-material sand))
                'group-slide-poof-sand
                )
               ((= v1-33 (pat-material wood))
                'group-slide-poof-wood
                )
               ((= v1-33 (pat-material crwood))
                'group-slide-poof-crwood
                )
               ((or (= v1-33 (pat-material tube)) (= v1-33 (pat-material pcmetal)))
                'group-slide-poof-pcmetal
                )
               ((or (= v1-33 (pat-material metal)) (= v1-33 (pat-material rotate)))
                'group-slide-poof-metal
                )
               ((= v1-33 (pat-material ice))
                'group-slide-poof-ice
                )
               ((= v1-33 (pat-material snow))
                'group-slide-poof-snow
                )
               ((= v1-33 (pat-material deepsnow))
                'group-slide-poof-dpsnow
                )
               ((= v1-33 (pat-material gravel))
                'group-slide-poof-gravel
                )
               ((= v1-33 (pat-material dirt))
                'group-slide-poof-dirt
                )
               ((= v1-33 (pat-material stone))
                'group-slide-poof-stone
                )
               ((= v1-33 (pat-material waterbottom))
                'group-slide-poof-water
                )
               ((= v1-33 (pat-material tar))
                'group-slide-poof-tar
                )
               ((= v1-33 (pat-material straw))
                'group-slide-poof-straw
                )
               ((= v1-33 (pat-material swamp))
                'group-slide-poof-swamp
                )
               ((= v1-33 (pat-material neutral))
                'group-slide-poof-neutral
                )
               (else
                 'group-slide-poof-grass
                 )
               )
             arg1
             -1
             )
           )
         )
        (('effect-droppings)
         (let* ((v1-36 (-> arg4 material))
                (s0-0 (cond
                        ((= v1-36 (pat-material sand))
                         (-> *part-id-table* 95)
                         )
                        ((= v1-36 (pat-material wood))
                         (-> *part-id-table* 97)
                         )
                        ((= v1-36 (pat-material crwood))
                         (-> *part-id-table* 99)
                         )
                        ((or (= v1-36 (pat-material tube)) (= v1-36 (pat-material pcmetal)))
                         (-> *part-id-table* 2248)
                         )
                        ((or (= v1-36 (pat-material metal)) (= v1-36 (pat-material rotate)))
                         (-> *part-id-table* 2334)
                         )
                        ((= v1-36 (pat-material ice))
                         (-> *part-id-table* 2249)
                         )
                        ((= v1-36 (pat-material snow))
                         (-> *part-id-table* 2250)
                         )
                        ((= v1-36 (pat-material deepsnow))
                         (-> *part-id-table* 2251)
                         )
                        ((= v1-36 (pat-material gravel))
                         (-> *part-id-table* 2252)
                         )
                        ((= v1-36 (pat-material dirt))
                         (-> *part-id-table* 2253)
                         )
                        ((= v1-36 (pat-material stone))
                         (-> *part-id-table* 98)
                         )
                        ((= v1-36 (pat-material waterbottom))
                         (-> *part-id-table* 2254)
                         )
                        ((= v1-36 (pat-material tar))
                         (-> *part-id-table* 2255)
                         )
                        ((= v1-36 (pat-material straw))
                         (-> *part-id-table* 2256)
                         )
                        ((= v1-36 (pat-material swamp))
                         (-> *part-id-table* 2257)
                         )
                        ((= v1-36 (pat-material neutral))
                         (-> *part-id-table* 2773)
                         )
                        (else
                          (-> *part-id-table* 96)
                          )
                        )
                      )
                )
           (when (nonzero? s0-0)
             (set! sv-48 sp-launch-particles-var)
             (set! sv-64 *sp-particle-system-2d*)
             (let ((a2-36 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)))
                   (a3-6 #f)
                   (t0-1 #f)
                   (t1-1 1.0)
                   )
               (sv-48 sv-64 s0-0 a2-36 (the-as sparticle-launch-state a3-6) (the-as sparticle-launch-control t0-1) t1-1)
               )
             )
           )
         )
        (('effect-jump-droppings)
         (let* ((v1-61 (-> arg4 material))
                (s0-1 (cond
                        ((= v1-61 (pat-material sand))
                         (-> *part-id-table* 106)
                         )
                        ((= v1-61 (pat-material wood))
                         (-> *part-id-table* 2258)
                         )
                        ((= v1-61 (pat-material crwood))
                         (-> *part-id-table* 2259)
                         )
                        ((or (= v1-61 (pat-material tube)) (= v1-61 (pat-material pcmetal)))
                         (-> *part-id-table* 2260)
                         )
                        ((or (= v1-61 (pat-material metal)) (= v1-61 (pat-material rotate)))
                         (-> *part-id-table* 2335)
                         )
                        ((= v1-61 (pat-material ice))
                         (-> *part-id-table* 2261)
                         )
                        ((= v1-61 (pat-material snow))
                         (-> *part-id-table* 2262)
                         )
                        ((= v1-61 (pat-material deepsnow))
                         (-> *part-id-table* 2263)
                         )
                        ((= v1-61 (pat-material gravel))
                         (-> *part-id-table* 2264)
                         )
                        ((= v1-61 (pat-material dirt))
                         (-> *part-id-table* 2265)
                         )
                        ((= v1-61 (pat-material stone))
                         (-> *part-id-table* 2266)
                         )
                        ((= v1-61 (pat-material waterbottom))
                         (-> *part-id-table* 2267)
                         )
                        ((= v1-61 (pat-material tar))
                         (-> *part-id-table* 2268)
                         )
                        ((= v1-61 (pat-material straw))
                         (-> *part-id-table* 2269)
                         )
                        ((= v1-61 (pat-material swamp))
                         (-> *part-id-table* 2270)
                         )
                        ((= v1-61 (pat-material neutral))
                         (-> *part-id-table* 2774)
                         )
                        (else
                          (-> *part-id-table* 107)
                          )
                        )
                      )
                )
           (when (nonzero? s0-1)
             (set! sv-80 sp-launch-particles-var)
             (set! sv-96 *sp-particle-system-2d*)
             (let ((a2-37 (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)))
                   (a3-7 #f)
                   (t0-2 #f)
                   (t1-2 1.0)
                   )
               (sv-80 sv-96 s0-1 a2-37 (the-as sparticle-launch-state a3-7) (the-as sparticle-launch-control t0-2) t1-2)
               )
             )
           )
         )
        )
      )
    (if s1-0
        (dummy-12 obj arg0 arg1 arg2 arg3 s1-0)
        )
    )
  0
  (none)
  )

;; definition for method 12 of type effect-control
;; INFO: Used lq/sq
(defmethod dummy-12 effect-control ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 sound-name))
  (local-vars (sv-112 res-tag) (sv-128 sound-name) (sv-144 basic) (sv-160 (function vector vector float)))
  (set! sv-144 arg3)
  (let ((s0-0 arg4)
        (gp-0 (new 'stack 'sound-spec))
        (s5-0 (if (< arg2 0)
                  (the-as vector #f)
                  (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2))
                  )
              )
        )
    (set! (-> gp-0 sound-name) s0-0)
    (logior! (-> gp-0 mask) (sound-mask volume))
    (set! (-> gp-0 volume) 1024)
    (logior! (-> gp-0 mask) (sound-mask bend))
    (set! (-> gp-0 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0))))
    (set! sv-112 (new 'static 'res-tag))
    (let* ((t9-3 (method-of-type res-lump get-property-data))
           (a1-6 'effect-param)
           (a2-1 'exact)
           (a3-1 arg1)
           (t0-1 #f)
           (t1-1 (the-as (pointer res-tag) (& sv-112)))
           (t2-0 *res-static-buf*)
           (a1-7 (t9-3 (the-as res-lump sv-144) a1-6 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0))
           )
      (if a1-7
          (effect-param->sound-spec gp-0 (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count)))
          )
      )
    (if (and (nonzero? (-> gp-0 fo-max)) (let ((f30-1 (* 4096.0 (the float (-> gp-0 fo-max)))))
                                           (set! sv-160 vector-vector-distance)
                                           (let ((a0-6 (ear-trans))
                                                 (a1-8 s5-0)
                                                 )
                                             (< f30-1 (sv-160 a0-6 a1-8))
                                             )
                                           )
             )
        (return 0)
        )
    (when *debug-effect-control*
      (set! sv-128 s0-0)
      (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128)))
      (format
        #t
        "(~5D) effect sound ~A ~A (~S) frame ~F joint ~D "
        (-> *display* base-frame-counter)
        (-> obj process name)
        arg0
        *temp-string*
        arg1
        arg2
        )
      (format
        #t
        "volume: ~f  pitch-mod: ~f~%"
        (* 0.09765625 (the float (-> gp-0 volume)))
        (* 0.000656168 (the float (-> gp-0 pitch-mod)))
        )
      )
    (sound-play-by-spec gp-0 (new-sound-id) s5-0)
    )
  0
  )

;; definition for function target-land-effect
;; INFO: Return type mismatch int vs none.
(defbehavior target-land-effect target ()
  (cond
    ((logtest? (-> self control root-prim prim-core action) (collide-action ca-14))
     (dummy-10 (-> self skel effect) 'effect-land-poof -1.0 -1)
     (dummy-10 (-> self skel effect) 'effect-flut-land -1.0 -1)
     )
    ((logtest? (-> self control root-prim prim-core action) (collide-action ca-9))
     (sound-play-by-name
       (sound-name-with-material 'zoom-land (-> self control ground-pat) "")
       (new-sound-id)
       (the int
            (* 10.24 (* 100.0 (the float (the int (* 10.24 (* 0.000016276043 (-> self control ground-impact-vel)))))))
            )
       0
       0
       (sound-group sfx)
       #t
       )
     )
    ((logtest? (-> self water flags) (water-flags wt09))
     (dummy-10 (-> self skel effect) 'effect-land-water -1.0 -1)
     )
    (else
      (dummy-10 (-> self skel effect) 'effect-land-poof -1.0 -1)
      (dummy-10 (-> self skel effect) 'effect-land -1.0 -1)
      )
    )
  0
  (none)
  )
