Move bullets into own data type
This commit is contained in:
@@ -81,6 +81,7 @@ functionalUpdate cfig w = checkEndGame
|
||||
. dbArg _worldEvents
|
||||
. updateIMl _modifications _mdUpdate
|
||||
. updateParticles
|
||||
. updateBullets
|
||||
. updateRadarBlips
|
||||
. updateFlares
|
||||
. updateBeams
|
||||
@@ -212,6 +213,12 @@ updateRadarBlips = radarBlips %~ mapMaybe updateRadarBlip
|
||||
updateFlares :: World -> World
|
||||
updateFlares = flares %~ mapMaybe updateFlare
|
||||
|
||||
{- Apply internal particle updates, delete 'Nothing's. -}
|
||||
updateBullets :: World -> World
|
||||
updateBullets w = updateInstantBullets $ set bullets (catMaybes ps) w'
|
||||
where
|
||||
(w',ps) = mapAccumR (\a b -> _buUpdate b a b) w $ _bullets w
|
||||
|
||||
{- Apply internal particle updates, delete 'Nothing's. -}
|
||||
updateParticles :: World -> World
|
||||
updateParticles w = updateInstantParticles $ set particles (catMaybes ps) w'
|
||||
@@ -287,6 +294,11 @@ intersectSegSegs' _ _ _ = Nothing
|
||||
-- Just
|
||||
-- (intersectSegSegss x y ass)
|
||||
--intersectSegsSegss _ _ = Nothing
|
||||
updateInstantBullets :: World -> World
|
||||
updateInstantBullets w = case _instantBullets w of
|
||||
[] -> w
|
||||
ps -> let (w',ps') = mapAccumR (\a b -> _buUpdate b a b) (w {_instantBullets=[]}) ps
|
||||
in updateInstantBullets $ w' & bullets .++~ catMaybes ps'
|
||||
|
||||
updateInstantParticles :: World -> World
|
||||
updateInstantParticles w = case _instantParticles w of
|
||||
|
||||
Reference in New Issue
Block a user