|
|
|
@@ -83,7 +83,7 @@ drawSweep cr w = fromMaybe mempty $ do
|
|
|
|
|
cdir = _crDir cr
|
|
|
|
|
rot = campos ^. camRot
|
|
|
|
|
p = _crPos cr
|
|
|
|
|
campos = w ^. cWorld . cwCamPos
|
|
|
|
|
campos = w ^. cWorld . cwCam
|
|
|
|
|
theinput = w ^. input
|
|
|
|
|
mwp = mouseWorldPos theinput campos
|
|
|
|
|
|
|
|
|
@@ -134,8 +134,8 @@ shiftDraw' fpos fdir fdraw x =
|
|
|
|
|
|
|
|
|
|
cullPoint :: Configuration -> World -> Point2 -> Bool
|
|
|
|
|
cullPoint cfig w p
|
|
|
|
|
| debugOn Close_shape_culling cfig = pointInPolygon p (w ^. cWorld . cwCamPos . camBoundBox)
|
|
|
|
|
| otherwise = dist (w ^. cWorld . cwCamPos . camCenter) p < (w ^. cWorld . cwCamPos . camViewDistance)
|
|
|
|
|
| debugOn Close_shape_culling cfig = pointInPolygon p (w ^. cWorld . cwCam . camBoundBox)
|
|
|
|
|
| otherwise = dist (w ^. cWorld . cwCam . camCenter) p < (w ^. cWorld . cwCam . camViewDistance)
|
|
|
|
|
|
|
|
|
|
extraPics :: Configuration -> Universe -> Picture
|
|
|
|
|
extraPics cfig u =
|
|
|
|
@@ -243,7 +243,7 @@ drawWallsNearYou w = fromMaybe mempty $ do
|
|
|
|
|
|
|
|
|
|
drawWallsNearCursor :: World -> Picture
|
|
|
|
|
drawWallsNearCursor w =
|
|
|
|
|
setLayer DebugLayer $ foldMap f $ wlsNearPoint (mouseWorldPos (_input w) (_cwCamPos $ _cWorld w)) w
|
|
|
|
|
setLayer DebugLayer $ foldMap f $ wlsNearPoint (mouseWorldPos (_input w) (_cwCam $ _cWorld w)) w
|
|
|
|
|
where
|
|
|
|
|
f wl = color rose $ thickLine 3 [a, b]
|
|
|
|
|
where
|
|
|
|
@@ -307,13 +307,13 @@ drawFarWallDetect w =
|
|
|
|
|
)
|
|
|
|
|
$ getViewpoints p (_cWorld w)
|
|
|
|
|
where
|
|
|
|
|
p = w ^. cWorld . cwCamPos . camViewFrom
|
|
|
|
|
p = w ^. cWorld . cwCam . camViewFrom
|
|
|
|
|
|
|
|
|
|
drawZoneNearPointCursor :: World -> Picture
|
|
|
|
|
drawZoneNearPointCursor w =
|
|
|
|
|
foldMap (drawZoneCol orange 50) ps
|
|
|
|
|
where
|
|
|
|
|
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . cwCamPos)
|
|
|
|
|
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . cwCam)
|
|
|
|
|
ps = [zoneOfPoint 50 mwp]
|
|
|
|
|
|
|
|
|
|
drawDDATest :: World -> Picture
|
|
|
|
@@ -321,8 +321,8 @@ drawDDATest w =
|
|
|
|
|
foldMap (drawZoneCol orange 50) ps
|
|
|
|
|
<> setLayer DebugLayer (color yellow (line [cvf, mwp]))
|
|
|
|
|
where
|
|
|
|
|
cvf = w ^. cWorld . cwCamPos . camViewFrom
|
|
|
|
|
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . cwCamPos)
|
|
|
|
|
cvf = w ^. cWorld . cwCam . camViewFrom
|
|
|
|
|
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . cwCam)
|
|
|
|
|
ps = zoneOfSeg 50 cvf mwp
|
|
|
|
|
|
|
|
|
|
drawZoneCol :: Color -> Float -> V2 Int -> Picture
|
|
|
|
@@ -342,7 +342,7 @@ drawWallSearchRays w = foldMap (f . fst) $ allVisibleWalls w
|
|
|
|
|
setLayer DebugLayer $
|
|
|
|
|
color yellow $
|
|
|
|
|
uncurryV translate p (circle 5)
|
|
|
|
|
<> line [w ^. cWorld . cwCamPos . camViewFrom, p]
|
|
|
|
|
<> line [w ^. cWorld . cwCam . camViewFrom, p]
|
|
|
|
|
|
|
|
|
|
testPic :: Configuration -> World -> Picture
|
|
|
|
|
testPic _ _ = mempty
|
|
|
|
@@ -350,7 +350,7 @@ testPic _ _ = mempty
|
|
|
|
|
drawBoundingBox :: World -> Picture
|
|
|
|
|
drawBoundingBox w = setLayer DebugLayer $ color green $ line $ (x : xs) ++ [x]
|
|
|
|
|
where
|
|
|
|
|
(x : xs) = w ^. cWorld . cwCamPos . camBoundBox
|
|
|
|
|
(x : xs) = w ^. cWorld . cwCam . camBoundBox
|
|
|
|
|
|
|
|
|
|
ppDraw :: PressPlate -> Picture
|
|
|
|
|
ppDraw c = uncurryV translate (_ppPos c) $ rotate (_ppRot c) (_ppPict c)
|
|
|
|
@@ -375,7 +375,7 @@ soundPic cfig w s = fixedSizePicClampArrow 50 50 thePic p cfig (w ^. cWorld)
|
|
|
|
|
where
|
|
|
|
|
p = _soundPos s
|
|
|
|
|
thePic =
|
|
|
|
|
rotate (w ^. cWorld . cwCamPos . camRot)
|
|
|
|
|
rotate (w ^. cWorld . cwCam . camRot)
|
|
|
|
|
. scale theScale theScale
|
|
|
|
|
. centerText
|
|
|
|
|
. soundToOnomato
|
|
|
|
@@ -391,7 +391,7 @@ drawMousePosition w =
|
|
|
|
|
. text
|
|
|
|
|
$ shortPoint2 mwp
|
|
|
|
|
where
|
|
|
|
|
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . cwCamPos)
|
|
|
|
|
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . cwCam)
|
|
|
|
|
|
|
|
|
|
drawWlIDs :: World -> Picture
|
|
|
|
|
drawWlIDs w = setLayer FixedCoordLayer $ foldMap f (w ^. cWorld . lWorld . walls)
|
|
|
|
@@ -404,7 +404,7 @@ drawWlIDs w = setLayer FixedCoordLayer $ foldMap f (w ^. cWorld . lWorld . walls
|
|
|
|
|
. text
|
|
|
|
|
$ show $ _wlID wl
|
|
|
|
|
where
|
|
|
|
|
p = worldPosToScreen (w ^. cWorld . cwCamPos) $ 0.5 *.* uncurry (+.+) (_wlLine wl)
|
|
|
|
|
p = worldPosToScreen (w ^. cWorld . cwCam) $ 0.5 *.* uncurry (+.+) (_wlLine wl)
|
|
|
|
|
|
|
|
|
|
edgeToPic :: [Point2] -> PathEdge -> Picture
|
|
|
|
|
edgeToPic poly pe
|
|
|
|
@@ -417,13 +417,13 @@ edgeToPic poly pe
|
|
|
|
|
drawPathing :: Configuration -> World -> Picture
|
|
|
|
|
drawPathing cfig w =
|
|
|
|
|
setLayer DebugLayer $
|
|
|
|
|
foldMap (edgeToPic (screenPolygon cfig (w ^. cWorld . cwCamPos)) . (^?! _3)) (FGL.labEdges gr)
|
|
|
|
|
foldMap (edgeToPic (screenPolygon cfig (w ^. cWorld . cwCam)) . (^?! _3)) (FGL.labEdges gr)
|
|
|
|
|
<> foldMap dispInc (graphToIncidence gr)
|
|
|
|
|
where
|
|
|
|
|
dispInc (p, n) = setDepth 2 . uncurryV translate p . scale 0.1 0.1 $ text $ show n
|
|
|
|
|
gr = w ^. cWorld . pathGraph
|
|
|
|
|
|
|
|
|
|
crDisplayInfo :: Configuration -> CamPos -> Creature -> Maybe (Point2, [String])
|
|
|
|
|
crDisplayInfo :: Configuration -> Camera -> Creature -> Maybe (Point2, [String])
|
|
|
|
|
crDisplayInfo cfig cam cr
|
|
|
|
|
| _crID cr == 0 = Nothing
|
|
|
|
|
| crOnScreen =
|
|
|
|
@@ -454,7 +454,7 @@ drawCrInfo cfig w =
|
|
|
|
|
renderInfoListsAt (2 * hw - 400) 0 cfig cam $
|
|
|
|
|
mapMaybe (crDisplayInfo cfig cam) $ IM.elems $ w ^. lWorld . creatures
|
|
|
|
|
where
|
|
|
|
|
cam = w ^. cwCamPos
|
|
|
|
|
cam = w ^. cwCam
|
|
|
|
|
hw = halfWidth cfig
|
|
|
|
|
|
|
|
|
|
viewBoundaries :: CWorld -> Picture
|
|
|
|
@@ -463,7 +463,7 @@ viewBoundaries w =
|
|
|
|
|
color green (foldMap (polygonWire . _grBound) grs)
|
|
|
|
|
<> color yellow (foldMap (\q -> line [p, q]) $ getViewpoints p w)
|
|
|
|
|
where
|
|
|
|
|
p = w ^. cwCamPos . camViewFrom
|
|
|
|
|
p = w ^. cwCam . camViewFrom
|
|
|
|
|
grs = filter (pointInOrOnPolygon p . _grBound) (_cwgGameRooms $ _cwGen w)
|
|
|
|
|
|
|
|
|
|
viewClipBounds :: Configuration -> World -> Picture
|
|
|
|
|