Thread a more complex structure through the placement process
This commit is contained in:
@@ -6,6 +6,7 @@ module Dodge.Placement.PlaceSpot.Block
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.Path
|
||||
import Dodge.LevelGen.LevelStructure
|
||||
import Dodge.Base
|
||||
import Dodge.Zone
|
||||
import Geometry
|
||||
@@ -53,10 +54,11 @@ 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 -> World -> (Int,World)
|
||||
placeBlock poly i wl is bm w
|
||||
= (0, foldr (uncurry removePathsCrossing) wWithBlock pairs)
|
||||
placeBlock :: [Point2] -> Int -> Wall -> [Int] -> BlockMaterial -> GenWorld -> (Int,GenWorld)
|
||||
placeBlock poly i wl is bm gw
|
||||
= (0, gw & gWorld .~ foldr (uncurry removePathsCrossing) wWithBlock pairs)
|
||||
where
|
||||
w = _gWorld gw
|
||||
pairs = loopPairs poly
|
||||
wWithBlock = addBlock poly wl i is bm w
|
||||
|
||||
@@ -68,11 +70,13 @@ placeLineBlock
|
||||
-> Float -- ^ Block depth
|
||||
-> Point2 -- ^ Start point (symmetric)
|
||||
-> Point2 -- ^ End point (symmetric)
|
||||
-> World
|
||||
-> (Int, World)
|
||||
placeLineBlock basePane bm blockWidth depth a b w = (,) 0
|
||||
$ removePathsCrossing a b $ foldr insertWall (insertBlocks w) listWalls
|
||||
-> GenWorld
|
||||
-> (Int, GenWorld)
|
||||
placeLineBlock basePane bm blockWidth depth a b gw = ( 0
|
||||
, gw & gWorld .~ (removePathsCrossing a b $ foldr insertWall (insertBlocks w) listWalls)
|
||||
)
|
||||
where
|
||||
w = _gWorld gw
|
||||
psOnLine = divideLineOddNumPoints blockWidth a b
|
||||
halfBlockWidth = dist a b / fromIntegral (length psOnLine - 1)
|
||||
blockCenPs = snd $ evenOddSplit psOnLine
|
||||
|
||||
Reference in New Issue
Block a user