Change poke to use folding rather than store incremental ints in vector
This commit is contained in:
@@ -10,7 +10,6 @@ import Dodge.Placement.PlaceSpot
|
||||
--import Dodge.LevelGen.Data
|
||||
import Dodge.LevelGen.StaticWalls
|
||||
import Dodge.LevelGen.LevelStructure
|
||||
import Dodge.Room.Foreground
|
||||
import Dodge.Wall.Zone
|
||||
import Dodge.GameRoom
|
||||
import Dodge.Default.Wall
|
||||
@@ -21,9 +20,6 @@ import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
import Tile
|
||||
import RandomHelp
|
||||
import Color
|
||||
import Shape
|
||||
--import Padding
|
||||
|
||||
import qualified Data.Set as S
|
||||
import Data.List (nubBy)
|
||||
@@ -38,7 +34,6 @@ generateLevelFromRoomList :: IM.IntMap Room -> World -> World
|
||||
generateLevelFromRoomList gr' w = initWallZoning
|
||||
. randomCompass
|
||||
. setupWorldBounds
|
||||
. placeWires
|
||||
. doAfterPlacements
|
||||
. doInPlacements
|
||||
. doOutPlacements
|
||||
@@ -86,35 +81,6 @@ shuffleRoomPos rm = do
|
||||
newPos <- shuffle $ _rmPos rm
|
||||
return $ rm & rmPos .~ newPos
|
||||
|
||||
placeWires :: World -> World
|
||||
placeWires w = foldr placeRoomWires w (_genRooms w)
|
||||
|
||||
placeRoomWires :: Room -> World -> World
|
||||
placeRoomWires rm w = IM.foldr ($) w
|
||||
$ IM.intersectionWith (placeWire rm) (_rmStartWires rm) (_rmEndWires rm)
|
||||
|
||||
placeWire :: Room -> RoomWire -> RoomWire -> World -> World
|
||||
placeWire rm (WallWire p _ h1) (WallWire q _ h2) = foregroundShape
|
||||
%~ (col ( thinHighBarChain h2 (map (shiftPointBy rs) doOrdering)
|
||||
<> barPP 1.5 (addZ h1 p) (addZ h2 p)
|
||||
)
|
||||
<>
|
||||
)
|
||||
where
|
||||
--TODO use rmWalls for non convex rooms
|
||||
--rmWalls = foldr cutWalls [] (_rmPolys rm)
|
||||
doOrdering = orderPolygonAround rmcen (p:q:ps)
|
||||
col | clockwise = colorSH red
|
||||
| otherwise = colorSH red
|
||||
rmps = concat $ _rmPolys rm
|
||||
rmcen = centroid rmps
|
||||
clockwise = isLHS rmcen p q
|
||||
ps | clockwise = filter leftprightq rmps
|
||||
| otherwise = filter rightpleftq rmps
|
||||
leftprightq x = isLHS rmcen p x && isRHS rmcen q x
|
||||
rightpleftq x = isRHS rmcen p x && isLHS rmcen q x
|
||||
rs = _rmShift rm
|
||||
|
||||
doAfterPlacements :: World -> World
|
||||
doAfterPlacements gw = foldr doAfterPlacement gw (_genPlacements gw)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user