Rewinding fixes
This commit is contained in:
@@ -123,6 +123,7 @@ data World = World
|
|||||||
, _distortions :: [Distortion]
|
, _distortions :: [Distortion]
|
||||||
, _worldBounds :: Bounds
|
, _worldBounds :: Bounds
|
||||||
, _gameRooms :: [GameRoom] -- consider using and IntMap
|
, _gameRooms :: [GameRoom] -- consider using and IntMap
|
||||||
|
, _maybeWorld :: Maybe' World
|
||||||
, _rewindWorlds :: [World]
|
, _rewindWorlds :: [World]
|
||||||
, _rewinding :: Bool
|
, _rewinding :: Bool
|
||||||
, _worldClock :: Int
|
, _worldClock :: Int
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ defaultWorld = World
|
|||||||
, _gameRooms = []
|
, _gameRooms = []
|
||||||
, _worldClock = 0
|
, _worldClock = 0
|
||||||
, _worldBounds = defaultBounds
|
, _worldBounds = defaultBounds
|
||||||
|
, _maybeWorld = Nothing'
|
||||||
, _rewindWorlds = []
|
, _rewindWorlds = []
|
||||||
, _rewinding = False
|
, _rewinding = False
|
||||||
, _lSelHammerPosition = HammerUp
|
, _lSelHammerPosition = HammerUp
|
||||||
|
|||||||
@@ -43,13 +43,16 @@ rewindEffect _ cr invid w
|
|||||||
useRewindGun :: Item -> Creature -> World -> World
|
useRewindGun :: Item -> Creature -> World -> World
|
||||||
useRewindGun _ _ w = case _rewindWorlds w of
|
useRewindGun _ _ w = case _rewindWorlds w of
|
||||||
[w'] -> rewindusing w' []
|
[w'] -> rewindusing w' []
|
||||||
|
(w':ws) -> rewindusing w' ws
|
||||||
(_:w':ws) -> rewindusing w' ws
|
(_:w':ws) -> rewindusing w' ws
|
||||||
_ -> w
|
_ -> w
|
||||||
where
|
where
|
||||||
rewindusing w' ws = w'
|
rewindusing w' ws = w
|
||||||
|
& maybeWorld .~ Just' ( w'
|
||||||
-- & creatures . ix (_crID cr) .~ cr
|
-- & creatures . ix (_crID cr) .~ cr
|
||||||
& upbuts
|
& upbuts
|
||||||
& rewindWorlds .~ ws
|
& rewindWorlds .~ ws
|
||||||
|
)
|
||||||
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
|
upbuts = (keys .~ _keys w) . (mouseButtons .~ _mouseButtons w)
|
||||||
|
|
||||||
-- needs to shift this item to the current inventory slot
|
-- needs to shift this item to the current inventory slot
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ updateUniverse u = case _menuLayers u of
|
|||||||
functionalUpdate :: Configuration -> World -> World
|
functionalUpdate :: Configuration -> World -> World
|
||||||
functionalUpdate cfig w = checkEndGame
|
functionalUpdate cfig w = checkEndGame
|
||||||
. (worldClock +~ 1)
|
. (worldClock +~ 1)
|
||||||
|
. doRewind
|
||||||
. updateDistortions
|
. updateDistortions
|
||||||
. updateCreatureSoundPositions
|
. updateCreatureSoundPositions
|
||||||
. ppEvents
|
. ppEvents
|
||||||
@@ -80,6 +81,11 @@ functionalUpdate cfig w = checkEndGame
|
|||||||
where
|
where
|
||||||
(x,y) = cloudZoneOfPoint $ stripZ $ _clPos cl
|
(x,y) = cloudZoneOfPoint $ stripZ $ _clPos cl
|
||||||
|
|
||||||
|
doRewind :: World -> World
|
||||||
|
doRewind w = case _maybeWorld w of
|
||||||
|
Just' w' -> w'
|
||||||
|
Nothing' -> w
|
||||||
|
|
||||||
zoneCreatures :: World -> World
|
zoneCreatures :: World -> World
|
||||||
zoneCreatures w = w
|
zoneCreatures w = w
|
||||||
& creaturesZone . znObjects .~
|
& creaturesZone . znObjects .~
|
||||||
|
|||||||
Reference in New Issue
Block a user