This commit is contained in:
2025-08-26 18:51:14 +01:00
parent b87c3380b8
commit 1ebdbdd8ae
34 changed files with 210 additions and 246 deletions
+9 -9
View File
@@ -339,12 +339,12 @@ checkTermDist w = fromMaybe w $ do
guard $ dist btpos (_crPos $ you w) > 40
return $ w & hud . subInventory .~ NoSubInventory
updateMouseContext :: Configuration -> Universe -> Universe
updateMouseContext :: Config -> Universe -> Universe
updateMouseContext cfig u = case u ^? uvScreenLayers . ix 0 of
Just screen -> u & uvWorld . input . mouseContext .~ getMenuMouseContext screen u
Nothing -> updateMouseContextGame cfig u
updateMouseContextGame :: Configuration -> Universe -> Universe
updateMouseContextGame :: Config -> Universe -> Universe
updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of
OverInvDrag i _ -> u & uvWorld . input . mouseContext .~ invdrag i
OverInvDragSelect{} -> u
@@ -362,25 +362,25 @@ updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of
| ButtonRight `M.member` (w ^. input . mouseButtons) = MouseAiming
| otherwise = MouseInGame
mpos = w ^. input . mousePos
disss = w ^. hud . diSections
invdrag i' = fromMaybe (OverInvDrag i' Nothing) $ do
sss <- w ^? hud . diSections
(i, j) <- inverseSelNumPos cfig invDP sss mpos
-- sss <- w ^? hud . diSections
(i, j) <- inverseSelNumPos cfig invDP mpos disss
return $ OverInvDrag i' (Just (i, j))
overinv = do
sss <- w ^? hud . diSections
selpos@(i, j) <- inverseSelNumPos cfig invDP sss mpos
selpos@(i, j) <- inverseSelNumPos cfig invDP mpos disss
case w ^? hud . subInventory . ciSelection of
Just _ | i == 0 -> return $ OverCombFiltInv selpos
Just _ -> Nothing
_ -> do
guard $ ButtonRight `M.notMember` (w ^. input . mouseButtons)
guard =<< sss ^? ix i . ssItems . ix j . siIsSelectable
guard =<< disss ^? ix i . ssItems . ix j . siIsSelectable
return $ OverInvSelect selpos
overcomb = do
sss <- w ^? hud . subInventory . ciSections
Sel xl xr _ <- w ^? hud . subInventory . ciSelection . _Just
let msel = (xl, xr)
let mpossel = inverseSelNumPos cfig secondColumnParams sss (w ^. input . mousePos)
let mpossel = inverseSelNumPos cfig secondColumnParams (w ^. input . mousePos) sss
return $ case mpossel of
Nothing -> OverCombEscape
Just (-1, i) | (-1, i) == msel -> OverCombFilter
@@ -405,7 +405,7 @@ getMenuMouseContext screen u = case screen ^. scOptions of
Just True -> MouseMenuClick yi
_ -> NoMouseContext
isOverTerminalScreen :: Configuration -> Point2 -> Bool
isOverTerminalScreen :: Config -> Point2 -> Bool
isOverTerminalScreen cfig (V2 x y) =
x <= xmax
&& x >= xmin - 5