Fix laser targeting draw when creature offscreen

This commit is contained in:
2022-03-06 22:58:05 +00:00
parent f82bd3f788
commit 1364e7c8c8
14 changed files with 108 additions and 138 deletions
+6 -1
View File
@@ -28,7 +28,8 @@ import qualified SDL
{- Update the screen camera rotation and position, including any in rold scope/remote camera modifiers;
update where your avatar's view is from. -}
updateCamera :: Configuration -> World -> World
updateCamera cfig = rotateCamera cfig . autoZoomCamera cfig . moveCamera . updateScopeZoom
updateCamera cfig = rotateCamera cfig . setViewDistance cfig
. autoZoomCamera cfig . moveCamera . updateScopeZoom
{- Updte the center of the screen camera center and where your avatar's view is from in world. -}
moveCamera :: World -> World
moveCamera w = w
@@ -169,6 +170,10 @@ autoZoomCamera cfig w = w & cameraZoom %~ changeZoom
zoomOutSpeed = 15
theScopeZoom = fromMaybe 1 $ yourItem w ^? _Just . itScope . scopeZoom
setViewDistance :: Configuration -> World -> World
setViewDistance cfig w = w & viewDistance
.~ sqrt (halfWidth cfig ** 2 + halfHeight cfig ** 2) / _cameraZoom w
farWallDist :: Point2 -> Configuration -> World -> Float
farWallDist p cfig w = (winFac /) . min maxViewDistance $ ssfold (> maxViewDistance) findMax 1 vps
where