From c0dcb4a5ecc5edea9b3f98482553ee8d50453e5e Mon Sep 17 00:00:00 2001 From: justin Date: Thu, 17 Feb 2022 20:35:34 +0000 Subject: [PATCH] Add "equipped" text --- src/Dodge/Inventory.hs | 8 ++++++++ src/Dodge/Render/HUD.hs | 10 ++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Dodge/Inventory.hs b/src/Dodge/Inventory.hs index 31ef7e830..a9003c8c6 100644 --- a/src/Dodge/Inventory.hs +++ b/src/Dodge/Inventory.hs @@ -5,6 +5,7 @@ module Dodge.Inventory , invSelPos , invSelSize , selNumPos + , selNumTextPos , selNumCol , selNumSlots , selNumMidHeight @@ -93,6 +94,13 @@ selNumPos i w = splitgap + (foldl' (+) 0 . fst $ IM.split i (augmentedInvSizes w | i < length (yourInv w) = 0 | otherwise = 1 +selNumTextPos :: Configuration -> World -> Int -> Point2 +selNumTextPos cfig w i = V2 (150 - hw) ( hh + 20 * fromIntegral ipos + 7.5) + where + hh = halfHeight cfig + hw = halfWidth cfig + ipos = selNumPos i w + selNumMidHeight :: Configuration -> World -> Int -> Point2 selNumMidHeight cfig w i = V2 (150 - hw) ( hh + bump - (20 * fromIntegral ipos + 7.5)) where diff --git a/src/Dodge/Render/HUD.hs b/src/Dodge/Render/HUD.hs index 480be27aa..19998d0cf 100644 --- a/src/Dodge/Render/HUD.hs +++ b/src/Dodge/Render/HUD.hs @@ -48,7 +48,7 @@ inventoryDisplay cfig w = listTextPicturesAt 0 0 cfig invlist cr = you w inv = _crInv cr invlist = concatMap itemText (IM.elems inv) - ++ displayFreeSlots + ++ displayFreeSlots ++ map floorItemsColor (concatMap (closeObjectToTextPictures nfreeslots) (_closeObjects w)) floorItemsColor | _inventoryMode w == TopInventory = id @@ -60,11 +60,9 @@ inventoryDisplay cfig w = listTextPicturesAt 0 0 cfig invlist x -> [color invDimColor . text $ " +" ++ show x ++ " FREE SLOTS"] equipcursor = case _crLeftInvSel cr of Nothing -> mempty - Just invid -> listCursorNES 0 0 cfig (selNumPos invid w) yellow topInvW - (selNumSlots invid w) - equipcursors = foldMap f (IS.toList $ _crInvEquipped cr) - where - f ei = listCursorNES 5 5 cfig (selNumPos ei w) blue topInvW (selNumSlots ei w) + Just invid -> f cyan invid + equipcursors = foldMap (f yellow) (IS.toList $ _crInvEquipped cr) + f col invid = listTextPictureAt 144 0 cfig (selNumPos invid w) . color col $ text "EQUIPPED" subInventoryDisplay :: Configuration -> World -> Picture