Correctly filter walls for distance test

This commit is contained in:
2022-06-24 09:34:45 +01:00
parent 86b1c2581b
commit ffdf7e4164
+4 -4
View File
@@ -22,7 +22,7 @@ import qualified Data.Map.Strict as M
import Data.Foldable
import Data.Maybe
import Control.Monad
import qualified Data.Set as S
import qualified Data.Set as Set
import qualified Data.IntMap.Strict as IM
import qualified SDL
--import Data.Monoid
@@ -168,8 +168,8 @@ rotateCamera cfig w
| keyr = rotateCameraBy (-0.025) w
| otherwise = ifConfigWallRotate cfig w
where
keyl = SDL.ScancodeQ `S.member` _keys w && notAtTerminal w
keyr = SDL.ScancodeE `S.member` _keys w && notAtTerminal w
keyl = SDL.ScancodeQ `Set.member` _keys w && notAtTerminal w
keyr = SDL.ScancodeE `Set.member` _keys w && notAtTerminal w
-- TODO check where/how this is used
notAtTerminal :: World -> Bool
@@ -216,7 +216,7 @@ farWallDistDirection p w = foldl' (flip (m . f)) (0,0,0,0) vps
f q = g $ rotateV (negate $ _cameraRot w)
-- $ collidePointWallsFilt wlIsOpaque p q (wallsAlongLine p q w) -.- p
-- $ L.purely S.fold_ (collidePointWallsL p q) (wallsAlongLineStream p q w) -.- p
$ runIdentity (L.purely S.fold_ (collidePointWallsL p q) (wallsAlongLineStream p q w)) -.- p
$ runIdentity (L.purely S.fold_ (collidePointWallsL p q) (S.filter wlIsOpaque $ wallsAlongLineStream p q w)) -.- p
g (V2 x y) = (y, negate y, x, negate x)
m (a,b,c,d) (x,y,z,w') = (max a x, max b y, max c z, max d w')
vps = concatMap _grViewpoints grs ++ extendedViewPoints p grs