diff --git a/desktop/resources/dream/wind.ogg b/desktop/resources/dream/wind.ogg new file mode 100644 index 00000000..9821c463 Binary files /dev/null and b/desktop/resources/dream/wind.ogg differ diff --git a/desktop/src-common/advent/screens/rooms/dream.clj b/desktop/src-common/advent/screens/rooms/dream.clj index 89933f21..fc0b9b05 100644 --- a/desktop/src-common/advent/screens/rooms/dream.clj +++ b/desktop/src-common/advent/screens/rooms/dream.clj @@ -173,11 +173,11 @@ (sound! (sound "dream/appear.ogg") :play (utils/current-sound-volume)) (particle-effect! (get-in @entities [:room :entities :magic]) :reset) (particle-effect! (get-in @entities [:room :entities :magic]) :start) - (Thread/sleep 500) (fade-in entities) + (actions/transition-music entities :dream) (Thread/sleep 100) (actions/talk entities :fairy-godfather "-daaaaaaaaaaaaa!") - (Thread/sleep 2500) + (Thread/sleep 1500) (actions/talk entities :ego "Oh no! The grim reaper!" :anim :frustrated-talk) (actions/do-dialogue entities :fairy-godfather "Relax, Tick. You're dreaming!" @@ -362,6 +362,8 @@ (assoc (texture "dream/corner-l.png") :x -10 :y -10 :baseline 240 :parallax 2.0 ) (assoc (texture "dream/corner-r.png") :x (- 320 80) :y -20 :baseline 240 :parallax 3.2) (assoc (texture "dream/pedestals.png") :x 0 :y 0 :baseline 139)] + :wind-sound {:sound (sound "dream/wind.ogg") + :id nil} :entities {:magic (assoc (particle-effect "dream/magic") :x 160 :y 80 :baseline 240) :clouds (assoc (particle-effect "dream/cloudy2") :x 160 :y 120 :baseline 241) @@ -472,8 +474,13 @@ (actions/play-animation entities :ego :sigh))})} :collision "dream/collision.png" :scale-fn (utils/scaler-fn-from-image "dream/scale.png" 0.1 1.3) + :stop-fn (fn [_ entities] + (when-let [wind-sound-id (get-in entities [:room :wind-sound :id])] + (sound! (get-in entities [:room :wind-sound :sound]) :stop wind-sound-id)) + entities) :apply-state (fn [_ entities] (utils/fast-forward-particle (get-in entities [:room :entities :outside-particles])) + (as-> entities entities (if (get-in entities [:state :seen-intro?]) (set-opacity entities 1.0 1.0) @@ -483,5 +490,6 @@ entities) (if (actions/has-item? entities :shovel) (update-in entities [:room :entities] dissoc :shovel) - entities))) + entities) + (assoc-in entities [:room :wind-sound :id] (sound! (get-in entities [:room :wind-sound :sound]) :loop 0.175)))) :start-pos [140 55]))) diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index db60f9a3..6034091a 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -648,7 +648,8 @@ void main() (defn fade-in-first-time-if-necessary [screen entities] (if (not (get-in entities [:started? :value])) (do (music! (utils/get-current-music entities) :set-volume (utils/current-music-volume (get-in entities [:volume :value]))) - (utils/play-sound (get-in entities [:musics (actions/get-music (get-in entities [:room :music]) (get-in entities [:state :time]))])) + (when (get-in entities [:state :seen-intro?]) + (utils/play-sound (get-in entities [:musics (actions/get-music (get-in entities [:room :music]) (get-in entities [:state :time]))]))) (assoc entities :tweens {:fade-in (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 1.0 :ease tween/ease-in-cubic :finish #(if (not (get-in % [:state :seen-intro?])) @@ -759,7 +760,6 @@ void main() (set! (. cam zoom) 0.95) (let [_ (input! :set-cursor-image (utils/cursor "cursor.png" :main) 0 0) shader (ShaderProgram. v-shader pix-shader) - _ (println (.getLog shader)) _ (update! screen :shader shader) rooms {:inside-house (rooms.inside-house/make screen) :inside-stash (rooms.inside-stash/make screen)