Add basic vocalizations to chase creatures

This commit is contained in:
2021-11-18 01:46:37 +00:00
parent 5949ad2b3d
commit f6d5d5a201
34 changed files with 525 additions and 329 deletions
-1
View File
@@ -19,7 +19,6 @@ import Dodge.Base
import Dodge.Zone
import Dodge.Base.Collide
import Dodge.SoundLogic
import Dodge.SoundLogic.LoadSound
--import Dodge.WorldEvent
import Dodge.Inventory
--import Dodge.LightSources
+2 -1
View File
@@ -13,6 +13,7 @@ import Dodge.Creature.State
import Dodge.Creature.State.Data
import Dodge.Item.Consumable
import Dodge.Picture.Layer
import Dodge.SoundLogic
--import Geometry
import Picture
--import Dodge.RandomHelp
@@ -40,7 +41,6 @@ chaseCrit = defaultCreature
overrideMeleeCloseTargetR >=>
setViewPos >=>
setMvPos >=>
-- setTargetMv (pure . _crTarget) >=>
goToTarget >=>
perceptionUpdate [0] >=>
targetYouWhenCognizantR >=>
@@ -50,6 +50,7 @@ chaseCrit = defaultCreature
, _crInv = IM.fromList [(0,medkit 200)]
, _crMeleeCooldown = 0
, _crFaction = ColorFaction green
, _crVocalization = Vocalization seagullBarkS 50 0
, _crMvType = ChaseMvType
{ _mvSpeed = 3
, _mvTurnRad = f
+6 -1
View File
@@ -10,7 +10,6 @@ import Dodge.Creature.Impulse.UseItem
import Dodge.Creature.State.Data
import Dodge.Creature.Stance.Data
import Dodge.SoundLogic
import Dodge.SoundLogic.LoadSound
import Geometry
import qualified Data.IntMap.Strict as IM
@@ -45,6 +44,7 @@ followImpulse
-> Impulse
-> (World -> World , Creature)
followImpulse cr w imp = case imp of
Bark sid -> (soundStart (CrMouth cid) cpos sid Nothing, resetCrVocCoolDown cr)
Move p -> (id, crMvBy p cr)
MoveForward x -> (id, crMvForward x cr)
Turn a -> (id, creatureTurn a cr)
@@ -85,3 +85,8 @@ followImpulse cr w imp = case imp of
hitCr i = over (creatures . ix i . crState . crDamage) (addDam i)
. soundStart (CrSound cid) cpos hitS Nothing
addDam i dams = Blunt 100 cpos (posFromID i) (posFromID i) : dams
resetCrVocCoolDown :: Creature -> Creature
resetCrVocCoolDown cr = case cr ^? crVocalization . vcMaxCoolDown of
Just i -> cr & crVocalization . vcCoolDown .~ i
Nothing -> cr
-1
View File
@@ -30,7 +30,6 @@ import Shape
import Dodge.WorldEvent
import Dodge.SoundLogic
import Dodge.Data.SoundOrigin
import Dodge.SoundLogic.LoadSound
import System.Random
import Data.List
+28 -3
View File
@@ -8,6 +8,7 @@ import Dodge.Data
import Dodge.Creature.Perception.Data
import Dodge.Creature.Memory.Data
import Dodge.Base.Collide
import Dodge.SoundLogic
import Geometry.Vector
--import Geometry.Data
import Geometry.Data
@@ -25,7 +26,8 @@ perceptionUpdate
:: [Int] -- ^ List of creature ids that may direct attention and awareness
-> Creature
-> Reader World Creature
perceptionUpdate is cr = basicAttentionUpdate is cr >>= basicAwarenessUpdate
perceptionUpdate is cr = basicAttentionUpdate is cr
>>= basicAwarenessUpdate
>>= rememberSounds
{- | Update a creatures awareness based upon the creatures' current direction
@@ -33,11 +35,34 @@ perceptionUpdate is cr = basicAttentionUpdate is cr >>= basicAwarenessUpdate
basicAwarenessUpdate
:: Creature -> Reader World Creature
basicAwarenessUpdate cr = case _crAttentionDir $ _crPerception cr of
AttentiveTo is -> pure $ cr & crPerception . crAwarenessLevel
%~ (IM.mapMaybe decreaseAwareness . IM.unionWith combineAwareness is)
AttentiveTo is -> pure $ cr
& crPerception . crAwarenessLevel
%~ (IM.mapMaybe decreaseAwareness . IM.unionWith combineAwareness is)
& maybeBark
where
oldAwareness = _crAwarenessLevel $ _crPerception cr
newAwareness = (IM.mapMaybe decreaseAwareness . IM.unionWith combineAwareness is) oldAwareness
becomesCognizant = any isCognizant $ IM.unionWith cogRaised oldAwareness newAwareness
maybeBark | becomesCognizant = case vocalizationTest cr of
Just sid -> crActionPlan . crImpulse .~ [Bark sid]
Nothing -> id
| otherwise = id
Fixated i -> pure $ cr & crPerception . crAwarenessLevel
%~ ( IM.insert i (Cognizant 10000) . IM.mapMaybe decreaseAwareness)
vocalizationTest :: Creature -> Maybe SoundID
vocalizationTest cr = case cr ^? crVocalization . vcCoolDown of
Just 0 -> Just $ _vcSound $ _crVocalization cr
Nothing -> Nothing
cogRaised :: AwarenessLevel -> AwarenessLevel -> AwarenessLevel
cogRaised Suspicious{} Cognizant{} = Cognizant 100
cogRaised _ _ = Suspicious 0
isCognizant :: AwarenessLevel -> Bool
isCognizant Cognizant {} = True
isCognizant _ = False
combineAwareness :: AwarenessLevel -> AwarenessLevel -> AwarenessLevel
combineAwareness (Suspicious x) (Suspicious y)
| x + y < 10000 = Suspicious $ x + y
-1
View File
@@ -153,7 +153,6 @@ watchUpdateStratR fs cr = reader $ \w -> case cr ^? crActionPlan . crStrategy of
& crActionPlan . crStrategy .~ listGuard (fs, \_ _ -> WatchAndWait) (w, cr) w cr
_ -> cr
listGuard :: ([(a -> Bool, b)] , b) -> a -> b
listGuard ( (test,y):ps, z ) x
| test x = y
-1
View File
@@ -11,7 +11,6 @@ import Dodge.Creature.Stance.Data
--import Dodge.Creature.Test
--import Dodge.Base
import Dodge.SoundLogic
import Dodge.SoundLogic.LoadSound
import Dodge.RandomHelp
import Dodge.WorldEvent
--import Dodge.WallCreatureCollisions
-1
View File
@@ -7,7 +7,6 @@ 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
+10 -1
View File
@@ -218,11 +218,19 @@ data Creature = Creature
, _crMeleeCooldown :: !Int
, _crPerception :: PerceptionState
, _crMemory :: MemoryState
, _crVocalization :: Vocalization
, _crFaction :: Faction
, _crGroup :: CrGroup
, _crIntention :: Intention
, _crMvType :: CrMvType
}
data Vocalization
= Mute
| Vocalization
{_vcSound :: SoundID
,_vcMaxCoolDown :: Int
,_vcCoolDown :: Int
}
data Intention = Intention
{ _targetCr :: Maybe Creature
, _mvToPoint :: Maybe Point2
@@ -649,7 +657,7 @@ data Impulse
| DropItem
-- | PickupNearby Int
-- | UseWorldObject Int
-- | Bark -- placeholder for various communication types
| Bark SoundID -- placeholder for various communication types
-- | UseIntrinsicAbility
| Melee Int
| ChangePosture Posture
@@ -820,3 +828,4 @@ makeLenses ''Machine
makeLenses ''MachineType
makeLenses ''Zone
makeLenses ''ItemDimension
makeLenses ''Vocalization
+1
View File
@@ -4,6 +4,7 @@ data SoundOrigin = InventorySound
| BackgroundSound
| OnceSound
| CrSound Int
| CrMouth Int
| CrWeaponSound Int Int
| MachineSound Int
| WallSound Int
+1 -1
View File
@@ -14,7 +14,6 @@ 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 Dodge.Wall.Delete
import Geometry
@@ -53,6 +52,7 @@ defaultCreature = Creature
,_posture=AtEase
,_strideLength = 40
}
, _crVocalization = Mute
, _crActionPlan = ActionPlan [] [] WatchAndWait [LiveLongAndProsper]
, _crPerception = defaultPerceptionState
, _crMemory = defaultCreatureMemory
+1
View File
@@ -18,6 +18,7 @@ import Dodge.LevelGen.Switch
import Dodge.Item.Weapon.Launcher
import Dodge.PlacementSpot
import Dodge.RoomPos
import Dodge.Room.RunPast
import MonadHelp
import Data.Tree
import Color
-1
View File
@@ -7,7 +7,6 @@ import Dodge.Creature
import Dodge.Story
import Dodge.WorldEvent.Cloud
import Dodge.SoundLogic
import Dodge.SoundLogic.LoadSound
import Geometry.Data
import System.Random
-1
View File
@@ -6,7 +6,6 @@ import Dodge.Item.Data
import Dodge.Picture.Layer
import Dodge.Default
import Dodge.SoundLogic
import Dodge.SoundLogic.LoadSound
import Shape
--import ShapePicture
import Dodge.Item.Draw
-1
View File
@@ -7,7 +7,6 @@ import Dodge.Base
import Dodge.Zone
import Dodge.Picture.Layer
import Dodge.SoundLogic
import Dodge.SoundLogic.LoadSound
import Dodge.Creature.Action
import Dodge.WorldEvent
import Dodge.Default
+1
View File
@@ -55,6 +55,7 @@ autoGun = defaultAutoGun
,('S', torqueBefore 0.05)
]
, withSoundForI autoBS 5
--, withSoundForI seagullChatterS 5
, useAmmo 1
, withRandomDirI (autogunSpread/2)
, withMuzFlareI
-1
View File
@@ -11,7 +11,6 @@ import Dodge.Default
import Dodge.Base
import Dodge.Zone
import Dodge.SoundLogic
import Dodge.SoundLogic.LoadSound
import Dodge.Item.Attachment.Data
import Dodge.Item.Draw
import Dodge.Item.Weapon.InventoryDisplay
+3
View File
@@ -111,6 +111,9 @@ psPtCont ps pt = Placement ps pt Nothing
sPS :: Point2 -> Float -> PSType -> Placement
sPS p a pt = Placement (PS p a) pt Nothing (const Nothing)
plRRpt :: Int -> PSType -> Placement
plRRpt i pt = Placement (PSRoomRand i) pt Nothing (const Nothing)
jsps :: Point2 -> Float -> PSType -> Maybe Placement
jsps p a pst = Just $ Placement (PS p a) pst Nothing $ const Nothing
-1
View File
@@ -8,7 +8,6 @@ import Dodge.Data
import Dodge.Default
import Dodge.Data.SoundOrigin
import Dodge.SoundLogic
import Dodge.SoundLogic.LoadSound
import Picture
import ShapePicture
import Shape
-1
View File
@@ -10,7 +10,6 @@ import Dodge.Wall.Damage
import Dodge.WorldEvent
import Dodge.Particle.Bullet.Spawn
import Dodge.SoundLogic
import Dodge.SoundLogic.LoadSound
import Dodge.RandomHelp
import Dodge.WorldEvent.Shockwave
import Dodge.Creature.State.Data
+15
View File
@@ -66,3 +66,18 @@ putLitButOnPos col f subpl
changeLight lsid = lightSources . ix lsid . lsIntensity .~ V3 0 0.5 0
ls = defaultLS { _lsRad = 75 , _lsIntensity = V3 0.5 0 0 }
thePS = PSLnk f (const id) Nothing
putLitButOnPosExtTrig :: Color -> (RoomPos -> Maybe PlacementSpot) -> Placement
putLitButOnPosExtTrig col f
= psPtCont thePS (PutTrigger (const False))
$ \tp -> Just $ plSpot .~ _plSpot tp $ mntLSOn aShape (Just col) ls 0 (V3 0 (-40) 40)
$ \plmnt -> let lsid = fromJust $ _plMID plmnt
in jps0 (PutButton (makeButton col (changeLight lsid . oneff (trigid tp)))
{_btPos = V2 0 (-1), _btRot = pi})
(const Nothing) <&> plSpot .~ _plSpot plmnt
where
trigid tp = fromJust $ _plMID tp
oneff tid = triggers . ix tid .~ const True
changeLight lsid = lightSources . ix lsid . lsIntensity .~ V3 0 0.5 0
ls = defaultLS { _lsRad = 75 , _lsIntensity = V3 0.5 0 0 }
thePS = PSLnk f (const id) Nothing
@@ -107,6 +107,13 @@ spanLSLightI ls h a b = ps0j (PutLS ls {_lsPos = V3 x y h})
where
V2 x y = 0.5 *.* (a +.+ b)
spanLS :: LightSource -> Point2 -> Point2 -> Placement
spanLS ls a b = Placement (PS (V2 x y) 0) (PutLS ls) Nothing
$ const $ Just $ sps0 $ PutForeground $ thinHighBar h a b
where
V3 _ _ h = _lsPos ls + 5
V2 x y = 0.5 *.* (a +.+ b)
spanColLightI :: Point3 -> Float -> Point2 -> Point2 -> Placement
spanColLightI col h a b = ps0j (PutLS $ colorLightAt col (V3 x y (h-5)) 0)
$ sps0 $ PutForeground $ thinHighBar h a b
@@ -11,7 +11,6 @@ import Picture
import Geometry
import qualified IntMapHelp as IM
import Dodge.SoundLogic
import Dodge.SoundLogic.LoadSound
import Dodge.Data.SoundOrigin
import Data.List
+15
View File
@@ -2,6 +2,9 @@ module Dodge.PlacementSpot where
import Dodge.LevelGen.Data
import Geometry
import Control.Monad.State
import System.Random
-- TODO rename to any unused link facing out
anyLnkOutPS :: PlacementSpot
anyLnkOutPS = PSLnk f (const id) Nothing
@@ -21,3 +24,15 @@ anyLnkInPS x = PSLnk f (const id) Nothing
where
f (UnusedLink v a) = Just $ PS (v -.- x *.* unitVectorAtAngle (a + 0.5 * pi)) (a+ pi)
f _ = Nothing
useLnkRoomPos :: RoomPos -> Maybe PlacementSpot
useLnkRoomPos rp = case rp of
(UnusedLink (V2 x y) a) -> Just $ PS (V2 x y) a
_ -> Nothing
psRandRanges :: (Float,Float) -> (Float,Float) -> (Float,Float) -> State StdGen (Point2,Float)
psRandRanges xranges yranges aranges = do
x <- state $ randomR xranges
y <- state $ randomR yranges
a <- state $ randomR aranges
return (V2 x y,a)
+13
View File
@@ -42,6 +42,19 @@ corridorN = defaultRoom
,(V2 20 10 ,pi)
]
pth = doublePair (V2 20 70,V2 20 10)
corridorWallN :: Room
corridorWallN = defaultRoom
{ _rmPolys = [rectNSWE 70 0 0 40
]
, _rmLinks = lnks
, _rmPath = pth
, _rmPmnts = []
, _rmBound = [ rectNSWE 50 30 0 40 ]
}
where lnks = [(V2 20 70 ,0)
,(V2 20 10 ,pi)
]
pth = doublePair (V2 20 70,V2 20 10)
tEast :: Room
tEast = defaultRoom
+2
View File
@@ -11,6 +11,7 @@ module Dodge.Room.Procedural
) where
import Dodge.Data
import Dodge.Default.Wall
import Dodge.PlacementSpot
import Dodge.Placement.Instance
import Dodge.Room.Link
import Dodge.Room.Path
@@ -55,6 +56,7 @@ roomRect x y xn yn = defaultRoom
, _tileX = V2 1 0
, _tileZ = 16
} ]
, _rmRandPSs = [psRandRanges (10,x-10) (10,y-10) (0,2*pi)]
}
where
yd = (y - 40) / fromIntegral yn
+78
View File
@@ -1 +1,79 @@
module Dodge.Room.RunPast where
import Dodge.LevelGen.Data
import Dodge.Data
import Dodge.Default
--import Dodge.Layout.Tree.Either
import Dodge.RandomHelp
import Dodge.Room.Door
--import Dodge.Room.Room
import Dodge.Room.Link
import Dodge.Room.Procedural
import Dodge.Room.Corridor
--import Dodge.Room.Foreground
--import Dodge.Room.RoadBlock
import Dodge.PlacementSpot
import Dodge.Placement.Instance
import Dodge.Layout.Tree.Polymorphic
import Dodge.Item.Random
--import Dodge.Item.Weapon.SprayGuns
--import Dodge.Item.Weapon.Grenade
--import Dodge.LevelGen.Data
import Geometry.Data
--import Padding
import Color
--import Shape
import Data.Tree
import Control.Monad.State
import Control.Lens
import System.Random
--import qualified Data.IntMap.Strict as IM
horEdgeTest :: (Float -> Bool) -> ((Point2,Float) -> Bool)
horEdgeTest t (V2 x _,_) = t x
roomCritLS :: RandomGen g => State g LightSource
roomCritLS = do
col <- takeOne [0.5, 0.6]
h <- takeOne [30,35]
rad <- takeOne [300]
return defaultLS
{ _lsPos = V3 0 0 h
, _lsIntensity = col
, _lsRad = rad
}
critRoom :: Room
critRoom = corridorWallN
{ _rmRandPSs = [psRandRanges (15,25) (30,45) (pi,2*pi)]
}
runPastRoom :: RandomGen g => State g (Tree (Either Room Room))
runPastRoom = do
h <- state $ randomR (200,400::Float)
theedgetest <- takeOne [horEdgeTest (<1), horEdgeTest (>39)]
thels <- roomCritLS
--theweapon <- join $ takeOne [randBlockBreakWeapon,return grenade]
theweapon <- randBlockBreakWeapon
cenroom <- changeLinkFrom theedgetest
$ roomRectAutoLinks 40 h & rmPmnts .~ [plRRpt 0 (PutFlIt theweapon)]
--let cenroom = filterSortOutLinksOn theedgetest ((\(V2 a b) -> (a,b)) . fst)
let linkcor = critRoom {_rmPmnts =
[ spanLS thels (V2 0 65) (V2 40 65)
]
}
critroom = linkcor & rmPmnts %~ ( plRRpt 0 randC1 :)
aswitchroom = corridorWallN
{_rmExtPmnt = Just $ putLitButOnPosExtTrig red useLnkRoomPos
,_rmLabel = Just 0
,_rmPmnts = []
}
switchdoor = switchDoorRoom & rmTakeFrom ?~ 0
n = length $ filter theedgetest $ _rmLinks cenroom
controom = treeFromPost [Left switchdoor,Left linkcor] (Right door)
critrooms :: [Tree (Either Room Room)]
critrooms = treeFromPost [Left switchdoor] (Left critroom) :
replicate (n-2) (treeFromPost [Left switchdoor] (Left linkcor))
return $ treeFromTrunk [Left door]
$ Node (Left cenroom) (controom : critrooms ++ [return $ Left aswitchroom])
+19 -5
View File
@@ -1,5 +1,7 @@
module Dodge.Room.Start where
module Dodge.Room.Start
where
import Dodge.LevelGen.Data
import Dodge.Room.RunPast
import Dodge.Data
import Dodge.Default
import Dodge.Layout.Tree.Either
@@ -27,12 +29,24 @@ import System.Random
startRoom :: RandomGen g => State g (Tree (Either Room Room))
startRoom = join $ takeOne
[ rezBoxesWp
, rezBoxesThenWeaponRoom
, rezBoxThenWeaponRoom
, rezBoxesWpCrit
[ -- rezBoxesWp
-- , rezBoxesThenWeaponRoom
-- , rezBoxThenWeaponRoom
-- , rezBoxesWpCrit
runPastStart
]
runPastStart :: RandomGen g => State g (Tree (Either Room Room))
runPastStart = do
s <- rezBoxStart
rp <- runPastRoom
return $ s `appendEitherTree` [rp]
rezBoxStart :: RandomGen g => State g (Tree (Either Room Room))
rezBoxStart = do
ls <- rezColor
return $ treeFromPost [Left $ rezBox ls] (Right door)
rezBox :: LightSource -> Room
rezBox ls = roomRect 40 60 1 1
& rmPmnts .~ [ sPS (V2 20 1) 0 $ PutLS ls]
+1
View File
@@ -16,6 +16,7 @@ module Dodge.SoundLogic (
, haltSound
, resumeSound
, pauseSound
, module Dodge.SoundLogic.LoadSound
) where
import Dodge.Data
import Dodge.Data.SoundOrigin
@@ -0,0 +1,317 @@
-- generated at 2021-11-18 01:13:04.234031373 UTC
module Dodge.SoundLogic.ExternallyGeneratedSounds where
import Sound.Data
soundToVol :: SoundID -> Float
soundToVol v = case _getSoundID v of
0 -> 5000
1 -> 8000
2 -> 8000
3 -> 5000
4 -> 5000
5 -> 5000
6 -> 3000
7 -> 3000
8 -> 4000
9 -> 5000
10 -> 10000
11 -> 8000
12 -> 8000
13 -> 8000
14 -> 8000
15 -> 10000
16 -> 3000
17 -> 4000
18 -> 5000
19 -> 5000
20 -> 20000
21 -> 4000
22 -> 10000
23 -> 8000
24 -> 4000
25 -> 2000
26 -> 6000
27 -> 500
28 -> 5000
29 -> 8000
30 -> 8000
31 -> 8000
32 -> 5000
33 -> 8000
34 -> 4000
35 -> 3000
36 -> 8000
37 -> 2000
38 -> 10000
39 -> 5000
40 -> 2000
41 -> 3000
42 -> 12000
43 -> 5000
44 -> 10000
45 -> 12000
46 -> 2000
47 -> 3000
48 -> 8000
49 -> 5000
50 -> 2000
51 -> 3000
52 -> 10000
53 -> 10000
54 -> 3000
55 -> 15000
56 -> 10000
57 -> 3000
58 -> 15000
59 -> 10000
60 -> 8000
_ -> 50
soundToOnomato :: SoundID -> String
soundToOnomato v = case _getSoundID v of
0 -> "HNH"
1 -> "CRNKL"
2 -> "ZMM"
3 -> "WE-OH"
4 -> "UGGAUGGA"
5 -> "KRTNKL"
6 -> "DWAAH"
7 -> "BWAH"
8 -> "TIPTOP"
9 -> "TINKLE"
10 -> "TATATA"
11 -> "CRSK"
12 -> "CRNK"
13 -> "TAKH"
14 -> "CRUNK"
15 -> "SCREE"
16 -> "TNKTNKTNK"
17 -> "TIPTAP"
18 -> "WRR"
19 -> "HSS"
20 -> "BOOM"
21 -> "CLNK"
22 -> "BRAP"
23 -> "CRSNK"
24 -> "TAPP"
25 -> "BLIH"
26 -> "TAPTIP"
27 -> "CLICK"
28 -> "FWUMP"
29 -> "RINGGG"
30 -> "BRAP"
31 -> "CRUMPLE"
32 -> "TRINKL"
33 -> "TAK"
34 -> "SMACK"
35 -> "DRR"
36 -> "CRASH"
37 -> "SWSH"
38 -> "CRAKLE"
39 -> "CRTINK"
40 -> "FHP"
41 -> "CHPCHPCHP"
42 -> "BRPBRPBRP"
43 -> "CHNKCHNKCHUNK"
44 -> "WRRR"
45 -> "BRDBRDBRD"
46 -> "PHF"
47 -> "BWAAH"
48 -> "BEP"
49 -> "HSSS"
50 -> "SHUHP"
51 -> "THUD"
52 -> "WHSSH"
53 -> "BRAHCHCH"
54 -> "TIP"
55 -> "BANGG"
56 -> "ZHM"
57 -> "TAP"
58 -> "BANG"
59 -> "CHUGUGUG"
60 -> "CRISH"
_ -> error "unitialised sound"
soundPathList :: [String]
soundPathList =
[ "grunt.HNH.5000.wav"
, "glassShat2.CRNKL.8000.wav"
, "buzz.ZMM.8000.wav"
, "seagullWhistle.WE-OH.5000.wav"
, "seagullBark.UGGAUGGA.5000.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"
, "seagullChatter.CHUGUGUG.10000.wav"
, "impact4.CRISH.8000.wav"
]
gruntS :: SoundID
gruntS = SoundID 0
glassShat2S :: SoundID
glassShat2S = SoundID 1
buzzS :: SoundID
buzzS = SoundID 2
seagullWhistleS :: SoundID
seagullWhistleS = SoundID 3
seagullBarkS :: SoundID
seagullBarkS = SoundID 4
smallGlass2S :: SoundID
smallGlass2S = SoundID 5
skwareFadeTwoSecS :: SoundID
skwareFadeTwoSecS = SoundID 6
sineRaisePitchOneSecS :: SoundID
sineRaisePitchOneSecS = SoundID 7
twoStepSlowS :: SoundID
twoStepSlowS = SoundID 8
smallGlass4S :: SoundID
smallGlass4S = SoundID 9
autoBS :: SoundID
autoBS = SoundID 10
glassShat4S :: SoundID
glassShat4S = SoundID 11
glassShat3S :: SoundID
glassShat3S = SoundID 12
tap2S :: SoundID
tap2S = SoundID 13
impact2S :: SoundID
impact2S = SoundID 14
tone440sawtoothS :: SoundID
tone440sawtoothS = SoundID 15
reloadS :: SoundID
reloadS = SoundID 16
twoStepS :: SoundID
twoStepS = SoundID 17
fireS :: SoundID
fireS = SoundID 18
foamSprayFadeOutS :: SoundID
foamSprayFadeOutS = SoundID 19
explosionS :: SoundID
explosionS = SoundID 20
tapQuietS :: SoundID
tapQuietS = SoundID 21
autoGunS :: SoundID
autoGunS = SoundID 22
glassShat1S :: SoundID
glassShat1S = SoundID 23
foot3S :: SoundID
foot3S = SoundID 24
healS :: SoundID
healS = SoundID 25
twoStep1S :: SoundID
twoStep1S = SoundID 26
click1S :: SoundID
click1S = SoundID 27
tap4S :: SoundID
tap4S = SoundID 28
tinitusS :: SoundID
tinitusS = SoundID 29
tap3S :: SoundID
tap3S = SoundID 30
impact3S :: SoundID
impact3S = SoundID 31
smallGlass1S :: SoundID
smallGlass1S = SoundID 32
tap1S :: SoundID
tap1S = SoundID 33
hit1S :: SoundID
hit1S = SoundID 34
slideDoorS :: SoundID
slideDoorS = SoundID 35
impact1S :: SoundID
impact1S = SoundID 36
knifeS :: SoundID
knifeS = SoundID 37
elecCrackleS :: SoundID
elecCrackleS = SoundID 38
smallGlass3S :: SoundID
smallGlass3S = SoundID 39
whiteNoiseFadeInS :: SoundID
whiteNoiseFadeInS = SoundID 40
reload1S :: SoundID
reload1S = SoundID 41
miniS :: SoundID
miniS = SoundID 42
crankSlowS :: SoundID
crankSlowS = SoundID 43
fireLoudS :: SoundID
fireLoudS = SoundID 44
mini1S :: SoundID
mini1S = SoundID 45
whiteNoiseFadeOutS :: SoundID
whiteNoiseFadeOutS = SoundID 46
sineRaisePitchTwoSecS :: SoundID
sineRaisePitchTwoSecS = SoundID 47
tone440S :: SoundID
tone440S = SoundID 48
foamSprayLoopS :: SoundID
foamSprayLoopS = SoundID 49
pickUpS :: SoundID
pickUpS = SoundID 50
hitS :: SoundID
hitS = SoundID 51
missileLaunchS :: SoundID
missileLaunchS = SoundID 52
shotgunS :: SoundID
shotgunS = SoundID 53
foot1S :: SoundID
foot1S = SoundID 54
bangEchoS :: SoundID
bangEchoS = SoundID 55
teleS :: SoundID
teleS = SoundID 56
foot2S :: SoundID
foot2S = SoundID 57
bangS :: SoundID
bangS = SoundID 58
seagullChatterS :: SoundID
seagullChatterS = SoundID 59
impact4S :: SoundID
impact4S = SoundID 60
+5 -302
View File
@@ -1,6 +1,9 @@
module Dodge.SoundLogic.LoadSound
where
import Sound.Data
( module Dodge.SoundLogic.LoadSound
, module Dodge.SoundLogic.ExternallyGeneratedSounds
) where
--import Sound.Data
import Dodge.SoundLogic.ExternallyGeneratedSounds
import qualified Data.IntMap.Strict as IM
import qualified SDL.Mixer as Mix
@@ -15,306 +18,6 @@ loadSounds = do
Mix.openAudio Mix.defaultAudio 128
fmap IM.fromList $ mapM loadSound $ zip [0..] soundPathList
soundToVol :: SoundID -> Float
soundToVol v = case _getSoundID v of
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 -> "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 -> "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 =
[ "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"
]
gruntS :: SoundID
gruntS = SoundID 0
glassShat2S :: SoundID
glassShat2S = SoundID 1
buzzS :: SoundID
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
impact3S :: SoundID
impact3S = SoundID 29
smallGlass1S :: SoundID
smallGlass1S = SoundID 30
tap1S :: SoundID
tap1S = SoundID 31
hit1S :: SoundID
hit1S = SoundID 32
slideDoorS :: SoundID
slideDoorS = SoundID 33
impact1S :: SoundID
impact1S = SoundID 34
knifeS :: SoundID
knifeS = SoundID 35
elecCrackleS :: SoundID
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 54
foot2S :: SoundID
foot2S = SoundID 55
bangS :: SoundID
bangS = SoundID 56
impact4S :: SoundID
impact4S = SoundID 57
loadMusic :: IO (IM.IntMap Mix.Music)
loadMusic = do
undercity <- Mix.load "./data/music/firstCompo.mid"
-1
View File
@@ -16,7 +16,6 @@ import Dodge.WorldEvent.SpawnParticle
--import Dodge.WorldEvent.Flash
import Dodge.RandomHelp
import Dodge.SoundLogic
import Dodge.SoundLogic.LoadSound
import Dodge.WorldEvent.Shockwave
import Geometry
import Geometry.Vector3D
-1
View File
@@ -7,7 +7,6 @@ module Dodge.WorldEvent.Sound
import Dodge.Data
import Dodge.Data.SoundOrigin
import Dodge.SoundLogic
import Dodge.SoundLogic.LoadSound
import Sound.Data
import Geometry.Data
import Dodge.RandomHelp
-1
View File
@@ -16,7 +16,6 @@ import Dodge.WorldEvent.ThingsHit
import Dodge.WorldEvent.Cloud
import Dodge.WorldEvent.Flash
import Dodge.SoundLogic
import Dodge.SoundLogic.LoadSound
import Dodge.RandomHelp
--import Dodge.Debug
import Picture