incorporate new assets

This commit is contained in:
nek0 2018-07-30 21:10:42 +02:00
parent 4a2a4c4aeb
commit 14549d8533
4 changed files with 109 additions and 31 deletions

View file

@ -59,7 +59,7 @@ loadFork
-> MVar (Float, T.Text) -> MVar (Float, T.Text)
-> IO () -> IO ()
loadFork ws win glc nvg future progress = do loadFork ws win glc nvg future progress = do
let stateSteps = 26 let stateSteps = 30
increment = 1 / stateSteps increment = 1 / stateSteps
SDL.glMakeCurrent win glc SDL.glMakeCurrent win glc
modifyMVar_ progress (return . (\(p, _) -> modifyMVar_ progress (return . (\(p, _) ->
@ -139,9 +139,29 @@ loadFork ws win glc nvg future progress = do
mmisctable3 <- createImage nvg (FileName "assets/misc/table3.png") 0 mmisctable3 <- createImage nvg (FileName "assets/misc/table3.png") 0
modifyMVar_ progress (return . (\(p, _) -> modifyMVar_ progress (return . (\(p, _) ->
( p + increment ( p + increment
, "Loading asset \"wall_table4\"" , "Loading asset \"table4\""
))) )))
mmisctable4 <- createImage nvg (FileName "assets/misc/table4.png") 0 mmisctable4 <- createImage nvg (FileName "assets/misc/table4.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"tableC1\""
)))
mmisctablec1 <- createImage nvg (FileName "assets/misc/tablec1.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"tableC2\""
)))
mmisctablec2 <- createImage nvg (FileName "assets/misc/tablec2.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"tableC3\""
)))
mmisctablec3 <- createImage nvg (FileName "assets/misc/tablec3.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"tableC4\""
)))
mmisctablec4 <- createImage nvg (FileName "assets/misc/tablec4.png") 0
modifyMVar_ progress (return . (\(p, _) -> modifyMVar_ progress (return . (\(p, _) ->
( p + increment ( p + increment
, "Loading asset \"tableCorner\"" , "Loading asset \"tableCorner\""
@ -161,6 +181,7 @@ loadFork ws win glc nvg future progress = do
mwalltne, mwalltse, mwalltsw, mwalltnw, mwallcross, mwalltne, mwalltse, mwalltsw, mwalltnw, mwallcross,
mmiscbox1, mmiscbox1,
mmisctable1, mmisctable2, mmisctable3, mmisctable4, mmisctableC, mmisctable1, mmisctable2, mmisctable3, mmisctable4, mmisctableC,
mmisctablec1, mmisctablec2, mmisctablec3, mmisctablec4,
mmiscFlipchart mmiscFlipchart
] ]
when (any isNothing mimgs) $ do when (any isNothing mimgs) $ do
@ -170,23 +191,7 @@ loadFork ws win glc nvg future progress = do
-- (zipWith (\a b -> (a, [b])) [0..] $ [ImgIntrE .. ImgIntrN] ++ [ImgIntrNE]) -- (zipWith (\a b -> (a, [b])) [0..] $ [ImgIntrE .. ImgIntrN] ++ [ImgIntrNE])
let imgs = zipWith (\a b -> (a, fromJust b)) let imgs = zipWith (\a b -> (a, fromJust b))
[ ImgWallAsc [ ImgWallAsc
, ImgWallDesc .. ImgMiscFlipchart
, ImgWallCornerN
, ImgWallCornerE
, ImgWallCornerS
, ImgWallCornerW
, ImgWallTNE
, ImgWallTSE
, ImgWallTSW
, ImgWallTNW
, ImgWallCross
, ImgMiscBox1
, ImgMiscTable1
, ImgMiscTable2
, ImgMiscTable3
, ImgMiscTable4
, ImgMiscTableCorner
, ImgMiscFlipchart
] ]
mimgs mimgs
directions = [E .. N] ++ [NE] directions = [E .. N] ++ [NE]

View file

@ -82,7 +82,7 @@ loadMapFork ud future progress = do
fc = FloorConfig fc = FloorConfig
(10, 10) (10, 10)
[(5, 5), (5, 45)] [(5, 5), (5, 45)]
(50, 50) (50, 75)
_ <- liftIO $ swapMVar progress (1 / loadSteps, "Building floor") _ <- liftIO $ swapMVar progress (1 / loadSteps, "Building floor")
(mat, gr) <- buildHallFloorIO fc progress (1 / loadSteps) (mat, gr) <- buildHallFloorIO fc progress (1 / loadSteps)
_ <- liftIO $ swapMVar progress (11 / loadSteps, "Converting to images") _ <- liftIO $ swapMVar progress (11 / loadSteps, "Converting to images")
@ -413,9 +413,9 @@ drawTile ud ctx posanims pr pc row col img =
dist = distance (V2 (fromIntegral row) (fromIntegral col)) dist = distance (V2 (fromIntegral row) (fromIntegral col))
(V2 (realToFrac pr - 1) (realToFrac pc)) / 4 (V2 (realToFrac pr - 1) (realToFrac pc)) / 4
fact = fact =
if (pr <= fromIntegral row + minimum maxrs && if isWall (fromJust img) &&
pc >= fromIntegral col + maximum mincs) && (pr <= fromIntegral row + minimum maxrs &&
isWall (fromJust img) pc >= fromIntegral col + maximum mincs)
then min 1 dist then min 1 dist
else 1 else 1
mb = maybe [] collisionObstacle img mb = maybe [] collisionObstacle img

View file

@ -22,6 +22,10 @@ data ImgId
| ImgMiscTable3 | ImgMiscTable3
| ImgMiscTable4 | ImgMiscTable4
| ImgMiscTableCorner | ImgMiscTableCorner
| ImgMiscTableC1
| ImgMiscTableC2
| ImgMiscTableC3
| ImgMiscTableC4
| ImgMiscFlipchart | ImgMiscFlipchart
-- | ImgIntrNE -- | ImgIntrNE
-- | ImgIntrE -- | ImgIntrE
@ -34,11 +38,15 @@ data ImgId
deriving (Show, Eq, Ord, Enum) deriving (Show, Eq, Ord, Enum)
isWall :: ImgId -> Bool isWall :: ImgId -> Bool
isWall ImgMiscBox1 = False isWall ImgWallAsc = True
isWall ImgMiscTable1 = False isWall ImgWallDesc = True
isWall ImgMiscTable2 = False isWall ImgWallCornerN = True
isWall ImgMiscTable3 = False isWall ImgWallCornerE = True
isWall ImgMiscTable4 = False isWall ImgWallCornerS = True
isWall ImgMiscTableCorner = False isWall ImgWallCornerW = True
isWall ImgMiscFlipchart = False isWall ImgWallTNE = True
isWall _ = True isWall ImgWallTSE = True
isWall ImgWallTSW = True
isWall ImgWallTNW = True
isWall ImgWallCross = True
isWall _ = False

View file

@ -21,6 +21,8 @@ data Cluster
| ClusterTableGroup | ClusterTableGroup
| ClusterCopier | ClusterCopier
| ClusterFlipchart | ClusterFlipchart
| ClusterConferenceTable1
| ClusterConferenceTable2
deriving (Enum, Bounded) deriving (Enum, Bounded)
clusterMat :: Cluster -> Matrix (Maybe ImgId) clusterMat :: Cluster -> Matrix (Maybe ImgId)
@ -79,6 +81,45 @@ clusterMat ClusterFlipchart =
[ [ Just ImgMiscFlipchart] [ [ Just ImgMiscFlipchart]
, [ Just ImgEmpty] , [ Just ImgEmpty]
] ]
clusterMat ClusterConferenceTable1 =
M.fromLists
[ [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTableC4, Just ImgMiscTable4, Just ImgMiscTable4
, Just ImgMiscTable4, Just ImgMiscTable4, Just ImgMiscTableC3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTable1, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTable1, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTableC1, Just ImgMiscTable2, Just ImgMiscTable2
, Just ImgMiscTable2, Just ImgMiscTable2, Just ImgMiscTableC2, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
]
clusterMat ClusterConferenceTable2 =
M.fromLists
[ [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTableC4, Just ImgMiscTable4
, Just ImgMiscTable4, Just ImgMiscTableC3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTable1, Just ImgEmpty
, Just ImgEmpty, Just ImgMiscTable3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTableC1, Just ImgMiscTable2
, Just ImgMiscTable2, Just ImgMiscTableC2, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
]
clusterRoom :: Cluster -> TileState clusterRoom :: Cluster -> TileState
clusterRoom ClusterBox1 = Offi clusterRoom ClusterBox1 = Offi
@ -90,6 +131,8 @@ clusterRoom ClusterCornerTable = Offi
clusterRoom ClusterTableGroup = Offi clusterRoom ClusterTableGroup = Offi
clusterRoom ClusterCopier = Offi clusterRoom ClusterCopier = Offi
clusterRoom ClusterFlipchart = Offi clusterRoom ClusterFlipchart = Offi
clusterRoom ClusterConferenceTable1 = Offi
clusterRoom ClusterConferenceTable2 = Offi
clusterPoints :: Cluster -> [ReachPoint] clusterPoints :: Cluster -> [ReachPoint]
clusterPoints ClusterBox1 = [] clusterPoints ClusterBox1 = []
@ -115,6 +158,28 @@ clusterPoints ClusterCopier =
clusterPoints ClusterFlipchart = clusterPoints ClusterFlipchart =
[ ReachPoint Table (V2 2 1) NW [ ReachPoint Table (V2 2 1) NW
] ]
clusterPoints ClusterConferenceTable1 =
[ ReachPoint Table (V2 1 3) SE
, ReachPoint Table (V2 1 4) SE
, ReachPoint Table (V2 1 5) SE
, ReachPoint Table (V2 1 6) SE
, ReachPoint Table (V2 3 1) NE
, ReachPoint Table (V2 3 8) SW
, ReachPoint Table (V2 4 1) NE
, ReachPoint Table (V2 4 8) SW
, ReachPoint Table (V2 6 3) NW
, ReachPoint Table (V2 6 4) NW
, ReachPoint Table (V2 6 5) NW
, ReachPoint Table (V2 6 6) NW
]
clusterPoints ClusterConferenceTable2 =
[ ReachPoint Table (V2 1 3) SE
, ReachPoint Table (V2 1 4) SE
, ReachPoint Table (V2 3 1) NE
, ReachPoint Table (V2 3 6) SW
, ReachPoint Table (V2 5 3) NW
, ReachPoint Table (V2 5 4) NW
]
instance Size Cluster where instance Size Cluster where
size c = size c =