This commit is contained in:
2025-08-27 19:22:01 +01:00
parent 40d2d316cb
commit dda0526180
9 changed files with 131 additions and 138 deletions
+12 -16
View File
@@ -342,15 +342,13 @@ checkTermDist w = fromMaybe w $ do
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
Nothing -> u & uvWorld . input . mouseContext %~ updateMouseContextGame cfig u
updateMouseContextGame :: Config -> Universe -> Universe
updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of
OverInvDrag i _ -> u & uvWorld . input . mouseContext .~ invdrag i
OverInvDragSelect{} -> u
_ ->
u & uvWorld . input . mouseContext
.~ fromMaybe aimcontext (isrotatedrag <|> overinv <|> overcomb <|> overterm)
updateMouseContextGame :: Config -> Universe -> MouseContext -> MouseContext
updateMouseContextGame cfig u = \case
OverInvDrag i _ -> OverInvDrag i (inverseSelNumPos cfig invDP mpos disss)
x@OverInvDragSelect{} -> x
_ -> fromMaybe aimcontext (isrotatedrag <|> overinv <|> overcomb <|> overterm)
where
w = u ^. uvWorld
isrotatedrag = do
@@ -363,9 +361,6 @@ updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of
| otherwise = MouseInGame
mpos = w ^. input . mousePos
disss = w ^. hud . diSections
invdrag i' = fromMaybe (OverInvDrag i' Nothing) $ do
(i, j) <- inverseSelNumPos cfig invDP mpos disss
return $ OverInvDrag i' (Just (i, j))
overinv = do
selpos@(i, j) <- inverseSelNumPos cfig invDP mpos disss
case w ^? hud . subInventory . ciSelection of
@@ -379,7 +374,7 @@ updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of
sss <- w ^? hud . subInventory . ciSections
Sel xl xr _ <- w ^? hud . subInventory . ciSelection . _Just
let msel = (xl, xr)
let mpossel = inverseSelNumPos cfig secondColumnParams (w ^. input . mousePos) sss
let mpossel = inverseSelNumPos cfig secondColumnLDP (w ^. input . mousePos) sss
return $ case mpossel of
Nothing -> OverCombEscape
Just (-1, i) | (-1, i) == msel -> OverCombFilter
@@ -398,9 +393,9 @@ getMenuMouseContext screen u = case screen ^. scOptions of
[] -> NoMouseContext
_ -> fromMaybe MouseMenuCursor $ do
ymax <- length <$> screen ^? scSelectionList
yi <- ldpVerticalSelection (u ^. uvConfig) menuDisplayParams (u ^. uvWorld . input . mousePos)
yi <- ldpSelection (u ^. uvConfig) menuLDP (u ^. uvWorld . input . mousePos)
guard (yi >= 0 && yi < ymax)
return $ case u ^? uvScreenLayers . _head . scSelectionList . ix yi . siIsSelectable of
return $ case screen ^? scSelectionList . ix yi . siIsSelectable of
Just True -> MouseMenuClick yi
_ -> NoMouseContext
@@ -411,7 +406,7 @@ isOverTerminalScreen cfig (V2 x y) =
&& y <= ymax + 5
&& y >= ymin
where
ldp = secondColumnParams
ldp = secondColumnLDP
V2 xmin ymax = screenPosAbs cfig (ldp ^. ldpPos)
tsize = fromIntegral $ getMaxLinesTM + 1
s = 5 + tsize * (20 * ldp ^. ldpScale + ldp ^. ldpVerticalGap)
@@ -483,6 +478,7 @@ pbFlicker pt =
zoneClouds :: World -> World
zoneClouds w = w & clZoning .~ foldl' (flip zoneCloud) mempty (w ^. cWorld . lWorld . clouds)
zoneDusts :: World -> World
zoneDusts w = w & dsZoning .~ foldl' (flip zoneDust) mempty (w ^. cWorld . lWorld . dusts)
@@ -499,7 +495,7 @@ tmUpdate tm w = fromMaybe w $ do
w & pointTermParams
%~ ( (tmFutureLines %~ tail)
. (tmDisplayedLines %~ take getMaxLinesTM . (map displayTerminalLineString tls ++))
-- . (tmDisplayedLines %~ (map displayTerminalLineString tls ++))
-- . (tmDisplayedLines %~ (map displayTerminalLineString tls ++))
)
& doTmWdWd g tm
where