Allow for time rewind with floating camera

This commit is contained in:
2023-04-25 15:45:45 +01:00
parent 734d74af52
commit d217fe7375
2 changed files with 12 additions and 8 deletions
+1 -1
View File
@@ -9,4 +9,4 @@ useNormalCamera = (uvWorld . wCam . camControl .~ CamInGame)
pauseAndFloatCam :: Universe -> Universe
pauseAndFloatCam = (uvWorld . wCam . camControl .~ CamFloat)
. (uvWorld . timeFlow .~ CameraScrollTimeFlow 0 0 [])
. (uvWorld . timeFlow .~ CameraScrollTimeFlow 0 200 [])
+11 -7
View File
@@ -143,7 +143,6 @@ updateUniverseMid u = case _uvScreenLayers u of
timeFlowUpdate :: Universe -> Universe
timeFlowUpdate u = case u ^. uvWorld . timeFlow of
-- _ | debugcamera -> u
NormalTimeFlow -> functionalUpdate u
ItemScrollTimeFlow smoothing _ _ _ -> over uvWorld (doItemTimeScroll smoothing) u
CameraScrollTimeFlow smoothing _ _ -> over uvWorld (doTimeScroll smoothing) u
@@ -186,12 +185,14 @@ scrollTimeBack w = case w ^? pastWorlds . _head of
& timeFlow . futureWorlds .:~ (w ^. cWorld . lWorld)
& timeFlow . reverseAmount -~ 1
& cWorld . lWorld .~ lw
& pointituse . leftConsumption . wpCharge .~ (x -1)
& pointituse . leftHammer .~ HammerDown
& mupdateitem x
_ -> w
where
pointituse = pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix i) . itUse
i = w ^?! timeFlow . scrollItemLocation
mupdateitem x = fromMaybe id $ do
i <- w ^? timeFlow . scrollItemLocation
let pointituse = pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix i) . itUse
return $ (pointituse . leftConsumption . wpCharge .~ (x -1))
. ( pointituse . leftHammer .~ HammerDown)
scrollTimeForward :: World -> World
scrollTimeForward w = case w ^? timeFlow . futureWorlds . _head of
@@ -201,10 +202,13 @@ scrollTimeForward w = case w ^? timeFlow . futureWorlds . _head of
& pastWorlds .:~ (w ^. cWorld . lWorld)
& cWorld . lWorld .~ lw
& timeFlow . reverseAmount .~ ramount
& pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix i) . itUse . leftConsumption . wpCharge .~ ramount
& mupdateitem
where
i = w ^?! timeFlow . scrollItemLocation
ramount = (w ^?! timeFlow . reverseAmount) + 1
mupdateitem = fromMaybe id $ do
i <- w ^? timeFlow . scrollItemLocation
return $ pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix i) . itUse . leftConsumption . wpCharge .~ ramount
-- | The update step.
functionalUpdate :: Universe -> Universe