more perf enhancements, getting ready for multi save slots.

This commit is contained in:
Bryce Covert
2015-09-16 13:29:39 -07:00
parent 3de4943f67
commit 260d411336
11 changed files with 35 additions and 29 deletions

View File

@@ -337,7 +337,8 @@
:ego "What's this?")
(actions/give entities :kiss)
(actions/do-dialogue entities :ego "A kiss for an inventory item?"
:ego "Sounds like the game designer was running out of good ideas."))
:ego "Sounds like the game designer was running out of good ideas.")
(utils/snapshot-state @entities "The Cat Whisperer"))
(actions/talk entities :ego "I guess I'm too far away.")))
:default (actions/get-script entities (actions/talk entities :ego "Kitty seems disinterested in it."))})
cat-stand)

View File

@@ -240,6 +240,7 @@
:fairy-godfather "Choose the broom or shovel, and cast it into the pit of fate."
:ego "But..."
:fairy-godfather "No buts.")
(utils/snapshot-state @entities "Our tale's beginning")
(actions/update-state entities #(assoc % :seen-intro? true)))
(defn swing [entities]

View File

@@ -80,7 +80,8 @@
:warriors "Congratulations young master. Thou art worthy in might."
:warriors "Take thy servant's medal of strength.")
(actions/give entities :medal)
(actions/glad entities))
(actions/glad entities)
(utils/snapshot-state @entities "Pro (arm) Wrestler"))
(do
(play-battle entities :lose)
(actions/do-dialogue entities

View File

@@ -575,7 +575,8 @@
(actions/give entities :trophy)
(actions/remove-entity entities :trophy)
(actions/glad entities)
(actions/talk entities :ego "Thanks!"))
(actions/talk entities :ego "Thanks!")
(utils/snapshot-state @entities "The Wise Guy"))
(actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking."))
(brian-get-to-work entities))
:trophy (actions/get-script entities

View File

@@ -191,10 +191,12 @@
(actions/talk entities :ego "I probably shouldn't leave without my belongings.")
(do (actions/transition-background entities :outside-jail [50 46] :face :right)
(if (get-in @entities [:state :dropped-ball?])
(actions/do-dialogue entities :ego "Yes I made it!"
:ego "But what now?"
:ego "I have till sunrise before Bloodclot comes and destroys the town."
:ego "Maybe Gandarf can help me!")
(do
(actions/do-dialogue entities :ego "Yes I made it!"
:ego "But what now?"
:ego "I have till sunrise before Bloodclot comes and destroys the town."
:ego "Maybe Gandarf can help me!")
(utils/snapshot-state @entities "Prisoner On The Loose"))
(do
(actions/do-dialogue entities :ego "Yes I made it!"
:guard "Hmm?"

View File

@@ -269,7 +269,8 @@
:bloodclot-head "Starting with his precious Georgia McGorgeous.")
(bloodclot-disappear entities)
(common/go-to-jail entities 5.0)
(actions/do-dialogue entities :ego "Hey!" :ego "What's going on? I was just about to teach Bloodclot a lesson!"))))
(actions/do-dialogue entities :ego "Hey!" :ego "What's going on? I was just about to teach Bloodclot a lesson!")
(utils/snapshot-state @entities "In The Slammer"))))
:magic-slingshot (actions/get-script entities
(actions/do-dialogue entities
:ego "Hey Bloodclot!"

View File

@@ -55,21 +55,29 @@
atlas (texture-atlas "packed/pack.atlas")]
(texture (texture-atlas! atlas :find-region atlas-name))))
(defn save [entities]
(defn snapshot-state [entities name]
(doto (.getPreferences (Gdx/app) "ticks-tales-saves")
(.putString "save-1" (pr-str (entities :state)))
(.putString name (pr-str (entities :state)))
.flush))
(defn save [entities]
(snapshot-state entities "Autosave"))
(defn has-save? []
(-> (.getPreferences (Gdx/app) "ticks-tales-saves")
(.contains "save-1")))
(.contains "Autosave")))
(defn load []
(defn load-snapshot [name]
(-> (.getPreferences (Gdx/app) "ticks-tales-saves")
(.getString "save-1")
(.getString name)
edn/read-string
(assoc :active? true)))
(defn load []
(load-snapshot "Autosave"))
(defn save-settings [entities]
(doto (.getPreferences (Gdx/app) "ticks-tales-saves")
(.putString "settings" (pr-str @settings))