Commit before working on debugging

This commit is contained in:
2025-10-13 23:43:29 +01:00
parent c3a0cb0527
commit 3d602b4f57
7 changed files with 144 additions and 102 deletions
+3 -44
View File
@@ -14,7 +14,7 @@ import Dodge.GameRoom
import Dodge.Graph
import Dodge.Path
import Dodge.Picture.SizeInvariant
import Dodge.Render.InfoBox
--import Dodge.Render.InfoBox
import Dodge.Render.Label
import Dodge.Render.List
import Dodge.ShortShow
@@ -26,10 +26,10 @@ import Dodge.Zoning.Base
import Geometry
import Geometry.ConvexPoly
import qualified IntMapHelp as IM
import Padding
--import Padding
import Picture
import SDL (MouseButton (..))
import ShortShow
--import ShortShow
import Sound.Data
printPoint :: Point2 -> Picture
@@ -394,47 +394,6 @@ drawWlIDs w = setLayer FixedCoordLayer $ foldMap f (w ^. cWorld . lWorld . walls
where
p = worldPosToScreen (w ^. wCam) $ 0.5 *.* uncurry (+.+) (_wlLine wl)
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 :: Config -> World -> Picture
-- drawPathing cfig w =
-- setLayer DebugLayer $
-- foldMap (edgeToPic (screenPolygon cfig (w ^. wCam)) . (^?! _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 :: Creature -> Maybe (Point2, [String])
crDisplayInfo cr
| _crID cr == 0 = Nothing
| crOnScreen =
Just
( cr ^. crPos . _xy
, catMaybes
-- [fmap show $ ap ^? crGoal
[ fpreShow "crHP" $ cr ^? crHP . _HP
, fpreShow "crStrategy" $ ap ^? apStrategy
, fmap (("crPos....." ++) . shortShow) $ cr ^? crPos . _xy
, fpreShow "cpVigilance" $ cr ^? crPerception . cpVigilance
, -- , fmap show $ cr ^? crOldPos
fpreShow "crAction" $ ap ^? apAction
, fpreShow "crImpulse" $ ap ^? apImpulse
]
)
| otherwise = Nothing
where
ap = _crActionPlan 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)
hw = halfWidth cfig
drawPathing :: Config -> World -> Picture
drawPathing cfig w =