Stop new old sounds from playing during rewinding

This commit is contained in:
2021-11-26 19:57:03 +00:00
parent f29c200a27
commit e231b851d9
4 changed files with 27 additions and 21 deletions
+11 -12
View File
@@ -6,12 +6,14 @@ import Dodge.Picture.Layer
import Dodge.Creature.Action
import Dodge.Item.Weapon.TriggerType
import Dodge.Default.Weapon
import Sound.Data
import Geometry
import Picture
import qualified IntMapHelp as IM
import Shape
import ShapePicture
import qualified Data.Map.Strict as M
import Control.Lens
rewindGun :: Item
@@ -29,24 +31,21 @@ rewindEffect iteff cr invid w = w & rewindWorlds %~ (take 100 . (w' : ))
& creatures . ix (_crID cr) . crInv . ix invid . wpLoadedAmmo .~ length (_rewindWorlds w)
where
w' = w & rewindWorlds .~ []
& rewinding .~ True
useRewindGun :: Item -> Creature -> World -> World
useRewindGun it cr w = case _rewindWorlds w of
(w':[]) -> w'
& upbuts
& rewindWorlds .~ []
& rewinding .~ True
& lClickHammer .~ HammerUp
where
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
(_:w':ws) -> w'
(w':[]) -> rewindusing w' []
(_:w':ws) -> rewindusing w' ws
_ -> w
where
rewindusing w' ws = w'
-- & creatures . ix (_crID cr) .~ cr
& upbuts
& rewindWorlds .~ ws
& rewinding .~ True
& lClickHammer .~ HammerUp
where
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
_ -> w
& worldEvents %~ (. (worldEvents %~ (.(rewinding .~ False)))) -- fucking nesting
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
shrinkGun :: Item
shrinkGun = defaultGun