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)
-> IO ()
loadFork ws win glc nvg future progress = do
let stateSteps = 26
let stateSteps = 30
increment = 1 / stateSteps
SDL.glMakeCurrent win glc
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
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"wall_table4\""
, "Loading asset \"table4\""
)))
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, _) ->
( p + increment
, "Loading asset \"tableCorner\""
@ -161,6 +181,7 @@ loadFork ws win glc nvg future progress = do
mwalltne, mwalltse, mwalltsw, mwalltnw, mwallcross,
mmiscbox1,
mmisctable1, mmisctable2, mmisctable3, mmisctable4, mmisctableC,
mmisctablec1, mmisctablec2, mmisctablec3, mmisctablec4,
mmiscFlipchart
]
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])
let imgs = zipWith (\a b -> (a, fromJust b))
[ ImgWallAsc
, ImgWallDesc
, ImgWallCornerN
, ImgWallCornerE
, ImgWallCornerS
, ImgWallCornerW
, ImgWallTNE
, ImgWallTSE
, ImgWallTSW
, ImgWallTNW
, ImgWallCross
, ImgMiscBox1
, ImgMiscTable1
, ImgMiscTable2
, ImgMiscTable3
, ImgMiscTable4
, ImgMiscTableCorner
, ImgMiscFlipchart
.. ImgMiscFlipchart
]
mimgs
directions = [E .. N] ++ [NE]

View file

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

View file

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

View file

@ -21,6 +21,8 @@ data Cluster
| ClusterTableGroup
| ClusterCopier
| ClusterFlipchart
| ClusterConferenceTable1
| ClusterConferenceTable2
deriving (Enum, Bounded)
clusterMat :: Cluster -> Matrix (Maybe ImgId)
@ -79,6 +81,45 @@ clusterMat ClusterFlipchart =
[ [ Just ImgMiscFlipchart]
, [ 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 ClusterBox1 = Offi
@ -90,6 +131,8 @@ clusterRoom ClusterCornerTable = Offi
clusterRoom ClusterTableGroup = Offi
clusterRoom ClusterCopier = Offi
clusterRoom ClusterFlipchart = Offi
clusterRoom ClusterConferenceTable1 = Offi
clusterRoom ClusterConferenceTable2 = Offi
clusterPoints :: Cluster -> [ReachPoint]
clusterPoints ClusterBox1 = []
@ -115,6 +158,28 @@ clusterPoints ClusterCopier =
clusterPoints ClusterFlipchart =
[ 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
size c =