Fix aiming creature direction when zooming

This commit is contained in:
2022-06-05 00:51:53 +01:00
parent 8e73203db3
commit 5e144b1cd5
3 changed files with 14 additions and 9 deletions
+8 -5
View File
@@ -81,9 +81,11 @@ updateScopeZoom w
= case w ^? creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
. itScope . scopeZoomChange of
Just x
| x > 9 -> zoomInLongGun $ zoomInLongGun w
| x > 10 -> zoomInLongGun $ zoomInLongGun $ zoomInLongGun w
| x > 5 -> zoomInLongGun $ zoomInLongGun w
| x > 0 -> zoomInLongGun w
| x < -9 -> zoomOutLongGun $ zoomOutLongGun w
| x < -10 -> zoomOutLongGun $ zoomOutLongGun $ zoomOutLongGun w
| x < -5 -> zoomOutLongGun $ zoomOutLongGun w
| x < 0 -> zoomOutLongGun w
| otherwise -> w
_ -> w
@@ -99,10 +101,10 @@ zoomSpeed = 39/40
zoomInLongGun :: World -> World
zoomInLongGun w
| currentZoom < 8 = w
& wpPointer . itScope . scopePos .+.+~ (1-(1*zoomSpeed)) / newzoom *.* mousep
& wpPointer . itScope . scopePos .+.+~ (1-zoomSpeed) / newzoom *.* mousep
& wpPointer . itScope . scopeZoom %~ (/ zoomSpeed)
& decreaseScopeZoomChange
| otherwise = decreaseScopeZoomChange w
| otherwise = w & wpPointer . itScope . scopeZoomChange .~ 0
where
decreaseScopeZoomChange = wpPointer . itScope . scopeZoomChange -~ 1
wpPointer = creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
@@ -117,7 +119,8 @@ zoomOutLongGun w
-- & wpPointer . itScope . scopePos .+.+~ ((1*zoomSpeed-1)) / currentZoom *.* mousep
& wpPointer . itScope . scopeZoom *~ zoomSpeed
& increaseScopeZoomChange
| otherwise = increaseScopeZoomChange w
-- | otherwise = increaseScopeZoomChange w
| otherwise = w & wpPointer . itScope . scopeZoomChange .~ 0
where
--mousep = rotateV (_cameraRot w) $ _mousePos w
increaseScopeZoomChange = wpPointer . itScope . scopeZoomChange +~ 1