Tweak sound positions

This commit is contained in:
2021-04-06 20:25:25 +02:00
parent 47ac104520
commit be3c3339ec
4 changed files with 106 additions and 25 deletions
+3 -7
View File
@@ -43,9 +43,9 @@ withWarmUp t f cid w
| fState == 0 = set (pointerToItem . wpFire) (withWarmUp 100 f)
$ set (pointerToItem . wpFireState) 2
w
| t > 1 = set (pointerToItem . wpFire) (withWarmUp (t-1) f)
| t > 2 = set (pointerToItem . wpFire) (withWarmUp (t-1) f)
$ set (pointerToItem . wpFireState) 2
$ continueSound 26
$ soundFrom (CrWeaponSound cid) 26 2 0
w
| t > 0 = set (pointerToItem . wpFire) (withWarmUp (t-1) f)
$ set (pointerToItem . wpFireState) 2
@@ -54,7 +54,7 @@ withWarmUp t f cid w
$ over (pointerToItem . wpLoadedAmmo) (\ammo -> ammo-1)
$ set (pointerToItem . wpFireState) 2
$ f cid
$ continueSound 28
$ soundFrom (CrWeaponSound cid) 28 2 0
w
where
cr = _creatures w IM.! cid
@@ -64,12 +64,8 @@ withWarmUp t f cid w
fState = _wpFireState item
fRate = _wpFireRate item
reloadCondition = _wpLoadedAmmo item == 0
continueSound soundID
| cid == 0 = soundFrom (CrWeaponSound cid) soundID 1 0
| otherwise = soundFromPos (CrWeaponSound cid) (_crPos cr) soundID 1 0
withSound :: Int -> (Int -> World -> World) -> Int -> World -> World
withSound soundid f 0 w = (soundOnce soundid . f 0) w
withSound soundid f cid w = (soundOncePos soundid p . f cid) w
where
p = _crPos (_creatures w IM.! cid)