tracer/src/Types/Interior.hs
2018-04-14 18:43:05 +02:00

102 lines
2.5 KiB
Haskell

module Types.Interior where
import Data.Matrix as M
import Linear.V2
-- internal imports
import Types.Map
import Types.UserData
import Types.ReachPoint
data Cluster
= ClusterBox1
| ClusterTable1
| ClusterTable2
| ClusterTable3
| ClusterTable4
| ClusterCornerTable
| ClusterTableGroup
deriving (Enum, Bounded)
clusterMat :: Cluster -> Matrix (Maybe ImgId)
clusterMat ClusterBox1 =
M.fromLists
-- [ [ Nothing]
[ [Just ImgMiscBox1]
-- , [Nothing, Nothing, Nothing]
]
clusterMat ClusterTable1 =
M.fromLists
[[Just ImgEmpty, Just ImgMiscTable1]]
clusterMat ClusterTable2 =
M.fromLists
[ [Just ImgMiscTable2]
, [Just ImgEmpty]
]
clusterMat ClusterTable3 =
M.fromLists
[[Just ImgMiscTable3, Just ImgEmpty]]
clusterMat ClusterTable4 =
M.fromLists
[ [Just ImgEmpty]
, [Just ImgMiscTable4]
]
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 ClusterTable1 = Offi
clusterRoom ClusterTable2 = Offi
clusterRoom ClusterTable3 = Offi
clusterRoom ClusterTable4 = Offi
clusterRoom ClusterCornerTable = Offi
clusterRoom ClusterTableGroup = Offi
clusterPoints :: Cluster -> [ReachPoint]
clusterPoints ClusterBox1 = []
clusterPoints ClusterTable1 =
[ ReachPoint Table (V2 1 1) ]
clusterPoints ClusterTable2 =
[ ReachPoint Table (V2 2 1) ]
clusterPoints ClusterTable3 =
[ ReachPoint Table (V2 1 2) ]
clusterPoints ClusterTable4 =
[ ReachPoint Table (V2 1 1) ]
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))