Tweak pause camera movement

This commit is contained in:
2023-04-25 10:23:43 +01:00
parent a2ad7c23ff
commit 734d74af52
31 changed files with 97 additions and 114 deletions
+8 -9
View File
@@ -143,15 +143,14 @@ updateUniverseMid u = case _uvScreenLayers u of
timeFlowUpdate :: Universe -> Universe
timeFlowUpdate u = case u ^. uvWorld . timeFlow of
_ | debugcamera -> u
-- _ | debugcamera -> u
NormalTimeFlow -> functionalUpdate u
ScrollTimeFlow smoothing _ _ _ -> over uvWorld (doTimeScroll smoothing) u
ItemScrollTimeFlow smoothing _ _ _ -> over uvWorld (doItemTimeScroll smoothing) u
CameraScrollTimeFlow smoothing _ _ -> over uvWorld (doTimeScroll smoothing) u
RewindLeftClick 0 _ -> u & uvWorld . timeFlow .~ NormalTimeFlow
RewindLeftClick _ _ -> over uvWorld scrollTimeBack u -- & uvWorld . cWorld . timeFlow .~ NormalTimeFlow
DeathTime{} -> u
PausedTimeFlow _ itmloc -> over uvWorld (pauseTime itmloc) u
where
debugcamera = CamInGame /= (u ^. uvWorld . wCam . camControl)
pauseTime :: Int -> World -> World
pauseTime itmloc w
@@ -162,13 +161,13 @@ pauseTime itmloc w
outofcharge = maybe True (== 0) charge
charge = w ^? pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix itmloc) . itUse . leftConsumption . wpCharge
doTimeScroll :: Int -> World -> World
doTimeScroll smoothing w = case w ^? input . mouseButtons . ix ButtonLeft of
doItemTimeScroll :: Int -> World -> World
doItemTimeScroll smoothing w = case w ^? input . mouseButtons . ix ButtonLeft of
Just 1 -> w & timeFlow .~ NormalTimeFlow
_ -> doTimeScroll' smoothing w
_ -> doTimeScroll smoothing w
doTimeScroll' :: Int -> World -> World
doTimeScroll' smoothing w = case w ^. input . scrollAmount of
doTimeScroll :: Int -> World -> World
doTimeScroll smoothing w = case w ^. input . scrollAmount of
x | x > 1 -> w & scrollTimeBack & timeFlow . scrollSmoothing .~ 20
x | x > 0 -> w & scrollTimeBack & timeFlow . scrollSmoothing %~ max 0
x | x < (-1) -> w & scrollTimeForward & timeFlow . scrollSmoothing .~ negate 20