Cleanup. Add room-wise random placement spots

This commit is contained in:
2021-11-07 19:46:14 +00:00
parent f380e140e1
commit 5681a37953
18 changed files with 179 additions and 141 deletions
+6 -3
View File
@@ -30,7 +30,7 @@ airlock0 = defaultRoom
[Placement (PS (V2 (-35) 50) (negate $ pi/2)) (PutButton $ makeSwitch col red id id)
$ \btid -> Just $ putDoubleDoorThen False col (not . cond' btid) (V2 (-1) 20) (V2 41 20) 2
$ Just $ putDoubleDoorThen False col (cond' btid) (V2 (-1) 80) (V2 41 80) 2 Nothing
,spanLightI 70 (V2 (-2) 30) (V2 (-2) 70)
,spanLightI (V2 (-2) 30) (V2 (-2) 70)
,sps0 $ PutForeground $ thinHighBar 75 (V2 40 50) (V2 (-1) 50)
]
, _rmBound = [rectNSWE 75 15 0 40]
@@ -82,8 +82,7 @@ airlockZ = defaultRoom
$ \btid -> jspsJ (V2 0 60) 0 (PutDoor col (cond btid) outDoorps)
$ sPS (V2 180 60) 0 (PutDoor col (cond btid) inDoorps)
, sps0 $ PutWall (rectNSEW 70 50 120 60) defaultWall
, mountLightV (V2 90 60) (V3 90 40 50)
, mountLightV (V2 90 60) (V3 90 80 50)
, lighting
]
, _rmBound =
[ rectNSWE 120 0 0 180 ]
@@ -93,6 +92,10 @@ airlockZ = defaultRoom
col = dim $ dim $ bright red
outDoorps = (V2 0 0 ,) <$> arcStepwise 3 (pi/2) (V2 0 0) (V2 0 (-61))
inDoorps = (V2 0 0 ,) <$> arcStepwise 3 (pi/2) (V2 0 0) (V2 (-61) 0)
cenlight = mountLightV (V2 90 60) (V3 90 40 50) `addPlmnt` mountLightV (V2 90 60) (V3 90 80 50)
cornlight = mountLightV (V2 0 120) (V3 30 90 50) `addPlmnt` mountLightV (V2 180 120) (V3 150 90 50)
`addPlmnt` sps0 (PutForeground (thinHighBar 50 (V2 30 90) (V2 150 90)))
lighting = RandomPlacement $ takeOne [cenlight,cornlight]
airlock90 :: Room
airlock90 = defaultRoom
+4 -6
View File
@@ -1,6 +1,4 @@
{-
Rooms containing particularly challenging creatures, that may drop useful loot.
-}
{- Rooms containing particularly challenging creatures, that may drop useful loot. -}
module Dodge.Room.Boss
where
import Dodge.Data
@@ -37,7 +35,7 @@ roomGlassOctogon x = createPathGrid $ defaultRoom
, ( V2 0 (-(x+40)), V2 0 x)
]
, _rmPS =
[sPS (V2 fx fx) 0 putLamp
[sPS (V2 fx fx) 0 putLamp
,sPS (V2 (-fx) fx) 0 putLamp
,sPS (V2 fx (-fx)) 0 putLamp
,sPS (V2 (-fx) (-fx)) 0 putLamp
@@ -97,8 +95,8 @@ roomCross x y = defaultRoom
]
, _rmPath = []
, _rmPS =
[ spanLightI 70 (V2 (x+5) x) (V2 (x+5) (-x))
, spanLightI 70 (V2 (-x-5) x) (V2 (-x-5) (-x))
[ spanLightI (V2 (x+5) x) (V2 (x+5) (-x))
, spanLightI (V2 (-x-5) x) (V2 (-x-5) (-x))
]
, _rmBound =
[rectNSWE y (-y) (-x) x
+1 -1
View File
@@ -17,7 +17,7 @@ corridor = defaultRoom
{ _rmPolys = [poly]
, _rmLinks = lnks
, _rmPath = concatMap (doublePair . (,) (V2 20 60) . fst) lnks
, _rmPS = [ spanLightI 50 (V2 0 40) (V2 40 40) ]
, _rmPS = [ spanLightI (V2 0 40) (V2 40 40) ]
, _rmBound = [ rectNSWE 50 30 0 40 ]
, _rmFloor = [makeTileFromPoly poly 2]
}
+3
View File
@@ -6,6 +6,8 @@ import Dodge.LevelGen.Data
import Geometry.Data
import Data.Tile
import Control.Monad.State
import System.Random
import Control.Lens
{-
The '_rmPolys' list states which polygons should be cut out to form the indestructible walls of the room.
@@ -27,5 +29,6 @@ data Room = Room
, _rmName :: String
, _rmShift :: (Point2, Float)
, _rmViewpoints :: [Point2]
, _rmRandPSs :: [State StdGen (Point2,Float)]
}
makeLenses ''Room
+10
View File
@@ -46,6 +46,16 @@ tankRectCross w h col x y = shiftPlacement (V2 x y,0) $ ps0j
tankSquareCross :: Color -> Float -> Float -> Placement
tankSquareCross = tankRectCross 20 20
lowWall :: [Point2] -> Placement
lowWall ps = ps0j (PutForeground . colorSH col $ upperPrismPoly 30 ps)
$ sps0 $ PutWall ps theWall
where
col = _wlColor defaultWall
theWall = defaultWall
{ _wlOpacity = SeeAbove
, _wlDraw = False
}
tankRect :: Float -> Float -> Color -> Float -> Float -> Placement
tankRect w h col x y = shiftPlacement (V2 x y,0) $ ps0j
(PutForeground $ colorSH col
+2 -2
View File
@@ -71,9 +71,9 @@ roomRectAutoLinks :: Float -> Float -> Room
roomRectAutoLinks x y = (roomRect x y ((ceiling x - 40) `div` 60) ((ceiling y - 40) `div` 60))
{_rmPS = plmnts}
where
plmnts = [mntLightCond (const True)]
plmnts = [mntLightLnkCond (const True)]
{- Combines two rooms into one room.
Combines into one big bound, concatenates the rest. -}
Mostly involves concatenation. -}
combineRooms :: Room -> Room -> Room
combineRooms r r' = defaultRoom
{ _rmPolys = _rmPolys r ++ _rmPolys r'
+23 -11
View File
@@ -1,15 +1,16 @@
{-
Connecting rooms designed with a pass-through technique in mind.
-}
{- Connecting rooms designed with a pass-through technique in mind. -}
module Dodge.Room.RoadBlock
where
import Geometry
--import Dodge.Data
import Dodge.Default.Room
import Dodge.Room.Data
import Dodge.Room.Link
import Dodge.Placements
import Dodge.Room.Corridor
import Dodge.Room.Furniture
import Dodge.LevelGen.Data
--import Dodge.Default.Wall
--import Dodge.RandomHelp
import Dodge.Creature
import Dodge.Layout.Tree.Polymorphic
@@ -42,7 +43,7 @@ litCorridor90 = do
]
, _rmPS =
[ sPS (V2 20 (h-5)) 0 putLamp
, spanLightI 70 (V2 0 (0.4*h)) (V2 40 (0.4*h))
, spanLightI (V2 0 (0.4*h)) (V2 40 (0.4*h))
, windowLine (V2 0 (h-20)) (V2 40 (h-20))
, sPS (V2 (-50) (h-85)) 0 putLamp
, windowLine (V2 (-40) (h-60)) (V2 (-40) (h-100))
@@ -52,11 +53,7 @@ litCorridor90 = do
, _rmBound = [poly]
}
noWeaponTest :: State g (Tree (Either Room Room))
noWeaponTest = do
undefined
-- | A random length corridor with a descrutible block blocking it.
-- | A random length corridor with a destructible block blocking it.
longBlockedCorridor :: RandomGen g => State g (Tree (Either Room Room))
longBlockedCorridor = do
r <- state $ randomR (0,pi)
@@ -68,13 +65,28 @@ longBlockedCorridor = do
sequence $ treeFromPost (replicate n $ Left <$> randomiseOutLinks corridor)
$ return $ Right $ set rmPS plmnts corridor
-- | A single corridor with a descrutible block blocking it.
-- | A single corridor with a destructible block blocking it.
blockedCorridor :: RandomGen g => State g (Tree (Either Room Room))
blockedCorridor = do
r <- state $ randomR (0,pi)
let plmnts =
[sPS (V2 20 40) r $ PutBlock [5,5,5] (V4 (150/256) ( 75/256) 0 ( 250/256))
$ reverse $ rectNSWE 10 (-10) (-10) 10
,spanLightI 55 (V2 0 15) (V2 40 15)
,spanLightI (V2 0 15) (V2 40 15)
]
sequence $ treeFromPost [] $ return $ Right $ set rmPS plmnts corridor
lasTunnel :: Room
lasTunnel = defaultRoom
{ _rmPolys = polys
, _rmBound = polys
, _rmLinks = [(V2 20 190,1.5* pi),(V2 0 20,0.5* pi)]
, _rmPS = [putLasTurret & placementSpot .~ PS (V2 10 240) (1.5*pi)
, lowWall (rectNSEW 65 40 0 25)
, mountLightV (V2 50 10) (V3 40 20 50)
]
}
where
polys = [rectNSWE 250 0 0 20
, rectNSWE 80 0 0 60
]