Unify block wall types

This commit is contained in:
2021-10-28 00:05:57 +01:00
parent 74e19008b4
commit 686a9fc3ee
9 changed files with 38 additions and 187 deletions
+2 -11
View File
@@ -96,8 +96,6 @@ soundPics w
| _show_sound (_config w) = pictures $ M.map (soundPic w) $ _playingSounds w
| otherwise = []
soundPic :: World -> Sound -> Picture
soundPic w s = fixedSizePicClampArrow 50 50 thePic p w
where
@@ -126,7 +124,7 @@ wallFloorsToDraw w = filter isVisible $ IM.elems $ wallsOnScreen w
where
onScreen wall = uncurry (lineOnScreen w) $ _wlLine wall
isVisible wl
| wl ^? blVisible == Just False = False
| wl ^? wlDraw == Just False = False
| otherwise = onScreen wl
drawWallFloor :: Wall -> Picture
@@ -162,12 +160,6 @@ outsideScreenPolygon w = [tr,tl,bl,br]
br = scTran $ scRot $ scZoom $ V2 ( 3*halfWidth w ) (- (3* halfHeight w))
bl = scTran $ scRot $ scZoom $ V2 (- (3*halfWidth w)) (- (3* halfHeight w))
wallShadowsToDraw :: World -> [Wall]
wallShadowsToDraw w
= filter (fromMaybe True . (^? blVisible))
. IM.elems
$ wallsNearZones (zoneOfSight w) w
-- cannot only test if walls are on screen, but also if they are on the cone
-- towards the center of sight
lineOnScreenCone :: World -> Point2 -> Point2 -> Bool
@@ -256,11 +248,10 @@ wallsAndWindows
:: World
-> ( [((Point2,Point2),Point4)] ,[((Point2,Point2),Point4)] )
wallsAndWindows w
= (map f wls, map f $ filter (fromMaybe True . (^? blVisible)) wins)
= (map f wls, map f wins)
where
f wl = (_wlLine wl, _wlColor wl)
(wins,wls) = partition _wlIsSeeThrough . IM.elems . IM.filter _wlDraw $ wallsDoubleScreen w
--(wins,wls) = partition _wlIsSeeThrough . IM.elems $ wallsOnScreen w
wallsToList :: [((Point2,Point2),Point4)] -> [Float]
wallsToList = concatMap (\((V2 a b,V2 c d),V4 e f g h) -> [a,b,c,d,e,f,g,h])