From 2085d5a048a05abc8d06f6af74f14b1f9048e42e Mon Sep 17 00:00:00 2001 From: jgk Date: Tue, 27 Apr 2021 22:01:03 +0200 Subject: [PATCH] Commit before static wall change --- src/Dodge/Base.hs | 11 +++++++---- src/Dodge/Data.hs | 4 ---- src/Dodge/Default.hs | 3 --- src/Dodge/LevelGen.hs | 1 - src/Dodge/LevelGen/AutoDoor.hs | 1 - src/Dodge/LevelGen/Block.hs | 2 -- src/Dodge/LevelGen/TriggerDoor.hs | 1 - src/Dodge/Room/Placement.hs | 2 -- src/Dodge/Update/Camera.hs | 4 +++- 9 files changed, 10 insertions(+), 19 deletions(-) diff --git a/src/Dodge/Base.hs b/src/Dodge/Base.hs index 1ab085015..a78d196f9 100644 --- a/src/Dodge/Base.hs +++ b/src/Dodge/Base.hs @@ -393,10 +393,13 @@ furthestPointWalkable p1 p2 ws = head $ (sortBy (compare `on` dist p1) $ IM.elem ) ++ [p2] collidePointIndirect :: Point2 -> Point2 -> IM.IntMap Wall -> Maybe Point2 -collidePointIndirect p1 p2 ws = listToMaybe $ sortOn (dist p1) $ IM.elems - $ IM.mapMaybe ( ( \(x:y:_) -> intersectSegSeg' p1 p2 x y) - . _wlLine - ) notWindows +{-# INLINE collidePointIndirect #-} +collidePointIndirect p1 p2 ws = listToMaybe + $ sortOn (dist p1) + $ IM.elems + $ IM.mapMaybe ( ( \(x:y:_) -> intersectSegSeg' p1 p2 x y) + . _wlLine + ) notWindows where notWindows = IM.filter (not . _wlIsSeeThrough) ws diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index 8a790ae0d..f10a8df32 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -445,7 +445,6 @@ data Wall = Wall { _wlLine :: [Point2] , _wlID :: Int , _wlColor :: Color - , _wlDraw :: Maybe (Wall -> Picture) , _wlSeen :: Bool , _wlIsSeeThrough :: Bool } @@ -454,7 +453,6 @@ data Wall , _wlID :: Int , _doorMech :: World -> World , _wlColor :: Color - , _wlDraw :: Maybe (Wall -> Picture) , _wlSeen :: Bool , _blIDs :: [Int] , _blHP :: Int @@ -464,7 +462,6 @@ data Wall { _wlLine :: [Point2] , _wlID :: Int , _doorMech :: World -> World , _wlColor :: Color - , _wlDraw :: Maybe (Wall -> Picture) , _wlSeen :: Bool , _wlIsSeeThrough :: Bool , _doorPathable :: Bool @@ -473,7 +470,6 @@ data Wall { _wlLine :: [Point2] , _wlID :: Int , _wlColor :: Color - , _wlDraw :: Maybe (Wall -> Picture) , _wlSeen :: Bool , _blIDs :: [Int] , _blHP :: Int diff --git a/src/Dodge/Default.hs b/src/Dodge/Default.hs index 9d03d89db..9ef736335 100644 --- a/src/Dodge/Default.hs +++ b/src/Dodge/Default.hs @@ -31,7 +31,6 @@ defaultWall = Wall { _wlLine = [(0,0),(50,0)] , _wlID = 0 , _wlColor = greyN 0.6 - , _wlDraw = Nothing , _wlSeen = False , _wlIsSeeThrough = False } @@ -44,7 +43,6 @@ defaultAutoDoor = Door , _wlID = 0 , _doorMech = id , _wlColor = light $ dim $ dim $ dim $ yellow - , _wlDraw = Nothing , _wlSeen = False , _wlIsSeeThrough = False , _doorPathable = True @@ -57,7 +55,6 @@ defaultDoor = Door , _wlID = 0 , _doorMech = id , _wlColor = light $ dim $ dim $ dim $ yellow - , _wlDraw = Nothing , _wlSeen = False , _wlIsSeeThrough = False , _doorPathable = False diff --git a/src/Dodge/LevelGen.hs b/src/Dodge/LevelGen.hs index c075111ad..451d62774 100644 --- a/src/Dodge/LevelGen.hs +++ b/src/Dodge/LevelGen.hs @@ -121,7 +121,6 @@ addPane :: Color -> (Point2,Point2) -> IM.IntMap Wall -> IM.IntMap Wall addPane c (p0,p1) wls = IM.insert (newKey wls) (Wall { _wlLine = [p0,p1] , _wlID = newKey wls , _wlColor = c - , _wlDraw = Nothing , _wlSeen = False , _wlIsSeeThrough = True } diff --git a/src/Dodge/LevelGen/AutoDoor.hs b/src/Dodge/LevelGen/AutoDoor.hs index 02a1de0e3..e7c5db63e 100644 --- a/src/Dodge/LevelGen/AutoDoor.hs +++ b/src/Dodge/LevelGen/AutoDoor.hs @@ -63,7 +63,6 @@ autoDoorPane (trigx,trigy) n closedPos openPos = Door , _wlID = n , _doorMech = dm , _wlColor = dim $ yellow - , _wlDraw = Nothing , _wlSeen = False , _wlIsSeeThrough = False , _doorPathable = True diff --git a/src/Dodge/LevelGen/Block.hs b/src/Dodge/LevelGen/Block.hs index 9b48888c5..239ca7f48 100644 --- a/src/Dodge/LevelGen/Block.hs +++ b/src/Dodge/LevelGen/Block.hs @@ -91,7 +91,6 @@ addBlockNoShadow (p:ps) hp col isSeeThrough degradability hasAllShadows w , _wlID = j -- , _wlColor = greyN 0.5 , _wlColor = col - , _wlDraw = Nothing , _wlSeen = False , _blIDs = is , _blHP = hp @@ -124,7 +123,6 @@ addBlock (p:ps) hp col isSeeThrough degradability w , _wlID = j -- , _wlColor = greyN 0.5 , _wlColor = col - , _wlDraw = Nothing , _wlSeen = False , _blIDs = is , _blHP = hp diff --git a/src/Dodge/LevelGen/TriggerDoor.hs b/src/Dodge/LevelGen/TriggerDoor.hs index 9d488ff7a..ee1812886 100644 --- a/src/Dodge/LevelGen/TriggerDoor.hs +++ b/src/Dodge/LevelGen/TriggerDoor.hs @@ -112,7 +112,6 @@ triggerDoorPane c cond n closedPos openPos = Door , _wlID = n , _doorMech = dm , _wlColor = c - , _wlDraw = Nothing , _wlSeen = False , _wlIsSeeThrough = False , _doorPathable = False diff --git a/src/Dodge/Room/Placement.hs b/src/Dodge/Room/Placement.hs index 9cc8a4488..52df565f4 100644 --- a/src/Dodge/Room/Placement.hs +++ b/src/Dodge/Room/Placement.hs @@ -67,7 +67,6 @@ baseBlockPane = Block { _wlLine = [] , _wlID = 0 , _wlColor = greyN 0.5 - , _wlDraw = Nothing , _wlSeen = False , _blIDs = [] , _blHP = 5 @@ -81,7 +80,6 @@ baseWindowPane = Block { _wlLine = [] , _wlID = 0 , _wlColor = withAlpha 0.2 cyan - , _wlDraw = Nothing , _wlSeen = False , _blIDs = [] , _blHP = 1 diff --git a/src/Dodge/Update/Camera.hs b/src/Dodge/Update/Camera.hs index 2ed716a32..50b590780 100644 --- a/src/Dodge/Update/Camera.hs +++ b/src/Dodge/Update/Camera.hs @@ -165,9 +165,11 @@ farWallDist cpos w = min (halfWidth w / (horizontalMax+50) ) (halfHeight w / (ve tRays = rotF [(y, maxViewDistance) | y <- zs] bRays = rotF [(y,-maxViewDistance) | y <- zs] rotF = map (h . (+.+) cpos . rotateV (_cameraRot w)) - zs = take 9 [-maxViewDistance,0 - 0.8*maxViewDistance..] + zs = takeWhile (< maxViewDistance) [-maxViewDistance,0 - 0.8*maxViewDistance..] maxViewDistance = 800 + + dirRays :: Float -> [Point2] dirRays dir = take 11 $ iterate (rotateV (0.5 * pi / 10)) $ rotateV (dir-pi*0.25) (600,0)