Refactor sound

This commit is contained in:
2021-09-12 17:52:34 +01:00
parent ea333a363b
commit 51a85bd1ec
97 changed files with 409 additions and 177 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ import Dodge.Picture.Layer
import Dodge.Item.Draw
import Dodge.Item.Weapon.Bullet
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.Synonyms
import Dodge.SoundLogic.LoadSound
import Picture
import Geometry
@@ -40,7 +40,7 @@ autoGun = defaultAutoGun
[('M', torqueBefore 0.08)
,('S', torqueBefore 0.05)
]
, withSoundI autoGunSound
, withSoundForI autoBS 5
, useAmmo 1
, withRandomDirI (autogunSpread/2)
, withMuzFlareI
+2 -1
View File
@@ -15,6 +15,7 @@ import Dodge.Particle.Bullet.HitEffect
import Dodge.WorldEvent.HitEffect
import Dodge.RandomHelp
import Dodge.Picture.Layer
import Dodge.SoundLogic.LoadSound
import Picture
import Geometry
@@ -28,7 +29,7 @@ bezierGun = defaultGun
, _itUse = \_ -> useTargetPos $ \p -> shootBezier $ fromJust p -- <- the start point
, _itUseModifiers =
[ useTimeCheckI
, withSoundI 0
, withSoundI tap2S
, useAmmo 1
, withMuzFlareI
. withRecoilI 40
+2 -2
View File
@@ -7,7 +7,7 @@ import Dodge.Base
import Dodge.Zone
import Dodge.Picture.Layer
import Dodge.SoundLogic
import Dodge.SoundLogic.Synonyms
import Dodge.SoundLogic.LoadSound
import Dodge.Item.Attachment.Data
import Dodge.Item.Draw
import Dodge.Default.Shell
@@ -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 tapQuiet Nothing updatedWorld
Just (p,_) -> soundFrom (Tap 0) p tapQuietS Nothing updatedWorld
_ -> updatedWorld
where
updatedWorld = updateV $ set (projectiles . ix pID . pjPos) finalPos
+3 -3
View File
@@ -4,7 +4,7 @@ import Dodge.Data
import Dodge.Data.SoundOrigin
import Dodge.Default.Weapon
import Dodge.Default.Shell
import Dodge.SoundLogic.Synonyms
import Dodge.SoundLogic.LoadSound
import Dodge.WorldEvent.Explosion
import Dodge.Picture.Layer
import Dodge.Item.Data
@@ -43,7 +43,7 @@ launcher = defaultGun
, _itUseModifiers =
[ ammoCheckI
, useTimeCheckI
, withSoundI launcherSound
, withSoundI 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 smokeTrailSound (Just 1)
& soundFrom (ShellSound i) newPos missileLaunchS (Just 1)
& makeFlameletTimed (oldPos -.- vel) 0 (vel +.+ rotateV (pi+sparkD) accel) Nothing 3 10
& smokeGen
where
+4 -3
View File
@@ -44,6 +44,7 @@ import Dodge.RandomHelp
import Dodge.Item.Attachment.Data
import Dodge.Item.Data
import Dodge.Default
import Sound.Data
import Geometry
import Geometry.Vector3D
@@ -121,7 +122,7 @@ rateIncABI startRate fastRate exeffFirst exeffCont eff item cr w
&& _itUseTime item == 0
{- | Apply effect after a warm up. -}
withWarmUpI
:: Int -- ^ warm up sound id
:: SoundID -- ^ warm up sound id
-> ChainEffect
withWarmUpI soundID f item cr w
| _wpReloadState item /= 0 = w
@@ -140,7 +141,7 @@ withWarmUpI soundID f item cr w
{- | Adds a sound to a creature based world effect.
The sound is emitted from the creature's position. -}
withSoundI
:: Int -- ^ Sound id
:: SoundID -- ^ Sound id
-> ChainEffect
withSoundI soundid f item cr
= soundFrom (CrWeaponSound cid) (_crPos cr) soundid Nothing
@@ -151,7 +152,7 @@ withSoundI soundid f item cr
{- | Adds a sound to a creature based world effect.
The sound is emitted from the creature's position. -}
withSoundForI
:: Int -- ^ Sound id
:: SoundID -- ^ Sound id
-> Int -- ^ Frames to play
-> ChainEffect
withSoundForI soundid playTime f item cr