Assign used links during room generation
This commit is contained in:
+8
-13
@@ -29,8 +29,6 @@ import Data.List (nubBy)
|
||||
import Control.Monad.State
|
||||
import Control.Lens
|
||||
import System.Random
|
||||
--import Data.List
|
||||
--import Data.Maybe
|
||||
import Data.Tree
|
||||
--import Data.Graph.Inductive.Graph (labNodes)
|
||||
--import qualified Data.Map as M
|
||||
@@ -42,16 +40,12 @@ generateLevelFromRoomList :: State StdGen [Room] -> World -> World
|
||||
generateLevelFromRoomList gr w
|
||||
= updateWallZoning
|
||||
. setupWorldBounds
|
||||
-- . initializeStaticWalls
|
||||
-- . setupForegroundEdgeVerxs
|
||||
. flip (foldr $ flip placeSpot) plmnts
|
||||
-- . addRoomPolyDecorations rs
|
||||
-- . addRoomLinkDecorations rs
|
||||
$ w { _walls = wallsFromRooms rs
|
||||
, _floorTiles = floorsFromRooms rs
|
||||
, _gameRooms = gameRoomsFromRooms rs
|
||||
, _pathGraph = path
|
||||
, _pathGraphP = pairPath
|
||||
$ w { _walls = wallsFromRooms rs
|
||||
, _floorTiles = floorsFromRooms rs
|
||||
, _gameRooms = gameRoomsFromRooms rs
|
||||
, _pathGraph = path
|
||||
, _pathGraphP = pairPath
|
||||
}
|
||||
where
|
||||
path = pairsToGraph dist pairPath
|
||||
@@ -122,10 +116,11 @@ gameRoomsFromRooms = map f
|
||||
where
|
||||
f rm = GameRoom
|
||||
{ _grViewpoints = _rmViewpoints rm ++ (map fst . foldl' (flip cutWalls) [] $ _rmPolys rm)
|
||||
, _grViewpointsEx = map fst (_rmLinks rm)
|
||||
++ map fst (_rmLinks rm)
|
||||
, _grViewpointsEx = map fst (_rmUsedLinks rm)
|
||||
, _grBound = expandPolyByFixed 100 . convexHullSafe . nubBy closePoints
|
||||
. concat $ _rmBound rm ++ _rmPolys rm
|
||||
, _grDir = snd . last $ _rmLinks rm
|
||||
, _grDir = snd . head $ _rmUsedLinks rm
|
||||
, _grName = _rmName rm
|
||||
}
|
||||
closePoints x y = roundPoint2 x == roundPoint2 y
|
||||
|
||||
Reference in New Issue
Block a user