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 u
|
||||
| _rewinding w = return M.empty
|
||||
| _rewinding w == RewindingNow = return M.empty
|
||||
| otherwise = playSoundAndUpdate (_soundData $ _preloadData u) (_playingSounds w) (_toPlaySounds w)
|
||||
where
|
||||
w = _uvWorld u
|
||||
@@ -103,7 +103,7 @@ doSideEffects u = do
|
||||
& uvWorld . playingSounds .~ newPlayingSounds
|
||||
& uvWorld . toPlaySounds .~ M.empty
|
||||
& 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
|
||||
|
||||
+7
-1
@@ -125,13 +125,19 @@ data World = World
|
||||
, _gameRooms :: [GameRoom] -- consider using and IntMap
|
||||
, _maybeWorld :: Maybe' World
|
||||
, _rewindWorlds :: [World]
|
||||
, _rewinding :: Bool
|
||||
, _rewinding :: RewindingStatus
|
||||
, _worldClock :: Int
|
||||
, _lSelHammerPosition :: HammerPosition
|
||||
, _worldTerminal :: Maybe' WorldTerminal
|
||||
}
|
||||
data WorldTerminal = WorldTerminal Int [(Int,String)]
|
||||
|
||||
data RewindingStatus
|
||||
= RewindingNow
|
||||
| RewindingLastFrame
|
||||
| NotRewinding
|
||||
deriving (Eq,Ord)
|
||||
|
||||
data SaveSlot = QuicksaveSlot | LevelStartSlot
|
||||
deriving (Eq,Ord)
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ defaultWorld = World
|
||||
, _worldBounds = defaultBounds
|
||||
, _maybeWorld = Nothing'
|
||||
, _rewindWorlds = []
|
||||
, _rewinding = False
|
||||
, _rewinding = NotRewinding
|
||||
, _lSelHammerPosition = HammerUp
|
||||
, _worldTerminal = Nothing'
|
||||
}
|
||||
|
||||
@@ -38,13 +38,12 @@ rewindEffect _ cr invid w
|
||||
ptrWpCharge = creatures . ix (_crID cr) . crInv . ix invid . itConsumption . wpCharge
|
||||
maxcharge = _wpMaxCharge . _itConsumption $ _crInv cr IM.! invid
|
||||
w' = w & rewindWorlds .~ []
|
||||
& rewinding .~ True
|
||||
& rewinding .~ RewindingNow
|
||||
|
||||
useRewindGun :: Item -> Creature -> World -> World
|
||||
useRewindGun _ _ w = case _rewindWorlds w of
|
||||
[w'] -> rewindusing w' []
|
||||
[w'] -> rewindusing w' [w']
|
||||
(w':ws) -> rewindusing w' ws
|
||||
(_:w':ws) -> rewindusing w' ws
|
||||
_ -> w
|
||||
where
|
||||
rewindusing w' ws = w
|
||||
|
||||
@@ -42,8 +42,6 @@ drawInGameHUD cfig w = pictures
|
||||
|
||||
inventoryDisplay :: Configuration -> World -> Picture
|
||||
inventoryDisplay cfig w = listTextPicturesAt 0 0 cfig invlist
|
||||
<> equipcursor
|
||||
<> equipcursors
|
||||
where
|
||||
cr = you w
|
||||
inv = _crInv cr
|
||||
@@ -58,12 +56,6 @@ inventoryDisplay cfig w = listTextPicturesAt 0 0 cfig invlist
|
||||
0 -> [color invDimColor . text $ " INVENTORY FULL"]
|
||||
1 -> [color invDimColor . text $ " +1 FREE SLOT"]
|
||||
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 cfig w = case _inventoryMode w of
|
||||
@@ -71,6 +63,8 @@ subInventoryDisplay cfig w = case _inventoryMode w of
|
||||
TopInventory -> pictures
|
||||
[ selcursor
|
||||
, closeobjectcursor
|
||||
, equipcursor
|
||||
, equipcursors
|
||||
]
|
||||
TweakInventory -> pictures
|
||||
--[ mCurs it cfig w
|
||||
@@ -111,7 +105,7 @@ subInventoryDisplay cfig w = case _inventoryMode w of
|
||||
Nothing -> mempty
|
||||
Just (i,co) -> listCursorNS clObjFloatIn 0 cfig (selNumPos i w) (closeObjectCol co) topInvW (invSelSize i w)
|
||||
itcol = fromMaybe (greyN 0.5) (it ^? _Just . itInvColor)
|
||||
--cr = you w
|
||||
cr = you w
|
||||
it = yourItem w
|
||||
selcursor' ct = fromMaybe mempty $ ct 0 0 cfig curpos itcol topInvW cury <$ it
|
||||
selcursor = selcursor' selcursortype
|
||||
@@ -120,6 +114,11 @@ subInventoryDisplay cfig w = case _inventoryMode w of
|
||||
| otherwise = listCursorNSW
|
||||
curpos = invSelPos 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 = 15
|
||||
|
||||
+2
-2
@@ -83,8 +83,8 @@ functionalUpdate cfig w = checkEndGame
|
||||
|
||||
doRewind :: World -> World
|
||||
doRewind w = case _maybeWorld w of
|
||||
Just' w' -> w'
|
||||
Nothing' -> w
|
||||
Just' w' -> w' & rewinding .~ RewindingLastFrame
|
||||
Nothing' -> w & rewinding .~ NotRewinding
|
||||
|
||||
zoneCreatures :: World -> World
|
||||
zoneCreatures w = w
|
||||
|
||||
@@ -19,7 +19,9 @@ updateUsingInput w = if _carteDisplay w
|
||||
updatePressedButtons :: S.Set MouseButton -> World -> World
|
||||
updatePressedButtons pkeys 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
|
||||
| mbPressed = w & clickMousePos .~ _mousePos w
|
||||
& cameraRot -~ rotation
|
||||
|
||||
Reference in New Issue
Block a user