Fix crWallCollisions by using a rectangle zone instead of a point

This commit is contained in:
2023-01-03 17:36:28 +00:00
parent 5fc39bd12d
commit 5b4e8d75bb
9 changed files with 58 additions and 35 deletions
+1 -1
View File
@@ -85,7 +85,7 @@ listCursorChooseBorderScale ygap s borders xoff yoff cfig yint col cursxsize cur
winScale cfig
. translate
(15 - (9 * s) + xoff - halfWidth cfig)
(halfHeight cfig + negate (yoff - s * 12.5) - ((s * 10 + ygap) * (fromIntegral yint + 1)))
(halfHeight cfig + s * 12.5 - (yoff + (s * 10 + ygap) * (fromIntegral yint + 1)))
. color col
$ chooseCursorBorders (s * wth) (s * hgt) borders
where
+26
View File
@@ -169,6 +169,9 @@ debugDraw' cfig w bl = case bl of
Show_wall_search_rays -> drawWallSearchRays w
Show_dda_test -> drawDDATest w
Show_far_wall_detect -> drawFarWallDetect w
Show_walls_near_point_cursor -> drawWallsNearCursor w
Show_walls_near_point_you -> drawWallsNearYou w
Show_zone_near_point_cursor -> drawZoneNearPointCursor w
Show_select -> drawWorldSelect w
Inspect_wall -> drawInspectWalls w
Cr_awareness -> drawCreatureDisplayTexts w
@@ -218,6 +221,22 @@ drawPathBetween w =
-- where
-- sp = _lSelect w
drawWallsNearYou :: World -> Picture
drawWallsNearYou w = fromMaybe mempty $ do
p <- w ^? cWorld . lWorld . creatures . ix 0 . crPos
return $ setLayer DebugLayer $ foldMap f $ wlsNearPoint p w
where
f wl = color violet $ thickLine 3 [a, b]
where
(a,b) = _wlLine wl
drawWallsNearCursor :: World -> Picture
drawWallsNearCursor w =
setLayer DebugLayer $ foldMap f $ wlsNearPoint (mouseWorldPos (_input w) (_camPos $ _cWorld w)) w
where
f wl = color rose $ thickLine 3 [a, b]
where
(a,b) = _wlLine wl
drawInspectWalls :: World -> Picture
drawInspectWalls w =
setLayer DebugLayer (color orange $ line [a,b]) <>
@@ -278,6 +297,13 @@ drawFarWallDetect w =
where
p = w ^. cWorld . camPos . camViewFrom
drawZoneNearPointCursor :: World -> Picture
drawZoneNearPointCursor w =
foldMap (drawZoneCol orange 50) ps
where
mwp = mouseWorldPos (w ^. input) (w ^. cWorld . camPos)
ps = [zoneOfPoint 50 mwp]
drawDDATest :: World -> Picture
drawDDATest w =
foldMap (drawZoneCol orange 50) ps