Refactor sound
This commit is contained in:
@@ -6,8 +6,10 @@ import Dodge.Base
|
||||
import Dodge.Zone
|
||||
import Dodge.Zone.Data
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.WorldEvent.Sound
|
||||
import Dodge.LevelGen.Pathing
|
||||
import Dodge.RandomHelp
|
||||
import Geometry
|
||||
import Picture.Data
|
||||
import qualified IntMapHelp as IM
|
||||
@@ -46,12 +48,12 @@ killBlock bl w = f bl . flip (foldr unshadow) (_blShadows bl) $ w
|
||||
pos = fst $ _wlLine bl
|
||||
breakHitSound bl'
|
||||
| _wlIsSeeThrough bl' = mkSoundBreakGlass pos
|
||||
| otherwise = soundMultiFrom sos (fst $ _wlLine bl') (soundid + 4) Nothing
|
||||
| otherwise = soundMultiFrom sos (fst $ _wlLine bl') impactSound Nothing
|
||||
hitSound' bl'
|
||||
| _wlIsSeeThrough bl' = mkSoundSplinterGlass pos
|
||||
| otherwise = soundMultiFrom sos (fst $ _wlLine bl') soundid Nothing
|
||||
| otherwise = soundMultiFrom sos (fst $ _wlLine bl') impactSound Nothing
|
||||
sos = [BlockDegradeSound 0,BlockDegradeSound 1]
|
||||
(soundid,_) = randomR (29,32) $ _randGen w
|
||||
impactSound = evalState (takeOne [impact1S,impact2S,impact3S,impact4S]) $ _randGen w
|
||||
unshadow :: Int -> World -> World
|
||||
unshadow bid w' = case w' ^? walls . ix bid of
|
||||
Just b ->
|
||||
|
||||
@@ -11,7 +11,7 @@ import Dodge.Base
|
||||
import Dodge.Zone
|
||||
import Dodge.Zone.Data
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.Synonyms
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Geometry
|
||||
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
@@ -70,7 +70,7 @@ addSoundToDoor i pld hwd (x:ys) = f x : ys
|
||||
where
|
||||
g dm w
|
||||
| dist wp pld > 2 && dist wp hwd > 2
|
||||
= soundFrom (WallSound i) wp doorSound (Just 1) $ dm w
|
||||
= soundFrom (WallSound i) wp slideDoorS (Just 1) $ dm w
|
||||
| otherwise = dm w
|
||||
where
|
||||
wp = fst $ _wlLine (_walls w IM.! i)
|
||||
|
||||
@@ -3,6 +3,7 @@ module Dodge.LevelGen.Switch
|
||||
import Dodge.Data
|
||||
import Dodge.Data.SoundOrigin
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.SoundLogic.LoadSound
|
||||
import Dodge.Picture.Layer
|
||||
import Picture
|
||||
import Geometry
|
||||
@@ -19,7 +20,7 @@ makeButton c eff = Button
|
||||
, _btPos = V2 0 0
|
||||
, _btRot = 0
|
||||
, _btEvent = \b w -> eff . over buttons (IM.adjust turnOn (_btID b))
|
||||
. soundFromGeneral (LeverSound 0) (btpos b) 1 Nothing $ w
|
||||
. soundFromGeneral (LeverSound 0) (btpos b) click1S Nothing $ w
|
||||
, _btID = 0
|
||||
, _btText = "Button"
|
||||
--, _btText = "Button"
|
||||
@@ -45,7 +46,7 @@ makeSwitch c effOn effOff = Button
|
||||
, _btState = BtOff
|
||||
}
|
||||
where
|
||||
flipSwitch b w = switchEffect b . soundFromGeneral (LeverSound 0) (bpos b) 1 Nothing $ w
|
||||
flipSwitch b w = switchEffect b . soundFromGeneral (LeverSound 0) (bpos b) click1S Nothing $ w
|
||||
bpos b w = _btPos $ _buttons w IM.! _btID b
|
||||
switchEffect b = case _btState b of
|
||||
BtOff -> effOn . over buttons (IM.adjust turnOn (_btID b))
|
||||
|
||||
Reference in New Issue
Block a user