prepare more cabinets

This commit is contained in:
nek0 2019-01-15 05:28:09 +01:00
parent dfd17eb973
commit 43e7a30ddc
14 changed files with 66 additions and 13 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

View file

@ -81,6 +81,7 @@ placeCluster
placeCluster imat rng bnds dim try mat rp appl =
let (pr, g1) = randomR (fst (matmin bnds) - 1, fst (matmax bnds) - 1) rng
(pc, g2) = randomR (snd (matmin bnds) - 1, snd (matmax bnds) - 1) g1
(g2_1, g2_2) = split g2
freeRoom = foldl
(\acc a -> if isNothing a then acc + 1 else acc)
0
@ -89,7 +90,7 @@ placeCluster imat rng bnds dim try mat rp appl =
(snd $ matmin bnds) (snd $ matmax bnds)
mat
) :: Int
cmat = clusterMat appl dim
cmat = clusterMat appl dim g2_2
newmat = insertMat cmat mat (pr, pc)
exits = filter
(\p -> pointType p == RoomExit && inBounds (pointCoord p) bnds)
@ -129,7 +130,7 @@ placeCluster imat rng bnds dim try mat rp appl =
mat
))
then A.log A.Debug ("no cluster placed") $
placeCluster imat g2 bnds dim (try + 1) mat rp appl
placeCluster imat g2_1 bnds dim (try + 1) mat rp appl
else if
any (`elem` (oldreaches))
(V2
@ -140,9 +141,9 @@ placeCluster imat rng bnds dim try mat rp appl =
else if
isReachable newmat [(V2 10 10, Boundaries (0, 1) (0, 1))] (oldreaches ++ reaches) exits
then A.log A.Debug ("placed cluster" ++ show appl) $
placeCluster imat g2 bnds dim (try + 1) newmat newrp appl
placeCluster imat g2_1 bnds dim (try + 1) newmat newrp appl
else A.log A.Debug ("no cluster placed") $
placeCluster imat g2 bnds dim (try + 1) mat rp appl
placeCluster imat g2_1 bnds dim (try + 1) mat rp appl
insertMat
:: Matrix (Maybe a)

View file

@ -63,7 +63,7 @@ loadFork
-> MVar (Float, T.Text)
-> IO ()
loadFork ws win glc nvg future progress = do
let stateSteps = 43
let stateSteps = 49
increment = 1 / stateSteps
SDL.glMakeCurrent win glc
modifyMVar_ progress (return . (\(p, _) ->
@ -213,14 +213,49 @@ loadFork ws win glc nvg future progress = do
mmiscVending <- createImage nvg (FileName "assets/misc/vending.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"Cabinet with Coffee machine\""
, "Loading asset \"Cabinet with Coffee machine SW\""
)))
mmiscCabCoffee <- createImage nvg (FileName "assets/cabinet/cabCoffeeSW.png") 0
mcabCoffeeSW <- createImage nvg (FileName "assets/cabinet/cabCoffeeSW.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"Cabinet with Coffee machine SE\""
)))
mcabCoffeeSE <- createImage nvg (FileName "assets/cabinet/cabCoffeeSE.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"Cabinet with sink SW\""
)))
mcabSinkSW <- createImage nvg (FileName "assets/cabinet/cabSinkSW.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"Cabinet with sink SE\""
)))
mcabSinkSE <- createImage nvg (FileName "assets/cabinet/cabSinkSE.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"Cabinet with stove SW\""
)))
mcabStoveSW <- createImage nvg (FileName "assets/cabinet/cabStoveSW.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"Cabinet with stove SE\""
)))
mcabStoveSE <- createImage nvg (FileName "assets/cabinet/cabStoveSE.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"cabinet SW\""
)))
mmiscCabinetSW <- createImage nvg (FileName "assets/cabinet/cabinetSW.png") 0
mcabinetSW <- createImage nvg (FileName "assets/cabinet/cabinetSW.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"cabinet SE\""
)))
mcabinetSE <- createImage nvg (FileName "assets/cabinet/cabinetSE.png") 0
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading asset \"cabinet corner\""
)))
mcabinetCorner <- createImage nvg (FileName "assets/cabinet/cabinetCorner.png") 0
let micons =
[ mcontrblue, mcontrgreen, marrow
]
@ -237,7 +272,10 @@ loadFork ws win glc nvg future progress = do
, mmiscFlipchart
, mmiscPlant1, mmiscPlant2
, mmiscWatercooler, mmiscVending
, mmiscCabCoffee, mmiscCabinetSW
, mcabCoffeeSW, mcabCoffeSE
, mcabSinkSW, mcabSinkSE
, mcabStoveSW, mcabStoveSE
, mcabinetSW, mcabinetSE, mcabinetCorner
]
when (any isNothing mimgs) $ do
liftIO $logIO Error "Failed to load image assets"
@ -250,7 +288,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
.. ImgCabinetSW
.. ImgCabinetCorner
]
mimgs
icons = zipWith (\a b -> (a, fromJust b))

View file

@ -99,8 +99,15 @@ instance Collidible ImgId where
collisionObstacle ImgMiscVending =
[ Boundaries (0, 2/36) (24/36, 34/36)
]
collisionObstacle ImgCabinetCoffee = collisionObstacle ImgTableSW
collisionObstacle ImgCabinetCoffeeSW = collisionObstacle ImgTableSW
collisionObstacle ImgCabinetCoffeeSE = collisionObstacle ImgTableSE
collisionObstacle ImgCabinetSinkSW = collisionObstacle ImgTableSW
collisionObstacle ImgCabinetSinkSE = collisionObstacle ImgTableSE
collisionObstacle ImgCabinetStoveSW = collisionObstacle ImgTableSW
collisionObstacle ImgCabinetStoveSE = collisionObstacle ImgTableSE
collisionObstacle ImgCabinetSW = collisionObstacle ImgTableSW
collisionObstacle ImgCabinetSE = collisionObstacle ImgTableSE
collisionObstacle ImgCabinetCorner = collisionObstacle ImgTableCorner
collisionObstacle ImgEmptyNoWalk =
[ Boundaries (0, 0) (0.99, 0.99) ]
[ Boundaries (0, 0) (1, 1) ]
collisionObstacle _ = []

View file

@ -35,8 +35,15 @@ data ImgId
| ImgMiscPlant2
| ImgMiscWatercooler
| ImgMiscVending
| ImgCabinetCoffee
| ImgCabinetCoffeeSW
| ImgCabinetCoffeeSE
| ImgCabinetSinkSW
| ImgCabinetSinkSE
| ImgCabinetStoveSW
| ImgCabinetStoveSE
| ImgCabinetSW
| ImgCabinetSE
| ImgCabinetCorner
-- | ImgIntrNE
-- | ImgIntrE
-- | ImgIntrSE