diff --git a/src/Dodge/Combine.hs b/src/Dodge/Combine.hs index dcbce0144..eeed56d25 100644 --- a/src/Dodge/Combine.hs +++ b/src/Dodge/Combine.hs @@ -140,8 +140,7 @@ toggleCombineInv uv = case uv ^? uvWorld . hud . hudElement . subInventory of enterCombineInv :: Configuration -> World -> World enterCombineInv cfig w = w & hud . hudElement . subInventory .~ CombineInventory cm' - Nothing - sss + FilterableSections {_fssFilters=IM.singleton (-1) Nothing,_fssSections = sss} --(updateCombineSelections w cfig sss) where cm' = IM.fromAscList $ zip [0..] $ combineList' w diff --git a/src/Dodge/Data/HUD.hs b/src/Dodge/Data/HUD.hs index efae69cf9..e0aa73e3e 100644 --- a/src/Dodge/Data/HUD.hs +++ b/src/Dodge/Data/HUD.hs @@ -16,20 +16,16 @@ import Data.IntMap.Strict (IntMap) data HUDElement = DisplayInventory { _subInventory :: SubInventory - , _diSections :: SelectionSections () - , _invRegex :: Maybe String - , _closeRegex :: Maybe String + , _diSections :: FilterableSections () } | DisplayCarte --- deriving (Eq, Ord, Show, Read) --Generic, Flat) data SubInventory = NoSubInventory | ExamineInventory {_subInvMSel :: Maybe Int} -- | CombineInventory {_subInvMap :: SelectionIntMap CombinableItem} | CombineInventory {_ciCombinations :: IntMap (SelectionItem CombinableItem) - , _ciRegex :: Maybe String - , _ciSections :: SelectionSections CombinableItem + , _ciSections :: FilterableSections CombinableItem } | LockedInventory | DisplayTerminal {_termID :: Int} diff --git a/src/Dodge/Data/SelectionList.hs b/src/Dodge/Data/SelectionList.hs index 9446a070d..6aeecb580 100644 --- a/src/Dodge/Data/SelectionList.hs +++ b/src/Dodge/Data/SelectionList.hs @@ -44,7 +44,6 @@ data SelectionSections a = SelectionSections } data SectionCursor = SectionCursor - --{ _scurSel :: Int { _scurPos :: Int , _scurSize :: Int , _scurColor :: Color diff --git a/src/Dodge/Default/World.hs b/src/Dodge/Default/World.hs index 732b25ebb..d52d6257c 100644 --- a/src/Dodge/Default/World.hs +++ b/src/Dodge/Default/World.hs @@ -162,9 +162,9 @@ defaultHUD = defaultDisplayInventory :: HUDElement defaultDisplayInventory = DisplayInventory {_subInventory = NoSubInventory - , _diSections = defaultInvSections - , _invRegex = Nothing - , _closeRegex = Nothing + , _diSections = defaultFiltInv +-- , _invRegex = Nothing +-- , _closeRegex = Nothing } --youLight :: TempLightSource --youLight = TLS @@ -179,13 +179,20 @@ defaultDisplayInventory = DisplayInventory -- where -- f (V2 x y) = V3 x y 100 +defaultFiltInv :: FilterableSections () +defaultFiltInv = FilterableSections + {_fssFilters = IM.fromList [(-1,mempty),(2,mempty)] + ,_fssSections =defaultInvSections + } + defaultInvSections :: SelectionSections () defaultInvSections = SelectionSections { _sssSections = IM.fromDistinctAscList $ zip [-1..] [ defaultFiltSection , defaultInvSection , defaultYouSection - , defaultFiltSection + , (defaultFiltSection & ssIndent .~ 2 + & ssDescriptor .~ "NEARBY") , defaultCOSection ] , _sssSelPos = Nothing @@ -201,7 +208,6 @@ defaultSS = SelectionSection , _ssDescriptor = "" } - defaultCOSection :: SelectionSection () defaultCOSection = defaultSS & ssIndent .~ 2 diff --git a/src/Dodge/DisplayInventory.hs b/src/Dodge/DisplayInventory.hs index 2a693e493..f5ad63202 100644 --- a/src/Dodge/DisplayInventory.hs +++ b/src/Dodge/DisplayInventory.hs @@ -38,8 +38,8 @@ updateDisplayInventory w cfig sss = case cr ^? crManipulation . manObject of SelNothing -> reverse [filtinv,filtclose,invx ,youx, closex] InNearby SortNearby -> reverse [filtinv,filtclose,closex, invx ,youx] InNearby SelCloseObject {} -> reverse [filtinv,filtclose,closex, invx ,youx] - (filtinv,invx) = filtpair (-1) (hud . hudElement . invRegex . _Just) invitems' "INV. " - (filtclose,closex) = filtpair 2 (hud . hudElement . closeRegex . _Just) coitems' "NEARBY " + (filtinv,invx) = filtpair (-1) (hud . hudElement . diSections . fssFilters . ix (-1) . _Just) invitems' "INV. " + (filtclose,closex) = filtpair 2 (hud . hudElement . diSections . fssFilters . ix 2 . _Just) coitems' "NEARBY " youx = (1, youitems) youitems = IM.singleton 0 $ SelectionItem [thetext] 1 True invDimColor 2 () thetext = displayFreeSlots nfreeslots diff --git a/src/Dodge/InputFocus.hs b/src/Dodge/InputFocus.hs index eeb2f961e..f52c14815 100644 --- a/src/Dodge/InputFocus.hs +++ b/src/Dodge/InputFocus.hs @@ -20,19 +20,19 @@ inTermFocus w = fromMaybe False $ do inInvRegex :: World -> Bool inInvRegex w = fromMaybe False $ do - sss <- w ^? hud . hudElement . diSections + sss <- w ^? hud . hudElement . diSections . fssSections i <- sss ^? sssSelPos . _Just . _1 return $ i == (-1) inCloseRegex :: World -> Bool inCloseRegex w = fromMaybe False $ do - sss <- w ^? hud . hudElement . diSections + sss <- w ^? hud . hudElement . diSections . fssSections i <- sss ^? sssSelPos . _Just . _1 return $ i == 2 inSubInvRegex :: World -> Bool inSubInvRegex w = fromMaybe False $ do - sss <- w ^? hud . hudElement . subInventory . ciSections + sss <- w ^? hud . hudElement . subInventory . ciSections . fssSections i <- sss ^? sssSelPos . _Just . _1 return $ i == (-1) diff --git a/src/Dodge/Inventory.hs b/src/Dodge/Inventory.hs index d281acf44..c499b8d4f 100644 --- a/src/Dodge/Inventory.hs +++ b/src/Dodge/Inventory.hs @@ -106,7 +106,7 @@ rmSelectedInvItem cid w = case w ^? cWorld . lWorld . creatures . ix cid . crMan Nothing -> w selNumPos :: ManipulatedObject -> World -> Maybe Int -selNumPos mo w = w ^? hud . hudElement . diSections >>= +selNumPos mo w = w ^? hud . hudElement . diSections . fssSections >>= case mo of InInventory SortInventory -> selSecSelPos (-1) 0 InInventory (SelItem i _) -> selSecSelPos 0 i @@ -164,7 +164,7 @@ updateCloseObjects w = = case w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject. inNearby . ispCloseObject of Just i | i >= length newcloseobjects -> scrollAugInvSel 1 - | isNothing (w ^? hud . hudElement . diSections . sssSections . ix 3 . ssItems . ix i) + | isNothing (w ^? hud . hudElement . diSections . fssSections . sssSections . ix 3 . ssItems . ix i) -> scrollAugInvSel (-1) _ -> id filt = filter $ \obj -> dist ypos (closeObjPos obj) < 40 && hasButtonLOS ypos (closeObjPos obj) w @@ -346,7 +346,7 @@ scrollAugInvSel :: Int -> World -> World scrollAugInvSel yi w | yi == 0 = w | otherwise = - w & hud . hudElement . diSections %~ scrollSelectionSections yi + w & hud . hudElement . diSections . fssSections %~ scrollSelectionSections yi & setInvPosFromSS setInvPosFromSS :: World -> World @@ -354,9 +354,8 @@ setInvPosFromSS w = w & cWorld . lWorld . creatures . ix 0 . crManipulation . manObject .~ thesel where thesel = fromMaybe SelNothing $ do - sss <- w ^? hud . hudElement . diSections + sss <- w ^? hud . hudElement . diSections . fssSections (i,j) <- sss ^? sssSelPos . _Just --- j <- sss ^? sssSections . ix i . ssCursor . _Just . scurSel case i of (-1) -> Just $ InInventory SortInventory 0 -> Just $ InInventory (SelItem j NoInvSelAction) @@ -369,5 +368,5 @@ setInvPosFromSS w = w selectedCloseObject :: World -> Maybe (Either FloorItem Button) selectedCloseObject w = do i <- you w ^? crManipulation . manObject . inNearby . ispCloseObject - <|> fmap fst (IM.lookupMin =<< w ^? hud . hudElement . diSections . sssSections . ix 3 . ssItems) + <|> fmap fst (IM.lookupMin =<< w ^? hud . hudElement . diSections . fssSections . sssSections . ix 3 . ssItems) w ^? hud . closeObjects . ix i diff --git a/src/Dodge/Render/HUD.hs b/src/Dodge/Render/HUD.hs index 600205973..2f75943b6 100644 --- a/src/Dodge/Render/HUD.hs +++ b/src/Dodge/Render/HUD.hs @@ -38,7 +38,7 @@ drawHUD cfig w = case w ^. hud . hudElement of DisplayCarte -> drawCarte cfig w DisplayInventory {_diSections = sections, _subInventory = subinv} -> drawHP cfig w - <> inventoryDisplay sections w cfig + <> inventoryDisplay (sections ^. fssSections) w cfig <> drawSubInventory subinv cfig w drawHP :: Configuration -> World -> Picture @@ -93,7 +93,8 @@ drawSubInventory subinv cfig w = case subinv of NoSubInventory -> drawNoSubInventory cfig w ExamineInventory mtweaki -> drawExamineInventory cfig mtweaki w DisplayTerminal tid -> displayTerminal tid cfig (w ^. cWorld . lWorld) - CombineInventory _ _ sss -> titledSub' cfig "COMBINE" sss + CombineInventory {_ciSections = FilterableSections {_fssSections = sss}} + -> titledSub' cfig "COMBINE" sss <> combineInventoryExtra sss cfig w titledSub :: Configuration -> String -> SelectionList a -> Picture @@ -155,11 +156,11 @@ drawNoSubInventory cfig w = where equipcursor = fromMaybe mempty $ do invid <- cr ^. crLeftInvSel . lisMPos - sss <- w ^? hud . hudElement . diSections + sss <- w ^? hud . hudElement . diSections . fssSections pos <- selSecSelPos 0 invid sss return $ listTextPictureAt 144 0 cfig pos . color cyan . text . eqPosText $_crInvEquipped cr IM.! invid f col invid epos = fromMaybe mempty $ do - sss <- w ^? hud . hudElement . diSections + sss <- w ^? hud . hudElement . diSections . fssSections pos <- selSecSelPos 0 invid sss return $ listTextPictureAt 144 0 cfig pos . color col $ text $ eqPosText epos equipcursors = IM.foldMapWithKey (f yellow) (_crInvEquipped cr) @@ -196,7 +197,7 @@ combineInventoryExtra sss cfig w = fromMaybe mempty $ do ] where invcursor i = fromMaybe mempty $ do - sss' <- w ^? hud . hudElement . diSections + sss' <- w ^? hud . hudElement . diSections . fssSections return $ selSecDrawCursor 17 [North,South,East] cfig (invDisplayParams w) sss' 0 i -- fromMaybe mempty $ do -- i <- mi @@ -323,7 +324,7 @@ combineCounts cfig w = winScale cfig . foldMap f . group where f (i : is) = fromMaybe mempty $ do _ <- yourInv w ^? ix i . itUse . useAmount - sss <- w ^? hud . hudElement . diSections + sss <- w ^? hud . hudElement . diSections . fssSections p <- selNumTextEndPos cfig (invDisplayParams w) sss 0 i col <- selSecSelCol 0 i sss return $ color col $ uncurryV translate p . scale 0.1 0.1 . text $ ('-' : show (length is + 1)) @@ -334,7 +335,7 @@ lnkMidPosInvSelsCol cfig w i col = winScale cfig . foldMap f where f j = fromMaybe mempty $ do - sss <- w ^? hud . hudElement . diSections + sss <- w ^? hud . hudElement . diSections . fssSections h <- selNumEndMidHeight cfig (invDisplayParams w) sss 0 j invcol <- selSecSelCol 0 j sss return $ zConnectCol rp (V2 18 0 + h) col white white invcol diff --git a/src/Dodge/TestString.hs b/src/Dodge/TestString.hs index 3eccb7530..13223863e 100644 --- a/src/Dodge/TestString.hs +++ b/src/Dodge/TestString.hs @@ -10,7 +10,7 @@ import Dodge.Data.Universe import qualified IntMapHelp as IM testStringInit :: Universe -> [String] testStringInit u = - [show $ fmap IM.keys $ u ^? uvWorld . hud . hudElement . diSections . sssSections] + [show $ fmap IM.keys $ u ^? uvWorld . hud . hudElement . diSections . fssSections . sssSections] --[ show $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crManipulation ++ lines (unpack $ AEP.encodePretty' (AEP.Config (AEP.Spaces 2) compare AEP.Generic False) $ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crManipulation) diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index da5a10764..384a5736f 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -82,7 +82,7 @@ updateUniverse u = cfig = u ^. uvConfig updateInventoryDisplay :: Universe -> Universe -updateInventoryDisplay u = u & uvWorld . hud . hudElement . diSections +updateInventoryDisplay u = u & uvWorld . hud . hudElement . diSections . fssSections %~ updateDisplayInventory (_uvWorld u) (_uvConfig u) maybeOpenTerminal :: Universe -> Universe diff --git a/src/Dodge/Update/Input.hs b/src/Dodge/Update/Input.hs index fe8761911..7467375a2 100644 --- a/src/Dodge/Update/Input.hs +++ b/src/Dodge/Update/Input.hs @@ -2,6 +2,7 @@ module Dodge.Update.Input ( updateUseInput, ) where +--import Control.Monad import Data.List (sort) import Dodge.Inventory.Add import Dodge.Data.Combine @@ -16,7 +17,7 @@ import Data.Char import qualified Data.IntMap.Strict as IM import qualified Data.Map.Strict as M import Data.Maybe -import Data.Monoid (First) +--import Data.Monoid (First) import Dodge.Base.You import Dodge.Button.Event import Dodge.Combine @@ -48,18 +49,18 @@ updateUseInputOnScreen sl = case sl of updateUseInputInGame :: HUDElement -> Universe -> Universe updateUseInputInGame h u = case h of DisplayCarte -> over uvWorld updatePressedButtonsCarte u - DisplayInventory si _ _ _ -> case si of + DisplayInventory {_subInventory = si} -> case si of DisplayTerminal tmid | lbinitialpress && inTermFocus w -> over uvWorld (doTerminalEffectLB (w ^?! cWorld . lWorld . terminals . ix tmid)) u | inTermFocus (_uvWorld u) -> updateKeysInTerminal tmid u | lbinitialpress -> u & uvWorld . cWorld . lWorld . terminals . ix tmid . tmInput . tiFocus %~ const True - CombineInventory _ _ sss - | inSubInvRegex (u ^. uvWorld) -> doSubInvRegexInput u + CombineInventory {_ciSections = FilterableSections {_fssSections = sss}} + | inSubInvRegex (u ^. uvWorld) -> u & uvWorld . hud . hudElement . subInventory . ciSections %~ doRegexInput u (-1) | lbinitialpress -> maybeExitCombine $ over uvWorld (tryCombine sss) u - _ | inInvRegex (u ^. uvWorld) -> doRegexInput (-1) invRegex invRegex u - _ | inCloseRegex (u ^. uvWorld) -> doRegexInput 2 closeRegex closeRegex u + _ | inInvRegex (u ^. uvWorld) -> u & uvWorld . hud . hudElement . diSections %~ doRegexInput u (-1) + _ | inCloseRegex (u ^. uvWorld) -> u & uvWorld . hud . hudElement . diSections %~ doRegexInput u 2 _ -> M.foldlWithKey' updateKeyInGame u pkeys where w = u ^. uvWorld @@ -80,11 +81,21 @@ maybeExitCombine u | otherwise = u & uvWorld . hud . hudElement . subInventory .~ NoSubInventory doTextInputOver :: ASetter' Universe String -> Universe -> Universe -doTextInputOver p u = - u & p %~ (++ map toUpper thetext) +doTextInputOver p u = doTextInputOver' u p u +-- u & p %~ (++ map toUpper thetext) +-- & checkBackspace +-- where +-- thetext = u ^. uvWorld . input . textInput +-- checkBackspace +-- | backspaceInputted u = p %~ doBackspace +-- | otherwise = id + +doTextInputOver' :: Universe -> ASetter' a String -> a -> a +doTextInputOver' u p x = + x & p %~ (++ map toUpper str) & checkBackspace where - thetext = u ^. uvWorld . input . textInput + str = u ^. uvWorld . input . textInput checkBackspace | backspaceInputted u = p %~ doBackspace | otherwise = id @@ -99,68 +110,22 @@ backspaceInputted u = case u ^. uvWorld . input . pressedKeys . at ScancodeBacks Just LongPress -> True _ -> False -doSubInvRegexInput :: Universe -> Universe -doSubInvRegexInput u - | backspacetonothing = - u & uvWorld . hud . hudElement . subInventory . ciRegex .~ Nothing --- & uvWorld . hud . hudElement . subInventory . subInvMap %~ initialSelPos --- & uvWorld . hud . hudElement . subInventory . subInvMap %~ setShownIntMap - | endkeys || endmouse = u --- u & uvWorld . hud . hudElement . subInventory . subInvMap %~ initialSelPos - | otherwise = - u & doTextInputOver (uvWorld . hud . hudElement . subInventory . ciRegex . _Just) --- & uvWorld . hud . hudElement . subInventory . subInvMap %~ setShownIntMap +doRegexInput :: Universe -> Int -> FilterableSections a -> FilterableSections a +doRegexInput u i fss + | backspacetonothing || escapekey = endregex i 0 + | endkeys || endmouse = endregex (i + 1) (j -1) + | otherwise = fss & doTextInputOver' u (fssFilters . ix i . _Just) where - endkeys = - any - ((== Just InitialPress) . (`M.lookup` pkeys)) - [ScancodeReturn, ScancodeEscape, ScancodeSlash] - endmouse = Just True == (u ^? uvWorld . input . mouseButtons . ix ButtonLeft) - backspacetonothing = - u ^? uvWorld . hud . hudElement . subInventory . ciRegex . _Just == Just "" - && ScancodeBackspace `M.lookup` pkeys == Just InitialPress - pkeys = u ^. uvWorld . input . pressedKeys - ---doRegexInput :: --- Int -> --- ( (Maybe String -> Identity (Maybe String)) -> --- Manipulation -> --- Identity Manipulation --- ) -> --- ( ( Maybe String -> --- Const (First String) (Maybe String) --- ) -> --- Manipulation -> --- Const (First String) Manipulation --- ) -> --- Universe -> --- Universe -doRegexInput :: Int - -> ((Maybe String -> Identity (Maybe String)) - -> HUDElement -> Identity HUDElement) - -> ((Maybe String - -> Const (Data.Monoid.First String) (Maybe String)) - -> HUDElement -> Const (Data.Monoid.First String) HUDElement) - -> Universe - -> Universe -doRegexInput i crregex crregex' u - | backspacetonothing || escapekey = closeregex i 0 - | endkeys || endmouse = closeregex (i + 1) (j -1) - | otherwise = - u - & doTextInputOver - (uvWorld . hud . hudElement . crregex . _Just) - where - closeregex a b = - u - & uvWorld . hud . hudElement . crregex .~ Nothing - & uvWorld . hud . hudElement . diSections + endregex a b = + fss + & fssFilters . ix i .~ Nothing + & fssSections %~ ( ssSetCursor (ssLookupDown a b) - . overSection (ssItems . at i .~ Nothing) + . (sssSections . ix i . ssItems .~ mempty) ) - & uvWorld %~ setInvPosFromSS +-- & uvWorld %~ setInvPosFromSS j = fromMaybe 0 $ do - itms <- u ^? uvWorld . hud . hudElement . diSections . sssSections . ix (i + 1) . ssItems + itms <- fss ^? fssSections . sssSections . ix (i + 1) . ssItems fst <$> IM.lookupMin itms escapekey = ScancodeEscape `M.lookup` pkeys == Just InitialPress endkeys = @@ -169,7 +134,7 @@ doRegexInput i crregex crregex' u [ScancodeReturn, ScancodeSlash] endmouse = Just True == (u ^? uvWorld . input . mouseButtons . ix ButtonLeft) backspacetonothing = - u ^? uvWorld . hud . hudElement . crregex' . _Just == Just "" + fss ^? fssFilters . ix i . _Just == Just "" && ScancodeBackspace `M.lookup` pkeys == Just InitialPress pkeys = u ^. uvWorld . input . pressedKeys @@ -228,34 +193,24 @@ updateLongPressInGame uv sc = case sc of ScancodeSpace -> over uvWorld spaceAction uv _ -> uv --- doesn't seem to set cursor positioning updateBackspaceRegex :: World -> World updateBackspaceRegex w = case di ^? subInventory of - Just NoSubInventory | secfocus (-1) 0 -> w & trybackspace - Just NoSubInventory | secfocus 2 3 -> w & trybackspaceclose - Just CombineInventory{} -> w & hud . hudElement . subInventory %~ trybackspacecomb + Just NoSubInventory | secfocus (-1) 0 -> w & hud . hudElement . diSections %~ trybackspace (-1) + Just NoSubInventory | secfocus 2 3 -> w & hud . hudElement . diSections %~ trybackspace 2 + Just CombineInventory{} -> w & hud . hudElement . subInventory . ciSections %~ trybackspace (-1) _ -> w where secfocus a b = fromMaybe False $ do - i <- di ^? diSections . sssSelPos . _Just . _1 + i <- di ^? diSections . fssSections . sssSelPos . _Just . _1 return $ i == a || i == b - trybackspacecomb ci = case ci ^? ciRegex . _Just of - Just (_ : _) -> - ci & ciRegex . _Just %~ init - Just [] -> ci & ciRegex .~ Nothing - Nothing -> ci - trybackspace w' = case w' ^? hud . hudElement . invRegex . _Just of - Just (_ : _) -> - w' & hud . hudElement . invRegex . _Just %~ init - & cWorld . lWorld . creatures . ix 0 . crManipulation . manObject .~ InInventory SortInventory - Just [] -> w' & hud . hudElement . invRegex .~ Nothing - Nothing -> w' - trybackspaceclose w' = case w' ^? hud . hudElement . closeRegex . _Just of - Just (_ : _) -> - w' & hud . hudElement . closeRegex . _Just %~ init - & cWorld . lWorld . creatures . ix 0 . crManipulation . manObject .~ InNearby SortNearby - Just [] -> w' & hud . hudElement . closeRegex .~ Nothing - Nothing -> w' + trybackspace x fss = fromMaybe fss $ do +-- i <- fss ^? fssSections . sssSelPos . _Just . _1 +-- guard (i == x || i == x+1) + str <- fss ^? fssFilters . ix x . _Just + return $ case str of + (_ : _) -> fss & fssFilters . ix x . _Just %~ init + & fssSections . sssSelPos ?~ (x,0) + [] -> fss & fssFilters . ix x .~ Nothing di = w ^. hud . hudElement updateEnterRegex :: World -> World @@ -264,26 +219,26 @@ updateEnterRegex w = case w ^? hud . hudElement . subInventory of | secfocus (-1) 0 -> w & cWorld . lWorld . creatures . ix 0 . crManipulation . manObject .~ InInventory SortInventory - & hud . hudElement . invRegex %~ enterregex + & hud . hudElement . diSections . fssFilters . ix (-1) %~ enterregex Just NoSubInventory | secfocus 2 3 -> w & cWorld . lWorld . creatures . ix 0 . crManipulation . manObject .~ InNearby SortNearby - & hud . hudElement . closeRegex %~ enterregex - Just CombineInventory{} -> w & hud . hudElement . subInventory - %~ ( ciRegex %~ enterregex ) + & hud . hudElement . diSections . fssFilters . ix 2 %~ enterregex + Just CombineInventory{} -> w & hud . hudElement . subInventory . ciSections . fssFilters . ix (-1) + %~ enterregex _ -> w where di = w ^. hud . hudElement secfocus a b = fromMaybe False $ do - i <- di ^? diSections . sssSelPos . _Just . _1 + i <- di ^? diSections . fssSections . sssSelPos . _Just . _1 return $ i == a || i == b enterregex Nothing = Just "" enterregex x = x -overSection :: (SelectionSection a -> SelectionSection a) -> SelectionSections a -> SelectionSections a -overSection f sss = fromMaybe sss $ do - i <- sss ^? sssSelPos . _Just . _1 - return $ sss & sssSections . ix i %~ f +--overSection :: (SelectionSection a -> SelectionSection a) -> SelectionSections a -> SelectionSections a +--overSection f sss = fromMaybe sss $ do +-- i <- sss ^? sssSelPos . _Just . _1 +-- return $ sss & sssSections . ix i %~ f pauseGame :: Universe -> Universe pauseGame u = u & uvScreenLayers .~ [pauseMenu u] @@ -306,8 +261,7 @@ spaceAction w = case w ^?! hud . hudElement of toggleMap :: Universe -> Universe toggleMap u = case u ^?! uvWorld . hud . hudElement of DisplayCarte -> u & uvWorld . hud . hudElement - .~ DisplayInventory{_subInventory = NoSubInventory, _diSections = defaultInvSections - , _invRegex = Nothing, _closeRegex = Nothing} + .~ DisplayInventory{_subInventory = NoSubInventory, _diSections = defaultFiltInv} _ -> u & uvWorld . hud . hudElement .~ DisplayCarte toggleTweakInv :: World -> World diff --git a/src/Dodge/Update/Scroll.hs b/src/Dodge/Update/Scroll.hs index 608bf7f6c..24da00fe9 100644 --- a/src/Dodge/Update/Scroll.hs +++ b/src/Dodge/Update/Scroll.hs @@ -49,7 +49,7 @@ updateWheelEvent yi w = case w ^. hud . hudElement of invKeyDown = ScancodeCapsLock `M.member` _pressedKeys (_input w) moveCombineSel :: Int -> World -> World -moveCombineSel yi = hud . hudElement . subInventory . ciSections +moveCombineSel yi = hud . hudElement . subInventory . ciSections . fssSections %~ scrollSelectionSections yi moveSubSel :: Int -> Int -> World -> World