Further implementation of poitional sound

This commit is contained in:
2021-04-06 19:19:23 +02:00
parent 48ef0c0088
commit 47ac104520
9 changed files with 44 additions and 26 deletions
+11 -2
View File
@@ -1,6 +1,6 @@
module Dodge.SoundLogic where
import Dodge.Data
import Sound.Preload (SoundStatus (..))
import Sound.Data (SoundStatus (..))
import Geometry.Vector
import Control.Lens
@@ -16,7 +16,16 @@ resumeSound :: World -> World
resumeSound w = w
soundOnce :: Int -> World -> World
soundOnce i = over soundQueue ((:) i)
soundOnce i = over soundQueue ((:) (i,0))
soundOncePos :: Int -> Point2 -> World -> World
soundOncePos i pos w = over soundQueue ((:) (i,a)) w
where
a = round
. radToDeg
. normalizeAngle
. (+ pi)
$ argV (vNormal (pos -.- _cameraViewFrom w)) - _cameraRot w
soundOnceOrigin :: Int -> SoundOrigin -> World -> World
soundOnceOrigin sType so = over sounds (M.insertWith (flip const) so sound)