Assorted changes, cleanup menu selection text

This commit is contained in:
2022-04-25 23:27:39 +01:00
parent 67e6c4a5bd
commit fa8d8b5899
22 changed files with 217 additions and 108 deletions
+3 -2
View File
@@ -79,7 +79,7 @@ pointHitsWalls p1 p2
collidePointWalkable :: Point2 -> Point2 -> IM.IntMap Wall -> Bool
collidePointWalkable p1 p2 ws
= any (isJust . uncurry (intersectSegSeg p1 p2) . _wlLine)
$ IM.filter (fromMaybe True . (^? wlPathable)) ws
$ IM.filter (not . fromMaybe True . (^? wlPathable)) ws
--furthestPointWalkable :: Point2 -> Point2 -> IM.IntMap Wall -> Point2
--furthestPointWalkable p1 p2 ws
@@ -179,7 +179,8 @@ hasLOSIndirect p1 p2 w = case collidePointIndirect' p1 p2 $ wallsAlongLine p1 p2
isWalkable :: Point2 -> Point2 -> World -> Bool
isWalkable p1 p2 w = not
$ collidePointWalkable p1 p2
$ wallsAlongLine p1 p2 w
$ _walls w
-- $ wallsAlongLine p1 p2 w
canSee :: Int -> Int -> World -> Bool
canSee i j w = hasLOS p1 p2 w
+4 -5
View File
@@ -14,11 +14,10 @@ worldPosToScreenNorm cfig w = doWindowScale cfig . doRotate . doZoom . doTransla
- These have to be scaled according to the size of the window to get actual screen positions.
- This allows for line thicknesses etc to correspond to pixel sizes.-}
worldPosToScreen :: World -> Point2 -> Point2
worldPosToScreen w = doRotate . doZoom . doTranslate
where
doTranslate p = p -.- _cameraCenter w
doZoom p = _cameraZoom w *.* p
doRotate p = rotateV (negate $ _cameraRot w) p
worldPosToScreen w
= rotateV (negate $ _cameraRot w)
. (_cameraZoom w *.*)
. (-.- _cameraCenter w)
{- | Transform coordinates from the map position to screen
coordinates. -}
cartePosToScreen :: Configuration -> World -> Point2 -> Point2