Refactor cloud zoning
This commit is contained in:
+6
-5
@@ -4,6 +4,7 @@ Module : Dodge.Update
|
||||
Description : Simulation update
|
||||
-}
|
||||
module Dodge.Update ( updateUniverse ) where
|
||||
import Dodge.Zoning.Cloud
|
||||
import Dodge.Zoning.Creature
|
||||
import Dodge.WorldEffect
|
||||
import Dodge.Data
|
||||
@@ -27,7 +28,7 @@ import Dodge.Distortion
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Update.WallDamage
|
||||
import Dodge.Base
|
||||
import Dodge.Zone
|
||||
--import Dodge.Zone
|
||||
import Dodge.Hammer
|
||||
import Dodge.WallCreatureCollisions
|
||||
import Dodge.Update.Camera
|
||||
@@ -42,7 +43,7 @@ import Data.Maybe
|
||||
import qualified IntMapHelp as IM
|
||||
import qualified Data.Map.Strict as M
|
||||
import Control.Applicative
|
||||
import qualified Streaming.Prelude as S
|
||||
--import qualified Streaming.Prelude as S
|
||||
import SDL
|
||||
|
||||
{- For most menus the only way to change the world is using event handling. -}
|
||||
@@ -116,9 +117,9 @@ doWorldEvents w = foldr doWorldEffect (w & worldEvents .~ []) (_worldEvents w)
|
||||
|
||||
zoneClouds :: World -> World
|
||||
zoneClouds w = w
|
||||
& clZoning . znObjects .~ mempty
|
||||
& clZoning .~ mempty
|
||||
& clZoning %~ \zn ->
|
||||
foldl' (flip $ updateZoning (:)) zn (_clouds w)
|
||||
foldl' (flip zoneCloud) zn (_clouds w)
|
||||
--runIdentity (S.fold_ (flip $ updateZoning (:)) (zn & znObjects .~ mempty) id (_clouds w))
|
||||
|
||||
updateWorldSelect :: World -> World
|
||||
@@ -407,7 +408,7 @@ updateCloud w c
|
||||
newVel@(V3 _ _ nvz) = (0.95 *.*.* springVels) +.+.+ V3 0 0 (0.001 * vertVel)
|
||||
newVel2 = stripZ newVel
|
||||
vertVel = _clAlt c - opz
|
||||
springVels = runIdentity $ S.fold_ (clClSpringVel c) (_clVel c) id (clsNearPoint oldPos2 w)
|
||||
springVels = foldl' (clClSpringVel c) (_clVel c) (clsNearPoint oldPos2 w)
|
||||
oldPos@(V3 _ _ opz) = _clPos c
|
||||
oldPos2 = stripZ oldPos
|
||||
newPos@(V3 _ _ npz) = oldPos +.+.+ newVel
|
||||
|
||||
Reference in New Issue
Block a user