Add sounds, move data types out into separate folders
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
module Dodge.Material.Damage where
|
||||
import Dodge.Data
|
||||
import Dodge.Particle.Spark
|
||||
--import Dodge.Particle.Bullet.Spawn
|
||||
--import Dodge.Base.Wall
|
||||
--import Dodge.Wall.Dust
|
||||
--import Dodge.Block
|
||||
import Geometry
|
||||
--import LensHelp
|
||||
|
||||
--import Control.Monad.State
|
||||
|
||||
damageMaterial :: Damage -> Material
|
||||
-> Float -- the angle of the hit surface, in radians
|
||||
-> World -> (Int, World)
|
||||
damageMaterial dm mt = case mt of
|
||||
Stone -> damageStone dm
|
||||
_ -> defDamageMaterial dm
|
||||
-- Glass -> damageGlass dm
|
||||
|
||||
defDamageMaterial :: Damage -> Float -> World -> (Int,World)
|
||||
defDamageMaterial dm _ w = (_dmAmount dm, w)
|
||||
|
||||
damageStone :: Damage -> Float -> World -> (Int,World)
|
||||
damageStone dm dir = case _dmType dm of
|
||||
LASERING -> a 0 $ colSparkRandDir 0.2 4 lSparkCol outTo (argV $ reflectIn (p -.- sp) v)
|
||||
PIERCING -> a d $ colSparkRandDir 0.2 8 pSparkCol outTo (argV $ reflectIn (p -.- sp) v)
|
||||
BLUNT -> a d id
|
||||
SHATTERING -> a d id
|
||||
CRUSHING -> a d id
|
||||
EXPLOSIVE -> a d id
|
||||
CUTTING -> a d id
|
||||
SPARKING -> a 0 id
|
||||
FLAMING -> a 0 id
|
||||
ELECTRICAL -> a 0 id
|
||||
CONCUSSIVE -> a d id
|
||||
TORQUEDAM -> a 0 id
|
||||
PUSHDAM -> a 0 id
|
||||
POISONDAM -> a 0 id
|
||||
ENTERREMENT -> a 0 id
|
||||
where
|
||||
v = unitVectorAtAngle dir
|
||||
a x f w = (x,f w)
|
||||
d = _dmAmount dm
|
||||
sp = _dmFrom dm
|
||||
p = _dmAt dm
|
||||
outTo = p +.+ squashNormalizeV (sp -.- p)
|
||||
pSparkCol = V4 5 1 0.5 2
|
||||
lSparkCol = V4 20 (-5) 0 1
|
||||
|
||||
--damageGlass :: Damage -> Float -> World -> (World,Int)
|
||||
--damageGlass dm dir w = w & case _dmType dm of
|
||||
-- LASERING -> a 0 $ id
|
||||
-- PIERCING -> a d $ dosplint . colSparkRandDir 0.2 8 pSparkCol outTo (reflDirWall sp p wl) . wlDustAt wl outTo
|
||||
-- BLUNT -> a d $ dosplint . wlDustAt wl outTo
|
||||
-- SHATTERING -> a d $ dosplint . muchWlDustAt wl outTo
|
||||
-- CRUSHING -> a d dosplint
|
||||
-- EXPLOSIVE -> a d dosplint
|
||||
-- CUTTING -> a d dosplint
|
||||
-- SPARKING -> a 0 id
|
||||
-- FLAMING -> a 0 id
|
||||
-- ELECTRICAL -> a 0 id
|
||||
-- CONCUSSIVE -> a 0 dosplint
|
||||
-- TORQUEDAM -> a 0 id
|
||||
-- PUSHDAM -> a 0 id
|
||||
-- POISONDAM -> a 0 id
|
||||
-- ENTERREMENT -> a 0 id
|
||||
-- where
|
||||
-- mbl = do
|
||||
-- blid <- wl ^? wlStructure . wsBlock
|
||||
-- w ^? blocks . ix blid
|
||||
-- d :: Int
|
||||
-- d = max 1 $ maybe 1 (subtract 1 . _blHP) mbl
|
||||
-- a :: Int -> (World -> World) -> World -> (World,Int)
|
||||
-- a x f w' = (f w',x)
|
||||
-- dosplint = maybe id splinterBlock mbl
|
||||
-- sp = _dmFrom dm
|
||||
-- p = _dmAt dm
|
||||
-- outTo = p +.+ squashNormalizeV (sp -.- p)
|
||||
-- pSparkCol = V4 5 1 0.5 2
|
||||
-- lSparkCol = V4 20 (-5) 0 1
|
||||
@@ -0,0 +1,26 @@
|
||||
module Dodge.Material.Sound where
|
||||
import Dodge.Data.Material
|
||||
import Dodge.SoundLogic.ExternallyGeneratedSounds
|
||||
import Sound.Data
|
||||
|
||||
destroyMatS :: Material -> [SoundID]
|
||||
destroyMatS mat = case mat of
|
||||
Glass -> [glassShat1S,glassShat2S,glassShat3S,glassShat4S]
|
||||
Crystal -> [glassShat1S,glassShat2S,glassShat3S,glassShat4S]
|
||||
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]
|
||||
Flesh -> [gut1S,gut2S,gut3S,gut4S,gut5S,gut6S]
|
||||
|
||||
weakenMatS :: Material -> [SoundID]
|
||||
weakenMatS mat = case mat of
|
||||
Glass -> [smallGlass1S,smallGlass2S,smallGlass3S,smallGlass4S]
|
||||
Crystal -> [smallGlass1S,smallGlass2S,smallGlass3S,smallGlass4S]
|
||||
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]
|
||||
Flesh -> [blood1S,blood2S,blood3S,blood4S,blood5S,blood6S,blood7S,blood8S]
|
||||
Reference in New Issue
Block a user