diff --git a/src/Dodge/Data/Universe.hs b/src/Dodge/Data/Universe.hs index 0db0f719b..207464394 100644 --- a/src/Dodge/Data/Universe.hs +++ b/src/Dodge/Data/Universe.hs @@ -85,7 +85,6 @@ data ScreenLayer , _scOptionFlag :: OptionScreenFlag , _scSelectionList :: [SelectionItem (Universe -> Universe,Universe->Universe)] , _scAvailableLines :: Int - , _scListDisplayParams :: ListDisplayParams , _scDisplayTime :: Int } | InputScreen diff --git a/src/Dodge/Menu/Loading.hs b/src/Dodge/Menu/Loading.hs index c63b0fdd7..274b090bd 100644 --- a/src/Dodge/Menu/Loading.hs +++ b/src/Dodge/Menu/Loading.hs @@ -15,6 +15,6 @@ loadingScreen str = , _scOptionFlag = LoadingScreen , _scSelectionList = [] , _scAvailableLines = 0 - , _scListDisplayParams = optionListDisplayParams +-- , _scListDisplayParams = optionListDisplayParams , _scDisplayTime = 0 } diff --git a/src/Dodge/Menu/Option.hs b/src/Dodge/Menu/Option.hs index 6b54be401..c0cde2815 100644 --- a/src/Dodge/Menu/Option.hs +++ b/src/Dodge/Menu/Option.hs @@ -25,7 +25,7 @@ initializeOptionMenu title ops pmo u = , _scOptionFlag = NormalOptions , _scSelectionList = optionsToSelections 10 u ops pmo , _scAvailableLines = getAvailableListLines optionListDisplayParams (u ^. uvConfig) - , _scListDisplayParams = optionListDisplayParams +-- , _scListDisplayParams = optionListDisplayParams , _scDisplayTime = 0 } diff --git a/src/Dodge/Render/MenuScreen.hs b/src/Dodge/Render/MenuScreen.hs index 3a8e670d5..6a9533b9d 100644 --- a/src/Dodge/Render/MenuScreen.hs +++ b/src/Dodge/Render/MenuScreen.hs @@ -3,6 +3,7 @@ module Dodge.Render.MenuScreen ( drawMenuScreen, ) where +import Dodge.ListDisplayParams import Dodge.ScreenPos import Dodge.Data.CardinalPoint import Control.Lens @@ -14,8 +15,8 @@ import Picture drawMenuScreen :: Configuration -> Maybe Int -> ScreenLayer -> Picture drawMenuScreen cfig spos screen = case screen of - OptionScreen{_scTitle = titf, _scSelectionList = slist, _scListDisplayParams = ldps} -> - drawOptions ldps cfig titf spos slist + OptionScreen{_scTitle = titf, _scSelectionList = slist} -> + drawOptions optionListDisplayParams cfig titf spos slist InputScreen inputstr help -> drawInputMenu cfig ('>' : inputstr) help drawInputMenu :: diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index 916ce208c..8b30a4bc7 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -7,6 +7,7 @@ Description : Simulation update -} module Dodge.Update (updateUniverse) where +import Dodge.ListDisplayParams import Color import Control.Applicative import Control.Monad @@ -339,9 +340,8 @@ updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of sss <- w ^? hud . hudElement . diSections selpos@(i, j) <- inverseSelNumPos cfig invDP sss mpos case w ^? hud . hudElement . subInventory . ciSelection of - Just _ -> do - guard (i == 0) - return $ OverCombFiltInv selpos + Just _ | i == 0 -> return $ OverCombFiltInv selpos + Just _ -> Nothing _ -> do guard $ ButtonRight `M.notMember` (w ^. input . mouseButtons) guard =<< sss ^? ix i . ssItems . ix j . siIsSelectable @@ -371,22 +371,17 @@ getMenuMouseContext :: ScreenLayer -> Universe -> MouseContext getMenuMouseContext screen u = case screen ^. scOptions of [] -> NoMouseContext _ -> fromMaybe MouseMenuCursor $ do - ldps <- screen ^? scListDisplayParams +-- ldps <- screen ^? scListDisplayParams let ymax = maybe 0 length $ screen ^? scSelectionList yi <- ldpVerticalSelection (u ^. uvConfig) - ldps + optionListDisplayParams (u ^. uvWorld . input . mousePos) guard (yi >= 0 && yi < ymax) - return $ - if isselectable yi - then MouseMenuClick yi - else NoMouseContext - where - isselectable yi = - fromMaybe False $ - u ^? uvScreenLayers . _head . scSelectionList . ix yi . siIsSelectable + return $ case u ^? uvScreenLayers . _head . scSelectionList . ix yi . siIsSelectable of + Just True -> MouseMenuClick yi + _ -> NoMouseContext isOverTerminalScreen :: Configuration -> Terminal -> Point2 -> Bool isOverTerminalScreen cfig tm (V2 x y) = diff --git a/src/Dodge/Update/Input/ScreenLayer.hs b/src/Dodge/Update/Input/ScreenLayer.hs index 715a36e06..eb7acc967 100644 --- a/src/Dodge/Update/Input/ScreenLayer.hs +++ b/src/Dodge/Update/Input/ScreenLayer.hs @@ -3,6 +3,7 @@ module Dodge.Update.Input.ScreenLayer ( ldpVerticalSelection, ) where +import Dodge.ListDisplayParams import Control.Monad import Data.Char import qualified Data.Map.Strict as M @@ -83,6 +84,8 @@ ldpVerticalSelection cfig ldp (V2 _ y) ylower = ceiling ((top - y) / yoff) - 1 setSelectionListRestriction :: Configuration -> ScreenLayer -> ScreenLayer -setSelectionListRestriction cfig screen = fromMaybe screen $ do - ldps <- screen ^? scListDisplayParams - return $ screen & scAvailableLines %~ const (getAvailableListLines ldps cfig) +setSelectionListRestriction cfig screen = + screen & scAvailableLines %~ const (getAvailableListLines optionListDisplayParams cfig) +-- fromMaybe screen $ do +-- ldps <- screen ^? scListDisplayParams +-- return $ screen & scAvailableLines %~ const (getAvailableListLines ldps cfig)