tracer/src/Types/Interior.hs

80 lines
1.9 KiB
Haskell

module Types.Interior where
import Data.Matrix as M
import Linear.V2
-- internal imports
import Types.Map
import Types.UserData
data Cluster
= ClusterBox1
| ClusterCornerTable
| ClusterTableGroup
deriving (Enum, Bounded)
clusterMat :: Cluster -> Matrix (Maybe ImgId)
clusterMat ClusterBox1 =
M.fromLists
-- [ [ Nothing]
[ [Just ImgMiscBox1]
-- , [Nothing, Nothing, Nothing]
]
clusterMat ClusterCornerTable =
M.fromLists
[ [Just ImgMiscTable2, Just ImgMiscTableCorner]
, [Just ImgEmpty , Just ImgMiscTable1]
]
clusterMat ClusterTableGroup =
M.fromLists
[ [ Just ImgEmpty, Just ImgMiscTable2, Just ImgMiscTableCorner
, Just ImgEmpty, Just ImgMiscTable2, Just ImgMiscTableCorner
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable1
, Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable1
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
, [ Nothing, Nothing, Nothing
, Just ImgEmpty, Just ImgMiscTable2, Just ImgMiscTableCorner
]
, [ Nothing, Nothing, Nothing
, Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable1
]
]
clusterRoom :: Cluster -> TileState
clusterRoom ClusterBox1 = Offi
clusterRoom ClusterCornerTable = Offi
clusterRoom ClusterTableGroup = Offi
clusterPoints :: Cluster -> [ReachPoint]
clusterPoints ClusterBox1 = []
clusterPoints ClusterCornerTable =
[ ReachPoint Table (V2 2 1)
]
clusterPoints ClusterTableGroup =
[ ReachPoint Table (V2 2 2)
, ReachPoint Table (V2 2 5)
, ReachPoint Table (V2 5 5)
]
instance Size Cluster where
size c =
let mat = clusterMat c
in fromIntegral ((nrows mat) * (ncols mat))
data ReachPoint = ReachPoint
{ pointType :: PointType
, pointCoord :: V2 Int
}
deriving (Show)
data PointType
= RoomExit
| Table
deriving (Eq, Show)