Move debug flags to config, various perf improvements

This commit is contained in:
2021-09-24 13:25:24 +01:00
parent 899cf6ef81
commit 7da1a8bc45
17 changed files with 112 additions and 265 deletions
+5 -5
View File
@@ -48,7 +48,7 @@ soundWithStatus
-> Maybe Int -- ^ Frames to play sound for, Nothing for until finished
-> World
-> World
soundWithStatus status so pos sType mtime w = over sounds (M.insertWith f so sound) w
soundWithStatus status so pos sType mtime w = over toPlaySounds (M.insertWith f so sound) w
where
sound = Sound
{ _soundChunkID = sType
@@ -86,7 +86,7 @@ soundFromGeneral
-> Maybe Int -- ^ Frames to play sound for, Nothing for until finished
-> World
-> World
soundFromGeneral so fpos sType mtime w = over sounds (M.insertWith f so sound) w
soundFromGeneral so fpos sType mtime w = over toPlaySounds (M.insertWith f so sound) w
where
sound = Sound
{ _soundChunkID = sType
@@ -126,7 +126,7 @@ soundMultiFrom
-> World
soundMultiFrom [] _ _ _ w = w
soundMultiFrom [so] pos sType mtime w
= over sounds (M.insert so sound) w
= over toPlaySounds (M.insert so sound) w
where
sound = Sound
{ _soundChunkID = sType
@@ -140,7 +140,7 @@ soundMultiFrom [so] pos sType mtime w
a = soundAngle pos w
soundMultiFrom (so:sos) pos sType mtime w
| so `M.member` _playingSounds w = soundMultiFrom sos pos sType mtime w
| otherwise = over sounds (M.insert so sound) w
| otherwise = over toPlaySounds (M.insert so sound) w
where
sound = Sound
{ _soundChunkID = sType
@@ -154,5 +154,5 @@ soundMultiFrom (so:sos) pos sType mtime w
a = soundAngle pos w
{- | Sets '_soundTime' to 0. -}
stopSoundFrom :: SoundOrigin -> World -> World
stopSoundFrom so = over (sounds . ix so . soundTime) (fmap $ min 0)
stopSoundFrom so = over (playingSounds . ix so . soundTime) (fmap $ min 0)