Add marimba sounds for crystal hits

This commit is contained in:
2025-11-23 19:39:07 +00:00
parent 92e4552f66
commit 5f29c20d39
6 changed files with 231 additions and 180 deletions
+34 -3
View File
@@ -24,7 +24,7 @@ damMatSideEffect dm = \case
Flesh -> damageFlesh dm
Dirt -> damageDirt dm
Glass -> damageGlass dm
Crystal -> \ecw -> set _1 0 . defDamageMaterial dm ecw
Crystal -> damageCrystal dm
_ -> defDamageMaterial dm
defDamageMaterial :: Damage -> ECW -> World -> (Int,World)
@@ -153,12 +153,12 @@ damageDirt dm _ w =
damageGlass :: Damage -> ECW -> World -> (Int,World)
damageGlass dm ecw w = case dm of
Lasering _ _ t -> f 0 $ id
Lasering {} -> f 0 $ id
Piercing _ p t ->
f dmam $ makeSpark NormalSpark (outTo p t) (rdir p t)
-- . makeDustAt Stone 200 (addZ 20 (outTo p t))
. randsound p [smallGlass1S, smallGlass2S, smallGlass3S, smallGlass4S]
Blunt _ p t -> f dmam $ -- makeDustAt Stone 200 (addZ 20 (outTo p t))
Blunt _ p _ -> f dmam $ -- makeDustAt Stone 200 (addZ 20 (outTo p t))
randsound p [smallGlass1S, smallGlass2S, smallGlass3S, smallGlass4S]
Shattering _ p t -> f dmam $ makeDustAt Glass 200 (addZ 20 (outTo p t))
. randsound p [smallGlass1S, smallGlass2S, smallGlass3S, smallGlass4S]
@@ -216,3 +216,34 @@ damageGlass dm ecw w = case dm of
-- outTo = p +.+ squashNormalizeV (sp -.- p)
-- pSparkCol = V4 5 1 0.5 2
-- lSparkCol = V4 20 (-5) 0 1
damageCrystal :: Damage -> ECW -> World -> (Int,World)
damageCrystal dm ecw w = case dm of
Lasering {} -> f $ id
Piercing _ p t ->
f $ makeSpark NormalSpark (outTo p t) (rdir p t)
. randsound p [marimbaC5S,marimbaE5S,marimbaG5S,marimbaB6S]
Blunt _ p _ -> f $ -- makeDustAt Stone 200 (addZ 20 (outTo p t))
randsound p [marimbaC5S,marimbaE5S,marimbaG5S,marimbaB6S]
Shattering _ p _ -> f $ randsound p [marimbaC5S,marimbaE5S,marimbaG5S,marimbaB6S]
Crushing{} -> f id
Explosive _ p -> f -- the sound comes from the explosion center, which is not correct...
$ randsound p [smallGlass1S, smallGlass2S, smallGlass3S, smallGlass4S]
Sparking{} -> f id
Flaming{} -> f id
Electrical{} -> f id
Poison{} -> f id
Enterrement{} -> f id
Flashing{} -> f id
where
f g = (0, g w)
rdir p t = argV $ reflectIn v t
where
v = case ecw of
Right wl -> uncurry (-) $ _wlLine wl
Left cr -> vNormal (p - cr ^. crPos . _xy)
randsound p xs =
let (x, g) = runState (takeOne xs) $ _randGen w
in soundStart so p x Nothing . set randGen g
so = DamageHitSound (w ^. cWorld . lWorld . lClock)
outTo x t = x -.- squashNormalizeV t