added plant and reworked clusters

This commit is contained in:
nek0 2018-07-31 13:30:17 +02:00
parent 14549d8533
commit 8a474f6edd
26 changed files with 86 additions and 70 deletions

BIN
assets/misc/plant1.kra Normal file

Binary file not shown.

BIN
assets/misc/plant1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 828 B

View file

Before

Width:  |  Height:  |  Size: 515 B

After

Width:  |  Height:  |  Size: 515 B

View file

Before

Width:  |  Height:  |  Size: 510 B

After

Width:  |  Height:  |  Size: 510 B

View file

Before

Width:  |  Height:  |  Size: 516 B

After

Width:  |  Height:  |  Size: 516 B

View file

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 537 B

View file

Before

Width:  |  Height:  |  Size: 497 B

After

Width:  |  Height:  |  Size: 497 B

View file

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 450 B

View file

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 459 B

View file

Before

Width:  |  Height:  |  Size: 471 B

After

Width:  |  Height:  |  Size: 471 B

View file

Before

Width:  |  Height:  |  Size: 497 B

After

Width:  |  Height:  |  Size: 497 B

View file

@ -42,7 +42,7 @@ placeInteriorIO imat imgmat irp graph =
let applicable =
(L.sortBy (\b a -> size a `compare` size b) (
L.filter
(\a -> clusterRoom a == roomType && size a <= size bnds)
(\a -> roomType `elem` clusterRoom a && size a <= size bnds)
[minBound .. maxBound] :: [Cluster])
)
roomType = fst (head $ L.sortBy
@ -106,7 +106,7 @@ placeInteriorIO imat imgmat irp graph =
else
if (pr + nrows cmat - 1 > fst (matmax bnds) ||
pc + ncols cmat - 1 > snd (matmax bnds) ||
any (/= clusterRoom appl)
any (`notElem` clusterRoom appl)
(M.toList (M.submatrix
pr (pr + nrows cmat - 1)
pc (pc + ncols cmat - 1)

View file

@ -59,7 +59,7 @@ loadFork
-> MVar (Float, T.Text)
-> IO ()
loadFork ws win glc nvg future progress = do
let stateSteps = 30
let stateSteps = 31
increment = 1 / stateSteps
SDL.glMakeCurrent win glc
modifyMVar_ progress (return . (\(p, _) ->
@ -126,52 +126,57 @@ loadFork ws win glc nvg future progress = do
( p + increment
, "Loading asset \"table1\""
)))
mmisctable1 <- createImage nvg (FileName "assets/misc/table1.png") 0
mtable1 <- createImage nvg (FileName "assets/table/table1.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"table2\""
)))
mmisctable2 <- createImage nvg (FileName "assets/misc/table2.png") 0
mtable2 <- createImage nvg (FileName "assets/table/table2.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"table3\""
)))
mmisctable3 <- createImage nvg (FileName "assets/misc/table3.png") 0
mtable3 <- createImage nvg (FileName "assets/table/table3.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"table4\""
)))
mmisctable4 <- createImage nvg (FileName "assets/misc/table4.png") 0
mtable4 <- createImage nvg (FileName "assets/table/table4.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"tableC1\""
)))
mmisctablec1 <- createImage nvg (FileName "assets/misc/tablec1.png") 0
mtablec1 <- createImage nvg (FileName "assets/table/tablec1.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"tableC2\""
)))
mmisctablec2 <- createImage nvg (FileName "assets/misc/tablec2.png") 0
mtablec2 <- createImage nvg (FileName "assets/table/tablec2.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"tableC3\""
)))
mmisctablec3 <- createImage nvg (FileName "assets/misc/tablec3.png") 0
mtablec3 <- createImage nvg (FileName "assets/table/tablec3.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"tableC4\""
)))
mmisctablec4 <- createImage nvg (FileName "assets/misc/tablec4.png") 0
mtablec4 <- createImage nvg (FileName "assets/table/tablec4.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"tableCorner\""
)))
mmisctableC <- createImage nvg (FileName "assets/misc/tableCorner.png") 0
mtableC <- createImage nvg (FileName "assets/table/tableCorner.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"flipchart\""
)))
mmiscFlipchart <- createImage nvg (FileName "assets/misc/flipchart.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"plant1\""
)))
mmiscPlant1 <- createImage nvg (FileName "assets/misc/plant1.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading Animation \"intruder: standing\""
@ -180,9 +185,10 @@ loadFork ws win glc nvg future progress = do
mwallcornern, mwallcornere, mwallcorners, mwallcornerw,
mwalltne, mwalltse, mwalltsw, mwalltnw, mwallcross,
mmiscbox1,
mmisctable1, mmisctable2, mmisctable3, mmisctable4, mmisctableC,
mmisctablec1, mmisctablec2, mmisctablec3, mmisctablec4,
mmiscFlipchart
mtable1, mtable2, mtable3, mtable4, mtableC,
mtablec1, mtablec2, mtablec3, mtablec4,
mmiscFlipchart,
mmiscPlant1
]
when (any isNothing mimgs) $ do
liftIO $logIO Error "Failed to load image assets"
@ -191,7 +197,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
.. ImgMiscFlipchart
.. ImgMiscPlant1
]
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, 75)
(50, 50)
_ <- liftIO $ swapMVar progress (1 / loadSteps, "Building floor")
(mat, gr) <- buildHallFloorIO fc progress (1 / loadSteps)
_ <- liftIO $ swapMVar progress (11 / loadSteps, "Converting to images")
@ -99,7 +99,7 @@ loadMapFork ud future progress = do
_ <- liftIO $ swapMVar progress (13 / loadSteps, "Placing NPCs")
logIO A.Debug ("number of reachpoints: " ++ show (length rps))
let nnex = Prelude.filter (\p -> pointType p /= RoomExit) rps
npcposs <- placeNPCs inter mat rps 10 -- (length $ filter (\a -> pointType a == Table) nnex)
npcposs <- placeNPCs inter mat rps 50 -- (length $ filter (\a -> pointType a == Table) nnex)
_ <- liftIO $ swapMVar progress (14 / loadSteps, "Preparing MindMap graph")
A.logIO A.Debug $ "number of placed NPCs: " ++ show (length npcposs)
!(mmintmat, mmgraph) <- buildFloorMap . springField <$>

View file

@ -60,25 +60,28 @@ instance Collidible ImgId where
[ Boundaries (0.34, 0) (0.66, 1)
, Boundaries (0, 0.34) (1, 0.66)
]
collisionObstacle ImgMiscTable1 =
collisionObstacle ImgTable1 =
[ Boundaries (0, 0.34) (1, 1)
]
collisionObstacle ImgMiscTable2 =
collisionObstacle ImgTable2 =
[ Boundaries (0, 0) (0.63, 1)
]
collisionObstacle ImgMiscTable3 =
collisionObstacle ImgTable3 =
[ Boundaries (0, 0) (1, 0.63)
]
collisionObstacle ImgMiscTable4 =
collisionObstacle ImgTable4 =
[ Boundaries (0.34, 0) (1, 1)
]
collisionObstacle ImgMiscTableCorner =
collisionObstacle ImgTableCorner =
[ Boundaries (0, 0) (0.63, 1)
, Boundaries (0, 0.34) (1, 1)
]
collisionObstacle ImgMiscFlipchart =
[ Boundaries (0, 7/36) (18/36, 28/36)
]
collisionObstacle ImgMiscPlant1 =
[ Boundaries (9/36, 9/36) (27/36, 27/26)
]
collisionObstacle ImgEmptyNoWalk =
[ Boundaries (0, 0) (1, 1) ]
collisionObstacle _ = []

View file

@ -17,16 +17,17 @@ data ImgId
| ImgWallTNW
| ImgWallCross
| ImgMiscBox1
| ImgMiscTable1
| ImgMiscTable2
| ImgMiscTable3
| ImgMiscTable4
| ImgMiscTableCorner
| ImgMiscTableC1
| ImgMiscTableC2
| ImgMiscTableC3
| ImgMiscTableC4
| ImgTable1
| ImgTable2
| ImgTable3
| ImgTable4
| ImgTableCorner
| ImgTableC1
| ImgTableC2
| ImgTableC3
| ImgTableC4
| ImgMiscFlipchart
| ImgMiscPlant1
-- | ImgIntrNE
-- | ImgIntrE
-- | ImgIntrSE

View file

@ -23,6 +23,7 @@ data Cluster
| ClusterFlipchart
| ClusterConferenceTable1
| ClusterConferenceTable2
| ClusterPlant1
deriving (Enum, Bounded)
clusterMat :: Cluster -> Matrix (Maybe ImgId)
@ -34,41 +35,41 @@ clusterMat ClusterBox1 =
]
clusterMat ClusterTable1 =
M.fromLists
[[Just ImgEmpty, Just ImgMiscTable1]]
[[Just ImgEmpty, Just ImgTable1]]
clusterMat ClusterTable2 =
M.fromLists
[ [Just ImgMiscTable2]
[ [Just ImgTable2]
, [Just ImgEmpty]
]
clusterMat ClusterTable3 =
M.fromLists
[[Just ImgMiscTable3, Just ImgEmpty]]
[[Just ImgTable3, Just ImgEmpty]]
clusterMat ClusterTable4 =
M.fromLists
[ [Just ImgEmpty]
, [Just ImgMiscTable4]
, [Just ImgTable4]
]
clusterMat ClusterCornerTable =
M.fromLists
[ [Just ImgMiscTable2, Just ImgMiscTableCorner]
, [Just ImgEmpty, Just ImgMiscTable1]
[ [Just ImgTable2, Just ImgTableCorner]
, [Just ImgEmpty, Just ImgTable1]
]
clusterMat ClusterTableGroup =
M.fromLists
[ [ Just ImgEmpty, Just ImgMiscTable2, Just ImgMiscTableCorner
, Just ImgEmpty, Just ImgMiscTable2, Just ImgMiscTableCorner
[ [ Just ImgEmpty, Just ImgTable2, Just ImgTableCorner
, Just ImgEmpty, Just ImgTable2, Just ImgTableCorner
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable1
, Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable1
, [ Just ImgEmpty, Just ImgEmpty, Just ImgTable1
, Just ImgEmpty, Just ImgEmpty, Just ImgTable1
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
, [ Nothing, Nothing, Nothing
, Just ImgEmpty, Just ImgMiscTable2, Just ImgMiscTableCorner
, Just ImgEmpty, Just ImgTable2, Just ImgTableCorner
]
, [ Nothing, Nothing, Nothing
, Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable1
, Just ImgEmpty, Just ImgEmpty, Just ImgTable1
]
]
clusterMat ClusterCopier =
@ -86,17 +87,17 @@ clusterMat ClusterConferenceTable1 =
[ [ 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 ImgTableC4, Just ImgTable4, Just ImgTable4
, Just ImgTable4, Just ImgTable4, Just ImgTableC3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTable1, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable3, Just ImgEmpty
, [ Just ImgEmpty, Just ImgTable1, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgTable3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTable1, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgMiscTable3, Just ImgEmpty
, [ Just ImgEmpty, Just ImgTable1, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgTable3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTableC1, Just ImgMiscTable2, Just ImgMiscTable2
, Just ImgMiscTable2, Just ImgMiscTable2, Just ImgMiscTableC2, Just ImgEmpty
, [ Just ImgEmpty, Just ImgTableC1, Just ImgTable2, Just ImgTable2
, Just ImgTable2, Just ImgTable2, Just ImgTableC2, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
@ -107,32 +108,36 @@ clusterMat ClusterConferenceTable2 =
[ [ 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 ImgTableC4, Just ImgTable4
, Just ImgTable4, Just ImgTableC3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTable1, Just ImgEmpty
, Just ImgEmpty, Just ImgMiscTable3, Just ImgEmpty
, [ Just ImgEmpty, Just ImgTable1, Just ImgEmpty
, Just ImgEmpty, Just ImgTable3, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgMiscTableC1, Just ImgMiscTable2
, Just ImgMiscTable2, Just ImgMiscTableC2, Just ImgEmpty
, [ Just ImgEmpty, Just ImgTableC1, Just ImgTable2
, Just ImgTable2, Just ImgTableC2, Just ImgEmpty
]
, [ Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
, Just ImgEmpty, Just ImgEmpty, Just ImgEmpty
]
]
clusterMat ClusterPlant1 =
M.fromLists
[ [ Just ImgMiscPlant1 ] ]
clusterRoom :: Cluster -> TileState
clusterRoom ClusterBox1 = Offi
clusterRoom ClusterTable1 = Offi
clusterRoom ClusterTable2 = Offi
clusterRoom ClusterTable3 = Offi
clusterRoom ClusterTable4 = Offi
clusterRoom ClusterCornerTable = Offi
clusterRoom ClusterTableGroup = Offi
clusterRoom ClusterCopier = Offi
clusterRoom ClusterFlipchart = Offi
clusterRoom ClusterConferenceTable1 = Offi
clusterRoom ClusterConferenceTable2 = Offi
clusterRoom :: Cluster -> [TileState]
clusterRoom ClusterBox1 = [Offi]
clusterRoom ClusterTable1 = [Offi]
clusterRoom ClusterTable2 = [Offi]
clusterRoom ClusterTable3 = [Offi]
clusterRoom ClusterTable4 = [Offi]
clusterRoom ClusterCornerTable = [Offi]
clusterRoom ClusterTableGroup = [Offi]
clusterRoom ClusterCopier = [Offi]
clusterRoom ClusterFlipchart = [Offi]
clusterRoom ClusterConferenceTable1 = [Offi]
clusterRoom ClusterConferenceTable2 = [Offi]
clusterRoom ClusterPlant1 = [Offi, Hall]
clusterPoints :: Cluster -> [ReachPoint]
clusterPoints ClusterBox1 = []
@ -180,6 +185,7 @@ clusterPoints ClusterConferenceTable2 =
, ReachPoint Table (V2 5 3) NW
, ReachPoint Table (V2 5 4) NW
]
clusterPoints _ = []
instance Size Cluster where
size c =