getting closer to everything workinng in mobile-friendly way.
This commit is contained in:
@@ -269,6 +269,7 @@
|
||||
(get-in @entities [:room :entities :ego :drop-sound])
|
||||
0.2)
|
||||
(actions/update-state entities #(assoc % :dropped-ball? true))
|
||||
(actions/remove-item entities :ball-n-chain)
|
||||
(actions/do-dialogue entities :ego "Geronimo!!")
|
||||
(actions/play-sound entities
|
||||
"inside-jail/guard-crash.ogg"
|
||||
@@ -285,7 +286,7 @@
|
||||
(Thread/sleep 300)
|
||||
(actions/play-animation entities :warden :fall-asleep :stop? false)
|
||||
(actions/begin-animation entities :warden :sleep)
|
||||
(actions/remove-item entities :ball-n-chain)
|
||||
|
||||
(actions/talk entities :ego "Phew! That was close!"))
|
||||
(actions/do-dialogue entities :ego "I don't know what to do with that.")))
|
||||
:sword (actions/get-script entities (actions/talk entities :ego "I wouldn't want to accidentally break the Sword of Blergh."))
|
||||
|
||||
@@ -182,17 +182,6 @@ void main ()
|
||||
|
||||
|
||||
|
||||
(defn click-inventory [screen entities]
|
||||
(when (not (get-in entities [:fg-actions :script-running?]))
|
||||
(if (= (get-in entities [:cursor :current] ) :main)
|
||||
(do
|
||||
(screen! inventory-screen :show-screen :items (map (entities :all-items) (get-in entities [:state :inventory])))
|
||||
(-> entities
|
||||
(assoc-in [:state :active?] false)
|
||||
(assoc-in [:cursor :override] nil)))
|
||||
(assoc-in entities [:cursor :current] :main))))
|
||||
|
||||
|
||||
|
||||
(defn skip-action [screen entities]
|
||||
(let [current-action (get-in entities [:fg-actions :current])]
|
||||
@@ -211,6 +200,23 @@ void main ()
|
||||
:else
|
||||
entities)))
|
||||
|
||||
(defn click-inventory [screen entities]
|
||||
(if (get-in entities [:fg-actions :script-running?])
|
||||
(skip-action screen entities)
|
||||
(assoc-in entities [:state :active?] false)))
|
||||
|
||||
(defn open-inventory [screen entities]
|
||||
(when (not (get-in entities [:fg-actions :script-running?]))
|
||||
(if (= (get-in entities [:cursor :current] ) :main)
|
||||
(do
|
||||
(screen! inventory-screen :show-screen :items (map (entities :all-items) (get-in entities [:state :inventory])))
|
||||
(-> entities
|
||||
(assoc-in [:state :active?] false)
|
||||
(assoc-in [:cursor :override] nil)))
|
||||
(assoc-in entities [:cursor :current] :main))))
|
||||
|
||||
|
||||
|
||||
(defn get-interaction [entities x y]
|
||||
(first (filter #((:mouse-in? %) entities x y)
|
||||
(get-in entities [:room :interactions]))) )
|
||||
@@ -1356,7 +1362,8 @@ void main ()
|
||||
(do
|
||||
(screen! hud :on-return-item))
|
||||
(when (and (get-in entities [:state :active?])
|
||||
(not (get-in entities [:state :hud-active?]))
|
||||
(or (not (get-in entities [:state :hud-active?]))
|
||||
(get-in entities [:fg-actions :script-running?]))
|
||||
(= 0.0 (get-in entities [:fade :opacity])))
|
||||
(left-click screen entities)))))
|
||||
|
||||
@@ -1380,6 +1387,9 @@ void main ()
|
||||
(screen! hud :on-chose-item :item item)
|
||||
(assoc-in entities [:cursor :current] item))
|
||||
|
||||
:on-open-inventory (fn [screen [entities]]
|
||||
(open-inventory screen entities))
|
||||
|
||||
:on-click-inventory (fn [screen [entities]]
|
||||
(click-inventory screen entities))
|
||||
:on-save (fn [screen [entities]]
|
||||
@@ -1535,7 +1545,7 @@ void main ()
|
||||
|
||||
(reify ITransition
|
||||
(start-transition [this screen entities]
|
||||
(screen! scene :on-click-inventory)
|
||||
(screen! scene :on-open-inventory)
|
||||
entities)
|
||||
(transition-done? [this screen entities]
|
||||
true))]))
|
||||
@@ -1713,7 +1723,7 @@ void main ()
|
||||
|
||||
next-state
|
||||
(-> (transition-hud screen entities next-state next-state-data)
|
||||
(assoc-in [:inv-fsm :pending-states] (doto (vec pending-states) println)))
|
||||
(assoc-in [:inv-fsm :pending-states] (vec pending-states)))
|
||||
|
||||
:else
|
||||
nil))
|
||||
@@ -1811,7 +1821,7 @@ void main ()
|
||||
(update-in [:inv-fsm] (fn [{:keys [state state-data] :as fsm}]
|
||||
(if (and (= state :selected) (= item state-data))
|
||||
(update-in fsm [:pending-states] conj [:none state-data])
|
||||
(update-in fsm [:pending-states] conj [state state-data])))))
|
||||
(update-in fsm [:pending-states] conj [:none state-data])))))
|
||||
(#(println (get-in % [:inv-fsm :pending-states])))))
|
||||
|
||||
:on-remove-item
|
||||
@@ -1901,9 +1911,12 @@ void main ()
|
||||
|
||||
((:mouse-in? (:inventory entities)) x y)
|
||||
|
||||
(if (:selected-item entities)
|
||||
(transition-hud screen entities :none (get-in entities [:inv-fsm :state-data]))
|
||||
(transition-hud screen entities :open nil))
|
||||
(if (= :selected (get-in entities [:inv-fsm :state]))
|
||||
(update-in entities [:inv-fsm :pending-states] conj [:none (get-in entities [:inv-fsm :state-data])])
|
||||
|
||||
(do
|
||||
(screen! scene :on-deactivate)
|
||||
(update-in entities [:inv-fsm :pending-states] conj [:open nil])))
|
||||
|
||||
(utils/intersects? (:close entities) [x y])
|
||||
(screen! scene :on-menu)
|
||||
|
||||
Reference in New Issue
Block a user