Improve scope zooming

This commit is contained in:
2022-06-05 00:19:44 +01:00
parent 512bc4c1ab
commit 8e73203db3
9 changed files with 41 additions and 77 deletions
+1
View File
@@ -28,6 +28,7 @@ data Scope = NoScope
{_scopePos :: Point2 -- ^ a camera offset
,_scopeZoomChange :: Int
,_scopeZoom :: Float
,_scopeDefaultZoom :: Float
,_scopeIsCamera :: Bool -- ^ if the camera offset is also the center of vision
}
+2 -1
View File
@@ -132,8 +132,9 @@ sniperRifle = elephantGun
& itParams . gunBarrels .~ SingleBarrel 0
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}
& itUse . heldScroll .~ zoomLongGun
& itScope .~ ZoomScope (V2 0 0) 0 1 False
& itScope .~ ZoomScope (V2 0 0) 0 1 0.5 False
& itTargeting .~ targetLaser
& itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1}
machineGun :: Item
machineGun = bangRod
& itName .~ "MACHINEGUN"
+1 -1
View File
@@ -297,7 +297,7 @@ longGun = defaultGun
& useAim . aimZoom .~ defaultItZoom {_itZoomMax = 0.5, _itZoomMin = 0.5}
& heldScroll .~ zoomLongGun
, _itAttachment = NoItAttachment
, _itScope = ZoomScope (V2 0 0) 0 1 False
, _itScope = ZoomScope (V2 0 0) 0 1 0.1 False
-- , _itEffect = itemLaserScopeEffect
}
+3 -2
View File
@@ -4,6 +4,7 @@ import LensHelp
zoomLongGun :: Float -> Creature -> Item -> Item
zoomLongGun x _
| x > 0 = itScope . scopeZoomChange %~ (max 5 . (+5))
| x < 0 = itScope . scopeZoomChange %~ (min (-5) . subtract 5)
| x > 0 = itScope . scopeZoomChange %~ (max 10 . (+3))
| x < 0 = itScope . scopeZoomChange %~ (min (-10) . subtract 3)
| otherwise = id
--zoomLongGun x _ = itScope . scopeZoomChange .~ round (signum x)