Simplify clouds

This commit is contained in:
2025-12-02 21:02:07 +00:00
parent c89d5af6a3
commit bd50262ca4
5 changed files with 33 additions and 50 deletions
-20
View File
@@ -1,20 +0,0 @@
module Dodge.Cloud (clAlt) where
import Dodge.Data.Cloud
clAlt :: Cloud -> Float
clAlt cl = case _clType cl of
Smoke -> 90
RocketSmoke -> 30
CryoReleaseCloud -> 50
GasCloud -> 20
--clRad :: Cloud -> Float
--clRad cl = case _clType cl of
-- SmokeCloud -> 15
-- FlamerSmokeCloud -> 6
-- RocketCloud -> 15
-- StoneDust -> 15
-- CryoReleaseCloud -> 10
-- GasCloud -> 15
-- BloodCloud -> 10
+7 -9
View File
@@ -14,7 +14,7 @@ import Data.Maybe
import Data.Monoid import Data.Monoid
import Dodge.Base import Dodge.Base
import Dodge.Bullet import Dodge.Bullet
import Dodge.Cloud --import Dodge.Cloud
import Dodge.CrGroupUpdate import Dodge.CrGroupUpdate
import Dodge.Creature.Mass import Dodge.Creature.Mass
import Dodge.Creature.Radius import Dodge.Creature.Radius
@@ -802,17 +802,15 @@ updateCloud w c
& clTimer -~ 1 & clTimer -~ 1
) )
where where
newVel@(V3 _ _ nvz) = (0.95 *^ springVels) + V3 0 0 (0.01 * vertVel) newVel = 0.95 *^ (springVels & _z +~ 0.02)
newVel2 = stripZ newVel
vertVel = min 5 $ clAlt c - opz
springVels = foldl' (clClSpringVel c) (_clVel c) (clsNearPoint oldPos2 w) springVels = foldl' (clClSpringVel c) (_clVel c) (clsNearPoint oldPos2 w)
oldPos@(V3 _ _ opz) = _clPos c oldPos = _clPos c
oldPos2 = stripZ oldPos oldPos2 = stripZ oldPos
newPos@(V3 _ _ npz) = oldPos +.+.+ newVel newPos@(V3 _ _ npz) = oldPos + newVel
newPos2 = stripZ newPos newPos2 = stripZ newPos
hitWl = bouncePoint (const True) 1 oldPos2 newPos2 w hitWl = bouncePoint (const True) 1 oldPos2 newPos2 w
finalPos = addZ (max 1 $ min 90 npz) $ maybe newPos2 fst hitWl finalPos = addZ (max 1 $ min 90 npz) $ maybe newPos2 fst hitWl
finalVel = addZ nvz $ maybe newVel2 snd hitWl finalVel = newVel & _xy %~ maybe id (const . snd) hitWl
updateDust :: World -> Dust -> Maybe Dust updateDust :: World -> Dust -> Maybe Dust
updateDust w c updateDust w c
@@ -835,12 +833,12 @@ updateDust w c
clClSpringVel :: Cloud -> Point3 -> Cloud -> Point3 clClSpringVel :: Cloud -> Point3 -> Cloud -> Point3
clClSpringVel a v b clClSpringVel a v b
| dist3 pa pb < radDist = v +.+.+ 0.1 *.*.* normalizeV3 (pa -.-.- pb) | dist3 pa pb < radDist = v + 0.1 *^ normalize (pa - pb)
| otherwise = v | otherwise = v
where where
pa = _clPos a pa = _clPos a
pb = _clPos b pb = _clPos b
radDist = 10 radDist = 8
--radDist = (_clRad a + _clRad b) / 2 --radDist = (_clRad a + _clRad b) / 2
+1 -3
View File
@@ -3,9 +3,7 @@
{- | Controls a walls response to external damage. {- | Controls a walls response to external damage.
- Indestructible walls may still produce sparks, dust etc - Indestructible walls may still produce sparks, dust etc
-} -}
module Dodge.Wall.Damage ( module Dodge.Wall.Damage (damageWall) where
damageWall,
) where
import Control.Monad import Control.Monad
import Data.Foldable import Data.Foldable
+1
View File
@@ -44,6 +44,7 @@ makeIntInterval x y
-- [V2 x y | x <- makeIntInterval x1 x2, y <- makeIntInterval y1 y2] -- [V2 x y | x <- makeIntInterval x1 x2, y <- makeIntInterval y1 y2]
zoneOfPoint :: Float -> Point2 -> Int2 zoneOfPoint :: Float -> Point2 -> Int2
{-# INLINE zoneOfPoint #-}
zoneOfPoint = fmap . divTo zoneOfPoint = fmap . divTo
zoneOfSeg :: Float -> Point2 -> Point2 -> [Int2] zoneOfSeg :: Float -> Point2 -> Point2 -> [Int2]
+24 -18
View File
@@ -1,22 +1,28 @@
module Dodge.Zoning.Cloud where module Dodge.Zoning.Cloud (
clsNearPoint,
zoneCloud,
zoneDust,
dssNearPoint,
) where
import Dodge.Data.World import Dodge.Data.World
import Dodge.Zoning.Base import Dodge.Zoning.Base
import Dodge.Zoning.Common
import Geometry import Geometry
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
import Dodge.Zoning.Common
clsNearPoint :: Point2 -> World -> [Cloud] clsNearPoint :: Point2 -> World -> [Cloud]
{-# INLINE clsNearPoint #-}
clsNearPoint = nearPoint clZoneSize _clZoning clsNearPoint = nearPoint clZoneSize _clZoning
clsNearSeg :: Point2 -> Point2 -> World -> [Cloud] --clsNearSeg :: Point2 -> Point2 -> World -> [Cloud]
clsNearSeg = nearSeg clZoneSize _clZoning --clsNearSeg = nearSeg clZoneSize _clZoning
--
clsNearRect :: Point2 -> Point2 -> World -> [Cloud] --clsNearRect :: Point2 -> Point2 -> World -> [Cloud]
clsNearRect = nearRect clZoneSize _clZoning --clsNearRect = nearRect clZoneSize _clZoning
--
clsNearCirc :: Point2 -> Float -> World -> [Cloud] --clsNearCirc :: Point2 -> Float -> World -> [Cloud]
clsNearCirc p r = clsNearRect (p +.+ V2 r r) (p -.- V2 r r) --clsNearCirc p r = clsNearRect (p +.+ V2 r r) (p -.- V2 r r)
clZoneSize :: Float clZoneSize :: Float
clZoneSize = 20 clZoneSize = 20
@@ -30,14 +36,14 @@ zoneCloud cl = zoneMonoid (zoneOfCl cl) [cl]
dssNearPoint :: Point2 -> World -> [Dust] dssNearPoint :: Point2 -> World -> [Dust]
dssNearPoint = nearPoint dsZoneSize _dsZoning dssNearPoint = nearPoint dsZoneSize _dsZoning
dssNearSeg :: Point2 -> Point2 -> World -> [Dust] --dssNearSeg :: Point2 -> Point2 -> World -> [Dust]
dssNearSeg = nearSeg dsZoneSize _dsZoning --dssNearSeg = nearSeg dsZoneSize _dsZoning
--
dssNearRect :: Point2 -> Point2 -> World -> [Dust] --dssNearRect :: Point2 -> Point2 -> World -> [Dust]
dssNearRect = nearRect dsZoneSize _dsZoning --dssNearRect = nearRect dsZoneSize _dsZoning
--
dssNearCirc :: Point2 -> Float -> World -> [Dust] --dssNearCirc :: Point2 -> Float -> World -> [Dust]
dssNearCirc p r = dssNearRect (p +.+ V2 r r) (p -.- V2 r r) --dssNearCirc p r = dssNearRect (p +.+ V2 r r) (p -.- V2 r r)
dsZoneSize :: Float dsZoneSize :: Float
dsZoneSize = 20 dsZoneSize = 20