Try to move sound into world, slightly broken now

This commit is contained in:
2021-09-08 19:12:54 +01:00
parent 04e5b9b39f
commit c3d567353c
9 changed files with 33 additions and 56 deletions
+4 -4
View File
@@ -14,7 +14,7 @@ import Data.Aeson (encodeFile)
{- |
Write the current world configuration to disk as a json file.
-}
saveConfig :: Configuration -> PreloadData SoundOrigin -> IO (PreloadData SoundOrigin)
saveConfig :: Configuration -> PreloadData -> IO PreloadData
saveConfig cfig d = do
putStrLn "Saving config to data/dodge.config.json"
encodeFile "data/dodge.config.json" cfig
@@ -23,7 +23,7 @@ saveConfig cfig d = do
{- |
Apply the volume settings from the world configuration to the running game.
-}
setVol :: Configuration -> PreloadData SoundOrigin -> IO (PreloadData SoundOrigin)
setVol :: Configuration -> PreloadData -> IO PreloadData
setVol cfig d = do
setSoundVolume ( _volume_master cfig * _volume_sound cfig)
setMusicVolume ( _volume_master cfig * _volume_music cfig)
@@ -34,8 +34,8 @@ Apply /all/ of the values in the world configuration to the running game.
-}
applyWorldConfig
:: Configuration
-> PreloadData SoundOrigin
-> IO (PreloadData SoundOrigin)
-> PreloadData
-> IO PreloadData
applyWorldConfig cfig pdata = do
setVol cfig pdata >>= pdataResizeUpdate (x `div` divRes) (y `div` divRes) x y
where