Improvements to rooms and view distances

This commit is contained in:
2022-03-07 09:16:16 +00:00
parent 1364e7c8c8
commit 81830d87a3
12 changed files with 140 additions and 100 deletions
+11 -16
View File
@@ -21,11 +21,11 @@ import Dodge.Creature
import Dodge.LightSource
import Picture
import Geometry
import LensHelp
import qualified Data.Set as S
import Data.Tree
import System.Random
import Control.Lens
import Control.Monad.State
--import Data.Tree
import qualified Data.IntMap as IM
@@ -95,14 +95,12 @@ southPillarsRoom x y h = do
addSouthPillars :: RandomGen g => Float -> Float -> Room -> State g Room
addSouthPillars x h r = 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)
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)
pillars <- takeOne [pillarsa, pillarsb, pillarsc]
return $ r & rmPmnts %~ (++ pillars)
return $ r & rmPmnts .++~ pillars
addButtonSlowDoor :: RandomGen g => Float -> Float -> Room -> State g Room
addButtonSlowDoor x h rm = do
@@ -111,10 +109,9 @@ addButtonSlowDoor x h rm = do
,( V2 (x/2+50) 5,0::Float)
]
thePlacement <- takeOne [butDoor butPos butRot ]
shuffleLinks $ setOutLinksPD aboveH $ setInLinksPD belowH (rm
& rmPmnts %~ (thePlacement :)
& rmBound %~ (openDoorBound :)
)
shuffleLinks $ setOutLinksPD aboveH $ setInLinksPD belowH $ rm
& rmPmnts .:~ thePlacement
& rmBound .:~ openDoorBound
where
openDoorBound = rectNSEW (h + 5) (h - 5) (-x/2) (3*x/2)
belowH y = (sndV2 . fst) y < h - 40
@@ -149,9 +146,7 @@ slowDoorRoom = do
slowDoorRoomRunPast :: RandomGen g => State g (SubCompTree Room)
slowDoorRoomRunPast = do
r <- slowDoorRoom
return $ treeFromTrunk [PassDown door]
(Node (PassDown r)
[ singleUseAll door
, return (UseLabel 0 $ door & rmConnectsTo .~ S.singleton InLink)
]
)
return $ treeFromTrunk [PassDown door] $ Node (PassDown r)
[ singleUseAll door
, return (UseLabel 0 $ door & rmConnectsTo .~ S.singleton InLink)
]