Some linting

This commit is contained in:
jgk
2021-08-10 14:22:33 +02:00
parent 51b8fab214
commit e43488ee17
11 changed files with 65 additions and 95 deletions
+6 -6
View File
@@ -158,18 +158,18 @@ farWallDist :: Point2 -> World -> Float
{-# INLINE farWallDist #-}
farWallDist cpos w = min (halfWidth w / (horizontalMax+50) ) (halfHeight w / (verticalMax+50) )
where
horizontalMax = maximum $ map (h' (V2 1 0)) rRays ++ map (h' (V2 (-1) (0))) lRays
verticalMax = maximum $ map (h' (V2 0 1)) tRays ++ map (h' (V2 (0) (-1))) bRays
horizontalMax = maximum $ map (h' (V2 1 0)) rRays ++ map (h' (V2 (-1) 0) ) lRays
verticalMax = maximum $ map (h' (V2 0 1)) tRays ++ map (h' (V2 0 (-1))) bRays
--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 [(V2 ( maxViewDistance) (y)) | y <- zs]
lRays = rotF [(V2 (-maxViewDistance) (y)) | y <- zs]
tRays = rotF [(V2 (y) ( maxViewDistance)) | y <- zs]
bRays = rotF [(V2 (y) (-maxViewDistance)) | y <- zs]
rRays = rotF [V2 maxViewDistance y | y <- zs]
lRays = rotF [V2 (-maxViewDistance) y | y <- zs]
tRays = rotF [V2 y maxViewDistance | y <- zs]
bRays = rotF [V2 y (-maxViewDistance) | y <- zs]
rotF = map (h . (+.+) cpos . rotateV (_cameraRot w))
zs = takeWhile (< maxViewDistance) [-maxViewDistance,negate $ 0.75*maxViewDistance..]
maxViewDistance = 800