water sounds nice.
This commit is contained in:
@@ -607,13 +607,16 @@
|
||||
(>= (get-in entities [:fade :opacity]) 1.0))
|
||||
|
||||
(terminate [this screen entities]
|
||||
(stop screen (if-let [next-time (get-in entities [:state :next-time])]
|
||||
(-> entities
|
||||
(assoc-in [:state :time] next-time)
|
||||
(assoc-in [:state :next-time] nil))
|
||||
entities)
|
||||
:ego
|
||||
:face face))
|
||||
(let [entities (stop screen (if-let [next-time (get-in entities [:state :next-time])]
|
||||
(-> entities
|
||||
(assoc-in [:state :time] next-time)
|
||||
(assoc-in [:state :next-time] nil))
|
||||
entities)
|
||||
:ego
|
||||
:face face)]
|
||||
(if-let [stop-fn (get-in entities [:room :stop-fn])]
|
||||
(stop-fn screen entities)
|
||||
entities)))
|
||||
(can-skip? [this screen entities]
|
||||
false))
|
||||
(run-action entities
|
||||
|
||||
@@ -81,6 +81,9 @@
|
||||
(actions/walk-straight-to entities :ego [142 96])
|
||||
(actions/talk entities :ego "This must be Frankie Rockfist's secret stash!")))
|
||||
|
||||
(defn fountain-vol [entities]
|
||||
(utils/proximity-volume entities [172 120] :scale 0.5))
|
||||
|
||||
(defn make [screen]
|
||||
(let [guard-sheet (texture! (texture "inside-cafeteria/ladder-guard.png") :split 37 87)
|
||||
guard-stand (animation 0.1 [(aget guard-sheet 0 0)])
|
||||
@@ -192,6 +195,8 @@
|
||||
:y 140
|
||||
:baseline 114)
|
||||
:axe (assoc (texture "outside-jail/axe.png") :x 213 :y 63 :baseline 176 :night-profile :sprite)}
|
||||
:fountain-sound {:sound (sound "outside-jail/fountain-2.ogg")
|
||||
:id nil}
|
||||
|
||||
|
||||
|
||||
@@ -224,11 +229,24 @@
|
||||
:collision "outside-jail/collision.png"
|
||||
:scale-fn (utils/scaler-fn-with-baseline 40 0.001 1.3)
|
||||
:start-pos [145 15]
|
||||
|
||||
:update-fn (fn [_ entities]
|
||||
(when-let [fountain-sound-id (get-in entities [:room :fountain-sound :id])]
|
||||
(sound! (get-in entities [:room :fountain-sound :sound]) :set-volume fountain-sound-id (fountain-vol entities)))
|
||||
entities)
|
||||
|
||||
:stop-fn (fn [_ entities]
|
||||
(when-let [fountain-sound-id (get-in entities [:room :fountain-sound :id])]
|
||||
(sound! (get-in entities [:room :fountain-sound :sound]) :stop fountain-sound-id))
|
||||
entities)
|
||||
|
||||
:apply-state (fn [_ entities]
|
||||
|
||||
(as-> entities entities
|
||||
(if (= :night (get-in entities [:state :time]))
|
||||
(make-night entities)
|
||||
entities)
|
||||
(if (get-in entities [:state :dropped-ball?])
|
||||
(update-in entities [:room :entities :guard] #(actions/start-animation % :sleep))
|
||||
entities))))))
|
||||
(assoc-in entities [:room :fountain-sound :id] (sound! (get-in entities [:room :fountain-sound :sound]) :loop (fountain-vol entities)))
|
||||
(if (= :night (get-in entities [:state :time]))
|
||||
(make-night entities)
|
||||
entities)
|
||||
(if (get-in entities [:state :dropped-ball?])
|
||||
(update-in entities [:room :entities :guard] #(actions/start-animation % :sleep))
|
||||
entities))))))
|
||||
|
||||
@@ -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))))))
|
||||
|
||||
|
||||
@@ -239,3 +239,17 @@
|
||||
|
||||
(def default-night-merge {:r 0.08 :g 0.1 :b 0.36 :multiply-amount 1.0 :hue-amount 1.0})
|
||||
(def default-night-merge-sprite {:r 0.08 :g 0.1 :b 0.36 :multiply-amount 0.3 :hue-amount 0.4})
|
||||
|
||||
(defn clamp-volume [vol]
|
||||
(max vol 0.005))
|
||||
|
||||
(defn proximity-volume [entities [x y] & {:keys [scale]}]
|
||||
(-> (max 0.0
|
||||
(- 1.0 (/ (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)))
|
||||
(* (or scale 1.0))
|
||||
(clamp-volume)))
|
||||
|
||||
Reference in New Issue
Block a user