Cleanup
This commit is contained in:
@@ -12,10 +12,7 @@ import Dodge.Data.Equipment.Misc
|
|||||||
|
|
||||||
data RightButtonOptions
|
data RightButtonOptions
|
||||||
= NoRightButtonOptions
|
= NoRightButtonOptions
|
||||||
| EquipOptions
|
| EquipOptions { _opSel :: Int }
|
||||||
{ _opEquip :: [EquipPosition]
|
|
||||||
, _opSel :: Int
|
|
||||||
}
|
|
||||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data EquipmentAllocation
|
data EquipmentAllocation
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ updateRBList w
|
|||||||
w
|
w
|
||||||
& rbOptions
|
& rbOptions
|
||||||
.~ EquipOptions
|
.~ EquipOptions
|
||||||
{ _opEquip = equipSiteToPositions esite
|
{ _opSel = chooseEquipmentPosition cr (equipSiteToPositions esite)
|
||||||
, _opSel = chooseEquipmentPosition cr (equipSiteToPositions esite)
|
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
cr = you w
|
cr = you w
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ updateWheelEvent yi w = case w ^. hud . hudElement of
|
|||||||
-- this lock can be sensibly applied, perhaps
|
-- this lock can be sensibly applied, perhaps
|
||||||
| w ^?! cWorld . lWorld . creatures . ix 0 . crInvLock -> w
|
| w ^?! cWorld . lWorld . creatures . ix 0 . crInvLock -> w
|
||||||
| rbDown -> case (yourItem w ^? _Just . itUse . heldScroll, _rbOptions w) of
|
| rbDown -> case (yourItem w ^? _Just . itUse . heldScroll, _rbOptions w) of
|
||||||
(_, EquipOptions{}) -> w & rbOptions %~ scrollRBOption yi
|
(_, EquipOptions{}) -> w & rbOptions . opSel %~ scrollRBOption yi rbscrollmax
|
||||||
(Nothing, _) -> closeObjScrollDir y w
|
(Nothing, _) -> closeObjScrollDir y w
|
||||||
(Just f, _) -> doHeldScroll f y (you w) w
|
(Just f, _) -> doHeldScroll f y (you w) w
|
||||||
| lbDown -> w & wCam . camZoom +~ y
|
| lbDown -> w & wCam . camZoom +~ y
|
||||||
@@ -42,6 +42,10 @@ updateWheelEvent yi w = case w ^. hud . hudElement of
|
|||||||
DisplayInventory{_subInventory = DisplayTerminal tmid} -> terminalWheelEvent yi tmid w
|
DisplayInventory{_subInventory = DisplayTerminal tmid} -> terminalWheelEvent yi tmid w
|
||||||
_ -> w
|
_ -> w
|
||||||
where
|
where
|
||||||
|
rbscrollmax = fromMaybe 1 $ do
|
||||||
|
invid <- you w ^? crManipulation . manObject . inInventory . ispItem
|
||||||
|
esite <- you w ^? crInv . ix invid . itUse . equipEffect . eeSite
|
||||||
|
return $ length $ equipSiteToPositions esite
|
||||||
y = fromIntegral yi
|
y = fromIntegral yi
|
||||||
numLocs = (fst . IM.findMax $ (w ^. cWorld . lWorld . seenLocations)) + 1
|
numLocs = (fst . IM.findMax $ (w ^. cWorld . lWorld . seenLocations)) + 1
|
||||||
rbDown = ButtonRight `M.member` _mouseButtons (_input w)
|
rbDown = ButtonRight `M.member` _mouseButtons (_input w)
|
||||||
@@ -97,11 +101,11 @@ terminalWheelEvent yi tmid w
|
|||||||
tc = scrollCommands tm !! i
|
tc = scrollCommands tm !! i
|
||||||
arg = getArguments' tc tm w !! j
|
arg = getArguments' tc tm w !! j
|
||||||
|
|
||||||
scrollRBOption :: Int -> RightButtonOptions -> RightButtonOptions
|
scrollRBOption :: Int -> Int -> Int -> Int
|
||||||
scrollRBOption y w
|
scrollRBOption dy ymax
|
||||||
| y < 0 = w & opSel %~ (min (length (_opEquip w) -1) . subtract y)
|
| dy < 0 = (min (ymax -1) . subtract dy)
|
||||||
| y > 0 = w & opSel %~ (max 0 . subtract y)
|
| dy > 0 = (max 0 . subtract dy)
|
||||||
| otherwise = w
|
| otherwise = id
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user