Fix one bug in door wall movement, add airlock, cleanup
This commit is contained in:
@@ -73,10 +73,8 @@ doSideEffects w = do
|
|||||||
let preData = _preloadData w
|
let preData = _preloadData w
|
||||||
newPlayingSounds <- playSoundAndUpdate (_soundData preData) (_playingSounds w) (_toPlaySounds w)
|
newPlayingSounds <- playSoundAndUpdate (_soundData preData) (_playingSounds w) (_toPlaySounds w)
|
||||||
w' <- _sideEffects w w
|
w' <- _sideEffects w w
|
||||||
|
|
||||||
endTicks <- SDL.ticks
|
endTicks <- SDL.ticks
|
||||||
let lastFrameTicks = _frameTimer preData
|
let lastFrameTicks = _frameTimer preData
|
||||||
|
|
||||||
when (_debug_seconds_frame $ _config w) $ void $ renderFoldable
|
when (_debug_seconds_frame $ _config w) $ void $ renderFoldable
|
||||||
(_pictureShaders $ _renderData preData)
|
(_pictureShaders $ _renderData preData)
|
||||||
(setDepth (-1)
|
(setDepth (-1)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ initialRoomTree = do
|
|||||||
t = treeFromTrunk
|
t = treeFromTrunk
|
||||||
[[StartRoom]
|
[[StartRoom]
|
||||||
,[Corridor]
|
,[Corridor]
|
||||||
|
,[AirlockAno]
|
||||||
,[Corridor]
|
,[Corridor]
|
||||||
,[SpecificRoom $ fmap connectRoom slowDoorRoom ]
|
,[SpecificRoom $ fmap connectRoom slowDoorRoom ]
|
||||||
,[Corridor]
|
,[Corridor]
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import Dodge.Data
|
|||||||
--import Dodge.Base
|
--import Dodge.Base
|
||||||
--import Dodge.Zone
|
--import Dodge.Zone
|
||||||
import Dodge.Default.Wall
|
import Dodge.Default.Wall
|
||||||
|
import Dodge.Wall.Move
|
||||||
--import Dodge.LevelGen.Switch
|
--import Dodge.LevelGen.Switch
|
||||||
--import Dodge.LevelGen.Pathing
|
--import Dodge.LevelGen.Pathing
|
||||||
import Dodge.LevelGen.MoveDoor
|
import Dodge.LevelGen.MoveDoor
|
||||||
@@ -69,13 +70,14 @@ doorMechanismStepwise nsteps drid wlids pss dr w
|
|||||||
where
|
where
|
||||||
playSound = soundContinue (WallSound drid) (fst $ head pss) slideDoorS (Just 1)
|
playSound = soundContinue (WallSound drid) (fst $ head pss) slideDoorS (Just 1)
|
||||||
toOpen = _drTrigger dr w
|
toOpen = _drTrigger dr w
|
||||||
cpss = uncurry (rectanglePairs 9) (head pss)
|
--cpss = uncurry (rectanglePairs 9) (head pss)
|
||||||
setWalls n = playSound (foldl' setWall w (zip3 wlids newps cpss))
|
setWalls n = playSound (foldl' setWall w (zip wlids newps))
|
||||||
& doors . ix drid . drStatus .~ DoorInt n
|
& doors . ix drid . drStatus .~ DoorInt n
|
||||||
where
|
where
|
||||||
newps = uncurry (rectanglePairs 9) (pss !! n)
|
newps = uncurry (rectanglePairs 9) (pss !! n)
|
||||||
setWall w' (wlid,ps,cps) = w' & walls . ix wlid . wlLine .~ ps
|
setWall w' (wlid,ps) = w' & moveWallID wlid ps
|
||||||
& (\w'' -> foldr (changeZonedWall (wlLine .~ ps) wlid) w'' (zoneps cps))
|
-- setWall w' (wlid,ps,cps) = w' & walls . ix wlid . wlLine .~ ps
|
||||||
|
-- & (\w'' -> foldr (changeZonedWall (wlLine .~ ps) wlid) w'' (zoneps cps))
|
||||||
-- it is not at all clear that the zoning selects the correct walls
|
-- it is not at all clear that the zoning selects the correct walls
|
||||||
|
|
||||||
-- TODO think about wall zoning, simplify!
|
-- TODO think about wall zoning, simplify!
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
module Dodge.Placements.Turret
|
module Dodge.Placements.Turret where
|
||||||
where
|
|
||||||
import Color
|
import Color
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.LevelGen.Data
|
import Dodge.LevelGen.Data
|
||||||
@@ -25,7 +24,7 @@ putLasTurret = sps0 $ PutMachine blue (reverse $ square wdth) defaultMachine
|
|||||||
{ _mcDraw = drawTurret
|
{ _mcDraw = drawTurret
|
||||||
, _mcUpdate = updateTurret
|
, _mcUpdate = updateTurret
|
||||||
, _mcType = lasTurret
|
, _mcType = lasTurret
|
||||||
, _mcHP = 100000
|
, _mcHP = 50000
|
||||||
}
|
}
|
||||||
lasTurret :: MachineType
|
lasTurret :: MachineType
|
||||||
lasTurret = Turret
|
lasTurret = Turret
|
||||||
@@ -52,7 +51,6 @@ updateTurret mc w
|
|||||||
| _tuFireTime (_mcType mc) > 0
|
| _tuFireTime (_mcType mc) > 0
|
||||||
= ( particles %~ (makeLaserAt 5 (mcpos + 15 *.* unitVectorAtAngle mcdir) mcdir :) )
|
= ( particles %~ (makeLaserAt 5 (mcpos + 15 *.* unitVectorAtAngle mcdir) mcdir :) )
|
||||||
. soundContinue (MachineSound mcid) mcpos tone440sawtoothS (Just 1)
|
. soundContinue (MachineSound mcid) mcpos tone440sawtoothS (Just 1)
|
||||||
|
|
||||||
| otherwise = id
|
| otherwise = id
|
||||||
mcid = _mcID mc
|
mcid = _mcID mc
|
||||||
ypos = _crPos $ you w
|
ypos = _crPos $ you w
|
||||||
@@ -91,6 +89,3 @@ drawTurret mc = (rotateSH (-_mcDir mc) . colorSH blue $ upperPrismPoly 20 (squar
|
|||||||
|
|
||||||
wdth :: Float
|
wdth :: Float
|
||||||
wdth = 10
|
wdth = 10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import Dodge.Room.Data
|
|||||||
import Dodge.Placements
|
import Dodge.Placements
|
||||||
import Dodge.Room.Foreground
|
import Dodge.Room.Foreground
|
||||||
import Dodge.Default.Room
|
import Dodge.Default.Room
|
||||||
|
import Dodge.Default.Wall
|
||||||
import Dodge.Data
|
import Dodge.Data
|
||||||
import Dodge.LevelGen.Data
|
import Dodge.LevelGen.Data
|
||||||
import Dodge.LevelGen.Switch
|
import Dodge.LevelGen.Switch
|
||||||
@@ -17,7 +18,8 @@ import System.Random
|
|||||||
import Control.Monad.State
|
import Control.Monad.State
|
||||||
{- | A passage with a switch that opens forward access while closing backwards access. -}
|
{- | A passage with a switch that opens forward access while closing backwards access. -}
|
||||||
airlock :: RandomGen g => State g Room
|
airlock :: RandomGen g => State g Room
|
||||||
airlock = takeOne [airlock0,airlock90,airlockCrystal]
|
--airlock = takeOne [airlock0,airlock90,airlockCrystal,airlockZ]
|
||||||
|
airlock = takeOne [airlockZ]
|
||||||
{- | Straight airlock -}
|
{- | Straight airlock -}
|
||||||
airlock0 :: Room
|
airlock0 :: Room
|
||||||
airlock0 = defaultRoom
|
airlock0 = defaultRoom
|
||||||
@@ -40,6 +42,58 @@ airlock0 = defaultRoom
|
|||||||
cond' btid w' = _btState (_buttons w' IM.! btid) == BtOn
|
cond' btid w' = _btState (_buttons w' IM.! btid) == BtOn
|
||||||
col = dim $ dim $ bright red
|
col = dim $ dim $ bright red
|
||||||
|
|
||||||
|
airlockSimple :: Room
|
||||||
|
airlockSimple = defaultRoom
|
||||||
|
{ _rmPolys =
|
||||||
|
[ rectNSWE 120 0 0 180 ]
|
||||||
|
, _rmLinks = lnks
|
||||||
|
, _rmPath = concatMap (doublePair. (V2 90 30,) . fst) lnks
|
||||||
|
, _rmPS =
|
||||||
|
[ Placement (PS (V2 90 115) pi) (PutButton $ makeSwitch col red id id)
|
||||||
|
$ \btid -> jspsJ (V2 0 0) 0 (PutDoor col (cond btid) outDoorps)
|
||||||
|
$ sPS (V2 180 0) 0 (PutDoor col (cond btid) inDoorps)
|
||||||
|
]
|
||||||
|
, _rmBound =
|
||||||
|
[ rectNSWE 120 0 0 180 ]
|
||||||
|
}
|
||||||
|
where
|
||||||
|
lnks =
|
||||||
|
[(V2 0 30,pi/2)
|
||||||
|
,(V2 180 30,1.5*pi)
|
||||||
|
]
|
||||||
|
cond btid w' = _btState (_buttons w' IM.! btid) == BtOn
|
||||||
|
col = dim $ dim $ bright red
|
||||||
|
outDoorps = (V2 0 0 ,) <$> arcStepwise 3 (negate $ pi/2) (V2 0 0) (V2 0 55)
|
||||||
|
inDoorps = (V2 0 0 ,) <$> arcStepwise 3 (negate $ pi/2) (V2 0 0) (V2 (-55) 0)
|
||||||
|
airlockZ :: Room
|
||||||
|
airlockZ = defaultRoom
|
||||||
|
{ _rmPolys =
|
||||||
|
[ rectNSWE 120 0 0 180 ]
|
||||||
|
, _rmLinks =
|
||||||
|
[(V2 0 30,pi/2)
|
||||||
|
,(V2 180 30,1.5*pi)
|
||||||
|
]
|
||||||
|
, _rmPath = []
|
||||||
|
-- [(V2 0 40,V2 40 0)
|
||||||
|
-- ,(V2 40 0,V2 0 40)
|
||||||
|
-- ]
|
||||||
|
, _rmPS =
|
||||||
|
[ Placement (PS (V2 90 115) pi) (PutButton $ makeSwitch col red id id)
|
||||||
|
$ \btid -> jspsJ (V2 0 60) 0 (PutDoor col (cond btid) outDoorps)
|
||||||
|
$ sPS (V2 180 60) 0 (PutDoor col (cond btid) inDoorps)
|
||||||
|
, sps0 $ PutWall (rectNSEW 70 50 120 60) defaultWall
|
||||||
|
, mountLightV (V2 90 60) (V3 90 40 50)
|
||||||
|
, mountLightV (V2 90 60) (V3 90 80 50)
|
||||||
|
]
|
||||||
|
, _rmBound =
|
||||||
|
[ rectNSWE 120 0 0 180 ]
|
||||||
|
}
|
||||||
|
where
|
||||||
|
cond btid w' = _btState (_buttons w' IM.! btid) == BtOn
|
||||||
|
col = dim $ dim $ bright red
|
||||||
|
outDoorps = (V2 0 0 ,) <$> arcStepwise 3 (pi/2) (V2 0 0) (V2 0 (-61))
|
||||||
|
inDoorps = (V2 0 0 ,) <$> arcStepwise 3 (pi/2) (V2 0 0) (V2 (-61) 0)
|
||||||
|
|
||||||
airlock90 :: Room
|
airlock90 :: Room
|
||||||
airlock90 = defaultRoom
|
airlock90 = defaultRoom
|
||||||
{ _rmPolys =
|
{ _rmPolys =
|
||||||
|
|||||||
Reference in New Issue
Block a user