Reorganise geometry modules slightly

This commit is contained in:
2021-12-15 10:59:06 +00:00
parent e3402bacf1
commit 9333d9497e
10 changed files with 198 additions and 160 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ import Dodge.Wall.Delete
import Dodge.Wall.Dust
import Dodge.RandomHelp
import Geometry
import Geometry.ConvexPoly
--import Geometry.ConvexPoly
import Data.Function
import qualified Data.IntSet as IS
+1 -1
View File
@@ -3,7 +3,7 @@ module Dodge.Creature.Boid
import Dodge.Data
import Dodge.Base
import Geometry
import Geometry.ConvexPoly
--import Geometry.ConvexPoly
import Control.Monad.Reader
import Control.Lens
+20 -22
View File
@@ -78,25 +78,23 @@ mvRadar
-> Point2 -- ^ Center of expanding circle
-> World -> Particle -> (World, Maybe Particle)
mvRadar 0 _ w _ = (w, Nothing)
mvRadar x p w pt =
( putBlips w
, Just $ pt {_ptDraw = const pic ,_ptUpdate = mvRadar (x-1) p }
)
where
pic = onLayerL [levLayer ShadowLayer, 1] $ pictures sweepPics
putBlips = over worldEvents ( over particles (blips ++) . )
blips = map (\bp -> blipAt bp (withAlpha (0.5*globalAlpha) red) 50) circPoints
circPoints = mapMaybe (\wl -> uncurry collidePointCircCorrect (_wlLine wl) r p)
$ map (over wlLine swp) (IM.elems $ wallsAlongCirc p r w)
++ IM.elems (wallsAlongCirc p r w)
swp (a,b) = (b,a)
r = fromIntegral (800 - x*16)
sweepPics = [--colHelper 0.1 $ uncurry translate p $ thickCircle r 15
--,colHelper 0.06 $ uncurry translate p $ thickCircle (r-5) 5
--,colHelper 0.03 $ uncurry translate p $ thickCircle (r-10) 5
]
globalAlpha | x > 10 = 1
| otherwise = fromIntegral x / 10
--colHelper y = color (withAlpha (y * globalAlpha) red)
mvRadar x p w pt = undefined
-- ( putBlips w
-- , Just $ pt {_ptDraw = const pic ,_ptUpdate = mvRadar (x-1) p }
-- )
-- where
-- pic = onLayerL [levLayer ShadowLayer, 1] $ pictures sweepPics
-- putBlips = over worldEvents ( over particles (blips ++) . )
-- blips = map (\bp -> blipAt bp (withAlpha (0.5*globalAlpha) red) 50) circPoints
-- circPoints = mapMaybe (\wl -> uncurry collidePointCircCorrect (_wlLine wl) r p)
-- $ map (over wlLine swp) (IM.elems $ wallsAlongCirc p r w)
-- ++ IM.elems (wallsAlongCirc p r w)
-- swp (a,b) = (b,a)
-- r = fromIntegral (800 - x*16)
-- sweepPics = [--colHelper 0.1 $ uncurry translate p $ thickCircle r 15
-- --,colHelper 0.06 $ uncurry translate p $ thickCircle (r-5) 5
-- --,colHelper 0.03 $ uncurry translate p $ thickCircle (r-10) 5
-- ]
-- globalAlpha | x > 10 = 1
-- | otherwise = fromIntegral x / 10
-- --colHelper y = color (withAlpha (y * globalAlpha) red)
+1 -1
View File
@@ -18,7 +18,7 @@ import Dodge.Default.Wall
import Dodge.Room.Link
import Dodge.Randify
import Geometry
import Geometry.ConvexPoly
--import Geometry.ConvexPoly
import qualified IntMapHelp as IM
import Tile
import Dodge.RandomHelp
+1 -1
View File
@@ -11,7 +11,7 @@ module Dodge.LevelGen.StaticWalls
)
where
import Geometry
import Geometry.ConvexPoly
--import Geometry.ConvexPoly
import FoldableHelp
import Data.List.Extra
+3 -2
View File
@@ -31,8 +31,8 @@ thingsHit sp ep w
where
hitCrs = IM.elems
$ IM.filter (\cr -> circOnSeg sp ep (_crPos cr) (_crRad cr))
-- $ _creatures w
$ creaturesAlongLine sp ep w
$ _creatures w
-- $ creaturesAlongLine sp ep w
crPs = map (\cr -> ssaTriPoint ep (_crPos cr) sp (_crRad cr)) hitCrs
crs = zip crPs (map Left hitCrs)
hitWls = wallsOnLine sp ep (IM.unions [f b $ f a $ _znObjects $ _wallsZone w | a<-[x-1,x,x+1]
@@ -127,6 +127,7 @@ thingsHitLongLine sp ep w
$ _creatures w
-- $ creaturesAlongLine sp ep w
crPs = map (\cr -> ssaTriPoint ep (_crPos cr) sp (_crRad cr)) hitCrs
--crPs = map _crPos hitCrs
wls = zip (map (fromJust . hitPoint) hitWls) (map Right hitWls)
--hitWls = wallsOnLine sp ep $ wallsAlongLine sp ep w
hitWls = wallsOnLine sp ep $ _walls w