Files
loop/src/Dodge/Room/Door.hs
T
2021-11-14 00:39:24 +00:00

46 lines
1.1 KiB
Haskell

{- Rooms that connect other rooms, blocking sight. -}
module Dodge.Room.Door
where
import Geometry
import Dodge.Data
import Dodge.Default.Room
import Dodge.Placements
import Color
import Data.Maybe
import qualified Data.IntMap.Strict as IM
import Dodge.LevelGen.Data
import Control.Lens
door :: Room
door = defaultRoom
{ _rmPolys = [rectNSWE 40 0 0 40]
, _rmLinks = lnks
, _rmPath = [(V2 20 35,V2 20 5)]
-- door extends into side walls (for shadows as rendered 12/03)
, _rmPmnts = [putAutoDoor (V2 0 20) (V2 40 20)]
-- note no bounds
}
where
lnks = [(V2 20 35,0)
,(V2 20 5,pi)
]
switchDoorRoom :: Room
switchDoorRoom = defaultRoom
{ _rmPolys = [rectNSWE 40 0 0 40]
, _rmLinks = lnks
, _rmPath = [(V2 20 35,V2 20 5)]
, _rmPartPmnt = Just f
-- door extends into side walls (for shadows as rendered 12/03)
-- note no bounds
}
where
lnks = [(V2 20 35,0)
,(V2 20 5,pi)
]
f (pmnt:_) = putDoubleDoor False red (cond pmnt) (V2 0 20) (V2 40 20) 2
f _ = error "tried to put a door using an empty placement list"
cond pmnt w = w & _triggers w IM.! fromJust (_plMID pmnt)