lots of tweaks.

This commit is contained in:
Bryce Covert
2015-10-10 11:04:44 -07:00
parent 2feaf36c87
commit 5981c1d303
37 changed files with 1452 additions and 1024 deletions

View File

@@ -68,7 +68,10 @@
(defn snapshot-state [entities name]
(doto (.getPreferences (Gdx/app) "ticks-tales-saves")
(.putString (saves/saves name) (pr-str (entities :state)))
(.putString "snapshot-list" (pr-str (filter (complement #{"Autosave"} ) (cons (saves/saves name) (snapshot-list)))))
(.putString "snapshot-list" (pr-str (filter (complement #{"Autosave"})
(cons (saves/saves name)
(filter (complement #{(saves/saves name)})
(snapshot-list))))))
.flush))
(defn save [entities]
@@ -257,7 +260,8 @@
(defn load-sound [f]
(try
(sound f)
(catch Exception _
(catch Exception e
(println e)
(sound (str f ".mp3")))))
@@ -405,13 +409,16 @@
(defn sourced-volume-fn [target vol-scale [x y]]
(fn [entities]
(* (if (= target :ego)
(-> (* (/ (get-in entities [:room :entities :ego :scale-x]) 1.5) 0.75)
(* (or vol-scale 1.0))
(clamp-volume))
(proximity-volume entities [x y] :scale vol-scale))
(- 1.0 (get-in entities [:fade :opacity])))))
(if (= target :ego)
(-> (* (/ (get-in entities [:room :entities :ego :scale-x]) 1.5) 0.75)
(* (or vol-scale 1.0))
(clamp-volume))
(proximity-volume entities [x y] :scale vol-scale))
))
(defn scale-vol-from-fade [entities vol]
(* vol
(- 1.0 (get-in entities [:fade :opacity]))))
(defn play-sound!
([screen entities snd volume-fn]
@@ -423,8 +430,8 @@
([screen entities snd volume-fn pan type]
(let [vol (volume-fn entities)
sound-id (if (= :once type)
(sound! snd :play (current-sound-volume vol) 1.0 pan)
(sound! snd :loop (current-sound-volume vol) 1.0 pan)) ]
(sound! snd :play (scale-vol-from-fade entities (current-sound-volume vol)) 1.0 pan)
(sound! snd :loop (scale-vol-from-fade entities (current-sound-volume vol)) 1.0 pan)) ]
(update-in entities [:current-sounds :value]
conj {:id sound-id
:sound snd