diff --git a/desktop/gametodos.txt b/desktop/gametodos.txt index 0aa7ab82..3027938c 100644 --- a/desktop/gametodos.txt +++ b/desktop/gametodos.txt @@ -19,17 +19,10 @@ + putting out the candle in jail + lighting the hay on fire in jail + mark the squeaky board a bit -+ some nattering noise while talking would be good -+ Didn't have the earplugs, I had the tapes, thief talked about the ear plugs " wit's end" typo + gang dude should pop the georgia dream + you can drink the strength potion while in blood clots hand + try to have dialogue for every wrong interaction - - Sometimes I end up clicking places kind of expecting to go there, - but you have to click on the path. One example is going to see the - sheep. I'd like to click in the sheep pasture and expect Tick to - move over to the sheep, but currently it's not on the path, so he - just doesn't move. + Items on yourself should glow just like other places + When you have an item and you click somewhere on the screen that diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index 5046a311..8b840454 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -74,22 +74,31 @@ (terminate [this screen entities] entities) (skip-type [this screen entities] - :skip))) + :none-but-arrow))) (defmacro get-script [entities & forms] `(fn [starting-entities#] - (let [~entities (atom starting-entities#)] - (thread (do (change-script-state ~entities true) - ~@forms - (change-script-state ~entities false) - (utils/save @~entities)))))) + (put! (get-in starting-entities# [:actions :script-chan]) + (fn [starting-entities#] + (let [~entities (atom starting-entities#)] + (thread (do + (try + ~@forms + (finally + (change-script-state ~entities false) + (utils/save @~entities) + ))))))))) (defmacro get-unsaved-script [entities & forms] `(fn [starting-entities#] - (let [~entities (atom starting-entities#)] - (thread (change-script-state ~entities true) - ~@forms - (change-script-state ~entities false))))) + (put! (get-in starting-entities# [:actions :script-chan]) + (fn [starting-entities#] + (let [~entities (atom starting-entities#)] + (thread (do + (try + ~@forms + (finally + (change-script-state ~entities false)))))))))) (defn bound-to-camera [x length zoom] (min (- length (* length 0.5 zoom )) diff --git a/desktop/src-common/advent/screens/rooms/outside_castle.clj b/desktop/src-common/advent/screens/rooms/outside_castle.clj index 6044edd9..b467d84a 100644 --- a/desktop/src-common/advent/screens/rooms/outside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/outside_castle.clj @@ -164,9 +164,8 @@ (actions/has-item? entities :motivational-tapes) (do (actions/remove-item entities :motivational-tapes) (actions/do-dialogue entities - :frankie "And how about that? Some used earplugs." - :frankie "Wow! These are the choicest of earplugs!" - :frankie "They're great for tuning out your voice, Dipstick!" + :frankie "And how about that? Some motivational tapes" + :frankie "Wow! These are the choicest of motivational tapes!" :frankie "But, I could fetch some real good dough for them." :frankie "What would you say boys? ") (actions/play-animation entities :frankie :glance) diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index dfdc605e..fd290176 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -626,9 +626,11 @@ (actions/talk entities :ego "I guess her wool is shedding.") (leave-sheep entities)) (do + (walk-to-sheep entities) (actions/talk entities :ego "Come here mama sheep!") (actions/play-animation entities :ego :sigh) - (actions/talk entities :ego "She's too far away for me to pet her."))))) + (actions/talk entities :ego "She's too far away for me to pet her.") + (leave-sheep entities))))) :scripts #(condp = % :wool (actions/get-script entities (actions/talk entities :ego "She doesn't need it back.")) diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index 2bd0f5a5..7bf24d95 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -35,7 +35,7 @@ [advent.screens.rooms.cat-tree :as rooms.cat-tree] [advent.screens.dialogue :refer [talking-screen]] [advent.screens.inventory :refer [inventory-screen]] - [clojure.core.async :refer [put! ! chan go thread take! alts!!]]) + [clojure.core.async :refer [put! ! chan go thread take! alts!! dropping-buffer]]) (:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter GL20 GL30] [com.badlogic.gdx.graphics.g2d TextureRegion Animation Batch] [com.badlogic.gdx.math Vector3 Matrix4] @@ -232,6 +232,7 @@ void main() (= :end (actions/skip-type current-action screen entities)) (let [terminated-entities (actions/terminate current-action screen entities)] + (println "trying to end") (do (put! (actions/get-channel current-action) :end) (-> terminated-entities (assoc-in [:actions :script-running?] false) @@ -647,7 +648,18 @@ void main() (merge (animation->texture screen (:stand (:right ego))) ego) :stand))) -(defn update-from-script [screen {{:keys [current started? channel]} :actions :as entities}] +(defn start-script-if-necessary [screen {{:keys [script-running? script-chan]} :actions :as entities}] + (if script-running? + entities + (let [[next-script] (alts!! [script-chan] :default nil)] + (if next-script + (do + (next-script entities) + (println "starting script") + (assoc-in entities [:actions :script-running?] true)) + entities)))) + +(defn update-from-script [screen {{:keys [current started? channel script-chan]} :actions :as entities}] (if current (let [entities (if started? entities (actions/begin current screen entities)) entities (actions/continue current screen entities)] @@ -655,10 +667,10 @@ void main() (let [terminated (actions/terminate current screen entities)] (put! (actions/get-channel current) terminated) (recur screen (assoc terminated - :actions {:channel channel :current nil :started? false :script-running? (get-in entities [:actions :script-running?]) :last-skip-type (get-in entities [:actions :last-skip-type])}))) + :actions {:channel channel :script-chan (get-in entities [:actions :script-chan]) :current nil :started? false :script-running? (get-in entities [:actions :script-running?]) :last-skip-type (get-in entities [:actions :last-skip-type])}))) (assoc-in entities [:actions :started?] true))) (let [[current _] (alts!! [channel] :default nil)] - (assoc entities :actions {:channel channel :current current :started? false :script-running? (get-in entities [:actions :script-running?]) :last-skip-type (if current + (assoc entities :actions {:script-chan (get-in entities [:actions :script-chan]) :channel channel :current current :started? false :script-running? (get-in entities [:actions :script-running?]) :last-skip-type (if current (actions/skip-type current screen entities) (get-in entities [:actions :last-skip-type]))})))) @@ -898,7 +910,8 @@ void main() :channel (chan) :current nil :script-running? false - :started? false} + :started? false + :script-chan (chan (dropping-buffer 1))} :volume {:object nil :value 0.0} :music-override {:object nil @@ -930,7 +943,6 @@ void main() :on-render (fn [{:keys [camera] :as screen} [entities]] - (if (get-in entities [:closing? :value]) (let [entities (utils/apply-tweens screen entities (:tweens entities)) @@ -944,6 +956,7 @@ void main() (let [entities (fade-in-first-time-if-necessary screen entities) entities (utils/apply-tweens screen entities (:tweens entities)) entities (update-cursor screen entities) + entities (start-script-if-necessary screen entities) entities (update-from-script screen entities) entities (update-from-room screen entities) entities (update-from-hotspots screen entities) @@ -1025,8 +1038,8 @@ void main() :on-touch-up (fn [{:keys [input-x input-y viewport] :as screen} [entities]] (when (utils/contains-point? (.getScreenX viewport) (.getScreenY viewport) - (.getScreenWidth viewport) (.getScreenHeight viewport) - input-x input-y) + (.getScreenWidth viewport) (.getScreenHeight viewport) + input-x input-y) (if (= (button-code :right) (:button screen)) (assoc-in entities [:cursor :current] :main)