Separate out concrete part of world
This commit is contained in:
+10
-11
@@ -41,12 +41,11 @@ generateLevelFromRoomList gr' w = over gwWorld initWallZoning
|
||||
. doIndividualPlacements
|
||||
. setFloors
|
||||
. worldToGenWorld rs'
|
||||
$ w { _walls = wallsFromRooms rs
|
||||
, _gameRooms = gameRoomsFromRooms (IM.elems rs')
|
||||
, _pathGraph = path
|
||||
}
|
||||
& pnZoning .~ foldl' (flip zonePn) mempty (labNodes path)
|
||||
& peZoning .~ foldl' (flip zonePe) mempty (labEdges path)
|
||||
$ w & cWorld . walls .~ wallsFromRooms rs
|
||||
& cWorld . gameRooms .~ gameRoomsFromRooms (IM.elems rs')
|
||||
& cWorld . pathGraph .~ path
|
||||
& cWorld . pnZoning .~ foldl' (flip zonePn) mempty (labNodes path)
|
||||
& cWorld . peZoning .~ foldl' (flip zonePe) mempty (labEdges path)
|
||||
where
|
||||
(_,path) = pairsToGraph pairPath'
|
||||
pairPath = foldMap _rmPath rs
|
||||
@@ -55,10 +54,10 @@ generateLevelFromRoomList gr' w = over gwWorld initWallZoning
|
||||
rs'= mapM shuffleRoomPos gr' & evalState $ _randGen w
|
||||
|
||||
randomCompass :: World -> World
|
||||
randomCompass w = w & cameraRot .~ (takeOne [0,0.5*pi,pi,1.5*pi] & evalState $ _randGen w)
|
||||
randomCompass w = w & cWorld . cameraRot .~ (takeOne [0,0.5*pi,pi,1.5*pi] & evalState $ _randGen w)
|
||||
|
||||
putFloorTiles :: GenWorld -> GenWorld
|
||||
putFloorTiles gw = gw & gwWorld . floorTiles .~ floorsFromGenWorld gw
|
||||
putFloorTiles gw = gw & gwWorld . cWorld . floorTiles .~ floorsFromGenWorld gw
|
||||
|
||||
setFloors :: GenWorld -> GenWorld
|
||||
setFloors = putFloorTiles . setTiles
|
||||
@@ -124,7 +123,7 @@ doRoomPlacements :: GenWorld -> Room -> (GenWorld, Room)
|
||||
doRoomPlacements w rm = foldl' (\wr -> fst . placeSpot wr) (w,rm) $ _rmPmnts rm
|
||||
|
||||
setupWorldBounds :: World -> World
|
||||
setupWorldBounds w = w & worldBounds %~
|
||||
setupWorldBounds w = w & cWorld . worldBounds %~
|
||||
( (bdMinX .~ f minx)
|
||||
. (bdMaxX .~ f maxx)
|
||||
. (bdMinY .~ f miny)
|
||||
@@ -132,7 +131,7 @@ setupWorldBounds w = w & worldBounds %~
|
||||
)
|
||||
where
|
||||
f = fromMaybe 0
|
||||
ps = IM.map (fst . _wlLine) $ _walls w
|
||||
ps = IM.map (fst . _wlLine) $ _walls (_cWorld w)
|
||||
(minx,maxx,miny,maxy) = L.fold ((,,,)
|
||||
<$> L.premap fstV2 L.minimum
|
||||
<*> L.premap fstV2 L.maximum
|
||||
@@ -144,7 +143,7 @@ setupWorldBounds w = w & worldBounds %~
|
||||
--polyhedrasToEdges = concatMap tflat4 . concatMap polyToEdges
|
||||
|
||||
initWallZoning :: World -> World
|
||||
initWallZoning w = foldl' (flip insertWallInZones) (w & wlZoning .~ IM.empty) (_walls w)
|
||||
initWallZoning w = foldl' (flip insertWallInZones) (w & cWorld . wlZoning .~ IM.empty) (_walls (_cWorld w))
|
||||
|
||||
--makePath :: Tree Room -> [(Point2,Point2)]
|
||||
--makePath = concatMap _rmPath . flatten
|
||||
|
||||
Reference in New Issue
Block a user