Add support for directional sound
This commit is contained in:
@@ -810,7 +810,7 @@ moveShell time i cid rot accel w
|
||||
$ set (projectiles . ix i . pjUpdate)
|
||||
(moveShell (time-1) i cid rot (rotateV rot accel))
|
||||
$ over (projectiles . ix i . pjVel) (\v -> accel +.+ frict *.* v)
|
||||
$ soundFrom (ShellSound i) (fromIntegral smokeTrailSound) (1) 250
|
||||
$ soundFromPos (ShellSound i) newPos (fromIntegral smokeTrailSound) (1) 250
|
||||
$ makeFlameletTimed oldPos
|
||||
(0.5 *.* rotateV (pi+sparkD) accel) Nothing 3 10
|
||||
$ smokeGen
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
module Dodge.SoundLogic where
|
||||
import Dodge.Data
|
||||
import Sound.Preload (SoundStatus (..))
|
||||
import Geometry.Vector
|
||||
|
||||
import Control.Lens
|
||||
import qualified Data.Map as M
|
||||
@@ -29,6 +30,24 @@ soundOnceOrigin sType so = over sounds (M.insertWith (flip const) so sound)
|
||||
, _soundPos = Nothing
|
||||
}
|
||||
|
||||
soundFromPos :: SoundOrigin -> Point2 -> Int -> Int -> Int -> World -> World
|
||||
soundFromPos so pos sType time fadeTime w = over sounds (M.insertWith f so sound) w
|
||||
where
|
||||
sound = Sound
|
||||
{ _soundChunkID = sType
|
||||
, _soundTime = Just time
|
||||
, _soundStatus = ToStart
|
||||
, _soundFadeTime = fadeTime
|
||||
, _soundChannel = Nothing
|
||||
, _soundPos = Just (a,0)
|
||||
}
|
||||
f _ s = s {_soundTime = Just time, _soundFadeTime = fadeTime}
|
||||
a = round
|
||||
. radToDeg
|
||||
. normalizeAngle
|
||||
. (+ pi)
|
||||
$ argV (vNormal (pos -.- _cameraViewFrom w)) - _cameraRot w
|
||||
|
||||
soundFrom :: SoundOrigin -> Int -> Int -> Int -> World -> World
|
||||
soundFrom so sType time fadeTime w = over sounds (M.insertWith f so sound) w
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user