Refactor sound
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -19,7 +19,7 @@ import Dodge.Base
|
||||
import Dodge.Zone
|
||||
import Dodge.Base.Collide
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
--import Dodge.WorldEvent
|
||||
import Dodge.Inventory
|
||||
--import Dodge.LightSources
|
||||
@@ -167,7 +167,7 @@ blinkAction
|
||||
-> World
|
||||
-> World
|
||||
blinkAction cr w
|
||||
= soundMultiFrom [TeleSound 0,TeleSound 1] p3 teleSound Nothing
|
||||
= soundMultiFrom [TeleSound 0,TeleSound 1] p3 teleS Nothing
|
||||
. over radDistortion (distortionBulge ++)
|
||||
. set (creatures . ix cid . crPos) p3
|
||||
. blinkShockwave cid p3
|
||||
@@ -198,7 +198,7 @@ youDropItem w = case yourItem w of
|
||||
NoItem -> w
|
||||
_ -> rmSelectedInvItem (_yourID w)
|
||||
. copyItemToFloor (you w) (_crInvSel cr)
|
||||
$ soundFrom (CrSound (_crID cr)) (_crPos cr) putDownSound Nothing
|
||||
$ soundFrom (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
|
||||
w
|
||||
where
|
||||
cr = you w
|
||||
@@ -233,7 +233,7 @@ pickUpItem
|
||||
pickUpItem cid flit w = case maybeInvSlot of
|
||||
Nothing -> w
|
||||
Just i -> w
|
||||
& soundFrom (CrSound cid) (_flItPos flit) pickUpSound Nothing
|
||||
& soundFrom (CrSound cid) (_flItPos flit) pickUpS Nothing
|
||||
& updateItLocation i
|
||||
& floorItems %~ IM.delete (_flItID flit)
|
||||
& creatures . ix cid . crInv . ix i %~ addItem it
|
||||
|
||||
@@ -11,7 +11,7 @@ import Dodge.Data.DamageType
|
||||
import Dodge.Creature.State.Data
|
||||
import Dodge.Creature.Stance.Data
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Geometry
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
@@ -84,5 +84,5 @@ followImpulse cr w imp = case imp of
|
||||
posFromID cid' = _crPos $ _creatures w IM.! cid'
|
||||
rr a = fst $ randomR (-a,a) $ _randGen w
|
||||
hitCr i = over (creatures . ix i . crState . crDamage) (addDam i)
|
||||
. soundFrom (CrSound cid) cpos hitSound Nothing
|
||||
. soundFrom (CrSound cid) cpos hitS Nothing
|
||||
addDam i dams = Blunt 100 cpos (posFromID i) (posFromID i) : dams
|
||||
|
||||
@@ -9,7 +9,7 @@ import Dodge.Creature.Stance.Data
|
||||
--import Dodge.Creature.Test
|
||||
--import Dodge.Base
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.WorldEvent
|
||||
--import Dodge.WallCreatureCollisions
|
||||
@@ -141,7 +141,7 @@ weaponReloadSounds cr w = case _crInv cr IM.!? _crInvSel cr of
|
||||
| otherwise -> w
|
||||
Just Weapon{_wpReloadState = 0} -> w
|
||||
Just Weapon{_wpReloadState = 1} -> stopSoundFrom (CrReloadSound cid) w
|
||||
Just Weapon{} -> soundFrom (CrReloadSound cid) (_crPos cr) reloadSound (Just 1) w
|
||||
Just Weapon{} -> soundFrom (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
|
||||
_ -> w
|
||||
where
|
||||
cid = _crID cr
|
||||
@@ -223,7 +223,7 @@ updateExpBarrel cr w
|
||||
applyFuseDamage cr' = cr' & crHP %~
|
||||
subtract (length . _piercedPoints . _crSpState $ _crState cr')
|
||||
hiss | null poss = id
|
||||
| otherwise = soundMultiFrom [BarrelHiss 0,BarrelHiss 1] (_crPos cr) 41 (Just 1)
|
||||
| otherwise = soundMultiFrom [BarrelHiss 0,BarrelHiss 1] (_crPos cr) foamSprayLoopS (Just 1)
|
||||
stopSounds = stopSoundFrom (BarrelHiss 0) . stopSoundFrom (BarrelHiss 1)
|
||||
|
||||
damToExpBarrel :: [DamageType] -> Creature -> Creature
|
||||
|
||||
@@ -4,7 +4,9 @@ import Dodge.Data
|
||||
import Dodge.Data.SoundOrigin
|
||||
import Dodge.Creature.Stance.Data
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Geometry.Data
|
||||
import Sound.Data
|
||||
|
||||
import Control.Lens
|
||||
|
||||
@@ -36,6 +38,6 @@ makeFootstepSound currentStride maxStride ff p
|
||||
where
|
||||
footor = [FootstepSound 0,FootstepSound 1]
|
||||
|
||||
chooseFootSound :: FootForward -> Int
|
||||
chooseFootSound LeftForward = 22
|
||||
chooseFootSound _ = 23
|
||||
chooseFootSound :: FootForward -> SoundID
|
||||
chooseFootSound LeftForward = foot1S
|
||||
chooseFootSound _ = foot2S
|
||||
|
||||
@@ -5,12 +5,12 @@ import Dodge.Data
|
||||
import Dodge.Base.Collide
|
||||
import Dodge.Creature.Test
|
||||
import Dodge.Creature.Stance.Data
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Geometry
|
||||
|
||||
holsterWeapon, drawWeapon :: Action
|
||||
holsterWeapon = DoImpulses [ChangePosture AtEase, MakeSound putDownSound]
|
||||
drawWeapon = DoImpulses [ChangePosture Aiming, MakeSound pickUpSound]
|
||||
holsterWeapon = DoImpulses [ChangePosture AtEase, MakeSound whiteNoiseFadeOutS]
|
||||
drawWeapon = DoImpulses [ChangePosture Aiming, MakeSound whiteNoiseFadeInS]
|
||||
|
||||
fleeFrom :: Creature -> Maybe Creature -> Action
|
||||
fleeFrom cr mtcr = case mtcr of
|
||||
|
||||
+2
-2
@@ -378,7 +378,7 @@ data Item
|
||||
}
|
||||
| NoItem
|
||||
|
||||
data ReloadType = ActiveReload | PassiveReload Int
|
||||
data ReloadType = ActiveReload | PassiveReload SoundID
|
||||
|
||||
data ItEffect = NoItEffect
|
||||
| ItInvEffect
|
||||
@@ -581,7 +581,7 @@ data Impulse
|
||||
-- | UseIntrinsicAbility
|
||||
| Melee Int
|
||||
| ChangePosture Posture
|
||||
| MakeSound Int
|
||||
| MakeSound SoundID
|
||||
| ChangeStrategy Strategy
|
||||
| AddGoal Goal
|
||||
| ArbitraryImpulseFunction (World -> Creature -> Creature)
|
||||
|
||||
@@ -15,6 +15,7 @@ import Dodge.Creature.State.Data
|
||||
import Dodge.Creature.Perception.Data
|
||||
import Dodge.Creature.Memory.Data
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.Picture.Layer
|
||||
import Geometry
|
||||
import Picture
|
||||
@@ -214,7 +215,7 @@ defaultButton = Button
|
||||
, _btEvent = \b w ->
|
||||
set (buttons . ix (_btID b) . btPict) (onLayer WlLayer $ color red $ polygon $ rectNSEW (-4) (-5) 10 (-10))
|
||||
. set (buttons . ix (_btID b) . btState) BtNoLabel
|
||||
. soundFrom (LeverSound 0) (_btPos b) 1 Nothing $ w
|
||||
. soundFrom (LeverSound 0) (_btPos b) click1S Nothing $ w
|
||||
, _btID = 0
|
||||
, _btText = "Button"
|
||||
, _btState = BtOff
|
||||
|
||||
@@ -9,7 +9,7 @@ import Dodge.Layout
|
||||
import Dodge.Story
|
||||
import Dodge.WorldEvent.Cloud
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
--import Dodge.Creature.Perception
|
||||
import Geometry.Data
|
||||
--import Picture
|
||||
@@ -47,7 +47,7 @@ initialWorld = defaultWorld
|
||||
, _mousePos = V2 0 0
|
||||
, _testString = testStringInit
|
||||
, _yourID = 0
|
||||
, _worldEvents = soundFrom BackgroundSound (V2 0 0) foamSprayFadeOutSound Nothing
|
||||
, _worldEvents = soundFrom BackgroundSound (V2 0 0) foamSprayFadeOutS Nothing
|
||||
. foldr ((.) . makeStartCloudAt) id [V3 x y 5 | x <- [-5,-3..5] , y <- [-5,-3..5]]
|
||||
, _pressPlates = IM.empty
|
||||
, _buttons = IM.empty
|
||||
|
||||
@@ -6,7 +6,7 @@ import Dodge.Item.Data
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Default
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
|
||||
import Dodge.Item.Draw
|
||||
|
||||
@@ -32,7 +32,7 @@ heal25 :: Int -> World -> Maybe World
|
||||
heal25 = heal 25
|
||||
heal :: Int -> Int -> World -> Maybe World
|
||||
heal hp n w | _crHP (_creatures w IM.! n) >= 10000 = Nothing
|
||||
| otherwise = Just $ soundFrom (CrSound $ _crID cr) (_crPos cr) healSound Nothing w
|
||||
| otherwise = Just $ soundFrom (CrSound $ _crID cr) (_crPos cr) healS Nothing w
|
||||
& creatures . ix n . crHP %~ min 10000 . (+ hp)
|
||||
where
|
||||
cr = _creatures w IM.! n
|
||||
|
||||
+17
-17
@@ -8,7 +8,7 @@ import Dodge.Base
|
||||
import Dodge.Zone
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.WorldEvent
|
||||
@@ -66,7 +66,7 @@ pistol = defaultGun
|
||||
[ ammoCheckI
|
||||
, hammerCheckI
|
||||
, useTimeCheckI
|
||||
, withSoundI 0
|
||||
, withSoundI tap3S
|
||||
, useAmmo 1
|
||||
, randSpreadDir
|
||||
, withMuzFlareI
|
||||
@@ -145,7 +145,7 @@ teslaGun = defaultGun
|
||||
[ ammoCheckI
|
||||
, useTimeCheckI
|
||||
, withTempLight 1 100 (V3 0 0 1)
|
||||
, withSoundForI 25 1
|
||||
, withSoundForI elecCrackleS 1
|
||||
, useAmmo 1
|
||||
]
|
||||
, _wpSpread = 0.001
|
||||
@@ -180,7 +180,7 @@ lasGun = defaultAutoGun
|
||||
[ ammoCheckI
|
||||
, useTimeCheckI
|
||||
, withTempLight 1 100 (V3 1 1 0)
|
||||
, withSoundForI 24 1
|
||||
, withSoundForI tone440sawtoothS 1
|
||||
, useAmmo 1
|
||||
]
|
||||
, _wpSpread = 0.001
|
||||
@@ -296,7 +296,7 @@ hvAutoGun = defaultAutoGun
|
||||
, _itUseModifiers =
|
||||
[ ammoCheckI
|
||||
, rateIncABI 24 7 (torqueBeforeAtLeast 0.1 0.1) (torqueAfterI 0.2)
|
||||
, withSoundI longGunSound
|
||||
, withSoundI bangEchoS
|
||||
, withThinSmokeI
|
||||
, withMuzFlareI
|
||||
]
|
||||
@@ -323,7 +323,7 @@ ltAutoGun = defaultAutoGun
|
||||
, _itUseModifiers =
|
||||
[ ammoCheckI
|
||||
, useTimeCheckI
|
||||
, withSoundI 0
|
||||
, withSoundI tap1S
|
||||
, useAmmo 1
|
||||
, withRandomDirI 0.1
|
||||
, torqueAfterI 0.2
|
||||
@@ -359,10 +359,10 @@ miniGun = defaultAutoGun
|
||||
, _itUse = useAmmoParamsVelMod vm4
|
||||
, _itUseModifiers =
|
||||
[ ammoCheckI
|
||||
, withWarmUpI 26
|
||||
, withWarmUpI crankSlowS
|
||||
, useTimeCheckI
|
||||
--, afterRecoil recoilAmount
|
||||
, withSoundForI 28 2
|
||||
, withSoundForI mini1S 2
|
||||
--, withThinSmokeI
|
||||
, torqueAfterI 0.05
|
||||
, withSidePushI 53
|
||||
@@ -429,7 +429,7 @@ spreadGun = defaultGun
|
||||
[ ammoCheckI
|
||||
, hammerCheckI
|
||||
, useTimeCheckI
|
||||
, withSoundI shotgunSound
|
||||
, withSoundI shotgunS
|
||||
, useAmmo 1
|
||||
, withRecoilI 100
|
||||
, withMuzFlareI
|
||||
@@ -461,7 +461,7 @@ multGun = defaultGun
|
||||
[ ammoCheckI
|
||||
, hammerCheckI
|
||||
, useTimeCheckI
|
||||
, withSoundI shotgunSound
|
||||
, withSoundI shotgunS
|
||||
, useAmmo 1
|
||||
, withRecoilI 200
|
||||
, withMuzFlareI
|
||||
@@ -499,7 +499,7 @@ longGun = defaultGun
|
||||
, _wpLoadedAmmo = 1
|
||||
, _wpReloadTime = 100
|
||||
, _wpReloadState = 0
|
||||
, _wpReloadType = PassiveReload skwareFadeTwoSecSound
|
||||
, _wpReloadType = PassiveReload skwareFadeTwoSecS
|
||||
, _itUseRate = 100
|
||||
, _itUseTime = 0
|
||||
, _itUse = useAmmoParams
|
||||
@@ -507,7 +507,7 @@ longGun = defaultGun
|
||||
[ ammoCheckI
|
||||
, hammerCheckI
|
||||
, useTimeCheckI
|
||||
, withSoundI longGunSound
|
||||
, withSoundI bangEchoS
|
||||
, useAmmo 1
|
||||
, withThickSmokeI
|
||||
, torqueAfterI 0.05
|
||||
@@ -553,7 +553,7 @@ poisonSprayer = defaultAutoGun
|
||||
, _itUseModifiers =
|
||||
[ ammoCheckI
|
||||
, useTimeCheckI
|
||||
, withSoundForI foamSpray 5
|
||||
, withSoundForI foamSprayLoopS 5
|
||||
, useAmmo 1
|
||||
, spreadNumI
|
||||
]
|
||||
@@ -752,10 +752,10 @@ moveRemoteBomb itid time pID w
|
||||
$ set (projectiles .ix pID.pjUpdate) (\_ -> moveRemoteBomb itid (f time) pID)
|
||||
w
|
||||
| time < 2 = case hitWl of
|
||||
Just (p,_) -> soundFrom (Tap 0) p tapQuiet Nothing $ halfV updatedWorld
|
||||
Just (p,_) -> soundFrom (Tap 0) p tapQuietS Nothing $ halfV updatedWorld
|
||||
_ -> halfV updatedWorld
|
||||
| otherwise = case hitWl of
|
||||
Just (p,_) -> soundFrom (Tap 0) p tapQuiet Nothing updatedWorld
|
||||
Just (p,_) -> soundFrom (Tap 0) p tapQuietS Nothing updatedWorld
|
||||
_ -> updatedWorld
|
||||
where
|
||||
updatedWorld
|
||||
@@ -875,7 +875,7 @@ fireRemoteLauncher :: Creature -> World -> World
|
||||
fireRemoteLauncher cr w = setLocation
|
||||
$ resetFire
|
||||
$ resetName
|
||||
$ soundFrom (CrWeaponSound cid) pos launcherSound Nothing
|
||||
$ soundFrom (CrWeaponSound cid) pos tap4S Nothing
|
||||
$ over projectiles addRemRocket w
|
||||
where
|
||||
i = IM.newKey $ _projectiles w
|
||||
@@ -923,7 +923,7 @@ moveRemoteShell cid itid pj w
|
||||
( ( pjVel %~ ( (accel +.+) . (frict *.*) ) )
|
||||
. ( pjDir .~ newdir )
|
||||
)
|
||||
& soundFrom (ShellSound i) newPos smokeTrailSound (Just 1)
|
||||
& soundFrom (ShellSound i) newPos missileLaunchS (Just 1)
|
||||
& smokeGen
|
||||
& makeFlameletTimed oldPos 20 (0.5 *.* rotateV (pi+sparkD) accel) Nothing 3 10
|
||||
| time > -200 = case thingHit of
|
||||
|
||||
@@ -13,7 +13,7 @@ import Dodge.Picture.Layer
|
||||
import Dodge.Item.Draw
|
||||
import Dodge.Item.Weapon.Bullet
|
||||
import Dodge.Item.Weapon.TriggerType
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Picture
|
||||
import Geometry
|
||||
|
||||
@@ -40,7 +40,7 @@ autoGun = defaultAutoGun
|
||||
[('M', torqueBefore 0.08)
|
||||
,('S', torqueBefore 0.05)
|
||||
]
|
||||
, withSoundI autoGunSound
|
||||
, withSoundForI autoBS 5
|
||||
, useAmmo 1
|
||||
, withRandomDirI (autogunSpread/2)
|
||||
, withMuzFlareI
|
||||
|
||||
@@ -15,6 +15,7 @@ import Dodge.Particle.Bullet.HitEffect
|
||||
import Dodge.WorldEvent.HitEffect
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Picture
|
||||
import Geometry
|
||||
|
||||
@@ -28,7 +29,7 @@ bezierGun = defaultGun
|
||||
, _itUse = \_ -> useTargetPos $ \p -> shootBezier $ fromJust p -- <- the start point
|
||||
, _itUseModifiers =
|
||||
[ useTimeCheckI
|
||||
, withSoundI 0
|
||||
, withSoundI tap2S
|
||||
, useAmmo 1
|
||||
, withMuzFlareI
|
||||
. withRecoilI 40
|
||||
|
||||
@@ -7,7 +7,7 @@ import Dodge.Base
|
||||
import Dodge.Zone
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.Item.Attachment.Data
|
||||
import Dodge.Item.Draw
|
||||
import Dodge.Default.Shell
|
||||
@@ -32,7 +32,7 @@ moveGrenade 0 _ pID w = over projectiles (IM.delete pID)
|
||||
pj = _projectiles w IM.! pID
|
||||
explosion = _pjPayload pj
|
||||
moveGrenade time dir pID w = case hitWl of
|
||||
Just (p,_) -> soundFrom (Tap 0) p tapQuiet Nothing updatedWorld
|
||||
Just (p,_) -> soundFrom (Tap 0) p tapQuietS Nothing updatedWorld
|
||||
_ -> updatedWorld
|
||||
where
|
||||
updatedWorld = updateV $ set (projectiles . ix pID . pjPos) finalPos
|
||||
|
||||
@@ -4,7 +4,7 @@ import Dodge.Data
|
||||
import Dodge.Data.SoundOrigin
|
||||
import Dodge.Default.Weapon
|
||||
import Dodge.Default.Shell
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.WorldEvent.Explosion
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Item.Data
|
||||
@@ -43,7 +43,7 @@ launcher = defaultGun
|
||||
, _itUseModifiers =
|
||||
[ ammoCheckI
|
||||
, useTimeCheckI
|
||||
, withSoundI launcherSound
|
||||
, withSoundI tap4S
|
||||
, useAmmo 1
|
||||
]
|
||||
, _wpSpread = 0.02
|
||||
@@ -107,7 +107,7 @@ doThrust :: Projectile -> World -> World
|
||||
doThrust pj w = w
|
||||
& randGen .~ g
|
||||
& projectiles . ix i . pjVel %~ (\v -> accel +.+ frict *.* v)
|
||||
& soundFrom (ShellSound i) newPos smokeTrailSound (Just 1)
|
||||
& soundFrom (ShellSound i) newPos missileLaunchS (Just 1)
|
||||
& makeFlameletTimed (oldPos -.- vel) 0 (vel +.+ rotateV (pi+sparkD) accel) Nothing 3 10
|
||||
& smokeGen
|
||||
where
|
||||
|
||||
@@ -44,6 +44,7 @@ import Dodge.RandomHelp
|
||||
import Dodge.Item.Attachment.Data
|
||||
import Dodge.Item.Data
|
||||
import Dodge.Default
|
||||
import Sound.Data
|
||||
import Geometry
|
||||
import Geometry.Vector3D
|
||||
|
||||
@@ -121,7 +122,7 @@ rateIncABI startRate fastRate exeffFirst exeffCont eff item cr w
|
||||
&& _itUseTime item == 0
|
||||
{- | Apply effect after a warm up. -}
|
||||
withWarmUpI
|
||||
:: Int -- ^ warm up sound id
|
||||
:: SoundID -- ^ warm up sound id
|
||||
-> ChainEffect
|
||||
withWarmUpI soundID f item cr w
|
||||
| _wpReloadState item /= 0 = w
|
||||
@@ -140,7 +141,7 @@ withWarmUpI soundID f item cr w
|
||||
{- | Adds a sound to a creature based world effect.
|
||||
The sound is emitted from the creature's position. -}
|
||||
withSoundI
|
||||
:: Int -- ^ Sound id
|
||||
:: SoundID -- ^ Sound id
|
||||
-> ChainEffect
|
||||
withSoundI soundid f item cr
|
||||
= soundFrom (CrWeaponSound cid) (_crPos cr) soundid Nothing
|
||||
@@ -151,7 +152,7 @@ withSoundI soundid f item cr
|
||||
{- | Adds a sound to a creature based world effect.
|
||||
The sound is emitted from the creature's position. -}
|
||||
withSoundForI
|
||||
:: Int -- ^ Sound id
|
||||
:: SoundID -- ^ Sound id
|
||||
-> Int -- ^ Frames to play
|
||||
-> ChainEffect
|
||||
withSoundForI soundid playTime f item cr
|
||||
|
||||
@@ -6,8 +6,10 @@ import Dodge.Base
|
||||
import Dodge.Zone
|
||||
import Dodge.Zone.Data
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.WorldEvent.Sound
|
||||
import Dodge.LevelGen.Pathing
|
||||
import Dodge.RandomHelp
|
||||
import Geometry
|
||||
import Picture.Data
|
||||
import qualified IntMapHelp as IM
|
||||
@@ -46,12 +48,12 @@ killBlock bl w = f bl . flip (foldr unshadow) (_blShadows bl) $ w
|
||||
pos = fst $ _wlLine bl
|
||||
breakHitSound bl'
|
||||
| _wlIsSeeThrough bl' = mkSoundBreakGlass pos
|
||||
| otherwise = soundMultiFrom sos (fst $ _wlLine bl') (soundid + 4) Nothing
|
||||
| otherwise = soundMultiFrom sos (fst $ _wlLine bl') impactSound Nothing
|
||||
hitSound' bl'
|
||||
| _wlIsSeeThrough bl' = mkSoundSplinterGlass pos
|
||||
| otherwise = soundMultiFrom sos (fst $ _wlLine bl') soundid Nothing
|
||||
| otherwise = soundMultiFrom sos (fst $ _wlLine bl') impactSound Nothing
|
||||
sos = [BlockDegradeSound 0,BlockDegradeSound 1]
|
||||
(soundid,_) = randomR (29,32) $ _randGen w
|
||||
impactSound = evalState (takeOne [impact1S,impact2S,impact3S,impact4S]) $ _randGen w
|
||||
unshadow :: Int -> World -> World
|
||||
unshadow bid w' = case w' ^? walls . ix bid of
|
||||
Just b ->
|
||||
|
||||
@@ -11,7 +11,7 @@ import Dodge.Base
|
||||
import Dodge.Zone
|
||||
import Dodge.Zone.Data
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Geometry
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
@@ -70,7 +70,7 @@ addSoundToDoor i pld hwd (x:ys) = f x : ys
|
||||
where
|
||||
g dm w
|
||||
| dist wp pld > 2 && dist wp hwd > 2
|
||||
= soundFrom (WallSound i) wp doorSound (Just 1) $ dm w
|
||||
= soundFrom (WallSound i) wp slideDoorS (Just 1) $ dm w
|
||||
| otherwise = dm w
|
||||
where
|
||||
wp = fst $ _wlLine (_walls w IM.! i)
|
||||
|
||||
@@ -3,6 +3,7 @@ module Dodge.LevelGen.Switch
|
||||
import Dodge.Data
|
||||
import Dodge.Data.SoundOrigin
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.Picture.Layer
|
||||
import Picture
|
||||
import Geometry
|
||||
@@ -19,7 +20,7 @@ makeButton c eff = Button
|
||||
, _btPos = V2 0 0
|
||||
, _btRot = 0
|
||||
, _btEvent = \b w -> eff . over buttons (IM.adjust turnOn (_btID b))
|
||||
. soundFromGeneral (LeverSound 0) (btpos b) 1 Nothing $ w
|
||||
. soundFromGeneral (LeverSound 0) (btpos b) click1S Nothing $ w
|
||||
, _btID = 0
|
||||
, _btText = "Button"
|
||||
--, _btText = "Button"
|
||||
@@ -45,7 +46,7 @@ makeSwitch c effOn effOff = Button
|
||||
, _btState = BtOff
|
||||
}
|
||||
where
|
||||
flipSwitch b w = switchEffect b . soundFromGeneral (LeverSound 0) (bpos b) 1 Nothing $ w
|
||||
flipSwitch b w = switchEffect b . soundFromGeneral (LeverSound 0) (bpos b) click1S Nothing $ w
|
||||
bpos b w = _btPos $ _buttons w IM.! _btID b
|
||||
switchEffect b = case _btState b of
|
||||
BtOff -> effOn . over buttons (IM.adjust turnOn (_btID b))
|
||||
|
||||
@@ -11,6 +11,7 @@ import Dodge.WorldEvent
|
||||
import Dodge.Particle.Bullet.Spawn
|
||||
import Dodge.WorldEvent.DamageBlock
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.WorldEvent.Shockwave
|
||||
import Dodge.Creature.State.Data
|
||||
@@ -37,7 +38,7 @@ bulHitCr bt p cr w
|
||||
mvDams = [ PushDam 1 $ 2 *.* bulVel ]
|
||||
addDamage = creatures . ix cid . crState . crDamage %~ ((Piercing 100 sp p ep : mvDams) ++ )
|
||||
addDamageArmoured = creatures . ix cid . crState . crDamage %~ (mvDams ++)
|
||||
makeHitSound = soundMultiFrom [CrHitSound 0] p 15 (Just 10)
|
||||
makeHitSound = soundMultiFrom [CrHitSound 0] p hit1S (Just 10)
|
||||
flashEff = over worldEvents (bloodFlashAt p . )
|
||||
cid = _crID cr
|
||||
(d1,_) = randomR (-0.7,0.7) $ _randGen w
|
||||
@@ -55,7 +56,7 @@ bulBounceArmCr' bt p cr w
|
||||
mvDams = [ PushDam 1 $ 2 *.* bulVel ]
|
||||
addDamage = creatures . ix cid . crState . crDamage %~ ((Piercing 100 sp p ep : mvDams) ++ )
|
||||
addDamageArmoured = creatures . ix cid . crState . crDamage %~ (mvDams ++)
|
||||
makeHitSound = soundMultiFrom [CrHitSound 0] p 15 (Just 10)
|
||||
makeHitSound = soundMultiFrom [CrHitSound 0] p hit1S (Just 10)
|
||||
flashEff = over worldEvents ((.) $ bloodFlashAt p)
|
||||
cid = _crID cr
|
||||
newDir = safeNormalizeV (p -.- _crPos cr)
|
||||
@@ -76,7 +77,7 @@ bulPenCr' bt p cr w
|
||||
]
|
||||
++
|
||||
)
|
||||
$ soundMultiFrom [CrHitSound 0] ep 15 (Just 10)
|
||||
$ soundMultiFrom [CrHitSound 0] ep hit1S (Just 10)
|
||||
$ over worldEvents (addPiercer . )
|
||||
w
|
||||
where
|
||||
@@ -100,7 +101,7 @@ hvBulHitCr bt p cr w
|
||||
]
|
||||
++
|
||||
)
|
||||
$ soundMultiFrom [CrHitSound 0] ep 15 (Just 10)
|
||||
$ soundMultiFrom [CrHitSound 0] ep hit1S (Just 10)
|
||||
w
|
||||
where
|
||||
(d1,_) = randomR (-0.7,0.7) $ _randGen w
|
||||
@@ -112,7 +113,7 @@ bulIncCr' :: Particle -> Point2 -> Creature -> World -> World
|
||||
bulIncCr' bt p cr w
|
||||
= over (creatures . ix cid . crState . crDamage)
|
||||
( Piercing 60 sp p ep : )
|
||||
. soundMultiFrom [CrHitSound 0] p 15 (Just 10)
|
||||
. soundMultiFrom [CrHitSound 0] p hit1S (Just 10)
|
||||
$ incFlamelets
|
||||
w
|
||||
where
|
||||
@@ -126,7 +127,7 @@ bulConCr' :: Particle -> Point2 -> Creature -> World -> World
|
||||
bulConCr' bt p cr w
|
||||
= over (creatures . ix cid . crState . crDamage)
|
||||
( Piercing 60 sp p ep : )
|
||||
. soundMultiFrom [CrHitSound 0] p 15 (Just 10)
|
||||
. soundMultiFrom [CrHitSound 0] p hit1S (Just 10)
|
||||
$ mkwave
|
||||
w
|
||||
where
|
||||
|
||||
@@ -10,6 +10,7 @@ import Dodge.Picture.SizeInvariant
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Render.HUD
|
||||
import Dodge.Render.MenuScreen
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Sound.Data
|
||||
import Geometry
|
||||
import Picture
|
||||
@@ -77,7 +78,7 @@ soundPic :: World -> Sound -> Picture
|
||||
soundPic w s = fixedSizePicClampArrow 50 50 thePic p w
|
||||
where
|
||||
p = _soundPos s
|
||||
thePic = scale 0.15 0.15 $ text "SOUND"
|
||||
thePic = scale 0.15 0.15 $ text $ soundToOnomato $ _soundChunkID s
|
||||
|
||||
crDraw :: World -> Creature -> Picture
|
||||
crDraw w c = _crPict c c w
|
||||
|
||||
@@ -23,6 +23,7 @@ import Sound.Data
|
||||
import Geometry.Data
|
||||
import Geometry.Vector
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
|
||||
import Control.Lens
|
||||
import qualified Data.Map as M
|
||||
@@ -44,7 +45,7 @@ resumeSound w = w
|
||||
For each origin only one sound will play at a time.
|
||||
-}
|
||||
soundOnceOrigin
|
||||
:: Int -- ^ ID of the sound to be played
|
||||
:: SoundID -- ^ ID of the sound to be played
|
||||
-> SoundOrigin -- ^ The \"creator\" of the sound
|
||||
-> Point2 -- ^ The position of the sound in the world
|
||||
-> World
|
||||
@@ -58,14 +59,14 @@ soundOnceOrigin sType so p w = w & sounds %~ M.insertWith (\ _ x -> x) so theSou
|
||||
, _soundChannel = Nothing
|
||||
, _soundAngDist = Just (a,0)
|
||||
, _soundPos = p
|
||||
, _soundVolume = soundVolID sType
|
||||
, _soundVolume = soundToVol sType
|
||||
}
|
||||
a = soundAngle p w
|
||||
|
||||
soundFrom
|
||||
:: SoundOrigin -- ^ \"Creator\" of sound
|
||||
-> Point2 -- ^ Position of sound
|
||||
-> Int -- ^ ID of sound to be played
|
||||
-> SoundID -- ^ ID of sound to be played
|
||||
-> Maybe Int -- ^ Frames to play sound for, Nothing for until finished
|
||||
-> World
|
||||
-> World
|
||||
@@ -78,7 +79,7 @@ soundFrom so pos sType mtime w = over sounds (M.insertWith f so sound) w
|
||||
, _soundChannel = Nothing
|
||||
, _soundAngDist = Just (a,0)
|
||||
, _soundPos = pos
|
||||
, _soundVolume = soundVolID sType
|
||||
, _soundVolume = soundToVol sType
|
||||
}
|
||||
f _ s = s {_soundTime = mtime }
|
||||
a = soundAngle pos w
|
||||
@@ -86,7 +87,7 @@ soundFrom so pos sType mtime w = over sounds (M.insertWith f so sound) w
|
||||
soundFromGeneral
|
||||
:: SoundOrigin -- ^ \"Creator\" of sound
|
||||
-> (World -> Point2) -- ^ Position of sound
|
||||
-> Int -- ^ ID of sound to be played
|
||||
-> SoundID -- ^ ID of sound to be played
|
||||
-> Maybe Int -- ^ Frames to play sound for, Nothing for until finished
|
||||
-> World
|
||||
-> World
|
||||
@@ -99,7 +100,7 @@ soundFromGeneral so fpos sType mtime w = over sounds (M.insertWith f so sound) w
|
||||
, _soundChannel = Nothing
|
||||
, _soundAngDist = Just (a,0)
|
||||
, _soundPos = fpos w
|
||||
, _soundVolume = soundVolID sType
|
||||
, _soundVolume = soundToVol sType
|
||||
}
|
||||
f _ s = s {_soundTime = mtime }
|
||||
a = soundAngle (fpos w) w
|
||||
@@ -124,7 +125,7 @@ Does nothing if all origins are already creating sounds. -}
|
||||
soundMultiFrom
|
||||
:: [SoundOrigin]
|
||||
-> Point2 -- ^ Position
|
||||
-> Int -- ^ Sound ID
|
||||
-> SoundID -- ^ Sound ID
|
||||
-> Maybe Int -- ^ Frames to play for, Nothing for full length
|
||||
-> World
|
||||
-> World
|
||||
@@ -140,7 +141,7 @@ soundMultiFrom (so:sos) pos sType mtime w
|
||||
, _soundChannel = Nothing
|
||||
, _soundAngDist = Just (a,0)
|
||||
, _soundPos = pos
|
||||
, _soundVolume = soundVolID sType
|
||||
, _soundVolume = soundToVol sType
|
||||
}
|
||||
a = soundAngle pos w
|
||||
{- | Sets '_soundTime' to 0. -}
|
||||
|
||||
@@ -1,104 +1,318 @@
|
||||
module Dodge.SoundLogic.LoadSound where
|
||||
import Sound.Data
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
import qualified SDL.Mixer as Mix
|
||||
|
||||
loadSound :: (Int,String) -> IO (Int, Mix.Chunk)
|
||||
loadSound (i,s) = do
|
||||
chnk <- Mix.load $ "./data/sound/" ++ s
|
||||
return (i,chnk)
|
||||
|
||||
loadSounds :: IO (IM.IntMap Mix.Chunk)
|
||||
loadSounds = do
|
||||
Mix.openAudio Mix.defaultAudio 128
|
||||
pFireSound <- Mix.load "./data/sound/tap3.wav"
|
||||
click <- Mix.load "./data/sound/click1.wav"
|
||||
reloadSound' <- Mix.load "./data/sound/reload1.wav"
|
||||
tone440 <- Mix.load "./data/sound/tone440.wav"
|
||||
pickupSound' <- Mix.load "./data/sound/pickUp.wav"
|
||||
putdownSound' <- Mix.load "./data/sound/whiteNoiseFadeOut.wav"
|
||||
fireSound' <- Mix.load "./data/sound/fire1.wav"
|
||||
grenadeBang' <- Mix.load "./data/sound/grenade.wav"
|
||||
tapQuiet' <- Mix.load "./data/sound/tapQuiet.wav"
|
||||
twoStep' <- Mix.load "./data/sound/twoStep.wav"
|
||||
healSound' <- Mix.load "./data/sound/heal.wav"
|
||||
doorSound' <- Mix.load "./data/sound/slideDoor.wav"
|
||||
twoStepSlow' <- Mix.load "./data/sound/twoStepSlow.wav"
|
||||
knifeSound' <- Mix.load "./data/sound/knife.wav"
|
||||
buzzSound' <- Mix.load "./data/sound/buzz.wav"
|
||||
hitSound' <- Mix.load "./data/sound/hit1.wav"
|
||||
autoGunSound' <- Mix.load "./data/sound/autoGun.wav"
|
||||
shotgunSound' <- Mix.load "./data/sound/shotgun.wav"
|
||||
teleSound' <- Mix.load "./data/sound/tele.wav"
|
||||
longGunSound' <- Mix.load "./data/sound/longTap.wav"
|
||||
launcherSound' <- Mix.load "./data/sound/tap4.wav"
|
||||
smokeTrailSound' <- Mix.load "./data/sound/missileLaunch.wav"
|
||||
foot1Sound' <- Mix.load "./data/sound/foot1.wav"
|
||||
foot2Sound' <- Mix.load "./data/sound/foot2.wav"
|
||||
lasSound' <- Mix.load "./data/sound/tone440sawtooth.wav"
|
||||
teslaSound' <- Mix.load "./data/sound/Electrical-Welding.wav"
|
||||
crankSlow' <- Mix.load "./data/sound/crankSlow.wav"
|
||||
autoB' <- Mix.load "./data/sound/autoB.wav"
|
||||
mini' <- Mix.load "./data/sound/mini1.wav"
|
||||
impactA' <- Mix.load "./data/sound/Impact-A.wav"
|
||||
impactB' <- Mix.load "./data/sound/Impact-B.wav"
|
||||
impactC' <- Mix.load "./data/sound/Impact-C.wav"
|
||||
impactD' <- Mix.load "./data/sound/Impact-D.wav"
|
||||
glassShat1' <- Mix.load "./data/sound/Glass-Bottle-Shattering-A1.wav"
|
||||
glassShat2' <- Mix.load "./data/sound/Glass-Bottle-Shattering-A2.wav"
|
||||
glassShat3' <- Mix.load "./data/sound/Glass-Bottle-Shattering-A3.wav"
|
||||
glassShat4' <- Mix.load "./data/sound/Glass-Bottle-Shattering-A4.wav"
|
||||
glass1' <- Mix.load "./data/sound/Small-Piece-Of-Glass-Shattering-A1.wav"
|
||||
glass2' <- Mix.load "./data/sound/Small-Piece-Of-Glass-Shattering-A2.wav"
|
||||
glass3' <- Mix.load "./data/sound/Small-Piece-Of-Glass-Shattering-A3.wav"
|
||||
glass4' <- Mix.load "./data/sound/Small-Piece-Of-Glass-Shattering-A4.wav"
|
||||
foamSpray <- Mix.load "./data/sound/foamSprayLoop.wav"
|
||||
foamSprayFadeOut <- Mix.load "./data/sound/foamSprayFadeOut.wav"
|
||||
sineRaisePitchOneSec <- Mix.load "./data/sound/sineRaisePitchOneSec.wav"
|
||||
sineRaisePitchTwoSec <- Mix.load "./data/sound/sineRaisePitchTwoSec.wav"
|
||||
skwareFadeTwoSec <- Mix.load "./data/sound/skwareFadeTwoSec.wav"
|
||||
return $ IM.fromList $ zip [0..]
|
||||
[ pFireSound
|
||||
, click
|
||||
, reloadSound'
|
||||
, tone440
|
||||
, pickupSound'
|
||||
, putdownSound'
|
||||
, fireSound'
|
||||
, grenadeBang'
|
||||
, tapQuiet'
|
||||
, twoStep'
|
||||
, healSound'
|
||||
, doorSound'
|
||||
, twoStepSlow'
|
||||
, knifeSound'
|
||||
, buzzSound'
|
||||
, hitSound' --15
|
||||
, autoGunSound'
|
||||
, shotgunSound'
|
||||
, teleSound'
|
||||
, longGunSound'
|
||||
, launcherSound'
|
||||
, smokeTrailSound'
|
||||
, foot1Sound'
|
||||
, foot2Sound'
|
||||
, lasSound'
|
||||
, teslaSound' --25
|
||||
, crankSlow'
|
||||
, autoB'
|
||||
, mini'
|
||||
, impactA'
|
||||
, impactB' --30
|
||||
, impactC'
|
||||
, impactD'
|
||||
, glassShat1' --33
|
||||
, glassShat2'
|
||||
, glassShat3'
|
||||
, glassShat4'
|
||||
, glass1' --37
|
||||
, glass2'
|
||||
, glass3'
|
||||
, glass4' --40
|
||||
, foamSpray
|
||||
, foamSprayFadeOut
|
||||
, sineRaisePitchOneSec
|
||||
, sineRaisePitchTwoSec
|
||||
, skwareFadeTwoSec
|
||||
]
|
||||
fmap IM.fromList $ mapM loadSound $ zip [0..] soundPathList
|
||||
|
||||
soundToVol :: SoundID -> Float
|
||||
soundToVol v = case _getSoundID v of
|
||||
0 -> 20
|
||||
1 -> 80
|
||||
2 -> 40
|
||||
3 -> 30
|
||||
4 -> 30
|
||||
5 -> 100
|
||||
6 -> 50
|
||||
7 -> 20
|
||||
8 -> 200
|
||||
9 -> 100
|
||||
10 -> 50
|
||||
11 -> 80
|
||||
12 -> 30
|
||||
13 -> 80
|
||||
14 -> 120
|
||||
15 -> 50
|
||||
16 -> 30
|
||||
17 -> 100
|
||||
18 -> 80
|
||||
19 -> 50
|
||||
20 -> 100
|
||||
21 -> 120
|
||||
22 -> 20
|
||||
23 -> 20
|
||||
24 -> 80
|
||||
25 -> 30
|
||||
26 -> 80
|
||||
27 -> 80
|
||||
28 -> 80
|
||||
29 -> 50
|
||||
30 -> 30
|
||||
31 -> 40
|
||||
32 -> 50
|
||||
33 -> 50
|
||||
34 -> 80
|
||||
35 -> 80
|
||||
36 -> 60
|
||||
37 -> 40
|
||||
38 -> 150
|
||||
39 -> 40
|
||||
40 -> 50
|
||||
41 -> 40
|
||||
42 -> 30
|
||||
43 -> 80
|
||||
44 -> 80
|
||||
45 -> 20
|
||||
46 -> 80
|
||||
47 -> 50
|
||||
48 -> 50
|
||||
49 -> 30
|
||||
50 -> 100
|
||||
51 -> 50
|
||||
52 -> 150
|
||||
53 -> 100
|
||||
54 -> 80
|
||||
55 -> 30
|
||||
56 -> 100
|
||||
57 -> 100
|
||||
_ -> 50
|
||||
soundToOnomato :: SoundID -> String
|
||||
soundToOnomato v = case _getSoundID v of
|
||||
0 -> "BLIH"
|
||||
1 -> "CRNK"
|
||||
2 -> "BRAP"
|
||||
3 -> "TIP"
|
||||
4 -> "THUD"
|
||||
5 -> "BRAP"
|
||||
6 -> "CRTINK"
|
||||
7 -> "SHUHP"
|
||||
8 -> "BOOM"
|
||||
9 -> "WHSSH"
|
||||
10 -> "KRTNKL"
|
||||
11 -> "CRUMPLE"
|
||||
12 -> "TAP"
|
||||
13 -> "CRUNK"
|
||||
14 -> "BRDBRDBRD"
|
||||
15 -> "WRR"
|
||||
16 -> "DRR"
|
||||
17 -> "TATATA"
|
||||
18 -> "TAK"
|
||||
19 -> "TRINKL"
|
||||
20 -> "SCREE"
|
||||
21 -> "BRPBRPBRP"
|
||||
22 -> "PHF"
|
||||
23 -> "FHP"
|
||||
24 -> "CRSNK"
|
||||
25 -> "BWAAH"
|
||||
26 -> "RINGGG"
|
||||
27 -> "ZMM"
|
||||
28 -> "BRAP"
|
||||
29 -> "HNH"
|
||||
30 -> "CHPCHPCHP"
|
||||
31 -> "SMACK"
|
||||
32 -> "HSSS"
|
||||
33 -> "HSS"
|
||||
34 -> "CRSK"
|
||||
35 -> "CRASH"
|
||||
36 -> "TAPTIP"
|
||||
37 -> "TIPTOP"
|
||||
38 -> "BANG"
|
||||
39 -> "TIPTAP"
|
||||
40 -> "THUD"
|
||||
41 -> "TAPP"
|
||||
42 -> "DWAAH"
|
||||
43 -> "TAKH"
|
||||
44 -> "BEP"
|
||||
45 -> "SWSH"
|
||||
46 -> "CRNKL"
|
||||
47 -> "CHNKCHNKCHUNK"
|
||||
48 -> "TINKLE"
|
||||
49 -> "TNKTNKTNK"
|
||||
50 -> "BRAHCHCH"
|
||||
51 -> "CLICK"
|
||||
52 -> "BANGG"
|
||||
53 -> "WRRR"
|
||||
54 -> "CRISH"
|
||||
55 -> "BWAH"
|
||||
56 -> "CRAKLE"
|
||||
57 -> "ZHM"
|
||||
_ -> error "unitialised sound"
|
||||
soundPathList :: [String]
|
||||
soundPathList =
|
||||
[ "heal.BLIH.20.wav"
|
||||
, "glassShat3.CRNK.80.wav"
|
||||
, "tapQuiet.BRAP.40.wav"
|
||||
, "foot1.TIP.30.wav"
|
||||
, "hit.THUD.30.wav"
|
||||
, "autoGun.BRAP.100.wav"
|
||||
, "smallGlass3.CRTINK.50.wav"
|
||||
, "pickUp.SHUHP.20.wav"
|
||||
, "explosion.BOOM.200.wav"
|
||||
, "missileLaunch.WHSSH.100.wav"
|
||||
, "smallGlass2.KRTNKL.50.wav"
|
||||
, "impact3.CRUMPLE.80.wav"
|
||||
, "foot2.TAP.30.wav"
|
||||
, "impact2.CRUNK.80.wav"
|
||||
, "mini1.BRDBRDBRD.120.wav"
|
||||
, "fire.WRR.50.wav"
|
||||
, "slideDoor.DRR.30.wav"
|
||||
, "autoB.TATATA.100.wav"
|
||||
, "tap1.TAK.80.wav"
|
||||
, "smallGlass1.TRINKL.50.wav"
|
||||
, "tone440sawtooth.SCREE.100.wav"
|
||||
, "mini.BRPBRPBRP.120.wav"
|
||||
, "whiteNoiseFadeOut.PHF.20.wav"
|
||||
, "whiteNoiseFadeIn.FHP.20.wav"
|
||||
, "glassShat1.CRSNK.80.wav"
|
||||
, "sineRaisePitchTwoSec.BWAAH.30.wav"
|
||||
, "tinitus.RINGGG.80.wav"
|
||||
, "buzz.ZMM.80.wav"
|
||||
, "tap3.BRAP.80.wav"
|
||||
, "grunt.HNH.50.wav"
|
||||
, "reload1.CHPCHPCHP.30.wav"
|
||||
, "hit1.SMACK.40.wav"
|
||||
, "foamSprayLoop.HSSS.50.wav"
|
||||
, "foamSprayFadeOut.HSS.50.wav"
|
||||
, "glassShat4.CRSK.80.wav"
|
||||
, "impact1.CRASH.80.wav"
|
||||
, "twoStep1.TAPTIP.60.wav"
|
||||
, "twoStepSlow.TIPTOP.40.wav"
|
||||
, "bang.BANG.150.wav"
|
||||
, "twoStep.TIPTAP.40.wav"
|
||||
, "tap4.THUD.50.wav"
|
||||
, "foot3.TAPP.40.wav"
|
||||
, "skwareFadeTwoSec.DWAAH.30.wav"
|
||||
, "tap2.TAKH.80.wav"
|
||||
, "tone440.BEP.80.wav"
|
||||
, "knife.SWSH.20.wav"
|
||||
, "glassShat2.CRNKL.80.wav"
|
||||
, "crankSlow.CHNKCHNKCHUNK.50.wav"
|
||||
, "smallGlass4.TINKLE.50.wav"
|
||||
, "reload.TNKTNKTNK.30.wav"
|
||||
, "shotgun.BRAHCHCH.100.wav"
|
||||
, "click1.CLICK.50.wav"
|
||||
, "bangEcho.BANGG.150.wav"
|
||||
, "fireLoud.WRRR.100.wav"
|
||||
, "impact4.CRISH.80.wav"
|
||||
, "sineRaisePitchOneSec.BWAH.30.wav"
|
||||
, "elecCrackle.CRAKLE.100.wav"
|
||||
, "tele.ZHM.100.wav"
|
||||
]
|
||||
healS :: SoundID
|
||||
healS = SoundID 0
|
||||
glassShat3S :: SoundID
|
||||
glassShat3S = 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 27
|
||||
tap3S :: SoundID
|
||||
tap3S = SoundID 28
|
||||
gruntS :: SoundID
|
||||
gruntS = SoundID 29
|
||||
reload1S :: SoundID
|
||||
reload1S = SoundID 30
|
||||
hit1S :: SoundID
|
||||
hit1S = SoundID 31
|
||||
foamSprayLoopS :: SoundID
|
||||
foamSprayLoopS = SoundID 32
|
||||
foamSprayFadeOutS :: SoundID
|
||||
foamSprayFadeOutS = SoundID 33
|
||||
glassShat4S :: SoundID
|
||||
glassShat4S = SoundID 34
|
||||
impact1S :: SoundID
|
||||
impact1S = SoundID 35
|
||||
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 45
|
||||
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 56
|
||||
teleS :: SoundID
|
||||
teleS = SoundID 57
|
||||
|
||||
loadMusic :: IO (IM.IntMap Mix.Music)
|
||||
loadMusic = do
|
||||
|
||||
@@ -12,7 +12,7 @@ import Dodge.WorldEvent.SpawnParticle
|
||||
--import Dodge.WorldEvent.Flash
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.WorldEvent.Shockwave
|
||||
import Geometry
|
||||
import Geometry.Vector3D
|
||||
@@ -30,7 +30,7 @@ makePoisonExplosionAt
|
||||
-> World
|
||||
-> World
|
||||
makePoisonExplosionAt p w
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p grenadeBang Nothing
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing
|
||||
$ foldr (makeGasCloud p) w vels
|
||||
where
|
||||
vels = replicateM 25 (randInCirc 2) & evalState $ _randGen w
|
||||
@@ -58,7 +58,7 @@ makeFlameExplosionAt
|
||||
-> World
|
||||
-> World
|
||||
makeFlameExplosionAt p w
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p grenadeBang Nothing
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing
|
||||
$ over particles (newFlames ++ ) w
|
||||
where
|
||||
newFlames = zipWith makeFlameWithVelAndTime velocities timers
|
||||
@@ -73,7 +73,7 @@ makeExplosionAt
|
||||
-> World
|
||||
-> World
|
||||
makeExplosionAt p w
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p grenadeBang Nothing
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing
|
||||
. addFlames
|
||||
-- . explosionFlashAt p
|
||||
. over tempLightSources (theTLS :)
|
||||
|
||||
@@ -3,17 +3,21 @@ module Dodge.WorldEvent.Sound
|
||||
import Dodge.Data
|
||||
import Dodge.Data.SoundOrigin
|
||||
import Dodge.SoundLogic
|
||||
import System.Random
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Geometry.Data
|
||||
import Dodge.RandomHelp
|
||||
|
||||
import System.Random
|
||||
import Control.Lens
|
||||
import Control.Monad.State.Lazy
|
||||
|
||||
|
||||
mkSoundBreakGlass :: Point2 -> World -> World
|
||||
mkSoundBreakGlass p w = soundOnceOrigin soundid (GlassBreakSound 0) p $ set randGen g w
|
||||
where
|
||||
(soundid,g) = _randGen w & randomR (37,40)
|
||||
(soundid,g) = _randGen w & runState (takeOne [glassShat1S,glassShat2S,glassShat3S,glassShat4S])
|
||||
|
||||
mkSoundSplinterGlass :: Point2 -> World -> World
|
||||
mkSoundSplinterGlass p w = soundOnceOrigin soundid (GlassBreakSound 1) p $ set randGen g w
|
||||
where
|
||||
(soundid,g) = _randGen w & randomR (33,36)
|
||||
(soundid,g) = _randGen w & runState (takeOne [smallGlass1S,smallGlass2S,smallGlass3S,smallGlass4S])
|
||||
|
||||
@@ -20,7 +20,7 @@ import Dodge.WorldEvent.Cloud
|
||||
import Dodge.Particle.Bullet.Draw
|
||||
import Dodge.Particle.Bullet.Update
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.RandomHelp
|
||||
--import Dodge.Debug
|
||||
import Picture
|
||||
@@ -99,7 +99,7 @@ moveFlame rotd w pt
|
||||
_ -> (glare $ doSound damcrs , mvPt)
|
||||
where
|
||||
time = _btTimer' pt
|
||||
doSound = soundFrom Flame (V2 x y) fireSound (Just 2) -- . over worldEvents ((.) $ flameGlareAt ep)
|
||||
doSound = soundFrom Flame (V2 x y) fireS (Just 2) -- . over worldEvents ((.) $ flameGlareAt ep)
|
||||
glare
|
||||
| time `mod` 5 == 0
|
||||
= tempLightSources %~ (theTLS :)
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ tryPlay sd s = do
|
||||
i <- tryGetChannel s
|
||||
_ <- liftIO $ do
|
||||
Mix.halt i
|
||||
Mix.playOn i Mix.Once (sd IM.! _soundChunkID s)
|
||||
Mix.playOn i Mix.Once (sd IM.! (_getSoundID $ _soundChunkID s))
|
||||
return $ s
|
||||
& soundChannel ?~ i
|
||||
& soundStatus .~ JustStartedPlaying
|
||||
|
||||
+4
-1
@@ -15,6 +15,9 @@ data SoundStatus
|
||||
| ToStart
|
||||
deriving (Eq,Ord,Show)
|
||||
|
||||
newtype SoundID = SoundID { _getSoundID :: Int }
|
||||
deriving (Eq,Ord,Show)
|
||||
|
||||
newtype SoundData = SoundData
|
||||
{_loadedChunks :: IM.IntMap Mix.Chunk
|
||||
}
|
||||
@@ -25,7 +28,7 @@ data Sound = Sound
|
||||
, _soundAngDist :: Maybe (Int16,Word8)
|
||||
, _soundPos :: Point2
|
||||
, _soundVolume :: Float
|
||||
, _soundChunkID :: Int
|
||||
, _soundChunkID :: SoundID
|
||||
}
|
||||
deriving (Eq,Ord,Show)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user