Further add information to room positions

This commit is contained in:
2022-06-15 12:57:31 +01:00
parent 62dae5bebe
commit 29e1ee14a1
2 changed files with 23 additions and 12 deletions
+11 -9
View File
@@ -41,16 +41,18 @@ crossPillar w' h' = ps0jPushPS (aline (V2 (-w) 0) (V2 w 0))
aline = PutLineBlock baseBlockPane StoneBlock 9 9
roomPillarsSquare :: RandomGen g => State g Room
roomPillarsSquare = return $ roomRectAutoLinks 400 400
& rmPmnts .++~ [sps (rprBool $ \rp _ -> t rp) smallPillar
,sps (rprBool $ \rp _ -> t rp) smallPillar
,sps (rprBool $ \rp _ -> t rp) smallPillar
,sps (rprBool $ \rp _ -> t rp) smallPillar
,sps (rprBool $ \rp _ -> t rp) smallPillar
]
roomPillarsSquare = do
h <- state $ randomR (300,300)
w <- state $ randomR (300,400)
let rm = roomRectAutoLinks w h
nlew = _numLinkEW (_rmType rm)
nlns = _numLinkNS (_rmType rm)
return $ rm & rmPmnts .++~ concatMap (replicate nlew . makepill) [South,North]
++ concatMap (replicate nlns . makepill) [East,West]
where
t rp = any f (_rpType rp) && _rpPlacementUse rp == 0
f rpt = maybe False (PathFromEdge West 1 `S.member`) (rpt ^? onPathEdges)
makepill edge = sps (rprBool $ \rp _ -> t edge rp) smallPillar
t edge rp = any (f edge) (_rpType rp) && _rpPlacementUse rp == 0
f edge rpt = maybe False (PathFromEdge edge 0 `S.member`) (rpt ^? offPathEdges)
roomPillarsPassage :: RandomGen g => State g Room
roomPillarsPassage = do
+12 -3
View File
@@ -50,8 +50,9 @@ roomRect x y xn yn = defaultRoom
, _rmName = "rect"
, _rmPath = concatMap doublePair pth
--, _rmPos = map (roomposat (RoomPosOnPath S.empty)) posps
, _rmPos = map (makeonpos) posps'
++ map (roomposat (RoomPosOffPath S.empty)) interposps
-- ++ map (roomposat (RoomPosOffPath S.empty)) interposps
, _rmPos = map makeonpos posps'
++ map makeoffpos interposps'
, _rmPmnts = []
, _rmBound = [rectNSWE (y+5) (-5) (-5) (x+5)]
, _rmFloor = Tiled [Tile
@@ -90,12 +91,20 @@ roomRect x y xn yn = defaultRoom
makerpedges (a,b) = S.fromList
[PathFromEdge South b
,PathFromEdge North (yn-b)
,PathFromEdge East (yn-a)
,PathFromEdge East (xn-a)
,PathFromEdge West a
]
posps' = map (over _1 (+.+ V2 20 20)) $ gridPoints'' xd (xn+1) yd (xn+1)
interposps' = map (over _1 (+.+ V2 (20 + xd/2) (20 + yd/2))) $ gridPoints'' xd xn yd yn
posps = map (+.+ V2 20 20) $ gridPoints xd (xn+1) yd (yn+1)
interposps = map (+.+ V2 (20 + xd/2) (20 + yd/2)) $ gridPoints xd xn yd yn
makeoffpos (p,a) = RoomPos p 0 (S.singleton $ RoomPosOffPath $ makerpedges' a) NotLink 0
makerpedges' (a,b) = S.fromList
[PathFromEdge South b
,PathFromEdge North (yn-(b+1))
,PathFromEdge East (xn-(a+1))
,PathFromEdge West a
]
zipCountDown :: [a] -> [(Int,a)]
zipCountDown xs = zip [length xs - 1, length xs - 2 ..] xs