Fix wall depth rendering

This commit is contained in:
2021-03-22 00:05:24 +01:00
parent 5a5ca6f208
commit f19f879945
4 changed files with 8 additions and 14 deletions
+2 -2
View File
@@ -722,13 +722,13 @@ crInPolygon :: Creature -> [Point2] -> Bool
crInPolygon cr xs = errorPointInPolygon 3 (_crPos cr) xs
onLayer :: Layer -> Picture -> Picture
onLayer l = setDepth (fromIntegral (levLayer l) / 100)
onLayer l = setDepth $ 1 - fromIntegral (levLayer l) / 100
--onLayer :: Layer -> Picture -> [(Picture, [Int])]
--onLayer l p = [(p, [levLayer l])]
onLayerL :: [Int] -> Picture -> Picture
onLayerL is = setDepth ((sum $ zipWith (/) (map fromIntegral is) $ map (\x->100**x) [1..]))
onLayerL is = setDepth (1 - (sum $ zipWith (/) (map fromIntegral is) $ map (\x->100**x) [1..]))
levLayer :: Layer -> Int
levLayer BgLayer = 20
+3 -3
View File
@@ -29,9 +29,9 @@ fixedCoordPictures :: World -> Picture
fixedCoordPictures w = pictures
[ scaler $ hudDrawings w
, scaler $ onLayer MenuLayer menuScreen
, setDepth 1 $ closeObjectTexts w
, setDepth (-1) $ closeObjectTexts w
]
where scaler = setDepth 1 . scale (2 / _windowX w) (2 / _windowY w)
where scaler = setDepth (-1) . scale (2 / _windowX w) (2 / _windowY w)
menuScreen :: Picture
menuScreen = case _menuState w of
InGame -> blank
@@ -300,7 +300,7 @@ lineOnScreen w (p1:p2:_) = errorPointInPolygon 8 p1 sp || errorPointInPolygon 9
drawWallFace :: World -> Wall -> Picture
drawWallFace w wall
| isRHS sightFrom x y || _wlIsSeeThrough wall = blank
| otherwise = setLayer 3 . setDepth 1 . polygon $ points
| otherwise = setLayer 3 . setDepth (-1) . polygon $ points
where
(x:y:_) = _wlLine wall
points = extendConeToScreenEdge w sightFrom (x,y)