Introduce safeMinimumOn
This commit is contained in:
@@ -98,7 +98,10 @@ zoomOutLongGun w
|
||||
--currentCursorDisplacement = fromJust $ _itAttachment wp
|
||||
|
||||
rotCam :: World -> World
|
||||
rotCam = rotateCameraL . rotateCameraR . zoomCamIn . zoomCamOut . autoZoomCam
|
||||
rotCam = rotateCameraL
|
||||
. rotateCameraR
|
||||
. zoomCamIn . zoomCamOut
|
||||
. autoZoomCam
|
||||
|
||||
rotateCameraL :: World -> World
|
||||
rotateCameraL w
|
||||
@@ -150,13 +153,15 @@ autoZoomCam w = over cameraZoom changeZoom w
|
||||
scZoom = fromMaybe 1 $ yourItem w ^? itAttachment . _Just . scopeZoom
|
||||
|
||||
farWallDist :: Point2 -> World -> Float
|
||||
{-# INLINE farWallDist #-}
|
||||
farWallDist cpos w = min (halfWidth w / (horizontalMax+50) ) (halfHeight w / (verticalMax+50) )
|
||||
where
|
||||
horizontalMax = maximum $ map (h' (1,0)) rRays ++ map (h' (-1,0)) lRays
|
||||
verticalMax = maximum $ map (h' (0,1)) tRays ++ map (h' (0,-1)) bRays
|
||||
-- TODO: fix wallsAlongLine and use instead of checking against all walls
|
||||
-- h p = fromMaybe p $ collidePointIndirect cpos p $ wallsAlongLine cpos p w
|
||||
h p = fromMaybe p . collidePointIndirect cpos p $ _walls w
|
||||
--h p = fromMaybe p $ collidePointIndirect cpos p $ wallsAlongLine cpos p w
|
||||
--h p = fromMaybe p . collidePointIndirect cpos p $ _walls w
|
||||
wos = wallsOnScreen w
|
||||
h p = fromMaybe p $ collidePointIndirect cpos p wos
|
||||
h' x p = dotV (rotateV camRot x) (p -.- cpos)
|
||||
camRot = _cameraRot w
|
||||
rRays = rotF [( maxViewDistance,y) | y <- zs]
|
||||
|
||||
Reference in New Issue
Block a user