Commit before trying to deal with leak in main inventory display

This commit is contained in:
2025-01-04 12:58:36 +00:00
parent 3b452b9002
commit 89eed0d059
11 changed files with 180155 additions and 504877 deletions
+3
View File
@@ -25,6 +25,9 @@ data ItemType
| MAPPER
| DROPPER InventoryPathing
| CLICKER InventoryPathing
| COPIER InventoryPathing
| UGATE
| BGATE
| INTROSCAN {_ibtIntroScanType :: IntroScanType}
| DETECTOR {_ibtDetector :: Detector}
| ARHUD
+15 -17
View File
@@ -2,9 +2,9 @@
--{-# LANGUAGE TupleSections #-}
module Dodge.DisplayInventory (
toggleCombineInv,
updateInventoryPositioning,
updateCombinePositioning,
toggleCombineInv,
) where
import Control.Applicative
@@ -32,12 +32,6 @@ import Dodge.SelectionSections
import qualified ListHelp as List
import Picture.Base
toggleCombineInv :: Universe -> Universe
toggleCombineInv uv =
uv & case uv ^? uvWorld . hud . hudElement . subInventory of
Just CombineInventory{} -> uvWorld . hud . hudElement . subInventory .~ NoSubInventory
_ -> uvWorld %~ enterCombineInv (uv ^. uvConfig)
updateCombinePositioning :: Universe -> Universe
updateCombinePositioning u =
u
@@ -341,16 +335,23 @@ updateSection indent mcsel sis availablelines oldoffset =
.~ color moredowncolor (text . replicate 15 $ toEnum 31)
| otherwise = id
moredowncolor = fromMaybe white $ allstrings ^? ix (offset + availablelines - 1) . _1
allstrings = listSelectionColorPicture sis
allstrings = foldMap listSelectionColorPicture sis
shownstrings = drop offset allstrings
listSelectionColorPicture :: Foldable t => t (SelectionItem a) -> [(Color, Picture)]
listSelectionColorPicture = foldMap f
listSelectionColorPicture :: SelectionItem a -> [(Color, Picture)]
listSelectionColorPicture si = g <$> _siPictures si
where
f si = map g (_siPictures si)
where
indent = 100 * fromIntegral (_siOffX si)
g str = (_siColor si, translate indent 0 . color (_siColor si) $ text str)
g str = (_siColor si, translate lindent 0 . color (_siColor si) $ text str)
lindent = 100 * fromIntegral (_siOffX si)
regexList :: String -> [String] -> Bool
regexList x = any (List.isInfixOf x)
toggleCombineInv :: Universe -> Universe
toggleCombineInv uv =
uv & case uv ^? uvWorld . hud . hudElement . subInventory of
Just CombineInventory{} -> uvWorld . hud . hudElement . subInventory .~ NoSubInventory
_ -> uvWorld %~ enterCombineInv (uv ^. uvConfig)
enterCombineInv :: Configuration -> World -> World
enterCombineInv cfig w =
@@ -387,6 +388,3 @@ enterCombineInv cfig w =
availablelines
0
availablelines = getAvailableListLines secondColumnParams cfig
regexList :: String -> [String] -> Bool
regexList x = any (List.isInfixOf x)
+3
View File
@@ -32,6 +32,9 @@ itemFromBase = \case
ARHUD -> arHUD
DROPPER x -> dropper x
CLICKER x -> clicker x
COPIER x -> copier x
BGATE -> bgate
UGATE -> ugate
itemFromAmmoMag :: AmmoMagType -> Item
itemFromAmmoMag at = case at of
+3
View File
@@ -73,6 +73,9 @@ itemBaseName = \case
ARHUD -> "AR-HUD"
DROPPER x -> "DROPPER-" ++ showInventoryPathing x
CLICKER x -> "CLICKER-" ++ showInventoryPathing x
COPIER x -> "COPIER-" ++ showInventoryPathing x
BGATE -> "BGATE"
UGATE -> "UGATE"
showInventoryPathing :: InventoryPathing -> String
showInventoryPathing = \case
+3
View File
@@ -48,6 +48,9 @@ itemSPic it = case it ^. itType of
DETECTOR dt -> noPic (colorSH (detectorColor dt) $ upperPrismPolySU 3 $ rectWH 2 2)
DROPPER{} -> defSPic
CLICKER{} -> defSPic
COPIER{} -> defSPic
BGATE -> defSPic
UGATE -> defSPic
craftItemSPic :: CraftType -> Shape
craftItemSPic = \case
+21
View File
@@ -19,6 +19,9 @@ module Dodge.Item.Scope (
mapper,
dropper,
clicker,
copier,
bgate,
ugate,
) where
import Dodge.Item.Attach
@@ -81,6 +84,24 @@ clicker x =
& itType .~ CLICKER x
& itUse .~ UseInt 0
copier :: InventoryPathing -> Item
copier x =
defaultHeldItem
& itType .~ COPIER x
& itUse .~ UseInt 0
bgate :: Item
bgate =
defaultHeldItem
& itType .~ BGATE
& itUse .~ UseInt 0
ugate :: Item
ugate =
defaultHeldItem
& itType .~ UGATE
& itUse .~ UseInt 0
bulletModule :: BulletMod -> Item
bulletModule bm =
defaultHeldItem
+2 -1
View File
@@ -5,7 +5,6 @@ module Dodge.Update.Input.InGame (
updateMouseInGame,
) where
import Dodge.SelectedClose
import Control.Applicative
import Control.Monad
import Data.Foldable
@@ -27,6 +26,7 @@ import Dodge.Item.InvSize
import Dodge.ListDisplayParams
import Dodge.Menu
import Dodge.Save
import Dodge.SelectedClose
import Dodge.SelectionSections
import Dodge.SoundLogic
import Dodge.Terminal
@@ -445,6 +445,7 @@ updateInitialPressInGame uv sc = case sc of
ScancodeBackspace -> uv & uvWorld %~ updateBackspaceRegex
_ -> uv
updateLongPressInGame :: Universe -> Scancode -> Universe
updateLongPressInGame uv sc = case sc of
ScancodeF -> over uvWorld youDropItem uv