reworked dialogue

This commit is contained in:
2015-02-18 08:29:52 -08:00
parent 352bfb9238
commit c7591dd3f2
4 changed files with 107 additions and 71 deletions

View File

@@ -482,7 +482,9 @@
(nil? (get-in entities [:tweens :fade-out-music])))
(terminate [this screen entities]
(music! (utils/get-current-music entities) :stop)
(doseq [m (-> entities :musics vals)
:when m]
(music! m :stop))
(let [entities (-> entities
(assoc-in [:music-override :value] new-music)
(assoc-in [:volume :value] 1.0))]
@@ -494,10 +496,11 @@
false))))
(defn transition-background [entities new-background [x y]]
(let [old-music (get-music (get-in @entities [:room :music]) (get-in @entities [:state :time]))
(defn transition-background [entities new-background [x y] & {:keys [transition-music?]}]
(let [transition-music? (if (nil? transition-music?) true transition-music?)
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)]
music-changed? (and transition-music? (not= old-music new-music))]
(run-action entities
(begin [this screen entities]
(doseq [[k] (get-in entities [:room :timers])]
@@ -543,11 +546,11 @@
(apply-state entities)
entities)
entities (utils/update-override entities)]
(when (not= new-music old-music)
(when (and (not= new-music old-music) transition-music?)
(doseq [[k v] (:musics entities)
:when (and v (not= new-music k))]
(music! v :stop))
(when new-music
(when (and new-music transition-music?)
(music! (get-in entities [:musics new-music]) :set-volume 0)
(music! (get-in entities [:musics new-music]) :play)))
(-> entities