fixed music up.

This commit is contained in:
Bryce Covert
2017-06-21 20:07:57 -07:00
parent 0ac95fb8f9
commit 7857c8cf09
19 changed files with 40 additions and 32 deletions

View File

@@ -676,9 +676,10 @@
(defn transition-background [entities new-background [x y] & {:keys [transition-music? between time face]}]
(let [transition-music? (if (nil? transition-music?) true transition-music?)
old-music (get-music (get-in @entities [:room :music]) (get-in @entities [:state :time]))
old-music (get-music (get-in @entities [:room-musics (get-in @entities [:state :last-room])]) (get-in @entities [:state :time]))
;; TODO FIX
new-music old-music
new-music (get-music (get-in @entities [:room-musics new-background]) (get-in @entities [:state :time]))
_ (println old-music new-music)
music-changed? (and transition-music? (not= old-music new-music))
time (/ (float (or time 1.0)) 2.0)]
(run-action entities
@@ -720,7 +721,7 @@
(begin [this screen entities]
(utils/stop-all-sounds! entities)
(let [ego (get-in entities [:room :entities :ego])
old-music (get-music (get-in entities [:room :music]) (get-in entities [:state :time]))
entities (as-> entities e
(assoc-in e [:room] ((get-in entities [:rooms new-background]) screen))
(assoc-in e [:room :entities :ego] ego)
@@ -740,7 +741,6 @@
(if music-changed?
(assoc-in e [:tweens :fade-in-music] (tween/tween :fade-in-music screen [:volume :value] 0.0 1.0 time))
e))
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 screen entities)

View File

@@ -30,8 +30,7 @@
(fn [state] (assoc state :safe-listen-count (inc (:safe-listen-count state 0))))))
(defn make [screen atlas global-atlas]
(rooms/make :music {:day :town-2 :night :night}
:name "Behind house"
(rooms/make :name "Behind house"
:interactions
{:left-dir-1 (make-left-dir [0 48 20 240])
:left-dir-2 (make-left-dir [0 160 148 217])

View File

@@ -202,7 +202,7 @@
(let [throw-walkie (utils/make-anim-seq atlas "throw-walkie" [205 136] 0.1 (flatten [(repeat 55 0) (range 9) (repeat 55 8)]))
walkie-visible (animation 1.0 [(utils/atlas->texture atlas "throw-walkie" 8)])
walkie-invisible (animation 1.0 [(utils/atlas->texture atlas "throw-walkie" 0)])]
(rooms/make :music {:day :town-2 :night :night}
(rooms/make
:name "Castle gate"
:timers {:taunt [1.0 6.0 flip-coin]}
:interactions {:right-dir {:box [280 40 320 83]

View File

@@ -267,8 +267,7 @@
owl-puke (utils/make-anim atlas "owl" [21 30] 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])
owl-eye (utils/make-anim-seq atlas "eye" [44 48] 0.10 [0 0 1 1 2 2 2 2 2 2 2 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 3 4 4 4 3 4 4 4 5 6 7 8 9 9 9 9 9 9 9 9 9 10 11 12 12 11 10 9 9 9 9 9 9 9 9 10 11 12 12 12 11 10 9 9 9 9 9 8 7 6 5])
puke (particle-effect "particles/puke")]
(rooms/make :music {:day :town-2 :night :night}
:name "Tree"
(rooms/make :name "Tree"
:sounds {:cat (utils/load-sound "cat-tree/cat.ogg")
:kiss (utils/load-sound "cat-tree/kiss.ogg")}
:ladder ladder-entity

View File

@@ -371,7 +371,7 @@
(let [fairy-godfather-anim (utils/make-anim atlas "fairy-godfather" [63 77] 0.15 [0 1 2 3 2 1 0 1 4 3 2 1])
fairy-godfather-talk-anim (utils/make-anim atlas "fairy-godfather" [63 77] 0.15 [5 6 7 8 7 6])
fairy-godfather-magic-anim (utils/make-anim atlas "fairy-godfather-magic" [100 77] 0.15 [0 1 2 3 4 4 4 4 3 2 1 0])]
(rooms/make :music {:intro :wind :day :dream}
(rooms/make
:name "Dream"
:interactions {:pit {:box [54 0 219 36]
:label "Pit of destiny"

View File

@@ -46,7 +46,7 @@
frankie-fall (utils/make-anim-seq atlas "frankie-fall" [40 35] 0.1 (flatten [(range 8) (repeat 20 7) 8 9 10 11 7]))
frankie-down (utils/make-anim-seq atlas "frankie-fall" [40 35] 0.1 [0])
scaler (utils/scaler-fn-with-baseline 20 1.3 1.30)]
(rooms/make :music :dream
(rooms/make
:sounds {:cloud (utils/load-sound "ending-castle/cloud.ogg")}
:name "Ending"
:interactions {}

View File

@@ -60,8 +60,7 @@
(defn make [screen atlas global-atlas]
(let [bloodclot-talk (utils/make-anim-seq atlas "bloodclot-head" [114 82] 0.1 [0 1 2 1 0 3 3 0 1 2 1 0 3 4 5 6 5 3 3 1 2 1 3 3 3 3 3 0 0 0 7 8 7])
bloodclot-stand (utils/make-anim-seq atlas "bloodclot-head" [114 82] 0.1 (flatten [(repeat 15 0) 7 8 7]))]
(rooms/make :music :fight
:name "Held"
(rooms/make :name "Held"
:interactions {:bloodclot {:box [182 42 270 196]
:label "Bloodclot"
:cursor :talk

View File

@@ -224,7 +224,7 @@
:shopkeep "Don't get any fast ideas."
:shopkeep "That teddy bear does not leave my store."
:shopkeep "My son would be stricken with grief to find it missing."))))]
(rooms/make :music :inside-antique
(rooms/make
:name "Antique shop"
:sounds {:fire-1 (utils/load-sound "inside-antique/fire-1.ogg")
:fire-2 (utils/load-sound "inside-antique/fire-2.ogg")

View File

@@ -198,8 +198,7 @@
(pace [0 0 0 0 2 1 1 2 2 1 1 2 2 2 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3] 0)]))
hands-fight-lose (utils/make-anim-seq atlas "fight-new-assets/fight" [256 192] 0.1 (flatten [4 4 4 4 4 4 0 0 0 0 4 4 4 0 0 0 5 5 5 6 6 6 6 6 6]))]
(rooms/make :music :town-1
:name "Cafeteria"
(rooms/make :name "Cafeteria"
:interactions
{:right-dir {:box [272 45 320 120]
:only-script (actions/get-script

View File

@@ -380,8 +380,7 @@
monocle (utils/make-anim atlas "monocle" [19 19] 0.05 (flatten [(repeat 70 0) 1 2 3 3 3 2 1]))
door (utils/make-anim atlas "door" [21 49] 0.15 (flatten [(range 4) 3 3 3 3 3 3 3]))
]
(rooms/make :music {:day :town-1 :night :night :sunrise :night}
:name "Inside castle"
(rooms/make :name "Inside castle"
:timers {:brian [10.0 7.0 brian]}
:interactions
{:right-door {:box [286 140 306 160]

View File

@@ -138,7 +138,7 @@
candle (utils/make-anim atlas "candle" [34 32] 0.2 [1 0 1 2])
candle-aura (utils/make-anim atlas "candle-aura" [27 27] 0.2 [0 1 2 3 2 1] )
experiment-left (utils/flip (utils/make-anim-seq global-atlas "wizard/experiment" [45 55] 0.075 [0 0 0 0 0 0 0 0 0 0 1 1 2 2 2 2 3 3 3 4 4 5 5 6 6 6 6 6 6 7 8 9 9 10 10 11 11 12 12 12 12 12 12 12 12 12 12 12 13 13 14 14 14 14 14 15 15 16 16 17 17 18 18 18 18 19 20 21 21 21 21 21 21 22 23 22 23 22 23 22 23 23 23 23 23 23 23 23 24 24 24 24 24 24 24 24 24 25 26 27 37 38 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 29 29 29 28 28 28 28 29 29 28 28 28 28 28 28 28 28 30 30 30 30 31 32 33 31 31 31 31 31 31 31 31 34 35 36 36 36 36 36 36 36 36 36] ))]
(rooms/make :music :inside-fangald
(rooms/make
:name "Inside house"
:interactions {:down-dir {:box [151 0 320 40]
:only-script (actions/get-script entities

View File

@@ -230,8 +230,7 @@
candle (utils/make-anim atlas "candle" [20 25] 0.1 (range 4))
candle-aura (utils/make-anim atlas "candle-aura" [27 27] 0.2 [0 1 2 3 2 1])
crowbar (utils/make-anim atlas "crowbar" [16 33] 0.15 (flatten [(repeat 120 0) [1 2 3 3 2 1]]))]
(rooms/make :music :inside-antique
:name "In jail"
(rooms/make :name "In jail"
:sounds {
:squeek (utils/load-sound "inside-jail/squeak.ogg")
:crowbar-sound (utils/load-sound "ego/crowbar.ogg")

View File

@@ -60,7 +60,7 @@
candle-flame (utils/make-anim atlas "candle" [4 4] 0.1 (range 4))
candle-aura (utils/make-anim atlas "candle-aura" [27 27] 0.2 [0 1 2 3 2 1] )
]
(rooms/make :music {:day :secret-hideout :night :secret-hideout}
(rooms/make
:name "Inside stash"
:interactions
{:left-dir {:box [91 60 125 140]

View File

@@ -341,8 +341,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 atlas "flies" [21 21] 0.075 (flatten (repeat 2 [0 1 2 1])))]
(rooms/make :music {:day :town-2 :night :night :sunrise :night}
:name "Outside castle"
(rooms/make :name "Outside castle"
:interactions
{:right-dir {:box [280 40 320 140]
:only-script (actions/get-script

View File

@@ -623,8 +623,7 @@
lamb-stand (aget lamb-walk-sheet 0 0)
lamb-walk (animation 0.075 (for [i (range 4)]
(aget lamb-walk-sheet 0 i)))]
(rooms/make :music {:day :town-2 :night :night}
:name "Outside house"
(rooms/make :name "Outside house"
:update-fn jump-around
:cauldron-sound {:object nil :sound (utils/load-sound "outsidehouse/cauldron.ogg")}
:interactions

View File

@@ -103,7 +103,7 @@
close-stash (utils/make-anim atlas "open-stash" [58 41] 0.075 (range 5))
candle-flame (utils/make-anim atlas "candle" [20 25] 0.075 (range 4))
candle-aura (utils/make-anim atlas "candle-aura2" [135 135] 0.3 [0 1 2 1] )]
(rooms/make :music {:day :town-1 :night :night}
(rooms/make
:name "Fountain"
:interactions {:down-dir {:box [30 0 227 40]
:only-script (actions/get-script entities

View File

@@ -195,8 +195,7 @@
blowup-effect (particle-effect "particles/blowup")
lightning-effect (particle-effect "particles/lightning")
grow-explode (particle-effect "particles/grow-explode")]
(rooms/make :music :fight
:name "Duel"
(rooms/make :name "Duel"
:sounds {:shock (utils/load-sound "space/shock.ogg")
:shock-short (utils/load-sound "space/shock-short.ogg")
:jump (utils/load-sound "space/jump.ogg")

View File

@@ -897,7 +897,7 @@
(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-music (get-in entities [:musics (actions/get-music (get-in entities [:room :music]) (get-in entities [:state :time]))]))
(utils/play-music (get-in entities [:musics (actions/get-music (get-in entities [:room-musics (doto (get-in entities [:state :last-room]) println)]) (get-in entities [:state :time]))]))
(-> entities
(assoc
:tweens {:fade-in (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 1.0 :ease tween/ease-in-cubic
@@ -1223,7 +1223,24 @@
:castle-gate (wrap rooms.castle-gate/make "packed/castle-gate.atlas")
:outside-jail (wrap rooms.outside-jail/make "packed/outside-jail.atlas")
:outside-castle (wrap rooms.outside-castle/make "packed/outside-castle.atlas") }
entities {:rooms rooms
:room-musics {:inside-house :inside-fangald
:inside-stash {:day :secret-hideout :night :secret-hideout}
:outside-house {:day :town-2 :night :night :sunrise :night}
:behind-house {:day :town-2 :night :night :sunrise :night}
:cat-tree {:day :town-2 :night :night :sunrise :night}
:inside-castle {:day :town-1 :night :night :sunrise :night}
:space :fight
:held :fight
:inside-cafeteria {:day :town-1 :night :night :sunrise :night}
:inside-antique :inside-antique
:inside-jail :inside-antique
:dream {:intro :wind :day :dream}
:ending :dream
:castle-gate {:day :town-2 :night :night}
:outside-jail {:day :town-1 :night :night :sunrise :night}
:outside-castle {:day :town-2 :night :night} }
:step-particles (assoc (particle-effect "particles/step") :x 100 :y 100 :baseline 241)
:cam {:zoom utils/min-zoom
:ideal-x 160

View File

@@ -497,8 +497,8 @@
(let [time (get-in entities [:state :time])
musics (:musics entities)
override-music (musics (get-in entities [:music-override :value]))
current-music (musics (get-in entities [:room :music]))
current-time-music (musics (get-in entities [:room :music time]))]
current-music (musics (get-in entities [:room-musics (get-in entities [:state :last-room])]))
current-time-music (musics (get-in entities [:room-musics (get-in entities [:state :last-room]) time]))]
(or override-music current-music current-time-music)))