Cleanup dragging
This commit is contained in:
@@ -44,4 +44,9 @@ data CardinalCover
|
||||
data XInfinity a = NegInf | NonInf {_nonInf :: a} | PosInf
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
instance Functor XInfinity where
|
||||
fmap f (NonInf x) = NonInf (f x)
|
||||
fmap _ NegInf = NegInf
|
||||
fmap _ PosInf = PosInf
|
||||
|
||||
makeLenses ''XInfinity
|
||||
|
||||
+211
-108
@@ -5,10 +5,6 @@ module Dodge.Update.Input.InGame (
|
||||
updateMouseInGame,
|
||||
) where
|
||||
|
||||
import Dodge.Data.ScreenPos
|
||||
import Geometry.Data
|
||||
import Dodge.Base.Coordinate
|
||||
import Dodge.Button.Event
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
import Data.Foldable
|
||||
@@ -19,10 +15,13 @@ import qualified Data.Map.Strict as M
|
||||
import Data.Maybe
|
||||
import Data.Monoid
|
||||
import Dodge.Base.Collide
|
||||
import Dodge.Base.Coordinate
|
||||
import Dodge.Button.Event
|
||||
import Dodge.Camera
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.Data.CardinalPoint
|
||||
import Dodge.Data.Combine
|
||||
import Dodge.Data.ScreenPos
|
||||
import Dodge.Data.Terminal.Status
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.DisplayInventory
|
||||
@@ -41,6 +40,7 @@ import Dodge.SoundLogic
|
||||
import Dodge.Terminal
|
||||
import Dodge.Update.Input.DebugTest
|
||||
import Dodge.Update.Input.Text
|
||||
import Geometry.Data
|
||||
import Geometry.Vector
|
||||
import LensHelp
|
||||
import NewInt
|
||||
@@ -49,38 +49,32 @@ import SDL
|
||||
updateUseInputInGame :: Universe -> Universe
|
||||
updateUseInputInGame u = updateFunctionKeys $ case u ^. uvWorld . hud . subInventory of
|
||||
DisplayTerminal tmid -> updateKeysInTerminal tmid u
|
||||
CombineInventory{_ciSections = sss, _ciSelection = msel@(Just (Sel (-1) _))} ->
|
||||
u
|
||||
& tohud . subInventory %~ docombineregexinput sss msel
|
||||
CombineInventory{_ciSections = sss, _ciSelection = msel@(Just (Sel (-1) _))} -> u
|
||||
& uvWorld . hud . subInventory %~ docombineregexinput sss msel
|
||||
& uvWorld . worldEventFlags . at CombineInventoryChange ?~ ()
|
||||
_ | disel == Just (-1) ->
|
||||
u
|
||||
& tohud %~ dodisplayregexinput diInvFilter diInvFilter (-1)
|
||||
& uvWorld . worldEventFlags . at InventoryChange ?~ ()
|
||||
& uvWorld %~ setInvPosFromSS
|
||||
_ | disel == Just 2 ->
|
||||
u
|
||||
& tohud %~ dodisplayregexinput diCloseFilter diCloseFilter 2
|
||||
& uvWorld . worldEventFlags . at InventoryChange ?~ ()
|
||||
& uvWorld %~ setInvPosFromSS
|
||||
_ | Just (-1) <- disel -> f diInvFilter diInvFilter (-1)
|
||||
_ | Just 2 <- disel -> f diCloseFilter diCloseFilter 2
|
||||
_ -> updateKeysInGame u
|
||||
where
|
||||
disel = u ^? uvWorld . hud . diSelection . _Just . slSec
|
||||
tohud = uvWorld . hud
|
||||
f x y i = u
|
||||
& uvWorld . hud %~ dodisplayregexinput x y i
|
||||
& uvWorld . worldEventFlags . at InventoryChange ?~ ()
|
||||
& uvWorld %~ setInvPosFromSS
|
||||
dodisplayregexinput filterprism filterlens x di = fromMaybe di $ do
|
||||
sss <- di ^? diSections
|
||||
msel <- di ^? diSelection
|
||||
filts <- di ^? filterprism
|
||||
let (sss', msel', filts') = doRegexInput (u ^. uvWorld . input) x sss msel filts
|
||||
return $
|
||||
di & diSections .~ sss'
|
||||
return $ di
|
||||
& diSections .~ sss'
|
||||
& diSelection .~ msel'
|
||||
& filterlens .~ filts'
|
||||
docombineregexinput sss msel ci = fromMaybe ci $ do
|
||||
filts <- ci ^? ciFilter
|
||||
let (sss', msel', filts') = doRegexInput (u ^. uvWorld . input) (-1) sss msel filts
|
||||
return $
|
||||
ci & ciSections .~ sss'
|
||||
return $ ci
|
||||
& ciSections .~ sss'
|
||||
& ciSelection .~ msel'
|
||||
& ciFilter .~ filts'
|
||||
|
||||
@@ -103,26 +97,23 @@ updateMouseHeldInGame cfig w = case w ^. input . mouseContext of
|
||||
| ButtonRight `M.member` (w ^. input . mouseButtons) ->
|
||||
w & input . mouseContext .~ MouseGameRotate (dist (mouseWorldPosW w) (w ^. wCam . camCenter))
|
||||
OverInvDragSelect (Just sstart) _ ->
|
||||
let sss = w ^. hud . diSections
|
||||
in case inverseSelNumPos cfig invDP (w ^. input . mousePos) sss of
|
||||
case inverseSelNumPos cfig invDP (w ^. input . mousePos) sss of
|
||||
Nothing -> w & input . mouseContext . mcoSelEnd .~ Nothing
|
||||
Just (NonInf (i, j))
|
||||
| i == fst sstart -> w & input . mouseContext . mcoSelEnd ?~ j
|
||||
| i < fst sstart -> w & input . mouseContext . mcoSelEnd ?~ 0
|
||||
| otherwise -> w
|
||||
& input . mouseContext . mcoSelEnd
|
||||
.~ fmap
|
||||
fst
|
||||
(IM.lookupMax =<< sss ^? ix (fst sstart) . ssItems)
|
||||
Just NegInf -> w & input . mouseContext . mcoSelEnd ?~ 0
|
||||
Just PosInf ->
|
||||
w & input . mouseContext . mcoSelEnd
|
||||
.~ fmap
|
||||
fst
|
||||
(IM.lookupMax =<< sss ^? ix (fst sstart) . ssItems)
|
||||
Just m
|
||||
| fmap fst m == NonInf (fst sstart) -> w & input . mouseContext . mcoSelEnd ?~ (m ^?! nonInf . _2)
|
||||
| fmap fst m < NonInf (fst sstart) -> w & input . mouseContext . mcoSelEnd ?~ 0
|
||||
| otherwise -> w & input . mouseContext . mcoSelEnd .~
|
||||
fmap fst (IM.lookupMax =<< sss ^? ix (fst sstart) . ssItems)
|
||||
-- Just (NonInf (i, j))
|
||||
-- | i == fst sstart -> w & input . mouseContext . mcoSelEnd ?~ j
|
||||
-- | i < fst sstart -> w & input . mouseContext . mcoSelEnd ?~ 0
|
||||
-- | otherwise -> w & input . mouseContext . mcoSelEnd .~
|
||||
-- fmap fst (IM.lookupMax =<< sss ^? ix (fst sstart) . ssItems)
|
||||
-- Just NegInf -> w & input . mouseContext . mcoSelEnd ?~ 0
|
||||
-- Just PosInf -> w & input . mouseContext . mcoSelEnd .~
|
||||
-- fmap fst (IM.lookupMax =<< sss ^? ix (fst sstart) . ssItems)
|
||||
-- not sure how the above performs when filtering...
|
||||
OverInvDragSelect Nothing _ -> fromMaybe w $ do
|
||||
sss <- w ^? hud . diSections
|
||||
ysel <-
|
||||
inverseSelSecYint
|
||||
(posSelSecYint cfig invDP (w ^. input . mousePos . _y))
|
||||
@@ -133,16 +124,20 @@ updateMouseHeldInGame cfig w = case w ^. input . mouseContext of
|
||||
OverInvDrag k mmouseover -> doDrag cfig 30 k mmouseover w
|
||||
OverTerminalBar p -> w & tmLDP %~ setPixelOffsetBounded cfig (p + w ^. input . mousePos)
|
||||
_ -> w
|
||||
where
|
||||
sss = w ^. hud . diSections
|
||||
|
||||
setPixelOffsetBounded :: Config -> Point2 -> LDParams -> LDParams
|
||||
setPixelOffsetBounded cfig (V2 x y) ldp = ldp & ldpPos . spPixelOff .~ V2 x' y'
|
||||
where
|
||||
h = fromIntegral $ cfig ^. windowY
|
||||
w = fromIntegral $ cfig ^. windowX
|
||||
x' = min (w - (w*a + 1+10*ldp ^?! ldpSize . _Just . _x . to fromIntegral))
|
||||
$ max (1 - w * a) x
|
||||
y' = min (h-(h*b + 20))
|
||||
$ max (1+20*(ldp^.ldpVerticalGap + ldp^?!ldpSize._Just._y.to fromIntegral)-h*b) y
|
||||
x' =
|
||||
min (w - (w * a + 1 + 10 * ldp ^?! ldpSize . _Just . _x . to fromIntegral)) $
|
||||
max (1 - w * a) x
|
||||
y' =
|
||||
min (h - (h * b + 20)) $
|
||||
max (1 + 20 * (ldp ^. ldpVerticalGap + ldp ^?! ldpSize . _Just . _y . to fromIntegral) - h * b) y
|
||||
V2 a b = ldp ^. ldpPos . spScreenOff
|
||||
|
||||
doDrag :: Config -> Int -> Int -> Maybe (Int, Int) -> World -> World
|
||||
@@ -165,9 +160,11 @@ tryDropSelected mpos w = do
|
||||
xs <- selectionSet w
|
||||
let xmin = IS.findMin xs
|
||||
return
|
||||
. (hud . diSelection ?~ Sel 3 (j-xmin) )
|
||||
. (hud . diSections . ix 3 . ssSet .~ IS.fromDistinctAscList [0..IS.size xs - 1])
|
||||
. foldl' (flip $ dropItem cr) w . IS.toDescList $ xs
|
||||
. (hud . diSelection ?~ Sel 3 (j - xmin))
|
||||
. (hud . diSections . ix 3 . ssSet .~ IS.fromDistinctAscList [0 .. IS.size xs - 1])
|
||||
. foldl' (flip $ dropItem cr) w
|
||||
. IS.toDescList
|
||||
$ xs
|
||||
|
||||
selectionSet :: World -> Maybe IS.IntSet
|
||||
selectionSet w = do
|
||||
@@ -175,12 +172,12 @@ selectionSet w = do
|
||||
case w ^? hud . diSections . ix j . ssSet of
|
||||
Just is | not $ IS.null is -> Just is
|
||||
_ -> IS.singleton <$> w ^? hud . diSelection . _Just . slInt
|
||||
--selectionSet :: World -> Maybe IS.IntSet
|
||||
--selectionSet w = case w ^? hud . diSelection . _Just . slSet of
|
||||
|
||||
-- selectionSet :: World -> Maybe IS.IntSet
|
||||
-- selectionSet w = case w ^? hud . diSelection . _Just . slSet of
|
||||
-- Just is' | not $ IS.null is' -> Just is'
|
||||
-- _ -> IS.singleton <$> w ^? hud . diSelection . _Just . slInt
|
||||
|
||||
|
||||
tryPickupSelected :: Int -> Maybe (Int, Int) -> World -> Maybe World
|
||||
tryPickupSelected k mpos w = do
|
||||
guard $ k == 3
|
||||
@@ -200,9 +197,9 @@ tryPickupSelected k mpos w = do
|
||||
_ -> foldl' (flip $ pickUpItem 0) w ispickup & newdisel (length (cr ^. crInv)) joff xs
|
||||
where
|
||||
newdisel j joff xs =
|
||||
-- hud . diSelection ?~ Sel 0 (j+joff) (IS.fromDistinctAscList [j .. j + IS.size xs -1])
|
||||
(hud . diSelection ?~ Sel 0 (j+joff))
|
||||
. (hud . diSections . ix 0 . ssSet .~ IS.fromDistinctAscList [j .. j + IS.size xs -1])
|
||||
-- hud . diSelection ?~ Sel 0 (j+joff) (IS.fromDistinctAscList [j .. j + IS.size xs -1])
|
||||
(hud . diSelection ?~ Sel 0 (j + joff))
|
||||
. (hud . diSections . ix 0 . ssSet .~ IS.fromDistinctAscList [j .. j + IS.size xs - 1])
|
||||
g i = do
|
||||
NInt j <- w ^? hud . closeItems . ix i
|
||||
w ^? cWorld . lWorld . items . ix j
|
||||
@@ -211,21 +208,33 @@ updateMouseReleaseInGame :: World -> World
|
||||
updateMouseReleaseInGame w = case w ^. input . mouseContext of
|
||||
OverInvDrag k mpos ->
|
||||
input . mouseContext .~ MouseInGame $
|
||||
fromMaybe w $ tryDropSelected mpos w <|> tryPickupSelected k mpos w
|
||||
fromMaybe w $
|
||||
tryDropSelected mpos w <|> tryPickupSelected k mpos w
|
||||
OverInvDragSelect (Just ssel) mesel
|
||||
| ScancodeLShift `M.member` (w ^. input . pressedKeys) ->
|
||||
w & input . mouseContext .~ MouseInGame
|
||||
& (fromMaybe id $ do
|
||||
w
|
||||
& input
|
||||
. mouseContext
|
||||
.~ MouseInGame
|
||||
& ( fromMaybe id $ do
|
||||
j <- w ^? hud . diSelection . _Just . slSec
|
||||
return $ hud . diSections . ix j . ssSet
|
||||
return $
|
||||
hud
|
||||
. diSections
|
||||
. ix j
|
||||
. ssSet
|
||||
%~ getuniques
|
||||
( maybe
|
||||
mempty
|
||||
mempty
|
||||
--(h ssel)
|
||||
-- (h ssel)
|
||||
(guard (ssel ^? _1 == w ^? hud . diSelection . _Just . slSec) >> mesel ^? _Just)
|
||||
))
|
||||
& hud . diSections . ix (fst ssel) . ssSet
|
||||
)
|
||||
)
|
||||
& hud
|
||||
. diSections
|
||||
. ix (fst ssel)
|
||||
. ssSet
|
||||
%~ getuniques
|
||||
( maybe
|
||||
mempty
|
||||
@@ -240,22 +249,36 @@ updateMouseReleaseInGame w = case w ^. input . mouseContext of
|
||||
-- (guard (ssel ^? _1 == w ^? hud . diSelection . _Just . slSec) >> mesel ^? _Just)
|
||||
-- )
|
||||
OverInvDragSelect (Just ssel) (Just esel) ->
|
||||
w & input . mouseContext .~ MouseInGame
|
||||
w
|
||||
& input
|
||||
. mouseContext
|
||||
.~ MouseInGame
|
||||
-- & invSetSelection (f (fst ssel, esel) (h ssel esel))
|
||||
& hud . diSections . ix (fst ssel) . ssSet .~ h ssel esel
|
||||
& hud
|
||||
. diSections
|
||||
. ix (fst ssel)
|
||||
. ssSet
|
||||
.~ h ssel esel
|
||||
& invSetSelection (f (fst ssel, esel))
|
||||
OverInvDragSelect{} ->
|
||||
w & input . mouseContext .~ MouseInGame
|
||||
-- & hud . diSelection . _Just . slSet %~ const mempty
|
||||
& hud . diSections . each . ssSet %~ const mempty
|
||||
w
|
||||
& input
|
||||
. mouseContext
|
||||
.~ MouseInGame
|
||||
-- & hud . diSelection . _Just . slSet %~ const mempty
|
||||
& hud
|
||||
. diSections
|
||||
. each
|
||||
. ssSet
|
||||
%~ const mempty
|
||||
_ -> w
|
||||
where
|
||||
getuniques x y = IS.union x y IS.\\ IS.intersection x y
|
||||
f (x, y) = Sel x y
|
||||
-- need to set this in OverInvDragSelect (twice)?
|
||||
-- need to set this in OverInvDragSelect (twice)?
|
||||
h (k, i) j = fold $ do
|
||||
sss <- w ^? hud . diSections . ix k . ssItems
|
||||
let (_, xss) = IM.split (min i j -1) sss
|
||||
let (_, xss) = IM.split (min i j - 1) sss
|
||||
(yss, _) = IM.split (max i j + 1) xss
|
||||
return . IM.keysSet $ yss
|
||||
|
||||
@@ -278,12 +301,22 @@ updateMouseClickInGame cfig w = case w ^. input . mouseContext of
|
||||
return $ w & input . mouseContext .~ OverInvDragSelect (Just ysel) Nothing
|
||||
OverInvSelect (-1, _)
|
||||
| selsec == Just (-1) ->
|
||||
w & hud . diSelection %~ endRegex (-1) w
|
||||
& hud . diInvFilter .~ Nothing
|
||||
w
|
||||
& hud
|
||||
. diSelection
|
||||
%~ endRegex (-1) w
|
||||
& hud
|
||||
. diInvFilter
|
||||
.~ Nothing
|
||||
OverInvSelect (2, _)
|
||||
| selsec == Just 2 ->
|
||||
w & hud . diSelection %~ endRegex 2 w
|
||||
& hud . diCloseFilter .~ Nothing
|
||||
w
|
||||
& hud
|
||||
. diSelection
|
||||
%~ endRegex 2 w
|
||||
& hud
|
||||
. diCloseFilter
|
||||
.~ Nothing
|
||||
OverInvSelect (5, j) -> fromMaybe w $ do
|
||||
k <- w ^? hud . closeButtons . ix j
|
||||
but <- w ^? cWorld . lWorld . buttons . ix k
|
||||
@@ -297,22 +330,45 @@ updateMouseClickInGame cfig w = case w ^. input . mouseContext of
|
||||
OverTerminal tmid TerminalPressTo{} -> continueTerminal tmid w
|
||||
OutsideTerminal -> w & hud . subInventory .~ NoSubInventory
|
||||
OverCombSelect x ->
|
||||
w & hud . subInventory . ciSelection ?~ f x
|
||||
& worldEventFlags . at CombineInventoryChange ?~ ()
|
||||
w
|
||||
& hud
|
||||
. subInventory
|
||||
. ciSelection
|
||||
?~ f x
|
||||
& worldEventFlags
|
||||
. at CombineInventoryChange
|
||||
?~ ()
|
||||
OverCombFilter ->
|
||||
w & hud . subInventory . ciFilter .~ Nothing
|
||||
& worldEventFlags . at CombineInventoryChange ?~ ()
|
||||
& hud . subInventory . ciSelection %~ endCombineRegex w
|
||||
w
|
||||
& hud
|
||||
. subInventory
|
||||
. ciFilter
|
||||
.~ Nothing
|
||||
& worldEventFlags
|
||||
. at CombineInventoryChange
|
||||
?~ ()
|
||||
& hud
|
||||
. subInventory
|
||||
. ciSelection
|
||||
%~ endCombineRegex w
|
||||
OverCombCombine x ->
|
||||
w
|
||||
& tryCombine x
|
||||
& worldEventFlags . at CombineInventoryChange ?~ ()
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
& worldEventFlags
|
||||
. at CombineInventoryChange
|
||||
?~ ()
|
||||
& worldEventFlags
|
||||
. at InventoryChange
|
||||
?~ ()
|
||||
& maybeExitCombine
|
||||
OverCombEscape ->
|
||||
w
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
& hud . subInventory .~ NoSubInventory
|
||||
& worldEventFlags
|
||||
. at InventoryChange
|
||||
?~ ()
|
||||
& hud
|
||||
. subInventory
|
||||
.~ NoSubInventory
|
||||
OverCombFiltInv (0, j) -> fromMaybe w $ do
|
||||
str <-
|
||||
fmap (take 5) $
|
||||
@@ -344,7 +400,7 @@ endCombineRegex w = ssSetCursor (ssLookupDown 0 j) sss
|
||||
j = fromMaybe 0 $ do
|
||||
itms <- sss ^? ix 0 . ssItems
|
||||
(k, _) <- IM.lookupMin itms
|
||||
return (k -1)
|
||||
return (k - 1)
|
||||
|
||||
startDrag :: (Int, Int) -> World -> World
|
||||
startDrag (a, b) w = setcontext $ fromMaybe (invSetSelection (Sel a b) w) $ do
|
||||
@@ -354,13 +410,13 @@ startDrag (a, b) w = setcontext $ fromMaybe (invSetSelection (Sel a b) w) $ do
|
||||
return w
|
||||
where
|
||||
setcontext = input . mouseContext .~ OverInvDrag a (Just (a, b))
|
||||
--startDrag (a, b) w = setcontext $ case w ^? hud . diSelection . _Just of
|
||||
|
||||
-- startDrag (a, b) w = setcontext $ case w ^? hud . diSelection . _Just of
|
||||
-- Just (Sel i _ xs) | i == a && b `IS.member` xs -> w
|
||||
-- _ -> invSetSelection (Sel a b mempty) w
|
||||
-- where
|
||||
-- setcontext = input . mouseContext .~ OverInvDrag a (Just (a, b))
|
||||
|
||||
|
||||
shiftInvItems ::
|
||||
Config ->
|
||||
Int -> -- recurse limit
|
||||
@@ -379,18 +435,18 @@ shiftInvItems cfig n k x xs ss w = setSelWhileDragging . fromMaybe w $ do
|
||||
ab =
|
||||
(\v -> inverseSelSecYint (yint - 1) v ^? nonInf)
|
||||
=<< w ^? hud . diSections
|
||||
guard $ xk == k || xk + 1 == k || xk -1 == k
|
||||
guard $ xk == k || xk + 1 == k || xk - 1 == k
|
||||
(maxi, _) <- IS.maxView xs
|
||||
(mini, _) <- IS.minView xs
|
||||
case True of
|
||||
_ | x < (k, mini) -> do
|
||||
guard $ not . null . fst $ IM.split mini ss
|
||||
guard $ Just (k, mini -1) /= ab
|
||||
return . doDrag cfig (n -1) k (Just x) $ shiftInvItemsUp k xs w
|
||||
guard $ Just (k, mini - 1) /= ab
|
||||
return . doDrag cfig (n - 1) k (Just x) $ shiftInvItemsUp k xs w
|
||||
_ | x > (k, maxi) -> do
|
||||
guard $ not . null . snd $ IM.split maxi ss
|
||||
guard $ Just (k, maxi + 1) /= bn
|
||||
return . doDrag cfig (n -1) k (Just x) $ shiftInvItemsDown k xs w
|
||||
return . doDrag cfig (n - 1) k (Just x) $ shiftInvItemsDown k xs w
|
||||
_ -> Nothing
|
||||
|
||||
setSelWhileDragging :: World -> World
|
||||
@@ -400,12 +456,12 @@ setSelWhileDragging w = fromMaybe w $ do
|
||||
(k, j) <- w ^? input . mouseContext . mcoMaybeSelect . _Just
|
||||
guard $ i == k && j `IS.member` xs
|
||||
return $ w & hud . diSelection . _Just . slInt .~ j
|
||||
|
||||
-- Sel i _ xs <- w ^? hud . diSelection . _Just
|
||||
-- (k, j) <- w ^? input . mouseContext . mcoMaybeSelect . _Just
|
||||
-- guard $ i == k && j `IS.member` xs
|
||||
-- return $ w & hud . diSelection . _Just . slInt .~ j
|
||||
|
||||
|
||||
updateFunctionKeys :: Universe -> Universe
|
||||
updateFunctionKeys u =
|
||||
M.foldlWithKey' updateFunctionKey u (u ^. uvWorld . input . pressedKeys)
|
||||
@@ -459,7 +515,14 @@ updateKeysTextInputTerminal tmid u =
|
||||
(uvWorld . cWorld . lWorld . terminals . ix tmid . tmStatus . tiText)
|
||||
& checkEndStatus
|
||||
& tryTabComplete
|
||||
& uvWorld . cWorld . lWorld . terminals . ix tmid . tmStatus . tiText %~ take 42
|
||||
& uvWorld
|
||||
. cWorld
|
||||
. lWorld
|
||||
. terminals
|
||||
. ix tmid
|
||||
. tmStatus
|
||||
. tiText
|
||||
%~ take 42
|
||||
where
|
||||
checkEndStatus
|
||||
| u ^. uvWorld . input . pressedKeys . at ScancodeReturn == Just 0 =
|
||||
@@ -504,7 +567,7 @@ doRegexInput ::
|
||||
(IMSS a, Maybe Selection, Maybe String)
|
||||
doRegexInput inp i sss msel filts
|
||||
| backspacetonothing || escapekey = endregex i 0
|
||||
| endkeys = endregex (i + 1) (j -1)
|
||||
| endkeys = endregex (i + 1) (j - 1)
|
||||
| otherwise =
|
||||
( sss
|
||||
, msel
|
||||
@@ -530,15 +593,28 @@ updateBackspaceRegex :: World -> World
|
||||
updateBackspaceRegex w = case di ^? subInventory of
|
||||
Just NoSubInventory{}
|
||||
| secfocus (-1) 0 ->
|
||||
w & hud %~ trybackspace (-1) diInvFilter diInvFilter diSelection
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
w
|
||||
& hud
|
||||
%~ trybackspace (-1) diInvFilter diInvFilter diSelection
|
||||
& worldEventFlags
|
||||
. at InventoryChange
|
||||
?~ ()
|
||||
Just NoSubInventory{}
|
||||
| secfocus 2 3 ->
|
||||
w & hud %~ trybackspace 2 diCloseFilter diCloseFilter diSelection
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
w
|
||||
& hud
|
||||
%~ trybackspace 2 diCloseFilter diCloseFilter diSelection
|
||||
& worldEventFlags
|
||||
. at InventoryChange
|
||||
?~ ()
|
||||
Just CombineInventory{} ->
|
||||
w & hud . subInventory %~ trybackspace (-1) ciFilter ciFilter ciSelection
|
||||
& worldEventFlags . at InventoryChange ?~ ()
|
||||
w
|
||||
& hud
|
||||
. subInventory
|
||||
%~ trybackspace (-1) ciFilter ciFilter ciSelection
|
||||
& worldEventFlags
|
||||
. at InventoryChange
|
||||
?~ ()
|
||||
_ -> w
|
||||
where
|
||||
secfocus a b = fromMaybe False $ do
|
||||
@@ -548,9 +624,13 @@ updateBackspaceRegex w = case di ^? subInventory of
|
||||
str <- he ^? filtget . _Just
|
||||
return $ case str of
|
||||
(_ : _) ->
|
||||
he & filtset . _Just %~ init
|
||||
& selset ?~ Sel x 0
|
||||
-- & selset ?~ Sel x 0 mempty
|
||||
he
|
||||
& filtset
|
||||
. _Just
|
||||
%~ init
|
||||
& selset
|
||||
?~ Sel x 0
|
||||
-- & selset ?~ Sel x 0 mempty
|
||||
[] -> he & filtset .~ Nothing
|
||||
di = w ^. hud
|
||||
|
||||
@@ -558,18 +638,35 @@ updateEnterRegex :: World -> World
|
||||
updateEnterRegex w = case w ^? hud . subInventory of
|
||||
Just NoSubInventory{}
|
||||
| secfocus [-1, 0, 1] ->
|
||||
-- w & hud . diSelection ?~ Sel (-1) 0 mempty
|
||||
w & hud . diSelection ?~ Sel (-1) 0
|
||||
& hud . diInvFilter %~ enterregex
|
||||
-- w & hud . diSelection ?~ Sel (-1) 0 mempty
|
||||
w
|
||||
& hud
|
||||
. diSelection
|
||||
?~ Sel (-1) 0
|
||||
& hud
|
||||
. diInvFilter
|
||||
%~ enterregex
|
||||
Just NoSubInventory{}
|
||||
| secfocus [2, 3] ->
|
||||
-- w & hud . diSelection ?~ Sel 2 0 mempty
|
||||
w & hud . diSelection ?~ Sel 2 0
|
||||
& hud . diCloseFilter %~ enterregex
|
||||
w
|
||||
& hud
|
||||
. diSelection
|
||||
?~ Sel 2 0
|
||||
& hud
|
||||
. diCloseFilter
|
||||
%~ enterregex
|
||||
Just CombineInventory{} ->
|
||||
w & hud . subInventory . ciFilter %~ enterregex
|
||||
-- & hud . subInventory . ciSelection ?~ Sel (-1) 0 mempty
|
||||
& hud . subInventory . ciSelection ?~ Sel (-1) 0
|
||||
w
|
||||
& hud
|
||||
. subInventory
|
||||
. ciFilter
|
||||
%~ enterregex
|
||||
-- & hud . subInventory . ciSelection ?~ Sel (-1) 0 mempty
|
||||
& hud
|
||||
. subInventory
|
||||
. ciSelection
|
||||
?~ Sel (-1) 0
|
||||
_ -> w
|
||||
where
|
||||
secfocus xs = fromMaybe False $ do
|
||||
@@ -601,7 +698,8 @@ tryCombine :: (Int, Int) -> World -> World
|
||||
tryCombine (i, j) w = fromMaybe w $ do
|
||||
CombItem is it <-
|
||||
w
|
||||
^? hud . subInventory
|
||||
^? hud
|
||||
. subInventory
|
||||
. ciSections
|
||||
. ix i
|
||||
. ssItems
|
||||
@@ -612,7 +710,12 @@ tryCombine (i, j) w = fromMaybe w $ do
|
||||
return $
|
||||
createItemYou it (foldr (destroyInvItem 0 . NInt) w (sort is))
|
||||
& soundStart InventorySound p wrench1S Nothing
|
||||
& hud . diSections . ix 1 . ssSet.~ mempty
|
||||
& hud
|
||||
. diSections
|
||||
. ix 1
|
||||
. ssSet
|
||||
.~ mempty
|
||||
|
||||
-- & hud . diSelection . _Just . slSet .~ mempty
|
||||
|
||||
maybeExitCombine :: World -> World
|
||||
|
||||
@@ -3026,7 +3026,7 @@ connectItemS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 802;" f
|
||||
constructEdges src/Polyhedra.hs 31;" f
|
||||
constructEdgesList src/Polyhedra.hs 40;" f
|
||||
contToIDCont src/Dodge/LevelGen/PlacementHelper.hs 58;" f
|
||||
continueTerminal src/Dodge/Update/Input/InGame.hs 452;" f
|
||||
continueTerminal src/Dodge/Update/Input/InGame.hs 523;" f
|
||||
convexHull src/Geometry/Polygon.hs 150;" f
|
||||
convexHullSafe src/Geometry/Polygon.hs 172;" f
|
||||
convexPolysOverlap src/Geometry/ConvexPoly.hs 48;" f
|
||||
@@ -3368,7 +3368,7 @@ doDebugTestF7 src/Dodge/Update/Input/DebugTest.hs 51;" f
|
||||
doDebugTestF8 src/Dodge/Update/Input/DebugTest.hs 59;" f
|
||||
doDoorLerp src/Dodge/Door/DoorLerp.hs 8;" f
|
||||
doDoorMount src/Dodge/Door.hs 32;" f
|
||||
doDrag src/Dodge/Update/Input/InGame.hs 148;" f
|
||||
doDrag src/Dodge/Update/Input/InGame.hs 158;" f
|
||||
doDrawing src/Dodge/Render.hs 33;" f
|
||||
doDrawing' src/Dodge/Render.hs 44;" f
|
||||
doFloatFloat src/Dodge/FloatFunction.hs 5;" f
|
||||
@@ -3387,7 +3387,7 @@ doPreload appDodge/Main.hs 133;" f
|
||||
doQuickload src/Dodge/Save.hs 83;" f
|
||||
doQuicksave src/Dodge/Save.hs 77;" f
|
||||
doRandImpulse src/Dodge/RandImpulse.hs 8;" f
|
||||
doRegexInput src/Dodge/Update/Input/InGame.hs 498;" f
|
||||
doRegexInput src/Dodge/Update/Input/InGame.hs 576;" f
|
||||
doRoomPlacements src/Dodge/Layout.hs 121;" f
|
||||
doRoomShift src/Dodge/Room/Link.hs 34;" f
|
||||
doScopeZoom src/Dodge/Update/Scroll.hs 89;" f
|
||||
@@ -3599,8 +3599,8 @@ encircleCloseP src/Dodge/Creature/Boid.hs 38;" f
|
||||
encircleDistP src/Dodge/Creature/Boid.hs 24;" f
|
||||
encircleP src/Dodge/Creature/Boid.hs 30;" f
|
||||
endArcPos src/Dodge/Tesla.hs 87;" f
|
||||
endCombineRegex src/Dodge/Update/Input/InGame.hs 340;" f
|
||||
endRegex src/Dodge/Update/Input/InGame.hs 334;" f
|
||||
endCombineRegex src/Dodge/Update/Input/InGame.hs 411;" f
|
||||
endRegex src/Dodge/Update/Input/InGame.hs 405;" f
|
||||
energyReleaseS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 742;" f
|
||||
enterCombineInv src/Dodge/DisplayInventory.hs 321;" f
|
||||
enumOption src/Dodge/Menu/OptionType.hs 17;" f
|
||||
@@ -3759,7 +3759,7 @@ getAutoSpringLinks src/Dodge/Item/Grammar.hs 90;" f
|
||||
getAvailableListLines src/Dodge/SelectionList.hs 10;" f
|
||||
getBulHitDams src/Dodge/Bullet.hs 175;" f
|
||||
getBulletType src/Dodge/HeldUse.hs 945;" f
|
||||
getCloseObj src/Dodge/Update/Input/InGame.hs 588;" f
|
||||
getCloseObj src/Dodge/Update/Input/InGame.hs 700;" f
|
||||
getCommand src/Dodge/Terminal.hs 61;" f
|
||||
getCommands src/Dodge/Terminal.hs 58;" f
|
||||
getCrMoveSpeed src/Dodge/Creature/Statistics.hs 56;" f
|
||||
@@ -4010,7 +4010,7 @@ isCognizant src/Dodge/Creature/Perception.hs 115;" f
|
||||
isConnected src/Dodge/Inventory/Swap.hs 86;" f
|
||||
isCornerLink src/Dodge/RoomLink.hs 66;" f
|
||||
isFlyable src/Dodge/WorldEvent/ThingsHit.hs 232;" f
|
||||
isGroupSelectableSection src/Dodge/Update/Input/InGame.hs 262;" f
|
||||
isGroupSelectableSection src/Dodge/Update/Input/InGame.hs 300;" f
|
||||
isInLnk src/Dodge/PlacementSpot.hs 163;" f
|
||||
isJust' src/MaybeHelp.hs 27;" f
|
||||
isLHS src/Geometry/LHS.hs 12;" f
|
||||
@@ -4299,7 +4299,7 @@ maybeBlockedPassage src/Dodge/Room/RezBox.hs 80;" f
|
||||
maybeClearLoadingScreen src/Dodge/StartNewGame.hs 58;" f
|
||||
maybeDestroyBlock src/Dodge/Wall/Damage.hs 136;" f
|
||||
maybeDestroyDoor src/Dodge/Wall/Damage.hs 141;" f
|
||||
maybeExitCombine src/Dodge/Update/Input/InGame.hs 618;" f
|
||||
maybeExitCombine src/Dodge/Update/Input/InGame.hs 736;" f
|
||||
maybeOpenConsole src/Dodge/Update.hs 135;" f
|
||||
maybeReadFile src/Dodge/LoadSeed.hs 10;" f
|
||||
maybeTakeOne src/RandomHelp.hs 135;" f
|
||||
@@ -4541,7 +4541,7 @@ passthroughLockKeyLists src/Dodge/Room/Tutorial.hs 693;" f
|
||||
pathConnected src/Dodge/Room/CheckConsistency.hs 13;" f
|
||||
pathEdgeObstructed src/Dodge/Path.hs 87;" f
|
||||
pauseAndFloatCam src/Dodge/Camera.hs 10;" f
|
||||
pauseGame src/Dodge/Update/Input/InGame.hs 580;" f
|
||||
pauseGame src/Dodge/Update/Input/InGame.hs 692;" f
|
||||
pauseMenu src/Dodge/Menu.hs 57;" f
|
||||
pauseMenuOptions src/Dodge/Menu.hs 64;" f
|
||||
pauseSound src/Dodge/SoundLogic.hs 42;" f
|
||||
@@ -5019,7 +5019,7 @@ selSecSelCol src/Dodge/Render/HUD.hs 527;" f
|
||||
selSecSelSize src/Dodge/SelectionSections.hs 159;" f
|
||||
selSecYint src/Dodge/SelectionSections.hs 168;" f
|
||||
selectedItemScroll src/Dodge/Update/Scroll.hs 49;" f
|
||||
selectionSet src/Dodge/Update/Input/InGame.hs 172;" f
|
||||
selectionSet src/Dodge/Update/Input/InGame.hs 184;" f
|
||||
semitoneLoop1S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 846;" f
|
||||
sensAboveDoor src/Dodge/Room/SensorDoor.hs 68;" f
|
||||
sensInsideDoor src/Dodge/Room/SensorDoor.hs 77;" f
|
||||
@@ -5052,9 +5052,9 @@ setOldPos src/Dodge/Update.hs 602;" f
|
||||
setOutLinks src/Dodge/RoomLink.hs 49;" f
|
||||
setOutLinksByType src/Dodge/RoomLink.hs 76;" f
|
||||
setOutLinksPD src/Dodge/RoomLink.hs 96;" f
|
||||
setPixelOffsetBounded src/Dodge/Update/Input/InGame.hs 137;" f
|
||||
setPixelOffsetBounded src/Dodge/Update/Input/InGame.hs 145;" f
|
||||
setRBCreatureTargeting src/Dodge/Creature/State.hs 318;" f
|
||||
setSelWhileDragging src/Dodge/Update/Input/InGame.hs 396;" f
|
||||
setSelWhileDragging src/Dodge/Update/Input/InGame.hs 467;" f
|
||||
setSelectionListRestriction src/Dodge/Update/Input/ScreenLayer.hs 93;" f
|
||||
setShaderSource src/Shader/Compile.hs 121;" f
|
||||
setShadowLimits src/Dodge/Shadows.hs 11;" f
|
||||
@@ -5097,7 +5097,7 @@ shiftByV2 src/Dodge/PlacementSpot.hs 257;" f
|
||||
shiftChildren src/Dodge/Tree/Compose.hs 45;" f
|
||||
shiftDraw src/Dodge/Render/ShapePicture.hs 111;" f
|
||||
shiftInBy src/Dodge/PlacementSpot.hs 254;" f
|
||||
shiftInvItems src/Dodge/Update/Input/InGame.hs 364;" f
|
||||
shiftInvItems src/Dodge/Update/Input/InGame.hs 435;" f
|
||||
shiftInvItemsDown src/Dodge/Inventory.hs 186;" f
|
||||
shiftInvItemsUp src/Dodge/Inventory.hs 196;" f
|
||||
shiftLinkBy src/Dodge/Room/Link.hs 89;" f
|
||||
@@ -5231,7 +5231,7 @@ soundWithStatus src/Dodge/SoundLogic.hs 104;" f
|
||||
soundWithStatusVolume src/Dodge/SoundLogic.hs 54;" f
|
||||
southPillarsRoom src/Dodge/Room/LongDoor.hs 89;" f
|
||||
spPos src/ShapePicture/Data.hs 11;" f
|
||||
spaceAction src/Dodge/Update/Input/InGame.hs 583;" f
|
||||
spaceAction src/Dodge/Update/Input/InGame.hs 695;" f
|
||||
spanColLightBlackI src/Dodge/Placement/Instance/LightSource.hs 162;" f
|
||||
spanColLightI src/Dodge/Placement/Instance/LightSource.hs 155;" f
|
||||
spanLS src/Dodge/Placement/Instance/LightSource.hs 147;" f
|
||||
@@ -5292,7 +5292,7 @@ stackedInventory src/Dodge/Creature.hs 318;" f
|
||||
startCr src/Dodge/Creature.hs 83;" f
|
||||
startCrafts src/Dodge/Room/Start.hs 94;" f
|
||||
startDeathTimer src/Dodge/Creature/Update.hs 495;" f
|
||||
startDrag src/Dodge/Update/Input/InGame.hs 349;" f
|
||||
startDrag src/Dodge/Update/Input/InGame.hs 420;" f
|
||||
startInvList src/Dodge/Creature.hs 97;" f
|
||||
startInventory src/Dodge/Creature.hs 100;" f
|
||||
startNewGameInSlot src/Dodge/StartNewGame.hs 16;" f
|
||||
@@ -5521,14 +5521,14 @@ truncate src/Polyhedra/Geodesic.hs 39;" f
|
||||
trunkDepth src/TreeHelp.hs 164;" f
|
||||
tryAttachItems src/Dodge/Item/Grammar.hs 35;" f
|
||||
tryClickUse src/Dodge/Creature/YourControl.hs 207;" f
|
||||
tryCombine src/Dodge/Update/Input/InGame.hs 600;" f
|
||||
tryCombine src/Dodge/Update/Input/InGame.hs 712;" f
|
||||
tryDrawToCapacitor src/Dodge/Creature/State.hs 179;" f
|
||||
tryDropSelected src/Dodge/Update/Input/InGame.hs 159;" f
|
||||
tryDropSelected src/Dodge/Update/Input/InGame.hs 169;" f
|
||||
tryEvadeSideways src/Dodge/Creature/Action.hs 101;" f
|
||||
tryGetChannel src/Sound.hs 99;" f
|
||||
tryGetRootAttachedFromInvID src/Dodge/Inventory/Location.hs 23;" f
|
||||
tryMeleeAttack src/Dodge/Creature/ReaderUpdate.hs 42;" f
|
||||
tryPickupSelected src/Dodge/Update/Input/InGame.hs 184;" f
|
||||
tryPickupSelected src/Dodge/Update/Input/InGame.hs 196;" f
|
||||
tryPlay src/Sound.hs 85;" f
|
||||
tryPutItemInInv src/Dodge/Inventory/Add.hs 25;" f
|
||||
tryPutItemInInvAt src/Dodge/Inventory/Add.hs 56;" f
|
||||
@@ -5581,7 +5581,7 @@ updateAggroBee src/Dodge/Creature/Update.hs 129;" f
|
||||
updateAimPos src/Dodge/Update.hs 400;" f
|
||||
updateAllNodes src/TreeHelp.hs 88;" f
|
||||
updateArc src/Dodge/Tesla.hs 44;" f
|
||||
updateBackspaceRegex src/Dodge/Update/Input/InGame.hs 529;" f
|
||||
updateBackspaceRegex src/Dodge/Update/Input/InGame.hs 607;" f
|
||||
updateBarrel src/Dodge/Barreloid.hs 43;" f
|
||||
updateBarreloid src/Dodge/Barreloid.hs 16;" f
|
||||
updateBaseWheelEvent src/Dodge/Update/Scroll.hs 30;" f
|
||||
@@ -5625,14 +5625,14 @@ updateEdgesWall src/Dodge/Update/WallDamage.hs 23;" f
|
||||
updateEdgesWall' src/Dodge/Update/WallDamage.hs 36;" f
|
||||
updateEnergyBall src/Dodge/EnergyBall.hs 32;" f
|
||||
updateEnergyBalls src/Dodge/Update.hs 775;" f
|
||||
updateEnterRegex src/Dodge/Update/Input/InGame.hs 557;" f
|
||||
updateEnterRegex src/Dodge/Update/Input/InGame.hs 652;" f
|
||||
updateExpBarrel src/Dodge/Barreloid.hs 21;" f
|
||||
updateFlame src/Dodge/Flame.hs 19;" f
|
||||
updateFlames src/Dodge/Update.hs 772;" f
|
||||
updateFloatingCamera src/Dodge/Update/Camera.hs 38;" f
|
||||
updateFoodSearchChaseCrit src/Dodge/Creature/Update.hs 381;" f
|
||||
updateFunctionKey src/Dodge/Update/Input/InGame.hs 413;" f
|
||||
updateFunctionKeys src/Dodge/Update/Input/InGame.hs 409;" f
|
||||
updateFunctionKey src/Dodge/Update/Input/InGame.hs 484;" f
|
||||
updateFunctionKeys src/Dodge/Update/Input/InGame.hs 480;" f
|
||||
updateGas src/Dodge/Update.hs 942;" f
|
||||
updateGusts src/Dodge/Update.hs 904;" f
|
||||
updateHiveCrit src/Dodge/Creature/Update.hs 82;" f
|
||||
@@ -5640,30 +5640,30 @@ updateHoverCrit src/Dodge/Humanoid.hs 25;" f
|
||||
updateIMl src/Dodge/Update.hs 639;" f
|
||||
updateIMl' src/Dodge/Update.hs 642;" f
|
||||
updateInGameCamera src/Dodge/Update/Camera.hs 86;" f
|
||||
updateInitialPressInGame src/Dodge/Update/Input/InGame.hs 479;" f
|
||||
updateInitialPressInGame src/Dodge/Update/Input/InGame.hs 557;" f
|
||||
updateInt2Map src/Dodge/Zoning/Base.hs 94;" f
|
||||
updateInventoryPositioning src/Dodge/DisplayInventory.hs 87;" f
|
||||
updateItemTargeting src/Dodge/Creature/State.hs 288;" f
|
||||
updateKeyContinueTerminal src/Dodge/Update/Input/InGame.hs 446;" f
|
||||
updateKeyInGame src/Dodge/Update/Input/InGame.hs 473;" f
|
||||
updateKeysInGame src/Dodge/Update/Input/InGame.hs 87;" f
|
||||
updateKeysInTerminal src/Dodge/Update/Input/InGame.hs 432;" f
|
||||
updateKeysTextInputTerminal src/Dodge/Update/Input/InGame.hs 455;" f
|
||||
updateKeyContinueTerminal src/Dodge/Update/Input/InGame.hs 517;" f
|
||||
updateKeyInGame src/Dodge/Update/Input/InGame.hs 551;" f
|
||||
updateKeysInGame src/Dodge/Update/Input/InGame.hs 89;" f
|
||||
updateKeysInTerminal src/Dodge/Update/Input/InGame.hs 503;" f
|
||||
updateKeysTextInputTerminal src/Dodge/Update/Input/InGame.hs 526;" f
|
||||
updateLampoid src/Dodge/Lampoid.hs 13;" f
|
||||
updateLaser src/Dodge/Laser/Update.hs 12;" f
|
||||
updateLasers src/Dodge/Update.hs 517;" f
|
||||
updateLeftParentSF src/Dodge/Item/Grammar.hs 179;" f
|
||||
updateLinearShockwave src/Dodge/LinearShockwave/Update.hs 8;" f
|
||||
updateLivingCreature src/Dodge/Creature/Update.hs 61;" f
|
||||
updateLongPressInGame src/Dodge/Update/Input/InGame.hs 492;" f
|
||||
updateLongPressInGame src/Dodge/Update/Input/InGame.hs 570;" f
|
||||
updateMachine src/Dodge/Machine/Update.hs 24;" f
|
||||
updateMagnets src/Dodge/Update.hs 408;" f
|
||||
updateMouseClickInGame src/Dodge/Update/Input/InGame.hs 268;" f
|
||||
updateMouseClickInGame src/Dodge/Update/Input/InGame.hs 306;" f
|
||||
updateMouseContext src/Dodge/Update.hs 421;" f
|
||||
updateMouseContextGame src/Dodge/Update.hs 426;" f
|
||||
updateMouseHeldInGame src/Dodge/Update/Input/InGame.hs 100;" f
|
||||
updateMouseInGame src/Dodge/Update/Input/InGame.hs 90;" f
|
||||
updateMouseReleaseInGame src/Dodge/Update/Input/InGame.hs 210;" f
|
||||
updateMouseHeldInGame src/Dodge/Update/Input/InGame.hs 102;" f
|
||||
updateMouseInGame src/Dodge/Update/Input/InGame.hs 92;" f
|
||||
updateMouseReleaseInGame src/Dodge/Update/Input/InGame.hs 222;" f
|
||||
updateObjCatMaybes src/Dodge/Update.hs 657;" f
|
||||
updateObjMapMaybe src/Dodge/Update.hs 650;" f
|
||||
updatePastWorlds src/Dodge/Update.hs 506;" f
|
||||
|
||||
Reference in New Issue
Block a user