Partially working scroll time item
This commit is contained in:
+17
-6
@@ -62,9 +62,15 @@ import SDL
|
|||||||
import Sound.Data
|
import Sound.Data
|
||||||
import StrictHelp
|
import StrictHelp
|
||||||
|
|
||||||
{- For most menus the only way to change the world is using event handling. -}
|
|
||||||
updateUniverse :: Universe -> Universe
|
updateUniverse :: Universe -> Universe
|
||||||
updateUniverse u
|
updateUniverse = updateUniverseLast . updateUniverseFirst
|
||||||
|
|
||||||
|
updateUniverseLast :: Universe -> Universe
|
||||||
|
updateUniverseLast = over uvWorld (mouseButtons . each .~ True) -- to determine if the mouse button is held
|
||||||
|
|
||||||
|
{- For most menus the only way to change the world is using event handling. -}
|
||||||
|
updateUniverseFirst :: Universe -> Universe
|
||||||
|
updateUniverseFirst u
|
||||||
| concurrentblocking = u
|
| concurrentblocking = u
|
||||||
| otherwise = case _uvScreenLayers u of
|
| otherwise = case _uvScreenLayers u of
|
||||||
(OptionScreen{_scOptionFlag = GameOverOptions} : _) ->
|
(OptionScreen{_scOptionFlag = GameOverOptions} : _) ->
|
||||||
@@ -93,7 +99,12 @@ functionalUpdate' u = case u ^. uvWorld . timeFlow of
|
|||||||
_ -> u
|
_ -> u
|
||||||
|
|
||||||
doTimeScroll :: Int -> World -> World
|
doTimeScroll :: Int -> World -> World
|
||||||
doTimeScroll smoothing w = case w ^. scrollAmount of
|
doTimeScroll smoothing w = case w ^? mouseButtons . ix ButtonLeft of
|
||||||
|
Just False -> w & timeFlow .~ NormalTimeFlow
|
||||||
|
_ -> doTimeScroll' smoothing w
|
||||||
|
|
||||||
|
doTimeScroll' :: Int -> World -> World
|
||||||
|
doTimeScroll' smoothing w = case w ^. scrollAmount of
|
||||||
x | x > 1 -> w & scrollTimeBack & timeFlow . scrollSmoothing .~ 20
|
x | x > 1 -> w & scrollTimeBack & timeFlow . scrollSmoothing .~ 20
|
||||||
x | x > 0 -> w & scrollTimeBack & timeFlow . scrollSmoothing %~ max 0
|
x | x > 0 -> w & scrollTimeBack & timeFlow . scrollSmoothing %~ max 0
|
||||||
x | x < (-1) -> w & scrollTimeForward & timeFlow . scrollSmoothing .~ negate 20
|
x | x < (-1) -> w & scrollTimeForward & timeFlow . scrollSmoothing .~ negate 20
|
||||||
@@ -123,17 +134,17 @@ scrollTimeForward w = case w ^? timeFlow . futureWorlds . _head of
|
|||||||
w & timeFlow . futureWorlds %~ tail
|
w & timeFlow . futureWorlds %~ tail
|
||||||
& cwTime . pastWorlds .:~ _cWorld w
|
& cwTime . pastWorlds .:~ _cWorld w
|
||||||
& cWorld .~ cw
|
& cWorld .~ cw
|
||||||
& timeFlow . reverseAmount +~ 1
|
& timeFlow . reverseAmount .~ ramount
|
||||||
& pointerToItemLocation (w ^?! cWorld . itemLocations . ix i) . itUse . leftConsumption . wpCharge +~ 1
|
& pointerToItemLocation (w ^?! cWorld . itemLocations . ix i) . itUse . leftConsumption . wpCharge .~ ramount
|
||||||
where
|
where
|
||||||
i = w ^?! timeFlow . scrollItemLocation
|
i = w ^?! timeFlow . scrollItemLocation
|
||||||
|
ramount = (w ^?! timeFlow . reverseAmount) + 1
|
||||||
|
|
||||||
-- | The update step.
|
-- | The update step.
|
||||||
functionalUpdate :: Universe -> Universe
|
functionalUpdate :: Universe -> Universe
|
||||||
functionalUpdate w =
|
functionalUpdate w =
|
||||||
checkEndGame
|
checkEndGame
|
||||||
-- . updateRandGen
|
-- . updateRandGen
|
||||||
. over uvWorld (mouseButtons . each .~ True) -- to determine if the mouse button is held
|
|
||||||
. over uvWorld (cwTime . worldClock +~ 1)
|
. over uvWorld (cwTime . worldClock +~ 1)
|
||||||
. over uvWorld updateWorldSelect
|
. over uvWorld updateWorldSelect
|
||||||
-- . over uvWorld doRewind
|
-- . over uvWorld doRewind
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ pressedMBEffectsNoInventory :: M.Map MouseButton Bool -> World -> World
|
|||||||
pressedMBEffectsNoInventory pkeys w
|
pressedMBEffectsNoInventory pkeys w
|
||||||
| isDown ButtonLeft && isDown ButtonRight && inTopInv =
|
| isDown ButtonLeft && isDown ButtonRight && inTopInv =
|
||||||
useItem (you w) w & hammers . ix DoubleMouseHam .~ HammerDown
|
useItem (you w) w & hammers . ix DoubleMouseHam .~ HammerDown
|
||||||
| isDown ButtonLeft && inTopInv
|
| justPressedDown ButtonLeft && inTopInv
|
||||||
&& w ^?! hammers . ix DoubleMouseHam == HammerUp =
|
&& w ^?! hammers . ix DoubleMouseHam == HammerUp =
|
||||||
useLeftItem (_yourID (_cWorld w)) w
|
useLeftItem (_yourID (_cWorld w)) w
|
||||||
| isDown ButtonLeft && inTopInv =
|
| isDown ButtonLeft && inTopInv =
|
||||||
@@ -68,6 +68,7 @@ pressedMBEffectsNoInventory pkeys w
|
|||||||
inTopInv = case _hudElement (_hud (_cWorld w)) of
|
inTopInv = case _hudElement (_hud (_cWorld w)) of
|
||||||
DisplayInventory NoSubInventory -> True
|
DisplayInventory NoSubInventory -> True
|
||||||
_ -> False
|
_ -> False
|
||||||
|
justPressedDown but = (pkeys ^. at but) == Just False
|
||||||
isDown but = but `M.member` pkeys
|
isDown but = but `M.member` pkeys
|
||||||
rotation = angleBetween (_mousePos w) (_clickMousePos w)
|
rotation = angleBetween (_mousePos w) (_clickMousePos w)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user