Move configuration from world to universe

This commit is contained in:
2021-11-28 22:30:47 +00:00
parent 45ba120796
commit 8c5777a1af
29 changed files with 343 additions and 300 deletions
+9 -11
View File
@@ -3,8 +3,7 @@ Module : Dodge.Update
Description : Simulation update
-}
module Dodge.Update
(update
,updateUniverse
( updateUniverse
) where
import Dodge.Data
import Dodge.Hammer
@@ -31,7 +30,7 @@ import System.Random
updateUniverse :: Universe -> Universe
updateUniverse w = case _menuLayers w of
(TerminalScreen t xs:mls) -> w & menuLayers .~ (TerminalScreen (max (t-1) 0) xs:mls)
-- (TerminalScreen t xs:mls) -> w & menuLayers .~ (TerminalScreen (max (t-1) 0) xs:mls)
(WaitScreen s i : _)
| i < 1 -> w & over uvWorld (dbArg _worldEvents)
| otherwise -> w & menuLayers %~ ( (WaitScreen s (i-1) :) . tail )
@@ -42,19 +41,18 @@ updateUniverse w = case _menuLayers w of
-- $ updateClouds
w
(_ : _) -> w
[] -> over uvWorld update w
[] -> over uvWorld (functionalUpdate (_config w)) w
update :: World -> World
update = (frameClock +~ 1) . functionalUpdate
{- | The update step.
For most menus the only way to change the world is using event handling. -}
functionalUpdate :: World -> World
functionalUpdate w = checkEndGame
functionalUpdate :: Configuration -> World -> World
functionalUpdate cfig w = checkEndGame
. (worldClock +~ 1)
. updateDistortions
. updateCreatureSoundPositions
. ppEvents
. updateCamera
. colCrsWalls
. ppEvents
. updateCamera cfig
. colCrsWalls cfig
-- . ifConfigWallRotate
. simpleCrSprings
. zoneCreatures