Work towards cross-room placements
This commit is contained in:
+31
-33
@@ -41,7 +41,7 @@ roomC w h = do
|
||||
, windowLine (V2 (w/2) 0) (V2 (w/2) (h-60))
|
||||
]
|
||||
changeLinkFrom fromCond $ roomRectAutoLinks w h
|
||||
& rmPS %~ (wl : )
|
||||
& rmPmnts %~ (wl : )
|
||||
& rmRandPSs .~ [farside]
|
||||
where
|
||||
fromCond (V2 x _,_) = x < w / 2 - 10
|
||||
@@ -56,11 +56,9 @@ roomPadCut ps p = defaultRoom
|
||||
{ _rmPolys = [ps]
|
||||
, _rmLinks = [(p,0),(V2 0 0,pi)]
|
||||
, _rmPath = [(V2 0 0,p)]
|
||||
, _rmPS = []
|
||||
, _rmBound = []
|
||||
}
|
||||
roomPillars :: Room
|
||||
roomPillars = over rmLinks init $ set rmPS plmnts $ roomRect 240 240 2 2
|
||||
roomPillars = over rmLinks init $ set rmPmnts plmnts $ roomRect 240 240 2 2
|
||||
where
|
||||
plmnts = spanLightI (V2 120 24) (V2 120 216)
|
||||
: mountLightV (V2 12 12) (V3 25 25 70)
|
||||
@@ -86,8 +84,8 @@ glassLesson = do
|
||||
return $ Node (Left botRoom) [deadRoom door,uppers, treeFromPost (Left door : corridors) $ Right door]
|
||||
where
|
||||
uppers = Node (Left door) [deadRoom topRoom]
|
||||
botRoom = set rmPS botplmnts $ roomRect 200 200 1 1
|
||||
topRoom = set rmPS topplmnts $ roomRect 200 200 1 1
|
||||
botRoom = set rmPmnts botplmnts $ roomRect 200 200 1 1
|
||||
topRoom = set rmPmnts topplmnts $ roomRect 200 200 1 1
|
||||
botplmnts =
|
||||
[sPS (V2 0 0) 0 $ PutWall (rectNSWE 200 0 90 110) defaultCrystalWall
|
||||
,sPS (V2 50 100) 0 $ PutCrit miniGunCrit
|
||||
@@ -134,12 +132,12 @@ glassSwitchBack = do
|
||||
return (V2 crx cry,1.5*pi)
|
||||
midPS = return (V2 (wth-20) (hgt/2+40), pi)
|
||||
return $ roomRect wth hgt 2 4
|
||||
& rmPS .~ plmnts
|
||||
& rmPmnts .~ plmnts
|
||||
& rmRandPSs .~ [northPSs,midPS]
|
||||
|
||||
glassSwitchBackCrits :: RandomGen g => State g Room
|
||||
glassSwitchBackCrits = glassSwitchBack
|
||||
<&> rmPS %~ ([Placement (PSRoomRand 0) (PutCrit miniGunCrit) (const Nothing)
|
||||
<&> rmPmnts %~ ([Placement (PSRoomRand 0) (PutCrit miniGunCrit) (const Nothing)
|
||||
, Placement (PSRoomRand 1) randC1 (const Nothing)
|
||||
] ++)
|
||||
|
||||
@@ -178,7 +176,7 @@ miniRoom3 = do
|
||||
,sPS cp (pi/8+7*pi/4) b
|
||||
,sPS (V2 (w/2) (h/2)) 0 putLamp
|
||||
]
|
||||
fmap connectRoom $ randomiseOutLinks $ set rmPS plmnts $ roomRectAutoLinks w h
|
||||
fmap connectRoom $ randomiseOutLinks $ set rmPmnts plmnts $ roomRectAutoLinks w h
|
||||
|
||||
rot90Around :: Point2 -> Point2 -> Point2
|
||||
rot90Around cen p = cen +.+ vNormal (p -.- cen)
|
||||
@@ -200,7 +198,7 @@ roomMiniIntro = fmap (g . expandTreeBy f) $ sequence $ treeFromPost
|
||||
|
||||
roomCenterPillar :: RandomGen g => State g Room
|
||||
roomCenterPillar = changeLinkTo ((\p -> dist p (V2 120 0) < 10) . fst)
|
||||
$ set rmPS plmnts $ roomRect 240 240 2 2
|
||||
$ set rmPmnts plmnts $ roomRect 240 240 2 2
|
||||
where
|
||||
plmnts =
|
||||
[ blockLine (V2 115 115) (V2 115 125)
|
||||
@@ -216,7 +214,7 @@ roomOctogon = defaultRoom
|
||||
{ _rmPolys = [poly ]
|
||||
, _rmLinks = lnks
|
||||
, _rmPath = allPairs $ map fst lnks -- this is too much
|
||||
, _rmPS = []
|
||||
, _rmPmnts = []
|
||||
, _rmBound = [map toV2 [(-20,30),(20,30),(60,70),(60,110),(20,150),(-20,150),(-60,110),(-60,70)] ]
|
||||
, _rmFloor = [makeTileFromPoly poly 7]
|
||||
}
|
||||
@@ -260,7 +258,7 @@ weaponEmptyRoom = do
|
||||
,mntLightLnkCond (const True)
|
||||
]
|
||||
(fmap connectRoom . randomiseOutLinks) =<<
|
||||
changeLinkTo ((\p -> dist p (V2 (w/2) 0) < 10) . fst) (set rmPS plmnts $ roomRect w h 2 2)
|
||||
changeLinkTo ((\p -> dist p (V2 (w/2) 0) < 10) . fst) (set rmPmnts plmnts $ roomRect w h 2 2)
|
||||
|
||||
weaponUnderCrits :: RandomGen g => State g (Tree (Either Room Room))
|
||||
weaponUnderCrits = do
|
||||
@@ -271,7 +269,7 @@ weaponUnderCrits = do
|
||||
]
|
||||
let continuationRoom = treeFromTrunk
|
||||
[Left corridorN,Left corridorN]
|
||||
(connectRoom (set rmPS plmnts corridorN))
|
||||
(connectRoom (set rmPmnts plmnts corridorN))
|
||||
rcp <- roomCenterPillar
|
||||
deadEndRoom' <- takeOne [roomPillars,rcp]
|
||||
junctionRoom <- takeOne [Left tEast,Left tWest]
|
||||
@@ -292,9 +290,9 @@ weaponBehindPillar = do
|
||||
rcp <- roomCenterPillar
|
||||
return $ treeFromTrunk
|
||||
[Left door
|
||||
,Left $ over rmLinks tail $ over rmPS (++ plmnts1) rcp
|
||||
,Left $ over rmLinks tail $ over rmPmnts (++ plmnts1) rcp
|
||||
]
|
||||
(connectRoom $ set rmPS [sPS (V2 20 60) (negate $ pi/2) randC1] corridorN)
|
||||
(connectRoom $ set rmPmnts [sPS (V2 20 60) (negate $ pi/2) randC1] corridorN)
|
||||
|
||||
weaponBetweenPillars :: RandomGen g => State g (Tree (Either Room Room))
|
||||
weaponBetweenPillars = do
|
||||
@@ -307,7 +305,7 @@ weaponBetweenPillars = do
|
||||
,sPS crPos1 (d crPos1) randC1
|
||||
,sPS crPos2 (d crPos2) randC1
|
||||
]
|
||||
theRoom = roomPillars & rmPS %~ (++ plmnts)
|
||||
theRoom = roomPillars & rmPmnts %~ (++ plmnts)
|
||||
(fmap connectRoom . randomiseOutLinks) =<< filterLinks f theRoom
|
||||
where
|
||||
f (_,a) = a == 0
|
||||
@@ -316,7 +314,7 @@ weaponLongCorridor :: RandomGen g => State g (Tree (Either Room Room))
|
||||
weaponLongCorridor = do
|
||||
root <- takeOne [tEast, tWest]
|
||||
connectingRoom <- takeOne
|
||||
[tEast & rmPS .~ [spanLightI (V2 (-40) 40) (V2 (-40) 80)]
|
||||
[tEast & rmPmnts .~ [spanLightI (V2 (-40) 40) (V2 (-40) 80)]
|
||||
]
|
||||
i1 <- state $ randomR (2,5)
|
||||
i2 <- state $ randomR (2,5)
|
||||
@@ -324,11 +322,11 @@ weaponLongCorridor = do
|
||||
let branch2 = treeFromTrunk (replicate i2 $ Left corridorN) (deadRoom $ putWp corridor)
|
||||
return $ Node (Left root) [branch1,branch2]
|
||||
where
|
||||
putCrs = over rmPS (++ [sPS (V2 10 40) (-pi/2) randC1 ,sPS (V2 (-10) 40) (-pi/2) randC1 ])
|
||||
putWp = set rmPS [sPS (V2 20 60) 0 $ RandPS randFirstWeapon ,spanLightI (V2 0 40) (V2 40 40)]
|
||||
putCrs = over rmPmnts (++ [sPS (V2 10 40) (-pi/2) randC1 ,sPS (V2 (-10) 40) (-pi/2) randC1 ])
|
||||
putWp = set rmPmnts [sPS (V2 20 60) 0 $ RandPS randFirstWeapon ,spanLightI (V2 0 40) (V2 40 40)]
|
||||
|
||||
critInDeadEnd :: Room
|
||||
critInDeadEnd = set rmPS [sPS (V2 0 0) 0 randC1] deadEndRoom
|
||||
critInDeadEnd = set rmPmnts [sPS (V2 0 0) 0 randC1] deadEndRoom
|
||||
|
||||
deadEndRoom :: Room
|
||||
deadEndRoom = defaultRoom
|
||||
@@ -336,7 +334,7 @@ deadEndRoom = defaultRoom
|
||||
]
|
||||
, _rmLinks = lnks
|
||||
, _rmPath = []
|
||||
, _rmPS = [sPS (V2 0 (-10)) 0 putLamp]
|
||||
, _rmPmnts = [sPS (V2 0 (-10)) 0 putLamp]
|
||||
, _rmBound = [rectNSWE 20 (-20) (-30) 30]
|
||||
}
|
||||
where
|
||||
@@ -353,7 +351,7 @@ weaponRoom = join $ takeOne
|
||||
|
||||
roomCCrits :: RandomGen g => State g Room
|
||||
roomCCrits = roomC 200 200
|
||||
<&> rmPS %~ (replicate 20 (Placement (PSRoomRand 0) randC1 (const Nothing)) ++ )
|
||||
<&> rmPmnts %~ (replicate 20 (Placement (PSRoomRand 0) randC1 (const Nothing)) ++ )
|
||||
|
||||
longRoom :: RandomGen g => State g Room
|
||||
longRoom = do
|
||||
@@ -373,7 +371,7 @@ longRoom = do
|
||||
brls <- fmap (map (\p -> sPS (p +.+ V2 10 200) 0 $ PutCrit explosiveBarrel) )
|
||||
$ replicateM 5 $ randInRect (w-20) 900
|
||||
let rm = roomRect w (h+70) 1 1 & rmPolys %~ ([rectNSWE h (h-165) (-45) (w+45)] ++)
|
||||
changeLinkTo cond $ rm & rmPS .~ ws ++ brls ++ wsDefense ++
|
||||
changeLinkTo cond $ rm & rmPmnts .~ ws ++ brls ++ wsDefense ++
|
||||
[sPS (V2 12.5 (h-25)) 0 $ PutCrit longCrit
|
||||
,sPS (V2 37.5 (h-25)) 0 $ PutCrit longCrit
|
||||
,sPS (V2 62.5 (h-25)) 0 $ PutCrit longCrit
|
||||
@@ -385,7 +383,7 @@ doubleCorridorBarrels :: RandomGen g => State g Room
|
||||
doubleCorridorBarrels = do
|
||||
h <- state $ randomR (200,300)
|
||||
let cond x = (sndV2 . fst) x < h - 40
|
||||
changeLinkTo cond $ roomRect 100 h 1 1 & rmPS .~
|
||||
changeLinkTo cond $ roomRect 100 h 1 1 & rmPmnts .~
|
||||
[blockLine (V2 50 50) (V2 50 h)
|
||||
,sPS (V2 25 (h-25)) 0 $ PutCrit $ addArmour autoCrit
|
||||
,sPS (V2 75 (h-30)) 0 $ PutCrit explosiveBarrel
|
||||
@@ -413,19 +411,19 @@ shootersRoom' = do
|
||||
,spanLightI (V2 (w/2) 200) (V2 (w+10) 200)
|
||||
]
|
||||
toPS x y = return (V2 x y,-0.5*pi)
|
||||
return $ set rmPS plmnts $ roomRectAutoLinks w 600
|
||||
& rmPS .~ plmnts
|
||||
return $ set rmPmnts plmnts $ roomRectAutoLinks w 600
|
||||
& rmPmnts .~ plmnts
|
||||
& rmRandPSs .~ [toPS x1 y1,toPS x2 y2,toPS x3 y3]
|
||||
|
||||
shootersRoom1 :: RandomGen g => State g Room
|
||||
shootersRoom1 = shootersRoom' <&> rmPS %~
|
||||
shootersRoom1 = shootersRoom' <&> rmPmnts %~
|
||||
( (
|
||||
RandomPlacement $ takeOne $ map (\i -> Placement (PSRoomRand i) (PutCrit autoCrit) (const Nothing))
|
||||
[0,1,2]
|
||||
) :)
|
||||
|
||||
shootersRoom :: RandomGen g => State g Room
|
||||
shootersRoom = shootersRoom' <&> rmPS %~
|
||||
shootersRoom = shootersRoom' <&> rmPmnts %~
|
||||
( map (\i -> Placement (PSRoomRand i) (PutCrit autoCrit) (const Nothing))
|
||||
[0,1,2]
|
||||
++ )
|
||||
@@ -456,13 +454,13 @@ pillarGrid = do
|
||||
++
|
||||
concat [f x y | x<-xs,y<-ys]
|
||||
return $ roomRect w h (max i 2) (max i 2)
|
||||
& rmPS .~ plmnts
|
||||
& rmPmnts .~ plmnts
|
||||
& rmRandPSs .~ [rps]
|
||||
|
||||
-- TODO remove possible identical draws on random PSs
|
||||
pistolerRoom :: RandomGen g => State g Room
|
||||
pistolerRoom = pillarGrid
|
||||
<&> rmPS %~ (
|
||||
<&> rmPmnts %~ (
|
||||
[Placement (PSRoomRand 0) (PutCrit pistolCrit) (const Nothing)
|
||||
,Placement (PSRoomRand 0) (PutCrit pistolCrit) (const Nothing)
|
||||
,Placement (PSRoomRand 0) (PutCrit pistolCrit) (const Nothing)
|
||||
@@ -480,10 +478,10 @@ shootingRange = do
|
||||
return $ treeFromPost
|
||||
[Left rm1
|
||||
,Left $ roomPadCut (rectNSWE 40 (-40) (-80) 80) (V2 0 20)
|
||||
& rmPS %~ (spanLightI (V2 (-80) 10) (V2 80 10) :)
|
||||
& rmPmnts %~ (spanLightI (V2 (-80) 10) (V2 80 10) :)
|
||||
,Left rm2
|
||||
,Left $ roomPadCut (rectNSWE 40 (-40) (-80) 80) (V2 0 20)
|
||||
& rmPS %~ (spanLightI (V2 (-80) 10) (V2 80 10) :)
|
||||
& rmPmnts %~ (spanLightI (V2 (-80) 10) (V2 80 10) :)
|
||||
]
|
||||
(Right rm3)
|
||||
|
||||
@@ -492,6 +490,6 @@ spawnerRoom = do
|
||||
x <- state $ randomR (250,300)
|
||||
y <- state $ randomR (300,400)
|
||||
roomWithSpawner <- roomC x y <&>
|
||||
rmPS %~ (Placement (PSRoomRand 0) (PutCrit spawnerCrit) (const Nothing) :)
|
||||
rmPmnts %~ (Placement (PSRoomRand 0) (PutCrit spawnerCrit) (const Nothing) :)
|
||||
aRoom <- airlock
|
||||
return $ treeFromTrunk [Left aRoom,Left corridor] $ connectRoom roomWithSpawner
|
||||
|
||||
Reference in New Issue
Block a user