From 972a284fac34f32ade41a5f1f4211f87dadbff0a Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Sun, 28 Dec 2014 17:14:17 -0800 Subject: [PATCH] addded crappy night music. --- desktop/src-common/advent/actions.clj | 16 +++++++++++----- .../advent/screens/rooms/behind_house.clj | 2 +- .../src-common/advent/screens/rooms/cat_tree.clj | 2 +- .../advent/screens/rooms/inside_castle.clj | 2 +- .../advent/screens/rooms/outside_castle.clj | 2 +- .../advent/screens/rooms/outside_house.clj | 2 +- .../advent/screens/rooms/outside_jail.clj | 2 +- desktop/src-common/advent/screens/scene.clj | 5 +++-- 8 files changed, 20 insertions(+), 13 deletions(-) diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index bc02daa7..d25491b4 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -457,9 +457,14 @@ (can-skip? [this screen entities] false))) +(defn get-music [music time] + (if (keyword? music) + music + (time music))) + (defn transition-music ([entities new-music] - (transition-music entities (get-in @entities [:room :music]) new-music)) + (transition-music entities (get-music (get-in @entities [:room :music]) (get-in @entities [:state :time])) new-music)) ([entities old-music new-music] (let [current-volume (atom 1.0)] (run-action entities @@ -482,9 +487,10 @@ (can-skip? [this screen entities] false))))) + (defn transition-background [entities new-background [x y]] - (let [old-music (get-in @entities [:room :music]) - new-music (get-in @entities [:rooms new-background :music]) + (let [old-music (get-music (get-in @entities [:room :music]) (get-in @entities [:state :time])) + new-music (get-music (get-in @entities [:rooms new-background :music]) (get-in @entities [:state :time])) music-changed? (not= old-music new-music)] (run-action entities (begin [this screen entities] @@ -514,12 +520,12 @@ (run-action entities (begin [this screen entities] (let [ego (get-in entities [:room :entities :ego]) - old-music (get-in entities [:room :music]) + old-music (get-music (get-in entities [:room :music]) (get-in entities [:state :time])) entities (-> entities (assoc-in [:room] (get-in entities [:rooms new-background])) (assoc-in [:room :entities :ego] ego) (assoc-in [:state :last-room] new-background)) - new-music (get-in entities [:room :music]) + new-music (get-music (get-in entities [:room :music]) (get-in entities [:state :time])) apply-state (get-in entities [:room :apply-state]) entities (if apply-state (apply-state entities) diff --git a/desktop/src-common/advent/screens/rooms/behind_house.clj b/desktop/src-common/advent/screens/rooms/behind_house.clj index 36ce3d71..025abc46 100644 --- a/desktop/src-common/advent/screens/rooms/behind_house.clj +++ b/desktop/src-common/advent/screens/rooms/behind_house.clj @@ -13,7 +13,7 @@ (assoc-in entities [:room :entities :peeling :opacity] 0)) (defn make [screen] - (rooms/make :music :town-2 + (rooms/make :music {:day :town-2 :night :night} :interactions {:left-dir {:box [0 131 20 224] :script (actions/get-script diff --git a/desktop/src-common/advent/screens/rooms/cat_tree.clj b/desktop/src-common/advent/screens/rooms/cat_tree.clj index d1ce76d8..a702f199 100644 --- a/desktop/src-common/advent/screens/rooms/cat_tree.clj +++ b/desktop/src-common/advent/screens/rooms/cat_tree.clj @@ -191,7 +191,7 @@ owl-stand (utils/make-anim "cat-tree/owl.png" [19 28] 0.2 [0 0 0 0 0 0 0 2]) owl-talk (utils/make-anim "cat-tree/owl.png" [19 28] 0.2 [1 0 1 0 1 0 0 0 2 0]) owl-puke (utils/make-anim "cat-tree/owl.png" [19 28] 0.10 [0 0 2 2 3 2 2 3 3 2 3 3 3 4 5 6 7 4 4 3 3 2 2 2 2 2])] - (rooms/make :music :town-2 + (rooms/make :music {:day :town-2 :night :night} :interactions {:down-dir {:box [150 0 270 20] :script (actions/get-script entities diff --git a/desktop/src-common/advent/screens/rooms/inside_castle.clj b/desktop/src-common/advent/screens/rooms/inside_castle.clj index 5a2a0a50..97e1244d 100644 --- a/desktop/src-common/advent/screens/rooms/inside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/inside_castle.clj @@ -172,7 +172,7 @@ trophy (utils/make-anim "inside-castle/trophy.png" [16 16] 0.1 (flatten [(repeat 50 0) 1 2 3 3 3 3 2 1])) pull-sword-anim (utils/make-anim "inside-castle/pull-sword.png" [95 190] 0.10 (flatten [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2 3 2 3 2 3 3 2 3 2 2 3 3 2 3 2 3 2 3 2 3 2 3 2 2 3 3 3 2 3 2 3 3 2 3 2 3 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ])) monocle (utils/make-anim "inside-castle/monocle.png" [7 7] 0.05 (flatten [(repeat 70 0) 1 2 3 3 3 2 1]))] - (rooms/make :music :town-1 + (rooms/make :music {:day :town-1 :night :night} :interactions {:right-door {:box [286 140 306 160] :cursor :right diff --git a/desktop/src-common/advent/screens/rooms/outside_castle.clj b/desktop/src-common/advent/screens/rooms/outside_castle.clj index 47a41e8b..760b08c2 100644 --- a/desktop/src-common/advent/screens/rooms/outside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/outside_castle.clj @@ -139,7 +139,7 @@ steer-stand (animation 0.2 (for [i [0 0 0 0 0 0 0 0 0 1 0 2 0 1 0 2 0 1 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 3 3 3 3 3 0 0 0 0]] (aget steer-sheet 0 i))) flies-stand (utils/make-anim "outside-castle/flies.png" [15 15] 0.075 [0 1 2 1])] - (rooms/make :music :town-2 + (rooms/make :music {:day :town-2 :night :night} :interactions {:right-dir {:box [300 40 320 140] :script (actions/get-script diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index f86fca09..44f52d27 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -166,7 +166,7 @@ (aget sheep-walk-sheet 0 i))) butterfly-stand (utils/make-anim "butterfly.png" [7 7] 0.1 [0 1]) cauldron (utils/make-anim "outsidehouse/cauldron.png" [50 38] 0.15 (range 4))] - (rooms/make :music :town-2 + (rooms/make :music {:day :town-2 :night :night} :interactions {:door {:box [258 100 281 160] :script diff --git a/desktop/src-common/advent/screens/rooms/outside_jail.clj b/desktop/src-common/advent/screens/rooms/outside_jail.clj index 834f7df1..7193c4b0 100644 --- a/desktop/src-common/advent/screens/rooms/outside_jail.clj +++ b/desktop/src-common/advent/screens/rooms/outside_jail.clj @@ -43,7 +43,7 @@ guard-stand (animation 0.1 [(aget guard-sheet 0 0)]) guard-talk (animation 0.2 (for [i [0 0 0 0 1 0 0 1]] (aget guard-sheet 0 i))) guard-sleep (utils/make-anim "outside-jail/guard-sleep.png" [43 67] 0.1 (range 4))] - (rooms/make :music :town-2 + (rooms/make :music {:day :town-1 :night :night} :interactions {:down-dir {:box [30 0 227 20] :script (actions/get-script entities (actions/walk-to entities :ego [159 5]) diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index 13765137..41942120 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -337,7 +337,8 @@ :town-2 (make-music "town-music-2.ogg") :inside-fangald (make-music "inside-fangald.ogg") :fight (make-music "megaboss.mp3") - :pull-sword (make-music "pull-sword.ogg")} + :pull-sword (make-music "pull-sword.ogg") + :night (make-music "night.ogg")} :state (get-state) :actions {:object nil :channel (chan) @@ -356,7 +357,7 @@ :mouse-in? (zone/box 278 0 320 42)) :fps (assoc (label "0" (color :white) ) :x 5 :baseline 0)}] - (play-sound (get-in entities [:musics (get-in entities [:room :music])])) + (play-sound (get-in entities [:musics (actions/get-music (get-in entities [:room :music]) (get-in entities [:state :time]))])) (doseq [[k [start time fn]] (get-in entities [:room :timers])] (add-timer! screen k start time))