Refactor sound
This commit is contained in:
@@ -6,7 +6,7 @@ import Dodge.Item.Data
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.Default
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
|
||||
import Dodge.Item.Draw
|
||||
|
||||
@@ -32,7 +32,7 @@ heal25 :: Int -> World -> Maybe World
|
||||
heal25 = heal 25
|
||||
heal :: Int -> Int -> World -> Maybe World
|
||||
heal hp n w | _crHP (_creatures w IM.! n) >= 10000 = Nothing
|
||||
| otherwise = Just $ soundFrom (CrSound $ _crID cr) (_crPos cr) healSound Nothing w
|
||||
| otherwise = Just $ soundFrom (CrSound $ _crID cr) (_crPos cr) healS Nothing w
|
||||
& creatures . ix n . crHP %~ min 10000 . (+ hp)
|
||||
where
|
||||
cr = _creatures w IM.! n
|
||||
|
||||
+17
-17
@@ -8,7 +8,7 @@ import Dodge.Base
|
||||
import Dodge.Zone
|
||||
import Dodge.Picture.Layer
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.RandomHelp
|
||||
import Dodge.WorldEvent
|
||||
@@ -66,7 +66,7 @@ pistol = defaultGun
|
||||
[ ammoCheckI
|
||||
, hammerCheckI
|
||||
, useTimeCheckI
|
||||
, withSoundI 0
|
||||
, withSoundI tap3S
|
||||
, useAmmo 1
|
||||
, randSpreadDir
|
||||
, withMuzFlareI
|
||||
@@ -145,7 +145,7 @@ teslaGun = defaultGun
|
||||
[ ammoCheckI
|
||||
, useTimeCheckI
|
||||
, withTempLight 1 100 (V3 0 0 1)
|
||||
, withSoundForI 25 1
|
||||
, withSoundForI elecCrackleS 1
|
||||
, useAmmo 1
|
||||
]
|
||||
, _wpSpread = 0.001
|
||||
@@ -180,7 +180,7 @@ lasGun = defaultAutoGun
|
||||
[ ammoCheckI
|
||||
, useTimeCheckI
|
||||
, withTempLight 1 100 (V3 1 1 0)
|
||||
, withSoundForI 24 1
|
||||
, withSoundForI tone440sawtoothS 1
|
||||
, useAmmo 1
|
||||
]
|
||||
, _wpSpread = 0.001
|
||||
@@ -296,7 +296,7 @@ hvAutoGun = defaultAutoGun
|
||||
, _itUseModifiers =
|
||||
[ ammoCheckI
|
||||
, rateIncABI 24 7 (torqueBeforeAtLeast 0.1 0.1) (torqueAfterI 0.2)
|
||||
, withSoundI longGunSound
|
||||
, withSoundI bangEchoS
|
||||
, withThinSmokeI
|
||||
, withMuzFlareI
|
||||
]
|
||||
@@ -323,7 +323,7 @@ ltAutoGun = defaultAutoGun
|
||||
, _itUseModifiers =
|
||||
[ ammoCheckI
|
||||
, useTimeCheckI
|
||||
, withSoundI 0
|
||||
, withSoundI tap1S
|
||||
, useAmmo 1
|
||||
, withRandomDirI 0.1
|
||||
, torqueAfterI 0.2
|
||||
@@ -359,10 +359,10 @@ miniGun = defaultAutoGun
|
||||
, _itUse = useAmmoParamsVelMod vm4
|
||||
, _itUseModifiers =
|
||||
[ ammoCheckI
|
||||
, withWarmUpI 26
|
||||
, withWarmUpI crankSlowS
|
||||
, useTimeCheckI
|
||||
--, afterRecoil recoilAmount
|
||||
, withSoundForI 28 2
|
||||
, withSoundForI mini1S 2
|
||||
--, withThinSmokeI
|
||||
, torqueAfterI 0.05
|
||||
, withSidePushI 53
|
||||
@@ -429,7 +429,7 @@ spreadGun = defaultGun
|
||||
[ ammoCheckI
|
||||
, hammerCheckI
|
||||
, useTimeCheckI
|
||||
, withSoundI shotgunSound
|
||||
, withSoundI shotgunS
|
||||
, useAmmo 1
|
||||
, withRecoilI 100
|
||||
, withMuzFlareI
|
||||
@@ -461,7 +461,7 @@ multGun = defaultGun
|
||||
[ ammoCheckI
|
||||
, hammerCheckI
|
||||
, useTimeCheckI
|
||||
, withSoundI shotgunSound
|
||||
, withSoundI shotgunS
|
||||
, useAmmo 1
|
||||
, withRecoilI 200
|
||||
, withMuzFlareI
|
||||
@@ -499,7 +499,7 @@ longGun = defaultGun
|
||||
, _wpLoadedAmmo = 1
|
||||
, _wpReloadTime = 100
|
||||
, _wpReloadState = 0
|
||||
, _wpReloadType = PassiveReload skwareFadeTwoSecSound
|
||||
, _wpReloadType = PassiveReload skwareFadeTwoSecS
|
||||
, _itUseRate = 100
|
||||
, _itUseTime = 0
|
||||
, _itUse = useAmmoParams
|
||||
@@ -507,7 +507,7 @@ longGun = defaultGun
|
||||
[ ammoCheckI
|
||||
, hammerCheckI
|
||||
, useTimeCheckI
|
||||
, withSoundI longGunSound
|
||||
, withSoundI bangEchoS
|
||||
, useAmmo 1
|
||||
, withThickSmokeI
|
||||
, torqueAfterI 0.05
|
||||
@@ -553,7 +553,7 @@ poisonSprayer = defaultAutoGun
|
||||
, _itUseModifiers =
|
||||
[ ammoCheckI
|
||||
, useTimeCheckI
|
||||
, withSoundForI foamSpray 5
|
||||
, withSoundForI foamSprayLoopS 5
|
||||
, useAmmo 1
|
||||
, spreadNumI
|
||||
]
|
||||
@@ -752,10 +752,10 @@ moveRemoteBomb itid time pID w
|
||||
$ set (projectiles .ix pID.pjUpdate) (\_ -> moveRemoteBomb itid (f time) pID)
|
||||
w
|
||||
| time < 2 = case hitWl of
|
||||
Just (p,_) -> soundFrom (Tap 0) p tapQuiet Nothing $ halfV updatedWorld
|
||||
Just (p,_) -> soundFrom (Tap 0) p tapQuietS Nothing $ halfV updatedWorld
|
||||
_ -> halfV updatedWorld
|
||||
| otherwise = case hitWl of
|
||||
Just (p,_) -> soundFrom (Tap 0) p tapQuiet Nothing updatedWorld
|
||||
Just (p,_) -> soundFrom (Tap 0) p tapQuietS Nothing updatedWorld
|
||||
_ -> updatedWorld
|
||||
where
|
||||
updatedWorld
|
||||
@@ -875,7 +875,7 @@ fireRemoteLauncher :: Creature -> World -> World
|
||||
fireRemoteLauncher cr w = setLocation
|
||||
$ resetFire
|
||||
$ resetName
|
||||
$ soundFrom (CrWeaponSound cid) pos launcherSound Nothing
|
||||
$ soundFrom (CrWeaponSound cid) pos tap4S Nothing
|
||||
$ over projectiles addRemRocket w
|
||||
where
|
||||
i = IM.newKey $ _projectiles w
|
||||
@@ -923,7 +923,7 @@ moveRemoteShell cid itid pj w
|
||||
( ( pjVel %~ ( (accel +.+) . (frict *.*) ) )
|
||||
. ( pjDir .~ newdir )
|
||||
)
|
||||
& soundFrom (ShellSound i) newPos smokeTrailSound (Just 1)
|
||||
& soundFrom (ShellSound i) newPos missileLaunchS (Just 1)
|
||||
& smokeGen
|
||||
& makeFlameletTimed oldPos 20 (0.5 *.* rotateV (pi+sparkD) accel) Nothing 3 10
|
||||
| time > -200 = case thingHit of
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user