Add sound on spawn, allow for filtering of to play sounds

This commit is contained in:
2025-12-05 23:19:06 +00:00
parent a4f8369420
commit f9ce58b409
19 changed files with 752 additions and 695 deletions
+1
View File
@@ -39,6 +39,7 @@ data SoundOrigin
| EBSound Int
| DamageHitSound Int
| PBSound Int
| SpawnSound
deriving (Eq, Ord, Show, Read) --Generic, Flat)
-3
View File
@@ -14,7 +14,6 @@ module Dodge.Data.Universe (
import Control.Lens
import qualified Data.IntMap.Strict as IM
import qualified Data.Map.Strict as M
--import qualified Data.Map.Strict as M
import Data.Preload
import Data.Sequence (Seq (..))
import Dodge.Data.Config
@@ -26,8 +25,6 @@ import Loop.Data
import Picture.Data
import Sound.Data
--import SDL (Scancode)
data Universe = Universe
{ _uvWorld :: World
, _preloadData :: PreloadData
+1
View File
@@ -39,6 +39,7 @@ data World = World
, _randGen :: StdGen
, _toPlaySounds :: M.Map SoundOrigin Sound
, _playingSounds :: M.Map SoundOrigin Sound
, _wSoundFilter :: SoundFilter
, _input :: Input
, _testFloat :: Float
, _rbState :: RightButtonState
+7
View File
@@ -3,6 +3,7 @@
module Dodge.Data.WorldEffect where
import qualified Data.Set as S
import Dodge.Data.Item.Location
import NewInt
import Dodge.Data.LightSource
@@ -17,6 +18,10 @@ data ItCrWdWd = ItCrWdItemHeldEffect
| ItCrWdItemHeldEffectNoHammer
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
data SoundFilter
= FilterBySoundOrigin (S.Set SoundOrigin)
| NoSoundFilter
data WdWd
= NoWorldEffect
| SetTrigger Bool Int
@@ -33,6 +38,7 @@ data WdWd
| MakeTempLightFade Float LSParam Int
| UseInvItem Int Int -- invid presstime
| WdWdBurstFireRepetition Int (NewInt InvInt)
| WdWdSetSoundFilter SoundFilter
--deriving (Eq, Show, Read) --, Generic)
--h--deriving (Eq, Show, Read) --Generic, Flat)
@@ -61,6 +67,7 @@ data WdP2f
= WdP2f0
| WdP2fDoorPosition Int
deriveJSON defaultOptions ''SoundFilter
deriveJSON defaultOptions ''ItCrWdWd
deriveJSON defaultOptions ''WdWd
deriveJSON defaultOptions ''WdP2