Allow for more complex placement positioning
This commit is contained in:
+6
-97
@@ -10,6 +10,7 @@ import Dodge.Default
|
||||
import Dodge.Tree
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.Room.Door
|
||||
import Dodge.Room.RezBox
|
||||
import Dodge.Room.Corridor
|
||||
import Dodge.Room.Room
|
||||
import Dodge.Room.Link
|
||||
@@ -67,11 +68,11 @@ startRoom :: RandomGen g => Int -> State g (SubCompTree Room)
|
||||
startRoom i = join $ takeOne
|
||||
[-- roomMiniIntro
|
||||
--minigunfakeout
|
||||
rezBoxesWp
|
||||
, rezBoxesThenWeaponRoom
|
||||
, rezBoxThenWeaponRoom
|
||||
, rezBoxesWpCrit
|
||||
, runPastStart i
|
||||
-- rezBoxesWp
|
||||
rezBoxesThenWeaponRoom
|
||||
-- , rezBoxThenWeaponRoom
|
||||
-- rezBoxesWpCrit
|
||||
-- , runPastStart i
|
||||
]
|
||||
|
||||
runPastStart :: RandomGen g => Int -> State g (SubCompTree Room)
|
||||
@@ -85,33 +86,6 @@ rezBoxStart = do
|
||||
ls <- rezColor
|
||||
return $ treeFromPost [PassDown $ rezBox ls] (UseAll door)
|
||||
|
||||
rezBox :: LightSource -> Room
|
||||
rezBox ls = roomRect 40 60 1 1
|
||||
& rmPmnts .~ [ sPS (V2 20 1) 0 $ PutLS ls]
|
||||
rezColor :: RandomGen g => State g LightSource
|
||||
rezColor = do
|
||||
col <- takeOne [V3 0.0 0.1 0.5, V3 0.0 0.5 0.1]
|
||||
h <- takeOne [30,50,80,90,90,90,90]
|
||||
rad <- takeOne [150,200,200,250,250,300,300,300]
|
||||
return defaultLS
|
||||
{ _lsPos = V3 0 0 h
|
||||
, _lsIntensity = col
|
||||
, _lsRad = rad
|
||||
}
|
||||
|
||||
rezInvBox :: LightSource -> Room
|
||||
rezInvBox = swapInOutLinks . rezBox
|
||||
|
||||
crAdd :: Room -> Room
|
||||
crAdd = rmPmnts %~ (sPS (V2 20 10) (0.5*pi) randC1 :)
|
||||
|
||||
wpAdd :: Item -> Room -> Room
|
||||
wpAdd wp = rmPmnts %~ f
|
||||
where
|
||||
f (x:xs) = sPS (V2 15 30) 1 (PutFlIt wp) : g x : xs
|
||||
f _ = [sPS (V2 15 30) 1 (PutFlIt wp)]
|
||||
g x = x & plIDCont .~ flickerMod
|
||||
|
||||
|
||||
rezBoxesThenWeaponRoom :: RandomGen g => State g (SubCompTree Room)
|
||||
rezBoxesThenWeaponRoom = do
|
||||
@@ -124,72 +98,7 @@ rezBoxThenWeaponRoom = do
|
||||
rcol <- rezColor
|
||||
treeFromTrunk [PassDown $ rezBox rcol,PassDown door] <$> weaponRoom
|
||||
|
||||
rezBoxesWpCrit :: RandomGen g => State g (SubCompTree Room)
|
||||
rezBoxesWpCrit = do
|
||||
w <- state $ randomR (200,400)
|
||||
h <- state $ randomR (40,40)
|
||||
thecol <- rezColor
|
||||
theweapon <- randBlockBreakWeapon
|
||||
let bottomEdgeTest (V2 _ y,_) = y < 1
|
||||
bottomPassDownTest (V2 x y,_) = y < 1 && x < 21
|
||||
aroom = rezInvBox thecol
|
||||
centralRoom <- filterSortOutLinksOn bottomEdgeTest ((\(V2 a b) -> (b,a)) . fst) <$>
|
||||
(randomiseOutLinks =<< changeLinkTo bottomPassDownTest
|
||||
((roomRectAutoLinks w h) {_rmPmnts = []}))
|
||||
let n = length $ filter bottomEdgeTest $ map lnkPosDir $ _rmLinks centralRoom
|
||||
i <- state $ randomR (0,n-3)
|
||||
j <- state $ randomR (i,n-2)
|
||||
blcor <- blockedCorridor'
|
||||
let rezrooms = map adddoor
|
||||
$ insertAt i (wpAdd theweapon aroom)
|
||||
$ insertAt j (crAdd aroom)
|
||||
$ replicate (n-3) aroom
|
||||
return $ treeFromTrunk [PassDown $ rezBox thecol
|
||||
, PassDown door
|
||||
]
|
||||
(Node (PassDown centralRoom) (rezrooms ++ [onwardtree blcor]))
|
||||
where
|
||||
adddoor rm = treeFromPost [PassDown door] (PassDown rm)
|
||||
onwardtree blcor = treeFromPost [PassDown door] (UseAll blcor)
|
||||
|
||||
rezBoxesWp :: RandomGen g => State g (SubCompTree Room)
|
||||
rezBoxesWp = do
|
||||
w <- state $ randomR (100,400)
|
||||
h <- state $ randomR (40,40)
|
||||
theweapon <- randBlockBreakWeapon
|
||||
thecol <- rezColor
|
||||
let bottomEdgeTest (V2 _ y,_) = y < 1
|
||||
aroom = rezInvBox thecol
|
||||
centralRoom <- randomiseOutLinks =<< changeLinkTo bottomEdgeTest
|
||||
((roomRectAutoLinks w h) {_rmPmnts = []})
|
||||
blcor <- blockedCorridor'
|
||||
let n = length $ filter bottomEdgeTest $ map lnkPosDir $_rmLinks centralRoom
|
||||
let rezrooms = map adddoor
|
||||
$ wpAdd theweapon aroom : replicate (n-2) aroom
|
||||
centralRoom' <- changeLinkFrom bottomEdgeTest centralRoom
|
||||
return $ treeFromTrunk [PassDown $ rezBox thecol
|
||||
, PassDown door
|
||||
]
|
||||
(Node (PassDown centralRoom') (rezrooms ++ [onwardtree blcor]))
|
||||
where
|
||||
adddoor rm = treeFromPost [PassDown door] (PassDown rm)
|
||||
onwardtree blcor = treeFromPost [PassDown door] (UseAll blcor)
|
||||
|
||||
rezBoxes :: RandomGen g => State g (SubCompTree Room)
|
||||
rezBoxes = do
|
||||
w <- state $ randomR (100,400)
|
||||
h <- state $ randomR (40,40)
|
||||
thecol <- rezColor
|
||||
let bottomEdgeTest (V2 _ y,_) = y < 1
|
||||
dbox = treeFromPost [PassDown door] (PassDown $ rezInvBox thecol)
|
||||
centralRoom <- randomiseOutLinks =<< changeLinkTo bottomEdgeTest
|
||||
((roomRectAutoLinks w h) {_rmPmnts = []})
|
||||
let n = length $ filter bottomEdgeTest $ map lnkPosDir $_rmLinks centralRoom
|
||||
centralRoom' <- changeLinkFrom bottomEdgeTest centralRoom
|
||||
return $ treeFromTrunk [PassDown $ rezBox thecol
|
||||
, PassDown door
|
||||
]
|
||||
(Node (PassDown centralRoom') (replicate (n-1) dbox ++ [Node (UseAll door) []]))
|
||||
|
||||
startRoom' :: RandomGen g => State g (SubCompTree Room)
|
||||
startRoom' = do
|
||||
|
||||
Reference in New Issue
Block a user