Commit before pushing more input events into update

This commit is contained in:
2022-10-29 22:33:10 +01:00
parent afaef480db
commit e3155752ba
36 changed files with 121 additions and 147 deletions
+9 -8
View File
@@ -64,14 +64,19 @@ import Sound.Data
import StrictHelp
updateUniverse :: Universe -> Universe
updateUniverse = updateUniverseLast . updateUniverseFirst
updateUniverse u = updateUniverseLast . updateUniverseMid
. over uvWorld (updateCamera cfig)
. over (uvWorld . cWorld . cClock) ( + 1)
$ updateBounds u -- where should this go? next to update camera?
where
cfig = u ^. uvConfig
updateUniverseLast :: Universe -> Universe
updateUniverseLast = over uvWorld (input . mouseButtons . each .~ True) -- to determine if the mouse button is held
{- For most menus the only way to change the world is using event handling. -}
updateUniverseFirst :: Universe -> Universe
updateUniverseFirst u
updateUniverseMid :: Universe -> Universe
updateUniverseMid u
| concurrentblocking = u
| otherwise = case _uvScreenLayers u of
(OptionScreen{_scOptionFlag = GameOverOptions} : _) ->
@@ -156,7 +161,6 @@ functionalUpdate w =
. over uvWorld updateDistortions
. over uvWorld updateCreatureSoundPositions
. over uvWorld ppEvents
. over uvWorld (updateCamera cfig)
. colCrsWalls
. over uvWorld simpleCrSprings
. over uvWorld zoneCreatures
@@ -197,12 +201,9 @@ functionalUpdate w =
. over uvWorld updateSeenWalls
. over uvWorld updateTerminal
. over uvWorld updateRBList
. updateBounds -- where should this go? next to update camera?
. over uvWorld updateCloseObjects
. over uvWorld updateWheelEvents
$ over uvWorld updatePastWorlds w
where
cfig = _uvConfig w
updateWheelEvents :: World -> World
updateWheelEvents w = foldr ($) w (replicate (abs y) (updateWheelEvent (signum y)))
@@ -249,7 +250,7 @@ zoneClouds w =
foldl' (flip zoneCloud) zn (w ^. cWorld . lWorld . clouds)
updateWorldSelect' :: World -> World
updateWorldSelect' w = over input (updateWorldSelect (w ^. cWorld . lWorld . camPos)) w
updateWorldSelect' w = over input (updateWorldSelect (w ^. cWorld . camPos)) w
updateWorldSelect :: CamPos -> Input -> Input
updateWorldSelect cam inp = f . g $ case (inp ^? mouseButtons . ix ButtonLeft, inp ^? mouseButtons . ix ButtonRight) of