diff --git a/appDodge/Main.hs b/appDodge/Main.hs index 00ab221a7..3fbb7c0b1 100644 --- a/appDodge/Main.hs +++ b/appDodge/Main.hs @@ -18,7 +18,6 @@ import Render import Preload.Render import Sound import Preload -import Sound.Data import Music import Data.Preload import Data.Preload.Render diff --git a/src/Dodge/LockAndKey.hs b/src/Dodge/LockAndKey.hs index 2bbc9cace..cc3f9c4df 100644 --- a/src/Dodge/LockAndKey.hs +++ b/src/Dodge/LockAndKey.hs @@ -14,14 +14,14 @@ import Control.Monad.State lockRoomKeyItems :: RandomGen g => [ (Int -> State g (SubCompTree Room) , State g CombineType ) ] lockRoomKeyItems = - [(lasCenSensEdge, takeOne [LAUNCHER,LASGUN,SPARKGUN,FLATSHIELD] ) - ,(sensorRoomRunPast Electrical, return SPARKGUN ) +-- [(lasCenSensEdge, takeOne [LAUNCHER,LASGUN,SPARKGUN,FLATSHIELD] ) + [(sensorRoomRunPast Electrical, return SPARKGUN ) ,(sensorRoomRunPast Flaming, return FLAMESPITTER ) ,(sensorRoomRunPast Lasering, return LASGUN ) - ,(const slowDoorRoomRunPast, return MINIGUN) - ,(const longRoomRunPast, takeOne [SNIPERRIFLE,FLATSHIELD]) - ,(const glassLessonRunPast, takeOne [LASGUN]) - ,(const $ lasTunnelRunPast 400, return FLATSHIELD) +-- ,(const slowDoorRoomRunPast, return MINIGUN) +-- ,(const longRoomRunPast, takeOne [SNIPERRIFLE,FLATSHIELD]) +-- ,(const glassLessonRunPast, takeOne [LASGUN]) +-- ,(const $ lasTunnelRunPast 400, return FLATSHIELD) ] itemRooms :: RandomGen g => [(CombineType, State g (SubCompTree Room))] diff --git a/src/Dodge/Machine.hs b/src/Dodge/Machine.hs index cc54bd9c5..e58799088 100644 --- a/src/Dodge/Machine.hs +++ b/src/Dodge/Machine.hs @@ -2,6 +2,10 @@ module Dodge.Machine where import Dodge.Data import Dodge.Wall.Delete import LensHelp +import Sound.Data +import Dodge.SoundLogic +import Geometry +import Dodge.Base import qualified Data.IntMap.Strict as IM @@ -15,3 +19,11 @@ machineUpdateDeathEff f mc where dams = sum $ map _dmAmount $ _mcDamage mc mcid = _mcID mc + +machineAddSound :: SoundID -> (Machine -> World -> World) -> Machine -> World -> World +machineAddSound sid f mc w + | dist (_crPos $ you w) (_mcPos mc) < 100 + = soundContinue (MachineSound mid) (_mcPos mc) sid (Just 2) $ f mc w + | otherwise = f mc w + where + mid = _mcID mc diff --git a/src/Dodge/Placement/Instance/Terminal.hs b/src/Dodge/Placement/Instance/Terminal.hs index 4b8a92a95..2c3811a9d 100644 --- a/src/Dodge/Placement/Instance/Terminal.hs +++ b/src/Dodge/Placement/Instance/Terminal.hs @@ -6,6 +6,7 @@ import Dodge.Data import Dodge.LevelGen.Data import Dodge.Default import Dodge.Machine +import Dodge.SoundLogic import Dodge.WorldEvent.Explosion import Color import Geometry @@ -20,7 +21,8 @@ putTerminal f = PlacementGenUpdate g $ ps0PushPS (PutButton $ thebutton) $ \pl -> Just $ pt0 (PutMachine terminalColor (reverse $ square 10) defaultMachine { _mcDraw = drawTerminal , _mcHP = 100 - , _mcUpdate = machineUpdateDeathEff $ \mc -> (buttons . at (fromJust (_plMID pl)) .~ Nothing) + , _mcUpdate = machineAddSound fridgeHumS + $ machineUpdateDeathEff $ \mc -> (buttons . at (fromJust (_plMID pl)) .~ Nothing) . makeExplosionAt (_mcPos mc) }) $ const Nothing diff --git a/src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs b/src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs index 5fa5753b7..ac5793506 100644 --- a/src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs +++ b/src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs @@ -1,4 +1,4 @@ --- generated at 2021-11-21 23:26:56.911504724 UTC +-- generated at 2022-03-15 09:41:05.616513405 UTC module Dodge.SoundLogic.ExternallyGeneratedSounds where import Sound.Data soundToVol :: SoundID -> Float @@ -46,25 +46,29 @@ soundToVol v = case _getSoundID v of 40 -> 5000 41 -> 2000 42 -> 3000 - 43 -> 12000 - 44 -> 5000 - 45 -> 10000 - 46 -> 12000 - 47 -> 2000 - 48 -> 3000 - 49 -> 8000 - 50 -> 5000 - 51 -> 2000 - 52 -> 3000 - 53 -> 10000 - 54 -> 10000 - 55 -> 3000 - 56 -> 15000 + 43 -> 5000 + 44 -> 10000 + 45 -> 12000 + 46 -> 5000 + 47 -> 10000 + 48 -> 12000 + 49 -> 2000 + 50 -> 3000 + 51 -> 8000 + 52 -> 5000 + 53 -> 2000 + 54 -> 3000 + 55 -> 10000 + 56 -> 500 57 -> 10000 58 -> 3000 59 -> 15000 60 -> 10000 - 61 -> 8000 + 61 -> 3000 + 62 -> 1000 + 63 -> 15000 + 64 -> 10000 + 65 -> 8000 _ -> 50 soundToOnomato :: SoundID -> String soundToOnomato v = case _getSoundID v of @@ -111,25 +115,29 @@ soundToOnomato v = case _getSoundID v of 40 -> "CRTINK" 41 -> "FHP" 42 -> "CHPCHPCHP" - 43 -> "BRPBRPBRP" - 44 -> "CHNKCHNKCHUNK" - 45 -> "WRRR" - 46 -> "BRDBRDBRD" - 47 -> "PHF" - 48 -> "BWAAH" - 49 -> "BEP" - 50 -> "HSSS" - 51 -> "SHUHP" - 52 -> "THUD" - 53 -> "WHSSH" - 54 -> "BRAHCHCH" - 55 -> "TIP" - 56 -> "BANGG" - 57 -> "ZHM" - 58 -> "TAP" - 59 -> "BANG" - 60 -> "CHUGUGUG" - 61 -> "CRISH" + 43 -> "BIPBIPBIP" + 44 -> "CHUGUGUG" + 45 -> "BRPBRPBRP" + 46 -> "CHNKCHNKCHUNK" + 47 -> "WRRR" + 48 -> "BRDBRDBRD" + 49 -> "PHF" + 50 -> "BWAAH" + 51 -> "BEP" + 52 -> "HSSS" + 53 -> "SHUHP" + 54 -> "THUD" + 55 -> "WHSSH" + 56 -> "HMM" + 57 -> "BRAHCHCH" + 58 -> "TIP" + 59 -> "BANGG" + 60 -> "ZHM" + 61 -> "TAP" + 62 -> "BLPCHCH" + 63 -> "BANG" + 64 -> "CHUGUGUG" + 65 -> "CRISH" _ -> error "unitialised sound" soundPathList :: [String] soundPathList = @@ -176,6 +184,8 @@ soundPathList = , "smallGlass3.CRTINK.5000.wav" , "whiteNoiseFadeIn.FHP.2000.wav" , "reload1.CHPCHPCHP.3000.wav" + , "computerBeeping.BIPBIPBIP.5000.wav" + , "seagullChatter1.CHUGUGUG.10000.wav" , "mini.BRPBRPBRP.12000.wav" , "crankSlow.CHNKCHNKCHUNK.5000.wav" , "fireLoud.WRRR.10000.wav" @@ -187,11 +197,13 @@ soundPathList = , "pickUp.SHUHP.2000.wav" , "hit.THUD.3000.wav" , "missileLaunch.WHSSH.10000.wav" + , "fridgeHum.HMM.500.wav" , "shotgun.BRAHCHCH.10000.wav" , "foot1.TIP.3000.wav" , "bangEcho.BANGG.15000.wav" , "tele.ZHM.10000.wav" , "foot2.TAP.3000.wav" + , "oldMachineBoot.BLPCHCH.1000.wav" , "bang.BANG.15000.wav" , "seagullChatter.CHUGUGUG.10000.wav" , "impact4.CRISH.8000.wav" @@ -282,41 +294,49 @@ whiteNoiseFadeInS :: SoundID whiteNoiseFadeInS = SoundID 41 reload1S :: SoundID reload1S = SoundID 42 +computerBeepingS :: SoundID +computerBeepingS = SoundID 43 +seagullChatter1S :: SoundID +seagullChatter1S = SoundID 44 miniS :: SoundID -miniS = SoundID 43 +miniS = SoundID 45 crankSlowS :: SoundID -crankSlowS = SoundID 44 +crankSlowS = SoundID 46 fireLoudS :: SoundID -fireLoudS = SoundID 45 +fireLoudS = SoundID 47 mini1S :: SoundID -mini1S = SoundID 46 +mini1S = SoundID 48 whiteNoiseFadeOutS :: SoundID -whiteNoiseFadeOutS = SoundID 47 +whiteNoiseFadeOutS = SoundID 49 sineRaisePitchTwoSecS :: SoundID -sineRaisePitchTwoSecS = SoundID 48 +sineRaisePitchTwoSecS = SoundID 50 tone440S :: SoundID -tone440S = SoundID 49 +tone440S = SoundID 51 foamSprayLoopS :: SoundID -foamSprayLoopS = SoundID 50 +foamSprayLoopS = SoundID 52 pickUpS :: SoundID -pickUpS = SoundID 51 +pickUpS = SoundID 53 hitS :: SoundID -hitS = SoundID 52 +hitS = SoundID 54 missileLaunchS :: SoundID -missileLaunchS = SoundID 53 +missileLaunchS = SoundID 55 +fridgeHumS :: SoundID +fridgeHumS = SoundID 56 shotgunS :: SoundID -shotgunS = SoundID 54 +shotgunS = SoundID 57 foot1S :: SoundID -foot1S = SoundID 55 +foot1S = SoundID 58 bangEchoS :: SoundID -bangEchoS = SoundID 56 +bangEchoS = SoundID 59 teleS :: SoundID -teleS = SoundID 57 +teleS = SoundID 60 foot2S :: SoundID -foot2S = SoundID 58 +foot2S = SoundID 61 +oldMachineBootS :: SoundID +oldMachineBootS = SoundID 62 bangS :: SoundID -bangS = SoundID 59 +bangS = SoundID 63 seagullChatterS :: SoundID -seagullChatterS = SoundID 60 +seagullChatterS = SoundID 64 impact4S :: SoundID -impact4S = SoundID 61 +impact4S = SoundID 65 diff --git a/src/Sound.hs b/src/Sound.hs index 1168364c0..3378f2f52 100644 --- a/src/Sound.hs +++ b/src/Sound.hs @@ -17,6 +17,8 @@ module Sound ( -- * Volume Control , setSoundVolume , setMusicVolume + + , module Sound.Data ) where import Sound.Data