Allow rewinding after combining items
This commit is contained in:
+2
-2
@@ -78,7 +78,7 @@ updateRenderSplit u = do
|
|||||||
|
|
||||||
playSoundUnlessRewinding :: Universe -> IO (M.Map SoundOrigin Sound)
|
playSoundUnlessRewinding :: Universe -> IO (M.Map SoundOrigin Sound)
|
||||||
playSoundUnlessRewinding u
|
playSoundUnlessRewinding u
|
||||||
| _rewinding w = return M.empty
|
| _rewinding w == RewindingNow = return M.empty
|
||||||
| otherwise = playSoundAndUpdate (_soundData $ _preloadData u) (_playingSounds w) (_toPlaySounds w)
|
| otherwise = playSoundAndUpdate (_soundData $ _preloadData u) (_playingSounds w) (_toPlaySounds w)
|
||||||
where
|
where
|
||||||
w = _uvWorld u
|
w = _uvWorld u
|
||||||
@@ -103,7 +103,7 @@ doSideEffects u = do
|
|||||||
& uvWorld . playingSounds .~ newPlayingSounds
|
& uvWorld . playingSounds .~ newPlayingSounds
|
||||||
& uvWorld . toPlaySounds .~ M.empty
|
& uvWorld . toPlaySounds .~ M.empty
|
||||||
& uvWorld . sideEffects .~ return
|
& uvWorld . sideEffects .~ return
|
||||||
& uvWorld . rewinding .~ False -- this is probably not the best place for this
|
-- & uvWorld . rewinding .~ False -- this is probably not the best place for this
|
||||||
|
|
||||||
|
|
||||||
doPreload :: IO PreloadData
|
doPreload :: IO PreloadData
|
||||||
|
|||||||
+7
-1
@@ -125,13 +125,19 @@ data World = World
|
|||||||
, _gameRooms :: [GameRoom] -- consider using and IntMap
|
, _gameRooms :: [GameRoom] -- consider using and IntMap
|
||||||
, _maybeWorld :: Maybe' World
|
, _maybeWorld :: Maybe' World
|
||||||
, _rewindWorlds :: [World]
|
, _rewindWorlds :: [World]
|
||||||
, _rewinding :: Bool
|
, _rewinding :: RewindingStatus
|
||||||
, _worldClock :: Int
|
, _worldClock :: Int
|
||||||
, _lSelHammerPosition :: HammerPosition
|
, _lSelHammerPosition :: HammerPosition
|
||||||
, _worldTerminal :: Maybe' WorldTerminal
|
, _worldTerminal :: Maybe' WorldTerminal
|
||||||
}
|
}
|
||||||
data WorldTerminal = WorldTerminal Int [(Int,String)]
|
data WorldTerminal = WorldTerminal Int [(Int,String)]
|
||||||
|
|
||||||
|
data RewindingStatus
|
||||||
|
= RewindingNow
|
||||||
|
| RewindingLastFrame
|
||||||
|
| NotRewinding
|
||||||
|
deriving (Eq,Ord)
|
||||||
|
|
||||||
data SaveSlot = QuicksaveSlot | LevelStartSlot
|
data SaveSlot = QuicksaveSlot | LevelStartSlot
|
||||||
deriving (Eq,Ord)
|
deriving (Eq,Ord)
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ defaultWorld = World
|
|||||||
, _worldBounds = defaultBounds
|
, _worldBounds = defaultBounds
|
||||||
, _maybeWorld = Nothing'
|
, _maybeWorld = Nothing'
|
||||||
, _rewindWorlds = []
|
, _rewindWorlds = []
|
||||||
, _rewinding = False
|
, _rewinding = NotRewinding
|
||||||
, _lSelHammerPosition = HammerUp
|
, _lSelHammerPosition = HammerUp
|
||||||
, _worldTerminal = Nothing'
|
, _worldTerminal = Nothing'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,13 +38,12 @@ rewindEffect _ cr invid w
|
|||||||
ptrWpCharge = creatures . ix (_crID cr) . crInv . ix invid . itConsumption . wpCharge
|
ptrWpCharge = creatures . ix (_crID cr) . crInv . ix invid . itConsumption . wpCharge
|
||||||
maxcharge = _wpMaxCharge . _itConsumption $ _crInv cr IM.! invid
|
maxcharge = _wpMaxCharge . _itConsumption $ _crInv cr IM.! invid
|
||||||
w' = w & rewindWorlds .~ []
|
w' = w & rewindWorlds .~ []
|
||||||
& rewinding .~ True
|
& rewinding .~ RewindingNow
|
||||||
|
|
||||||
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']
|
||||||
(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
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ drawInGameHUD cfig w = pictures
|
|||||||
|
|
||||||
inventoryDisplay :: Configuration -> World -> Picture
|
inventoryDisplay :: Configuration -> World -> Picture
|
||||||
inventoryDisplay cfig w = listTextPicturesAt 0 0 cfig invlist
|
inventoryDisplay cfig w = listTextPicturesAt 0 0 cfig invlist
|
||||||
<> equipcursor
|
|
||||||
<> equipcursors
|
|
||||||
where
|
where
|
||||||
cr = you w
|
cr = you w
|
||||||
inv = _crInv cr
|
inv = _crInv cr
|
||||||
@@ -58,12 +56,6 @@ inventoryDisplay cfig w = listTextPicturesAt 0 0 cfig invlist
|
|||||||
0 -> [color invDimColor . text $ " INVENTORY FULL"]
|
0 -> [color invDimColor . text $ " INVENTORY FULL"]
|
||||||
1 -> [color invDimColor . text $ " +1 FREE SLOT"]
|
1 -> [color invDimColor . text $ " +1 FREE SLOT"]
|
||||||
x -> [color invDimColor . text $ " +" ++ show x ++ " FREE SLOTS"]
|
x -> [color invDimColor . text $ " +" ++ show x ++ " FREE SLOTS"]
|
||||||
equipcursor = case _crLeftInvSel cr of
|
|
||||||
Nothing -> mempty
|
|
||||||
Just invid -> f cyan invid
|
|
||||||
equipcursors = foldMap (f yellow) (IS.toList $ _crInvEquipped cr)
|
|
||||||
f col invid = listTextPictureAt 144 0 cfig (selNumPos invid w) . color col $ text "EQUIPPED"
|
|
||||||
|
|
||||||
|
|
||||||
subInventoryDisplay :: Configuration -> World -> Picture
|
subInventoryDisplay :: Configuration -> World -> Picture
|
||||||
subInventoryDisplay cfig w = case _inventoryMode w of
|
subInventoryDisplay cfig w = case _inventoryMode w of
|
||||||
@@ -71,6 +63,8 @@ subInventoryDisplay cfig w = case _inventoryMode w of
|
|||||||
TopInventory -> pictures
|
TopInventory -> pictures
|
||||||
[ selcursor
|
[ selcursor
|
||||||
, closeobjectcursor
|
, closeobjectcursor
|
||||||
|
, equipcursor
|
||||||
|
, equipcursors
|
||||||
]
|
]
|
||||||
TweakInventory -> pictures
|
TweakInventory -> pictures
|
||||||
--[ mCurs it cfig w
|
--[ mCurs it cfig w
|
||||||
@@ -111,7 +105,7 @@ subInventoryDisplay cfig w = case _inventoryMode w of
|
|||||||
Nothing -> mempty
|
Nothing -> mempty
|
||||||
Just (i,co) -> listCursorNS clObjFloatIn 0 cfig (selNumPos i w) (closeObjectCol co) topInvW (invSelSize i w)
|
Just (i,co) -> listCursorNS clObjFloatIn 0 cfig (selNumPos i w) (closeObjectCol co) topInvW (invSelSize i w)
|
||||||
itcol = fromMaybe (greyN 0.5) (it ^? _Just . itInvColor)
|
itcol = fromMaybe (greyN 0.5) (it ^? _Just . itInvColor)
|
||||||
--cr = you w
|
cr = you w
|
||||||
it = yourItem w
|
it = yourItem w
|
||||||
selcursor' ct = fromMaybe mempty $ ct 0 0 cfig curpos itcol topInvW cury <$ it
|
selcursor' ct = fromMaybe mempty $ ct 0 0 cfig curpos itcol topInvW cury <$ it
|
||||||
selcursor = selcursor' selcursortype
|
selcursor = selcursor' selcursortype
|
||||||
@@ -120,6 +114,11 @@ subInventoryDisplay cfig w = case _inventoryMode w of
|
|||||||
| otherwise = listCursorNSW
|
| otherwise = listCursorNSW
|
||||||
curpos = invSelPos w
|
curpos = invSelPos w
|
||||||
cury = fromMaybe 1 $ augmentedInvSizes w IM.!? _crInvSel (you w)
|
cury = fromMaybe 1 $ augmentedInvSizes w IM.!? _crInvSel (you w)
|
||||||
|
equipcursor = case _crLeftInvSel cr of
|
||||||
|
Nothing -> mempty
|
||||||
|
Just invid -> f cyan invid
|
||||||
|
equipcursors = foldMap (f yellow) (IS.toList $ _crInvEquipped cr)
|
||||||
|
f col invid = listTextPictureAt 144 0 cfig (selNumPos invid w) . color col $ text "EQUIPPED"
|
||||||
|
|
||||||
topInvW :: Int
|
topInvW :: Int
|
||||||
topInvW = 15
|
topInvW = 15
|
||||||
|
|||||||
+2
-2
@@ -83,8 +83,8 @@ functionalUpdate cfig w = checkEndGame
|
|||||||
|
|
||||||
doRewind :: World -> World
|
doRewind :: World -> World
|
||||||
doRewind w = case _maybeWorld w of
|
doRewind w = case _maybeWorld w of
|
||||||
Just' w' -> w'
|
Just' w' -> w' & rewinding .~ RewindingLastFrame
|
||||||
Nothing' -> w
|
Nothing' -> w & rewinding .~ NotRewinding
|
||||||
|
|
||||||
zoneCreatures :: World -> World
|
zoneCreatures :: World -> World
|
||||||
zoneCreatures w = w
|
zoneCreatures w = w
|
||||||
|
|||||||
@@ -19,7 +19,9 @@ updateUsingInput w = if _carteDisplay w
|
|||||||
updatePressedButtons :: S.Set MouseButton -> World -> World
|
updatePressedButtons :: S.Set MouseButton -> World -> World
|
||||||
updatePressedButtons pkeys w
|
updatePressedButtons pkeys w
|
||||||
| lbPressed && rbPressed = tryUseItem (you w) w
|
| lbPressed && rbPressed = tryUseItem (you w) w
|
||||||
| lbPressed = useLeftItem (_yourID w) w
|
| lbPressed &&
|
||||||
|
(_inventoryMode w == TopInventory || _rewinding w == RewindingLastFrame)
|
||||||
|
= useLeftItem (_yourID w) w
|
||||||
-- | lbPressed = w
|
-- | lbPressed = w
|
||||||
| mbPressed = w & clickMousePos .~ _mousePos w
|
| mbPressed = w & clickMousePos .~ _mousePos w
|
||||||
& cameraRot -~ rotation
|
& cameraRot -~ rotation
|
||||||
|
|||||||
Reference in New Issue
Block a user