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
+8 -8
View File
@@ -226,7 +226,7 @@ randomFourCornerRoom = do
randomiseAllLinks . fillNothingPlacements (crits ++ itms) =<<
( shufflePlacements
. foldr1 combineRooms
$ zipWith (\r a -> shiftRoomBy ((V2 0 0),a) r) corners [0,pi/2,pi,3*pi/2]
$ zipWith (\r a -> shiftRoomBy (V2 0 0,a) r) corners [0,pi/2,pi,3*pi/2]
)
{- | Creates room with a central vault with doors around it.
-}
@@ -246,10 +246,10 @@ centerVaultRoom n w h d = do
return $ defaultRoom
{ _rmPolys = polys
, _rmLinks =
[((V2 0 h),0)
,((V2 w 0),-pi/2)
,((V2 (-w) (0)),pi/2)
,((V2 (0) (-h)),pi)
[(V2 0 h , 0 )
,(V2 w 0 ,-pi/2)
,(V2 (-w) 0 , pi/2)
,(V2 0 (-h), pi )
]
, _rmPath = []
, _rmPS =
@@ -259,15 +259,15 @@ centerVaultRoom n w h d = do
,sPS (V2 (5-w) (h-5)) 0 putLamp
,sPS (V2 (5-w) (5-h)) 0 putLamp
]
++ concat (zipWith (\i r -> map (shiftPSBy ((V2 0 0),r)) $ theDoor i)
++ concat (zipWith (\i r -> map (shiftPSBy (V2 0 0,r)) $ theDoor i)
[n, n+1, n+2, n+3] [0,pi/2,pi,3*pi/2])
, _rmBound = [rectNSWE h (-h) (-w) w]
}
where
col = dim $ dim $ bright red
theDoor i =
[ sPS (V2 (0) (d-10)) 0 $ PutDoubleDoor col (cond i) (V2 (-19) (0)) (V2 19 0)
, sPS (V2 (35) (d+4)) 0 $ PutButton $ makeSwitch col
[ sPS (V2 0 (d-10)) 0 $ PutDoubleDoor col (cond i) (V2 (-19) 0) (V2 19 0)
, sPS (V2 35 (d+4)) 0 $ PutButton $ makeSwitch col
(over worldState (M.insert (DoorNumOpen i) True))
(over worldState (M.insert (DoorNumOpen i) False))
]
+10 -10
View File
@@ -32,20 +32,20 @@ litCorridor90 = do
poly2 = rectNSWE (h-60) (h-100) (-60) 5
pure $ defaultRoom
{ _rmPolys = [poly,poly2]
, _rmLinks = [ ((V2 (40) (h - 80)), -pi/2)
, ((V2 (20) ( 0)), pi)
, _rmLinks = [ (V2 40 (h - 80), -pi/2)
, (V2 20 0 , pi )
]
, _rmPath = concatMap doublePair
[((V2 20 0),(V2 (20) (h-40)))
,((V2 ( 0) (h-40)),(V2 (20) (h-40)))
,((V2 (40) (h-40)),(V2 (20) (h-40)))
[( V2 20 0 , V2 20 (h-40) )
,( V2 0 (h-40) , V2 20 (h-40) )
,( V2 40 (h-40) , V2 20 (h-40) )
]
, _rmPS =
[ sPS (V2 (20) (h-5)) 0 putLamp
, windowLine (V2 (0) (h-20)) (V2 (40) (h-20))
[ sPS (V2 20 (h-5)) 0 putLamp
, windowLine (V2 0 (h-20)) (V2 40 (h-20))
, sPS (V2 (-50) (h-85)) 0 putLamp
, windowLine (V2 (-40) (h-60)) (V2 (-40) (h-100))
, sPS (V2 ( 20) (h-40)) 0 $ PutID 0
, sPS (V2 20 (h-40)) 0 $ PutID 0
, sPS (V2 (-20) (h-80)) 0 $ PutID 2
]
, _rmBound = [poly]
@@ -60,7 +60,7 @@ longBlockedCorridor :: RandomGen g => State g (Tree (Either Room Room))
longBlockedCorridor = do
r <- state $ randomR (0,pi)
n <- state $ randomR (0,3)
let plmnts = [sPS (V2 20 40) r $ PutBlock [5,5,5] (V4 (150/256) (75/256) (0) (250/256))
let plmnts = [sPS (V2 20 40) r $ PutBlock [5,5,5] (V4 (150/256) (75/256) 0 (250/256))
$ reverse $ rectNSWE 10 (-10) (-10) 10
,sPS (V2 20 15) 0 putLamp
]
@@ -71,7 +71,7 @@ longBlockedCorridor = do
blockedCorridor :: RandomGen g => State g (Tree (Either Room Room))
blockedCorridor = do
r <- state $ randomR (0,pi)
let plmnts = [sPS (V2 20 40) r $ PutBlock [5,5,5] (V4 (150/256) ( 75/256) ( 0) ( 250/256))
let plmnts = [sPS (V2 20 40) r $ PutBlock [5,5,5] (V4 (150/256) ( 75/256) 0 ( 250/256))
$ reverse $ rectNSWE 10 (-10) (-10) 10
,sPS (V2 20 15) 0 putLamp
]
+5 -5
View File
@@ -16,20 +16,20 @@ import Control.Lens
import System.Random
rezBox :: Room
rezBox = shiftRoomBy ((V2 (-20) (-10)),0) $ roomRect 40 20 1 1 & rmPS .~ []
rezBox = shiftRoomBy (V2 (-20) (-10),0) $ roomRect 40 20 1 1 & rmPS .~ []
startRoom :: RandomGen g => State g (Tree (Either Room Room))
startRoom = do
w <- state $ randomR (100,400)
h <- state $ randomR (200,400)
let fground = sPS (V2 0 0) 0 $ PutForeground $
highPipe 80 (V2 (0) (h/3)) (V2 (w) ( h/2))
++ highPipe 40 (V2 (0) (h/2)) (V2 (w) ( h/3))
++ highPipe 60 (V2 (w/3) (0)) (V2 (w/3) ( h))
highPipe 80 (V2 0 (h/3)) (V2 w (h/2))
++ highPipe 40 (V2 0 (h/2)) (V2 w (h/3))
++ highPipe 60 (V2 (w/3) 0 ) (V2 (w/3) h )
-- ++ highPipe 20 (0,2*h/3) (w, h/3)
-- , girderV cola 10 (0,3*h/4) (w, 3*h/4)
-- , girder colb 5 (0,5*h/8) (w, 5*h/8)
treeFromPost [Left rezBox, Left door] . Right <$> randomiseOutLinks (shiftRoomBy ((V2 (-20) (-20)),0) $ roomRectAutoLinks w h & rmPS %~ (fground :))
treeFromPost [Left rezBox, Left door] . Right <$> randomiseOutLinks (shiftRoomBy (V2 (-20) (-20),0) $ roomRectAutoLinks w h & rmPS %~ (fground :))
-- where
-- cola = dark . dark . light . light $ light red
-- colb = dark . dark . light . light $ light blue
+1 -1
View File
@@ -34,7 +34,7 @@ telRoomLev i = do
where
telPP = PressPlate
{ _ppPict = setDepth 0.5 . color red $ polygon ppFootprint
, _ppPos = (V2 0 0)
, _ppPos = V2 0 0
, _ppRot = 0
, _ppEvent = levelReset
, _ppID = 0
+9 -9
View File
@@ -25,17 +25,17 @@ triLootRoom
triLootRoom w h = pure $ defaultRoom
{ _rmPolys = [ tri
, base
]
, _rmLinks = [((V2 (0) (-80)),pi)]
, _rmPath = doublePair ((V2 (0) (-80)),(V2 (0) (h/2)))
]
, _rmLinks = [(V2 0 (-80) , pi)]
, _rmPath = doublePair (V2 0 (-80) , V2 0 (h/2))
, _rmPS =
[sPS (V2 (15-w) ( 15)) 0 $ PutID 0
,sPS (V2 (w-15) ( 15)) pi $ PutID 0
,sPS (V2 ( 0) (h-35)) 0 $ PutID 2
[sPS (V2 (15-w) 15 ) 0 $ PutID 0
,sPS (V2 (w-15) 15 ) pi $ PutID 0
,sPS (V2 0 (h-35)) 0 $ PutID 2
,sPS (V2 ( -5) (h-10)) 0 putLamp
,sPS (V2 ( 5) (h-10)) 0 putLamp
,sPS (V2 ( 0) (h-15)) 0 putLamp
,sPS (V2 ( 0) ( -60)) 0 putLamp
,sPS (V2 5 (h-10)) 0 putLamp
,sPS (V2 0 (h-15)) 0 putLamp
,sPS (V2 0 ( -60)) 0 putLamp
]
, _rmBound = [tri , base]
}
+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
+1 -1
View File
@@ -14,7 +14,7 @@ makeCloudAt rad t drawFunc p w = w & clouds %~ (theCloud :)
where
theCloud = Cloud
{ _clPos = p
, _clVel = (V2 0 0)
, _clVel = V2 0 0
, _clPict = drawFunc
, _clRad = rad
, _clTimer = t
+4 -4
View File
@@ -59,9 +59,9 @@ drawFlame rotd pt = thePic
ep = _btPos' pt
thePic = pictures
[ glow
, aPic 3 prot2 18 (V2 (scaleChange + 1) (2)) red
, aPic 4 prot 19 (V2 (scaleChange + 0.5) (1.5)) orange
, aPic 5 prot3 20 (V2 (scaleChange) (1)) white
, aPic 3 prot2 18 (V2 (scaleChange + 1) 2 ) red
, aPic 4 prot 19 (V2 (scaleChange + 0.5) 1.5) orange
, aPic 5 prot3 20 (V2 (scaleChange) 1 ) white
]
aPic :: Int -> (Point2 -> Point2) -> Float -> Point2 -> Color -> Picture
aPic lay offset depth (V2 scalex scaley) col
@@ -143,7 +143,7 @@ makeFlameletTimed (V2 x y) z vel maycid size time w = w
, _ptUpdate' = moveFlamelet
, _btVel' = vel
, _btColor' = red
, _btPos' = (V2 x y)
, _btPos' = V2 x y
, _btPassThrough' = maycid
, _btWidth' = size
, _btTimer' = time