Continue tweaking sound
This commit is contained in:
@@ -198,7 +198,7 @@ youDropItem w = case yourItem w of
|
||||
NoItem -> w
|
||||
_ -> rmSelectedInvItem (_yourID w)
|
||||
. copyItemToFloor (you w) (_crInvSel cr)
|
||||
$ soundFrom (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
|
||||
$ soundStart (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
|
||||
w
|
||||
where
|
||||
cr = you w
|
||||
@@ -233,7 +233,7 @@ pickUpItem
|
||||
pickUpItem cid flit w = case maybeInvSlot of
|
||||
Nothing -> w
|
||||
Just i -> w
|
||||
& soundFrom (CrSound cid) (_flItPos flit) pickUpS Nothing
|
||||
& soundStart (CrSound cid) (_flItPos flit) pickUpS Nothing
|
||||
& updateItLocation i
|
||||
& floorItems %~ IM.delete (_flItID flit)
|
||||
& creatures . ix cid . crInv . ix i %~ addItem it
|
||||
|
||||
@@ -58,7 +58,7 @@ followImpulse cr w imp = case imp of
|
||||
(hitCr cid'
|
||||
, crMvBy (10 *.* normalizeV (posFromID cid' -.- cpos)) $ cr & crMeleeCooldown .~ 20) -- randomise cooldown?
|
||||
RandomTurn a -> (id, creatureTurn (rr a) cr)
|
||||
MakeSound sid -> ( soundOnceOrigin sid (CrSound (_crID cr)) (_crPos cr) , cr )
|
||||
MakeSound sid -> ( soundStart (CrSound (_crID cr)) (_crPos cr) sid Nothing , cr )
|
||||
DropItem -> undefined
|
||||
ChangeStrategy strat -> (id, cr & crActionPlan . crStrategy .~ strat)
|
||||
AddGoal gl -> (id, cr & crActionPlan . crGoal %~ (gl :) )
|
||||
@@ -84,5 +84,5 @@ followImpulse cr w imp = case imp of
|
||||
posFromID cid' = _crPos $ _creatures w IM.! cid'
|
||||
rr a = fst $ randomR (-a,a) $ _randGen w
|
||||
hitCr i = over (creatures . ix i . crState . crDamage) (addDam i)
|
||||
. soundFrom (CrSound cid) cpos hitS Nothing
|
||||
. soundStart (CrSound cid) cpos hitS Nothing
|
||||
addDam i dams = Blunt 100 cpos (posFromID i) (posFromID i) : dams
|
||||
|
||||
@@ -91,9 +91,9 @@ awakeLevelPerception cr = case _crAwakeLevel $ _crPerception cr of
|
||||
newSounds :: World -> [(Point2,Float)]
|
||||
newSounds = mapMaybe f . M.elems . _playingSounds
|
||||
where
|
||||
f s | _soundStatus s == JustStartedPlaying
|
||||
= Just (_soundPos s, _soundVolume s)
|
||||
| otherwise = Nothing
|
||||
f s = case _soundStatus s of
|
||||
JustStartedPlaying -> Just (_soundPos s, _soundVolume s)
|
||||
_ -> Nothing
|
||||
|
||||
rememberSounds :: Creature -> Reader World Creature
|
||||
rememberSounds cr = do
|
||||
|
||||
@@ -52,7 +52,7 @@ stateUpdate u cr w = case u (updateMovement cr) w of
|
||||
| otherwise = Nothing
|
||||
deathEff
|
||||
| cr ^.crHP > 0 = id
|
||||
| otherwise = stopSoundFrom (CrWeaponSound (_crID cr))
|
||||
| otherwise = stopSoundFrom (CrWeaponSound (_crID cr) 0)
|
||||
. over decorations addCorpse
|
||||
. dropByState cr
|
||||
addCorpse = IM.insertNewKey
|
||||
@@ -137,11 +137,11 @@ invSideEff cr w = weaponReloadSounds cr $ IM.foldrWithKey f w (_crInv cr)
|
||||
weaponReloadSounds :: Creature -> World -> World
|
||||
weaponReloadSounds cr w = case _crInv cr IM.!? _crInvSel cr of
|
||||
Just Weapon{_wpReloadType = PassiveReload stype,_wpReloadTime=rt,_wpReloadState=rs}
|
||||
| rt == rs -> soundFrom (CrReloadSound 0) (_crPos cr) stype Nothing w
|
||||
| rt == rs -> soundContinue (CrReloadSound 0) (_crPos cr) stype Nothing w
|
||||
| otherwise -> w
|
||||
Just Weapon{_wpReloadState = 0} -> w
|
||||
Just Weapon{_wpReloadState = 1} -> stopSoundFrom (CrReloadSound cid) w
|
||||
Just Weapon{} -> soundFrom (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
|
||||
Just Weapon{} -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
|
||||
_ -> w
|
||||
where
|
||||
cid = _crID cr
|
||||
|
||||
Reference in New Issue
Block a user