Fix bug determining max radius of convex polys, fixes bugs in room positioning

This commit is contained in:
2022-03-21 07:43:27 +00:00
parent 2a5b6d3597
commit d6285c45b3
12 changed files with 80 additions and 32 deletions
+18 -2
View File
@@ -1,7 +1,6 @@
module Dodge.Render.ShapePicture
( worldSPic
)
where
) where
import Dodge.Config.Data
--import Dodge.Debug.Picture
import Dodge.Picture.SizeInvariant
@@ -19,6 +18,7 @@ import ShapePicture
import Shape
import Picture
import Sound.Data
import Geometry.ConvexPoly
import qualified Data.IntMap.Strict as IM -- Lazy?
import qualified Data.Map.Strict as M
@@ -52,6 +52,7 @@ extraPics cfig w = pictures (_decorations w)
<> concatMapPic ppDraw (_pressPlates w )
<> soundPics cfig w
<> viewBoundaries cfig w
<> viewClipBounds cfig w
<> drawPathing cfig w
testPic :: World -> Picture
@@ -110,6 +111,21 @@ viewBoundaries cfig w
p = _crPos $ you w
grs = filter (pointInOrOnPolygon p . _grBound) (_gameRooms w)
viewClipBounds :: Configuration -> World -> Picture
viewClipBounds cfig w
| _debug_view_clip_bounds cfig
-- = setLayer 5 $ color green $ concatMap (polygonWire . _cpPoints) (_roomClipping w)
= setLayer 5 $ f (_roomClipping w)
| otherwise = []
where
f (x:xs) = g x xs <> f xs
f [] = mempty
g x (y:ys) | convexPolysOverlap x y = color green (polygonWire $ _cpPoints x)
<> color yellow (polygonWire $ _cpPoints y)
<> g x ys
| otherwise = g x ys
g _ [] = mempty
--wallFloorsToDraw :: World -> [Wall]
--wallFloorsToDraw w = filter isVisible $ IM.elems $ wallsOnScreen w
-- where