Refactor sound
This commit is contained in:
@@ -12,7 +12,7 @@ import Dodge.WorldEvent.SpawnParticle
|
||||
--import Dodge.WorldEvent.Flash
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.WorldEvent.Shockwave
|
||||
import Geometry
|
||||
import Geometry.Vector3D
|
||||
@@ -30,7 +30,7 @@ makePoisonExplosionAt
|
||||
-> World
|
||||
-> World
|
||||
makePoisonExplosionAt p w
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p grenadeBang Nothing
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing
|
||||
$ foldr (makeGasCloud p) w vels
|
||||
where
|
||||
vels = replicateM 25 (randInCirc 2) & evalState $ _randGen w
|
||||
@@ -58,7 +58,7 @@ makeFlameExplosionAt
|
||||
-> World
|
||||
-> World
|
||||
makeFlameExplosionAt p w
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p grenadeBang Nothing
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing
|
||||
$ over particles (newFlames ++ ) w
|
||||
where
|
||||
newFlames = zipWith makeFlameWithVelAndTime velocities timers
|
||||
@@ -73,7 +73,7 @@ makeExplosionAt
|
||||
-> World
|
||||
-> World
|
||||
makeExplosionAt p w
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p grenadeBang Nothing
|
||||
= soundMultiFrom [Explosion 0,Explosion 1] p bangS Nothing
|
||||
. addFlames
|
||||
-- . explosionFlashAt p
|
||||
. over tempLightSources (theTLS :)
|
||||
|
||||
@@ -3,17 +3,21 @@ module Dodge.WorldEvent.Sound
|
||||
import Dodge.Data
|
||||
import Dodge.Data.SoundOrigin
|
||||
import Dodge.SoundLogic
|
||||
import System.Random
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Geometry.Data
|
||||
import Dodge.RandomHelp
|
||||
|
||||
import System.Random
|
||||
import Control.Lens
|
||||
import Control.Monad.State.Lazy
|
||||
|
||||
|
||||
mkSoundBreakGlass :: Point2 -> World -> World
|
||||
mkSoundBreakGlass p w = soundOnceOrigin soundid (GlassBreakSound 0) p $ set randGen g w
|
||||
where
|
||||
(soundid,g) = _randGen w & randomR (37,40)
|
||||
(soundid,g) = _randGen w & runState (takeOne [glassShat1S,glassShat2S,glassShat3S,glassShat4S])
|
||||
|
||||
mkSoundSplinterGlass :: Point2 -> World -> World
|
||||
mkSoundSplinterGlass p w = soundOnceOrigin soundid (GlassBreakSound 1) p $ set randGen g w
|
||||
where
|
||||
(soundid,g) = _randGen w & randomR (33,36)
|
||||
(soundid,g) = _randGen w & runState (takeOne [smallGlass1S,smallGlass2S,smallGlass3S,smallGlass4S])
|
||||
|
||||
@@ -20,7 +20,7 @@ import Dodge.WorldEvent.Cloud
|
||||
import Dodge.Particle.Bullet.Draw
|
||||
import Dodge.Particle.Bullet.Update
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.RandomHelp
|
||||
--import Dodge.Debug
|
||||
import Picture
|
||||
@@ -99,7 +99,7 @@ moveFlame rotd w pt
|
||||
_ -> (glare $ doSound damcrs , mvPt)
|
||||
where
|
||||
time = _btTimer' pt
|
||||
doSound = soundFrom Flame (V2 x y) fireSound (Just 2) -- . over worldEvents ((.) $ flameGlareAt ep)
|
||||
doSound = soundFrom Flame (V2 x y) fireS (Just 2) -- . over worldEvents ((.) $ flameGlareAt ep)
|
||||
glare
|
||||
| time `mod` 5 == 0
|
||||
= tempLightSources %~ (theTLS :)
|
||||
|
||||
Reference in New Issue
Block a user