Allow for time rewind with floating camera
This commit is contained in:
+1
-1
@@ -9,4 +9,4 @@ useNormalCamera = (uvWorld . wCam . camControl .~ CamInGame)
|
|||||||
|
|
||||||
pauseAndFloatCam :: Universe -> Universe
|
pauseAndFloatCam :: Universe -> Universe
|
||||||
pauseAndFloatCam = (uvWorld . wCam . camControl .~ CamFloat)
|
pauseAndFloatCam = (uvWorld . wCam . camControl .~ CamFloat)
|
||||||
. (uvWorld . timeFlow .~ CameraScrollTimeFlow 0 0 [])
|
. (uvWorld . timeFlow .~ CameraScrollTimeFlow 0 200 [])
|
||||||
|
|||||||
+11
-7
@@ -143,7 +143,6 @@ updateUniverseMid u = case _uvScreenLayers u of
|
|||||||
|
|
||||||
timeFlowUpdate :: Universe -> Universe
|
timeFlowUpdate :: Universe -> Universe
|
||||||
timeFlowUpdate u = case u ^. uvWorld . timeFlow of
|
timeFlowUpdate u = case u ^. uvWorld . timeFlow of
|
||||||
-- _ | debugcamera -> u
|
|
||||||
NormalTimeFlow -> functionalUpdate u
|
NormalTimeFlow -> functionalUpdate u
|
||||||
ItemScrollTimeFlow smoothing _ _ _ -> over uvWorld (doItemTimeScroll smoothing) u
|
ItemScrollTimeFlow smoothing _ _ _ -> over uvWorld (doItemTimeScroll smoothing) u
|
||||||
CameraScrollTimeFlow smoothing _ _ -> over uvWorld (doTimeScroll 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 . futureWorlds .:~ (w ^. cWorld . lWorld)
|
||||||
& timeFlow . reverseAmount -~ 1
|
& timeFlow . reverseAmount -~ 1
|
||||||
& cWorld . lWorld .~ lw
|
& cWorld . lWorld .~ lw
|
||||||
& pointituse . leftConsumption . wpCharge .~ (x -1)
|
& mupdateitem x
|
||||||
& pointituse . leftHammer .~ HammerDown
|
|
||||||
_ -> w
|
_ -> w
|
||||||
where
|
where
|
||||||
pointituse = pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix i) . itUse
|
mupdateitem x = fromMaybe id $ do
|
||||||
i = w ^?! timeFlow . scrollItemLocation
|
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 :: World -> World
|
||||||
scrollTimeForward w = case w ^? timeFlow . futureWorlds . _head of
|
scrollTimeForward w = case w ^? timeFlow . futureWorlds . _head of
|
||||||
@@ -201,10 +202,13 @@ scrollTimeForward w = case w ^? timeFlow . futureWorlds . _head of
|
|||||||
& pastWorlds .:~ (w ^. cWorld . lWorld)
|
& pastWorlds .:~ (w ^. cWorld . lWorld)
|
||||||
& cWorld . lWorld .~ lw
|
& cWorld . lWorld .~ lw
|
||||||
& timeFlow . reverseAmount .~ ramount
|
& timeFlow . reverseAmount .~ ramount
|
||||||
& pointerToItemLocation (w ^?! cWorld . lWorld . itemLocations . ix i) . itUse . leftConsumption . wpCharge .~ ramount
|
& mupdateitem
|
||||||
where
|
where
|
||||||
i = w ^?! timeFlow . scrollItemLocation
|
|
||||||
ramount = (w ^?! timeFlow . reverseAmount) + 1
|
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.
|
-- | The update step.
|
||||||
functionalUpdate :: Universe -> Universe
|
functionalUpdate :: Universe -> Universe
|
||||||
|
|||||||
Reference in New Issue
Block a user