Broken commit

This commit is contained in:
2023-02-17 20:20:57 +00:00
parent 1cb59d0809
commit 36b9b5445c
2 changed files with 41 additions and 33 deletions
+5 -1
View File
@@ -11,6 +11,7 @@ import Dodge.Data.Button
import Dodge.Data.FloorItem import Dodge.Data.FloorItem
import Control.Lens import Control.Lens
import Geometry.Data import Geometry.Data
import Data.IntMap.Strict (IntMap)
data HUDElement data HUDElement
= DisplayInventory = DisplayInventory
@@ -23,7 +24,10 @@ data HUDElement
data SubInventory data SubInventory
= NoSubInventory = NoSubInventory
| ExamineInventory {_subInvMSel :: Maybe Int} | ExamineInventory {_subInvMSel :: Maybe Int}
| CombineInventory {_subInvMap :: SelectionIntMap CombinableItem} -- | CombineInventory {_subInvMap :: SelectionIntMap CombinableItem}
| CombineInventory {_ciCombinations :: IntMap CombinableItem
, _ciSections :: SelectionSections CombinableItem
}
| LockedInventory | LockedInventory
| DisplayTerminal {_termID :: Int} | DisplayTerminal {_termID :: Int}
-- deriving (Eq, Ord, Show, Read) --Generic, Flat) -- deriving (Eq, Ord, Show, Read) --Generic, Flat)
+36 -32
View File
@@ -68,8 +68,8 @@ invDisplayParams w =
Just ExamineInventory{} -> True Just ExamineInventory{} -> True
_ -> False _ -> False
inventoryDisplay :: SelectionSections () -> World -> Configuration -> Picture drawSelectionSections :: SelectionSections () -> ListDisplayParams -> Configuration -> Picture
inventoryDisplay sss w cfig = listPicturesAtScaleOff drawSelectionSections sss ldps cfig = listPicturesAtScaleOff
(_ldpVerticalGap ldps) (_ldpVerticalGap ldps)
(_ldpScale ldps) (_ldpScale ldps)
(_ldpPosX ldps) (_ldpPosX ldps)
@@ -83,27 +83,29 @@ inventoryDisplay sss w cfig = listPicturesAtScaleOff
i <- sss ^? sssSelPos . _Just i <- sss ^? sssSelPos . _Just
j <- sss ^? sssSections . ix i . ssCursor . _Just . scurSel j <- sss ^? sssSections . ix i . ssCursor . _Just . scurSel
return $ selSecDrawCursor 15 [North,South,West] cfig ldps sss i j return $ selSecDrawCursor 15 [North,South,West] cfig ldps sss i j
ldps = invDisplayParams w
pics = foldMap _ssShownItems (_sssSections sss) pics = foldMap _ssShownItems (_sssSections sss)
inventoryDisplay :: SelectionSections () -> World -> Configuration -> Picture
inventoryDisplay sss w = drawSelectionSections sss (invDisplayParams w)
drawSubInventory :: SubInventory -> Configuration -> World -> Picture drawSubInventory :: SubInventory -> Configuration -> World -> Picture
drawSubInventory subinv cfig w = case subinv of drawSubInventory subinv cfig w = case subinv of
LockedInventory -> mempty -- topInvCursor col cursPos cfig w LockedInventory -> mempty -- topInvCursor col cursPos cfig w
NoSubInventory -> drawNoSubInventory cfig w NoSubInventory -> drawNoSubInventory cfig w
ExamineInventory mtweaki -> drawExamineInventory cfig mtweaki w ExamineInventory mtweaki -> drawExamineInventory cfig mtweaki w
DisplayTerminal tid -> displayTerminal tid cfig (w ^. cWorld . lWorld) DisplayTerminal tid -> displayTerminal tid cfig (w ^. cWorld . lWorld)
CombineInventory sl -> titledSub' cfig "COMBINE" sl CombineInventory _ sss -> titledSub' cfig "COMBINE" sss
<> combineInventoryExtra sl (_smSelPos sl) cfig w <> combineInventoryExtra sss cfig w
titledSub :: Configuration -> String -> SelectionList a -> Picture titledSub :: Configuration -> String -> SelectionSections a -> Picture
titledSub cfig subtitle subitems = titledSub cfig subtitle sss =
invHead cfig subtitle invHead cfig subtitle
<> drawSelectionList secondColumnParams cfig subitems <> drawSelectionList sss secondColumnParams cfig
titledSub' :: Configuration -> String -> SelectionIntMap a -> Picture titledSub' :: Configuration -> String -> SelectionSections a -> Picture
titledSub' cfig subtitle subitems = titledSub' cfig subtitle subitems =
invHead cfig subtitle invHead cfig subtitle
<> drawSelectionMap secondColumnParams cfig subitems <> drawSelectionSections secondColumnParams cfig subitems
drawExamineInventory :: Configuration -> Maybe Int -> World -> Picture drawExamineInventory :: Configuration -> Maybe Int -> World -> Picture
drawExamineInventory cfig mtweaki w = drawExamineInventory cfig mtweaki w =
@@ -175,28 +177,30 @@ examineInventoryExtra mtweaki mitm cfig = fromMaybe mempty $ do
return $ listCursorNSW subInvX 60 cfig tweaki 0 white (length $ showTweak tparam) 15 return $ listCursorNSW subInvX 60 cfig tweaki 0 white (length $ showTweak tparam) 15
-- , drawSelectionList thirdColumnParams cfig (thirdColumnPara (itmInfo mitm)) -- , drawSelectionList thirdColumnParams cfig (thirdColumnPara (itmInfo mitm))
combineInventoryExtra :: SelectionIntMap CombinableItem -> Maybe Int -> Configuration -> World -> Picture --combineInventoryExtra :: SelectionIntMap CombinableItem -> Maybe Int -> Configuration -> World -> Picture
combineInventoryExtra sm mi cfig w = fromMaybe mempty $ do combineInventoryExtra :: SelectionSections CombinableItem -> Configuration -> World -> Picture
i <- mi combineInventoryExtra sss cfig w = mempty
let cpos = getIthPos i (sm ^. smShownItems) -- fromMaybe mempty $ do
col <- sm ^? smShownItems . ix i . siColor -- i <- mi
return $ -- let cpos = getIthPos i (sm ^. smShownItems)
pictures -- col <- sm ^? smShownItems . ix i . siColor
[ fromMaybe mempty $ do -- return $
strs <- sm ^? smShownItems . ix i . siPayload . ciInfo -- pictures
return $ listPicturesAtOff (subInvX + 150) 60 cfig cpos $ map (color red . text) strs -- [ fromMaybe mempty $ do
, fromMaybe mempty $ do -- strs <- sm ^? smShownItems . ix i . siPayload . ciInfo
lnks <- sm ^? smShownItems . ix i . siPayload . ciInvIDs -- return $ listPicturesAtOff (subInvX + 150) 60 cfig cpos $ map (color red . text) strs
return $ -- , fromMaybe mempty $ do
lnkMidPosInvSelsCol cfig w cpos col lnks -- lnks <- sm ^? smShownItems . ix i . siPayload . ciInvIDs
-- <> foldMap (topCursorTypeWidth listCursorNESW (topInvW + 2) cfig w) lnks -- return $
<> foldMap invcursor lnks -- lnkMidPosInvSelsCol cfig w cpos col lnks
<> combineCounts cfig w lnks -- -- <> foldMap (topCursorTypeWidth listCursorNESW (topInvW + 2) cfig w) lnks
] -- <> foldMap invcursor lnks
where -- <> combineCounts cfig w lnks
invcursor i = fromMaybe mempty $ do -- ]
sss <- w ^? hud . hudElement . diSections -- where
return $ selSecDrawCursor 17 [North,South,East] cfig (invDisplayParams w) sss 0 i -- invcursor i = fromMaybe mempty $ do
-- sss <- w ^? hud . hudElement . diSections
-- return $ selSecDrawCursor 17 [North,South,East] cfig (invDisplayParams w) sss 0 i
secondColumnParams :: ListDisplayParams secondColumnParams :: ListDisplayParams
secondColumnParams = secondColumnParams =