From 73a35bb3f1a6398d8b5a3dcc1392258af2592fcb Mon Sep 17 00:00:00 2001 From: justin Date: Thu, 10 Mar 2022 19:00:56 +0000 Subject: [PATCH] Move typical light placement over doors --- src/Dodge/PlacementSpot.hs | 6 ++++++ src/Dodge/Room/LongDoor.hs | 21 ++++----------------- src/Dodge/Room/Procedural.hs | 3 +-- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/Dodge/PlacementSpot.hs b/src/Dodge/PlacementSpot.hs index 7457839f4..e6317c63a 100644 --- a/src/Dodge/PlacementSpot.hs +++ b/src/Dodge/PlacementSpot.hs @@ -96,6 +96,12 @@ isUnusedLnk rp = case _rpLinkStatus rp of UnusedLink {} -> _rpPlacementUse rp == 0 _ -> False +isUsedLnkUnplaced :: RoomPos -> Bool +isUsedLnkUnplaced rp = case _rpLinkStatus rp of + UsedOutLink {} -> _rpPlacementUse rp == 0 + UsedInLink {} -> _rpPlacementUse rp == 0 + _ -> False + useRoomPosCond :: (RoomPos -> Bool) -> RoomPos -> Room -> Maybe (PlacementSpot,RoomPos) useRoomPosCond t rp _ diff --git a/src/Dodge/Room/LongDoor.hs b/src/Dodge/Room/LongDoor.hs index 0cabd2e8f..16596381b 100644 --- a/src/Dodge/Room/LongDoor.hs +++ b/src/Dodge/Room/LongDoor.hs @@ -73,9 +73,7 @@ twinSlowDoorRoom w h x = defaultRoom cond' btid w' = _btState (_buttons w' IM.! btid) /= BtOff col = dim $ dim $ bright red -twinSlowDoorChasers - :: RandomGen g - => State g Room +twinSlowDoorChasers :: RandomGen g => State g Room twinSlowDoorChasers = do let lps = V2 (-65) <$> [20,40 .. 180] rps = V2 65 <$> [20,40 .. 180] @@ -84,24 +82,13 @@ twinSlowDoorChasers = do return $ twinSlowDoorRoom 80 200 40 & rmPmnts %~ (plmnts ++) southPillarsRoom :: RandomGen g => Float -> Float -> Float -> State g Room -southPillarsRoom x y h = do - let pillarsa = [] - pillarsb = putBlockRect (x/5-20) (x/5+20) (h/2-20) (h/2+20) - ++ putBlockRect (2*x/5-20) (2*x/5+20) (h/2-20) (h/2+20) - ++ putBlockRect (3*x/5-20) (3*x/5+20) (h/2-20) (h/2+20) - ++ putBlockRect (4*x/5-20) (4*x/5+20) (h/2-20) (h/2+20) - pillarsc = putBlockRect (x/3-20) (x/3+20) (h/2-20) (h/2+20) - ++ putBlockRect (2*x/3-20) (2*x/3+20) (h/2-20) (h/2+20) - pillars <- takeOne [pillarsa, pillarsb, pillarsc] - return $ roomRectAutoLinks x y & rmPmnts .~ (pillars ++ [mntLightLnkCond usedInLnkToPS]) +southPillarsRoom x y h = addSouthPillars x h (roomRectAutoLinks x y) addSouthPillars :: RandomGen g => Float -> Float -> Room -> State g Room addSouthPillars x h r = do let pillarsa = [] - pillarsb = concat [putBlockRect (i*x/5-20) (i*x/5+20) (h/2-20) (h/2+20) - | i <- map fromIntegral [1..4::Int]] - pillarsc = putBlockRect (x/3-20) (x/3+20) (h/2-20) (h/2+20) - ++ putBlockRect (2*x/3-20) (2*x/3+20) (h/2-20) (h/2+20) + pillarsb = concat [putBlockRect (i*x/5-20) (i*x/5+20) (h/2-20) (h/2+20) | i <- [1..4] ] + pillarsc = concat [putBlockRect (i*x/3-20) (i*x/3+20) (h/2-20) (h/2+20) | i <- [1,2] ] pillars <- takeOne [pillarsa, pillarsb, pillarsc] return $ r & rmPmnts .++~ pillars diff --git a/src/Dodge/Room/Procedural.hs b/src/Dodge/Room/Procedural.hs index f3ef450bc..dd9ebe89d 100644 --- a/src/Dodge/Room/Procedural.hs +++ b/src/Dodge/Room/Procedural.hs @@ -91,8 +91,7 @@ roomRectAutoLinks x y = (roomRect x y xn yn) where xn = max 1 $ (ceiling x - 40) `div` 60 yn = max 1 $ (ceiling y - 40) `div` 60 - plmnts = [mntLightLnkCond unusedLnkToPS - , mntLightLnkCond unusedLnkToPS ] + plmnts = replicate 3 (mntLightLnkCond $ useRoomPosCond isUsedLnkUnplaced) {- Combines two rooms into one room. - will have to work out exactly what to do with combining links Mostly involves concatenation. -}