Fix reloading of start of level

This commit is contained in:
2021-09-13 00:34:14 +01:00
parent 49274064a0
commit d11d19c9e8
4 changed files with 27 additions and 36 deletions
+2 -7
View File
@@ -1,6 +1,7 @@
module Dodge.Menu
where
import Dodge.Data
import Dodge.Save
import Dodge.Config.Data
import Dodge.Config.Update
import SDL
@@ -14,7 +15,6 @@ import Dodge.SoundLogic
import Picture
import Control.Lens
import Data.Maybe
optionMenu :: ScreenLayer
optionMenu = OptionScreen
{ _scTitle = const "OPTIONS"
@@ -131,7 +131,7 @@ pauseMenu = OptionScreen
pauseMenuOptions :: [MenuOption]
pauseMenuOptions =
[ Toggle ScancodeN startNewGame (const "NEW LEVEL")
, Toggle ScancodeR (\w -> return $ fromMaybe w $ _storedLevel w) (const "RESTART")
, Toggle ScancodeR (Just . loadStoredLevel) (const "RESTART")
, Toggle ScancodeO (pushScreen optionMenu ) (const "OPTIONS")
, Toggle ScancodeC (pushScreen displayControls) (const "CONTROLS")
, InvisibleToggle ScancodeEscape (const Nothing)
@@ -174,11 +174,6 @@ levelMenu x = OptionScreen
unpause :: World -> Maybe World
unpause w = Just . resumeSound $ w {_menuLayers = []}
storeLevel :: World -> World
storeLevel w = case _storedLevel w of
Nothing -> w & storedLevel ?~ w
_ -> w
displayControls :: ScreenLayer
displayControls = DisplayScreen
{_scDisplay = \w -> pictures