diff --git a/src/Dodge/Base.hs b/src/Dodge/Base.hs index f1a86370a..900188f08 100644 --- a/src/Dodge/Base.hs +++ b/src/Dodge/Base.hs @@ -386,9 +386,7 @@ collidePointWalkable p1 p2 ws = any (isJust . ( \(x:y:_) -> intersectSegSeg' p1 p2 x y) . _wlLine ) unwalkableWalls - where unwalkableWalls = IM.filter notDoor ws - notDoor (AutoDoor {}) = False - notDoor _ = True + where unwalkableWalls = IM.filter (fromMaybe True . (^? doorPathable)) ws furthestPointWalkable :: Point2 -> Point2 -> IM.IntMap Wall -> Point2 furthestPointWalkable p1 p2 ws = head $ (sortBy (compare `on` dist p1) $ IM.elems diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index 8339ed079..707e26241 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -546,14 +546,6 @@ data Wall , _blHP :: Int , _wlIsSeeThrough :: Bool } - | AutoDoor - { _wlLine :: [Point2] , _wlID :: Int - , _doorMech :: World -> World - , _wlColor :: Color - , _wlDraw :: Maybe (Wall -> Drawing) - , _wlSeen :: Bool - , _wlIsSeeThrough :: Bool - } | Door { _wlLine :: [Point2] , _wlID :: Int , _doorMech :: World -> World @@ -561,6 +553,7 @@ data Wall , _wlDraw :: Maybe (Wall -> Drawing) , _wlSeen :: Bool , _wlIsSeeThrough :: Bool + , _doorPathable :: Bool } | Block { _wlLine :: [Point2] diff --git a/src/Dodge/LevelGen/AutoDoor.hs b/src/Dodge/LevelGen/AutoDoor.hs index deb49c62b..8bdf495dc 100644 --- a/src/Dodge/LevelGen/AutoDoor.hs +++ b/src/Dodge/LevelGen/AutoDoor.hs @@ -26,13 +26,6 @@ autoDoorAt a b wls = IM.union wls $ IM.fromList $ zip is $ mkAutoDoor a b is mkAutoDoor :: Point2 -> Point2 -> [Int] -> [Wall] mkAutoDoor pl pr xs = addSound $ zipWith3 (autoDoorPane [pl,pr]) xs --- [ True --- , False --- , True --- , True --- , False --- , True --- ] [ [pld,hwd,hw,pl] , [hwd,hwu] , [hwu,plu,pl,hw] @@ -69,7 +62,7 @@ mkAutoDoor pl pr xs = addSound $ zipWith3 (autoDoorPane [pl,pr]) where wp = (_wlLine $ _walls w IM.! (head xs)) !! 1 autoDoorPane :: [Point2] -> Int -> [Point2] -> [Point2] -> Wall -autoDoorPane trigL n closedPos openPos = AutoDoor +autoDoorPane trigL n closedPos openPos = Door { _wlLine = closedPos , _wlID = n , _doorMech = dm @@ -77,6 +70,7 @@ autoDoorPane trigL n closedPos openPos = AutoDoor , _wlDraw = Nothing , _wlSeen = False , _wlIsSeeThrough = False + , _doorPathable = True } where a = closedPos !! 0 diff --git a/src/Dodge/LevelGen/TriggerDoor.hs b/src/Dodge/LevelGen/TriggerDoor.hs index 8bf6cbc4b..8ebaed6c2 100644 --- a/src/Dodge/LevelGen/TriggerDoor.hs +++ b/src/Dodge/LevelGen/TriggerDoor.hs @@ -116,7 +116,7 @@ triggerDoorPane c cond n closedPos openPos = Door , _wlDraw = Nothing , _wlSeen = False , _wlIsSeeThrough = False --- , _doorLine = [a,b,a',b'] + , _doorPathable = False } where a = closedPos !! 0 diff --git a/src/Dodge/Prototypes.hs b/src/Dodge/Prototypes.hs index 67051491a..9f08f0e4f 100644 --- a/src/Dodge/Prototypes.hs +++ b/src/Dodge/Prototypes.hs @@ -28,13 +28,14 @@ basicWall = Wall { _wlLine = [(0,0),(50,0)] , _wlSeen = False , _wlIsSeeThrough = False } -basicAutoDoor = AutoDoor { _wlLine = [(0,0),(50,0)] +basicAutoDoor = Door { _wlLine = [(0,0),(50,0)] , _wlID = 0 , _doorMech = id , _wlColor = light $ dim $ dim $ dim $ yellow , _wlDraw = Nothing , _wlSeen = False , _wlIsSeeThrough = False + , _doorPathable = True } basicDoor = Door { _wlLine = [(0,0),(50,0)] , _wlID = 0 @@ -43,6 +44,7 @@ basicDoor = Door { _wlLine = [(0,0),(50,0)] , _wlDraw = Nothing , _wlSeen = False , _wlIsSeeThrough = False + , _doorPathable = False } basicCreature :: Creature basicCreature = Creature diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index 66f44688b..211436eb4 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -91,7 +91,6 @@ updateCreatures w = f $ set randGen newG $ set creatures (IM.mapMaybe id crs) w wallEvents :: World -> World wallEvents w = IM.foldr (_doorMech) w ( IM.filter (\d -> case d of Door {} -> True - AutoDoor {} -> True BlockAutoDoor {} -> True _ -> False) ( _walls w))