Simplify shockwave damages

This commit is contained in:
2025-06-23 18:15:28 +01:00
parent 4e008366f4
commit 54eab6dd9e
12 changed files with 468 additions and 457 deletions
+19 -21
View File
@@ -1,6 +1,4 @@
module Dodge.Bullet (
updateBullet,
) where
module Dodge.Bullet (updateBullet) where
import Data.Bifunctor
import Data.Foldable
@@ -20,8 +18,9 @@ import System.Random
updateBullet :: World -> Bullet -> (World, Maybe Bullet)
updateBullet w bu
| magV (_buVel bu) < 10
, BulBall _ <- _buPayload bu = (useBulletPayload bu (_buPos bu) w, Nothing)
| magV (_buVel bu) < 10
, BulBall _ <- _buPayload bu =
(useBulletPayload bu (_buPos bu) w, Nothing)
| magV (_buVel bu) < 1 = (useBulletPayload bu (_buPos bu) w, Nothing)
-- have to be slightly carefull not to accelerate bullets using magnets
| otherwise = second (Just . updateBulVel) . hitEffFromBul w $ applyMagnetsToBul bu w
@@ -106,8 +105,8 @@ updateBulVel bt = bt & buVel .*.*~ _buDrag bt
-- return $ BezierTrajectory sp tpos (mouseWorldPos (w ^. input) (w ^. wCam))
bounceDir :: (Point2, Either Creature Wall) -> Maybe Point2
bounceDir (_, Right wl) | _wlBouncy wl = Just $ uncurry (-.-) (_wlLine wl)
bounceDir (p, Left cr) | crIsArmouredFrom p cr = Just $ vNormal $ p -.- _crPos cr
bounceDir (_, Right wl) | _wlBouncy wl = Just $ uncurry (-) (_wlLine wl)
bounceDir (p, Left cr) | crIsArmouredFrom p cr = Just $ vNormal $ p - _crPos cr
bounceDir _ = Nothing
useBulletPayload :: Bullet -> Point2 -> World -> World
@@ -117,10 +116,12 @@ useBulletPayload bu = case _buPayload bu of
BulFrag -> makeFragBullets
BulGas -> (`makeGasCloud` V2 0 0)
BulBall ExplosiveBall -> makeMovingEB (_buVel bu) ExplosiveBall
BulBall ElectricalBall{} -> makeMovingEB (_buVel bu)
(ElectricalBall (round $ bu ^. buPos . _1))
BulBall ElectricalBall{} ->
makeMovingEB
(_buVel bu)
(ElectricalBall (round $ bu ^. buPos . _1))
BulBall FlashBall -> makeMovingEB (_buVel bu) FlashBall
BulBall (FlameletBall x r) -> makeMovingEB (_buVel bu) (FlameletBall x r)
BulBall (FlameletBall x r) -> makeMovingEB (_buVel bu) (FlameletBall x r)
BulBall IncendiaryBall -> makeMovingEB (_buVel bu) IncendiaryBall
makeFragBullets :: Point2 -> World -> World
@@ -130,7 +131,7 @@ makeFragBullets p w = w & cWorld . lWorld . bullets .++~ bus
as = randomRs (0, 2 * pi) $ _randGen w
ss = randomRs (5, 15) $ _randGen w
f a s =
defaultBullet
defaultBullet
& buPayload .~ BulPlain 5
& buVel .~ s *.* unitVectorAtAngle a
& buDrag .~ 0.8
@@ -143,7 +144,8 @@ makeFlak bu _ w = w & cWorld . lWorld . bullets .++~ [f x | x <- xs]
where
s = min 10 (0.5 * magV (_buVel bu))
xs = take 5 $ randomRs (- s, s) $ _randGen w
f x = bu & buVel %~ g x
f x =
bu & buVel %~ g x
& buPayload .~ BulPlain 25
& buWidth .~ 0.5
g x v = v +.+ x *.* normalizeV (vNormal v)
@@ -171,13 +173,12 @@ setFromToDams bu p = case _buPayload bu of
_ -> []
where
v = _buVel bu
-- f = (dmFrom .~ _buPos bu) . (dmAt .~ p) . (dmTo .~ _buPos bu +.+ _buVel bu)
damageThingHit :: Bullet -> (Point2, Either Creature Wall) -> World -> World
damageThingHit bu (p, crwl) = case crwl of
Left cr -> cWorld . lWorld . creatures . ix (_crID cr) . crDamage .++~ dams
-- Right wl -> cWorld . lWorld . wallDamages %~ IM.insertWith (++) (_wlID wl) dams
-- hopefully the following doesn't introduce a space leak
Left cr -> cWorld . lWorld . creatures . ix (_crID cr) . crDamage <>~ dams
Right wl -> cWorld . lWorld . wallDamages . at (_wlID wl) . non mempty <>~ dams
where
dams = setFromToDams bu p
@@ -195,16 +196,13 @@ moveBullet :: Bullet -> Bullet
moveBullet pt = pt & buPos +~ _buVel pt & buOldPos .~ _buPos pt
stopBulletAt :: Point2 -> Bullet -> Bullet
stopBulletAt hitp pt =
pt
& buPos .~ hitp
& buOldPos .~ _buPos pt
& buVel .~ 0
stopBulletAt hitp pt = pt & buPos .~ hitp & buOldPos .~ _buPos pt & buVel .~ 0
movePenBullet :: Bullet -> [(Point2, Either Creature Wall)] -> World -> (World, Bullet)
movePenBullet bu hitstream w = case hitstream of
[] -> (w, moveBullet bu)
((p, crwl) : strm) | penThing crwl ->
((p, crwl) : strm)
| penThing crwl ->
first (damageThingHit bu (p, crwl)) $ movePenBullet bu strm w
_ -> expireAndDamage bu hitstream w
+2 -2
View File
@@ -1,4 +1,4 @@
module Dodge.Item.Weapon.Shatter where
module Dodge.Item.Weapon.Shatter (shootShatter) where
import Dodge.Base.Collide
import Dodge.Block.Debris
@@ -31,7 +31,7 @@ shatterWall w sp ep p wl =
1
2
(pi / 2)
(argV $ vNormal $ uncurry (-.-) $ _wlLine wl)
(argV $ vNormal $ uncurry (-) $ _wlLine wl)
(_wlMaterial wl)
(_wlColor wl)
p
+1 -3
View File
@@ -1,6 +1,4 @@
module Dodge.Laser.Update (
updateLaser,
) where
module Dodge.Laser.Update ( updateLaser) where
import Dodge.Damage
import Control.Lens
+12 -11
View File
@@ -59,10 +59,12 @@ damageMetal dm ecw w =
Lasering _ p t -> makeSpark FireSpark (outTo p t) (rdir p t)
Piercing _ p t ->
makeSpark NormalSpark (outTo p t) (rdir p t)
. randsound p [tingS, ting1S, ting2S, ting3S, ting4S, ting5S]
. randsound p [clangS,clang1S
,tingS, ting1S, ting2S, ting3S, ting4S, ting5S]
-- . randsound p [tingS, ting1S, ting2S, ting3S, ting4S, ting5S]
Blunt _ p t ->
makeSpark NormalSpark (outTo p t) (rdir p t)
. randsound p [tingS, ting1S, ting2S, ting3S, ting4S, ting5S]
. randsound p [clangS,clang1S,clang2S]
Shattering _ _ _ -> id
Crushing{} -> id
Explosive{} -> id
@@ -85,7 +87,7 @@ damageMetal dm ecw w =
so = DamageHitSound (w ^. cWorld . lWorld . lClock)
damageFlesh :: Damage -> ECW -> World -> World
damageFlesh dm ecw w = w & case dm of
damageFlesh dm _ w = w & case dm of
Lasering _ _ _ -> id
Piercing _ p t ->
randsound
@@ -101,7 +103,7 @@ damageFlesh dm ecw w = w & case dm of
]
. smokeCloudAt red 20 200 1 (addZ 20 (outTo p t))
Blunt _ p _ -> randsound p [hitS]
Shattering _ p t -> id
Shattering _ _ _ -> id
Crushing{} -> id
Explosive{} -> id
Sparking{} -> id
@@ -111,9 +113,6 @@ damageFlesh dm ecw w = w & case dm of
Enterrement{} -> id
Flashing{} -> id
where
v = case ecw of
Right wl -> uncurry (-) $ _wlLine wl
Left cr -> undefined
randsound p xs =
let (x, g) = runState (takeOne xs) $ _randGen w
in soundStart so p x Nothing . set randGen g
@@ -123,7 +122,7 @@ damageFlesh dm ecw w = w & case dm of
damageDirt :: Damage -> ECW -> World -> World
damageDirt dm ecw w =
w & case dm of
Lasering _ p t -> makeSpark FireSpark (outTo p t) (argV $ reflectIn v t)
Lasering _ p t -> makeSpark FireSpark (outTo p t) (rdir p t)
Piercing _ p t ->
smokeCloudAt orange 20 200 1 (addZ 20 (outTo p t))
. randsound p [slapS, slap1S]
@@ -138,9 +137,11 @@ damageDirt dm ecw w =
Enterrement{} -> id
Flashing{} -> id
where
v = case ecw of
Right wl -> uncurry (-) $ _wlLine wl
Left cr -> undefined
rdir p t = argV $ reflectIn v t
where
v = case ecw of
Right wl -> uncurry (-) $ _wlLine wl
Left cr -> vNormal (p - _crPos cr)
randsound p xs =
let (x, g) = runState (takeOne xs) $ _randGen w
in soundStart so p x Nothing . set randGen g
+2 -2
View File
@@ -11,8 +11,8 @@ destroyMatS mat = case mat of
Stone -> [stone1S, stone2S, stone3S, stone4S, stone5S]
Dirt -> [stone1S, stone3S]
Wood -> [stone1S, stone3S]
Metal -> [metal1S, metal2S, metal3S, metal4S, metal5S, metal6S, metal7S]
Electronics -> [metal1S, metal2S, metal3S, metal4S, metal5S, metal6S, metal7S]
Metal -> [metal1S, metal2S, metal3S, metal4S, metal5S, metal6S,metal7S]
Electronics -> [metal1S, metal2S, metal3S, metal4S, metal5S, metal6S,metal7S]
Flesh -> [gut1S, gut2S, gut3S, gut4S, gut5S, gut6S]
weakenMatS :: Material -> [SoundID]
+14 -16
View File
@@ -1,11 +1,8 @@
module Dodge.Shockwave.Update (updateShockwave) where
import Data.Foldable
import Dodge.Base.Collide
import Dodge.Damage
import Dodge.Creature.Radius
import Dodge.Data.World
import Dodge.Wall.Damage
import Dodge.Zoning.Wall
import Geometry.Vector
import qualified IntMapHelp as IM
import LensHelp
@@ -20,24 +17,25 @@ moveShockwave w sw
| _swTimer sw <= 0 = (w, Nothing)
| otherwise = (doDams w, Just $ sw & swTimer -~ 1)
where
is = _swInvulnerableCrs sw
-- is = _swInvulnerableCrs sw
r = _swRad sw
p = _swPos sw
dam = _swDam sw
t = _swTimer sw
tFraction = fromIntegral t / fromIntegral (_swMaxTime sw)
rad = r - (3 / 4) * r * tFraction
doDams w' =
over (cWorld . lWorld . creatures) (IM.map damCr) $
foldl'
(flip $ damageWall (Explosive 1000 p))
w'
hitBlocks
hitBlocks = map snd . overlapCircWalls p rad $ wlsNearCirc p rad w
-- this is not expansive enough
damCr cr
| _crID cr `elem` is || dist (_crPos cr) p >= rad + crRad (cr ^. crType) = cr
| otherwise = cr & crDamage .:~ Explosive dam p
doDams = damageInCircle (Explosive dam) p rad
-- doDams w' =
-- over (cWorld . lWorld . creatures) (IM.map damCr) $
-- foldl'
-- (flip $ damageWall (Explosive 1000 p))
-- w'
-- hitBlocks
-- hitBlocks = map snd . overlapCircWalls p rad $ wlsNearCirc p rad w
-- -- this is not expansive enough
-- damCr cr
-- | _crID cr `elem` is || dist (_crPos cr) p >= rad + crRad (cr ^. crType) = cr
-- | otherwise = cr & crDamage .:~ Explosive dam p
--where
-- cpos = _crPos cr
+258 -243
View File
@@ -1,4 +1,4 @@
-- generated at 2025-06-22 13:29:03.952552964 UTC
-- generated at 2025-06-22 21:26:57.684446959 UTC
module Dodge.SoundLogic.ExternallyGeneratedSounds where
import Sound.Data
soundToVol :: SoundID -> Float
@@ -44,89 +44,92 @@ soundToVol v = case _getSoundID v of
38 -> 1000
39 -> 200
40 -> 1000
41 -> 40
42 -> 400
43 -> 2000
44 -> 100
45 -> 300
46 -> 50
47 -> 2000
48 -> 50
49 -> 1000
50 -> 8000
51 -> 2000
52 -> 2000
53 -> 1000
54 -> 200
55 -> 2000
56 -> 100
57 -> 100
58 -> 40
41 -> 500
42 -> 40
43 -> 400
44 -> 2000
45 -> 100
46 -> 300
47 -> 50
48 -> 2000
49 -> 50
50 -> 500
51 -> 1000
52 -> 8000
53 -> 2000
54 -> 2000
55 -> 1000
56 -> 200
57 -> 2000
58 -> 100
59 -> 100
60 -> 40
61 -> 2000
62 -> 100
63 -> 500
64 -> 40
65 -> 100
66 -> 300
67 -> 300
68 -> 100
69 -> 2000
70 -> 1000
71 -> 1000
61 -> 100
62 -> 40
63 -> 2000
64 -> 100
65 -> 500
66 -> 40
67 -> 100
68 -> 300
69 -> 300
70 -> 100
71 -> 2000
72 -> 1000
73 -> 100
74 -> 100
75 -> 1000
76 -> 1000
77 -> 40
78 -> 50
79 -> 1000
80 -> 500
81 -> 500
82 -> 100
83 -> 100
84 -> 1000
85 -> 20
86 -> 500
87 -> 300
88 -> 200
89 -> 500
90 -> 1000
91 -> 200
73 -> 1000
74 -> 1000
75 -> 100
76 -> 100
77 -> 1000
78 -> 1000
79 -> 40
80 -> 50
81 -> 1000
82 -> 500
83 -> 500
84 -> 100
85 -> 100
86 -> 1000
87 -> 20
88 -> 500
89 -> 300
90 -> 200
91 -> 500
92 -> 1000
93 -> 2000
94 -> 500
95 -> 200
96 -> 100
97 -> 1000
98 -> 300
99 -> 2000
100 -> 2000
101 -> 100
102 -> 500
103 -> 2000
104 -> 100
105 -> 300
106 -> 1000
107 -> 200
108 -> 100
93 -> 200
94 -> 1000
95 -> 2000
96 -> 500
97 -> 200
98 -> 100
99 -> 1000
100 -> 300
101 -> 2000
102 -> 2000
103 -> 100
104 -> 500
105 -> 2000
106 -> 500
107 -> 100
108 -> 300
109 -> 1000
110 -> 2000
111 -> 1000
112 -> 100
113 -> 200
114 -> 500
110 -> 200
111 -> 100
112 -> 1000
113 -> 2000
114 -> 1000
115 -> 100
116 -> 2000
117 -> 200
118 -> 1000
116 -> 200
117 -> 500
118 -> 100
119 -> 2000
120 -> 2000
121 -> 200
122 -> 100
123 -> 200
120 -> 200
121 -> 1000
122 -> 2000
123 -> 2000
124 -> 200
125 -> 100
126 -> 200
_ -> 50
soundToOnomato :: SoundID -> String
soundToOnomato v = case _getSoundID v of
@@ -171,89 +174,92 @@ soundToOnomato v = case _getSoundID v of
38 -> "TRWNG"
39 -> "TING"
40 -> "CRASH"
41 -> "TAPTIP"
42 -> "CRNKCRNKCRNK"
43 -> "CHUGUGUG"
44 -> "SKWLL"
45 -> "WRRR"
46 -> "HSSS"
47 -> "BOOM"
48 -> "HSS"
49 -> "TAKH"
50 -> "RINGGG"
51 -> "CRH"
52 -> "UGGAUGGA"
53 -> "CRUMPLE"
54 -> "TING"
55 -> "CREUH"
56 -> "KKSQWL"
57 -> "SMACK"
58 -> "CLICK"
59 -> "SPRT"
60 -> "TIPTOP"
61 -> "CRUH"
62 -> "CHNKCHNKCHUNK"
63 -> "CLKCLK"
64 -> "TIPTAP"
65 -> "SKWLCH"
66 -> "TNKTNKTNK"
67 -> "CHPCHPCHP"
68 -> "SLP"
69 -> "SCREE"
70 -> "DHDHL"
71 -> "BRAP"
72 -> "CRSK"
73 -> "SPLRT"
74 -> "SKWLL"
75 -> "CRNKL"
76 -> "TRNKL"
77 -> "TAPP"
78 -> "SHUHP"
79 -> "CRUMBL"
80 -> "DEDEDUM"
81 -> "TAK"
82 -> "SPLRT"
83 -> "SQLEE"
84 -> "CRISH"
85 -> "SWSH"
86 -> "BIPBIPBIP"
87 -> "BEP"
88 -> "CRSKRL"
89 -> "KRTNKL"
90 -> "CRSNK"
91 -> "SHTCK"
92 -> "TTRKL"
93 -> "UGGAUGGA"
94 -> "DUDURAH"
95 -> "TING"
96 -> "KKSQWL"
97 -> "CRMPL"
98 -> "BWEP"
99 -> "CHUGUGUG"
100 -> "BANG"
101 -> "SLPP"
102 -> "DEDA"
103 -> "WHSSH"
104 -> "HNH"
105 -> "BWAH"
106 -> "CRUNK"
107 -> "SQWLTCH"
108 -> "DRR"
109 -> "TRNKL"
110 -> "BRAP"
111 -> "BLPCHCH"
112 -> "SKLE"
113 -> "ZMM"
114 -> "WRRR"
115 -> "FWUMP"
116 -> "BRAHCHCH"
117 -> "TING"
118 -> "BWMP"
119 -> "BRPBRPBRP"
120 -> "WE-OH"
121 -> "THCK"
122 -> "FHP"
123 -> "QWLPH"
41 -> "CLANG"
42 -> "TAPTIP"
43 -> "CRNKCRNKCRNK"
44 -> "CHUGUGUG"
45 -> "SKWLL"
46 -> "WRRR"
47 -> "HSSS"
48 -> "BOOM"
49 -> "HSS"
50 -> "CLANG"
51 -> "TAKH"
52 -> "RINGGG"
53 -> "CRH"
54 -> "UGGAUGGA"
55 -> "CRUMPLE"
56 -> "TING"
57 -> "CREUH"
58 -> "KKSQWL"
59 -> "SMACK"
60 -> "CLICK"
61 -> "SPRT"
62 -> "TIPTOP"
63 -> "CRUH"
64 -> "CHNKCHNKCHUNK"
65 -> "CLKCLK"
66 -> "TIPTAP"
67 -> "SKWLCH"
68 -> "TNKTNKTNK"
69 -> "CHPCHPCHP"
70 -> "SLP"
71 -> "SCREE"
72 -> "DHDHL"
73 -> "BRAP"
74 -> "CRSK"
75 -> "SPLRT"
76 -> "SKWLL"
77 -> "CRNKL"
78 -> "TRNKL"
79 -> "TAPP"
80 -> "SHUHP"
81 -> "CRUMBL"
82 -> "DEDEDUM"
83 -> "TAK"
84 -> "SPLRT"
85 -> "SQLEE"
86 -> "CRISH"
87 -> "SWSH"
88 -> "BIPBIPBIP"
89 -> "BEP"
90 -> "CRSKRL"
91 -> "KRTNKL"
92 -> "CRSNK"
93 -> "SHTCK"
94 -> "TTRKL"
95 -> "UGGAUGGA"
96 -> "DUDURAH"
97 -> "TING"
98 -> "KKSQWL"
99 -> "CRMPL"
100 -> "BWEP"
101 -> "CHUGUGUG"
102 -> "BANG"
103 -> "SLPP"
104 -> "DEDA"
105 -> "WHSSH"
106 -> "CLANG"
107 -> "HNH"
108 -> "BWAH"
109 -> "CRUNK"
110 -> "SQWLTCH"
111 -> "DRR"
112 -> "TRNKL"
113 -> "BRAP"
114 -> "BLPCHCH"
115 -> "SKLE"
116 -> "ZMM"
117 -> "WRRR"
118 -> "FWUMP"
119 -> "BRAHCHCH"
120 -> "TING"
121 -> "BWMP"
122 -> "BRPBRPBRP"
123 -> "WE-OH"
124 -> "THCK"
125 -> "FHP"
126 -> "QWLPH"
_ -> error "unitialised sound"
soundPathList :: [String]
soundPathList =
@@ -298,6 +304,7 @@ soundPathList =
, "metal7.TRWNG.1000.wav"
, "ting4.TING.200.wav"
, "stone1.CRASH.1000.wav"
, "clang.CLANG.500.wav"
, "twoStep1.TAPTIP.40.wav"
, "wrench1.CRNKCRNKCRNK.400.wav"
, "seagullChatter.CHUGUGUG.2000.wav"
@@ -306,6 +313,7 @@ soundPathList =
, "foamSprayLoop.HSSS.50.wav"
, "explosion.BOOM.2000.wav"
, "foamSprayFadeOut.HSS.50.wav"
, "clang1.CLANG.500.wav"
, "tap2.TAKH.1000.wav"
, "tinitus.RINGGG.8000.wav"
, "seagullCry1.CRH.2000.wav"
@@ -361,6 +369,7 @@ soundPathList =
, "slap1.SLPP.100.wav"
, "deda.DEDA.500.wav"
, "missileLaunch.WHSSH.2000.wav"
, "clang2.CLANG.500.wav"
, "grunt.HNH.100.wav"
, "sineRaisePitchOneSec.BWAH.300.wav"
, "metal2.CRUNK.1000.wav"
@@ -464,169 +473,175 @@ ting4S :: SoundID
ting4S = SoundID 39
stone1S :: SoundID
stone1S = SoundID 40
clangS :: SoundID
clangS = SoundID 41
twoStep1S :: SoundID
twoStep1S = SoundID 41
twoStep1S = SoundID 42
wrench1S :: SoundID
wrench1S = SoundID 42
wrench1S = SoundID 43
seagullChatterS :: SoundID
seagullChatterS = SoundID 43
seagullChatterS = SoundID 44
blood4S :: SoundID
blood4S = SoundID 44
blood4S = SoundID 45
fireFadeS :: SoundID
fireFadeS = SoundID 45
fireFadeS = SoundID 46
foamSprayLoopS :: SoundID
foamSprayLoopS = SoundID 46
foamSprayLoopS = SoundID 47
explosionS :: SoundID
explosionS = SoundID 47
explosionS = SoundID 48
foamSprayFadeOutS :: SoundID
foamSprayFadeOutS = SoundID 48
foamSprayFadeOutS = SoundID 49
clang1S :: SoundID
clang1S = SoundID 50
tap2S :: SoundID
tap2S = SoundID 49
tap2S = SoundID 51
tinitusS :: SoundID
tinitusS = SoundID 50
tinitusS = SoundID 52
seagullCry1S :: SoundID
seagullCry1S = SoundID 51
seagullCry1S = SoundID 53
seagullBarkS :: SoundID
seagullBarkS = SoundID 52
seagullBarkS = SoundID 54
stone3S :: SoundID
stone3S = SoundID 53
stone3S = SoundID 55
tingS :: SoundID
tingS = SoundID 54
tingS = SoundID 56
seagullCry2S :: SoundID
seagullCry2S = SoundID 55
seagullCry2S = SoundID 57
bloodShort3S :: SoundID
bloodShort3S = SoundID 56
bloodShort3S = SoundID 58
hit1S :: SoundID
hit1S = SoundID 57
hit1S = SoundID 59
click1S :: SoundID
click1S = SoundID 58
click1S = SoundID 60
bloodShort2S :: SoundID
bloodShort2S = SoundID 59
bloodShort2S = SoundID 61
twoStepSlowS :: SoundID
twoStepSlowS = SoundID 60
twoStepSlowS = SoundID 62
seagullCryS :: SoundID
seagullCryS = SoundID 61
seagullCryS = SoundID 63
crankSlowS :: SoundID
crankSlowS = SoundID 62
crankSlowS = SoundID 64
primeS :: SoundID
primeS = SoundID 63
primeS = SoundID 65
twoStepS :: SoundID
twoStepS = SoundID 64
twoStepS = SoundID 66
bloodShort8S :: SoundID
bloodShort8S = SoundID 65
bloodShort8S = SoundID 67
reloadS :: SoundID
reloadS = SoundID 66
reloadS = SoundID 68
reload1S :: SoundID
reload1S = SoundID 67
reload1S = SoundID 69
slapS :: SoundID
slapS = SoundID 68
slapS = SoundID 70
tone440sawtoothS :: SoundID
tone440sawtoothS = SoundID 69
tone440sawtoothS = SoundID 71
metal3S :: SoundID
metal3S = SoundID 70
metal3S = SoundID 72
tap3S :: SoundID
tap3S = SoundID 71
tap3S = SoundID 73
glassShat4S :: SoundID
glassShat4S = SoundID 72
glassShat4S = SoundID 74
bloodShort1S :: SoundID
bloodShort1S = SoundID 73
bloodShort1S = SoundID 75
bloodShort4S :: SoundID
bloodShort4S = SoundID 74
bloodShort4S = SoundID 76
glassShat2S :: SoundID
glassShat2S = SoundID 75
glassShat2S = SoundID 77
metal1S :: SoundID
metal1S = SoundID 76
metal1S = SoundID 78
foot3S :: SoundID
foot3S = SoundID 77
foot3S = SoundID 79
pickUpS :: SoundID
pickUpS = SoundID 78
pickUpS = SoundID 80
stone5S :: SoundID
stone5S = SoundID 79
stone5S = SoundID 81
dededumS :: SoundID
dededumS = SoundID 80
dededumS = SoundID 82
tap1S :: SoundID
tap1S = SoundID 81
tap1S = SoundID 83
blood1S :: SoundID
blood1S = SoundID 82
blood1S = SoundID 84
bloodShort7S :: SoundID
bloodShort7S = SoundID 83
bloodShort7S = SoundID 85
metal4S :: SoundID
metal4S = SoundID 84
metal4S = SoundID 86
knifeS :: SoundID
knifeS = SoundID 85
knifeS = SoundID 87
computerBeepingS :: SoundID
computerBeepingS = SoundID 86
computerBeepingS = SoundID 88
tone440S :: SoundID
tone440S = SoundID 87
tone440S = SoundID 89
gut6S :: SoundID
gut6S = SoundID 88
gut6S = SoundID 90
smallGlass2S :: SoundID
smallGlass2S = SoundID 89
smallGlass2S = SoundID 91
glassShat1S :: SoundID
glassShat1S = SoundID 90
glassShat1S = SoundID 92
disconnectItemS :: SoundID
disconnectItemS = SoundID 91
disconnectItemS = SoundID 93
metal5S :: SoundID
metal5S = SoundID 92
metal5S = SoundID 94
seagullBarkTransformedS :: SoundID
seagullBarkTransformedS = SoundID 93
seagullBarkTransformedS = SoundID 95
ejectS :: SoundID
ejectS = SoundID 94
ejectS = SoundID 96
ting3S :: SoundID
ting3S = SoundID 95
ting3S = SoundID 97
blood3S :: SoundID
blood3S = SoundID 96
blood3S = SoundID 98
stone2S :: SoundID
stone2S = SoundID 97
stone2S = SoundID 99
tone440raiseS :: SoundID
tone440raiseS = SoundID 98
tone440raiseS = SoundID 100
seagullChatter1S :: SoundID
seagullChatter1S = SoundID 99
seagullChatter1S = SoundID 101
bangS :: SoundID
bangS = SoundID 100
bangS = SoundID 102
slap1S :: SoundID
slap1S = SoundID 101
slap1S = SoundID 103
dedaS :: SoundID
dedaS = SoundID 102
dedaS = SoundID 104
missileLaunchS :: SoundID
missileLaunchS = SoundID 103
missileLaunchS = SoundID 105
clang2S :: SoundID
clang2S = SoundID 106
gruntS :: SoundID
gruntS = SoundID 104
gruntS = SoundID 107
sineRaisePitchOneSecS :: SoundID
sineRaisePitchOneSecS = SoundID 105
sineRaisePitchOneSecS = SoundID 108
metal2S :: SoundID
metal2S = SoundID 106
metal2S = SoundID 109
gut5S :: SoundID
gut5S = SoundID 107
gut5S = SoundID 110
slideDoorS :: SoundID
slideDoorS = SoundID 108
slideDoorS = SoundID 111
metal6S :: SoundID
metal6S = SoundID 109
metal6S = SoundID 112
autoGunS :: SoundID
autoGunS = SoundID 110
autoGunS = SoundID 113
oldMachineBootS :: SoundID
oldMachineBootS = SoundID 111
oldMachineBootS = SoundID 114
blood6S :: SoundID
blood6S = SoundID 112
blood6S = SoundID 115
buzzS :: SoundID
buzzS = SoundID 113
buzzS = SoundID 116
fireLoudS :: SoundID
fireLoudS = SoundID 114
fireLoudS = SoundID 117
tap4S :: SoundID
tap4S = SoundID 115
tap4S = SoundID 118
shotgunS :: SoundID
shotgunS = SoundID 116
shotgunS = SoundID 119
ting5S :: SoundID
ting5S = SoundID 117
ting5S = SoundID 120
sawtoothFailS :: SoundID
sawtoothFailS = SoundID 118
sawtoothFailS = SoundID 121
miniS :: SoundID
miniS = SoundID 119
miniS = SoundID 122
seagullWhistleS :: SoundID
seagullWhistleS = SoundID 120
seagullWhistleS = SoundID 123
connectItemS :: SoundID
connectItemS = SoundID 121
connectItemS = SoundID 124
whiteNoiseFadeInS :: SoundID
whiteNoiseFadeInS = SoundID 122
whiteNoiseFadeInS = SoundID 125
gut1S :: SoundID
gut1S = SoundID 123
gut1S = SoundID 126
+6 -3
View File
@@ -13,16 +13,19 @@ loadSound (i,s) = do
chnk <- Mix.load $ "./data/sound/" ++ s
return (i,chnk)
-- current thinking is to use group 0 for game sounds, group 1 for menu sounds
loadSounds :: IO (IM.IntMap Mix.Chunk)
loadSounds = do
Mix.openAudio Mix.defaultAudio 128
Mix.setChannels 32
x <- Mix.groupSpan 0 0 29
Mix.setChannels nchans
x <- Mix.groupSpan 0 0 (fromIntegral $ nchans - 3)
putStrLn $ show x <> " channels assigned to group 0"
y <- Mix.groupSpan 1 30 31
y <- Mix.groupSpan 1 (fromIntegral $ nchans - 2) (fromIntegral $ nchans - 1)
putStrLn $ show y <> " channels assigned to group 1"
fmap IM.fromList $ mapM loadSound $ zip [0..] soundPathList
where
nchans = (64::Int)
loadMusic :: IO (IM.IntMap Mix.Music)
loadMusic = do
+1 -6
View File
@@ -2,7 +2,7 @@
- Indestructible walls may still produce sparks, dust etc
-}
module Dodge.Wall.Damage (
damageBlocksBy,
-- damageBlocksBy,
damageWall,
) where
@@ -36,8 +36,3 @@ maybeDestroyDoor :: Int -> World -> World
maybeDestroyDoor drid w = case w ^? cWorld . lWorld . doors . ix drid of
Just dr | _drHP dr < 1 -> destroyDoor dr w
_ -> w
damageBlocksBy :: Int -> Wall -> World -> World
damageBlocksBy x wl = case wl ^? wlStructure . wsBlock of
Just blid -> cWorld . lWorld . blocks . ix blid . blHP -~ x
Nothing -> id
+1 -1
View File
@@ -1,4 +1,4 @@
module Dodge.Wall.Draw where
module Dodge.Wall.Draw (drawWall) where
import Dodge.Data.Wall
import Picture.Base