Work towards cross-room placements
This commit is contained in:
@@ -48,7 +48,7 @@ roomRect x y xn yn = defaultRoom
|
||||
{ _rmPolys = [rectNSWE y 0 0 x ]
|
||||
, _rmLinks = lnks
|
||||
, _rmPath = concatMap doublePair pth
|
||||
, _rmPS = []
|
||||
, _rmPmnts = []
|
||||
, _rmBound = [rectNSWE (y+5) (-5) (-5) (x+5)]
|
||||
, _rmFloor = [Tile
|
||||
{ _tilePoly = rectNSWE y 0 0 x
|
||||
@@ -69,7 +69,7 @@ roomRect x y xn yn = defaultRoom
|
||||
{- Creates a rectangular room, automatically creates links and pathfinding graph at a sensible size. -}
|
||||
roomRectAutoLinks :: Float -> Float -> Room
|
||||
roomRectAutoLinks x y = (roomRect x y ((ceiling x - 40) `div` 60) ((ceiling y - 40) `div` 60))
|
||||
{_rmPS = plmnts}
|
||||
{_rmPmnts = plmnts}
|
||||
where
|
||||
plmnts =
|
||||
[mntLightLnkCond (const True)
|
||||
@@ -83,8 +83,8 @@ combineRooms r r' = defaultRoom
|
||||
, _rmLinks = _rmLinks r ++ _rmLinks r'
|
||||
, _rmPath = map clampPath $ _rmPath r
|
||||
++ _rmPath r'
|
||||
, _rmPS = map (shiftPlacement $ _rmShift r) (_rmPS r)
|
||||
++ map (shiftPlacement $ _rmShift r') (_rmPS r')
|
||||
, _rmPmnts = map (shiftPlacement $ _rmShift r) (_rmPmnts r)
|
||||
++ map (shiftPlacement $ _rmShift r') (_rmPmnts r')
|
||||
, _rmBound = _rmBound r ++ _rmBound r'
|
||||
, _rmFloor = _rmFloor r ++ _rmFloor r'
|
||||
, _rmShift = (V2 0 0 , 0)
|
||||
@@ -126,7 +126,7 @@ quarterRoomFlat w = do
|
||||
,(V2 0 (w-20),V2 0 0)
|
||||
,(V2 (55-w) (w-20),V2 0 0)
|
||||
]
|
||||
, _rmPS = b
|
||||
, _rmPmnts = b
|
||||
, _rmBound = [[V2 0 0,V2 w w,V2 (-w) w]]
|
||||
}
|
||||
|
||||
@@ -167,13 +167,13 @@ fourthCornerWall w = do
|
||||
,(V2 0 0,V2 0 (w-40))
|
||||
-- ,(V2 (20-w) (w-20),V2 (40-w) (w))
|
||||
]
|
||||
, _rmPS = b
|
||||
, _rmPmnts = b
|
||||
, _rmBound = [map toV2 [(w,w),(0,2*w),(-w,w)]]
|
||||
}
|
||||
{- | Replace the first 'PutNothing' with a given 'PSType'. -}
|
||||
fillNothingPlacement :: PSType -> Room -> Room
|
||||
fillNothingPlacement pst r =
|
||||
r & rmPS %~ replaceNothingWith pst
|
||||
r & rmPmnts %~ replaceNothingWith pst
|
||||
where
|
||||
replaceNothingWith x (Placement (PS p rot) PutNothing _: pss) = sPS p rot x : pss
|
||||
replaceNothingWith x (ps:pss) = ps : replaceNothingWith x pss
|
||||
@@ -186,8 +186,8 @@ fillNothingPlacements pst r = foldr fillNothingPlacement r pst
|
||||
Useful for randomising the position of generic placements such as 'PutNothing'. -}
|
||||
shufflePlacements :: RandomGen g => Room -> State g Room
|
||||
shufflePlacements r = do
|
||||
newPSs <- shuffle $ _rmPS r
|
||||
return $ r & rmPS .~ newPSs
|
||||
newPSs <- shuffle $ _rmPmnts r
|
||||
return $ r & rmPmnts .~ newPSs
|
||||
{- | A randomly generate room based on four randomly generated corners.
|
||||
Tight corridors, random placements. -}
|
||||
randomFourCornerRoom :: RandomGen g => State g Room
|
||||
@@ -201,7 +201,7 @@ randomFourCornerRoom = do
|
||||
++ replicate 20 chaseCrit
|
||||
randomiseAllLinks . fillNothingPlacements (crits ++ itms) =<<
|
||||
( shufflePlacements
|
||||
. over rmPS ( sps0 putLamp :)
|
||||
. over rmPmnts ( sps0 putLamp :)
|
||||
. foldr1 combineRooms
|
||||
$ zipWith (\r a -> shiftRoomBy (V2 0 0,a) r) corners [0,pi/2,pi,3*pi/2]
|
||||
)
|
||||
@@ -221,7 +221,7 @@ centerVaultRoom w h d = do
|
||||
,(V2 0 (-h), pi )
|
||||
]
|
||||
, _rmPath = []
|
||||
, _rmPS =
|
||||
, _rmPmnts =
|
||||
[sps0 $ PutWall (rectNSEW d (d - 30) d (d - 30)) defaultWall
|
||||
,sps0 $ PutWall (rectNSEW d (d - 30) (-d) (30 - d)) defaultWall
|
||||
,sps0 $ PutWall (rectNSEW (-d) (30 - d) d (d - 30)) defaultWall
|
||||
|
||||
Reference in New Issue
Block a user