Files
loop/src/Dodge/Room/Door.hs
T
2022-07-24 20:36:27 +01:00

43 lines
1.3 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.Default.Door
import Dodge.Placement.Instance
import Color
import Data.Maybe
door :: Room
door = defaultRoom
{ _rmPolys = [rectNSWE 40 0 0 40]
, _rmLinks = lnks
, _rmPath = doublePairSet (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 = [uncurry outLink (V2 20 35,0) ,uncurry inLink(V2 20 5,pi) ]
, _rmPath = doublePairSet (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
f (pmnt:_) = putDoubleDoor DoorObstacle (switchWallCol red) (cond pmnt) (V2 0 20) (V2 40 20) 2
f _ = error "tried to put a door using an empty placement list"
cond pmnt = WdTrig $ fromJust (_plMID pmnt)