diff --git a/android/project.clj b/android/project.clj index 4c6814ce..ce6b9f3b 100644 --- a/android/project.clj +++ b/android/project.clj @@ -45,7 +45,7 @@ :assets-paths ["/Users/brycecovert/dev/advent/desktop/resources"] :native-libraries-paths ["libs"] - :target-version "15" + :target-version "15" ; 18+ :aot-exclude-ns ["clojure.parallel" "clojure.core.reducers" "cider.nrepl" "cider-nrepl.plugin" "cider.nrepl.middleware.util.java.parser" diff --git a/desktop/project.clj b/desktop/project.clj index ab98ded7..01b899fe 100644 --- a/desktop/project.clj +++ b/desktop/project.clj @@ -3,15 +3,7 @@ :dependencies [[com.badlogicgames.gdx/gdx "1.5.3"] [com.badlogicgames.gdx/gdx-backend-lwjgl "1.5.3"] - [com.badlogicgames.gdx/gdx-box2d "1.5.3"] - [com.badlogicgames.gdx/gdx-tools "1.5.3"] - [com.badlogicgames.gdx/gdx-box2d-platform "1.5.3" - :classifier "natives-desktop"] - [com.badlogicgames.gdx/gdx-bullet "1.5.3"] - [com.badlogicgames.gdx/gdx-bullet-platform "1.5.3" - :classifier "natives-desktop"] - [com.badlogicgames.gdx/gdx-platform "1.5.3" - :classifier "natives-desktop"] + [com.badlogicgames.gdx/gdx-platform "1.5.3" :classifier "natives-desktop"] [org.clojure/clojure "1.6.0"] [org.clojure/tools.nrepl "0.2.7"] [play-clj "0.4.5-BRYCE"] @@ -23,6 +15,7 @@ :aliases {"pack" ["run" "-m" "com.badlogic.gdx.tools.texturepacker.TexturePacker" "asset-work/" "resources/packed/"]} :profiles { :dev { + :dependencies [[com.badlogicgames.gdx/gdx-tools "1.5.3"]] :warn-on-reflection true} } :aot [advent.core.desktop-launcher] diff --git a/desktop/src-common/advent/screens/rooms/cat_tree.clj b/desktop/src-common/advent/screens/rooms/cat_tree.clj index d60e84bb..42b0ba2a 100644 --- a/desktop/src-common/advent/screens/rooms/cat_tree.clj +++ b/desktop/src-common/advent/screens/rooms/cat_tree.clj @@ -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) diff --git a/desktop/src-common/advent/screens/rooms/dream.clj b/desktop/src-common/advent/screens/rooms/dream.clj index 6688ea00..6789c334 100644 --- a/desktop/src-common/advent/screens/rooms/dream.clj +++ b/desktop/src-common/advent/screens/rooms/dream.clj @@ -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] diff --git a/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj b/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj index 4584c6cc..90ed871f 100644 --- a/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj +++ b/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj @@ -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 diff --git a/desktop/src-common/advent/screens/rooms/inside_castle.clj b/desktop/src-common/advent/screens/rooms/inside_castle.clj index 7af34496..b00173b2 100644 --- a/desktop/src-common/advent/screens/rooms/inside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/inside_castle.clj @@ -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 diff --git a/desktop/src-common/advent/screens/rooms/inside_jail.clj b/desktop/src-common/advent/screens/rooms/inside_jail.clj index 0d3458ad..5d3c0615 100644 --- a/desktop/src-common/advent/screens/rooms/inside_jail.clj +++ b/desktop/src-common/advent/screens/rooms/inside_jail.clj @@ -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?" diff --git a/desktop/src-common/advent/screens/rooms/space.clj b/desktop/src-common/advent/screens/rooms/space.clj index 86866b43..91bca196 100644 --- a/desktop/src-common/advent/screens/rooms/space.clj +++ b/desktop/src-common/advent/screens/rooms/space.clj @@ -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!" diff --git a/desktop/src-common/advent/utils.clj b/desktop/src-common/advent/utils.clj index de1e3caa..a46ebb60 100644 --- a/desktop/src-common/advent/utils.clj +++ b/desktop/src-common/advent/utils.clj @@ -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)) diff --git a/desktop/src/advent/core/desktop_launcher.clj b/desktop/src/advent/core/desktop_launcher.clj index 3723e783..962efab1 100644 --- a/desktop/src/advent/core/desktop_launcher.clj +++ b/desktop/src/advent/core/desktop_launcher.clj @@ -1,12 +1,12 @@ (ns advent.core.desktop-launcher (:require [advent.core :refer :all] - [clojure.tools.nrepl.server]) + #_[clojure.tools.nrepl.server]) (:import [com.badlogic.gdx.backends.lwjgl LwjglApplication LwjglApplicationConfiguration] [org.lwjgl.input Keyboard] [com.badlogic.gdx Gdx]) (:gen-class)) -(defmacro start-nrepl-expr [port] +#_(defmacro start-nrepl-expr [port] `(let [{port# :port} (clojure.tools.nrepl.server/start-server :port ~port)] (doseq [port-file# ["target/repl-port" ".nrepl-port"]] (-> port-file# @@ -19,7 +19,7 @@ (defn -main [& [port]] - (try + #_(try (when port (start-nrepl-expr (Integer/parseInt port))) (catch Exception e)) (let [cfg (LwjglApplicationConfiguration.)] diff --git a/ios/project.clj b/ios/project.clj index c3ae0b84..4a1f6ce7 100644 --- a/ios/project.clj +++ b/ios/project.clj @@ -2,8 +2,6 @@ :description "FIXME: write description" :dependencies [[com.badlogicgames.gdx/gdx "1.5.3"] [com.badlogicgames.gdx/gdx-backend-robovm "1.5.3"] - [com.badlogicgames.gdx/gdx-box2d "1.5.3"] - [com.badlogicgames.gdx/gdx-bullet "1.5.3"] [org.clojure/data.priority-map "0.0.5"] [org.clojure/core.async "0.1.346.0-17112a-alpha"] [org.clojure/clojure "1.6.0"] @@ -16,7 +14,7 @@ :plugins [[lein-fruit "0.2.4-SNAPSHOT"]] :javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"] :ios {:robovm-opts ["-forcelinkclasses" "advent.**:clojure.**:com.badlogic.**:play_clj.**" - "-libs" "libs/libObjectAL.a:libs/libgdx.a:libs/libgdx-box2d.a:libs/libgdx-bullet.a" + "-libs" "libs/libObjectAL.a:libs/libgdx.a" "-frameworks" "UIKit:OpenGLES:QuartzCore:CoreGraphics:OpenAL:AudioToolbox:AVFoundation" "-resources" "../desktop/resources/**" ]