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
+1 -1
View File
@@ -38,4 +38,4 @@ initialWorld = defaultWorld
}
testStringInit :: World -> [String]
testStringInit _ = []
testStringInit w = [show $ _rewinding w]
+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
+7 -7
View File
@@ -65,13 +65,13 @@ room2 :: RandomGen g => Int -> State g (SubCompTree Room)
room2 = lasCenSensEdge
startRoom :: RandomGen g => Int -> State g (SubCompTree Room)
startRoom i = join $ takeOne
[ chainUses <$> sequence [minigunFakeout,weaponRoom]
, rezBoxesWp
, rezBoxesThenWeaponRoom
, rezBoxThenWeaponRoom
, rezBoxesWpCrit
, runPastStart i
startRoom i = join $ uncurry takeOneWeighted $ unzip
[ (,) (0.5::Float) $ chainUses <$> sequence [minigunFakeout,weaponRoom]
, (,) 1 $ rezBoxesWp
, (,) 1 $ rezBoxesThenWeaponRoom
, (,) 1 $ rezBoxThenWeaponRoom
, (,) 1 $ rezBoxesWpCrit
, (,) 1 $ runPastStart i
]
runPastStart :: RandomGen g => Int -> State g (SubCompTree Room)