Refactor crPos to be a V3

This commit is contained in:
2025-10-10 13:47:31 +01:00
parent 98ece551c7
commit 49fb982877
58 changed files with 375 additions and 307 deletions
+6 -5
View File
@@ -1,6 +1,7 @@
{-# OPTIONS -Wno-incomplete-uni-patterns #-}
module Dodge.Debug.Picture where
import Linear (_xy)
import Control.Lens
import Data.Foldable
import qualified Data.Graph.Inductive as FGL
@@ -211,7 +212,7 @@ drawPathBetween w = concat $ do
drawWallsNearYou :: World -> Picture
drawWallsNearYou w = concat $ do
p <- w ^? cWorld . lWorld . creatures . ix 0 . crPos
p <- w ^? cWorld . lWorld . creatures . ix 0 . crPos . _xy
return $ setLayer DebugLayer $ foldMap f $ wlsNearPoint p w
where
f wl = color violet $ thickLine 3 [a, b]
@@ -384,7 +385,7 @@ drawWlIDs :: World -> Picture
drawWlIDs w = setLayer FixedCoordLayer $ foldMap f (w ^. cWorld . lWorld . walls)
where
f wl
| dist (_crPos $ you w) (fst (_wlLine wl)) > 200 = mempty -- this should be improved with a better "on screen test"
| dist (you w ^. crPos . _xy) (fst (_wlLine wl)) > 200 = mempty -- this should be improved with a better "on screen test"
| otherwise =
uncurryV translate p
. scale 0.1 0.1
@@ -414,12 +415,12 @@ drawCrInfo cfig w =
| _crID cr == 0 = Nothing
| crOnScreen =
Just
( _crPos cr
( cr ^. crPos . _xy
, catMaybes
-- [fmap show $ ap ^? crGoal
[ fpreShow "crHP" $ cr ^? crHP . _HP
, fpreShow "crStrategy" $ ap ^? apStrategy
, fmap (("crPos....." ++) . shortShow) $ cr ^? crPos
, fmap (("crPos....." ++) . shortShow) $ cr ^? crPos . _xy
, fpreShow "cpVigilance" $ cr ^? crPerception . cpVigilance
, -- , fmap show $ cr ^? crOldPos
fpreShow "crAction" $ ap ^? apAction
@@ -429,7 +430,7 @@ drawCrInfo cfig w =
| otherwise = Nothing
where
ap = _crActionPlan cr
crOnScreen = pointIsOnScreen cfig cam $ _crPos cr
crOnScreen = pointIsOnScreen cfig cam $ cr ^. crPos . _xy
fpreShow :: (Show a, Functor f) => String -> f a -> f String
fpreShow str = fmap (((rightPad 7 '.' str ++ "...") ++) . show)