This commit is contained in:
2025-08-25 11:01:07 +01:00
parent ee884899ef
commit 65803c11c9
7 changed files with 17 additions and 34 deletions
+1
View File
@@ -5,6 +5,7 @@ module Dodge.Update.Input.InGame (
updateMouseInGame,
) where
import Dodge.Inventory.CheckSlots
import Dodge.Base.Collide
import Geometry.Vector
import Dodge.Data.Terminal.Status
+7 -9
View File
@@ -52,14 +52,13 @@ selectedItemScroll :: Int -> World -> Maybe World
selectedItemScroll yi w = do
i <- you w ^? crManipulation . manObject . imSelectedItem
itm <- you w ^? crInv . ix i >>= \k -> w ^? cWorld . lWorld . items . ix k
return $ itemScroll yi (_unNInt i) itm w
return $ itemScroll yi itm w
itemScroll :: Int -> Int -> Item -> World -> World
itemScroll yi invid itm w
-- | isJust $ itm ^? itUse . uInt = w & itmlens . itUse . uInt +~ yi
itemScroll :: Int -> Item -> World -> World
itemScroll yi itm w
| Just xs <- itm ^? itUse . uaParams . apProjectiles = w
& itmlens . itUse . uaParams . apProjectiles .~ rotateList yi xs
| ATTACH ZOOMSCOPE <- itm ^. itType = updateScopeZoom invid w
| ATTACH ZOOMSCOPE <- itm ^. itType = updateScopeZoom (itm ^. itID) w
| HELD ALTERIFLE <- itm ^. itType
, yi /= 0 =
w
@@ -75,8 +74,8 @@ itemScroll yi invid itm w
-- note that your _crInvLock does not apply to this TODO check that this is what
-- is wanted
updateScopeZoom :: Int -> World -> World
updateScopeZoom i w
updateScopeZoom :: NewInt ItmInt -> World -> World
updateScopeZoom itid w
| Just 0 <- w ^. input . mouseButtons . at SDL.ButtonRight =
w
& wppointer %~ resetscope
@@ -84,8 +83,7 @@ updateScopeZoom i w
w & wppointer %~ doScopeZoom (w ^. input . smoothScrollAmount) (w ^. input . mousePos)
| otherwise = w & wppointer %~ resetscope
where
itid = w ^?! cWorld . lWorld . creatures . ix 0 . crInv . ix (NInt i)
wppointer = cWorld . lWorld . items . ix itid . itUse . uScope
wppointer = cWorld . lWorld . items . ix (_unNInt itid) . itUse . uScope
resetscope (OpticScope _ _ defz) = OpticScope (V2 0 0) defz defz
doScopeZoom :: Int -> Point2 -> Scope -> Scope