tracer/src/Types/Interior.hs

113 lines
2.9 KiB
Haskell
Raw Normal View History

2018-03-03 16:03:17 +00:00
module Types.Interior where
import Data.Matrix as M
import Linear.V2
2018-03-03 16:03:17 +00:00
-- internal imports
import Types.Map
2018-04-14 16:43:05 +00:00
import Types.ReachPoint
import Types.ImgId
import Types.Direction
2018-03-03 16:03:17 +00:00
data Cluster
= ClusterBox1
2018-04-03 20:21:07 +00:00
| ClusterTable1
| ClusterTable2
2018-04-03 20:27:41 +00:00
| ClusterTable3
| ClusterTable4
2018-03-31 21:22:10 +00:00
| ClusterCornerTable
2018-04-01 02:51:15 +00:00
| ClusterTableGroup
2018-07-21 04:43:26 +00:00
| ClusterCopier
2018-03-03 16:03:17 +00:00
deriving (Enum, Bounded)
clusterMat :: Cluster -> Matrix (Maybe ImgId)
clusterMat ClusterBox1 =
M.fromLists
2018-03-05 20:11:38 +00:00
-- [ [ Nothing]
[ [Just ImgMiscBox1]
-- , [Nothing, Nothing, Nothing]
2018-03-03 16:03:17 +00:00
]
2018-04-03 20:21:07 +00:00
clusterMat ClusterTable1 =
M.fromLists
2018-07-21 04:43:26 +00:00
[[Just (ImgEmpty []), Just ImgMiscTable1]]
2018-04-03 20:21:07 +00:00
clusterMat ClusterTable2 =
M.fromLists
[ [Just ImgMiscTable2]
2018-07-21 04:43:26 +00:00
, [Just (ImgEmpty [])]
2018-04-03 20:21:07 +00:00
]
2018-04-03 20:27:41 +00:00
clusterMat ClusterTable3 =
M.fromLists
2018-07-21 04:43:26 +00:00
[[Just ImgMiscTable3, Just (ImgEmpty [])]]
2018-04-03 20:27:41 +00:00
clusterMat ClusterTable4 =
M.fromLists
2018-07-21 04:43:26 +00:00
[ [Just (ImgEmpty [])]
2018-04-11 18:01:41 +00:00
, [Just ImgMiscTable4]
2018-04-03 20:27:41 +00:00
]
2018-03-31 21:22:10 +00:00
clusterMat ClusterCornerTable =
M.fromLists
[ [Just ImgMiscTable2, Just ImgMiscTableCorner]
2018-07-21 04:43:26 +00:00
, [Just (ImgEmpty []), Just ImgMiscTable1]
2018-04-01 02:51:15 +00:00
]
clusterMat ClusterTableGroup =
M.fromLists
2018-07-21 04:43:26 +00:00
[ [ Just (ImgEmpty []), Just ImgMiscTable2, Just ImgMiscTableCorner
, Just (ImgEmpty []), Just ImgMiscTable2, Just ImgMiscTableCorner
2018-04-01 02:51:15 +00:00
]
2018-07-21 04:43:26 +00:00
, [ Just (ImgEmpty []), Just (ImgEmpty []), Just ImgMiscTable1
, Just (ImgEmpty []), Just (ImgEmpty []), Just ImgMiscTable1
2018-04-01 02:51:15 +00:00
]
2018-07-21 04:43:26 +00:00
, [ Just (ImgEmpty []), Just (ImgEmpty []), Just (ImgEmpty [])
, Just (ImgEmpty []), Just (ImgEmpty []), Just (ImgEmpty [])
2018-04-01 02:51:15 +00:00
]
, [ Nothing, Nothing, Nothing
2018-07-21 04:43:26 +00:00
, Just (ImgEmpty []), Just ImgMiscTable2, Just ImgMiscTableCorner
2018-04-01 02:51:15 +00:00
]
, [ Nothing, Nothing, Nothing
2018-07-21 04:43:26 +00:00
, Just (ImgEmpty []), Just (ImgEmpty []), Just ImgMiscTable1
2018-04-01 02:51:15 +00:00
]
2018-03-31 21:22:10 +00:00
]
2018-07-21 04:43:26 +00:00
clusterMat ClusterCopier =
M.fromLists
[ [ Just (ImgEmpty [Boundaries (10/36, 8/36) (28/36, 30/36)])]
, [ Just (ImgEmpty [])]
]
2018-03-03 16:03:17 +00:00
clusterRoom :: Cluster -> TileState
clusterRoom ClusterBox1 = Offi
2018-04-03 20:21:07 +00:00
clusterRoom ClusterTable1 = Offi
clusterRoom ClusterTable2 = Offi
2018-04-03 20:27:41 +00:00
clusterRoom ClusterTable3 = Offi
clusterRoom ClusterTable4 = Offi
2018-03-31 21:22:10 +00:00
clusterRoom ClusterCornerTable = Offi
2018-04-01 02:51:15 +00:00
clusterRoom ClusterTableGroup = Offi
2018-07-21 04:43:26 +00:00
clusterRoom ClusterCopier = Offi
2018-03-03 16:03:17 +00:00
clusterPoints :: Cluster -> [ReachPoint]
clusterPoints ClusterBox1 = []
2018-04-03 20:21:07 +00:00
clusterPoints ClusterTable1 =
[ ReachPoint Table (V2 1 1) NE]
2018-04-03 20:21:07 +00:00
clusterPoints ClusterTable2 =
[ ReachPoint Table (V2 2 1) NW]
2018-04-03 20:27:41 +00:00
clusterPoints ClusterTable3 =
[ ReachPoint Table (V2 1 2) SW]
2018-04-03 20:27:41 +00:00
clusterPoints ClusterTable4 =
[ ReachPoint Table (V2 1 1) SE]
clusterPoints ClusterCornerTable =
[ ReachPoint Table (V2 2 1) N
]
clusterPoints ClusterTableGroup =
[ ReachPoint Table (V2 2 2) N
, ReachPoint Table (V2 2 5) N
, ReachPoint Table (V2 5 5) N
]
2018-07-21 04:43:26 +00:00
clusterPoints ClusterCopier =
[ ReachPoint Copier (V2 2 1) NW
]
2018-03-03 16:03:17 +00:00
instance Size Cluster where
size c =
let mat = clusterMat c
in fromIntegral ((nrows mat) * (ncols mat))