diff --git a/data/sound/autoB.TATATA.100.wav b/data/sound/autoB.TATATA.10000.wav similarity index 100% rename from data/sound/autoB.TATATA.100.wav rename to data/sound/autoB.TATATA.10000.wav diff --git a/data/sound/autoGun.BRAP.100.wav b/data/sound/autoGun.BRAP.10000.wav similarity index 100% rename from data/sound/autoGun.BRAP.100.wav rename to data/sound/autoGun.BRAP.10000.wav diff --git a/data/sound/bang.BANG.150.wav b/data/sound/bang.BANG.15000.wav similarity index 100% rename from data/sound/bang.BANG.150.wav rename to data/sound/bang.BANG.15000.wav diff --git a/data/sound/bangEcho.BANGG.150.wav b/data/sound/bangEcho.BANGG.15000.wav similarity index 100% rename from data/sound/bangEcho.BANGG.150.wav rename to data/sound/bangEcho.BANGG.15000.wav diff --git a/data/sound/buzz.ZMM.80.wav b/data/sound/buzz.ZMM.8000.wav similarity index 100% rename from data/sound/buzz.ZMM.80.wav rename to data/sound/buzz.ZMM.8000.wav diff --git a/data/sound/click1.CLICK.50.wav b/data/sound/click1.CLICK.500.wav similarity index 100% rename from data/sound/click1.CLICK.50.wav rename to data/sound/click1.CLICK.500.wav diff --git a/data/sound/crankSlow.CHNKCHNKCHUNK.50.wav b/data/sound/crankSlow.CHNKCHNKCHUNK.5000.wav similarity index 100% rename from data/sound/crankSlow.CHNKCHNKCHUNK.50.wav rename to data/sound/crankSlow.CHNKCHNKCHUNK.5000.wav diff --git a/data/sound/elecCrackle.CRAKLE.100.wav b/data/sound/elecCrackle.CRAKLE.10000.wav similarity index 100% rename from data/sound/elecCrackle.CRAKLE.100.wav rename to data/sound/elecCrackle.CRAKLE.10000.wav diff --git a/data/sound/explosion.BOOM.200.wav b/data/sound/explosion.BOOM.20000.wav similarity index 100% rename from data/sound/explosion.BOOM.200.wav rename to data/sound/explosion.BOOM.20000.wav diff --git a/data/sound/fire.WRR.50.wav b/data/sound/fire.WRR.5000.wav similarity index 100% rename from data/sound/fire.WRR.50.wav rename to data/sound/fire.WRR.5000.wav diff --git a/data/sound/fireLoud.WRRR.100.wav b/data/sound/fireLoud.WRRR.10000.wav similarity index 100% rename from data/sound/fireLoud.WRRR.100.wav rename to data/sound/fireLoud.WRRR.10000.wav diff --git a/data/sound/foamSprayFadeOut.HSS.50.wav b/data/sound/foamSprayFadeOut.HSS.5000.wav similarity index 100% rename from data/sound/foamSprayFadeOut.HSS.50.wav rename to data/sound/foamSprayFadeOut.HSS.5000.wav diff --git a/data/sound/foamSprayLoop.HSSS.50.wav b/data/sound/foamSprayLoop.HSSS.5000.wav similarity index 100% rename from data/sound/foamSprayLoop.HSSS.50.wav rename to data/sound/foamSprayLoop.HSSS.5000.wav diff --git a/data/sound/foot1.TIP.30.wav b/data/sound/foot1.TIP.3000.wav similarity index 100% rename from data/sound/foot1.TIP.30.wav rename to data/sound/foot1.TIP.3000.wav diff --git a/data/sound/foot2.TAP.30.wav b/data/sound/foot2.TAP.3000.wav similarity index 100% rename from data/sound/foot2.TAP.30.wav rename to data/sound/foot2.TAP.3000.wav diff --git a/data/sound/foot3.TAPP.40.wav b/data/sound/foot3.TAPP.4000.wav similarity index 100% rename from data/sound/foot3.TAPP.40.wav rename to data/sound/foot3.TAPP.4000.wav diff --git a/data/sound/glassShat1.CRSNK.80.wav b/data/sound/glassShat1.CRSNK.8000.wav similarity index 100% rename from data/sound/glassShat1.CRSNK.80.wav rename to data/sound/glassShat1.CRSNK.8000.wav diff --git a/data/sound/glassShat2.CRNKL.80.wav b/data/sound/glassShat2.CRNKL.8000.wav similarity index 100% rename from data/sound/glassShat2.CRNKL.80.wav rename to data/sound/glassShat2.CRNKL.8000.wav diff --git a/data/sound/glassShat3.CRNK.80.wav b/data/sound/glassShat3.CRNK.8000.wav similarity index 100% rename from data/sound/glassShat3.CRNK.80.wav rename to data/sound/glassShat3.CRNK.8000.wav diff --git a/data/sound/glassShat4.CRSK.80.wav b/data/sound/glassShat4.CRSK.8000.wav similarity index 100% rename from data/sound/glassShat4.CRSK.80.wav rename to data/sound/glassShat4.CRSK.8000.wav diff --git a/data/sound/grunt.HNH.50.wav b/data/sound/grunt.HNH.5000.wav similarity index 100% rename from data/sound/grunt.HNH.50.wav rename to data/sound/grunt.HNH.5000.wav diff --git a/data/sound/heal.BLIH.20.wav b/data/sound/heal.BLIH.2000.wav similarity index 100% rename from data/sound/heal.BLIH.20.wav rename to data/sound/heal.BLIH.2000.wav diff --git a/data/sound/hit.THUD.30.wav b/data/sound/hit.THUD.3000.wav similarity index 100% rename from data/sound/hit.THUD.30.wav rename to data/sound/hit.THUD.3000.wav diff --git a/data/sound/hit1.SMACK.40.wav b/data/sound/hit1.SMACK.4000.wav similarity index 100% rename from data/sound/hit1.SMACK.40.wav rename to data/sound/hit1.SMACK.4000.wav diff --git a/data/sound/impact1.CRASH.80.wav b/data/sound/impact1.CRASH.8000.wav similarity index 100% rename from data/sound/impact1.CRASH.80.wav rename to data/sound/impact1.CRASH.8000.wav diff --git a/data/sound/impact2.CRUNK.80.wav b/data/sound/impact2.CRUNK.8000.wav similarity index 100% rename from data/sound/impact2.CRUNK.80.wav rename to data/sound/impact2.CRUNK.8000.wav diff --git a/data/sound/impact3.CRUMPLE.80.wav b/data/sound/impact3.CRUMPLE.8000.wav similarity index 100% rename from data/sound/impact3.CRUMPLE.80.wav rename to data/sound/impact3.CRUMPLE.8000.wav diff --git a/data/sound/impact4.CRISH.80.wav b/data/sound/impact4.CRISH.8000.wav similarity index 100% rename from data/sound/impact4.CRISH.80.wav rename to data/sound/impact4.CRISH.8000.wav diff --git a/data/sound/knife.SWSH.20.wav b/data/sound/knife.SWSH.2000.wav similarity index 100% rename from data/sound/knife.SWSH.20.wav rename to data/sound/knife.SWSH.2000.wav diff --git a/data/sound/mini.BRPBRPBRP.120.wav b/data/sound/mini.BRPBRPBRP.12000.wav similarity index 100% rename from data/sound/mini.BRPBRPBRP.120.wav rename to data/sound/mini.BRPBRPBRP.12000.wav diff --git a/data/sound/mini1.BRDBRDBRD.120.wav b/data/sound/mini1.BRDBRDBRD.12000.wav similarity index 100% rename from data/sound/mini1.BRDBRDBRD.120.wav rename to data/sound/mini1.BRDBRDBRD.12000.wav diff --git a/data/sound/missileLaunch.WHSSH.100.wav b/data/sound/missileLaunch.WHSSH.10000.wav similarity index 100% rename from data/sound/missileLaunch.WHSSH.100.wav rename to data/sound/missileLaunch.WHSSH.10000.wav diff --git a/data/sound/nondata/Cranking-Gear--Faster--www.fesliyanstudios.com.mp3 b/data/sound/nondata/Cranking-Gear--Faster--www.fesliyanstudios.com.mp3 deleted file mode 100644 index ae2586da9..000000000 Binary files a/data/sound/nondata/Cranking-Gear--Faster--www.fesliyanstudios.com.mp3 and /dev/null differ diff --git a/data/sound/nondata/Cranking-Gears--Fast--www.fesliyanstudios.com.mp3 b/data/sound/nondata/Cranking-Gears--Fast--www.fesliyanstudios.com.mp3 deleted file mode 100644 index 05ad3f371..000000000 Binary files a/data/sound/nondata/Cranking-Gears--Fast--www.fesliyanstudios.com.mp3 and /dev/null differ diff --git a/data/sound/nondata/Cranking-Gears--Medium--www.fesliyanstudios.com.mp3 b/data/sound/nondata/Cranking-Gears--Medium--www.fesliyanstudios.com.mp3 deleted file mode 100644 index 9db638493..000000000 Binary files a/data/sound/nondata/Cranking-Gears--Medium--www.fesliyanstudios.com.mp3 and /dev/null differ diff --git a/data/sound/nondata/Cranking-Gears--Slow--www.fesliyanstudios.com.mp3 b/data/sound/nondata/Cranking-Gears--Slow--www.fesliyanstudios.com.mp3 deleted file mode 100644 index 142c50518..000000000 Binary files a/data/sound/nondata/Cranking-Gears--Slow--www.fesliyanstudios.com.mp3 and /dev/null differ diff --git a/data/sound/nondata/Electrical-Welding-Metal-Long-A1-www.fesliyanstudios.com.mp3 b/data/sound/nondata/Electrical-Welding-Metal-Long-A1-www.fesliyanstudios.com.mp3 deleted file mode 100644 index fe3c89d2f..000000000 Binary files a/data/sound/nondata/Electrical-Welding-Metal-Long-A1-www.fesliyanstudios.com.mp3 and /dev/null differ diff --git a/data/sound/nondata/Electrical-Welding.mp3 b/data/sound/nondata/Electrical-Welding.mp3 deleted file mode 100644 index bafeee3b9..000000000 Binary files a/data/sound/nondata/Electrical-Welding.mp3 and /dev/null differ diff --git a/data/sound/nondata/Rifle-Automatic-Fire-B-www.fesliyanstudios.com.mp3 b/data/sound/nondata/Rifle-Automatic-Fire-B-www.fesliyanstudios.com.mp3 deleted file mode 100644 index 3921b7485..000000000 Binary files a/data/sound/nondata/Rifle-Automatic-Fire-B-www.fesliyanstudios.com.mp3 and /dev/null differ diff --git a/data/sound/nondata/reload.aup b/data/sound/nondata/reload.aup deleted file mode 100644 index 6f964cf1b..000000000 --- a/data/sound/nondata/reload.aup +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/sound/nondata/tap.aup b/data/sound/nondata/tap.aup deleted file mode 100644 index de6e7917f..000000000 --- a/data/sound/nondata/tap.aup +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/sound/nondata/twoStep.aup b/data/sound/nondata/twoStep.aup deleted file mode 100644 index aced3bdc9..000000000 --- a/data/sound/nondata/twoStep.aup +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/sound/pickUp.SHUHP.20.wav b/data/sound/pickUp.SHUHP.2000.wav similarity index 100% rename from data/sound/pickUp.SHUHP.20.wav rename to data/sound/pickUp.SHUHP.2000.wav diff --git a/data/sound/reload.TNKTNKTNK.30.wav b/data/sound/reload.TNKTNKTNK.3000.wav similarity index 100% rename from data/sound/reload.TNKTNKTNK.30.wav rename to data/sound/reload.TNKTNKTNK.3000.wav diff --git a/data/sound/reload1.CHPCHPCHP.30.wav b/data/sound/reload1.CHPCHPCHP.3000.wav similarity index 100% rename from data/sound/reload1.CHPCHPCHP.30.wav rename to data/sound/reload1.CHPCHPCHP.3000.wav diff --git a/data/sound/shotgun.BRAHCHCH.100.wav b/data/sound/shotgun.BRAHCHCH.10000.wav similarity index 100% rename from data/sound/shotgun.BRAHCHCH.100.wav rename to data/sound/shotgun.BRAHCHCH.10000.wav diff --git a/data/sound/sineRaisePitchOneSec.BWAH.30.wav b/data/sound/sineRaisePitchOneSec.BWAH.3000.wav similarity index 100% rename from data/sound/sineRaisePitchOneSec.BWAH.30.wav rename to data/sound/sineRaisePitchOneSec.BWAH.3000.wav diff --git a/data/sound/sineRaisePitchTwoSec.BWAAH.30.wav b/data/sound/sineRaisePitchTwoSec.BWAAH.3000.wav similarity index 100% rename from data/sound/sineRaisePitchTwoSec.BWAAH.30.wav rename to data/sound/sineRaisePitchTwoSec.BWAAH.3000.wav diff --git a/data/sound/skwareFadeTwoSec.DWAAH.30.wav b/data/sound/skwareFadeTwoSec.DWAAH.3000.wav similarity index 100% rename from data/sound/skwareFadeTwoSec.DWAAH.30.wav rename to data/sound/skwareFadeTwoSec.DWAAH.3000.wav diff --git a/data/sound/slideDoor.DRR.30.wav b/data/sound/slideDoor.DRR.3000.wav similarity index 100% rename from data/sound/slideDoor.DRR.30.wav rename to data/sound/slideDoor.DRR.3000.wav diff --git a/data/sound/smallGlass1.TRINKL.50.wav b/data/sound/smallGlass1.TRINKL.5000.wav similarity index 100% rename from data/sound/smallGlass1.TRINKL.50.wav rename to data/sound/smallGlass1.TRINKL.5000.wav diff --git a/data/sound/smallGlass2.KRTNKL.50.wav b/data/sound/smallGlass2.KRTNKL.5000.wav similarity index 100% rename from data/sound/smallGlass2.KRTNKL.50.wav rename to data/sound/smallGlass2.KRTNKL.5000.wav diff --git a/data/sound/smallGlass3.CRTINK.50.wav b/data/sound/smallGlass3.CRTINK.5000.wav similarity index 100% rename from data/sound/smallGlass3.CRTINK.50.wav rename to data/sound/smallGlass3.CRTINK.5000.wav diff --git a/data/sound/smallGlass4.TINKLE.50.wav b/data/sound/smallGlass4.TINKLE.5000.wav similarity index 100% rename from data/sound/smallGlass4.TINKLE.50.wav rename to data/sound/smallGlass4.TINKLE.5000.wav diff --git a/data/sound/tap1.TAK.80.wav b/data/sound/tap1.TAK.8000.wav similarity index 100% rename from data/sound/tap1.TAK.80.wav rename to data/sound/tap1.TAK.8000.wav diff --git a/data/sound/tap2.TAKH.80.wav b/data/sound/tap2.TAKH.8000.wav similarity index 100% rename from data/sound/tap2.TAKH.80.wav rename to data/sound/tap2.TAKH.8000.wav diff --git a/data/sound/tap3.BRAP.80.wav b/data/sound/tap3.BRAP.8000.wav similarity index 100% rename from data/sound/tap3.BRAP.80.wav rename to data/sound/tap3.BRAP.8000.wav diff --git a/data/sound/tap4.THUD.50.wav b/data/sound/tap4.FWUMP.5000.wav similarity index 100% rename from data/sound/tap4.THUD.50.wav rename to data/sound/tap4.FWUMP.5000.wav diff --git a/data/sound/tapQuiet.BRAP.40.wav b/data/sound/tapQuiet.CLNK.4000.wav similarity index 100% rename from data/sound/tapQuiet.BRAP.40.wav rename to data/sound/tapQuiet.CLNK.4000.wav diff --git a/data/sound/tele.ZHM.100.wav b/data/sound/tele.ZHM.10000.wav similarity index 100% rename from data/sound/tele.ZHM.100.wav rename to data/sound/tele.ZHM.10000.wav diff --git a/data/sound/tinitus.RINGGG.80.wav b/data/sound/tinitus.RINGGG.8000.wav similarity index 100% rename from data/sound/tinitus.RINGGG.80.wav rename to data/sound/tinitus.RINGGG.8000.wav diff --git a/data/sound/tone440.BEP.80.wav b/data/sound/tone440.BEP.8000.wav similarity index 100% rename from data/sound/tone440.BEP.80.wav rename to data/sound/tone440.BEP.8000.wav diff --git a/data/sound/tone440sawtooth.SCREE.100.wav b/data/sound/tone440sawtooth.SCREE.10000.wav similarity index 100% rename from data/sound/tone440sawtooth.SCREE.100.wav rename to data/sound/tone440sawtooth.SCREE.10000.wav diff --git a/data/sound/twoStep.TIPTAP.40.wav b/data/sound/twoStep.TIPTAP.4000.wav similarity index 100% rename from data/sound/twoStep.TIPTAP.40.wav rename to data/sound/twoStep.TIPTAP.4000.wav diff --git a/data/sound/twoStep1.TAPTIP.60.wav b/data/sound/twoStep1.TAPTIP.6000.wav similarity index 100% rename from data/sound/twoStep1.TAPTIP.60.wav rename to data/sound/twoStep1.TAPTIP.6000.wav diff --git a/data/sound/twoStepSlow.TIPTOP.40.wav b/data/sound/twoStepSlow.TIPTOP.4000.wav similarity index 100% rename from data/sound/twoStepSlow.TIPTOP.40.wav rename to data/sound/twoStepSlow.TIPTOP.4000.wav diff --git a/data/sound/whiteNoiseFadeIn.FHP.20.wav b/data/sound/whiteNoiseFadeIn.FHP.2000.wav similarity index 100% rename from data/sound/whiteNoiseFadeIn.FHP.20.wav rename to data/sound/whiteNoiseFadeIn.FHP.2000.wav diff --git a/data/sound/whiteNoiseFadeOut.PHF.20.wav b/data/sound/whiteNoiseFadeOut.PHF.2000.wav similarity index 100% rename from data/sound/whiteNoiseFadeOut.PHF.20.wav rename to data/sound/whiteNoiseFadeOut.PHF.2000.wav diff --git a/src/Dodge/Creature/Action.hs b/src/Dodge/Creature/Action.hs index d547362d3..9c135422a 100644 --- a/src/Dodge/Creature/Action.hs +++ b/src/Dodge/Creature/Action.hs @@ -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) whiteNoiseFadeOutS Nothing + $ soundStart (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) pickUpS Nothing + & soundStart (CrSound cid) (_flItPos flit) pickUpS Nothing & updateItLocation i & floorItems %~ IM.delete (_flItID flit) & creatures . ix cid . crInv . ix i %~ addItem it diff --git a/src/Dodge/Creature/Impulse.hs b/src/Dodge/Creature/Impulse.hs index e6d7b036c..323766102 100644 --- a/src/Dodge/Creature/Impulse.hs +++ b/src/Dodge/Creature/Impulse.hs @@ -58,7 +58,7 @@ followImpulse cr w imp = case imp of (hitCr cid' , crMvBy (10 *.* normalizeV (posFromID cid' -.- cpos)) $ cr & crMeleeCooldown .~ 20) -- randomise cooldown? 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 ChangeStrategy strat -> (id, cr & crActionPlan . crStrategy .~ strat) 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' rr a = fst $ randomR (-a,a) $ _randGen w 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 diff --git a/src/Dodge/Creature/Perception.hs b/src/Dodge/Creature/Perception.hs index c62af7a78..67444080b 100644 --- a/src/Dodge/Creature/Perception.hs +++ b/src/Dodge/Creature/Perception.hs @@ -91,9 +91,9 @@ awakeLevelPerception cr = case _crAwakeLevel $ _crPerception cr of newSounds :: World -> [(Point2,Float)] newSounds = mapMaybe f . M.elems . _playingSounds where - f s | _soundStatus s == JustStartedPlaying - = Just (_soundPos s, _soundVolume s) - | otherwise = Nothing + f s = case _soundStatus s of + JustStartedPlaying -> Just (_soundPos s, _soundVolume s) + _ -> Nothing rememberSounds :: Creature -> Reader World Creature rememberSounds cr = do diff --git a/src/Dodge/Creature/State.hs b/src/Dodge/Creature/State.hs index 55a1d0343..a4d307c45 100644 --- a/src/Dodge/Creature/State.hs +++ b/src/Dodge/Creature/State.hs @@ -52,7 +52,7 @@ stateUpdate u cr w = case u (updateMovement cr) w of | otherwise = Nothing deathEff | cr ^.crHP > 0 = id - | otherwise = stopSoundFrom (CrWeaponSound (_crID cr)) + | otherwise = stopSoundFrom (CrWeaponSound (_crID cr) 0) . over decorations addCorpse . dropByState cr addCorpse = IM.insertNewKey @@ -137,11 +137,11 @@ invSideEff cr w = weaponReloadSounds cr $ IM.foldrWithKey f w (_crInv cr) weaponReloadSounds :: Creature -> World -> World weaponReloadSounds cr w = case _crInv cr IM.!? _crInvSel cr of 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 Just Weapon{_wpReloadState = 0} -> 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 where cid = _crID cr diff --git a/src/Dodge/Data/SoundOrigin.hs b/src/Dodge/Data/SoundOrigin.hs index ab80da764..b47d4c495 100644 --- a/src/Dodge/Data/SoundOrigin.hs +++ b/src/Dodge/Data/SoundOrigin.hs @@ -4,7 +4,7 @@ data SoundOrigin = InventorySound | BackgroundSound | OnceSound | CrSound Int - | CrWeaponSound Int + | CrWeaponSound Int Int | WallSound Int | CrReloadSound Int | Flamer diff --git a/src/Dodge/Default.hs b/src/Dodge/Default.hs index 388726e9a..e86e20b94 100644 --- a/src/Dodge/Default.hs +++ b/src/Dodge/Default.hs @@ -215,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) click1S Nothing $ w + . soundStart (LeverSound 0) (_btPos b) click1S Nothing $ w , _btID = 0 , _btText = "Button" , _btState = BtOff diff --git a/src/Dodge/Initialisation.hs b/src/Dodge/Initialisation.hs index f85430a9e..52e88b5df 100644 --- a/src/Dodge/Initialisation.hs +++ b/src/Dodge/Initialisation.hs @@ -47,7 +47,7 @@ initialWorld = defaultWorld , _mousePos = V2 0 0 , _testString = testStringInit , _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]] , _pressPlates = IM.empty , _buttons = IM.empty diff --git a/src/Dodge/Item/Consumable.hs b/src/Dodge/Item/Consumable.hs index 51883a211..9c71dc45b 100644 --- a/src/Dodge/Item/Consumable.hs +++ b/src/Dodge/Item/Consumable.hs @@ -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) healS Nothing w + | otherwise = Just $ soundStart (CrSound $ _crID cr) (_crPos cr) healS Nothing w & creatures . ix n . crHP %~ min 10000 . (+ hp) where cr = _creatures w IM.! n diff --git a/src/Dodge/Item/Weapon.hs b/src/Dodge/Item/Weapon.hs index 59231572d..e9274c4f6 100644 --- a/src/Dodge/Item/Weapon.hs +++ b/src/Dodge/Item/Weapon.hs @@ -66,7 +66,7 @@ pistol = defaultGun [ ammoCheckI , hammerCheckI , useTimeCheckI - , withSoundI tap3S + , withSoundStart tap3S , useAmmo 1 , randSpreadDir , withMuzFlareI @@ -296,7 +296,7 @@ hvAutoGun = defaultAutoGun , _itUseModifiers = [ ammoCheckI , rateIncABI 24 7 (torqueBeforeAtLeast 0.1 0.1) (torqueAfterI 0.2) - , withSoundI bangEchoS + , withSoundStart bangEchoS , withThinSmokeI , withMuzFlareI ] @@ -323,7 +323,7 @@ ltAutoGun = defaultAutoGun , _itUseModifiers = [ ammoCheckI , useTimeCheckI - , withSoundI tap1S + , withSoundStart tap1S , useAmmo 1 , withRandomDirI 0.1 , torqueAfterI 0.2 @@ -429,7 +429,7 @@ spreadGun = defaultGun [ ammoCheckI , hammerCheckI , useTimeCheckI - , withSoundI shotgunS + , withSoundStart shotgunS , useAmmo 1 , withRecoilI 100 , withMuzFlareI @@ -461,7 +461,7 @@ multGun = defaultGun [ ammoCheckI , hammerCheckI , useTimeCheckI - , withSoundI shotgunS + , withSoundStart shotgunS , useAmmo 1 , withRecoilI 200 , withMuzFlareI @@ -507,7 +507,7 @@ longGun = defaultGun [ ammoCheckI , hammerCheckI , useTimeCheckI - , withSoundI bangEchoS + , withSoundStart bangEchoS , useAmmo 1 , withThickSmokeI , torqueAfterI 0.05 @@ -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 tapQuietS Nothing $ halfV updatedWorld + Just (p,_) -> soundStart (Tap 0) p tapQuietS Nothing $ halfV updatedWorld _ -> halfV updatedWorld | otherwise = case hitWl of - Just (p,_) -> soundFrom (Tap 0) p tapQuietS Nothing updatedWorld + Just (p,_) -> soundStart (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 tap4S Nothing + $ soundStart (CrWeaponSound cid 0) 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 missileLaunchS (Just 1) + & soundContinue (ShellSound i) newPos missileLaunchS (Just 1) & smokeGen & makeFlameletTimed oldPos 20 (0.5 *.* rotateV (pi+sparkD) accel) Nothing 3 10 | time > -200 = case thingHit of diff --git a/src/Dodge/Item/Weapon/Bezier.hs b/src/Dodge/Item/Weapon/Bezier.hs index d7e217e3a..45bed8ac7 100644 --- a/src/Dodge/Item/Weapon/Bezier.hs +++ b/src/Dodge/Item/Weapon/Bezier.hs @@ -29,7 +29,7 @@ bezierGun = defaultGun , _itUse = \_ -> useTargetPos $ \p -> shootBezier $ fromJust p -- <- the start point , _itUseModifiers = [ useTimeCheckI - , withSoundI tap2S + , withSoundStart tap2S , useAmmo 1 , withMuzFlareI . withRecoilI 40 diff --git a/src/Dodge/Item/Weapon/Grenade.hs b/src/Dodge/Item/Weapon/Grenade.hs index b876916a8..e78d7cd55 100644 --- a/src/Dodge/Item/Weapon/Grenade.hs +++ b/src/Dodge/Item/Weapon/Grenade.hs @@ -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 tapQuietS Nothing updatedWorld + Just (p,_) -> soundStart (Tap 0) p tapQuietS Nothing updatedWorld _ -> updatedWorld where updatedWorld = updateV $ set (projectiles . ix pID . pjPos) finalPos diff --git a/src/Dodge/Item/Weapon/Launcher.hs b/src/Dodge/Item/Weapon/Launcher.hs index 675be0b29..bc5fdbb5d 100644 --- a/src/Dodge/Item/Weapon/Launcher.hs +++ b/src/Dodge/Item/Weapon/Launcher.hs @@ -43,7 +43,7 @@ launcher = defaultGun , _itUseModifiers = [ ammoCheckI , useTimeCheckI - , withSoundI tap4S + , withSoundStart 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 missileLaunchS (Just 1) + & soundContinue (ShellSound i) newPos missileLaunchS (Just 1) & makeFlameletTimed (oldPos -.- vel) 0 (vel +.+ rotateV (pi+sparkD) accel) Nothing 3 10 & smokeGen where diff --git a/src/Dodge/Item/Weapon/TriggerType.hs b/src/Dodge/Item/Weapon/TriggerType.hs index 70087f1f6..c59434653 100644 --- a/src/Dodge/Item/Weapon/TriggerType.hs +++ b/src/Dodge/Item/Weapon/TriggerType.hs @@ -12,7 +12,8 @@ module Dodge.Item.Weapon.TriggerType , torqueBefore , torqueBeforeAtLeast , torqueAfterI - , withSoundI + , withSoundStart + , withSoundContinue , withSoundForI , withThickSmokeI , withThinSmokeI @@ -128,7 +129,7 @@ withWarmUpI soundID f item cr w | _wpReloadState item /= 0 = w | curWarmUp < maxWarmUp = w & pointerToItem . wpCurWarmUp +~ 2 - & soundFrom (CrWeaponSound cid) (_crPos cr) soundID (Just 2) + & soundContinue (CrWeaponSound cid 0) (_crPos cr) soundID (Just 2) | otherwise = w & pointerToItem . wpCurWarmUp .~ maxWarmUp & f item cr @@ -140,11 +141,22 @@ withWarmUpI soundID f item cr w maxWarmUp = _wpMaxWarmUp item {- | Adds a sound to a creature based world effect. The sound is emitted from the creature's position. -} -withSoundI +withSoundStart :: SoundID -- ^ Sound id -> ChainEffect -withSoundI soundid f item cr - = soundFrom (CrWeaponSound cid) (_crPos cr) soundid Nothing +withSoundStart soundid f item cr + = 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 where cid = _crID cr @@ -156,7 +168,7 @@ withSoundForI -> Int -- ^ Frames to play -> ChainEffect 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 afterRecoil diff --git a/src/Dodge/LevelGen/MoveDoor.hs b/src/Dodge/LevelGen/MoveDoor.hs index 299adbf15..e5b14e949 100644 --- a/src/Dodge/LevelGen/MoveDoor.hs +++ b/src/Dodge/LevelGen/MoveDoor.hs @@ -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 slideDoorS (Just 1) $ dm w + = soundContinue (WallSound i) wp slideDoorS (Just 1) $ dm w | otherwise = dm w where wp = fst $ _wlLine (_walls w IM.! i) diff --git a/src/Dodge/SoundLogic.hs b/src/Dodge/SoundLogic.hs index db20eff70..8e35a8460 100644 --- a/src/Dodge/SoundLogic.hs +++ b/src/Dodge/SoundLogic.hs @@ -6,8 +6,8 @@ This module allows us to talk to the "Sound" module. -} module Dodge.SoundLogic ( -- * Manipulation of individual sounds - soundOnceOrigin - , soundFrom + soundStart + , soundContinue , soundFromGeneral , soundMultiFrom , stopSoundFrom @@ -22,7 +22,6 @@ import Dodge.Data.SoundOrigin import Sound.Data import Geometry.Data import Geometry.Vector -import Dodge.SoundLogic.Synonyms import Dodge.SoundLogic.LoadSound import Control.Lens @@ -41,41 +40,20 @@ pauseSound w = w resumeSound :: World -> World resumeSound w = w -{-| Play a sound once, with a given origin. -For each origin only one sound will play at a time. --} -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 +soundWithStatus + :: SoundStatus + -> 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 -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 sound = Sound { _soundChunkID = sType , _soundTime = mtime - , _soundStatus = ToStart + , _soundStatus = status , _soundChannel = Nothing , _soundAngDist = Just (a,0) , _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 } 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 :: SoundOrigin -- ^ \"Creator\" of sound -> (World -> Point2) -- ^ Position of sound @@ -130,8 +125,21 @@ soundMultiFrom -> World -> World 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 - | 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 where sound = Sound diff --git a/src/Dodge/SoundLogic/LoadSound.hs b/src/Dodge/SoundLogic/LoadSound.hs index 6f2e27d45..7f5900962 100644 --- a/src/Dodge/SoundLogic/LoadSound.hs +++ b/src/Dodge/SoundLogic/LoadSound.hs @@ -16,303 +16,303 @@ loadSounds = do 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 + 0 -> 5000 + 1 -> 8000 + 2 -> 8000 + 3 -> 5000 + 4 -> 3000 + 5 -> 3000 + 6 -> 4000 + 7 -> 5000 + 8 -> 10000 + 9 -> 8000 + 10 -> 8000 + 11 -> 8000 + 12 -> 8000 + 13 -> 10000 + 14 -> 3000 + 15 -> 4000 + 16 -> 5000 + 17 -> 5000 + 18 -> 20000 + 19 -> 4000 + 20 -> 10000 + 21 -> 8000 + 22 -> 4000 + 23 -> 2000 + 24 -> 6000 + 25 -> 500 + 26 -> 5000 + 27 -> 8000 + 28 -> 8000 + 29 -> 8000 + 30 -> 5000 + 31 -> 8000 + 32 -> 4000 + 33 -> 3000 + 34 -> 8000 + 35 -> 2000 + 36 -> 10000 + 37 -> 5000 + 38 -> 2000 + 39 -> 3000 + 40 -> 12000 + 41 -> 5000 + 42 -> 10000 + 43 -> 12000 + 44 -> 2000 + 45 -> 3000 + 46 -> 8000 + 47 -> 5000 + 48 -> 2000 + 49 -> 3000 + 50 -> 10000 + 51 -> 10000 + 52 -> 3000 + 53 -> 15000 + 54 -> 10000 + 55 -> 3000 + 56 -> 15000 + 57 -> 8000 _ -> 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" + 0 -> "HNH" + 1 -> "CRNKL" + 2 -> "ZMM" + 3 -> "KRTNKL" + 4 -> "DWAAH" + 5 -> "BWAH" + 6 -> "TIPTOP" + 7 -> "TINKLE" + 8 -> "TATATA" + 9 -> "CRSK" + 10 -> "CRNK" + 11 -> "TAKH" + 12 -> "CRUNK" + 13 -> "SCREE" + 14 -> "TNKTNKTNK" + 15 -> "TIPTAP" + 16 -> "WRR" + 17 -> "HSS" + 18 -> "BOOM" + 19 -> "CLNK" + 20 -> "BRAP" + 21 -> "CRSNK" + 22 -> "TAPP" + 23 -> "BLIH" + 24 -> "TAPTIP" + 25 -> "CLICK" + 26 -> "FWUMP" + 27 -> "RINGGG" 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" + 29 -> "CRUMPLE" + 30 -> "TRINKL" + 31 -> "TAK" + 32 -> "SMACK" + 33 -> "DRR" + 34 -> "CRASH" + 35 -> "SWSH" + 36 -> "CRAKLE" + 37 -> "CRTINK" + 38 -> "FHP" + 39 -> "CHPCHPCHP" + 40 -> "BRPBRPBRP" + 41 -> "CHNKCHNKCHUNK" + 42 -> "WRRR" + 43 -> "BRDBRDBRD" + 44 -> "PHF" + 45 -> "BWAAH" + 46 -> "BEP" + 47 -> "HSSS" + 48 -> "SHUHP" + 49 -> "THUD" + 50 -> "WHSSH" + 51 -> "BRAHCHCH" + 52 -> "TIP" + 53 -> "BANGG" + 54 -> "ZHM" + 55 -> "TAP" + 56 -> "BANG" + 57 -> "CRISH" _ -> 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" + [ "grunt.HNH.5000.wav" + , "glassShat2.CRNKL.8000.wav" + , "buzz.ZMM.8000.wav" + , "smallGlass2.KRTNKL.5000.wav" + , "skwareFadeTwoSec.DWAAH.3000.wav" + , "sineRaisePitchOneSec.BWAH.3000.wav" + , "twoStepSlow.TIPTOP.4000.wav" + , "smallGlass4.TINKLE.5000.wav" + , "autoB.TATATA.10000.wav" + , "glassShat4.CRSK.8000.wav" + , "glassShat3.CRNK.8000.wav" + , "tap2.TAKH.8000.wav" + , "impact2.CRUNK.8000.wav" + , "tone440sawtooth.SCREE.10000.wav" + , "reload.TNKTNKTNK.3000.wav" + , "twoStep.TIPTAP.4000.wav" + , "fire.WRR.5000.wav" + , "foamSprayFadeOut.HSS.5000.wav" + , "explosion.BOOM.20000.wav" + , "tapQuiet.CLNK.4000.wav" + , "autoGun.BRAP.10000.wav" + , "glassShat1.CRSNK.8000.wav" + , "foot3.TAPP.4000.wav" + , "heal.BLIH.2000.wav" + , "twoStep1.TAPTIP.6000.wav" + , "click1.CLICK.500.wav" + , "tap4.FWUMP.5000.wav" + , "tinitus.RINGGG.8000.wav" + , "tap3.BRAP.8000.wav" + , "impact3.CRUMPLE.8000.wav" + , "smallGlass1.TRINKL.5000.wav" + , "tap1.TAK.8000.wav" + , "hit1.SMACK.4000.wav" + , "slideDoor.DRR.3000.wav" + , "impact1.CRASH.8000.wav" + , "knife.SWSH.2000.wav" + , "elecCrackle.CRAKLE.10000.wav" + , "smallGlass3.CRTINK.5000.wav" + , "whiteNoiseFadeIn.FHP.2000.wav" + , "reload1.CHPCHPCHP.3000.wav" + , "mini.BRPBRPBRP.12000.wav" + , "crankSlow.CHNKCHNKCHUNK.5000.wav" + , "fireLoud.WRRR.10000.wav" + , "mini1.BRDBRDBRD.12000.wav" + , "whiteNoiseFadeOut.PHF.2000.wav" + , "sineRaisePitchTwoSec.BWAAH.3000.wav" + , "tone440.BEP.8000.wav" + , "foamSprayLoop.HSSS.5000.wav" + , "pickUp.SHUHP.2000.wav" + , "hit.THUD.3000.wav" + , "missileLaunch.WHSSH.10000.wav" + , "shotgun.BRAHCHCH.10000.wav" + , "foot1.TIP.3000.wav" + , "bangEcho.BANGG.15000.wav" + , "tele.ZHM.10000.wav" + , "foot2.TAP.3000.wav" + , "bang.BANG.15000.wav" + , "impact4.CRISH.8000.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 +gruntS :: SoundID +gruntS = SoundID 0 +glassShat2S :: SoundID +glassShat2S = SoundID 1 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 28 -gruntS :: SoundID -gruntS = SoundID 29 -reload1S :: SoundID -reload1S = SoundID 30 +impact3S :: SoundID +impact3S = SoundID 29 +smallGlass1S :: SoundID +smallGlass1S = SoundID 30 +tap1S :: SoundID +tap1S = SoundID 31 hit1S :: SoundID -hit1S = SoundID 31 -foamSprayLoopS :: SoundID -foamSprayLoopS = SoundID 32 -foamSprayFadeOutS :: SoundID -foamSprayFadeOutS = SoundID 33 -glassShat4S :: SoundID -glassShat4S = SoundID 34 +hit1S = SoundID 32 +slideDoorS :: SoundID +slideDoorS = SoundID 33 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 +impact1S = SoundID 34 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 +knifeS = SoundID 35 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 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 = do diff --git a/src/Dodge/SoundLogic/Synonyms.hs b/src/Dodge/SoundLogic/Synonyms.hs deleted file mode 100644 index 569c50474..000000000 --- a/src/Dodge/SoundLogic/Synonyms.hs +++ /dev/null @@ -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 diff --git a/src/Dodge/WorldEvent/Sound.hs b/src/Dodge/WorldEvent/Sound.hs index 8a6a2238a..d487f881a 100644 --- a/src/Dodge/WorldEvent/Sound.hs +++ b/src/Dodge/WorldEvent/Sound.hs @@ -7,17 +7,17 @@ import Dodge.SoundLogic.LoadSound import Geometry.Data import Dodge.RandomHelp -import System.Random +--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 +mkSoundBreakGlass p w = soundStart (GlassBreakSound 0) p soundid Nothing $ set randGen g w where (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 +mkSoundSplinterGlass p w = soundStart (GlassBreakSound 1) p soundid Nothing $ set randGen g w where (soundid,g) = _randGen w & runState (takeOne [smallGlass1S,smallGlass2S,smallGlass3S,smallGlass4S]) diff --git a/src/Dodge/WorldEvent/SpawnParticle.hs b/src/Dodge/WorldEvent/SpawnParticle.hs index 894ea8fe0..e58f52b25 100644 --- a/src/Dodge/WorldEvent/SpawnParticle.hs +++ b/src/Dodge/WorldEvent/SpawnParticle.hs @@ -99,7 +99,7 @@ moveFlame rotd w pt _ -> (glare $ doSound damcrs , mvPt) where 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 | time `mod` 5 == 0 = tempLightSources %~ (theTLS :) diff --git a/src/Sound.hs b/src/Sound.hs index aa66fad10..06c747aff 100644 --- a/src/Sound.hs +++ b/src/Sound.hs @@ -55,7 +55,7 @@ playSoundAndUpdate sData oldSounds newSounds mergeSound :: Sound -> Sound -> Sound mergeSound oldS newS - | _soundChunkID newS == _soundChunkID oldS + | _soundChunkID newS == _soundChunkID oldS && _soundStatus newS == ToContinueStart = newS & soundChannel .~ _soundChannel oldS & soundStatus .~ _soundStatus oldS | otherwise = newS & soundChannel .~ _soundChannel oldS @@ -74,6 +74,7 @@ updateSound sd s = initialisePlaying :: IM.IntMap Mix.Chunk -> Sound -> MaybeT IO Sound initialisePlaying sd s = case _soundStatus s of ToStart -> tryPlay sd s + ToContinueStart -> tryPlay sd s JustStartedPlaying -> return $ s & soundStatus .~ Playing _ -> return s diff --git a/src/Sound/Data.hs b/src/Sound/Data.hs index 461367f80..1a95ed673 100644 --- a/src/Sound/Data.hs +++ b/src/Sound/Data.hs @@ -13,6 +13,7 @@ data SoundStatus = JustStartedPlaying | Playing | ToStart + | ToContinueStart deriving (Eq,Ord,Show) newtype SoundID = SoundID { _getSoundID :: Int }