From e6c2b659fd69e13d6c23aaef84ae241cf3770494 Mon Sep 17 00:00:00 2001 From: justin Date: Sun, 24 Nov 2024 14:07:54 +0000 Subject: [PATCH] Fix indentation display of indented sections --- ghcidOutput | 2 +- src/Dodge/DisplayInventory.hs | 6 ++-- src/Dodge/Render/HUD.hs | 4 ++- src/Dodge/Render/List.hs | 4 ++- src/Dodge/SelectionSections/Draw.hs | 8 +++-- tags | 54 ++++++++++++++--------------- 6 files changed, 42 insertions(+), 36 deletions(-) diff --git a/ghcidOutput b/ghcidOutput index 1ba29d218..dcbdca3cf 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1 +1 @@ -All good (594 modules, at 13:23:07) +All good (594 modules, at 14:06:19) diff --git a/src/Dodge/DisplayInventory.hs b/src/Dodge/DisplayInventory.hs index 913da1fd0..8a17ba5fa 100644 --- a/src/Dodge/DisplayInventory.hs +++ b/src/Dodge/DisplayInventory.hs @@ -138,18 +138,18 @@ updateDisplaySections w cfig = (filtinv, invx) = ((-1, sfinv), (0, sinv)) closefiltcurs = mselpos ^? _Just . _1 == Just 2 (sfclose, sclose) = - filterSectionsPair closefiltcurs plainRegex closeitms "NEARBY" $ + filterSectionsPair closefiltcurs plainRegex closeitms "NEARBY ITEMS" $ w ^? hud . hudElement . diCloseFilter . _Just (filtclose, closex) = ((2, sfclose), (3, sclose)) nearbyhead = if null sfclose - then if null sclose then (2,mempty) else makehead "NEARBY" 2 + then if null sclose then (2,mempty) else makehead "NEARBY ITEMS" 2 else filtclose youx = (1, youitems) makehead str i = (i,IM.singleton 0 $ SelectionInfo [str] 1 False white 0) statushead = (-4,IM.singleton 0 $ SelectionInfo ["STATUS"] 1 False white 0) statusdisplay = (-3,IM.singleton 0 $ SelectionInfo ["HEALTH "++show (_crHP cr)] 1 False white 0) invhead = if null sfinv then makehead "INVENTORY" (-2) else filtinv - youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 0 () + youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 2 () thetext = displayFreeSlots (crNumFreeSlots cr) closeitms = IM.fromDistinctAscList . zip [0 ..] $ diff --git a/src/Dodge/Render/HUD.hs b/src/Dodge/Render/HUD.hs index 8b10fca98..16874b993 100644 --- a/src/Dodge/Render/HUD.hs +++ b/src/Dodge/Render/HUD.hs @@ -457,7 +457,9 @@ selNumPosCardinal :: selNumPosCardinal card cfig ldp sss i j = do ipos <- selSecYint i j sss size <- selSecSelSize i j sss - indent <- sss ^? ix i . ssItems . ix j . siOffX + itmindent <- sss ^? ix i . ssItems . ix j . siOffX + sindent <- sss ^? ix i . ssIndent + let indent = itmindent + sindent let offset = cardEightVec card * V2 0 (fromIntegral size * 0.5 * 20 * s) return $ screenPosAbs cfig (ldp ^. ldpPos) diff --git a/src/Dodge/Render/List.hs b/src/Dodge/Render/List.hs index bded2ae05..c07ee9e70 100644 --- a/src/Dodge/Render/List.hs +++ b/src/Dodge/Render/List.hs @@ -67,6 +67,7 @@ makeSelectionListPictures = concatMap f where f si = map (color (_siColor si) . text) $ _siPictures si +-- note this does not take into account any selectionsection indent drawCursorAt :: Maybe Int -> [SelectionItem a] -> @@ -113,6 +114,7 @@ selSecDrawCursorAt :: Picture selSecDrawCursorAt xsize ldp curs sss (i, j) = fold $ do yint <- selSecYint i j sss + sindent <- sss ^? ix i . ssIndent si <- sss ^? ix i . ssItems . ix j return $ listCursorChooseBorderScale @@ -120,7 +122,7 @@ selSecDrawCursorAt xsize ldp curs sss (i, j) = fold $ do (ldp ^. ldpScale) curs yint - (_siOffX si) + (_siOffX si + sindent) (_siColor si) xsize (_siHeight si) diff --git a/src/Dodge/SelectionSections/Draw.hs b/src/Dodge/SelectionSections/Draw.hs index 1a3f4b225..bf8d6c03b 100644 --- a/src/Dodge/SelectionSections/Draw.hs +++ b/src/Dodge/SelectionSections/Draw.hs @@ -25,7 +25,8 @@ drawSelectionSections sss ldp cfig = (_ldpVerticalGap ldp) (_ldpScale ldp) 0 - (foldMap _ssShownItems sss) + (foldMap + (\ss -> fmap (translate (100*fromIntegral (_ssIndent ss)) 0) $ _ssShownItems ss) sss) drawSSCursor :: IM.IntMap (SelectionSection a) -> @@ -53,6 +54,7 @@ drawSSMultiCursor sss msel mextra ldp curs cfig = translateScreenPos cfig (ldp ^ yint <- selSecYint i j sss ydown <- mextra ssitms <- sss ^? ix i . ssItems + sindent <- sss ^? ix i . ssIndent let selitms = fst . IM.split (j + ydown + 1) . snd . IM.split (j -1) $ ssitms ysize = sum . fmap _siHeight $ selitms maxxoff = maximum . fmap _siOffX $ selitms @@ -65,7 +67,7 @@ drawSSMultiCursor sss msel mextra ldp curs cfig = translateScreenPos cfig (ldp ^ (ldp ^. ldpScale) curs yint - minxoff + (minxoff + sindent) col - (15 + maxxoff - minxoff) + (sindent + 15 + maxxoff - minxoff) ysize diff --git a/tags b/tags index 0464c7e2f..96382f768 100644 --- a/tags +++ b/tags @@ -3596,7 +3596,7 @@ checkWallLeft src/Dodge/LevelGen/StaticWalls/Deprecated.hs 29;" f checkWallRight src/Dodge/LevelGen/StaticWalls.hs 54;" f checkWallRight src/Dodge/LevelGen/StaticWalls/Deprecated.hs 59;" f chemFuelPouch src/Dodge/Item/Ammo.hs 110;" f -chooseCursorBorders src/Dodge/Render/List.hs 159;" f +chooseCursorBorders src/Dodge/Render/List.hs 160;" f chooseEquipmentPosition src/Dodge/Inventory/RBList.hs 36;" f chooseFootSound src/Dodge/Creature/State/WalkCycle.hs 39;" f chooseFreeSite src/Dodge/Inventory/RBList.hs 42;" f @@ -3801,7 +3801,7 @@ cylinderIndices src/Shader/Poke.hs 374;" f cylinderOnSeg src/Geometry.hs 125;" f cylinderPoly src/Shape.hs 86;" f cylinderRoundIndices src/Shader/Poke.hs 381;" f -dShadCol src/Dodge/Render/List.hs 218;" f +dShadCol src/Dodge/Render/List.hs 219;" f damThingHitWith src/Dodge/WorldEvent/Damage.hs 10;" f damToExpBarrel src/Dodge/Barreloid.hs 57;" f damageBlocksBy src/Dodge/Wall/Damage.hs 36;" f @@ -3976,7 +3976,7 @@ disconnectTerminal src/Dodge/Terminal.hs 217;" f displayConfig src/Dodge/Menu.hs 196;" f displayControls src/Dodge/Menu.hs 206;" f displayFrameTicks src/Dodge/Render/Picture.hs 39;" f -displayFreeSlots src/Dodge/DisplayInventory.hs 198;" f +displayFreeSlots src/Dodge/DisplayInventory.hs 202;" f displaySectionsSizes src/Dodge/DisplayInventory.hs 115;" f displayTerminalLineString src/Dodge/Update.hs 422;" f dist src/Geometry/Vector.hs 179;" f @@ -4041,7 +4041,7 @@ doRoomOutPlacements src/Dodge/Layout.hs 107;" f doRoomPlacements src/Dodge/Layout.hs 122;" f doRoomShift src/Dodge/Room/Link.hs 33;" f doScopeZoom src/Dodge/Update/Camera.hs 141;" f -doSectionSize src/Dodge/DisplayInventory.hs 220;" f +doSectionSize src/Dodge/DisplayInventory.hs 224;" f doSideEffects appDodge/Main.hs 118;" f doStep src/Dodge/ArcStep.hs 9;" f doStrategyActions src/Dodge/Creature/ReaderUpdate.hs 164;" f @@ -4099,7 +4099,7 @@ drawCreature src/Dodge/Render/ShapePicture.hs 41;" f drawCreatureDisplayTexts src/Dodge/Debug/Picture.hs 165;" f drawCross src/Dodge/Render/Label.hs 24;" f drawCrossCol src/Dodge/Render/Label.hs 21;" f -drawCursorAt src/Dodge/Render/List.hs 70;" f +drawCursorAt src/Dodge/Render/List.hs 71;" f drawDDATest src/Dodge/Debug/Picture.hs 256;" f drawDoorPaths src/Dodge/Debug/Picture.hs 217;" f drawDoubleLampCover src/Dodge/Prop/Draw.hs 81;" f @@ -4132,10 +4132,10 @@ drawLampCover src/Dodge/Prop/Draw.hs 44;" f drawLaser src/Dodge/Laser/Draw.hs 6;" f drawLightSource src/Dodge/LightSource/Draw.hs 7;" f drawLinearShockwave src/Dodge/LinearShockwave/Draw.hs 10;" f -drawList src/Dodge/Render/List.hs 212;" f -drawListElement src/Dodge/Render/List.hs 190;" f -drawListYgapScaleYoff src/Dodge/Render/List.hs 98;" f -drawListYoff src/Dodge/Render/List.hs 95;" f +drawList src/Dodge/Render/List.hs 213;" f +drawListElement src/Dodge/Render/List.hs 191;" f +drawListYgapScaleYoff src/Dodge/Render/List.hs 99;" f +drawListYoff src/Dodge/Render/List.hs 96;" f drawMachine src/Dodge/Machine/Draw.hs 17;" f drawMapWall src/Dodge/Render/HUD/Carte.hs 33;" f drawMenuClick src/Dodge/Render/Picture.hs 132;" f @@ -4227,7 +4227,7 @@ encircle src/Dodge/Creature/Boid.hs 115;" f encircleCloseP src/Dodge/Creature/Boid.hs 35;" f encircleDistP src/Dodge/Creature/Boid.hs 21;" f encircleP src/Dodge/Creature/Boid.hs 27;" f -enterCombineInv src/Dodge/DisplayInventory.hs 334;" f +enterCombineInv src/Dodge/DisplayInventory.hs 338;" f eqConstr src/SameConstr.hs 17;" f eqPosText src/Dodge/Equipment/Text.hs 6;" f equipAllocString src/Dodge/Render/HUD.hs 280;" f @@ -4276,7 +4276,7 @@ fdiv src/ShortShow.hs 27;" f feet src/Dodge/Creature/Picture.hs 51;" f ffoldM src/Framebuffer/Update.hs 79;" f filter3 src/FoldableHelp.hs 76;" f -filterSectionsPair src/Dodge/DisplayInventory.hs 165;" f +filterSectionsPair src/Dodge/DisplayInventory.hs 169;" f findBlips src/Dodge/RadarSweep.hs 44;" f findBoundDists src/Dodge/Update/Camera.hs 235;" f findClosePoint src/Dodge/LevelGen/StaticWalls.hs 155;" f @@ -4395,7 +4395,7 @@ getDamageCoding src/Dodge/Terminal.hs 177;" f getDistortions src/Dodge/Render.hs 383;" f getEquipmentAllocation src/Dodge/Inventory/RBList.hs 47;" f getItem src/Dodge/Item/Location.hs 15;" f -getLDPWidth src/Dodge/Render/List.hs 90;" f +getLDPWidth src/Dodge/Render/List.hs 91;" f getLaserColor src/Dodge/HeldUse.hs 196;" f getLaserDamage src/Dodge/HeldUse.hs 193;" f getLaserPhaseV src/Dodge/HeldUse.hs 190;" f @@ -4588,7 +4588,7 @@ interweave src/Justify.hs 17;" f intsToPos src/Dodge/Room/Modify/Girder.hs 160;" f invAdj src/Dodge/Item/Grammar.hs 188;" f invCursorParams src/Dodge/ListDisplayParams.hs 38;" f -invDimColor src/Dodge/DisplayInventory.hs 192;" f +invDimColor src/Dodge/DisplayInventory.hs 196;" f invDisplayParams src/Dodge/ListDisplayParams.hs 32;" f invHead src/Dodge/Render/HUD.hs 377;" f invLDT src/Dodge/Item/Grammar.hs 171;" f @@ -4761,9 +4761,9 @@ linksAndPath' src/Dodge/Room/Path.hs 44;" f linksOnPath src/Dodge/Room/CheckConsistency.hs 7;" f listConfig src/Dodge/Menu.hs 199;" f listControls src/Dodge/Menu.hs 212;" f -listCursorChooseBorderScale src/Dodge/Render/List.hs 138;" f +listCursorChooseBorderScale src/Dodge/Render/List.hs 139;" f listGuard src/Dodge/Creature/ReaderUpdate.hs 188;" f -listSelectionColorPicture src/Dodge/DisplayInventory.hs 326;" f +listSelectionColorPicture src/Dodge/DisplayInventory.hs 330;" f litCorridor90 src/Dodge/Room/RoadBlock.hs 26;" f llleft src/Dodge/Item/Grammar.hs 107;" f llright src/Dodge/Item/Grammar.hs 114;" f @@ -5182,7 +5182,7 @@ placeSpotRoomRand src/Dodge/Placement/PlaceSpot.hs 89;" f placeSpotUsingLink src/Dodge/Placement/PlaceSpot.hs 70;" f placeString src/Dodge/Render/MenuScreen.hs 63;" f placeWallPoly src/Dodge/Placement/PlaceSpot.hs 162;" f -plainRegex src/Dodge/DisplayInventory.hs 195;" f +plainRegex src/Dodge/DisplayInventory.hs 199;" f plateCraft src/Dodge/Item/Craftable.hs 45;" f playIfFree src/Sound.hs 136;" f playPositionalSoundQueue src/Sound.hs 144;" f @@ -5412,7 +5412,7 @@ refract src/Dodge/Item/Weapon/LaserPath.hs 40;" f refreshOptionsSelectionList src/Dodge/Menu/Option.hs 39;" f regexCombs src/Dodge/DisplayInventory.hs 70;" f regexIn src/Regex.hs 4;" f -regexList src/Dodge/DisplayInventory.hs 368;" f +regexList src/Dodge/DisplayInventory.hs 372;" f regexList src/Regex.hs 7;" f reload1S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 442;" f reloadLevelStart src/Dodge/Save.hs 71;" f @@ -5432,7 +5432,7 @@ renderInfoListAt src/Dodge/Render/InfoBox.hs 17;" f renderInfoListsAt src/Dodge/Render/InfoBox.hs 44;" f renderLayer src/Render.hs 233;" f renderLightingNoShadows src/Render.hs 48;" f -renderListAt src/Dodge/Render/List.hs 195;" f +renderListAt src/Dodge/Render/List.hs 196;" f renderShadows src/Render.hs 117;" f replaceNullWith src/Dodge/Creature/ReaderUpdate.hs 160;" f replacePutID src/Dodge/Placement/Instance/Wall.hs 102;" f @@ -5583,15 +5583,15 @@ seagullWhistle1S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 372;" f seagullWhistleS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 530;" f searchIfDamaged src/Dodge/Creature/ReaderUpdate.hs 203;" f secondColumnParams src/Dodge/ListDisplayParams.hs 45;" f -sectionsDesiredLines src/Dodge/DisplayInventory.hs 204;" f -sectionsSizes src/Dodge/DisplayInventory.hs 209;" f +sectionsDesiredLines src/Dodge/DisplayInventory.hs 208;" f +sectionsSizes src/Dodge/DisplayInventory.hs 213;" f seedStartMenu src/Dodge/Menu.hs 79;" f seedStartOptions src/Dodge/Menu.hs 82;" f segOnCirc src/Geometry.hs 116;" f selNumPos src/Dodge/Render/HUD.hs 426;" f selNumPosCardinal src/Dodge/Render/HUD.hs 449;" f -selSecDrawCursor src/Dodge/Render/List.hs 128;" f -selSecDrawCursorAt src/Dodge/Render/List.hs 107;" f +selSecDrawCursor src/Dodge/Render/List.hs 129;" f +selSecDrawCursorAt src/Dodge/Render/List.hs 108;" f selSecSelCol src/Dodge/Render/HUD.hs 472;" f selSecSelSize src/Dodge/SelectionSections.hs 182;" f selSecYint src/Dodge/SelectionSections.hs 191;" f @@ -5835,8 +5835,8 @@ ssScrollUsing src/Dodge/SelectionSections.hs 51;" f ssSetCursor src/Dodge/SelectionSections.hs 72;" f ssTryLookup src/Dodge/SelectionSections.hs 81;" f ssfold src/FoldableHelp.hs 105;" f -stackPicturesAt src/Dodge/Render/List.hs 101;" f -stackPicturesAtOff src/Dodge/Render/List.hs 104;" f +stackPicturesAt src/Dodge/Render/List.hs 102;" f +stackPicturesAtOff src/Dodge/Render/List.hs 105;" f stackText src/Picture/Base.hs 188;" f stackedInventory src/Dodge/Creature.hs 281;" f startCr src/Dodge/Creature.hs 91;" f @@ -5974,7 +5974,7 @@ toLabel src/Dodge/Cleat.hs 16;" f toLasgunUpdate src/Dodge/Item/Grammar.hs 119;" f toMultiset src/Multiset.hs 64;" f toOnward src/Dodge/Tree/Compose.hs 101;" f -toTopLeft src/Dodge/Render/List.hs 222;" f +toTopLeft src/Dodge/Render/List.hs 223;" f toV2 src/Geometry/Data.hs 36;" f toV3 src/Geometry/Data.hs 38;" f toV4 src/Geometry/Data.hs 40;" f @@ -6184,8 +6184,8 @@ updateRootItemID src/Dodge/Inventory/Location.hs 35;" f updateScopeZoom src/Dodge/Update/Camera.hs 127;" f updateScopeZoom' src/Dodge/Update/Camera.hs 132;" f updateScrollTestValue src/Dodge/ScrollValue.hs 6;" f -updateSection src/Dodge/DisplayInventory.hs 275;" f -updateSectionsPositioning src/Dodge/DisplayInventory.hs 246;" f +updateSection src/Dodge/DisplayInventory.hs 279;" f +updateSectionsPositioning src/Dodge/DisplayInventory.hs 250;" f updateSeenWalls src/Dodge/Update.hs 660;" f updateShockwave src/Dodge/Shockwave/Update.hs 12;" f updateShockwaves src/Dodge/Update.hs 534;" f