Distinguish between selected item and root-selected item
This commit is contained in:
@@ -88,26 +88,26 @@ moveZoomCamera cfig theinput cr campos =
|
||||
where
|
||||
vfoffset = fromMaybe 0 $ do
|
||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
i <- cr ^? crManipulation . manObject . inInventory . imSelectedItem
|
||||
(cr ^? crInv . ix i . itScope . remotePos)
|
||||
docamrot = rotateV (campos ^. camRot)
|
||||
offset = fromMaybe noscopeoffset $ do
|
||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
i <- cr ^? crManipulation . manObject . inInventory . imSelectedItem
|
||||
(fmap docamrot (cr ^? crInv . ix i . itScope . opticPos))
|
||||
<|> (cr ^? crInv . ix i . itScope . remotePos)
|
||||
noscopeoffset = docamrot $
|
||||
((newzoom - newDefaultZoom) / (newDefaultZoom * newzoom)) *.* _mousePos theinput
|
||||
newzoom = fromMaybe (newDefaultZoom * newItemZoom) $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
i <- cr ^? crManipulation . manObject . inInventory . imSelectedItem
|
||||
(cr ^? crInv . ix i . itScope . opticZoom)
|
||||
idealDefaultZoom = clipZoom wallZoom
|
||||
newDefaultZoom = fromMaybe (changeZoom (campos ^. camDefaultZoom) idealDefaultZoom) $ do
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
i <- cr ^? crManipulation . manObject . inInventory . imSelectedItem
|
||||
(cr ^? crInv . ix i . itScope . opticZoom)
|
||||
idealItemZoom = fromMaybe 1 $ do
|
||||
guard $ crIsAiming cr
|
||||
i <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
i <- cr ^? crManipulation . manObject . inInventory . imSelectedItem
|
||||
zoomFromItem <$> (cr ^? crInv . ix i . itUse . heldAim . aimZoom)
|
||||
newItemZoom = changeZoom (campos ^. camItemZoom) idealItemZoom
|
||||
changeZoom curZoom idealZoom
|
||||
@@ -128,7 +128,7 @@ moveZoomCamera cfig theinput cr campos =
|
||||
-- is wanted
|
||||
updateScopeZoom :: World -> World
|
||||
updateScopeZoom w = fromMaybe w $ do
|
||||
i <- you w ^? crManipulation . manObject . inInventory . ispItem
|
||||
i <- you w ^? crManipulation . manObject . inInventory . imSelectedItem
|
||||
return $ updateScopeZoom' i w
|
||||
|
||||
updateScopeZoom' :: Int -> World -> World
|
||||
|
||||
@@ -247,7 +247,7 @@ toggleTweakInv w = case w ^? hud . hudElement . subInventory of
|
||||
_ -> w & thepointer .~ ExamineInventory mi
|
||||
where
|
||||
thepointer = hud . hudElement . subInventory
|
||||
mi = 0 <$ (yourItem w >>= (^? itTweaks . tweakParams . ix 0))
|
||||
mi = 0 <$ (yourSelectedItem w >>= (^? itTweaks . tweakParams . ix 0))
|
||||
|
||||
tryCombine :: SelectionSections CombinableItem -> World -> World
|
||||
tryCombine sss w = fromMaybe w $ do
|
||||
|
||||
@@ -46,7 +46,7 @@ updateWheelEvent yi w = case w ^. hud . hudElement of
|
||||
_ -> w
|
||||
where
|
||||
rbscrollmax = fromMaybe 1 $ do
|
||||
invid <- you w ^? crManipulation . manObject . inInventory . ispItem
|
||||
invid <- you w ^? crManipulation . manObject . inInventory . imSelectedItem
|
||||
esite <- you w ^? crInv . ix invid . itUse . equipEffect . eeSite
|
||||
return $ length $ equipSiteToPositions esite
|
||||
y = fromIntegral yi
|
||||
@@ -111,15 +111,15 @@ scrollRBOption dy ymax
|
||||
| otherwise = id
|
||||
|
||||
moveTweakSel :: Int -> World -> World
|
||||
moveTweakSel i w = case yourItem w ^? _Just . itTweaks . tweakParams of
|
||||
moveTweakSel i w = case yourSelectedItem w ^? _Just . itTweaks . tweakParams of
|
||||
Just l -> moveSubSel i (length l) w
|
||||
_ -> w
|
||||
|
||||
changeTweakParam :: Maybe Int -> Int -> World -> World
|
||||
changeTweakParam mi i w = fromMaybe w $ do
|
||||
curpos <- you w ^? crManipulation . manObject . inInventory . ispItem
|
||||
curpos <- you w ^? crManipulation . manObject . inInventory . imSelectedItem
|
||||
paramid <- mi
|
||||
params <- yourItem w ^? _Just . itTweaks . tweakParams . ix paramid
|
||||
params <- yourSelectedItem w ^? _Just . itTweaks . tweakParams . ix paramid
|
||||
let x = (_tweakVal params + i) `mod` _tweakMax params
|
||||
return $
|
||||
w & cWorld . lWorld . creatures . ix 0 . crInv . ix curpos
|
||||
|
||||
Reference in New Issue
Block a user