Files
loop/src/Dodge/Room/Door.hs
T

49 lines
1.4 KiB
Haskell

{- Rooms that connect other rooms, blocking sight. -}
module Dodge.Room.Door
where
import Geometry
import Dodge.RoomLink
import Dodge.Data
import Dodge.Default.Room
import Dodge.Placement.Instance
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 = init lnks ++ [last 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)]
, _rmName = "autoDoor"
, _rmBound = [rectNSWE 21 19 0 40]
}
where
lnks = [uncurry outLink (V2 20 35,0)
,uncurry inLink (V2 20 5,pi)
]
triggerDoorRoom :: Int -> Room
triggerDoorRoom inplid = defaultRoom
{ _rmPolys = [rectNSWE 40 0 0 40]
, _rmLinks = init lnks++ [last lnks]
, _rmPath = [(V2 20 35,V2 20 5)]
, _rmInPmnt = [InPlacement f inplid]
, _rmName = "triggerDoorRoom"
-- door extends into side walls (for shadows as rendered 12/03/21)
-- note no bounds
}
where
lnks = [uncurry outLink (V2 20 35,0)
,uncurry inLink(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)