Move bullet trajectory into bullet update function

This commit is contained in:
2022-07-17 10:31:34 +01:00
parent c9f7f39f22
commit 7d6407bebc
15 changed files with 159 additions and 121 deletions
+3 -2
View File
@@ -5,6 +5,7 @@ Description : Simulation update
-}
module Dodge.Update ( updateUniverse ) where
import Dodge.Data
import Dodge.Bullet
import Dodge.Update.Cloud
import Dodge.Machine.Update
import Dodge.RadarBlip
@@ -217,7 +218,7 @@ updateFlares = flares %~ mapMaybe updateFlare
updateBullets :: World -> World
updateBullets w = updateInstantBullets $ set bullets (catMaybes ps) w'
where
(w',ps) = mapAccumR (\a b -> _buUpdate b a b) w $ _bullets w
(w',ps) = mapAccumR (\a b -> updateBullet a b) w $ _bullets w
{- Apply internal particle updates, delete 'Nothing's. -}
updateParticles :: World -> World
@@ -297,7 +298,7 @@ intersectSegSegs' _ _ _ = 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
ps -> let (w',ps') = mapAccumR (\a b -> updateBullet a b) (w {_instantBullets=[]}) ps
in updateInstantBullets $ w' & bullets .++~ catMaybes ps'
updateInstantParticles :: World -> World