Allow for creature death sounds
This commit is contained in:
@@ -285,6 +285,15 @@ inventoryX c = case c of
|
||||
, FlashBall ]]
|
||||
<> [bulletModule (BulletModPayload BulGas)]
|
||||
<> [bulletModule (BulletModEffect x) | x <- [minBound .. maxBound]]
|
||||
"W" -> [miniGunX 2
|
||||
, beltMag
|
||||
, miniGunX 3
|
||||
, beltMag
|
||||
, miniGunX 4
|
||||
, beltMag
|
||||
, miniGunX 5
|
||||
, beltMag
|
||||
]
|
||||
_ -> []
|
||||
|
||||
testInventory :: [Item]
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
module Dodge.Creature.Update (updateCreature) where
|
||||
|
||||
import Dodge.Creature.Vocalization
|
||||
import RandomHelp
|
||||
import Data.Maybe
|
||||
import Linear
|
||||
import NewInt
|
||||
import Color
|
||||
@@ -88,11 +91,22 @@ checkDeath' cr w = case cr ^. crHP of
|
||||
corpseOrGib :: Creature -> World -> World
|
||||
corpseOrGib cr = case cr ^? crDamage . to maxDamageType . _Just . _1 of
|
||||
Just CookingDamage -> sethp (CrIsCorpse $ scorchSPic thecorpse)
|
||||
. dodeathsound CookDeath
|
||||
Just PoisonDamage -> sethp (CrIsCorpse $ poisonSPic thecorpse)
|
||||
. dodeathsound PoisonDeath
|
||||
Just PhysicalDamage | _crPain cr > 200
|
||||
-> addCrGibs cr . sethp CrIsGibs
|
||||
. dodeathsound GibsDeath
|
||||
_ -> sethp (CrIsCorpse thecorpse)
|
||||
. dodeathsound PlainDeath
|
||||
where
|
||||
dodeathsound dt = f dt . stopSoundFrom (CrMouth cid)
|
||||
f dt w = fromMaybe w $ do
|
||||
let (msid, g) = runState (maybeTakeOne (crDeathSounds cr dt)) (_randGen w)
|
||||
sid <- msid
|
||||
return $ w & soundStart (CrMouth cid) (cr ^. crPos . _xy) sid Nothing
|
||||
& randGen .~ g
|
||||
cid = cr ^. crID
|
||||
sethp x = cWorld . lWorld . creatures . ix (_crID cr) . crHP .~ x
|
||||
thecorpse = makeCorpse cr
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{-# LANGUAGE LambdaCase #-}
|
||||
module Dodge.Creature.Vocalization (
|
||||
crWarningSounds,
|
||||
crDeathSounds,
|
||||
vocalizationTest,
|
||||
resetCrVocCoolDown,
|
||||
) where
|
||||
@@ -39,6 +41,23 @@ crWarningSounds cr = case cr ^. crType of
|
||||
BarrelCrit{} -> mempty
|
||||
LampCrit{} -> mempty
|
||||
|
||||
crDeathSounds :: Creature -> DeathType -> [SoundID]
|
||||
crDeathSounds cr dt = case cr ^. crType of
|
||||
Avatar{} -> mempty
|
||||
AvatarDead -> mempty
|
||||
ChaseCrit{} -> defaultDeathSounds dt
|
||||
SwarmCrit -> mempty
|
||||
AutoCrit -> mempty
|
||||
BarrelCrit{} -> mempty
|
||||
LampCrit{} -> mempty
|
||||
|
||||
defaultDeathSounds :: DeathType -> [SoundID]
|
||||
defaultDeathSounds = \case
|
||||
CookDeath -> mempty
|
||||
PoisonDeath -> mempty
|
||||
PlainDeath -> mempty
|
||||
GibsDeath -> mempty
|
||||
|
||||
vocalizationTest :: Creature -> Maybe SoundID
|
||||
vocalizationTest cr = case cr ^? crVocalization . vcCoolDown of
|
||||
Just 0 -> crVocalizationSound cr
|
||||
|
||||
@@ -52,7 +52,7 @@ data Config = Config
|
||||
, _gr_upscale_filter :: Bool
|
||||
, _gr_cloud_shadows :: Bool
|
||||
, _gr_distortions :: Bool
|
||||
, _gr_bloom :: Bool
|
||||
-- , _gr_bloom :: Bool
|
||||
, _gr_shadow_rendering :: ShadowRendering
|
||||
, _gr_shadows_on_clouds :: ShadowRendering
|
||||
, _gr_shadow_size :: Importance
|
||||
@@ -156,7 +156,7 @@ defaultConfig =
|
||||
, _volume_music = 0
|
||||
, _gr_upscale_filter = True
|
||||
, _gr_cloud_shadows = True
|
||||
, _gr_bloom = True
|
||||
-- , _gr_bloom = True
|
||||
, _gr_shadow_rendering = GeoObjShads
|
||||
, _gr_shadows_on_clouds = NoObjShads
|
||||
, _gr_shadow_size = Typical
|
||||
|
||||
@@ -65,6 +65,8 @@ data CrHP
|
||||
| CrIsGibs
|
||||
| CrIsPitted
|
||||
|
||||
data DeathType = CookDeath | PoisonDeath | PlainDeath | GibsDeath
|
||||
|
||||
data Intention = Intention
|
||||
{ _targetCr :: Maybe Int
|
||||
, _mvToPoint :: Maybe Point2
|
||||
|
||||
@@ -208,14 +208,14 @@ heldItemMuzzles itm = \case
|
||||
BURSTRIFLE -> dbwMuzzles & ix 0 . mzPos .~ V2 25 0 & ix 0 . mzInaccuracy .~ 0.05
|
||||
MINIGUNX i ->
|
||||
[ Muzzle
|
||||
(V2 (30 + 40 * fromIntegral j / fromIntegral i) 0)
|
||||
(V2 (40 * fromIntegral j / fromIntegral i) 0)
|
||||
0
|
||||
0.05
|
||||
maguse1
|
||||
NoFlare
|
||||
MuzzleShootBullet
|
||||
10
|
||||
| j <- [0 .. i -1]
|
||||
| j <- [1 .. i]
|
||||
]
|
||||
& ix 0 . mzFlareType .~ MiniGunFlare
|
||||
BANGROD ->
|
||||
|
||||
@@ -321,9 +321,6 @@ shatterGunSPic =
|
||||
xa = 1
|
||||
xb = 9
|
||||
|
||||
baseCaneShape :: Shape
|
||||
baseCaneShape = colorSH red $ xCylinderST 3 15
|
||||
|
||||
baseRifleShape :: Shape
|
||||
baseRifleShape = colorSH red $ xCylinderST 3 25
|
||||
|
||||
@@ -372,12 +369,11 @@ miniGunXPictItem i it = miniGunXPict i (_wTime (_itParams it) - 10)
|
||||
|
||||
miniGunXPict :: Int -> Int -> SPic
|
||||
miniGunXPict i spin =
|
||||
noPic
|
||||
( colorSH red (rotateSHx a barrels)
|
||||
<> baseRifleShape
|
||||
)
|
||||
noPic .
|
||||
colorSH red $ rotateSHx a barrels
|
||||
<> xCylinderST 3 40
|
||||
where
|
||||
aBarrel = translateSH (V3 15 2 2) baseCaneShape
|
||||
aBarrel = translateSH (V3 15 4 2.5) $ xCylinderST 2 25
|
||||
barrels = foldMap (\an -> aBarrel & rotateSHx (2 * pi * fromIntegral an / fromIntegral i)) [1 .. i]
|
||||
a = fromIntegral spin / 100
|
||||
|
||||
|
||||
+1
-1
@@ -192,7 +192,7 @@ graphicsMenuOptions =
|
||||
, enumOption gr_shadows_on_clouds "SHADOW DETAIL ON CLOUDS" id
|
||||
, enumOption gr_shadow_size "SHADOW DETAIL" id
|
||||
, enumOption gr_distortions "ENABLE DISTORTIONS" id
|
||||
, enumOption gr_bloom "ENABLE BLOOM" id
|
||||
-- , enumOption gr_bloom "ENABLE BLOOM" id
|
||||
, boolOption gr_cloud_shadows "CLOUD SHADOWS TOGGLE"
|
||||
, enumOption gr_num_shadow_casters "NUM SHADOW CASTERS" id
|
||||
]
|
||||
|
||||
+5
-4
@@ -131,14 +131,15 @@ xCylinderST :: Float -> Float -> Shape
|
||||
xCylinderST = xCylinder Small Typical
|
||||
|
||||
xCylinder :: Size -> Importance -> Float -> Float -> Shape
|
||||
xCylinder size shad r x =
|
||||
xCylinder size shad d x =
|
||||
translateSHz r . rotateSHq (V3 0 1 0) (pi / 2) . upperCylinder size shad x $
|
||||
-- why didn't I make this a simple circle?
|
||||
[ V2 r r
|
||||
, V2 (- r / 2) (r / 2)
|
||||
, V2 (- r / 2) (negate $ r / 2)
|
||||
, V2 (-r) (r)
|
||||
, V2 (-r) (-r)
|
||||
, V2 r (- r)
|
||||
]
|
||||
where
|
||||
r = 0.5 * d
|
||||
|
||||
upperBoxMT :: Float -> [Point2] -> Shape
|
||||
upperBoxMT = upperBox Medium Typical
|
||||
|
||||
Reference in New Issue
Block a user