Continue tweaking sound

This commit is contained in:
2021-09-12 20:33:33 +01:00
parent 51a85bd1ec
commit 72657294d1
89 changed files with 373 additions and 517 deletions
Binary file not shown.
-26
View File
@@ -1,26 +0,0 @@
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN" "http://audacity.sourceforge.net/xml/audacityproject-1.3.0.dtd" >
<project xmlns="http://audacity.sourceforge.net/xml/" projname="reload_data" version="1.3.0" audacityversion="2.2.1" sel0="1.0000000000" sel1="1.0000000000" vpos="80" h="0.0000000000" zoom="619.9769053118" rate="44100.0" snapto="on" selectionformat="hh:mm:ss + milliseconds" frequencyformat="Hz" bandwidthformat="octaves">
<tags/>
<wavetrack name="Audio Track" channel="2" linked="0" mute="0" solo="0" height="150" minimized="0" isSelected="0" rate="44100" gain="1.0" pan="0.0" colorindex="0"/>
<wavetrack name="Audio Track" channel="0" linked="1" mute="0" solo="0" height="150" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="44100">
<waveblock start="0">
<simpleblockfile filename="e0002ad8.au" len="44100" min="-0.626438" max="0.756957" rms="0.050527"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="Audio Track" channel="1" linked="0" mute="0" solo="0" height="150" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="44100">
<waveblock start="0">
<simpleblockfile filename="e0002124.au" len="44100" min="-0.626438" max="0.756957" rms="0.050527"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
</project>
-25
View File
@@ -1,25 +0,0 @@
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN" "http://audacity.sourceforge.net/xml/audacityproject-1.3.0.dtd" >
<project xmlns="http://audacity.sourceforge.net/xml/" projname="tap_data" version="1.3.0" audacityversion="2.2.1" sel0="0.0000000000" sel1="0.2786394558" vpos="0" h="0.0000000000" zoom="86.1328125000" rate="44100.0" snapto="off" selectionformat="hh:mm:ss + milliseconds" frequencyformat="Hz" bandwidthformat="octaves">
<tags/>
<wavetrack name="Audio Track" channel="0" linked="1" mute="0" solo="0" height="161" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="12288">
<waveblock start="0">
<simpleblockfile filename="e000077f.au" len="12288" min="-10.632122" max="11.905688" rms="0.574985"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="Audio Track" channel="1" linked="0" mute="0" solo="0" height="139" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="12288">
<waveblock start="0">
<simpleblockfile filename="e0000254.au" len="12288" min="-11.171772" max="11.837081" rms="0.58168"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
</project>
-73
View File
@@ -1,73 +0,0 @@
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN" "http://audacity.sourceforge.net/xml/audacityproject-1.3.0.dtd" >
<project xmlns="http://audacity.sourceforge.net/xml/" projname="twoStep_data" version="1.3.0" audacityversion="2.2.1" sel0="0.0000000000" sel1="0.7800000000" vpos="0" h="0.2878780178" zoom="1639.5833333333" rate="44100.0" snapto="on" selectionformat="hh:mm:ss + milliseconds" frequencyformat="Hz" bandwidthformat="octaves">
<tags/>
<wavetrack name="twoStep" channel="2" linked="0" mute="0" solo="0" height="150" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.15000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="13892">
<waveblock start="0">
<simpleblockfile filename="e00004be.au" len="13892" min="-0.124176" max="0.095367" rms="0.007066"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="0.61501134" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="7276">
<waveblock start="0">
<simpleblockfile filename="e00007db.au" len="7276" min="-0.186249" max="0.163513" rms="0.017523"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="Audio Track" channel="2" linked="0" mute="0" solo="0" height="150" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.56501134" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="2205">
<waveblock start="0">
<silentblockfile len="2205"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="2205">
<waveblock start="0">
<silentblockfile len="2205"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="0.05000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="2205">
<waveblock start="0">
<silentblockfile len="2205"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="0.51501134" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="2205">
<waveblock start="0">
<silentblockfile len="2205"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="0.10000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="2205">
<waveblock start="0">
<silentblockfile len="2205"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="0.46501134" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="2205">
<waveblock start="0">
<silentblockfile len="2205"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
</project>
+2 -2
View File
@@ -198,7 +198,7 @@ youDropItem w = case yourItem w of
NoItem -> w NoItem -> w
_ -> rmSelectedInvItem (_yourID w) _ -> rmSelectedInvItem (_yourID w)
. copyItemToFloor (you w) (_crInvSel cr) . copyItemToFloor (you w) (_crInvSel cr)
$ soundFrom (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing $ soundStart (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
w w
where where
cr = you w cr = you w
@@ -233,7 +233,7 @@ pickUpItem
pickUpItem cid flit w = case maybeInvSlot of pickUpItem cid flit w = case maybeInvSlot of
Nothing -> w Nothing -> w
Just i -> w Just i -> w
& soundFrom (CrSound cid) (_flItPos flit) pickUpS Nothing & soundStart (CrSound cid) (_flItPos flit) pickUpS Nothing
& updateItLocation i & updateItLocation i
& floorItems %~ IM.delete (_flItID flit) & floorItems %~ IM.delete (_flItID flit)
& creatures . ix cid . crInv . ix i %~ addItem it & creatures . ix cid . crInv . ix i %~ addItem it
+2 -2
View File
@@ -58,7 +58,7 @@ followImpulse cr w imp = case imp of
(hitCr cid' (hitCr cid'
, crMvBy (10 *.* normalizeV (posFromID cid' -.- cpos)) $ cr & crMeleeCooldown .~ 20) -- randomise cooldown? , crMvBy (10 *.* normalizeV (posFromID cid' -.- cpos)) $ cr & crMeleeCooldown .~ 20) -- randomise cooldown?
RandomTurn a -> (id, creatureTurn (rr a) cr) RandomTurn a -> (id, creatureTurn (rr a) cr)
MakeSound sid -> ( soundOnceOrigin sid (CrSound (_crID cr)) (_crPos cr) , cr ) MakeSound sid -> ( soundStart (CrSound (_crID cr)) (_crPos cr) sid Nothing , cr )
DropItem -> undefined DropItem -> undefined
ChangeStrategy strat -> (id, cr & crActionPlan . crStrategy .~ strat) ChangeStrategy strat -> (id, cr & crActionPlan . crStrategy .~ strat)
AddGoal gl -> (id, cr & crActionPlan . crGoal %~ (gl :) ) AddGoal gl -> (id, cr & crActionPlan . crGoal %~ (gl :) )
@@ -84,5 +84,5 @@ followImpulse cr w imp = case imp of
posFromID cid' = _crPos $ _creatures w IM.! cid' posFromID cid' = _crPos $ _creatures w IM.! cid'
rr a = fst $ randomR (-a,a) $ _randGen w rr a = fst $ randomR (-a,a) $ _randGen w
hitCr i = over (creatures . ix i . crState . crDamage) (addDam i) hitCr i = over (creatures . ix i . crState . crDamage) (addDam i)
. soundFrom (CrSound cid) cpos hitS Nothing . soundStart (CrSound cid) cpos hitS Nothing
addDam i dams = Blunt 100 cpos (posFromID i) (posFromID i) : dams addDam i dams = Blunt 100 cpos (posFromID i) (posFromID i) : dams
+3 -3
View File
@@ -91,9 +91,9 @@ awakeLevelPerception cr = case _crAwakeLevel $ _crPerception cr of
newSounds :: World -> [(Point2,Float)] newSounds :: World -> [(Point2,Float)]
newSounds = mapMaybe f . M.elems . _playingSounds newSounds = mapMaybe f . M.elems . _playingSounds
where where
f s | _soundStatus s == JustStartedPlaying f s = case _soundStatus s of
= Just (_soundPos s, _soundVolume s) JustStartedPlaying -> Just (_soundPos s, _soundVolume s)
| otherwise = Nothing _ -> Nothing
rememberSounds :: Creature -> Reader World Creature rememberSounds :: Creature -> Reader World Creature
rememberSounds cr = do rememberSounds cr = do
+3 -3
View File
@@ -52,7 +52,7 @@ stateUpdate u cr w = case u (updateMovement cr) w of
| otherwise = Nothing | otherwise = Nothing
deathEff deathEff
| cr ^.crHP > 0 = id | cr ^.crHP > 0 = id
| otherwise = stopSoundFrom (CrWeaponSound (_crID cr)) | otherwise = stopSoundFrom (CrWeaponSound (_crID cr) 0)
. over decorations addCorpse . over decorations addCorpse
. dropByState cr . dropByState cr
addCorpse = IM.insertNewKey addCorpse = IM.insertNewKey
@@ -137,11 +137,11 @@ invSideEff cr w = weaponReloadSounds cr $ IM.foldrWithKey f w (_crInv cr)
weaponReloadSounds :: Creature -> World -> World weaponReloadSounds :: Creature -> World -> World
weaponReloadSounds cr w = case _crInv cr IM.!? _crInvSel cr of weaponReloadSounds cr w = case _crInv cr IM.!? _crInvSel cr of
Just Weapon{_wpReloadType = PassiveReload stype,_wpReloadTime=rt,_wpReloadState=rs} Just Weapon{_wpReloadType = PassiveReload stype,_wpReloadTime=rt,_wpReloadState=rs}
| rt == rs -> soundFrom (CrReloadSound 0) (_crPos cr) stype Nothing w | rt == rs -> soundContinue (CrReloadSound 0) (_crPos cr) stype Nothing w
| otherwise -> w | otherwise -> w
Just Weapon{_wpReloadState = 0} -> w Just Weapon{_wpReloadState = 0} -> w
Just Weapon{_wpReloadState = 1} -> stopSoundFrom (CrReloadSound cid) w Just Weapon{_wpReloadState = 1} -> stopSoundFrom (CrReloadSound cid) w
Just Weapon{} -> soundFrom (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w Just Weapon{} -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
_ -> w _ -> w
where where
cid = _crID cr cid = _crID cr
+1 -1
View File
@@ -4,7 +4,7 @@ data SoundOrigin = InventorySound
| BackgroundSound | BackgroundSound
| OnceSound | OnceSound
| CrSound Int | CrSound Int
| CrWeaponSound Int | CrWeaponSound Int Int
| WallSound Int | WallSound Int
| CrReloadSound Int | CrReloadSound Int
| Flamer | Flamer
+1 -1
View File
@@ -215,7 +215,7 @@ defaultButton = Button
, _btEvent = \b w -> , _btEvent = \b w ->
set (buttons . ix (_btID b) . btPict) (onLayer WlLayer $ color red $ polygon $ rectNSEW (-4) (-5) 10 (-10)) set (buttons . ix (_btID b) . btPict) (onLayer WlLayer $ color red $ polygon $ rectNSEW (-4) (-5) 10 (-10))
. set (buttons . ix (_btID b) . btState) BtNoLabel . set (buttons . ix (_btID b) . btState) BtNoLabel
. soundFrom (LeverSound 0) (_btPos b) click1S Nothing $ w . soundStart (LeverSound 0) (_btPos b) click1S Nothing $ w
, _btID = 0 , _btID = 0
, _btText = "Button" , _btText = "Button"
, _btState = BtOff , _btState = BtOff
+1 -1
View File
@@ -47,7 +47,7 @@ initialWorld = defaultWorld
, _mousePos = V2 0 0 , _mousePos = V2 0 0
, _testString = testStringInit , _testString = testStringInit
, _yourID = 0 , _yourID = 0
, _worldEvents = soundFrom BackgroundSound (V2 0 0) foamSprayFadeOutS Nothing , _worldEvents = soundStart BackgroundSound (V2 0 0) foamSprayFadeOutS Nothing
. foldr ((.) . makeStartCloudAt) id [V3 x y 5 | x <- [-5,-3..5] , y <- [-5,-3..5]] . foldr ((.) . makeStartCloudAt) id [V3 x y 5 | x <- [-5,-3..5] , y <- [-5,-3..5]]
, _pressPlates = IM.empty , _pressPlates = IM.empty
, _buttons = IM.empty , _buttons = IM.empty
+1 -1
View File
@@ -32,7 +32,7 @@ heal25 :: Int -> World -> Maybe World
heal25 = heal 25 heal25 = heal 25
heal :: Int -> Int -> World -> Maybe World heal :: Int -> Int -> World -> Maybe World
heal hp n w | _crHP (_creatures w IM.! n) >= 10000 = Nothing heal hp n w | _crHP (_creatures w IM.! n) >= 10000 = Nothing
| otherwise = Just $ soundFrom (CrSound $ _crID cr) (_crPos cr) healS Nothing w | otherwise = Just $ soundStart (CrSound $ _crID cr) (_crPos cr) healS Nothing w
& creatures . ix n . crHP %~ min 10000 . (+ hp) & creatures . ix n . crHP %~ min 10000 . (+ hp)
where where
cr = _creatures w IM.! n cr = _creatures w IM.! n
+10 -10
View File
@@ -66,7 +66,7 @@ pistol = defaultGun
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
, useTimeCheckI , useTimeCheckI
, withSoundI tap3S , withSoundStart tap3S
, useAmmo 1 , useAmmo 1
, randSpreadDir , randSpreadDir
, withMuzFlareI , withMuzFlareI
@@ -296,7 +296,7 @@ hvAutoGun = defaultAutoGun
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, rateIncABI 24 7 (torqueBeforeAtLeast 0.1 0.1) (torqueAfterI 0.2) , rateIncABI 24 7 (torqueBeforeAtLeast 0.1 0.1) (torqueAfterI 0.2)
, withSoundI bangEchoS , withSoundStart bangEchoS
, withThinSmokeI , withThinSmokeI
, withMuzFlareI , withMuzFlareI
] ]
@@ -323,7 +323,7 @@ ltAutoGun = defaultAutoGun
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, useTimeCheckI , useTimeCheckI
, withSoundI tap1S , withSoundStart tap1S
, useAmmo 1 , useAmmo 1
, withRandomDirI 0.1 , withRandomDirI 0.1
, torqueAfterI 0.2 , torqueAfterI 0.2
@@ -429,7 +429,7 @@ spreadGun = defaultGun
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
, useTimeCheckI , useTimeCheckI
, withSoundI shotgunS , withSoundStart shotgunS
, useAmmo 1 , useAmmo 1
, withRecoilI 100 , withRecoilI 100
, withMuzFlareI , withMuzFlareI
@@ -461,7 +461,7 @@ multGun = defaultGun
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
, useTimeCheckI , useTimeCheckI
, withSoundI shotgunS , withSoundStart shotgunS
, useAmmo 1 , useAmmo 1
, withRecoilI 200 , withRecoilI 200
, withMuzFlareI , withMuzFlareI
@@ -507,7 +507,7 @@ longGun = defaultGun
[ ammoCheckI [ ammoCheckI
, hammerCheckI , hammerCheckI
, useTimeCheckI , useTimeCheckI
, withSoundI bangEchoS , withSoundStart bangEchoS
, useAmmo 1 , useAmmo 1
, withThickSmokeI , withThickSmokeI
, torqueAfterI 0.05 , torqueAfterI 0.05
@@ -752,10 +752,10 @@ moveRemoteBomb itid time pID w
$ set (projectiles .ix pID.pjUpdate) (\_ -> moveRemoteBomb itid (f time) pID) $ set (projectiles .ix pID.pjUpdate) (\_ -> moveRemoteBomb itid (f time) pID)
w w
| time < 2 = case hitWl of | time < 2 = case hitWl of
Just (p,_) -> soundFrom (Tap 0) p tapQuietS Nothing $ halfV updatedWorld Just (p,_) -> soundStart (Tap 0) p tapQuietS Nothing $ halfV updatedWorld
_ -> halfV updatedWorld _ -> halfV updatedWorld
| otherwise = case hitWl of | otherwise = case hitWl of
Just (p,_) -> soundFrom (Tap 0) p tapQuietS Nothing updatedWorld Just (p,_) -> soundStart (Tap 0) p tapQuietS Nothing updatedWorld
_ -> updatedWorld _ -> updatedWorld
where where
updatedWorld updatedWorld
@@ -875,7 +875,7 @@ fireRemoteLauncher :: Creature -> World -> World
fireRemoteLauncher cr w = setLocation fireRemoteLauncher cr w = setLocation
$ resetFire $ resetFire
$ resetName $ resetName
$ soundFrom (CrWeaponSound cid) pos tap4S Nothing $ soundStart (CrWeaponSound cid 0) pos tap4S Nothing
$ over projectiles addRemRocket w $ over projectiles addRemRocket w
where where
i = IM.newKey $ _projectiles w i = IM.newKey $ _projectiles w
@@ -923,7 +923,7 @@ moveRemoteShell cid itid pj w
( ( pjVel %~ ( (accel +.+) . (frict *.*) ) ) ( ( pjVel %~ ( (accel +.+) . (frict *.*) ) )
. ( pjDir .~ newdir ) . ( pjDir .~ newdir )
) )
& soundFrom (ShellSound i) newPos missileLaunchS (Just 1) & soundContinue (ShellSound i) newPos missileLaunchS (Just 1)
& smokeGen & smokeGen
& makeFlameletTimed oldPos 20 (0.5 *.* rotateV (pi+sparkD) accel) Nothing 3 10 & makeFlameletTimed oldPos 20 (0.5 *.* rotateV (pi+sparkD) accel) Nothing 3 10
| time > -200 = case thingHit of | time > -200 = case thingHit of
+1 -1
View File
@@ -29,7 +29,7 @@ bezierGun = defaultGun
, _itUse = \_ -> useTargetPos $ \p -> shootBezier $ fromJust p -- <- the start point , _itUse = \_ -> useTargetPos $ \p -> shootBezier $ fromJust p -- <- the start point
, _itUseModifiers = , _itUseModifiers =
[ useTimeCheckI [ useTimeCheckI
, withSoundI tap2S , withSoundStart tap2S
, useAmmo 1 , useAmmo 1
, withMuzFlareI , withMuzFlareI
. withRecoilI 40 . withRecoilI 40
+1 -1
View File
@@ -32,7 +32,7 @@ moveGrenade 0 _ pID w = over projectiles (IM.delete pID)
pj = _projectiles w IM.! pID pj = _projectiles w IM.! pID
explosion = _pjPayload pj explosion = _pjPayload pj
moveGrenade time dir pID w = case hitWl of moveGrenade time dir pID w = case hitWl of
Just (p,_) -> soundFrom (Tap 0) p tapQuietS Nothing updatedWorld Just (p,_) -> soundStart (Tap 0) p tapQuietS Nothing updatedWorld
_ -> updatedWorld _ -> updatedWorld
where where
updatedWorld = updateV $ set (projectiles . ix pID . pjPos) finalPos updatedWorld = updateV $ set (projectiles . ix pID . pjPos) finalPos
+2 -2
View File
@@ -43,7 +43,7 @@ launcher = defaultGun
, _itUseModifiers = , _itUseModifiers =
[ ammoCheckI [ ammoCheckI
, useTimeCheckI , useTimeCheckI
, withSoundI tap4S , withSoundStart tap4S
, useAmmo 1 , useAmmo 1
] ]
, _wpSpread = 0.02 , _wpSpread = 0.02
@@ -107,7 +107,7 @@ doThrust :: Projectile -> World -> World
doThrust pj w = w doThrust pj w = w
& randGen .~ g & randGen .~ g
& projectiles . ix i . pjVel %~ (\v -> accel +.+ frict *.* v) & projectiles . ix i . pjVel %~ (\v -> accel +.+ frict *.* v)
& soundFrom (ShellSound i) newPos missileLaunchS (Just 1) & soundContinue (ShellSound i) newPos missileLaunchS (Just 1)
& makeFlameletTimed (oldPos -.- vel) 0 (vel +.+ rotateV (pi+sparkD) accel) Nothing 3 10 & makeFlameletTimed (oldPos -.- vel) 0 (vel +.+ rotateV (pi+sparkD) accel) Nothing 3 10
& smokeGen & smokeGen
where where
+18 -6
View File
@@ -12,7 +12,8 @@ module Dodge.Item.Weapon.TriggerType
, torqueBefore , torqueBefore
, torqueBeforeAtLeast , torqueBeforeAtLeast
, torqueAfterI , torqueAfterI
, withSoundI , withSoundStart
, withSoundContinue
, withSoundForI , withSoundForI
, withThickSmokeI , withThickSmokeI
, withThinSmokeI , withThinSmokeI
@@ -128,7 +129,7 @@ withWarmUpI soundID f item cr w
| _wpReloadState item /= 0 = w | _wpReloadState item /= 0 = w
| curWarmUp < maxWarmUp = w | curWarmUp < maxWarmUp = w
& pointerToItem . wpCurWarmUp +~ 2 & pointerToItem . wpCurWarmUp +~ 2
& soundFrom (CrWeaponSound cid) (_crPos cr) soundID (Just 2) & soundContinue (CrWeaponSound cid 0) (_crPos cr) soundID (Just 2)
| otherwise = w | otherwise = w
& pointerToItem . wpCurWarmUp .~ maxWarmUp & pointerToItem . wpCurWarmUp .~ maxWarmUp
& f item cr & f item cr
@@ -140,11 +141,22 @@ withWarmUpI soundID f item cr w
maxWarmUp = _wpMaxWarmUp item maxWarmUp = _wpMaxWarmUp item
{- | Adds a sound to a creature based world effect. {- | Adds a sound to a creature based world effect.
The sound is emitted from the creature's position. -} The sound is emitted from the creature's position. -}
withSoundI withSoundStart
:: SoundID -- ^ Sound id :: SoundID -- ^ Sound id
-> ChainEffect -> ChainEffect
withSoundI soundid f item cr withSoundStart soundid f item cr
= soundFrom (CrWeaponSound cid) (_crPos cr) soundid Nothing = soundMultiFrom [CrWeaponSound cid 0,CrWeaponSound cid 1,CrWeaponSound cid 2] (_crPos cr) soundid Nothing
-- = soundStart (CrWeaponSound cid 0) (_crPos cr) soundid Nothing
. f item cr
where
cid = _crID cr
{- | Adds a sound to a creature based world effect.
The sound is emitted from the creature's position. -}
withSoundContinue
:: SoundID -- ^ Sound id
-> ChainEffect
withSoundContinue soundid f item cr
= soundContinue (CrWeaponSound cid 0) (_crPos cr) soundid Nothing
. f item cr . f item cr
where where
cid = _crID cr cid = _crID cr
@@ -156,7 +168,7 @@ withSoundForI
-> Int -- ^ Frames to play -> Int -- ^ Frames to play
-> ChainEffect -> ChainEffect
withSoundForI soundid playTime f item cr withSoundForI soundid playTime f item cr
= soundFrom (CrWeaponSound (_crID cr)) (_crPos cr) soundid (Just playTime) = soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) soundid (Just playTime)
. f item cr . f item cr
afterRecoil afterRecoil
+1 -1
View File
@@ -70,7 +70,7 @@ addSoundToDoor i pld hwd (x:ys) = f x : ys
where where
g dm w g dm w
| dist wp pld > 2 && dist wp hwd > 2 | dist wp pld > 2 && dist wp hwd > 2
= soundFrom (WallSound i) wp slideDoorS (Just 1) $ dm w = soundContinue (WallSound i) wp slideDoorS (Just 1) $ dm w
| otherwise = dm w | otherwise = dm w
where where
wp = fst $ _wlLine (_walls w IM.! i) wp = fst $ _wlLine (_walls w IM.! i)
+38 -30
View File
@@ -6,8 +6,8 @@ This module allows us to talk to the "Sound" module.
-} -}
module Dodge.SoundLogic ( module Dodge.SoundLogic (
-- * Manipulation of individual sounds -- * Manipulation of individual sounds
soundOnceOrigin soundStart
, soundFrom , soundContinue
, soundFromGeneral , soundFromGeneral
, soundMultiFrom , soundMultiFrom
, stopSoundFrom , stopSoundFrom
@@ -22,7 +22,6 @@ import Dodge.Data.SoundOrigin
import Sound.Data import Sound.Data
import Geometry.Data import Geometry.Data
import Geometry.Vector import Geometry.Vector
import Dodge.SoundLogic.Synonyms
import Dodge.SoundLogic.LoadSound import Dodge.SoundLogic.LoadSound
import Control.Lens import Control.Lens
@@ -41,41 +40,20 @@ pauseSound w = w
resumeSound :: World -> World resumeSound :: World -> World
resumeSound w = w resumeSound w = w
{-| Play a sound once, with a given origin. soundWithStatus
For each origin only one sound will play at a time. :: SoundStatus
-} -> SoundOrigin -- ^ \"Creator\" of sound
soundOnceOrigin
:: SoundID -- ^ ID of the sound to be played
-> SoundOrigin -- ^ The \"creator\" of the sound
-> Point2 -- ^ The position of the sound in the world
-> World
-> World
soundOnceOrigin sType so p w = w & sounds %~ M.insertWith (\ _ x -> x) so theSound
where
theSound = Sound
{ _soundChunkID = sType
, _soundTime = Nothing
, _soundStatus = ToStart
, _soundChannel = Nothing
, _soundAngDist = Just (a,0)
, _soundPos = p
, _soundVolume = soundToVol sType
}
a = soundAngle p w
soundFrom
:: SoundOrigin -- ^ \"Creator\" of sound
-> Point2 -- ^ Position of sound -> Point2 -- ^ Position of sound
-> SoundID -- ^ ID of sound to be played -> SoundID -- ^ ID of sound to be played
-> Maybe Int -- ^ Frames to play sound for, Nothing for until finished -> Maybe Int -- ^ Frames to play sound for, Nothing for until finished
-> World -> World
-> World -> World
soundFrom so pos sType mtime w = over sounds (M.insertWith f so sound) w soundWithStatus status so pos sType mtime w = over sounds (M.insertWith f so sound) w
where where
sound = Sound sound = Sound
{ _soundChunkID = sType { _soundChunkID = sType
, _soundTime = mtime , _soundTime = mtime
, _soundStatus = ToStart , _soundStatus = status
, _soundChannel = Nothing , _soundChannel = Nothing
, _soundAngDist = Just (a,0) , _soundAngDist = Just (a,0)
, _soundPos = pos , _soundPos = pos
@@ -84,6 +62,23 @@ soundFrom so pos sType mtime w = over sounds (M.insertWith f so sound) w
f _ s = s {_soundTime = mtime } f _ s = s {_soundTime = mtime }
a = soundAngle pos w a = soundAngle pos w
soundStart
:: SoundOrigin -- ^ \"Creator\" of sound
-> Point2 -- ^ Position of sound
-> SoundID -- ^ ID of sound to be played
-> Maybe Int -- ^ Frames to play sound for, Nothing for until finished
-> World
-> World
soundStart = soundWithStatus ToStart
soundContinue
:: SoundOrigin -- ^ \"Creator\" of sound
-> Point2 -- ^ Position of sound
-> SoundID -- ^ ID of sound to be played
-> Maybe Int -- ^ Frames to play sound for, Nothing for until finished
-> World
-> World
soundContinue = soundWithStatus ToContinueStart
soundFromGeneral soundFromGeneral
:: SoundOrigin -- ^ \"Creator\" of sound :: SoundOrigin -- ^ \"Creator\" of sound
-> (World -> Point2) -- ^ Position of sound -> (World -> Point2) -- ^ Position of sound
@@ -130,8 +125,21 @@ soundMultiFrom
-> World -> World
-> World -> World
soundMultiFrom [] _ _ _ w = w soundMultiFrom [] _ _ _ w = w
soundMultiFrom [so] pos sType mtime w
= over sounds (M.insert so sound) w
where
sound = Sound
{ _soundChunkID = sType
, _soundTime = mtime
, _soundStatus = ToStart
, _soundChannel = Nothing
, _soundAngDist = Just (a,0)
, _soundPos = pos
, _soundVolume = soundToVol sType
}
a = soundAngle pos w
soundMultiFrom (so:sos) pos sType mtime w soundMultiFrom (so:sos) pos sType mtime w
| so `M.member` _sounds w = soundMultiFrom sos pos sType mtime w | so `M.member` _playingSounds w = soundMultiFrom sos pos sType mtime w
| otherwise = over sounds (M.insert so sound) w | otherwise = over sounds (M.insert so sound) w
where where
sound = Sound sound = Sound
+281 -281
View File
@@ -16,303 +16,303 @@ loadSounds = do
soundToVol :: SoundID -> Float soundToVol :: SoundID -> Float
soundToVol v = case _getSoundID v of soundToVol v = case _getSoundID v of
0 -> 20 0 -> 5000
1 -> 80 1 -> 8000
2 -> 40 2 -> 8000
3 -> 30 3 -> 5000
4 -> 30 4 -> 3000
5 -> 100 5 -> 3000
6 -> 50 6 -> 4000
7 -> 20 7 -> 5000
8 -> 200 8 -> 10000
9 -> 100 9 -> 8000
10 -> 50 10 -> 8000
11 -> 80 11 -> 8000
12 -> 30 12 -> 8000
13 -> 80 13 -> 10000
14 -> 120 14 -> 3000
15 -> 50 15 -> 4000
16 -> 30 16 -> 5000
17 -> 100 17 -> 5000
18 -> 80 18 -> 20000
19 -> 50 19 -> 4000
20 -> 100 20 -> 10000
21 -> 120 21 -> 8000
22 -> 20 22 -> 4000
23 -> 20 23 -> 2000
24 -> 80 24 -> 6000
25 -> 30 25 -> 500
26 -> 80 26 -> 5000
27 -> 80 27 -> 8000
28 -> 80 28 -> 8000
29 -> 50 29 -> 8000
30 -> 30 30 -> 5000
31 -> 40 31 -> 8000
32 -> 50 32 -> 4000
33 -> 50 33 -> 3000
34 -> 80 34 -> 8000
35 -> 80 35 -> 2000
36 -> 60 36 -> 10000
37 -> 40 37 -> 5000
38 -> 150 38 -> 2000
39 -> 40 39 -> 3000
40 -> 50 40 -> 12000
41 -> 40 41 -> 5000
42 -> 30 42 -> 10000
43 -> 80 43 -> 12000
44 -> 80 44 -> 2000
45 -> 20 45 -> 3000
46 -> 80 46 -> 8000
47 -> 50 47 -> 5000
48 -> 50 48 -> 2000
49 -> 30 49 -> 3000
50 -> 100 50 -> 10000
51 -> 50 51 -> 10000
52 -> 150 52 -> 3000
53 -> 100 53 -> 15000
54 -> 80 54 -> 10000
55 -> 30 55 -> 3000
56 -> 100 56 -> 15000
57 -> 100 57 -> 8000
_ -> 50 _ -> 50
soundToOnomato :: SoundID -> String soundToOnomato :: SoundID -> String
soundToOnomato v = case _getSoundID v of soundToOnomato v = case _getSoundID v of
0 -> "BLIH" 0 -> "HNH"
1 -> "CRNK" 1 -> "CRNKL"
2 -> "BRAP" 2 -> "ZMM"
3 -> "TIP" 3 -> "KRTNKL"
4 -> "THUD" 4 -> "DWAAH"
5 -> "BRAP" 5 -> "BWAH"
6 -> "CRTINK" 6 -> "TIPTOP"
7 -> "SHUHP" 7 -> "TINKLE"
8 -> "BOOM" 8 -> "TATATA"
9 -> "WHSSH" 9 -> "CRSK"
10 -> "KRTNKL" 10 -> "CRNK"
11 -> "CRUMPLE" 11 -> "TAKH"
12 -> "TAP" 12 -> "CRUNK"
13 -> "CRUNK" 13 -> "SCREE"
14 -> "BRDBRDBRD" 14 -> "TNKTNKTNK"
15 -> "WRR" 15 -> "TIPTAP"
16 -> "DRR" 16 -> "WRR"
17 -> "TATATA" 17 -> "HSS"
18 -> "TAK" 18 -> "BOOM"
19 -> "TRINKL" 19 -> "CLNK"
20 -> "SCREE" 20 -> "BRAP"
21 -> "BRPBRPBRP" 21 -> "CRSNK"
22 -> "PHF" 22 -> "TAPP"
23 -> "FHP" 23 -> "BLIH"
24 -> "CRSNK" 24 -> "TAPTIP"
25 -> "BWAAH" 25 -> "CLICK"
26 -> "RINGGG" 26 -> "FWUMP"
27 -> "ZMM" 27 -> "RINGGG"
28 -> "BRAP" 28 -> "BRAP"
29 -> "HNH" 29 -> "CRUMPLE"
30 -> "CHPCHPCHP" 30 -> "TRINKL"
31 -> "SMACK" 31 -> "TAK"
32 -> "HSSS" 32 -> "SMACK"
33 -> "HSS" 33 -> "DRR"
34 -> "CRSK" 34 -> "CRASH"
35 -> "CRASH" 35 -> "SWSH"
36 -> "TAPTIP" 36 -> "CRAKLE"
37 -> "TIPTOP" 37 -> "CRTINK"
38 -> "BANG" 38 -> "FHP"
39 -> "TIPTAP" 39 -> "CHPCHPCHP"
40 -> "THUD" 40 -> "BRPBRPBRP"
41 -> "TAPP" 41 -> "CHNKCHNKCHUNK"
42 -> "DWAAH" 42 -> "WRRR"
43 -> "TAKH" 43 -> "BRDBRDBRD"
44 -> "BEP" 44 -> "PHF"
45 -> "SWSH" 45 -> "BWAAH"
46 -> "CRNKL" 46 -> "BEP"
47 -> "CHNKCHNKCHUNK" 47 -> "HSSS"
48 -> "TINKLE" 48 -> "SHUHP"
49 -> "TNKTNKTNK" 49 -> "THUD"
50 -> "BRAHCHCH" 50 -> "WHSSH"
51 -> "CLICK" 51 -> "BRAHCHCH"
52 -> "BANGG" 52 -> "TIP"
53 -> "WRRR" 53 -> "BANGG"
54 -> "CRISH" 54 -> "ZHM"
55 -> "BWAH" 55 -> "TAP"
56 -> "CRAKLE" 56 -> "BANG"
57 -> "ZHM" 57 -> "CRISH"
_ -> error "unitialised sound" _ -> error "unitialised sound"
soundPathList :: [String] soundPathList :: [String]
soundPathList = soundPathList =
[ "heal.BLIH.20.wav" [ "grunt.HNH.5000.wav"
, "glassShat3.CRNK.80.wav" , "glassShat2.CRNKL.8000.wav"
, "tapQuiet.BRAP.40.wav" , "buzz.ZMM.8000.wav"
, "foot1.TIP.30.wav" , "smallGlass2.KRTNKL.5000.wav"
, "hit.THUD.30.wav" , "skwareFadeTwoSec.DWAAH.3000.wav"
, "autoGun.BRAP.100.wav" , "sineRaisePitchOneSec.BWAH.3000.wav"
, "smallGlass3.CRTINK.50.wav" , "twoStepSlow.TIPTOP.4000.wav"
, "pickUp.SHUHP.20.wav" , "smallGlass4.TINKLE.5000.wav"
, "explosion.BOOM.200.wav" , "autoB.TATATA.10000.wav"
, "missileLaunch.WHSSH.100.wav" , "glassShat4.CRSK.8000.wav"
, "smallGlass2.KRTNKL.50.wav" , "glassShat3.CRNK.8000.wav"
, "impact3.CRUMPLE.80.wav" , "tap2.TAKH.8000.wav"
, "foot2.TAP.30.wav" , "impact2.CRUNK.8000.wav"
, "impact2.CRUNK.80.wav" , "tone440sawtooth.SCREE.10000.wav"
, "mini1.BRDBRDBRD.120.wav" , "reload.TNKTNKTNK.3000.wav"
, "fire.WRR.50.wav" , "twoStep.TIPTAP.4000.wav"
, "slideDoor.DRR.30.wav" , "fire.WRR.5000.wav"
, "autoB.TATATA.100.wav" , "foamSprayFadeOut.HSS.5000.wav"
, "tap1.TAK.80.wav" , "explosion.BOOM.20000.wav"
, "smallGlass1.TRINKL.50.wav" , "tapQuiet.CLNK.4000.wav"
, "tone440sawtooth.SCREE.100.wav" , "autoGun.BRAP.10000.wav"
, "mini.BRPBRPBRP.120.wav" , "glassShat1.CRSNK.8000.wav"
, "whiteNoiseFadeOut.PHF.20.wav" , "foot3.TAPP.4000.wav"
, "whiteNoiseFadeIn.FHP.20.wav" , "heal.BLIH.2000.wav"
, "glassShat1.CRSNK.80.wav" , "twoStep1.TAPTIP.6000.wav"
, "sineRaisePitchTwoSec.BWAAH.30.wav" , "click1.CLICK.500.wav"
, "tinitus.RINGGG.80.wav" , "tap4.FWUMP.5000.wav"
, "buzz.ZMM.80.wav" , "tinitus.RINGGG.8000.wav"
, "tap3.BRAP.80.wav" , "tap3.BRAP.8000.wav"
, "grunt.HNH.50.wav" , "impact3.CRUMPLE.8000.wav"
, "reload1.CHPCHPCHP.30.wav" , "smallGlass1.TRINKL.5000.wav"
, "hit1.SMACK.40.wav" , "tap1.TAK.8000.wav"
, "foamSprayLoop.HSSS.50.wav" , "hit1.SMACK.4000.wav"
, "foamSprayFadeOut.HSS.50.wav" , "slideDoor.DRR.3000.wav"
, "glassShat4.CRSK.80.wav" , "impact1.CRASH.8000.wav"
, "impact1.CRASH.80.wav" , "knife.SWSH.2000.wav"
, "twoStep1.TAPTIP.60.wav" , "elecCrackle.CRAKLE.10000.wav"
, "twoStepSlow.TIPTOP.40.wav" , "smallGlass3.CRTINK.5000.wav"
, "bang.BANG.150.wav" , "whiteNoiseFadeIn.FHP.2000.wav"
, "twoStep.TIPTAP.40.wav" , "reload1.CHPCHPCHP.3000.wav"
, "tap4.THUD.50.wav" , "mini.BRPBRPBRP.12000.wav"
, "foot3.TAPP.40.wav" , "crankSlow.CHNKCHNKCHUNK.5000.wav"
, "skwareFadeTwoSec.DWAAH.30.wav" , "fireLoud.WRRR.10000.wav"
, "tap2.TAKH.80.wav" , "mini1.BRDBRDBRD.12000.wav"
, "tone440.BEP.80.wav" , "whiteNoiseFadeOut.PHF.2000.wav"
, "knife.SWSH.20.wav" , "sineRaisePitchTwoSec.BWAAH.3000.wav"
, "glassShat2.CRNKL.80.wav" , "tone440.BEP.8000.wav"
, "crankSlow.CHNKCHNKCHUNK.50.wav" , "foamSprayLoop.HSSS.5000.wav"
, "smallGlass4.TINKLE.50.wav" , "pickUp.SHUHP.2000.wav"
, "reload.TNKTNKTNK.30.wav" , "hit.THUD.3000.wav"
, "shotgun.BRAHCHCH.100.wav" , "missileLaunch.WHSSH.10000.wav"
, "click1.CLICK.50.wav" , "shotgun.BRAHCHCH.10000.wav"
, "bangEcho.BANGG.150.wav" , "foot1.TIP.3000.wav"
, "fireLoud.WRRR.100.wav" , "bangEcho.BANGG.15000.wav"
, "impact4.CRISH.80.wav" , "tele.ZHM.10000.wav"
, "sineRaisePitchOneSec.BWAH.30.wav" , "foot2.TAP.3000.wav"
, "elecCrackle.CRAKLE.100.wav" , "bang.BANG.15000.wav"
, "tele.ZHM.100.wav" , "impact4.CRISH.8000.wav"
] ]
healS :: SoundID gruntS :: SoundID
healS = SoundID 0 gruntS = SoundID 0
glassShat3S :: SoundID glassShat2S :: SoundID
glassShat3S = SoundID 1 glassShat2S = SoundID 1
tapQuietS :: SoundID
tapQuietS = SoundID 2
foot1S :: SoundID
foot1S = SoundID 3
hitS :: SoundID
hitS = SoundID 4
autoGunS :: SoundID
autoGunS = SoundID 5
smallGlass3S :: SoundID
smallGlass3S = SoundID 6
pickUpS :: SoundID
pickUpS = SoundID 7
explosionS :: SoundID
explosionS = SoundID 8
missileLaunchS :: SoundID
missileLaunchS = SoundID 9
smallGlass2S :: SoundID
smallGlass2S = SoundID 10
impact3S :: SoundID
impact3S = SoundID 11
foot2S :: SoundID
foot2S = SoundID 12
impact2S :: SoundID
impact2S = SoundID 13
mini1S :: SoundID
mini1S = SoundID 14
fireS :: SoundID
fireS = SoundID 15
slideDoorS :: SoundID
slideDoorS = SoundID 16
autoBS :: SoundID
autoBS = SoundID 17
tap1S :: SoundID
tap1S = SoundID 18
smallGlass1S :: SoundID
smallGlass1S = SoundID 19
tone440sawtoothS :: SoundID
tone440sawtoothS = SoundID 20
miniS :: SoundID
miniS = SoundID 21
whiteNoiseFadeOutS :: SoundID
whiteNoiseFadeOutS = SoundID 22
whiteNoiseFadeInS :: SoundID
whiteNoiseFadeInS = SoundID 23
glassShat1S :: SoundID
glassShat1S = SoundID 24
sineRaisePitchTwoSecS :: SoundID
sineRaisePitchTwoSecS = SoundID 25
tinitusS :: SoundID
tinitusS = SoundID 26
buzzS :: SoundID buzzS :: SoundID
buzzS = SoundID 27 buzzS = SoundID 2
smallGlass2S :: SoundID
smallGlass2S = SoundID 3
skwareFadeTwoSecS :: SoundID
skwareFadeTwoSecS = SoundID 4
sineRaisePitchOneSecS :: SoundID
sineRaisePitchOneSecS = SoundID 5
twoStepSlowS :: SoundID
twoStepSlowS = SoundID 6
smallGlass4S :: SoundID
smallGlass4S = SoundID 7
autoBS :: SoundID
autoBS = SoundID 8
glassShat4S :: SoundID
glassShat4S = SoundID 9
glassShat3S :: SoundID
glassShat3S = SoundID 10
tap2S :: SoundID
tap2S = SoundID 11
impact2S :: SoundID
impact2S = SoundID 12
tone440sawtoothS :: SoundID
tone440sawtoothS = SoundID 13
reloadS :: SoundID
reloadS = SoundID 14
twoStepS :: SoundID
twoStepS = SoundID 15
fireS :: SoundID
fireS = SoundID 16
foamSprayFadeOutS :: SoundID
foamSprayFadeOutS = SoundID 17
explosionS :: SoundID
explosionS = SoundID 18
tapQuietS :: SoundID
tapQuietS = SoundID 19
autoGunS :: SoundID
autoGunS = SoundID 20
glassShat1S :: SoundID
glassShat1S = SoundID 21
foot3S :: SoundID
foot3S = SoundID 22
healS :: SoundID
healS = SoundID 23
twoStep1S :: SoundID
twoStep1S = SoundID 24
click1S :: SoundID
click1S = SoundID 25
tap4S :: SoundID
tap4S = SoundID 26
tinitusS :: SoundID
tinitusS = SoundID 27
tap3S :: SoundID tap3S :: SoundID
tap3S = SoundID 28 tap3S = SoundID 28
gruntS :: SoundID impact3S :: SoundID
gruntS = SoundID 29 impact3S = SoundID 29
reload1S :: SoundID smallGlass1S :: SoundID
reload1S = SoundID 30 smallGlass1S = SoundID 30
tap1S :: SoundID
tap1S = SoundID 31
hit1S :: SoundID hit1S :: SoundID
hit1S = SoundID 31 hit1S = SoundID 32
foamSprayLoopS :: SoundID slideDoorS :: SoundID
foamSprayLoopS = SoundID 32 slideDoorS = SoundID 33
foamSprayFadeOutS :: SoundID
foamSprayFadeOutS = SoundID 33
glassShat4S :: SoundID
glassShat4S = SoundID 34
impact1S :: SoundID impact1S :: SoundID
impact1S = SoundID 35 impact1S = SoundID 34
twoStep1S :: SoundID
twoStep1S = SoundID 36
twoStepSlowS :: SoundID
twoStepSlowS = SoundID 37
bangS :: SoundID
bangS = SoundID 38
twoStepS :: SoundID
twoStepS = SoundID 39
tap4S :: SoundID
tap4S = SoundID 40
foot3S :: SoundID
foot3S = SoundID 41
skwareFadeTwoSecS :: SoundID
skwareFadeTwoSecS = SoundID 42
tap2S :: SoundID
tap2S = SoundID 43
tone440S :: SoundID
tone440S = SoundID 44
knifeS :: SoundID knifeS :: SoundID
knifeS = SoundID 45 knifeS = SoundID 35
glassShat2S :: SoundID
glassShat2S = SoundID 46
crankSlowS :: SoundID
crankSlowS = SoundID 47
smallGlass4S :: SoundID
smallGlass4S = SoundID 48
reloadS :: SoundID
reloadS = SoundID 49
shotgunS :: SoundID
shotgunS = SoundID 50
click1S :: SoundID
click1S = SoundID 51
bangEchoS :: SoundID
bangEchoS = SoundID 52
fireLoudS :: SoundID
fireLoudS = SoundID 53
impact4S :: SoundID
impact4S = SoundID 54
sineRaisePitchOneSecS :: SoundID
sineRaisePitchOneSecS = SoundID 55
elecCrackleS :: SoundID elecCrackleS :: SoundID
elecCrackleS = SoundID 56 elecCrackleS = SoundID 36
smallGlass3S :: SoundID
smallGlass3S = SoundID 37
whiteNoiseFadeInS :: SoundID
whiteNoiseFadeInS = SoundID 38
reload1S :: SoundID
reload1S = SoundID 39
miniS :: SoundID
miniS = SoundID 40
crankSlowS :: SoundID
crankSlowS = SoundID 41
fireLoudS :: SoundID
fireLoudS = SoundID 42
mini1S :: SoundID
mini1S = SoundID 43
whiteNoiseFadeOutS :: SoundID
whiteNoiseFadeOutS = SoundID 44
sineRaisePitchTwoSecS :: SoundID
sineRaisePitchTwoSecS = SoundID 45
tone440S :: SoundID
tone440S = SoundID 46
foamSprayLoopS :: SoundID
foamSprayLoopS = SoundID 47
pickUpS :: SoundID
pickUpS = SoundID 48
hitS :: SoundID
hitS = SoundID 49
missileLaunchS :: SoundID
missileLaunchS = SoundID 50
shotgunS :: SoundID
shotgunS = SoundID 51
foot1S :: SoundID
foot1S = SoundID 52
bangEchoS :: SoundID
bangEchoS = SoundID 53
teleS :: SoundID teleS :: SoundID
teleS = SoundID 57 teleS = SoundID 54
foot2S :: SoundID
foot2S = SoundID 55
bangS :: SoundID
bangS = SoundID 56
impact4S :: SoundID
impact4S = SoundID 57
loadMusic :: IO (IM.IntMap Mix.Music) loadMusic :: IO (IM.IntMap Mix.Music)
loadMusic = do loadMusic = do
-42
View File
@@ -1,42 +0,0 @@
module Dodge.SoundLogic.Synonyms
where
clickSound , reloadSound , pickUpSound , putDownSound , fireSound , grenadeBang , tapQuiet , twoStepSound , healSound , doorSound , twoStepSlowSound , knifeSound , buzzSound , hitSound , autoGunSound , shotgunSound , teleSound , longGunSound , launcherSound , smokeTrailSound , foot1Sound , foot2Sound , drawWeaponSound , holsterWeaponSound :: Int
clickSound = 1
reloadSound = 2
pickUpSound = 4
putDownSound = 5
fireSound = 6
grenadeBang = 7
tapQuiet = 8
twoStepSound = 9
healSound = 10
doorSound = 11
twoStepSlowSound = 12
knifeSound = 13
buzzSound = 14
hitSound = 15
autoGunSound = 16
shotgunSound = 17
teleSound = 18
longGunSound = 19
launcherSound = 20
smokeTrailSound = 21
foot1Sound = 22
foot2Sound = 23
foamSpray :: Int
foamSpray = 41
foamSprayFadeOutSound :: Int
foamSprayFadeOutSound = 42
sineRaisePitchOneSecSound :: Int
sineRaisePitchOneSecSound = 43
sineRaisePitchTwoSecSound :: Int
sineRaisePitchTwoSecSound = 44
skwareFadeTwoSecSound :: Int
skwareFadeTwoSecSound = 45
drawWeaponSound = 4
holsterWeaponSound = 5
soundVolID :: Int -> Float
soundVolID _ = 10000
+3 -3
View File
@@ -7,17 +7,17 @@ import Dodge.SoundLogic.LoadSound
import Geometry.Data import Geometry.Data
import Dodge.RandomHelp import Dodge.RandomHelp
import System.Random --import System.Random
import Control.Lens import Control.Lens
import Control.Monad.State.Lazy import Control.Monad.State.Lazy
mkSoundBreakGlass :: Point2 -> World -> World mkSoundBreakGlass :: Point2 -> World -> World
mkSoundBreakGlass p w = soundOnceOrigin soundid (GlassBreakSound 0) p $ set randGen g w mkSoundBreakGlass p w = soundStart (GlassBreakSound 0) p soundid Nothing $ set randGen g w
where where
(soundid,g) = _randGen w & runState (takeOne [glassShat1S,glassShat2S,glassShat3S,glassShat4S]) (soundid,g) = _randGen w & runState (takeOne [glassShat1S,glassShat2S,glassShat3S,glassShat4S])
mkSoundSplinterGlass :: Point2 -> World -> World mkSoundSplinterGlass :: Point2 -> World -> World
mkSoundSplinterGlass p w = soundOnceOrigin soundid (GlassBreakSound 1) p $ set randGen g w mkSoundSplinterGlass p w = soundStart (GlassBreakSound 1) p soundid Nothing $ set randGen g w
where where
(soundid,g) = _randGen w & runState (takeOne [smallGlass1S,smallGlass2S,smallGlass3S,smallGlass4S]) (soundid,g) = _randGen w & runState (takeOne [smallGlass1S,smallGlass2S,smallGlass3S,smallGlass4S])
+1 -1
View File
@@ -99,7 +99,7 @@ moveFlame rotd w pt
_ -> (glare $ doSound damcrs , mvPt) _ -> (glare $ doSound damcrs , mvPt)
where where
time = _btTimer' pt time = _btTimer' pt
doSound = soundFrom Flame (V2 x y) fireS (Just 2) -- . over worldEvents ((.) $ flameGlareAt ep) doSound = soundContinue Flame (V2 x y) fireS (Just 2) -- . over worldEvents ((.) $ flameGlareAt ep)
glare glare
| time `mod` 5 == 0 | time `mod` 5 == 0
= tempLightSources %~ (theTLS :) = tempLightSources %~ (theTLS :)
+2 -1
View File
@@ -55,7 +55,7 @@ playSoundAndUpdate sData oldSounds newSounds
mergeSound :: Sound -> Sound -> Sound mergeSound :: Sound -> Sound -> Sound
mergeSound oldS newS mergeSound oldS newS
| _soundChunkID newS == _soundChunkID oldS | _soundChunkID newS == _soundChunkID oldS && _soundStatus newS == ToContinueStart
= newS & soundChannel .~ _soundChannel oldS = newS & soundChannel .~ _soundChannel oldS
& soundStatus .~ _soundStatus oldS & soundStatus .~ _soundStatus oldS
| otherwise = newS & soundChannel .~ _soundChannel oldS | otherwise = newS & soundChannel .~ _soundChannel oldS
@@ -74,6 +74,7 @@ updateSound sd s =
initialisePlaying :: IM.IntMap Mix.Chunk -> Sound -> MaybeT IO Sound initialisePlaying :: IM.IntMap Mix.Chunk -> Sound -> MaybeT IO Sound
initialisePlaying sd s = case _soundStatus s of initialisePlaying sd s = case _soundStatus s of
ToStart -> tryPlay sd s ToStart -> tryPlay sd s
ToContinueStart -> tryPlay sd s
JustStartedPlaying -> return $ s & soundStatus .~ Playing JustStartedPlaying -> return $ s & soundStatus .~ Playing
_ -> return s _ -> return s
+1
View File
@@ -13,6 +13,7 @@ data SoundStatus
= JustStartedPlaying = JustStartedPlaying
| Playing | Playing
| ToStart | ToStart
| ToContinueStart
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show)
newtype SoundID = SoundID { _getSoundID :: Int } newtype SoundID = SoundID { _getSoundID :: Int }