Major item refactor, still broken
This commit is contained in:
@@ -3,6 +3,7 @@ module Dodge.Update.Scroll (
|
||||
updateWheelEvent,
|
||||
) where
|
||||
|
||||
import NewInt
|
||||
import Control.Applicative
|
||||
import qualified Data.ListTrie.Patricia.Map.Enum as PTE
|
||||
import Dodge.Data.Terminal.Status
|
||||
@@ -44,13 +45,13 @@ updateBaseWheelEvent yi w
|
||||
bdown b = w & has (input . mouseButtons . ix b)
|
||||
rbscrollmax = fromMaybe 1 $ do
|
||||
invid <- you w ^? crManipulation . manObject . imSelectedItem
|
||||
esite <- you w ^? crInv . ix invid >>= equipType -- . itUse . uequipEffect . eeType
|
||||
esite <- you w ^? crInv . ix invid >>= \k -> w ^? cWorld . lWorld . items . ix k >>= equipType -- . itUse . uequipEffect . eeType
|
||||
return . length $ eqSiteToPositions esite
|
||||
|
||||
selectedItemScroll :: Int -> World -> Maybe World
|
||||
selectedItemScroll yi w = do
|
||||
i <- you w ^? crManipulation . manObject . imSelectedItem
|
||||
itm <- you w ^? crInv . ix i
|
||||
itm <- you w ^? crInv . ix i >>= \k -> w ^? cWorld . lWorld . items . ix k
|
||||
return $ itemScroll yi i itm w
|
||||
|
||||
itemScroll :: Int -> Int -> Item -> World -> World
|
||||
@@ -69,7 +70,8 @@ itemScroll yi invid itm w
|
||||
%~ ((`mod` y) . (+ yi))
|
||||
| otherwise = w
|
||||
where
|
||||
itmlens = cWorld . lWorld . creatures . ix 0 . crInv . ix invid
|
||||
--itmlens = cWorld . lWorld . creatures . ix 0 . crInv . ix invid
|
||||
itmlens = cWorld . lWorld . items . ix (itm ^. itID . unNInt)
|
||||
|
||||
-- note that your _crInvLock does not apply to this TODO check that this is what
|
||||
-- is wanted
|
||||
@@ -82,7 +84,8 @@ updateScopeZoom i w
|
||||
w & wppointer %~ doScopeZoom (w ^. input . smoothScrollAmount) (w ^. input . mousePos)
|
||||
| otherwise = w & wppointer %~ resetscope
|
||||
where
|
||||
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix i . itUse . uScope
|
||||
itid = w ^?! cWorld . lWorld . creatures . ix 0 . crInv . ix i
|
||||
wppointer = cWorld . lWorld . items . ix itid . itUse . uScope
|
||||
resetscope (OpticScope _ _ defz) = OpticScope (V2 0 0) defz defz
|
||||
|
||||
doScopeZoom :: Int -> Point2 -> Scope -> Scope
|
||||
|
||||
Reference in New Issue
Block a user