diff --git a/src/Dodge/Data/Terminal.hs b/src/Dodge/Data/Terminal.hs index 79e2e7e77..d693886b3 100644 --- a/src/Dodge/Data/Terminal.hs +++ b/src/Dodge/Data/Terminal.hs @@ -47,7 +47,7 @@ data Terminal = Terminal , _tmCommandHistory :: [String] , _tmToggles :: M.Map String TerminalToggle , _tmPartialCommand :: Maybe TerminalCommand - , _tmType :: TerminalType +-- , _tmType :: TerminalType } --deriving (Eq, Show, Read) --, Generic) --h--deriving (Eq, Show, Read) --Generic, Flat) diff --git a/src/Dodge/Default/Terminal.hs b/src/Dodge/Default/Terminal.hs index d0dcc12b2..43ee22cb0 100644 --- a/src/Dodge/Default/Terminal.hs +++ b/src/Dodge/Default/Terminal.hs @@ -25,7 +25,6 @@ defaultTerminal = , _tmCommandHistory = [] , _tmToggles = mempty , _tmPartialCommand = Nothing - , _tmType = DefaultTerminal , _tmExternalColor = dark magenta } diff --git a/src/Dodge/Render/HUD.hs b/src/Dodge/Render/HUD.hs index d4d404f76..b87e297ad 100644 --- a/src/Dodge/Render/HUD.hs +++ b/src/Dodge/Render/HUD.hs @@ -363,7 +363,7 @@ combineInventoryExtra sss msel cfig w = fromMaybe mempty $ do drawTerminalDisplay :: Int -> Configuration -> LWorld -> Picture drawTerminalDisplay tid cfig w = fromMaybe mempty $ do tm <- w ^? terminals . ix tid - let tsize = getMaxLinesTM (tm ^. tmType) + 1 + let tsize = getMaxLinesTM + 1 return $ invHead cfig (_tmTitle tm ++ ":T" ++ show tid) <> drawSelectionList secondColumnParams cfig (thesellist tm) @@ -378,14 +378,14 @@ drawTerminalDisplay tid cfig w = fromMaybe mempty $ do thelist tm = map toselitm . displayTermInput tm . reverse - . take (getMaxLinesTM (tm ^. tmType)) + . take getMaxLinesTM $ _tmDisplayedLines tm displayTermInput tm = case _tmInput tm of TerminalInput{_tiText = s} -> (++ [(displayInputText tm s ++ [cFilledRect], white)]) partcommand tm = maybe "" (++ " ") $ tm ^? tmPartialCommand . _Just . tcString displayInputText tm s - | _tmStatus tm == TerminalReady = partcommand tm ++ getPromptTM (tm ^. tmType) ++ s + | _tmStatus tm == TerminalReady = partcommand tm ++ getPromptTM ++ s | otherwise = "" -- | hasfoc = clockCycle 10 (V.fromList [[cFilledRect] , "."]) w diff --git a/src/Dodge/Terminal.hs b/src/Dodge/Terminal.hs index e4aaf90cb..d82e17411 100644 --- a/src/Dodge/Terminal.hs +++ b/src/Dodge/Terminal.hs @@ -284,7 +284,7 @@ terminalReturnEffect tmid w = fromMaybe w $ do w & cWorld . lWorld . terminals . ix tmid . tmPartialCommand .~ Nothing & cWorld . lWorld . terminals . ix tmid . tmFutureLines - .~ [makeTermLine (pc ++ getPromptTM (tm ^. tmType) ++ s)] + .~ [makeTermLine (pc ++ getPromptTM ++ s)] runTerminalString :: String -> Terminal -> World -> World runTerminalString s tm w = diff --git a/src/Dodge/Terminal/Type.hs b/src/Dodge/Terminal/Type.hs index c5fe6149d..977df4873 100644 --- a/src/Dodge/Terminal/Type.hs +++ b/src/Dodge/Terminal/Type.hs @@ -3,10 +3,8 @@ module Dodge.Terminal.Type ( getMaxLinesTM, ) where -import Dodge.Data.Terminal +getPromptTM :: String +getPromptTM = "> " -getPromptTM :: TerminalType -> String -getPromptTM _ = "> " - -getMaxLinesTM :: TerminalType -> Int -getMaxLinesTM _ = 14 +getMaxLinesTM :: Int +getMaxLinesTM = 14 diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index f7e5e57fc..9e31391cf 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -397,7 +397,7 @@ updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of tmid <- w ^? hud . hudElement . subInventory . termID tm <- w ^? cWorld . lWorld . terminals . ix tmid return $ - if isOverTerminalScreen cfig tm mpos + if isOverTerminalScreen cfig mpos then fromMaybe NoMouseContext $ do let s = tm ^. tmInput . tiText guard $ not (null s) && _tmStatus tm == TerminalReady @@ -415,8 +415,8 @@ getMenuMouseContext screen u = case screen ^. scOptions of Just True -> MouseMenuClick yi _ -> NoMouseContext -isOverTerminalScreen :: Configuration -> Terminal -> Point2 -> Bool -isOverTerminalScreen cfig tm (V2 x y) = +isOverTerminalScreen :: Configuration -> Point2 -> Bool +isOverTerminalScreen cfig (V2 x y) = x <= xmax && x >= xmin - 5 && y <= ymax + 5 @@ -424,7 +424,7 @@ isOverTerminalScreen cfig tm (V2 x y) = where ldp = secondColumnParams V2 xmin ymax = screenPosAbs cfig (ldp ^. ldpPos) - tsize = fromIntegral $ getMaxLinesTM (tm ^. tmType) + 1 + tsize = fromIntegral $ getMaxLinesTM + 1 s = 5 + tsize * (20 * ldp ^. ldpScale + ldp ^. ldpVerticalGap) ymin = ymax - s xmax = xmin + 555 -- HACK drawSelectionListBackground