Tweak sound

This commit is contained in:
2021-04-05 14:34:32 +02:00
parent a7e56d727d
commit f7e0b40cd5
3 changed files with 43 additions and 9 deletions
+5 -3
View File
@@ -19,9 +19,10 @@ soundOnceOrigin :: Int -> SoundOrigin -> World -> World
soundOnceOrigin sType so = over sounds (M.insertWith (flip const) so sound)
where
sound = Sound
{ _soundType = sType
{ _soundChunkID = sType
, _soundTime = Nothing
, _soundFadeTime = 0
, _soundIsFadingOut = False
, _soundChannel = Nothing
, _soundPos = Nothing
}
@@ -30,8 +31,9 @@ soundFrom :: SoundOrigin -> Int -> Int -> Int -> World -> World
soundFrom so sType time fadeTime w = over sounds (M.insertWith f so sound) w
where
sound = Sound
{ _soundType = sType
{ _soundChunkID = sType
, _soundTime = Just time
, _soundIsFadingOut = False
, _soundFadeTime = fadeTime
, _soundChannel = Nothing
, _soundPos = Nothing
@@ -43,7 +45,7 @@ soundMultiFrom [] _ _ _ w = w
soundMultiFrom (so:sos) sType time fadeTime w
| so `M.member` _sounds w = soundMultiFrom sos sType time fadeTime w
| otherwise = over sounds (M.insert so sound) w
where sound = Sound { _soundType = sType
where sound = Sound { _soundChunkID = sType
, _soundTime = Nothing
, _soundFadeTime = fadeTime
, _soundChannel = Nothing