Transition to new room datatypes, first separate out/inlinks

This commit is contained in:
2021-11-23 17:27:33 +00:00
parent 67b0d694af
commit 0f4040807a
19 changed files with 119 additions and 87 deletions
+15 -7
View File
@@ -46,7 +46,8 @@ roomRect
-> Room
roomRect x y xn yn = defaultRoom
{ _rmPolys = [rectNSWE y 0 0 x ]
, _rmLinks = lnks
, _rmOutLinks = init lnks
, _rmInLinks = [last lnks]
, _rmPath = concatMap doublePair pth
, _rmPmnts = []
, _rmBound = [rectNSWE (y+5) (-5) (-5) (x+5)]
@@ -78,11 +79,13 @@ roomRectAutoLinks x y = (roomRect x y xn yn)
yn = max 1 $ (ceiling y - 40) `div` 60
plmnts = [mntLightLnkCond unusedLnkToPS ]
{- Combines two rooms into one room.
- will have to work out exactly what to do with combining links
Mostly involves concatenation. -}
combineRooms :: Room -> Room -> Room
combineRooms r r' = defaultRoom
{ _rmPolys = _rmPolys r ++ _rmPolys r'
, _rmLinks = _rmLinks r ++ _rmLinks r'
, _rmOutLinks = _rmOutLinks r ++ _rmOutLinks r'
, _rmInLinks = _rmInLinks r ++ _rmInLinks r'
, _rmPath = map clampPath $ _rmPath r
++ _rmPath r'
, _rmPmnts = map (shiftPlacement $ _rmShift r) (_rmPmnts r)
@@ -119,7 +122,8 @@ quarterRoomFlat w = do
]
pure $ defaultRoom
{ _rmPolys = [ [V2 0 0,V2 w w,V2 (-w) w] ]
, _rmLinks = [(V2 0 w, 0)]
, _rmOutLinks = [(V2 0 w, 0)]
, _rmInLinks = [(V2 0 w, 0)]
, _rmPath = concatMap doublePair
[(V2 0 w,V2 0 (w-20))
,(V2 0 (w-20),V2 (w-20) (w-20))
@@ -153,7 +157,11 @@ fourthCornerWall w = do
]
pure $ defaultRoom
{ _rmPolys = [ map toV2 [(0,0),(w,w),(0,2*w),(-w,w)] ]
, _rmLinks =
, _rmOutLinks =
[(V2 (w/2) (3*w/2), negate $ pi/4)
,(V2 (negate $ w/2) (3*w/2), pi/4)
]
, _rmInLinks =
[(V2 (w/2) (3*w/2), negate $ pi/4)
,(V2 (negate $ w/2) (3*w/2), pi/4)
]
@@ -216,11 +224,11 @@ centerVaultRoom
centerVaultRoom w h d = do
return $ defaultRoom
{ _rmPolys = [rectNSWE h (-h) (-w) w]
, _rmLinks =
, _rmOutLinks =
[(V2 0 h , 0 )
,(V2 w 0 ,-pi/2)
,(V2 (-w) 0 , pi/2)
,(V2 0 (-h), pi )
,(V2 (-w) 0 , pi/2) ]
, _rmInLinks = [(V2 0 (-h), pi )
]
, _rmPath = []
, _rmPmnts =