Tweak airlock door to stop z fighting

This commit is contained in:
2021-04-22 14:42:49 +02:00
parent 1ab793180c
commit 6c65515381
4 changed files with 24 additions and 10 deletions
+2 -1
View File
@@ -33,7 +33,8 @@ roomTreex = do
struct' <- aTreeStrut struct' <- aTreeStrut
let struct = Node [EndRoom] [] let struct = Node [EndRoom] []
let t' = padCorridors struct let t' = padCorridors struct
t = treeTrunk [[StartRoom],[OrAno [[DoorAno],[Corridor]] ],[FirstWeapon],[Corridor]] t' t = treeTrunk [[StartRoom],[OrAno [--[DoorAno],[Corridor],
[DoorNumAno 0,AirlockAno]] ],[FirstWeapon],[Corridor]] t'
fmap (shiftExpandTree . expandTreeBy id) $ mapM annoToRoomTree t fmap (shiftExpandTree . expandTreeBy id) $ mapM annoToRoomTree t
levx :: RandomGen g => State g [Room] levx :: RandomGen g => State g [Room]
+9 -1
View File
@@ -22,6 +22,9 @@ data Annotation
| Key Int | Key Int
| Corridor | Corridor
| DoorAno | DoorAno
| SwitchDoorAno
| DoorNumAno Int
| AirlockAno
| FirstWeapon | FirstWeapon
| StartRoom | StartRoom
| EndRoom | EndRoom
@@ -42,12 +45,17 @@ randomPadCorridors (Node x xs) = do
xs' <- mapM randomPadCorridors xs xs' <- mapM randomPadCorridors xs
return $ treeTrunk (replicate n [Corridor]) (Node x xs') return $ treeTrunk (replicate n [Corridor]) (Node x xs')
roomThenCorridor :: RandomGen g => Room -> State g (Tree (Either Room Room))
roomThenCorridor theRoom = fmap (\r -> Node (Left theRoom) [(pure . Right) r])
(randomiseOutLinks corridor)
annoToRoomTree :: RandomGen g => [Annotation] -> State g (Tree (Either Room Room)) annoToRoomTree :: RandomGen g => [Annotation] -> State g (Tree (Either Room Room))
annoToRoomTree [OrAno as] = do annoToRoomTree [OrAno as] = do
a <- takeOne as a <- takeOne as
annoToRoomTree a annoToRoomTree a
annoToRoomTree [Corridor] = fmap (pure . Right) $ randomiseOutLinks corridor annoToRoomTree [Corridor] = fmap (pure . Right) $ randomiseOutLinks corridor
annoToRoomTree [DoorAno] = fmap (\r -> Node (Left door) [(pure . Right) r]) (randomiseOutLinks corridor) annoToRoomTree [DoorAno] = roomThenCorridor door
annoToRoomTree [DoorNumAno i,AirlockAno] = roomThenCorridor (airlock i)
annoToRoomTree [FirstWeapon] = do annoToRoomTree [FirstWeapon] = do
branchWP <- branchRectWith weaponRoom branchWP <- branchRectWith weaponRoom
blockedC <- blockedCorridor blockedC <- blockedCorridor
+1 -1
View File
@@ -86,7 +86,7 @@ mkTriggerDoor c cond pl pr xs = addSound $ zipWith3 (triggerDoorPane c cond)
, [prd,prrd,pr,pr] , [prd,prrd,pr,pr]
, [prrd,prru] , [prrd,prru]
] ]
where norm = 15 *.* errorNormalizeV 49 ( vNormal (pr -.- pl)) where norm = 14 *.* errorNormalizeV 49 ( vNormal (pr -.- pl))
hw = 0.5 *.* (pl +.+ pr) hw = 0.5 *.* (pl +.+ pr)
perp = 20 *.* normalizeV (pl -.- pr) perp = 20 *.* normalizeV (pl -.- pr)
--perp = pl -.- hw --perp = pl -.- hw
+12 -7
View File
@@ -65,17 +65,22 @@ airlockOneWay n = Room
col = dim $ dim $ bright red col = dim $ dim $ bright red
airlock :: Int -> Room airlock :: Int -> Room
airlock n = Room airlock n = Room
{ _rmPolys = [rectNSWE 90 0 0 40] { _rmPolys =
[ rectNSWE 90 0 0 40
, rectNSWE 60 30 (-40) 20
]
, _rmLinks = lnks , _rmLinks = lnks
, _rmPath = [((20,85),(20,45)) , _rmPath = [((20,85),(20,45))
,((20,45),(20, 5)) ,((20,45),(20, 5))
] ]
, _rmPS = [PS (0,15) 0 $ PutTriggerDoor col (not . cond) (0,0) (40,0) , _rmPS =
,PS (0,75) 0 $ PutTriggerDoor col (cond) (0,0) (40,0) [PS (0,15) 0 $ PutTriggerDoor col (not . cond) (1,0) (39,0)
,PS (35,45) (pi/2) $ PutButton $ makeSwitch col ,PS (0,75) 0 $ PutTriggerDoor col (cond) (1,0) (39,0)
(over worldState (M.insert (DoorNumOpen n) True)) ,PS (35,45) (pi/2) $ PutButton $ makeSwitch col
(over worldState (M.insert (DoorNumOpen n) False)) (over worldState (M.insert (DoorNumOpen n) True))
] (over worldState (M.insert (DoorNumOpen n) False))
,PS (-25, 45) 0 putLamp
]
, _rmBound = rectNSWE 75 15 0 40 , _rmBound = rectNSWE 75 15 0 40
} }
where lnks = [((20,85),0) where lnks = [((20,85),0)