Allow for rooms to inherit floor tiling from parents

This commit is contained in:
2021-11-26 13:57:22 +00:00
parent 123bcd2c94
commit 040849a550
9 changed files with 75 additions and 29 deletions
+5 -2
View File
@@ -52,7 +52,7 @@ roomRect x y xn yn = defaultRoom
, _rmPos = map (`UnusedSpot` 0) posps
, _rmPmnts = []
, _rmBound = [rectNSWE (y+5) (-5) (-5) (x+5)]
, _rmFloor = [Tile
, _rmFloor = Tiled [Tile
{ _tilePoly = rectNSWE y 0 0 x
, _tileZero = V2 0 0
, _tileX = V2 1 0
@@ -93,7 +93,7 @@ combineRooms r r' = defaultRoom
, _rmPmnts = map (shiftPlacement $ _rmShift r) (_rmPmnts r)
++ map (shiftPlacement $ _rmShift r') (_rmPmnts r')
, _rmBound = _rmBound r ++ _rmBound r'
, _rmFloor = _rmFloor r ++ _rmFloor r'
, _rmFloor = combineFloors (_rmFloor r) (_rmFloor r')
, _rmShift = (V2 0 0 , 0)
}
-- not that this assumes that any link paths are integral
@@ -102,6 +102,9 @@ clampPath = bimap f f
where
f (V2 x y) = V2 (g x) (g y)
g = (fromIntegral :: Int -> Float) . floor
combineFloors :: Floor -> Floor -> Floor
combineFloors f _ = f
{- Randomly generate a top fourth of a room possibly with a wall.
Add a light and a 'PutNothing' placement. -}
quarterRoomFlat :: RandomGen g => Float -> State g Room