diff --git a/data/sound/seagullBark.UGGAUGGA.5000.wav b/data/sound/seagullBark.UGGAUGGA.5000.wav index 200ff470a..8e8af0b58 100644 Binary files a/data/sound/seagullBark.UGGAUGGA.5000.wav and b/data/sound/seagullBark.UGGAUGGA.5000.wav differ diff --git a/data/sound/seagullCry.CRUH.5000.wav b/data/sound/seagullCry.CRUH.5000.wav new file mode 100644 index 000000000..277568ff3 Binary files /dev/null and b/data/sound/seagullCry.CRUH.5000.wav differ diff --git a/data/sound/seagullWhistle1.PEW.10000.wav b/data/sound/seagullWhistle1.PEW.10000.wav new file mode 100644 index 000000000..a7f2755ca Binary files /dev/null and b/data/sound/seagullWhistle1.PEW.10000.wav differ diff --git a/src/Dodge/Creature/ChaseCrit.hs b/src/Dodge/Creature/ChaseCrit.hs index 775820f0b..f375de533 100644 --- a/src/Dodge/Creature/ChaseCrit.hs +++ b/src/Dodge/Creature/ChaseCrit.hs @@ -46,6 +46,11 @@ chaseCrit = defaultCreature , _crInv = IM.fromList [(0,medkit 200)] , _crMeleeCooldown = 0 , _crFaction = ColorFaction green - , _crVocalization = Vocalization seagullChatterS 50 0 + , _crVocalization = Vocalization seagullChatterS + [seagullBarkS + ,seagullChatterS,seagullWhistleS + ,seagullWhistle1S + ,seagullCryS + ] 50 0 , _crMvType = defaultChaseMvType } diff --git a/src/Dodge/Creature/Perception.hs b/src/Dodge/Creature/Perception.hs index 3b643a6cc..68129bf6b 100644 --- a/src/Dodge/Creature/Perception.hs +++ b/src/Dodge/Creature/Perception.hs @@ -64,6 +64,7 @@ basicAwarenessUpdate cr = case _crAttentionDir $ _crPerception cr of Nothing -> id | otherwise = id +-- TODO fold in randgen update, requires that this is a world to world function chaseCritAwarenessUpdate :: World -> Creature -> Creature chaseCritAwarenessUpdate w cr = case _crAttentionDir $ _crPerception cr of Fixated i -> cr & crPerception . crAwarenessLevel @@ -76,23 +77,19 @@ chaseCritAwarenessUpdate w cr = case _crAttentionDir $ _crPerception cr of oldAwareness = _crAwarenessLevel $ _crPerception cr newAwareness = (IM.mapMaybe decreaseAwareness . IM.unionWith combineAwareness is) oldAwareness becomesCognizant = any isCognizant $ IM.unionWith cogRaised oldAwareness newAwareness - randBool = takeOne [False,True] & evalState $ _randGen w + --randBool = takeOne [False,True] & evalState $ _randGen w thejitter = do p <- randInCirc 2 return $ Move p - maybeBark - | becomesCognizant && randBool = case vocalizationTest cr of - Just soundid -> crActionPlan . crStrategy .~ StrategyActions WarningCry - [ImpulsesList ([Bark soundid]: replicate 20 [RandomImpulse thejitter]++ - [[ChangeStrategy $ CloseToMelee 0] ]) - , AimAt 0 (_crPos $ _creatures w IM.! 0) - ] - --[ImpulsesList [Bark soundid: replicate 20 (RandomImpulse thejitter)] - -- `DoActionThen` 20 - -- `WaitThen` DoImpulses [ChangeStrategy $ CloseToMelee 0] - --, AimAt 0 (_crPos $ _creatures w IM.! 0) - --] - Nothing -> id + maybeBark + | becomesCognizant -- && randBool + && cr ^? crVocalization . vcCoolDown == Just 0 + = let soundid = evalState (takeOne (_vcWarnings (_crVocalization cr))) (_randGen w) + in crActionPlan . crStrategy .~ StrategyActions WarningCry + [ImpulsesList ([Bark soundid]: replicate 20 [RandomImpulse thejitter]++ + [[ChangeStrategy $ CloseToMelee 0] ]) + , AimAt 0 (_crPos $ _creatures w IM.! 0) + ] | otherwise = id cogRaised :: AwarenessLevel -> AwarenessLevel -> AwarenessLevel diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index 58e32eaaa..84f4feec3 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -299,6 +299,7 @@ data Vocalization = Mute | Vocalization {_vcSound :: SoundID + ,_vcWarnings :: [SoundID] ,_vcMaxCoolDown :: Int ,_vcCoolDown :: Int } diff --git a/src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs b/src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs index 529ffdcdd..1a992b37f 100644 --- a/src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs +++ b/src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs @@ -1,4 +1,4 @@ --- generated at 2022-03-22 15:35:37.255279739 UTC +-- generated at 2022-05-19 12:29:16.87589614 UTC module Dodge.SoundLogic.ExternallyGeneratedSounds where import Sound.Data soundToVol :: SoundID -> Float @@ -40,39 +40,41 @@ soundToVol v = case _getSoundID v of 34 -> 8000 35 -> 8000 36 -> 5000 - 37 -> 8000 - 38 -> 4000 - 39 -> 3000 - 40 -> 8000 - 41 -> 2000 - 42 -> 10000 - 43 -> 5000 - 44 -> 2000 - 45 -> 3000 - 46 -> 5000 - 47 -> 10000 - 48 -> 12000 - 49 -> 5000 - 50 -> 10000 - 51 -> 12000 - 52 -> 2000 - 53 -> 3000 - 54 -> 8000 - 55 -> 5000 - 56 -> 2000 - 57 -> 3000 - 58 -> 10000 - 59 -> 500 + 37 -> 10000 + 38 -> 8000 + 39 -> 4000 + 40 -> 3000 + 41 -> 8000 + 42 -> 2000 + 43 -> 10000 + 44 -> 5000 + 45 -> 2000 + 46 -> 3000 + 47 -> 5000 + 48 -> 10000 + 49 -> 12000 + 50 -> 5000 + 51 -> 5000 + 52 -> 10000 + 53 -> 12000 + 54 -> 2000 + 55 -> 3000 + 56 -> 8000 + 57 -> 5000 + 58 -> 2000 + 59 -> 3000 60 -> 10000 - 61 -> 3000 - 62 -> 15000 - 63 -> 10000 - 64 -> 3000 - 65 -> 1000 - 66 -> 15000 - 67 -> 10000 - 68 -> 5000 - 69 -> 8000 + 61 -> 500 + 62 -> 10000 + 63 -> 3000 + 64 -> 15000 + 65 -> 10000 + 66 -> 3000 + 67 -> 1000 + 68 -> 15000 + 69 -> 10000 + 70 -> 5000 + 71 -> 8000 _ -> 50 soundToOnomato :: SoundID -> String soundToOnomato v = case _getSoundID v of @@ -113,39 +115,41 @@ soundToOnomato v = case _getSoundID v of 34 -> "BRAP" 35 -> "CRUMPLE" 36 -> "TRINKL" - 37 -> "TAK" - 38 -> "SMACK" - 39 -> "DRR" - 40 -> "CRASH" - 41 -> "SWSH" - 42 -> "CRAKLE" - 43 -> "CRTINK" - 44 -> "FHP" - 45 -> "CHPCHPCHP" - 46 -> "BIPBIPBIP" - 47 -> "CHUGUGUG" - 48 -> "BRPBRPBRP" - 49 -> "CHNKCHNKCHUNK" - 50 -> "WRRR" - 51 -> "BRDBRDBRD" - 52 -> "PHF" - 53 -> "BWAAH" - 54 -> "BEP" - 55 -> "HSSS" - 56 -> "SHUHP" - 57 -> "THUD" - 58 -> "WHSSH" - 59 -> "HMM" - 60 -> "BRAHCHCH" - 61 -> "TIP" - 62 -> "BANGG" - 63 -> "ZHM" - 64 -> "TAP" - 65 -> "BLPCHCH" - 66 -> "BANG" - 67 -> "CHUGUGUG" - 68 -> "DEDA" - 69 -> "CRISH" + 37 -> "PEW" + 38 -> "TAK" + 39 -> "SMACK" + 40 -> "DRR" + 41 -> "CRASH" + 42 -> "SWSH" + 43 -> "CRAKLE" + 44 -> "CRTINK" + 45 -> "FHP" + 46 -> "CHPCHPCHP" + 47 -> "BIPBIPBIP" + 48 -> "CHUGUGUG" + 49 -> "BRPBRPBRP" + 50 -> "CRUH" + 51 -> "CHNKCHNKCHUNK" + 52 -> "WRRR" + 53 -> "BRDBRDBRD" + 54 -> "PHF" + 55 -> "BWAAH" + 56 -> "BEP" + 57 -> "HSSS" + 58 -> "SHUHP" + 59 -> "THUD" + 60 -> "WHSSH" + 61 -> "HMM" + 62 -> "BRAHCHCH" + 63 -> "TIP" + 64 -> "BANGG" + 65 -> "ZHM" + 66 -> "TAP" + 67 -> "BLPCHCH" + 68 -> "BANG" + 69 -> "CHUGUGUG" + 70 -> "DEDA" + 71 -> "CRISH" _ -> error "unitialised sound" soundPathList :: [String] soundPathList = @@ -186,6 +190,7 @@ soundPathList = , "tap3.BRAP.8000.wav" , "impact3.CRUMPLE.8000.wav" , "smallGlass1.TRINKL.5000.wav" + , "seagullWhistle1.PEW.10000.wav" , "tap1.TAK.8000.wav" , "hit1.SMACK.4000.wav" , "slideDoor.DRR.3000.wav" @@ -198,6 +203,7 @@ soundPathList = , "computerBeeping.BIPBIPBIP.5000.wav" , "seagullChatter1.CHUGUGUG.10000.wav" , "mini.BRPBRPBRP.12000.wav" + , "seagullCry.CRUH.5000.wav" , "crankSlow.CHNKCHNKCHUNK.5000.wav" , "fireLoud.WRRR.10000.wav" , "mini1.BRDBRDBRD.12000.wav" @@ -294,69 +300,73 @@ impact3S :: SoundID impact3S = SoundID 35 smallGlass1S :: SoundID smallGlass1S = SoundID 36 +seagullWhistle1S :: SoundID +seagullWhistle1S = SoundID 37 tap1S :: SoundID -tap1S = SoundID 37 +tap1S = SoundID 38 hit1S :: SoundID -hit1S = SoundID 38 +hit1S = SoundID 39 slideDoorS :: SoundID -slideDoorS = SoundID 39 +slideDoorS = SoundID 40 impact1S :: SoundID -impact1S = SoundID 40 +impact1S = SoundID 41 knifeS :: SoundID -knifeS = SoundID 41 +knifeS = SoundID 42 elecCrackleS :: SoundID -elecCrackleS = SoundID 42 +elecCrackleS = SoundID 43 smallGlass3S :: SoundID -smallGlass3S = SoundID 43 +smallGlass3S = SoundID 44 whiteNoiseFadeInS :: SoundID -whiteNoiseFadeInS = SoundID 44 +whiteNoiseFadeInS = SoundID 45 reload1S :: SoundID -reload1S = SoundID 45 +reload1S = SoundID 46 computerBeepingS :: SoundID -computerBeepingS = SoundID 46 +computerBeepingS = SoundID 47 seagullChatter1S :: SoundID -seagullChatter1S = SoundID 47 +seagullChatter1S = SoundID 48 miniS :: SoundID -miniS = SoundID 48 +miniS = SoundID 49 +seagullCryS :: SoundID +seagullCryS = SoundID 50 crankSlowS :: SoundID -crankSlowS = SoundID 49 +crankSlowS = SoundID 51 fireLoudS :: SoundID -fireLoudS = SoundID 50 +fireLoudS = SoundID 52 mini1S :: SoundID -mini1S = SoundID 51 +mini1S = SoundID 53 whiteNoiseFadeOutS :: SoundID -whiteNoiseFadeOutS = SoundID 52 +whiteNoiseFadeOutS = SoundID 54 sineRaisePitchTwoSecS :: SoundID -sineRaisePitchTwoSecS = SoundID 53 +sineRaisePitchTwoSecS = SoundID 55 tone440S :: SoundID -tone440S = SoundID 54 +tone440S = SoundID 56 foamSprayLoopS :: SoundID -foamSprayLoopS = SoundID 55 +foamSprayLoopS = SoundID 57 pickUpS :: SoundID -pickUpS = SoundID 56 +pickUpS = SoundID 58 hitS :: SoundID -hitS = SoundID 57 +hitS = SoundID 59 missileLaunchS :: SoundID -missileLaunchS = SoundID 58 +missileLaunchS = SoundID 60 fridgeHumS :: SoundID -fridgeHumS = SoundID 59 +fridgeHumS = SoundID 61 shotgunS :: SoundID -shotgunS = SoundID 60 +shotgunS = SoundID 62 foot1S :: SoundID -foot1S = SoundID 61 +foot1S = SoundID 63 bangEchoS :: SoundID -bangEchoS = SoundID 62 +bangEchoS = SoundID 64 teleS :: SoundID -teleS = SoundID 63 +teleS = SoundID 65 foot2S :: SoundID -foot2S = SoundID 64 +foot2S = SoundID 66 oldMachineBootS :: SoundID -oldMachineBootS = SoundID 65 +oldMachineBootS = SoundID 67 bangS :: SoundID -bangS = SoundID 66 +bangS = SoundID 68 seagullChatterS :: SoundID -seagullChatterS = SoundID 67 +seagullChatterS = SoundID 69 dedaS :: SoundID -dedaS = SoundID 68 +dedaS = SoundID 70 impact4S :: SoundID -impact4S = SoundID 69 +impact4S = SoundID 71