Work on saving/loading concurrently

This commit is contained in:
2022-08-18 10:05:24 +01:00
parent 26e88f059a
commit c74d3b04bf
20 changed files with 232 additions and 154 deletions
+19 -16
View File
@@ -63,21 +63,24 @@ import Sound.Data
{- For most menus the only way to change the world is using event handling. -}
updateUniverse :: Universe -> Universe
updateUniverse u = (uvConcEffects .~ Nothing) $ case _menuLayers u of
(WaitScreen s i : _)
| i < 1 -> u & over uvWorld doWorldEvents
| otherwise -> u & menuLayers %~ ((WaitScreen s (i -1) :) . tail)
(OptionScreen{_scOptionFlag = GameOverOptions} : _) ->
u & uvWorld
%~ (
--updateParticles
(cWorld . radarBlips .~ [])
-- . updateIMl _props _pjUpdate
. updateLightSources
. updateClouds
)
(_ : _) -> u
[] -> functionalUpdate u
updateUniverse u
| isblocking = u
| otherwise = case _uvScreenLayers u of
(OptionScreen{_scOptionFlag = GameOverOptions} : _) ->
u & uvWorld
%~ (
--updateParticles
(cWorld . radarBlips .~ [])
-- . updateIMl _props _pjUpdate
. updateLightSources
. updateClouds
)
(_ : _) -> u
[] -> functionalUpdate u
where
isblocking = case u ^. uvConcEffects of
BlockingConcEffect{} -> True
_ -> False
-- | The update step.
functionalUpdate :: Universe -> Universe
@@ -444,7 +447,7 @@ checkEndGame :: Universe -> Universe
checkEndGame uv = case _deathDelay (_cWorld w) of
Just x
| x < 0 ->
uv & menuLayers .~ [gameOverMenu]
uv & uvScreenLayers .~ [gameOverMenu]
& uvWorld . cWorld . deathDelay .~ Nothing
Just _ -> uv & uvWorld . cWorld . deathDelay . _Just -~ 1
_ | _crHP (you w) < 1 -> uv & uvWorld . cWorld . deathDelay ?~ 50