water sounds nice.

This commit is contained in:
2015-05-29 20:04:11 -07:00
parent 0045dbcde7
commit 59a2df0788
6 changed files with 53 additions and 24 deletions

View File

@@ -654,17 +654,11 @@ void main()
((set (keys anim-sound-frames)) anim))
(when-let [[snd vol-scale] (get-in anim-sound-frames [anim current-frame-index])]
(let [vol (if (= target :ego)
(* (/ (get-in entities [:room :entities :ego :scale-x]) 1.5) 0.75)
(max 0.0
(- 1.0 (/ (utils/dist x y
(get-in entities [:room :entities :ego :x])
(get-in entities [:room :entities :ego :y])
:y-sign 2.0
:x-sign (/ 1.0 (get-in entities [:room :entities :ego :scale-x])))
175.0))))
pan (/ (- (:x e) 160 ) 160)
vol (* vol vol-scale)
vol (max vol 0.005)]
(-> (* (/ (get-in entities [:room :entities :ego :scale-x]) 1.5) 0.75)
(* (or vol-scale 1.0))
(utils/clamp-volume))
(utils/proximity-volume entities [x y] :scale vol-scale))
pan (/ (- (:x e) 160 ) 160)]
(sound! (or (snd e)
(snd (:sounds entities))) :play (utils/current-sound-volume vol) 1.0 pan))))))