Cleanup
This commit is contained in:
@@ -28,6 +28,7 @@ import Geometry
|
||||
import LensHelp
|
||||
import SDL
|
||||
|
||||
-- might not need the full universe here
|
||||
updateUseInputInGame :: Universe -> Universe
|
||||
updateUseInputInGame u = case u ^. uvWorld . hud . hudElement of
|
||||
DisplayCarte -> over uvWorld updatePressedButtonsCarte u
|
||||
@@ -40,7 +41,8 @@ updateUseInputInGame u = case u ^. uvWorld . hud . hudElement of
|
||||
u & uvWorld . cWorld . lWorld . terminals . ix tmid . tmInput . tiFocus %~ const True
|
||||
CombineInventory{_ciSections = sss}
|
||||
| inSubInvRegex (u ^. uvWorld) ->
|
||||
u & uvWorld . hud . hudElement . subInventory . ciSections %~ doRegexInput u (-1)
|
||||
u & uvWorld . hud . hudElement . subInventory . ciSections
|
||||
%~ doRegexInput (u ^. uvWorld . input) (-1)
|
||||
& uvWorld . worldEventFlags . at CombineInventoryChange ?~ ()
|
||||
| lbinitialpress ->
|
||||
(uvWorld . worldEventFlags . at InventoryChange ?~ ()) . maybeExitCombine $
|
||||
@@ -48,12 +50,12 @@ updateUseInputInGame u = case u ^. uvWorld . hud . hudElement of
|
||||
& uvWorld . worldEventFlags . at CombineInventoryChange ?~ ()
|
||||
_
|
||||
| inInvRegex (u ^. uvWorld) ->
|
||||
u & uvWorld . hud . hudElement . diSections %~ doRegexInput u (-1)
|
||||
u & uvWorld . hud . hudElement . diSections %~ doRegexInput (u ^. uvWorld . input) (-1)
|
||||
& uvWorld . worldEventFlags . at InventoryChange ?~ ()
|
||||
& uvWorld %~ setInvPosFromSS
|
||||
_
|
||||
| inCloseRegex (u ^. uvWorld) ->
|
||||
u & uvWorld . hud . hudElement . diSections %~ doRegexInput u 2
|
||||
u & uvWorld . hud . hudElement . diSections %~ doRegexInput (u ^. uvWorld . input) 2
|
||||
& uvWorld . worldEventFlags . at InventoryChange ?~ ()
|
||||
& uvWorld %~ setInvPosFromSS
|
||||
_ -> M.foldlWithKey' updateKeyInGame u pkeys
|
||||
@@ -89,7 +91,7 @@ updatePressedButtonsCarte' pkeys w
|
||||
|
||||
updateKeysInTerminal :: Int -> Universe -> Universe
|
||||
updateKeysInTerminal tmid u =
|
||||
u & doTextInputOver (uvWorld . cWorld . lWorld . terminals . ix tmid . tmInput . tiText)
|
||||
u & doTextInputOverUniverse (uvWorld . cWorld . lWorld . terminals . ix tmid . tmInput . tiText)
|
||||
& checkEndStatus
|
||||
where
|
||||
pkeys = u ^. uvWorld . input . pressedKeys
|
||||
@@ -130,11 +132,11 @@ updateLongPressInGame uv sc = case sc of
|
||||
ScancodeSpace -> over uvWorld spaceAction uv
|
||||
_ -> uv
|
||||
|
||||
doRegexInput :: Universe -> Int -> SelectionSections a -> SelectionSections a
|
||||
doRegexInput u i sss
|
||||
doRegexInput :: Input -> Int -> SelectionSections a -> SelectionSections a
|
||||
doRegexInput inp i sss
|
||||
| backspacetonothing || escapekey = endregex i 0
|
||||
| endkeys || endmouse = endregex (i + 1) (j -1)
|
||||
| otherwise = sss & doTextInputOver' u (sssExtra . sssFilters . ix i . _Just)
|
||||
| otherwise = sss & doTextInputOver inp (sssExtra . sssFilters . ix i . _Just)
|
||||
where
|
||||
endregex a b =
|
||||
sss
|
||||
@@ -149,11 +151,11 @@ doRegexInput u i sss
|
||||
any
|
||||
((== Just InitialPress) . (`M.lookup` pkeys))
|
||||
[ScancodeReturn, ScancodeSlash]
|
||||
endmouse = (Just 0 ==) $ u ^? uvWorld . input . mouseButtons . ix ButtonLeft
|
||||
endmouse = (Just 0 ==) $ inp ^? mouseButtons . ix ButtonLeft
|
||||
backspacetonothing =
|
||||
sss ^? sssExtra . sssFilters . ix i . _Just == Just ""
|
||||
&& ScancodeBackspace `M.lookup` pkeys == Just InitialPress
|
||||
pkeys = u ^. uvWorld . input . pressedKeys
|
||||
pkeys = inp ^. pressedKeys
|
||||
|
||||
updateBackspaceRegex :: World -> World
|
||||
updateBackspaceRegex w = case di ^? subInventory of
|
||||
|
||||
Reference in New Issue
Block a user