Implement terminals

This commit is contained in:
2022-03-14 20:39:23 +00:00
parent 1b6f11709c
commit f16f32d9d3
30 changed files with 313 additions and 119 deletions
+35 -15
View File
@@ -110,17 +110,13 @@ data World = World
, _pathGraph :: ~(Gr Point2 Float)
, _pathGraphP :: ~[(Point2,Point2)]
, _pathPoints :: ~(IM.IntMap (IM.IntMap [(Int,Point2)]))
, _carteDisplay :: Bool
, _carteCenter :: Point2
, _carteZoom :: Float
, _carteRot :: Float
, _hud :: HUD
, _lightSources :: IM.IntMap LightSource
, _tempLightSources :: [TempLightSource]
, _closeObjects :: [Either FloorItem Button]
, _seenLocations :: IM.IntMap (World -> Point2,String)
, _selLocation :: Int
, _sideEffects :: Universe -> IO Universe
, _inventoryMode :: InventoryMode
, _distortions :: [Distortion]
, _worldBounds :: Bounds
, _gameRooms :: [GameRoom] -- consider using an IntMap
@@ -129,10 +125,30 @@ data World = World
, _timeFlow :: TimeFlowStatus
, _worldClock :: Int
, _youHammerPosition :: HammerPosition
, _worldTerminal :: Maybe' WorldTerminal
}
data WorldTerminal = WorldTerminal Int [(Int,String)]
data HUDElement = DisplayInventory {_subInventory :: SubInventory}
| DisplayCarte
deriving (Eq,Ord,Show)
data SubInventory
= NoSubInventory
| TweakInventory
| CombineInventory {_combineInvSel :: Maybe Int}
| InspectInventory
| LockedInventory
| DisplayTerminal
{_termParams :: TerminalParams
,_termID :: Int
}
deriving (Eq,Ord,Show)
data HUD = HUD
{ _hudElement :: HUDElement
, _carteCenter :: Point2
, _carteZoom :: Float
, _carteRot :: Float
}
data TimeFlowStatus
= RewindingNow
| RewindingLastFrame
@@ -183,13 +199,6 @@ data MenuOption
{ _moKey :: Scancode
, _moEff :: Universe -> IO (Maybe Universe)
}
data InventoryMode
= TopInventory
| TweakInventory
| CombineInventory {_combineInvSel :: Maybe Int}
| InspectInventory
| LockedInventory
deriving (Eq, Ord, Show)
data CrGroupParams = CrGroupParams
{ _crGroupParamID :: Int
, _crGroupIDs :: IS.IntSet
@@ -306,7 +315,14 @@ data Button = Button
, _btID :: Int
, _btText :: String
, _btState :: ButtonState
, _btTerminalParams :: TerminalParams
}
data TerminalParams = NoTerminalParams | TerminalParams
{ _termDisplayedLines :: [(String,Color)]
, _termFutureLines :: [(Int,(String,Color))]
, _termMaxLines :: Int
}
deriving (Eq,Ord,Show)
data ButtonState = BtOn | BtOff | BtNoLabel
deriving (Eq, Show)
data PressPlate = PressPlate
@@ -754,6 +770,7 @@ data Wall = Wall
, _wlOpacity :: Opacity
, _wlPathable :: Bool
, _wlWalkable :: Bool
, _wlTouchThrough :: Bool
, _wlFireThrough :: Bool
, _wlReflect :: Bool
, _wlDraw :: Bool
@@ -981,7 +998,6 @@ makeLenses ''LSParam
makeLenses ''ItemParams
makeLenses ''ItemTweaks
makeLenses ''Maybe'
makeLenses ''InventoryMode
makeLenses ''ItemPortage
makeLenses ''Magnet
makeLenses ''Gust
@@ -989,3 +1005,7 @@ makeLenses ''GunBarrels
makeLenses ''ItemModule
makeLenses ''Targeting
makeLenses ''Nozzle
makeLenses ''HUD
makeLenses ''HUDElement
makeLenses ''SubInventory
makeLenses ''TerminalParams