Decouple selection section inventory position
This commit is contained in:
+13
-9
@@ -58,7 +58,7 @@ drawHP cfig =
|
||||
|
||||
drawInventory :: SelectionSections () -> World -> Configuration -> Picture
|
||||
drawInventory sss w cfig =
|
||||
drawSelectionSections sss ldp cfig
|
||||
drawSelectionSections sss (w ^? hud . hudElement . diSelection . _Just) ldp cfig
|
||||
<> iextra
|
||||
<> translateScreenPos cfig (ldp ^. ldpPos)
|
||||
(drawDIMouseOver w)
|
||||
@@ -88,7 +88,7 @@ getMouseInvSel w = case w ^? hud . hudElement . subInventory . nsSelected of
|
||||
getMouseInvSel' :: World -> Maybe ((Int,Int),(Int,Int))
|
||||
getMouseInvSel' w = case w ^? hud . hudElement . subInventory . nsSelected of
|
||||
Just (MouseInvChosen x) -> do
|
||||
(i,j) <- w ^? hud . hudElement . diSections . sssExtra . sssSelPos . _Just
|
||||
(i,j) <- w ^? hud . hudElement . diSelection . _Just
|
||||
return ((i,j),(i,j+x))
|
||||
_ -> Nothing
|
||||
|
||||
@@ -122,8 +122,10 @@ drawSubInventory subinv cfig w = case subinv of
|
||||
drawCombineInventory :: Configuration -> SelectionSections CombinableItem -> World -> Picture
|
||||
drawCombineInventory cfig sss w =
|
||||
invHead cfig "COMBINE"
|
||||
<> drawSelectionSections sss secondColumnParams cfig
|
||||
<> combineInventoryExtra sss cfig w
|
||||
<> drawSelectionSections sss msel secondColumnParams cfig
|
||||
<> combineInventoryExtra sss msel cfig w
|
||||
where
|
||||
msel = w ^? hud . hudElement . subInventory . ciSelection . _Just
|
||||
|
||||
drawExamineInventory :: Configuration -> World -> Picture
|
||||
drawExamineInventory cfig w =
|
||||
@@ -181,7 +183,7 @@ drawRBOptions cfig w = fromMaybe mempty $ do
|
||||
i <- w ^? rbOptions . opSel
|
||||
let ae = getEquipmentAllocation w
|
||||
sss <- w ^? hud . hudElement . diSections
|
||||
(i', j) <- sss ^? sssExtra . sssSelPos . _Just
|
||||
(i', j) <- w ^? hud . hudElement . diSelection . _Just
|
||||
curpos <- selSecYint i' j sss
|
||||
let ytext = drawListElement 0 1 0 curpos . text
|
||||
midstr = equipAllocString ae
|
||||
@@ -244,9 +246,11 @@ inventoryExtraH sss cfig w i is = fromMaybe mempty $ do
|
||||
where
|
||||
snum = selNumPos cfig (invDisplayParams w) sss 0
|
||||
|
||||
combineInventoryExtra :: SelectionSections CombinableItem -> Configuration -> World -> Picture
|
||||
combineInventoryExtra sss cfig w = fromMaybe mempty $ do
|
||||
(i, j) <- sss ^? sssExtra . sssSelPos . _Just
|
||||
combineInventoryExtra :: SelectionSections CombinableItem
|
||||
-> Maybe (Int,Int)
|
||||
-> Configuration -> World -> Picture
|
||||
combineInventoryExtra sss msel cfig w = fromMaybe mempty $ do
|
||||
(i, j) <- msel
|
||||
cpos <- selSecYint i j sss
|
||||
si <- sss ^? sssSections . ix i . ssItems . ix j
|
||||
let col = _siColor si
|
||||
@@ -269,7 +273,7 @@ combineInventoryExtra sss cfig w = fromMaybe mempty $ do
|
||||
let idp = invDisplayParams w & ldpCursorSides .~ [North, South, East, West]
|
||||
return $
|
||||
translateScreenPos cfig (idp ^. ldpPos) $
|
||||
selSecDrawCursor 17 idp (sss' & sssExtra . sssSelPos ?~ (0, i))
|
||||
selSecDrawCursor 17 idp sss' (Just (0, i))
|
||||
|
||||
displayTerminal :: Int -> Configuration -> LWorld -> Picture
|
||||
displayTerminal tid cfig w = fromMaybe mempty $ do
|
||||
|
||||
@@ -101,10 +101,11 @@ selSecDrawCursorAt (i,j) xsize ldp sss = fromMaybe mempty $ do
|
||||
xsize
|
||||
(_siHeight si)
|
||||
|
||||
selSecDrawCursor :: Int -> ListDisplayParams -> SelectionSections a -> Picture
|
||||
selSecDrawCursor xsize ldp sss = maybe mempty
|
||||
selSecDrawCursor :: Int -> ListDisplayParams -> SelectionSections a ->
|
||||
Maybe (Int,Int) -> Picture
|
||||
selSecDrawCursor xsize ldp sss msel = maybe mempty
|
||||
(\x -> selSecDrawCursorAt x xsize ldp sss)
|
||||
(sss ^? sssExtra . sssSelPos . _Just)
|
||||
msel
|
||||
|
||||
-- displays a cursor that should match up to list text pictures
|
||||
listCursorChooseBorderScale ::
|
||||
|
||||
Reference in New Issue
Block a user