Fix pathing for zChasm
This commit is contained in:
@@ -45,17 +45,15 @@ roomRect x y xn yn =
|
||||
{ _rmPolys = [rectNSWE y 0 0 x]
|
||||
, _rmLinks = lnks
|
||||
, _rmName = "rect"
|
||||
, _rmPath = pth
|
||||
, _rmPath = linksDAGToPath lnks $ latticeXsYs xs ys
|
||||
, _rmPos = gridRoomPos xs ys
|
||||
-- , _rmPos = map makeonpos (grid xs ys)
|
||||
-- <> map makeoffpos (grid (mids xs) (mids ys))
|
||||
, _rmPmnts = []
|
||||
, _rmBound = [rectNSWE (y + 5) (-5) (-5) (x + 5)]
|
||||
, _rmFloor =
|
||||
Tiled
|
||||
[ Tile
|
||||
{ _tilePoly = rectNSWE y 0 0 x
|
||||
, _tileZero = V2 0 0
|
||||
, _tileZero = 0
|
||||
, _tileTangentPos = V2 baseFloorTileSize 0
|
||||
, _tileArrayZ = 16
|
||||
}
|
||||
@@ -76,7 +74,6 @@ roomRect x y xn yn =
|
||||
ys = take (yn + 1) [0,yd..] & each +~ 20
|
||||
yd = (y - 40) / fromIntegral yn
|
||||
xd = (x - 40) / fromIntegral xn
|
||||
pth = linksDAGToPath lnks $ latticeXsYs xs ys
|
||||
horilnks y' a e = xs <&> \x' -> RoomLink (rlt e) (V2 x' y') a
|
||||
vertlnks x' a e = ys <&> \y' -> RoomLink (rlt e) (V2 x' y') a
|
||||
rlt e = S.fromList [OnEdge e, InLink, OutLink]
|
||||
@@ -88,28 +85,7 @@ roomRect x y xn yn =
|
||||
<> imap (g West) slnks
|
||||
<> imap (g South) elnks
|
||||
<> imap (g South) wlnks
|
||||
g c xi ln = ln
|
||||
& rlType <>~ S.fromList [FromEdge c xi,FromEdge (revCard c) (xn - xi)]
|
||||
grid as bs = [(V2 x' y', (xi,yi)) | (x',xi) <- zip as [0..], (y',yi) <- zip bs [0..]]
|
||||
makeonpos (p, a) = RoomPos p 0 (S.singleton $ RoomPosOnGrid $ makerpedges a)
|
||||
(NotLink True) mempty
|
||||
makerpedges (a, b) =
|
||||
S.fromList
|
||||
[ PathFromEdge South b
|
||||
, PathFromEdge North (yn - b)
|
||||
, PathFromEdge East (xn - a)
|
||||
, PathFromEdge West a
|
||||
]
|
||||
mids zs = zipWith (\a b -> 0.5 * (a + b)) zs $ tail zs
|
||||
makeoffpos (p, a) = RoomPos
|
||||
p 0 (S.singleton $ RoomPosOffGrid $ makerpedges' a) (NotLink False) mempty
|
||||
makerpedges' (a, b) =
|
||||
S.fromList
|
||||
[ PathFromEdge South b
|
||||
, PathFromEdge North (yn - (b + 1))
|
||||
, PathFromEdge East (xn - (a + 1))
|
||||
, PathFromEdge West a
|
||||
]
|
||||
g c xi = rlType <>~ S.fromList [FromEdge c xi,FromEdge (revCard c) (xn - xi)]
|
||||
|
||||
gridRoomPos :: [Float] -> [Float] -> [RoomPos]
|
||||
gridRoomPos xs ys = map makeonpos (grid xs ys) <> map makeoffpos (grid (mids xs) (mids ys))
|
||||
|
||||
Reference in New Issue
Block a user