Add various item info

This commit is contained in:
2023-01-03 15:58:54 +00:00
parent 6c1862b2a1
commit 5fc39bd12d
11 changed files with 310 additions and 50 deletions
+33 -26
View File
@@ -3,6 +3,7 @@ module Dodge.Render.HUD (
drawHUD,
) where
import Justify
import Control.Lens
import qualified Data.Map.Strict as M
import Data.Maybe
@@ -90,7 +91,7 @@ drawSubInventory subinv cfig w = case subinv of
ExamineInventory mtweaki ->
titledSub
"EXAMINE"
(defaultSubInvSelectionList & slItems .~ ammoTweakSelectionItems itm)
(defaultSubInvSelectionList & slItems .~ ammoTweakSelectionItems itm ++ map f (mitmInfo itm))
<> examineInventoryExtra mtweaki itm cfig
DisplayTerminal tid -> displayTerminal tid cfig (w ^. cWorld . lWorld)
CombineInventory mi ->
@@ -103,6 +104,16 @@ drawSubInventory subinv cfig w = case subinv of
invHead cfig subtitle
<> drawSelectionList secondColumnParams cfig subitems
itm = yourItem w
f str =
SelectionItem
{ _siPictures = [text str]
, _siHeight = 1
, _siIsSelectable = True
, _siWidth = length str
, _siColor = white
, _siOffX = 0
, _siPayload = ()
}
drawNoSubInventory :: Configuration -> World -> Picture
drawNoSubInventory cfig w =
@@ -139,7 +150,7 @@ examineInventoryExtra mtweaki mitm cfig =
-- consider moving this functionality out into a tweaks module
tparam <- mitm ^? _Just . itTweaks . tweakParams . ix tweaki
return $ listCursorNSW subInvX 60 cfig tweaki white (length $ showTweak tparam) 15
, drawSelectionList thirdColumnParams cfig (thirdColumnPara (itmInfo mitm))
-- , drawSelectionList thirdColumnParams cfig (thirdColumnPara (itmInfo mitm))
]
combineInventoryExtra :: Maybe Int -> Configuration -> World -> Picture
@@ -170,32 +181,28 @@ secondColumnParams =
& ldpPosY .~ 60
& ldpCursorType .~ BorderCursor [North, South, West]
thirdColumnParams :: ListDisplayParams
thirdColumnParams =
defaultListDisplayParams
& ldpPosX .~ 9 * fromIntegral topInvW + 275
& ldpPosY .~ 60
--thirdColumnParams :: ListDisplayParams
--thirdColumnParams =
-- defaultListDisplayParams
-- & ldpPosX .~ 9 * fromIntegral topInvW + 275
-- & ldpPosY .~ 60
thirdColumnPara :: [String] -> SelectionList ()
thirdColumnPara strs = SelectionList (map f strs) Nothing (length strs)
where
f str =
SelectionItem
{ _siPictures = [text str]
, _siHeight = 1
, _siIsSelectable = True
, _siWidth = length str
, _siColor = white
, _siOffX = 0
, _siPayload = ()
}
--thirdColumnPara :: [String] -> SelectionList ()
--thirdColumnPara strs = SelectionList (map f strs) Nothing (length strs)
-- where
-- f str =
-- SelectionItem
-- { _siPictures = [text str]
-- , _siHeight = 1
-- , _siIsSelectable = True
-- , _siWidth = length str
-- , _siColor = white
-- , _siOffX = 0
-- , _siPayload = ()
-- }
itmInfo :: Maybe Item -> [String]
itmInfo mit = fromMaybe [] $ do
itm <- mit
return $
itmBaseInfo (itm ^. itType . iyBase) :
(map show . M.assocs . _iyModules $ _itType itm)
mitmInfo :: Maybe Item -> [String]
mitmInfo = maybe [] $ makeParagraph 60 . itmInfo
displayTerminal :: Int -> Configuration -> LWorld -> Picture
displayTerminal tid cfig w = fromMaybe mempty $ do