Move towards resolving picture rendering bug

The bug concerns a mutable vector storing the amount of data that has
been poked.
This commit is contained in:
2026-01-01 23:44:18 +00:00
parent 0a8725f68d
commit 2c978b4de1
19 changed files with 316 additions and 315 deletions
+25 -2
View File
@@ -2,6 +2,13 @@
module Dodge.Debug (debugEvents, drawDebug) where
import Geometry.Data
import Dodge.Render.Label
import Dodge.Data.DoubleTree
import Dodge.HeldUse
import Dodge.DoubleTree
import Dodge.Item.Grammar
import NewInt
import AesonHelp
import Control.Lens
import Control.Monad
@@ -55,7 +62,7 @@ debugItem = \case
Show_wall_search_rays -> mempty
Show_dda_test -> mempty
Show_far_wall_detect -> mempty
Show_walls_near_point_you -> mempty
Show_walls_near_you -> mempty
Show_zone_near_point_cursor -> mempty
Show_zone_circ -> mempty
Inspect_wall -> mempty
@@ -70,6 +77,7 @@ debugItem = \case
Show_mouse_click_pos -> debugMouseClickPos
Debug_get -> doDebugGet
Debug_put -> debugPutItems
Muzzle_positions -> mempty
debugGet :: Universe -> [String]
debugGet u = foldMap getPretty $ u ^. uvWorld . cWorld . lWorld . shockwaves
@@ -224,7 +232,7 @@ drawDebug u = \case
Show_wall_search_rays -> drawWallSearchRays $ _uvWorld u
Show_dda_test -> drawDDATest $ _uvWorld u
Show_far_wall_detect -> drawFarWallDetect $ _uvWorld u
Show_walls_near_point_you -> drawWallsNearYou $ _uvWorld u
Show_walls_near_you -> drawWallsNearYou $ _uvWorld u
Show_zone_near_point_cursor -> drawZoneNearPointCursor $ _uvWorld u
Show_zone_circ -> drawZoneCirc $ _uvWorld u
Inspect_wall -> drawInspectWalls $ _uvWorld u
@@ -239,3 +247,18 @@ drawDebug u = \case
Show_path_between -> drawPathBetween u
Show_writable_values -> mempty
Show_mouse_click_pos -> mempty
Muzzle_positions -> showMuzzlePositions u
showMuzzlePositions :: Universe -> Picture
showMuzzlePositions u = fold $ do
cr <- u ^? uvWorld . cWorld . lWorld . creatures . ix 0
invid <- cr ^? crManipulation . manObject . imRootSelectedItem . unNInt
loc <- invIndents ((\k -> u ^?! uvWorld . cWorld . lWorld . items . ix k) <$> _crInv cr)
^? ix invid . _2
return . color red $ setLayer DebugLayer $ reduceLocDT (f cr) loc
where
f cr loc = foldMap g $ map (muzzlePos loc cr) (itemMuzzles $ loc ^. locDT . dtValue . _1)
where
g :: Point3Q -> Picture
g pq = translate3 (pq ^. _1) $ crossPic 5