diff --git a/appDodge/Main.hs b/appDodge/Main.hs index d3f7ae2c5..e252d7dfe 100644 --- a/appDodge/Main.hs +++ b/appDodge/Main.hs @@ -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 diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index 197547ddc..98b9f917b 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -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) diff --git a/src/Dodge/Default/World.hs b/src/Dodge/Default/World.hs index 91baa65bc..38d649d28 100644 --- a/src/Dodge/Default/World.hs +++ b/src/Dodge/Default/World.hs @@ -87,7 +87,7 @@ defaultWorld = World , _worldBounds = defaultBounds , _maybeWorld = Nothing' , _rewindWorlds = [] - , _rewinding = False + , _rewinding = NotRewinding , _lSelHammerPosition = HammerUp , _worldTerminal = Nothing' } diff --git a/src/Dodge/Item/Weapon/Utility.hs b/src/Dodge/Item/Weapon/Utility.hs index 154749889..46954f768 100644 --- a/src/Dodge/Item/Weapon/Utility.hs +++ b/src/Dodge/Item/Weapon/Utility.hs @@ -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 diff --git a/src/Dodge/Render/HUD.hs b/src/Dodge/Render/HUD.hs index 19998d0cf..944be1a94 100644 --- a/src/Dodge/Render/HUD.hs +++ b/src/Dodge/Render/HUD.hs @@ -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 diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index d1aeeb122..9aa17b38b 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -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 diff --git a/src/Dodge/Update/UsingInput.hs b/src/Dodge/Update/UsingInput.hs index a9a0eecf2..87c25ee3d 100644 --- a/src/Dodge/Update/UsingInput.hs +++ b/src/Dodge/Update/UsingInput.hs @@ -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