Add quiet laser sound

This commit is contained in:
2021-11-21 23:27:14 +00:00
parent afeb9d2b64
commit 1aa797ddef
10 changed files with 227 additions and 209 deletions
Binary file not shown.
+7 -2
View File
@@ -21,7 +21,11 @@ addLock i t = do
return $ addToTrunk newBefore [Node [Lock i] afterLock]
{- | Add one corridor between each parent-child link of a tree of annotations. -}
padWithCorridors :: Tree [Annotation g] -> Tree [Annotation g]
padWithCorridors (Node x xs) = Node [Corridor] [Node x (map padWithCorridors xs)]
padWithCorridors = padWithAno [Corridor]
padWithAno :: [Annotation g] -> Tree [Annotation g] -> Tree [Annotation g]
padWithAno ano (Node x xs) = Node ano [Node x (map (padWithAno ano) xs)]
padSucWithCorridors :: Tree [Annotation g] -> Tree [Annotation g]
padSucWithCorridors (Node x xs) = Node x (map padWithCorridors xs)
@@ -35,9 +39,11 @@ randomPadCorridors (Node x xs) = do
roomThenCorridor :: RandomGen g => Room -> State g (Tree (Either Room Room))
roomThenCorridor theRoom = fmap (\r -> Node (Left theRoom) [(pure . Right) r])
(randomiseOutLinks corridor)
{- | Create a random room tree structure from a list of annotations. -}
anoToRoomTree :: RandomGen g => [Annotation g] -> State g (Tree (Either Room Room))
anoToRoomTree anos = case anos of
[AnoApplyInt i f] -> f i
[SetLabel i randrm] -> do
rm <- randrm
return . connectRoom $ rm & rmLabel ?~ i
@@ -57,7 +63,6 @@ anoToRoomTree anos = case anos of
blockedC <- longBlockedCorridor
join $ takeOne $ return (appendEitherTree branchWP [blockedC]) : replicate 5 weaponRoom
[EndRoom] -> fmap (pure . Right) (telRoomLev 1)
[StartRoom] -> startRoom
(SpecificRoom rt:_) -> rt
(BossAno cr : _) -> do
br <- bossRoom cr
+1 -1
View File
@@ -13,12 +13,12 @@ data Annotation g
| Corridor
| AirlockAno
| FirstWeapon
| StartRoom
| EndRoom
| OrAno [[Annotation g]]
| SpecificRoom (State g (Tree (Either Room Room)))
| BossAno Creature
| TreasureAno [Creature] [Item]
| AnoApplyInt Int (Int -> State g (Tree (Either Room Room)))
| SetLabel Int (State g Room)
| UseLabel Int (State g Room)
| ChainAnos [[Annotation g]]
+2 -1
View File
@@ -35,7 +35,8 @@ import qualified Data.IntMap.Strict as IM
initialAnoTree :: RandomGen g => Tree [Annotation g]
initialAnoTree = padSucWithCorridors $ treeFromTrunk
[[StartRoom]
[[AnoApplyInt 0 startRoom]
, [AnoApplyInt 1 lasSensorTurretTest]
-- ,[ChainAnos
-- [[SetLabel 0 $ return $ roomRectAutoLinks 200 200
-- & rmExtPmnt ?~ triggerSwitchSPicLight (drawSwitchWire red red)
+2 -2
View File
@@ -36,7 +36,7 @@ sensorUpdate :: (DamageType -> Either Int Int) -> Machine -> World -> World
sensorUpdate damF mc w = w & machines . ix mcid %~ upmc
& lightSources . ix lsid %~ upls
where
upmc = ( mcSensor %~ \x' -> min 750 (max 0 (x' - 5 + newSense)) )
upmc = ( mcSensor %~ \x' -> min 1000 (max 0 (x' - 5 + newSense)) )
. ( mcHP -~ sum dam )
. (mcDamage .~ [])
x = _mcSensor mc
@@ -44,7 +44,7 @@ sensorUpdate damF mc w = w & machines . ix mcid %~ upmc
lsid = head (_mcLSs mc)
(senseData,dam) = partitionEithers $ map damF $ _mcDamage mc
newSense = sum senseData
ni = fromIntegral x / 500
ni = fromIntegral x / 1000
upls = lsIntensity .~ V3 ni ni ni
sensorSPic :: Machine -> SPic
+6 -6
View File
@@ -18,10 +18,10 @@ import Data.List
import Control.Lens
import qualified Data.IntMap.Strict as IM
putLasTurret :: Placement
putLasTurret = sps0 $ PutMachine blue (reverse $ square wdth) defaultMachine
putLasTurret :: Float -> Placement
putLasTurret rotSpeed = sps0 $ PutMachine blue (reverse $ square wdth) defaultMachine
{ _mcDraw = drawTurret
, _mcUpdate = updateTurret
, _mcUpdate = updateTurret rotSpeed
, _mcType = lasTurret
, _mcHP = 50000
}
@@ -32,8 +32,8 @@ lasTurret = Turret
, _tuFireTime = 0
}
updateTurret :: Machine -> World -> World
updateTurret mc w
updateTurret :: Float -> Machine -> World -> World
updateTurret rotSpeed mc w
| _mcHP mc < 1 = w & machines %~ IM.delete mcid
& deleteWallIDs (_mcWallIDs mc)
& makeExplosionAt mcpos
@@ -60,7 +60,7 @@ updateTurret mc w
dam = sum $ map _dmAmount dams
elecDam = sum $ map _dmAmount elecDams
doTurn
| seesYou = machines . ix mcid . mcDir %~ turnTo 0.005 mcpos ypos
| seesYou = machines . ix mcid . mcDir %~ turnTo rotSpeed mcpos ypos
| otherwise = id
closeFireAngle = seesYou && angleVV (ypos -.- mcpos) (unitVectorAtAngle mcdir) < 1
updateFiringStatus
+1 -1
View File
@@ -97,7 +97,7 @@ lasTunnel = defaultRoom
{ _rmPolys = polys
, _rmBound = polys
, _rmLinks = [(V2 20 190,1.5* pi),(V2 0 20,0.5* pi)]
, _rmPmnts = [putLasTurret & plSpot .~ PS (V2 10 240) (1.5*pi)
, _rmPmnts = [putLasTurret 0.005 & plSpot .~ PS (V2 10 240) (1.5*pi)
, midWall (rectNSEW 65 40 0 25)
, mntLS vShape (V2 50 10) (V3 40 20 50)
]
+4 -4
View File
@@ -49,8 +49,8 @@ critRoom = corridorWallN
{ _rmRandPSs = [psRandRanges (15,25) (30,45) (pi,2*pi)]
}
runPastRoom :: RandomGen g => State g (Tree (Either Room Room))
runPastRoom = do
runPastRoom :: RandomGen g => Int -> State g (Tree (Either Room Room))
runPastRoom i = do
h <- state $ randomR (200,400::Float)
theedgetest <- takeOne [horEdgeTest (<1), horEdgeTest (>39)]
thels <- roomCritLS
@@ -66,10 +66,10 @@ runPastRoom = do
critroom = linkcor & rmPmnts %~ ( plRRpt 0 randC1 :)
aswitchroom = corridorWallN
{_rmExtPmnt = Just $ putLitButOnPosExtTrig red useLnkRoomPos
,_rmLabel = Just 0
,_rmLabel = Just i
,_rmPmnts = []
}
switchdoor = switchDoorRoom & rmTakeFrom ?~ 0
switchdoor = switchDoorRoom & rmTakeFrom ?~ i
n = length $ filter theedgetest $ _rmLinks cenroom
controom = treeFromPost [Left switchdoor,Left linkcor] (Right door)
critrooms :: [Tree (Either Room Room)]
+26 -19
View File
@@ -52,44 +52,51 @@ minigunfakeout = do
centralLasTurret :: Room
centralLasTurret = roomNgon 8 200 & rmPmnts .~
[ putLasTurret
, heightWall 30 (rectNSEW (-90) (-110) 10 (-10))
, spanColLightI 0.5 98 (V2 0 (-5)) (V2 0 5)
[ putLasTurret 0.02
, heightWall 30 (rectNSEW (-90) (-110) 20 (-20))
, mntLightLnkCond unusedLnkToPS
--, spanColLightI 0.5 98 (V2 0 (-5)) (V2 0 5)
, psPt atFstLnkOut $ PutForeground $ colorSH yellow $
thinHighBar 0 (V2 20 (-1)) (V2 20 (-100))
<> thinHighBar 0 (V2 0 (-100)) (V2 20 (-100))
<> barPP 1.5 (V3 20 (-1) 0) (V3 20 (-1) 80)
]
& rmExtPmnt ?~
extTrigLitPos (atFstLnkOutShiftBy (\(p,a) -> (p +.+ rotateV a (V2 18 (-2)), a)))
extTrigLitPos (atFstLnkOutShiftBy (\(p,a) -> (p +.+ rotateV a (V2 18.5 (-2.5)), a)))
( \tp -> Just $ lightSensor (upf $ fromJust $ _plMID tp) (atFstLnkOutShiftInward 100)
)
where
upf trid mc w | _mcSensor mc > 90 = w & triggers . ix trid .~ const True
upf trid mc w | _mcSensor mc > 900 = w & triggers . ix trid .~ const True
| otherwise = w
lasSensorTurretTest :: RandomGen g => Int -> State g (Tree (Either Room Room))
lasSensorTurretTest n = do
cenroom <- randomiseOutLinks $ centralLasTurret {_rmLabel = Just n}
let doorroom = switchDoorRoom {_rmTakeFrom = Just n}
return $ treeFromPost [Left cenroom,Left doorroom] (Right door)
rezThenLasTurret :: RandomGen g => State g (Tree (Either Room Room))
rezThenLasTurret = do
rbox <- rezBoxStart
cenroom <- randomiseOutLinks $ centralLasTurret {_rmLabel = Just 0}
let doorroom = switchDoorRoom {_rmTakeFrom = Just 0}
contTree = treeFromPost [Left cenroom] (Right doorroom)
contTree = treeFromPost [Left cenroom,Left doorroom] (Right door)
return $ rbox `appendEitherTree` [contTree]
startRoom :: RandomGen g => State g (Tree (Either Room Room))
startRoom = join $ takeOne
[ rezThenLasTurret
--,minigunfakeout
--, rezBoxesWp
--, rezBoxesThenWeaponRoom
--, rezBoxThenWeaponRoom
--, rezBoxesWpCrit
--, runPastStart
startRoom :: RandomGen g => Int -> State g (Tree (Either Room Room))
startRoom i = join $ takeOne
[ minigunfakeout
, rezBoxesWp
, rezBoxesThenWeaponRoom
, rezBoxThenWeaponRoom
, rezBoxesWpCrit
, runPastStart i
]
runPastStart :: RandomGen g => State g (Tree (Either Room Room))
runPastStart = do
runPastStart :: RandomGen g => Int -> State g (Tree (Either Room Room))
runPastStart i = do
s <- rezBoxStart
rp <- runPastRoom
rp <- runPastRoom i
return $ s `appendEitherTree` [rp]
rezBoxStart :: RandomGen g => State g (Tree (Either Room Room))
@@ -214,7 +221,7 @@ startRoom' = do
, tankSquare (dim orange) 50 50
, tankSquare (dim orange) 50 120
, lightSensor (const id) (PS (V2 (0.8*w) (0.25*h)) 0)
, putLasTurret & plSpot .~ PS (V2 (0.8*w) (0.8*h)) 0
, putLasTurret 0.005 & plSpot .~ PS (V2 (0.8*w) (0.8*h)) 0
, sps0 $ PutForeground $ colorSH orange $ pipePP 2 (V3 50 50 25) (V3 50 120 25)
]
thecol <- rezColor
+178 -173
View File
@@ -1,137 +1,140 @@
-- generated at 2021-11-18 01:13:04.234031373 UTC
-- generated at 2021-11-21 23:26:56.911504724 UTC
module Dodge.SoundLogic.ExternallyGeneratedSounds where
import Sound.Data
soundToVol :: SoundID -> Float
soundToVol v = case _getSoundID v of
0 -> 5000
1 -> 8000
1 -> 5000
2 -> 8000
3 -> 5000
3 -> 8000
4 -> 5000
5 -> 5000
6 -> 3000
6 -> 5000
7 -> 3000
8 -> 4000
9 -> 5000
10 -> 10000
11 -> 8000
8 -> 3000
9 -> 4000
10 -> 5000
11 -> 10000
12 -> 8000
13 -> 8000
14 -> 8000
15 -> 10000
16 -> 3000
17 -> 4000
18 -> 5000
15 -> 8000
16 -> 10000
17 -> 3000
18 -> 4000
19 -> 5000
20 -> 20000
21 -> 4000
22 -> 10000
23 -> 8000
24 -> 4000
25 -> 2000
26 -> 6000
27 -> 500
28 -> 5000
29 -> 8000
20 -> 5000
21 -> 20000
22 -> 4000
23 -> 10000
24 -> 8000
25 -> 4000
26 -> 2000
27 -> 6000
28 -> 500
29 -> 5000
30 -> 8000
31 -> 8000
32 -> 5000
33 -> 8000
34 -> 4000
35 -> 3000
36 -> 8000
37 -> 2000
38 -> 10000
39 -> 5000
40 -> 2000
41 -> 3000
42 -> 12000
43 -> 5000
44 -> 10000
45 -> 12000
46 -> 2000
47 -> 3000
48 -> 8000
49 -> 5000
50 -> 2000
51 -> 3000
52 -> 10000
32 -> 8000
33 -> 5000
34 -> 8000
35 -> 4000
36 -> 3000
37 -> 8000
38 -> 2000
39 -> 10000
40 -> 5000
41 -> 2000
42 -> 3000
43 -> 12000
44 -> 5000
45 -> 10000
46 -> 12000
47 -> 2000
48 -> 3000
49 -> 8000
50 -> 5000
51 -> 2000
52 -> 3000
53 -> 10000
54 -> 3000
55 -> 15000
56 -> 10000
57 -> 3000
58 -> 15000
59 -> 10000
60 -> 8000
54 -> 10000
55 -> 3000
56 -> 15000
57 -> 10000
58 -> 3000
59 -> 15000
60 -> 10000
61 -> 8000
_ -> 50
soundToOnomato :: SoundID -> String
soundToOnomato v = case _getSoundID v of
0 -> "HNH"
1 -> "CRNKL"
2 -> "ZMM"
3 -> "WE-OH"
4 -> "UGGAUGGA"
5 -> "KRTNKL"
6 -> "DWAAH"
7 -> "BWAH"
8 -> "TIPTOP"
9 -> "TINKLE"
10 -> "TATATA"
11 -> "CRSK"
12 -> "CRNK"
13 -> "TAKH"
14 -> "CRUNK"
15 -> "SCREE"
16 -> "TNKTNKTNK"
17 -> "TIPTAP"
18 -> "WRR"
19 -> "HSS"
20 -> "BOOM"
21 -> "CLNK"
22 -> "BRAP"
23 -> "CRSNK"
24 -> "TAPP"
25 -> "BLIH"
26 -> "TAPTIP"
27 -> "CLICK"
28 -> "FWUMP"
29 -> "RINGGG"
30 -> "BRAP"
31 -> "CRUMPLE"
32 -> "TRINKL"
33 -> "TAK"
34 -> "SMACK"
35 -> "DRR"
36 -> "CRASH"
37 -> "SWSH"
38 -> "CRAKLE"
39 -> "CRTINK"
40 -> "FHP"
41 -> "CHPCHPCHP"
42 -> "BRPBRPBRP"
43 -> "CHNKCHNKCHUNK"
44 -> "WRRR"
45 -> "BRDBRDBRD"
46 -> "PHF"
47 -> "BWAAH"
48 -> "BEP"
49 -> "HSSS"
50 -> "SHUHP"
51 -> "THUD"
52 -> "WHSSH"
53 -> "BRAHCHCH"
54 -> "TIP"
55 -> "BANGG"
56 -> "ZHM"
57 -> "TAP"
58 -> "BANG"
59 -> "CHUGUGUG"
60 -> "CRISH"
0 -> "SCREE"
1 -> "HNH"
2 -> "CRNKL"
3 -> "ZMM"
4 -> "WE-OH"
5 -> "UGGAUGGA"
6 -> "KRTNKL"
7 -> "DWAAH"
8 -> "BWAH"
9 -> "TIPTOP"
10 -> "TINKLE"
11 -> "TATATA"
12 -> "CRSK"
13 -> "CRNK"
14 -> "TAKH"
15 -> "CRUNK"
16 -> "SCREE"
17 -> "TNKTNKTNK"
18 -> "TIPTAP"
19 -> "WRR"
20 -> "HSS"
21 -> "BOOM"
22 -> "CLNK"
23 -> "BRAP"
24 -> "CRSNK"
25 -> "TAPP"
26 -> "BLIH"
27 -> "TAPTIP"
28 -> "CLICK"
29 -> "FWUMP"
30 -> "RINGGG"
31 -> "BRAP"
32 -> "CRUMPLE"
33 -> "TRINKL"
34 -> "TAK"
35 -> "SMACK"
36 -> "DRR"
37 -> "CRASH"
38 -> "SWSH"
39 -> "CRAKLE"
40 -> "CRTINK"
41 -> "FHP"
42 -> "CHPCHPCHP"
43 -> "BRPBRPBRP"
44 -> "CHNKCHNKCHUNK"
45 -> "WRRR"
46 -> "BRDBRDBRD"
47 -> "PHF"
48 -> "BWAAH"
49 -> "BEP"
50 -> "HSSS"
51 -> "SHUHP"
52 -> "THUD"
53 -> "WHSSH"
54 -> "BRAHCHCH"
55 -> "TIP"
56 -> "BANGG"
57 -> "ZHM"
58 -> "TAP"
59 -> "BANG"
60 -> "CHUGUGUG"
61 -> "CRISH"
_ -> error "unitialised sound"
soundPathList :: [String]
soundPathList =
[ "grunt.HNH.5000.wav"
[ "tone440sawtoothquiet.SCREE.5000.wav"
, "grunt.HNH.5000.wav"
, "glassShat2.CRNKL.8000.wav"
, "buzz.ZMM.8000.wav"
, "seagullWhistle.WE-OH.5000.wav"
@@ -193,125 +196,127 @@ soundPathList =
, "seagullChatter.CHUGUGUG.10000.wav"
, "impact4.CRISH.8000.wav"
]
tone440sawtoothquietS :: SoundID
tone440sawtoothquietS = SoundID 0
gruntS :: SoundID
gruntS = SoundID 0
gruntS = SoundID 1
glassShat2S :: SoundID
glassShat2S = SoundID 1
glassShat2S = SoundID 2
buzzS :: SoundID
buzzS = SoundID 2
buzzS = SoundID 3
seagullWhistleS :: SoundID
seagullWhistleS = SoundID 3
seagullWhistleS = SoundID 4
seagullBarkS :: SoundID
seagullBarkS = SoundID 4
seagullBarkS = SoundID 5
smallGlass2S :: SoundID
smallGlass2S = SoundID 5
smallGlass2S = SoundID 6
skwareFadeTwoSecS :: SoundID
skwareFadeTwoSecS = SoundID 6
skwareFadeTwoSecS = SoundID 7
sineRaisePitchOneSecS :: SoundID
sineRaisePitchOneSecS = SoundID 7
sineRaisePitchOneSecS = SoundID 8
twoStepSlowS :: SoundID
twoStepSlowS = SoundID 8
twoStepSlowS = SoundID 9
smallGlass4S :: SoundID
smallGlass4S = SoundID 9
smallGlass4S = SoundID 10
autoBS :: SoundID
autoBS = SoundID 10
autoBS = SoundID 11
glassShat4S :: SoundID
glassShat4S = SoundID 11
glassShat4S = SoundID 12
glassShat3S :: SoundID
glassShat3S = SoundID 12
glassShat3S = SoundID 13
tap2S :: SoundID
tap2S = SoundID 13
tap2S = SoundID 14
impact2S :: SoundID
impact2S = SoundID 14
impact2S = SoundID 15
tone440sawtoothS :: SoundID
tone440sawtoothS = SoundID 15
tone440sawtoothS = SoundID 16
reloadS :: SoundID
reloadS = SoundID 16
reloadS = SoundID 17
twoStepS :: SoundID
twoStepS = SoundID 17
twoStepS = SoundID 18
fireS :: SoundID
fireS = SoundID 18
fireS = SoundID 19
foamSprayFadeOutS :: SoundID
foamSprayFadeOutS = SoundID 19
foamSprayFadeOutS = SoundID 20
explosionS :: SoundID
explosionS = SoundID 20
explosionS = SoundID 21
tapQuietS :: SoundID
tapQuietS = SoundID 21
tapQuietS = SoundID 22
autoGunS :: SoundID
autoGunS = SoundID 22
autoGunS = SoundID 23
glassShat1S :: SoundID
glassShat1S = SoundID 23
glassShat1S = SoundID 24
foot3S :: SoundID
foot3S = SoundID 24
foot3S = SoundID 25
healS :: SoundID
healS = SoundID 25
healS = SoundID 26
twoStep1S :: SoundID
twoStep1S = SoundID 26
twoStep1S = SoundID 27
click1S :: SoundID
click1S = SoundID 27
click1S = SoundID 28
tap4S :: SoundID
tap4S = SoundID 28
tap4S = SoundID 29
tinitusS :: SoundID
tinitusS = SoundID 29
tinitusS = SoundID 30
tap3S :: SoundID
tap3S = SoundID 30
tap3S = SoundID 31
impact3S :: SoundID
impact3S = SoundID 31
impact3S = SoundID 32
smallGlass1S :: SoundID
smallGlass1S = SoundID 32
smallGlass1S = SoundID 33
tap1S :: SoundID
tap1S = SoundID 33
tap1S = SoundID 34
hit1S :: SoundID
hit1S = SoundID 34
hit1S = SoundID 35
slideDoorS :: SoundID
slideDoorS = SoundID 35
slideDoorS = SoundID 36
impact1S :: SoundID
impact1S = SoundID 36
impact1S = SoundID 37
knifeS :: SoundID
knifeS = SoundID 37
knifeS = SoundID 38
elecCrackleS :: SoundID
elecCrackleS = SoundID 38
elecCrackleS = SoundID 39
smallGlass3S :: SoundID
smallGlass3S = SoundID 39
smallGlass3S = SoundID 40
whiteNoiseFadeInS :: SoundID
whiteNoiseFadeInS = SoundID 40
whiteNoiseFadeInS = SoundID 41
reload1S :: SoundID
reload1S = SoundID 41
reload1S = SoundID 42
miniS :: SoundID
miniS = SoundID 42
miniS = SoundID 43
crankSlowS :: SoundID
crankSlowS = SoundID 43
crankSlowS = SoundID 44
fireLoudS :: SoundID
fireLoudS = SoundID 44
fireLoudS = SoundID 45
mini1S :: SoundID
mini1S = SoundID 45
mini1S = SoundID 46
whiteNoiseFadeOutS :: SoundID
whiteNoiseFadeOutS = SoundID 46
whiteNoiseFadeOutS = SoundID 47
sineRaisePitchTwoSecS :: SoundID
sineRaisePitchTwoSecS = SoundID 47
sineRaisePitchTwoSecS = SoundID 48
tone440S :: SoundID
tone440S = SoundID 48
tone440S = SoundID 49
foamSprayLoopS :: SoundID
foamSprayLoopS = SoundID 49
foamSprayLoopS = SoundID 50
pickUpS :: SoundID
pickUpS = SoundID 50
pickUpS = SoundID 51
hitS :: SoundID
hitS = SoundID 51
hitS = SoundID 52
missileLaunchS :: SoundID
missileLaunchS = SoundID 52
missileLaunchS = SoundID 53
shotgunS :: SoundID
shotgunS = SoundID 53
shotgunS = SoundID 54
foot1S :: SoundID
foot1S = SoundID 54
foot1S = SoundID 55
bangEchoS :: SoundID
bangEchoS = SoundID 55
bangEchoS = SoundID 56
teleS :: SoundID
teleS = SoundID 56
teleS = SoundID 57
foot2S :: SoundID
foot2S = SoundID 57
foot2S = SoundID 58
bangS :: SoundID
bangS = SoundID 58
bangS = SoundID 59
seagullChatterS :: SoundID
seagullChatterS = SoundID 59
seagullChatterS = SoundID 60
impact4S :: SoundID
impact4S = SoundID 60
impact4S = SoundID 61