Cleanup
This commit is contained in:
+12
-12
@@ -41,7 +41,7 @@ printRotPoint r p =
|
||||
. uncurryV translate p
|
||||
$ fold [circle 3, rotate (negate r) $ scale 0.1 0.1 $ text (show p)]
|
||||
|
||||
outsideScreenPolygon :: Configuration -> Camera -> [Point2]
|
||||
outsideScreenPolygon :: Config -> Camera -> [Point2]
|
||||
outsideScreenPolygon cfig w = [tr, tl, bl, br]
|
||||
where
|
||||
scRot = rotateV (w ^. camRot)
|
||||
@@ -57,7 +57,7 @@ outsideScreenPolygon cfig w = [tr, tl, bl, br]
|
||||
|
||||
-- cannot only test if walls are on screen, but also if they are on the cone
|
||||
-- towards the center of sight
|
||||
lineOnScreenCone :: Configuration -> World -> Point2 -> Point2 -> Bool
|
||||
lineOnScreenCone :: Config -> World -> Point2 -> Point2 -> Bool
|
||||
lineOnScreenCone cfig w p1 p2 =
|
||||
pointInPolygon p1 sp
|
||||
|| pointInPolygon p2 sp
|
||||
@@ -70,7 +70,7 @@ lineOnScreenCone cfig w p1 p2 =
|
||||
| otherwise = orderPolygon ((w ^. wCam . camViewFrom) : sp')
|
||||
sps = zip sp (tail sp ++ [head sp])
|
||||
|
||||
drawWallFace :: Configuration -> World -> Wall -> Picture
|
||||
drawWallFace :: Config -> World -> Wall -> Picture
|
||||
drawWallFace cfig w wall
|
||||
| isRHS sightFrom x y || not (wlIsOpaque wall) = blank
|
||||
| otherwise = setDepth (-1) . color (withAlpha 0 black) . polygon $ points
|
||||
@@ -79,7 +79,7 @@ drawWallFace cfig w wall
|
||||
points = extendConeToScreenEdge cfig w sightFrom (x, y)
|
||||
sightFrom = w ^. wCam . camViewFrom
|
||||
|
||||
extendConeToScreenEdge :: Configuration -> World -> Point2 -> (Point2, Point2) -> [Point2]
|
||||
extendConeToScreenEdge :: Config -> World -> Point2 -> (Point2, Point2) -> [Point2]
|
||||
extendConeToScreenEdge cfig w c (x, y) = orderPolygon $ wallScreenIntersect ++ [x, y] ++ borderPs ++ cornerPs
|
||||
where
|
||||
borderPs = mapMaybe (intersectLinefromScreen cfig w c) [x, y]
|
||||
@@ -93,7 +93,7 @@ extendConeToScreenEdge cfig w c (x, y) = orderPolygon $ wallScreenIntersect ++ [
|
||||
-- the following assumes that the point a is inside the screen
|
||||
-- it still works otherwise, but it might intersect two points:
|
||||
-- it is not obvious which will be returned
|
||||
intersectLinefromScreen :: Configuration -> World -> Point2 -> Point2 -> Maybe Point2
|
||||
intersectLinefromScreen :: Config -> World -> Point2 -> Point2 -> Maybe Point2
|
||||
intersectLinefromScreen cfig w a b =
|
||||
listToMaybe
|
||||
. mapMaybe (\(x, y) -> intersectSegLineFrom x y b (b +.+ b -.- a))
|
||||
@@ -151,7 +151,7 @@ drawZoneCol col s (V2 x y) = setLayer DebugLayer . color col $ thickLine 2 (p :
|
||||
zipWith (+.+) (square 1) $
|
||||
map ((s *.*) . (each %~ fromIntegral)) [V2 x y, V2 (x + 1) y, V2 (x + 1) (y + 1), V2 x (y + 1)]
|
||||
|
||||
debugDraw :: Configuration -> World -> Picture
|
||||
debugDraw :: Config -> World -> Picture
|
||||
{-# INLINE debugDraw #-}
|
||||
debugDraw cfig w
|
||||
| Enable_debug `S.member` _debug_booleans cfig =
|
||||
@@ -162,7 +162,7 @@ debugDraw cfig w
|
||||
pic = foldMap (debugDraw' cfig w) (_debug_booleans cfig)
|
||||
ts = map show (S.toList $ _debug_booleans cfig)
|
||||
|
||||
debugDraw' :: Configuration -> World -> DebugBool -> Picture
|
||||
debugDraw' :: Config -> World -> DebugBool -> Picture
|
||||
{-# INLINE debugDraw' #-}
|
||||
debugDraw' cfig w bl = case bl of
|
||||
Enable_debug -> mempty
|
||||
@@ -315,7 +315,7 @@ viewBoundaries w =
|
||||
p = w ^. wCam . camViewFrom
|
||||
grs = filter (pointInOrOnPolygon p . _grBound) (_cwgGameRooms $ _cwGen $ _cWorld w)
|
||||
|
||||
viewClipBounds :: Configuration -> World -> Picture
|
||||
viewClipBounds :: Config -> World -> Picture
|
||||
viewClipBounds cfig w
|
||||
| _debug_view_clip_bounds cfig == AllRoomClipBoundaries =
|
||||
setLayer DebugLayer $ color green $ foldMap (polygonWire . _cpPoints) (_cwgRoomClipping $ _cwGen (_cWorld w))
|
||||
@@ -338,7 +338,7 @@ drawBoundingBox w = setLayer DebugLayer $ color green $ line $ (x : xs) ++ [x]
|
||||
where
|
||||
(x : xs) = w ^. wCam . camBoundBox
|
||||
|
||||
soundPic :: Configuration -> World -> Sound -> Picture
|
||||
soundPic :: Config -> World -> Sound -> Picture
|
||||
soundPic cfig w s = fixedSizePicClampArrow 50 50 thePic p cfig w
|
||||
where
|
||||
p = _soundPos s
|
||||
@@ -382,14 +382,14 @@ drawWlIDs w = setLayer FixedCoordLayer $ foldMap f (w ^. cWorld . lWorld . walls
|
||||
where
|
||||
p = worldPosToScreen (w ^. wCam) $ 0.5 *.* uncurry (+.+) (_wlLine wl)
|
||||
|
||||
drawCrInfo :: Configuration -> World -> Picture
|
||||
drawCrInfo :: Config -> World -> Picture
|
||||
drawCrInfo cfig w =
|
||||
setLayer FixedCoordLayer $
|
||||
renderInfoListsAt (2 * hw - 400) 0 cfig cam $
|
||||
mapMaybe crDisplayInfo $ IM.elems $ w ^. cWorld . lWorld . creatures
|
||||
where
|
||||
cam = w ^. wCam
|
||||
-- drawPathing :: Configuration -> World -> Picture
|
||||
-- drawPathing :: Config -> World -> Picture
|
||||
-- drawPathing cfig w =
|
||||
-- setLayer DebugLayer $
|
||||
-- foldMap (edgeToPic (screenPolygon cfig (w ^. wCam)) . (^?! _3)) (FGL.labEdges gr)
|
||||
@@ -424,7 +424,7 @@ drawCrInfo cfig w =
|
||||
fpreShow str = fmap (((rightPad 7 '.' str ++ "...") ++) . show)
|
||||
hw = halfWidth cfig
|
||||
|
||||
drawPathing :: Configuration -> World -> Picture
|
||||
drawPathing :: Config -> World -> Picture
|
||||
drawPathing cfig w =
|
||||
setLayer DebugLayer $
|
||||
foldMap (edgeToPic (screenPolygon cfig (w ^. wCam)) . (^?! _3)) (FGL.labEdges gr)
|
||||
|
||||
Reference in New Issue
Block a user