many many bug fixes.
This commit is contained in:
@@ -36,9 +36,9 @@
|
||||
:down-time (:total-time screen))))
|
||||
|
||||
(defn mouse-outside-inventory? [[x y]]
|
||||
(or (< x 80)
|
||||
(> x 1200)
|
||||
(< y 80)
|
||||
(or (< x 140)
|
||||
(> x 1140)
|
||||
(< y 320)
|
||||
(> y 880)))
|
||||
|
||||
(defn mouse-drag [screen {:keys [selected-item] :as entities} options]
|
||||
@@ -51,8 +51,8 @@
|
||||
|
||||
selected-item
|
||||
(-> entities
|
||||
(assoc-in [:items selected-item :x] (- x 32))
|
||||
(assoc-in [:items selected-item :y] (- y 32))
|
||||
(assoc-in [:items selected-item :x] x)
|
||||
(assoc-in [:items selected-item :y] y)
|
||||
(assoc :dragged? true)
|
||||
(assoc :hovered-item (:item hovered-entity)))
|
||||
:else
|
||||
@@ -172,20 +172,23 @@
|
||||
base-y (* 180 4)
|
||||
item-width (* utils/ui-scale 4 18)
|
||||
padding (/ item-width 4)
|
||||
item-height (* utils/ui-scale 4 16)
|
||||
padding-height (/ item-height 4)
|
||||
x (+ base-x (* column (+ padding item-width)))
|
||||
y (- base-y (* row (+ padding item-width)))
|
||||
offset-x (+ x (/ item-width 2))
|
||||
offset-y (+ y (/ item-width 2))
|
||||
padded-size (/ (+ item-width padding padding) 2)
|
||||
padded-width (/ (+ item-width padding padding) 2)
|
||||
padded-height (/ (+ item-height padding-height padding-height) 2)
|
||||
#_#_padding (* 4 padding)]]
|
||||
[item (assoc (texture (aget (:all-items entities) 0 (.indexOf utils/+all-cursors+ (:cursor item))))
|
||||
:x (+ x (/ padding 2)) :y (+ y (/ padding 2))
|
||||
:x (+ x (/ padding 2)) :y y
|
||||
:scale-x (* utils/ui-scale 4)
|
||||
:scale-y (* utils/ui-scale 4)
|
||||
:origin-x 9
|
||||
:origin-y 8
|
||||
:item item
|
||||
:box (zone/box (- x padded-size) (- y padded-size) (+ x padded-size) (+ y (/ item-width 2))))])))
|
||||
:box (zone/box (- x padded-width) (- y padded-height) (+ x padded-width) (+ y padded-height)))])))
|
||||
(assoc-in [:tweens :fade-in] (tween/tween :fade-in screen [:opacity] 0.0 1.0 0.2 :ease tween/ease-out-cubic)))))
|
||||
|
||||
:on-mouse-moved mouse-move
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
(assoc (animation->texture screen coin-flip)
|
||||
:x 212 :y 114 :baseline 151
|
||||
:opacity 0.0
|
||||
:label "Coin"
|
||||
:cursor :hand
|
||||
:origin-x 5
|
||||
:origin-y 5
|
||||
:night-profile :none
|
||||
@@ -42,6 +44,8 @@
|
||||
(let [stand (utils/make-anim "castle-gate/goon-1.png" [13 33] 0.21 [0 0 0 0 0 0 0 0 0 1])]
|
||||
(assoc (animation->texture screen stand)
|
||||
:x 244 :y 102 :baseline 138
|
||||
:label "Goon"
|
||||
:cursor :talk
|
||||
:scale-x 1.4
|
||||
:scale-y 1.4
|
||||
:night-profile :sprite
|
||||
@@ -61,6 +65,8 @@
|
||||
:scale-y 1.4
|
||||
:origin-x 6
|
||||
:origin-y 0
|
||||
:label "Bubba"
|
||||
:cursor :talk
|
||||
:anim stand
|
||||
:talk talk
|
||||
:flip flip
|
||||
@@ -127,6 +133,7 @@
|
||||
(actions/walk-to entities :ego [245 90] :skip-type :end))
|
||||
|
||||
(defn flip-coin [screen entities]
|
||||
(println "here")
|
||||
(if (and (= 0 (rand-int 2))
|
||||
(not (get-in entities [:state :has-dropped-coin?]))
|
||||
(not (get-in entities [:state :bubba-gone?]))
|
||||
@@ -182,6 +189,8 @@
|
||||
|
||||
(defn make-note []
|
||||
{:box [97 102 111 132]
|
||||
:label "Note"
|
||||
:cursor :look
|
||||
:script (actions/get-script entities
|
||||
(look-at-note entities))
|
||||
:scripts {:charcoal (actions/get-script entities
|
||||
@@ -207,6 +216,8 @@
|
||||
:cursor :left}
|
||||
|
||||
:window {:box [192 157 215 215]
|
||||
:label "Window"
|
||||
:cursor :look
|
||||
:script (actions/get-script entities
|
||||
(actions/talk entities :ego "That's a big window!"))
|
||||
:scripts {:walkie-talkies (actions/get-script entities
|
||||
@@ -260,8 +271,7 @@
|
||||
|
||||
(if (and (not (actions/has-obtained? entities :money))
|
||||
(get-in entities [:state :has-dropped-coin?]))
|
||||
(do
|
||||
(update-in entities [:room :entities :coin-flip] assoc :x 185 :y 44 :opacity 1.0))
|
||||
(do (update-in entities [:room :entities :coin-flip] assoc :x 185 :y 44 :opacity 1.0))
|
||||
entities)
|
||||
(if (actions/has-obtained? entities :money)
|
||||
(update-in entities [:room :entities] dissoc :coin-flip)
|
||||
|
||||
@@ -304,6 +304,8 @@
|
||||
flex (utils/make-anim "castle-gate/frankie.png" [24 35] 0.2 [0 10 11 12 12 12 12 11 10])]
|
||||
(assoc (animation->texture screen stand)
|
||||
:x 235 :y 90 :baseline 150
|
||||
:label "Frankie Rockfist"
|
||||
:cursor :talk
|
||||
:origin-x 12
|
||||
:origin-y 0
|
||||
:anim stand
|
||||
@@ -457,7 +459,9 @@
|
||||
:bloodclot-head "Give it here!")
|
||||
(actions/transition-background entities :space [200 45] :between (fn [s e]
|
||||
(-> e
|
||||
|
||||
(assoc-in [:room :entities :ego :stand-override] :crawl-stand)
|
||||
(assoc-in [:room :entities :ego :previous-frame-index] -1)
|
||||
(update-in [:room :entities :ego] #(actions/start-animation s % :crawl-stand)))
|
||||
))
|
||||
(actions/do-dialogue entities
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
(assoc-in [:room :current-layers 6 :opacity] opacity)
|
||||
(assoc-in [:room :current-layers 7 :opacity] opacity)
|
||||
(assoc-in [:room :current-layers 8 :opacity] opacity)
|
||||
(assoc-in [:room :entities :fairy-godfather :label] (if (> opacity 0.0) "Fairy Godfather" nil))
|
||||
(assoc-in [:room :entities :fairy-godfather :cursor] (if (> opacity 0.0) :talk nil))
|
||||
(assoc-in [:room :entities :sword :opacity] tool-opacity)
|
||||
(assoc-in [:room :entities :case :opacity] tool-opacity)
|
||||
(assoc-in [:room :entities :broom :opacity] tool-opacity)
|
||||
@@ -584,7 +586,7 @@
|
||||
(utils/fast-forward-particle (get-in entities [:room :entities :outside-particles]))
|
||||
|
||||
(as-> entities entities
|
||||
(if (get-in entities [:state :seen-intro?])
|
||||
(if (get-in entities [:state :seen-intro?])
|
||||
(set-opacity entities 1.0 1.0)
|
||||
(set-opacity entities 0.0 0.0))
|
||||
(if (actions/has-item? entities :broom)
|
||||
|
||||
@@ -1100,6 +1100,7 @@ void main ()
|
||||
(.setUniformf shader "hue_amount" (float (or hue-amount 1.0))))
|
||||
|
||||
(.setColor batch (color (:r e 1.0) (:g e 1.0) (:b e 1.0) (:opacity e 1.0)))
|
||||
|
||||
|
||||
|
||||
(entities/draw! (assoc e :x (+ (/ ^double (:x e) (.zoom camera))
|
||||
@@ -1111,14 +1112,15 @@ void main ()
|
||||
(.setColor batch (color 1 1 1 1))
|
||||
(.set (.combined camera) original-combined))))
|
||||
|
||||
(def nighttime-times #{:night :sunrise})
|
||||
(def nighttime-times #{:night :dawn})
|
||||
(defn get-rendered [entities {:keys [time ^double y ^double offset-y night-profile] :or {night-profile :default} :as e}]
|
||||
(as-> e e
|
||||
(if (and (not= time (-> entities :state :time))
|
||||
(nighttime-times (-> entities :state :time)))
|
||||
(-> e
|
||||
(merge (-> entities :time-profiles night-profile))
|
||||
(assoc :time (-> entities :state :time)))
|
||||
(if (or (get-in entities [:tweens :dawn-r])
|
||||
(and (not= time (-> entities :state :time))
|
||||
(nighttime-times (-> entities :state :time))))
|
||||
(-> e
|
||||
(merge (-> entities :time-profiles night-profile))
|
||||
(assoc :time (-> entities :state :time)))
|
||||
e)
|
||||
#_(if offset-y
|
||||
(assoc e :y (+ y offset-y))
|
||||
@@ -1131,7 +1133,8 @@ void main ()
|
||||
(defn grab-layers [entities]
|
||||
(update-in entities [:room]
|
||||
(fn [{:keys [layers current-layers] :as room}]
|
||||
(cond current-layers
|
||||
(cond (and current-layers
|
||||
(not (get-in entities [:tweens :dawn-r])))
|
||||
room
|
||||
|
||||
(map? layers)
|
||||
@@ -1173,7 +1176,7 @@ void main ()
|
||||
(defscreen scene
|
||||
:on-timer
|
||||
(fn [screen entities options]
|
||||
(when-let [timer-fn (get-in entities [:room :timers (:id screen) 2])]
|
||||
(when-let [timer-fn (get-in entities [:room :timers (:id options) 2])]
|
||||
(timer-fn screen entities)))
|
||||
|
||||
:on-show
|
||||
@@ -1407,7 +1410,7 @@ void main ()
|
||||
entities))
|
||||
entities (grab-layers entities)
|
||||
layers (get-in entities [:room :current-layers])
|
||||
all-entities (concat layers (vals (get-in entities [:room :entities])))]
|
||||
all-entities (concat layers (vals (get-in entities [:room :entities])) [(:white-fade entities)])]
|
||||
(screen! fade-screen :update-fade {:opacity (get-in entities [:fade :opacity])})
|
||||
(doseq [m (vals (get-in entities [:musics]))]
|
||||
(when m
|
||||
@@ -1471,7 +1474,7 @@ void main ()
|
||||
rest)
|
||||
(assoc-in entities [:room :entities] (persistent! room))))
|
||||
layers (get-in entities [:room :current-layers])
|
||||
all-entities (concat layers (vals (get-in entities [:room :entities])))]
|
||||
all-entities (concat layers (vals (get-in entities [:room :entities])) [(:white-fade entities)])]
|
||||
|
||||
(screen! tooltip-screen :on-hover-start {:hover-text (get-in entities [:label :text])
|
||||
:scene-viewport (:viewport screen)
|
||||
|
||||
Reference in New Issue
Block a user