I believe this fixes the freezes.
This commit is contained in:
@@ -19,17 +19,10 @@
|
|||||||
+ putting out the candle in jail
|
+ putting out the candle in jail
|
||||||
+ lighting the hay on fire in jail
|
+ lighting the hay on fire in jail
|
||||||
+ mark the squeaky board a bit
|
+ 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
|
" wit's end" typo
|
||||||
+ gang dude should pop the georgia dream
|
+ gang dude should pop the georgia dream
|
||||||
+ you can drink the strength potion while in blood clots hand
|
+ you can drink the strength potion while in blood clots hand
|
||||||
+ try to have dialogue for every wrong interaction
|
+ 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
|
+ Items on yourself should glow just like other places
|
||||||
|
|
||||||
+ When you have an item and you click somewhere on the screen that
|
+ When you have an item and you click somewhere on the screen that
|
||||||
|
|||||||
@@ -74,22 +74,31 @@
|
|||||||
(terminate [this screen entities]
|
(terminate [this screen entities]
|
||||||
entities)
|
entities)
|
||||||
(skip-type [this screen entities]
|
(skip-type [this screen entities]
|
||||||
:skip)))
|
:none-but-arrow)))
|
||||||
|
|
||||||
(defmacro get-script [entities & forms]
|
(defmacro get-script [entities & forms]
|
||||||
`(fn [starting-entities#]
|
`(fn [starting-entities#]
|
||||||
(let [~entities (atom starting-entities#)]
|
(put! (get-in starting-entities# [:actions :script-chan])
|
||||||
(thread (do (change-script-state ~entities true)
|
(fn [starting-entities#]
|
||||||
~@forms
|
(let [~entities (atom starting-entities#)]
|
||||||
(change-script-state ~entities false)
|
(thread (do
|
||||||
(utils/save @~entities))))))
|
(try
|
||||||
|
~@forms
|
||||||
|
(finally
|
||||||
|
(change-script-state ~entities false)
|
||||||
|
(utils/save @~entities)
|
||||||
|
)))))))))
|
||||||
|
|
||||||
(defmacro get-unsaved-script [entities & forms]
|
(defmacro get-unsaved-script [entities & forms]
|
||||||
`(fn [starting-entities#]
|
`(fn [starting-entities#]
|
||||||
(let [~entities (atom starting-entities#)]
|
(put! (get-in starting-entities# [:actions :script-chan])
|
||||||
(thread (change-script-state ~entities true)
|
(fn [starting-entities#]
|
||||||
~@forms
|
(let [~entities (atom starting-entities#)]
|
||||||
(change-script-state ~entities false)))))
|
(thread (do
|
||||||
|
(try
|
||||||
|
~@forms
|
||||||
|
(finally
|
||||||
|
(change-script-state ~entities false))))))))))
|
||||||
|
|
||||||
(defn bound-to-camera [x length zoom]
|
(defn bound-to-camera [x length zoom]
|
||||||
(min (- length (* length 0.5 zoom ))
|
(min (- length (* length 0.5 zoom ))
|
||||||
|
|||||||
@@ -164,9 +164,8 @@
|
|||||||
(actions/has-item? entities :motivational-tapes) (do
|
(actions/has-item? entities :motivational-tapes) (do
|
||||||
(actions/remove-item entities :motivational-tapes)
|
(actions/remove-item entities :motivational-tapes)
|
||||||
(actions/do-dialogue entities
|
(actions/do-dialogue entities
|
||||||
:frankie "And how about that? Some used earplugs."
|
:frankie "And how about that? Some motivational tapes"
|
||||||
:frankie "Wow! These are the choicest of earplugs!"
|
:frankie "Wow! These are the choicest of motivational tapes!"
|
||||||
:frankie "They're great for tuning out your voice, Dipstick!"
|
|
||||||
:frankie "But, I could fetch some real good dough for them."
|
:frankie "But, I could fetch some real good dough for them."
|
||||||
:frankie "What would you say boys? ")
|
:frankie "What would you say boys? ")
|
||||||
(actions/play-animation entities :frankie :glance)
|
(actions/play-animation entities :frankie :glance)
|
||||||
|
|||||||
@@ -626,9 +626,11 @@
|
|||||||
(actions/talk entities :ego "I guess her wool is shedding.")
|
(actions/talk entities :ego "I guess her wool is shedding.")
|
||||||
(leave-sheep entities))
|
(leave-sheep entities))
|
||||||
(do
|
(do
|
||||||
|
(walk-to-sheep entities)
|
||||||
(actions/talk entities :ego "Come here mama sheep!")
|
(actions/talk entities :ego "Come here mama sheep!")
|
||||||
(actions/play-animation entities :ego :sigh)
|
(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 = %
|
:scripts #(condp = %
|
||||||
:wool (actions/get-script entities
|
:wool (actions/get-script entities
|
||||||
(actions/talk entities :ego "She doesn't need it back."))
|
(actions/talk entities :ego "She doesn't need it back."))
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
[advent.screens.rooms.cat-tree :as rooms.cat-tree]
|
[advent.screens.rooms.cat-tree :as rooms.cat-tree]
|
||||||
[advent.screens.dialogue :refer [talking-screen]]
|
[advent.screens.dialogue :refer [talking-screen]]
|
||||||
[advent.screens.inventory :refer [inventory-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]
|
(:import [com.badlogic.gdx.graphics Pixmap Pixmap$Filter Texture Texture$TextureFilter GL20 GL30]
|
||||||
[com.badlogic.gdx.graphics.g2d TextureRegion Animation Batch]
|
[com.badlogic.gdx.graphics.g2d TextureRegion Animation Batch]
|
||||||
[com.badlogic.gdx.math Vector3 Matrix4]
|
[com.badlogic.gdx.math Vector3 Matrix4]
|
||||||
@@ -232,6 +232,7 @@ void main()
|
|||||||
|
|
||||||
(= :end (actions/skip-type current-action screen entities))
|
(= :end (actions/skip-type current-action screen entities))
|
||||||
(let [terminated-entities (actions/terminate 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)
|
(do (put! (actions/get-channel current-action) :end)
|
||||||
(-> terminated-entities
|
(-> terminated-entities
|
||||||
(assoc-in [:actions :script-running?] false)
|
(assoc-in [:actions :script-running?] false)
|
||||||
@@ -647,7 +648,18 @@ void main()
|
|||||||
(merge (animation->texture screen (:stand (:right ego))) ego)
|
(merge (animation->texture screen (:stand (:right ego))) ego)
|
||||||
:stand)))
|
: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
|
(if current
|
||||||
(let [entities (if started? entities (actions/begin current screen entities))
|
(let [entities (if started? entities (actions/begin current screen entities))
|
||||||
entities (actions/continue current screen entities)]
|
entities (actions/continue current screen entities)]
|
||||||
@@ -655,10 +667,10 @@ void main()
|
|||||||
(let [terminated (actions/terminate current screen entities)]
|
(let [terminated (actions/terminate current screen entities)]
|
||||||
(put! (actions/get-channel current) terminated)
|
(put! (actions/get-channel current) terminated)
|
||||||
(recur screen (assoc 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)))
|
(assoc-in entities [:actions :started?] true)))
|
||||||
(let [[current _] (alts!! [channel] :default nil)]
|
(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)
|
(actions/skip-type current screen entities)
|
||||||
(get-in entities [:actions :last-skip-type]))}))))
|
(get-in entities [:actions :last-skip-type]))}))))
|
||||||
|
|
||||||
@@ -898,7 +910,8 @@ void main()
|
|||||||
:channel (chan)
|
:channel (chan)
|
||||||
:current nil
|
:current nil
|
||||||
:script-running? false
|
:script-running? false
|
||||||
:started? false}
|
:started? false
|
||||||
|
:script-chan (chan (dropping-buffer 1))}
|
||||||
:volume {:object nil
|
:volume {:object nil
|
||||||
:value 0.0}
|
:value 0.0}
|
||||||
:music-override {:object nil
|
:music-override {:object nil
|
||||||
@@ -930,7 +943,6 @@ void main()
|
|||||||
|
|
||||||
:on-render
|
:on-render
|
||||||
(fn [{:keys [camera] :as screen} [entities]]
|
(fn [{:keys [camera] :as screen} [entities]]
|
||||||
|
|
||||||
(if (get-in entities [:closing? :value])
|
(if (get-in entities [:closing? :value])
|
||||||
|
|
||||||
(let [entities (utils/apply-tweens screen entities (:tweens entities))
|
(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)
|
(let [entities (fade-in-first-time-if-necessary screen entities)
|
||||||
entities (utils/apply-tweens screen entities (:tweens entities))
|
entities (utils/apply-tweens screen entities (:tweens entities))
|
||||||
entities (update-cursor screen entities)
|
entities (update-cursor screen entities)
|
||||||
|
entities (start-script-if-necessary screen entities)
|
||||||
entities (update-from-script screen entities)
|
entities (update-from-script screen entities)
|
||||||
entities (update-from-room screen entities)
|
entities (update-from-room screen entities)
|
||||||
entities (update-from-hotspots 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]]
|
:on-touch-up (fn [{:keys [input-x input-y viewport] :as screen} [entities]]
|
||||||
(when (utils/contains-point? (.getScreenX viewport) (.getScreenY viewport)
|
(when (utils/contains-point? (.getScreenX viewport) (.getScreenY viewport)
|
||||||
(.getScreenWidth viewport) (.getScreenHeight viewport)
|
(.getScreenWidth viewport) (.getScreenHeight viewport)
|
||||||
input-x input-y)
|
input-x input-y)
|
||||||
(if (= (button-code :right)
|
(if (= (button-code :right)
|
||||||
(:button screen))
|
(:button screen))
|
||||||
(assoc-in entities [:cursor :current] :main)
|
(assoc-in entities [:cursor :current] :main)
|
||||||
|
|||||||
Reference in New Issue
Block a user