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

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

View file

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

View file

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

View file

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