Remove GenWorld datatype
This commit is contained in:
@@ -54,11 +54,10 @@ addBlock (p:ps) wl hp hps bm w
|
||||
ips = map zoneOfPoint $ uncurry (divideLine (2*zoneSize)) (_wlLine wl)
|
||||
addBlock _ _ _ _ _ _ = error "Trying to add a block with incomplete polygon"
|
||||
|
||||
placeBlock :: [Point2] -> Int -> Wall -> [Int] -> BlockMaterial -> GenWorld -> (Int,GenWorld)
|
||||
placeBlock poly i wl is bm gw
|
||||
= (0, gw & gWorld .~ foldr (uncurry removePathsCrossing) wWithBlock pairs)
|
||||
placeBlock :: [Point2] -> Int -> Wall -> [Int] -> BlockMaterial -> World -> (Int,World)
|
||||
placeBlock poly i wl is bm w
|
||||
= (0, foldr (uncurry removePathsCrossing) wWithBlock pairs)
|
||||
where
|
||||
w = _gWorld gw
|
||||
pairs = loopPairs poly
|
||||
wWithBlock = addBlock poly wl i is bm w
|
||||
|
||||
@@ -70,13 +69,12 @@ placeLineBlock
|
||||
-> Float -- ^ Block depth
|
||||
-> Point2 -- ^ Start point (symmetric)
|
||||
-> Point2 -- ^ End point (symmetric)
|
||||
-> GenWorld
|
||||
-> (Int, GenWorld)
|
||||
-> World
|
||||
-> (Int, World)
|
||||
placeLineBlock basePane bm blockWidth depth a b gw = ( 0
|
||||
, gw & gWorld .~ removePathsCrossing a b (foldr insertWall (insertBlocks w) listWalls)
|
||||
, removePathsCrossing a b (foldr insertWall (insertBlocks gw) listWalls)
|
||||
)
|
||||
where
|
||||
w = _gWorld gw
|
||||
psOnLine = divideLineOddNumPoints blockWidth a b
|
||||
halfBlockWidth = dist a b / fromIntegral (length psOnLine - 1)
|
||||
blockCenPs = snd $ evenOddSplit psOnLine
|
||||
@@ -85,8 +83,8 @@ placeLineBlock basePane bm blockWidth depth a b gw = ( 0
|
||||
cornerPoints = reverse $ rectWH halfBlockWidth depth -- goes clockwise around the block
|
||||
cornersAt p = fmap ( (p +.+) . rotateV (argV (b -.- a)) ) cornerPoints
|
||||
linesAt p = loopPairs $ cornersAt p
|
||||
wlid = IM.newKey $ _walls w
|
||||
blid = IM.newKey $ _blocks w
|
||||
wlid = IM.newKey $ _walls gw
|
||||
blid = IM.newKey $ _blocks gw
|
||||
insertBlock i = over blocks $ IM.insert (i+blid) Block
|
||||
{ _blID = i + blid, _blWallIDs = IS.fromList $ ksAtI i
|
||||
, _blHPs = [5,5], _blShadows = shadowsAt i, _blMaterial = bm}
|
||||
|
||||
Reference in New Issue
Block a user