This commit is contained in:
2022-12-27 14:14:03 +00:00
parent 2def9800fa
commit 85738adff1
6 changed files with 169 additions and 160 deletions
+1 -2
View File
@@ -20,9 +20,8 @@ data HUDElement
data SubInventory data SubInventory
= NoSubInventory = NoSubInventory
| TweakInventory {_tweakInvSel :: Maybe Int} | ExamineInventory {_examineInvSel :: Maybe Int}
| CombineInventory {_combineInvSel :: Maybe Int} | CombineInventory {_combineInvSel :: Maybe Int}
| InspectInventory
| LockedInventory | LockedInventory
| DisplayTerminal {_termID :: Int} | DisplayTerminal {_termID :: Int}
deriving (Eq, Ord, Show, Read) --Generic, Flat) deriving (Eq, Ord, Show, Read) --Generic, Flat)
+1 -1
View File
@@ -32,7 +32,7 @@ applyTerminalCommand s = case s of
(uvWorld . cWorld . lWorld %~ initSpecificCrItemLocations 0) (uvWorld . cWorld . lWorld %~ initSpecificCrItemLocations 0)
. (uvWorld . cWorld . lWorld . creatures . ix 0 . crInv .~ IM.fromList (zip [0 ..] $ inventoryX x)) . (uvWorld . cWorld . lWorld . creatures . ix 0 . crInv .~ IM.fromList (zip [0 ..] $ inventoryX x))
. (uvWorld . cWorld . lWorld . creatures . ix 0 . crInvCapacity .~ 50) . (uvWorld . cWorld . lWorld . creatures . ix 0 . crInvCapacity .~ 50)
['I','S',x,y] -> (uvWorld . cWorld . lWorld . creatures . ix 0 . crInvCapacity .~ read [x,y]) ['I','S',x,y] -> uvWorld . cWorld . lWorld . creatures . ix 0 . crInvCapacity .~ read [x,y]
"GODON" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crMaterial .~ Crystal "GODON" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crMaterial .~ Crystal
"GODOFF" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crMaterial .~ Flesh "GODOFF" -> uvWorld . cWorld . lWorld . creatures . ix 0 . crMaterial .~ Flesh
_ -> id _ -> id
+122 -106
View File
@@ -3,9 +3,6 @@ module Dodge.Render.HUD (
drawHUD, drawHUD,
) where ) where
import Dodge.Inventory.SelectionList
import Dodge.Data.CardinalPoint
import Dodge.Data.SelectionList
import Control.Lens import Control.Lens
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
import Data.Maybe import Data.Maybe
@@ -14,11 +11,15 @@ import qualified Data.Vector as V
import Dodge.Base import Dodge.Base
import Dodge.Clock import Dodge.Clock
import Dodge.Combine import Dodge.Combine
import Dodge.Data.World import Dodge.Data.CardinalPoint
import Dodge.Data.Config import Dodge.Data.Config
import Dodge.Data.SelectionList
import Dodge.Data.World
import Dodge.Inventory import Dodge.Inventory
import Dodge.Inventory.ItemSpace import Dodge.Inventory.ItemSpace
import Dodge.Inventory.SelectionList
import Dodge.Item.Display import Dodge.Item.Display
import Dodge.Item.Info
import Dodge.Render.Connectors import Dodge.Render.Connectors
import Dodge.Render.List import Dodge.Render.List
import Dodge.Tweak.Show import Dodge.Tweak.Show
@@ -47,7 +48,8 @@ drawInGameHUD sl cfig w =
] ]
defaultListDisplayParams :: ListDisplayParams defaultListDisplayParams :: ListDisplayParams
defaultListDisplayParams = ListDisplayParams defaultListDisplayParams =
ListDisplayParams
{ _ldpVerticalGap = 10 { _ldpVerticalGap = 10
, _ldpScale = 1 , _ldpScale = 1
, _ldpPosX = 0 , _ldpPosX = 0
@@ -56,32 +58,27 @@ defaultListDisplayParams = ListDisplayParams
, _ldpWidth = FixedSelectionWidth 15 , _ldpWidth = FixedSelectionWidth 15
} }
subInvListDisplayParams :: ListDisplayParams
subInvListDisplayParams = ListDisplayParams
{ _ldpVerticalGap = 10
, _ldpScale = 1
, _ldpPosX = subInvX
, _ldpPosY = 60
, _ldpCursorType = NoCursor
, _ldpWidth = FixedSelectionWidth 15
}
defaultSubInvSelectionList :: SelectionList a defaultSubInvSelectionList :: SelectionList a
defaultSubInvSelectionList = SelectionList defaultSubInvSelectionList =
SelectionList
{ _slItems = [] { _slItems = []
, _slSelPos = Nothing , _slSelPos = Nothing
, _slLength = 0 , _slLength = 15
} }
invDisplayParams :: World -> ListDisplayParams invDisplayParams :: World -> ListDisplayParams
invDisplayParams w = defaultListDisplayParams invDisplayParams w =
defaultListDisplayParams
& ldpWidth .~ FixedSelectionWidth topInvW & ldpWidth .~ FixedSelectionWidth topInvW
& ldpCursorType .~ BorderCursor selcursortype & ldpCursorType .~ BorderCursor selcursortype
& ldpWidth .~ FixedSelectionWidth (determineInvSelCursorWidth w) & ldpWidth .~ FixedSelectionWidth (determineInvSelCursorWidth w)
where where
selcursortype selcursortype
| ButtonRight `M.member` _mouseButtons (_input w) = [North,South,East,West] | isexaminesub || ButtonRight `M.member` _mouseButtons (_input w) = [North, South, East, West]
| otherwise = [North,South,West] | otherwise = [North, South, West]
isexaminesub = case w ^? cWorld . lWorld . hud . hudElement . subInventory of
Just ExamineInventory{} -> True
_ -> False
inventoryDisplay :: World -> Configuration -> SelectionList () -> Picture inventoryDisplay :: World -> Configuration -> SelectionList () -> Picture
inventoryDisplay w = drawSelectionList (invDisplayParams w) inventoryDisplay w = drawSelectionList (invDisplayParams w)
@@ -89,27 +86,65 @@ inventoryDisplay w = drawSelectionList (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 -> NoSubInventory -> drawNoSubInventory cfig w
ExamineInventory mtweaki ->
titledSub
"TWEAK"
(defaultSubInvSelectionList & slItems .~ ammoTweakSelectionItems itm)
<> examineInventoryExtra mtweaki itm cfig
DisplayTerminal tid -> displayTerminal tid cfig (w ^. cWorld . lWorld)
CombineInventory mi ->
titledSub
"COMBINE"
(combineListSelection w mi)
<> combineInventoryExtra mi cfig w
where
titledSub subtitle subitems =
invHead cfig subtitle
<> drawSelectionList secondColumnParams cfig subitems
itm = yourItem w
drawNoSubInventory :: Configuration -> World -> Picture
drawNoSubInventory cfig w =
pictures pictures
[ closeobjectcursor [ closeobjectcursor
, equipcursors , equipcursors
, equipcursor -- the order is important, this should go on top of the other equipcursors , equipcursor -- the order is important, this should go on top of the other equipcursors
, rboptions , rboptions
] ]
TweakInventory mtweaki -> where
titledSub "TWEAK" (defaultSubInvSelectionList & slItems .~ ammoTweakSelectionItems it) closeobjectcursor = case selectedCloseObject w of
[ selcursor' listCursorNESW Nothing -> mempty
, fromMaybe mempty $ do Just (i, _) ->
drawCursorAt
(invDisplayParams w & ldpCursorType .~ BorderCursor [North, South])
cfig
(Just i)
(inventorySelectionList w)
equipcursor = case _crLeftInvSel cr of
Just invid -> f cyan invid (_crInvEquipped cr IM.! invid)
_ -> mempty
equipcursors = IM.foldMapWithKey (f yellow) (_crInvEquipped cr)
cr = you w
rboptions
| ButtonRight `M.member` _mouseButtons (_input w) = drawRBOptions cfig w (_rbOptions w)
| otherwise = mempty
f col invid epos = listTextPictureAt 144 0 cfig (selNumPos invid w) . color col $ text $ eqPosText epos
examineInventoryExtra :: Maybe Int -> Maybe Item -> Configuration -> Picture
examineInventoryExtra mtweaki mitm cfig =
pictures
[ fromMaybe mempty $ do
tweaki <- mtweaki tweaki <- mtweaki
-- consider moving this functionality out into a tweaks module -- consider moving this functionality out into a tweaks module
tparam <- it ^? _Just . itTweaks . tweakParams . ix tweaki tparam <- mitm ^? _Just . itTweaks . tweakParams . ix tweaki
return $ return $ listCursorNSW subInvX 60 cfig tweaki white (length $ showTweak tparam) 15
lnkMidInvSel cfig w curpos tweaki , drawSelectionList thirdColumnParams cfig (thirdColumnPara (itmInfo mitm))
<> listCursorNSW subInvX 60 cfig tweaki white (length $ showTweak tparam) 1
] ]
DisplayTerminal tid -> displayTerminal tid cfig (w ^. cWorld . lWorld)
CombineInventory mi -> combineInventoryExtra :: Maybe Int -> Configuration -> World -> Picture
titledSub "COMBINE" (combineListSelection w) combineInventoryExtra mi cfig w =
pictures
[ fromMaybe mempty $ do [ fromMaybe mempty $ do
i <- mi i <- mi
cpos <- combinePoss w !? i cpos <- combinePoss w !? i
@@ -119,9 +154,6 @@ drawSubInventory subinv cfig w = case subinv of
[ fromMaybe mempty $ do [ fromMaybe mempty $ do
strs <- fmap (fst . snd) (combineListInfo w !? i) strs <- fmap (fst . snd) (combineListInfo w !? i)
return $ listPicturesAtOff (subInvX + 150) 60 cfig cpos $ map (color red . text) strs return $ listPicturesAtOff (subInvX + 150) 60 cfig cpos $ map (color red . text) strs
, fromMaybe mempty $ do
csize <- combineSizes w !? i
return $ listCursorNSW subInvX 60 cfig cpos col 15 csize
, fromMaybe mempty $ do , fromMaybe mempty $ do
lnks <- map fst (combineItemListYou w) !? i lnks <- map fst (combineItemListYou w) !? i
return $ return $
@@ -130,37 +162,40 @@ drawSubInventory subinv cfig w = case subinv of
<> combineCounts cfig w lnks <> combineCounts cfig w lnks
] ]
] ]
InspectInventory ->
titledSub "INSPECT" (defaultSubInvSelectionList & slItems .~ textSelItems (itmInfo it)) secondColumnParams :: ListDisplayParams
[ selcursor' listCursorNESW secondColumnParams =
] defaultListDisplayParams
& ldpPosX .~ subInvX
& ldpPosY .~ 60
& ldpCursorType .~ BorderCursor [North, South, West]
thirdColumnParams :: ListDisplayParams
thirdColumnParams =
defaultListDisplayParams
& ldpPosX .~ 9 * fromIntegral topInvW + 275
& ldpPosY .~ 60
thirdColumnPara :: [String] -> SelectionList ()
thirdColumnPara strs = SelectionList (map f strs) Nothing (length strs)
where where
titledSub subtitle subitems extrapics = pictures $ [invHead cfig subtitle f str =
,drawSelectionList subInvListDisplayParams cfig subitems] <> SelectionItem
extrapics { _siPictures = [text str]
closeobjectcursor = case selectedCloseObject w of , _siHeight = 1
Nothing -> mempty , _siIsSelectable = True
Just (i,_) -> drawCursorAt (invDisplayParams w & ldpCursorType .~ BorderCursor [North,South]) cfig (Just i) (inventorySelectionList w) , _siWidth = length str
itcol = fromMaybe (greyN 0.5) (it ^? _Just . itInvColor) , _siColor = white
cr = you w , _siOffX = 0
it = yourItem w , _siPayload = ()
selcursor' ct = fromMaybe mempty $ ct 0 0 cfig curpos itcol (determineInvSelCursorWidth w) cury <$ it }
curpos = invSelPos w
cury = fromMaybe 1 $ augmentedInvSizes w IM.!? crSel (you w)
equipcursor = case _crLeftInvSel cr of
Just invid -> f cyan invid (_crInvEquipped cr IM.! invid)
_ -> mempty
equipcursors = IM.foldMapWithKey (f yellow) (_crInvEquipped cr)
f col invid epos = listTextPictureAt 144 0 cfig (selNumPos invid w) . color col $ text $ eqPosText epos
rboptions =
if ButtonRight `M.member` _mouseButtons (_input w)
then drawRBOptions cfig w (_rbOptions w)
else mempty
itmInfo :: Maybe Item -> [String] itmInfo :: Maybe Item -> [String]
itmInfo mit = fromMaybe [] $ do itmInfo mit = fromMaybe [] $ do
itm <- mit itm <- mit
return (map show . M.assocs . _iyModules $ _itType itm) return $
itmBaseInfo (itm ^. itType . iyBase) :
(map show . M.assocs . _iyModules $ _itType itm)
displayTerminal :: Int -> Configuration -> LWorld -> Picture displayTerminal :: Int -> Configuration -> LWorld -> Picture
displayTerminal tid cfig w = fromMaybe mempty $ do displayTerminal tid cfig w = fromMaybe mempty $ do
@@ -168,13 +203,16 @@ displayTerminal tid cfig w = fromMaybe mempty $ do
return $ return $
pictures pictures
[ invHead cfig (_tmTitle tm ++ ":T" ++ show tid) [ invHead cfig (_tmTitle tm ++ ":T" ++ show tid)
, renderListAt subInvX 60 cfig , drawSelectionList secondColumnParams cfig (thesellist tm)
. displayTermInput tm ]
where
toselitm (str, col) = SelectionItem [color col $ text str] 1 True (length str) col 0 ()
thesellist tm = SelectionList (thelist tm) Nothing (length (thelist tm))
thelist tm =
map toselitm . displayTermInput tm
. reverse . reverse
. take (_tmMaxLines tm) . take (_tmMaxLines tm)
$ _tmDisplayedLines tm $ _tmDisplayedLines tm
]
where
displayTermInput tm = case _tmInput tm of displayTermInput tm = case _tmInput tm of
TerminalInput s hasfoc _ -> (++ [(displayInputText tm s ++ displayBlinkCursor hasfoc, white)]) TerminalInput s hasfoc _ -> (++ [(displayInputText tm s ++ displayBlinkCursor hasfoc, white)])
displayInputText tm s displayInputText tm s
@@ -225,28 +263,6 @@ topInvW = 15
subInvX :: Float subInvX :: Float
subInvX = 9 * fromIntegral topInvW + 50 subInvX = 9 * fromIntegral topInvW + 50
lnkMidInvSel :: Configuration -> World -> Int -> Int -> Picture
lnkMidInvSel cfig w lefti midi =
winScale cfig
. color white
. zConnect rp
$ selNumMidHeight cfig w lefti
where
-- lp ipos = V2 (150 - hw) ( hh - (20 * fromIntegral ipos + 17.5))
rp = V2 (190 - hw) (hh - (20 * fromIntegral midi + 77.5))
hh = halfHeight cfig
hw = halfWidth cfig
--lnkMidPosInvSels :: Configuration -> World -> Int -> [Int] -> Picture
--lnkMidPosInvSels cfig w i = winScale cfig
-- . color white
-- . concatMap (zConnect rp . selNumMidHeight cfig w)
-- where
---- lp ipos = V2 (150 - hw) ( hh - (20 * fromIntegral ipos + 17.5))
-- rp = V2 (190 - hw) ( hh - (20 * fromIntegral i + 77.5))
-- hh = halfHeight cfig
-- hw = halfWidth cfig
combineCounts :: Configuration -> World -> [Int] -> Picture combineCounts :: Configuration -> World -> [Int] -> Picture
combineCounts cfig w = winScale cfig . foldMap f . group combineCounts cfig w = winScale cfig . foldMap f . group
where where
@@ -260,7 +276,6 @@ lnkMidPosInvSelsCol cfig w i col =
winScale cfig winScale cfig
. foldMap (\j -> zConnectCol rp (V2 18 0 + selNumMidHeight cfig w j) col white white (selNumCol j w)) . foldMap (\j -> zConnectCol rp (V2 18 0 + selNumMidHeight cfig w j) col white white (selNumCol j w))
where where
-- lp ipos = V2 (150 - hw) ( hh - (20 * fromIntegral ipos + 17.5))
rp = V2 (190 - hw) (hh - (20 * fromIntegral i + 77.5)) rp = V2 (190 - hw) (hh - (20 * fromIntegral i + 77.5))
hh = halfHeight cfig hh = halfHeight cfig
hw = halfWidth cfig hw = halfWidth cfig
@@ -278,13 +293,15 @@ topCursorTypeWidth ctype width cfig w i =
determineInvSelCursorWidth :: World -> Int determineInvSelCursorWidth :: World -> Int
determineInvSelCursorWidth w = case _rbOptions w of determineInvSelCursorWidth w = case _rbOptions w of
NoRightButtonOptions -> topInvW NoRightButtonOptions -> topInvW
EquipOptions{} -> EquipOptions{}
if ButtonRight `M.member` _mouseButtons (_input w) | ButtonRight `M.member` _mouseButtons (_input w) -> 47
then 47 | otherwise -> topInvW
else topInvW
combineListSelection :: World -> SelectionList () combineListSelection :: World -> Maybe Int -> SelectionList ()
combineListSelection w = defaultSubInvSelectionList & slItems .~ combineListSelectionItems w combineListSelection w mi =
defaultSubInvSelectionList
& slItems .~ combineListSelectionItems w
& slSelPos .~ mi
combineListSelectionItems :: World -> [SelectionItem ()] combineListSelectionItems :: World -> [SelectionItem ()]
combineListSelectionItems w = case combineListSelectionItems' w of combineListSelectionItems w = case combineListSelectionItems' w of
@@ -293,9 +310,8 @@ combineListSelectionItems w = case combineListSelectionItems' w of
where where
thetext = "NO POSSIBLE COMBINATIONS" thetext = "NO POSSIBLE COMBINATIONS"
combineListSelectionItems' :: World -> [SelectionItem ()] combineListSelectionItems' :: World -> [SelectionItem ()]
combineListSelectionItems' w = map (picsToSelectable 15 . itemText . snd) $ combineItemListYou w combineListSelectionItems' = map (picsToSelectable 15 . itemText . snd) . combineItemListYou
ammoTweakSelectionItems :: Maybe Item -> [SelectionItem ()] ammoTweakSelectionItems :: Maybe Item -> [SelectionItem ()]
ammoTweakSelectionItems = textSelItems . ammoTweakStrings ammoTweakSelectionItems = textSelItems . ammoTweakStrings
@@ -309,12 +325,12 @@ tweakString :: TweakParam -> String
tweakString tp = rightPad 12 ' ' (show $ _tweakType tp) ++ " " ++ showTweak tp tweakString tp = rightPad 12 ' ' (show $ _tweakType tp) ++ " " ++ showTweak tp
invHead :: Configuration -> String -> Picture invHead :: Configuration -> String -> Picture
invHead cfig s = invHead cfig =
winScale cfig winScale cfig
. translate (- halfWidth cfig + subInvX + 20) (halfHeight cfig - 40) . translate (- halfWidth cfig + subInvX + 20) (halfHeight cfig - 40)
. dShadCol white . dShadCol white
. scale 0.4 0.4 . scale 0.4 0.4
$ text s . text
drawCarte :: Configuration -> World -> Picture drawCarte :: Configuration -> World -> Picture
drawCarte cfig w = drawCarte cfig w =
@@ -343,10 +359,9 @@ mapOverlay cfig w =
(mapMaybe (mapWall cfig (w ^. cWorld . lWorld . hud)) . IM.elems $ w ^. cWorld . lWorld . walls) (mapMaybe (mapWall cfig (w ^. cWorld . lWorld . hud)) . IM.elems $ w ^. cWorld . lWorld . walls)
mapWall :: Configuration -> HUD -> Wall -> Maybe Picture mapWall :: Configuration -> HUD -> Wall -> Maybe Picture
mapWall cfig thehud wl = mapWall cfig thehud wl
if _wlSeen wl | _wlSeen wl = Just . color c . polygon $ map (cartePosToScreen cfig thehud) [x, x +.+ n2, y +.+ n2, y]
then Just . color c . polygon $ map (cartePosToScreen cfig thehud) [x, x +.+ n2, y +.+ n2, y] | otherwise = Nothing
else Nothing
where where
t = normalizeV (y -.- x) t = normalizeV (y -.- x)
n2 = 20 *.* vNormal t n2 = 20 *.* vNormal t
@@ -389,7 +404,8 @@ mainListCursor :: Color -> Int -> Configuration -> Picture
mainListCursor c = openCursorAt 120 c 5 0 mainListCursor c = openCursorAt 120 c 5 0
picsToSelectable :: Int -> [Picture] -> SelectionItem () picsToSelectable :: Int -> [Picture] -> SelectionItem ()
picsToSelectable wdth pics = SelectionItem picsToSelectable wdth pics =
SelectionItem
{ _siPictures = pics { _siPictures = pics
, _siHeight = length pics , _siHeight = length pics
, _siIsSelectable = True , _siIsSelectable = True
@@ -400,7 +416,7 @@ picsToSelectable wdth pics = SelectionItem
} }
textSelItems :: [String] -> [SelectionItem ()] textSelItems :: [String] -> [SelectionItem ()]
textSelItems = map (picsToSelectable 15 . (:[]) . text) textSelItems = map (picsToSelectable 15 . (: []) . text)
itemText :: Item -> [Picture] itemText :: Item -> [Picture]
{-# INLINE itemText #-} {-# INLINE itemText #-}
@@ -435,10 +451,10 @@ openCursorAt wth col xoff yoff yint w =
] ]
displayHP :: Int -> Configuration -> World -> Picture displayHP :: Int -> Configuration -> World -> Picture
displayHP cid cfig w = displayHP cid cfig =
translate (halfWidth cfig -80) (halfHeight cfig -20) translate (halfWidth cfig -80) (halfHeight cfig -20)
. scale 0.2 0.2 . scale 0.2 0.2
. text . text
. leftPad 5 ' ' . leftPad 5 ' '
. show . show
$ w ^?! cWorld . lWorld . creatures . ix cid . crHP . (^?! cWorld . lWorld . creatures . ix cid . crHP)
+2 -2
View File
@@ -1,6 +1,6 @@
module Dodge.Render.List where module Dodge.Render.List where
import Data.Foldable --import Data.Foldable
import Data.Maybe import Data.Maybe
import Dodge.Base.WinScale import Dodge.Base.WinScale
import Dodge.Base.Window import Dodge.Base.Window
@@ -102,7 +102,7 @@ listCursorChooseBorder = listCursorChooseBorderScale 10 1
-- note we cannot simply scale lines because they are drawn as solid rectangles -- note we cannot simply scale lines because they are drawn as solid rectangles
chooseCursorBorders :: Float -> Float -> [CardinalPoint] -> Picture chooseCursorBorders :: Float -> Float -> [CardinalPoint] -> Picture
chooseCursorBorders wth hgt = fold . map (line . toLine) chooseCursorBorders wth hgt = foldMap (line . toLine)
where where
top = 0 top = 0
bot = - hgt bot = - hgt
+2 -8
View File
@@ -79,7 +79,6 @@ updateKeyInGame uv sc InitialPress = case sc of
ScancodeT -> over uvWorld testEvent uv ScancodeT -> over uvWorld testEvent uv
ScancodeX -> uv & uvWorld %~ toggleTweakInv ScancodeX -> uv & uvWorld %~ toggleTweakInv
ScancodeC -> over uvWorld toggleCombineInv uv ScancodeC -> over uvWorld toggleCombineInv uv
ScancodeI -> uv & uvWorld . cWorld . lWorld . hud . hudElement %~ toggleInspectInv
_ -> uv _ -> uv
where where
w = _uvWorld uv w = _uvWorld uv
@@ -108,13 +107,8 @@ toggleMap w = case w ^?! cWorld . lWorld . hud . hudElement of
toggleTweakInv :: World -> World toggleTweakInv :: World -> World
toggleTweakInv w = case w ^. cWorld . lWorld . hud . hudElement of toggleTweakInv w = case w ^. cWorld . lWorld . hud . hudElement of
DisplayInventory TweakInventory{} -> w & thepointer .~ NoSubInventory DisplayInventory ExamineInventory{} -> w & thepointer .~ NoSubInventory
_ -> w & thepointer .~ TweakInventory mi _ -> w & thepointer .~ ExamineInventory mi
where where
thepointer = cWorld . lWorld . hud . hudElement . subInventory thepointer = cWorld . lWorld . hud . hudElement . subInventory
mi = 0 <$ (yourItem w >>= (^? itTweaks . tweakParams . ix 0)) mi = 0 <$ (yourItem w >>= (^? itTweaks . tweakParams . ix 0))
toggleInspectInv :: HUDElement -> HUDElement
toggleInspectInv he = case he of
DisplayInventory InspectInventory -> DisplayInventory NoSubInventory
_ -> DisplayInventory InspectInventory
+2 -2
View File
@@ -32,7 +32,7 @@ updateWheelEvent yi w = case w ^. cWorld . lWorld . hud . hudElement of
| lbDown -> w & cWorld . camPos . camZoom +~ y | lbDown -> w & cWorld . camPos . camZoom +~ y
| invKeyDown -> changeSwapInvSel yi w | invKeyDown -> changeSwapInvSel yi w
| otherwise -> stopSoundFrom (CrReloadSound 0) $ changeAugInvSel yi w | otherwise -> stopSoundFrom (CrReloadSound 0) $ changeAugInvSel yi w
DisplayInventory (TweakInventory mi) DisplayInventory (ExamineInventory mi)
| invKeyDown && rbDown -> w & moveTweakSel yi | invKeyDown && rbDown -> w & moveTweakSel yi
| invKeyDown -> stopSoundFrom (CrReloadSound 0) $ changeInvSel yi w | invKeyDown -> stopSoundFrom (CrReloadSound 0) $ changeInvSel yi w
| rbDown -> w & changeTweakParam mi yi | rbDown -> w & changeTweakParam mi yi
@@ -87,7 +87,7 @@ scrollRBOption y w
moveTweakSel :: Int -> World -> World moveTweakSel :: Int -> World -> World
moveTweakSel i w = case yourItem w ^? _Just . itTweaks . tweakParams of moveTweakSel i w = case yourItem w ^? _Just . itTweaks . tweakParams of
Just l -> w & cWorld . lWorld . hud . hudElement . subInventory . tweakInvSel . _Just %~ (`mod` length l) . subtract i Just l -> w & cWorld . lWorld . hud . hudElement . subInventory . examineInvSel . _Just %~ (`mod` length l) . subtract i
_ -> w _ -> w
changeTweakParam :: Maybe Int -> Int -> World -> World changeTweakParam :: Maybe Int -> Int -> World -> World