Try to move sound into world, slightly broken now
This commit is contained in:
@@ -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
|
||||
|
||||
+4
-3
@@ -78,6 +78,7 @@ data World = World
|
||||
, _buttons :: IM.IntMap Button
|
||||
, _soundQueue :: [(Int,Int16)]
|
||||
, _sounds :: M.Map SoundOrigin Sound
|
||||
, _playingSounds :: M.Map SoundOrigin Sound
|
||||
, _decorations :: IM.IntMap Picture
|
||||
, _foregroundDecorations :: [Polyhedra]
|
||||
, _foregroundEdgeVerx :: [Point3]
|
||||
@@ -102,14 +103,14 @@ data World = World
|
||||
, _selLocation :: Int
|
||||
, _keyConfig :: KeyConfigSDL
|
||||
, _config :: Configuration
|
||||
, _sideEffects :: [PreloadData SoundOrigin -> IO (PreloadData SoundOrigin)]
|
||||
, _doneSideEffects :: [PreloadData SoundOrigin -> IO (PreloadData SoundOrigin)]
|
||||
, _sideEffects :: [PreloadData -> IO PreloadData]
|
||||
, _doneSideEffects :: [PreloadData -> IO PreloadData]
|
||||
, _debugFlags :: DebugFlags
|
||||
, _inventoryMode :: InventoryMode
|
||||
, _lClickHammer :: HammerPosition
|
||||
, _radDistortion :: [(Point2,Point2,Point2,Float)]
|
||||
, _gameRooms :: [GameRoom]
|
||||
, _preloadData :: PreloadData SoundOrigin
|
||||
, _preloadData :: PreloadData
|
||||
}
|
||||
data OptionScreenFlag = NormalOptions | GameOverOptions
|
||||
data ScreenLayer
|
||||
|
||||
@@ -50,10 +50,10 @@ defaultWorld = World
|
||||
, _buttons = IM.empty
|
||||
, _soundQueue = []
|
||||
, _sounds = M.empty
|
||||
, _playingSounds = M.empty
|
||||
, _corpses = IM.empty
|
||||
, _decorations = IM.empty
|
||||
, _storedLevel = Nothing
|
||||
--, _menuLayers = [levelMenu 1]
|
||||
, _menuLayers = []
|
||||
, _worldState = M.empty
|
||||
, _worldTriggers = S.empty
|
||||
|
||||
Reference in New Issue
Block a user