more computers

This commit is contained in:
nek0 2019-02-09 22:39:42 +01:00
parent 795e0fc24c
commit 0d370a4f42
7 changed files with 53 additions and 20 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -63,7 +63,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 = 49 let stateSteps = 55
increment = 1 / stateSteps increment = 1 / stateSteps
SDL.glMakeCurrent win glc SDL.glMakeCurrent win glc
modifyMVar_ progress (return . (\(p, _) -> modifyMVar_ progress (return . (\(p, _) ->
@ -398,6 +398,33 @@ loadFork ws win glc nvg future progress = do
, AnimationConfig (0, 74) (64, 74) (64, 0) 4 2 APLoop , AnimationConfig (0, 74) (64, 74) (64, 0) 4 2 APLoop
) )
] ]
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading Animation \"nwComputer: off\""
)))
nwComputerOff <- loadAnimationSprites "assets/misc/tableSEComputer.png" nvg
[ ( AnimId "computer" "off" NW
, AnimationConfig (0, 0) (64, 74) (64, 0) 2 2 APLoop
)
]
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading Animation \"nwComputer: on\""
)))
nwComputerOn <- loadAnimationSprites "assets/misc/tableSEComputer.png" nvg
[ ( AnimId "computer" "on" NW
, AnimationConfig (128, 0) (64, 74) (0, 0) 1 0 APLoop
)
]
modifyMVar_ progress (return . (\(p, _) ->
( p + increment
, "Loading Animation \"nwComputer: hack\""
)))
nwComputerHack <- loadAnimationSprites "assets/misc/tableSEComputer.png" nvg
[ ( AnimId "computer" "hack" NW
, AnimationConfig (0, 74) (64, 74) (64, 0) 4 2 APLoop
)
]
modifyMVar_ progress (return . (\(p, _) -> modifyMVar_ progress (return . (\(p, _) ->
( p + increment ( p + increment
, "Loading Animation \"toilet: free\"" , "Loading Animation \"toilet: free\""
@ -438,6 +465,9 @@ loadFork ws win glc nvg future progress = do
neComputerOff ++ neComputerOff ++
neComputerOn ++ neComputerOn ++
neComputerHack ++ neComputerHack ++
nwComputerOff ++
nwComputerOn ++
nwComputerHack ++
toiletFree ++ toiletFree ++
toiletOccupied toiletOccupied
) )

View file

@ -161,7 +161,8 @@ loadMapFork ud ad future progress = do
access = case dir of access = case dir of
N -> V2 1 (-1) N -> V2 1 (-1)
NE -> V2 0 (-1) NE -> V2 0 (-1)
_ -> error "not yet defined" NW -> V2 1 0
x -> error ("computer placement " ++ show x ++ " not defined")
void $ createEntity $ newEntity void $ createEntity $ newEntity
{ pos = Just $ reachCoord - fmap fromIntegral access { pos = Just $ reachCoord - fmap fromIntegral access
, anim = Just $ AnimState (AnimId "computer" "off" dir) 0 0 , anim = Just $ AnimState (AnimId "computer" "off" dir) 0 0

View file

@ -23,7 +23,6 @@ data Cluster
| ClusterTableNW | ClusterTableNW
| ClusterTableNE | ClusterTableNE
| ClusterTableSE | ClusterTableSE
| ClusterComputerTableSW
| ClusterCornerTable | ClusterCornerTable
| ClusterTableGroup | ClusterTableGroup
| ClusterCopier | ClusterCopier
@ -45,17 +44,33 @@ clusterMatWithRPs ClusterBox1 dim _ =
] ]
, clusterPoints ClusterBox1 dim , clusterPoints ClusterBox1 dim
) )
clusterMatWithRPs ClusterTableSW dim@(h, _) _ = clusterMatWithRPs ClusterTableSW dim@(mh, _) g =
let h = min 3 mh
ps = [ ReachPoint (if p /= 1 then Table else Computer) (V2 r 1) NE 0 |
(r, p) <- zip [1..] $ map fst (tail $ foldl
(\acc@((_, fg):_) _ -> randomR (1 :: Int, 3) fg : acc)
[(0, g)]
[1..h])
]
in
( M.fromLists $ replicate h ( M.fromLists $ replicate h
[Just ImgEmpty, Just ImgTableSW] [Just ImgEmpty, Just ImgTableSW]
, clusterPoints ClusterTableSW dim , ps
) )
clusterMatWithRPs ClusterTableSE dim@(_, w) _ = clusterMatWithRPs ClusterTableSE dim@(_, mw) g =
let w = min 3 mw
ps = [ ReachPoint (if p /= 1 then Table else Computer) (V2 2 c) NW 0 |
(c, p) <- zip [1..] $ map fst (tail $ foldl
(\acc@((_, fg):_) _ -> randomR (1 :: Int, 3) fg : acc)
[(0, g)]
[1..w])
]
in
( M.fromLists $ ( M.fromLists $
[ replicate w (Just ImgTableSE) [ replicate w (Just ImgTableSE)
, replicate w (Just ImgEmpty) , replicate w (Just ImgEmpty)
] ]
, clusterPoints ClusterTableSE dim , ps
) )
clusterMatWithRPs ClusterTableNE dim@(h, _) _ = clusterMatWithRPs ClusterTableNE dim@(h, _) _ =
( M.fromLists $ replicate h ( M.fromLists $ replicate h
@ -69,12 +84,6 @@ clusterMatWithRPs ClusterTableNW dim@(_, w) _ =
] ]
, clusterPoints ClusterTableNW dim , clusterPoints ClusterTableNW dim
) )
clusterMatWithRPs ClusterComputerTableSW dim _ =
( M.fromLists [
[Just ImgEmpty, Just ImgTableSW]
]
, clusterPoints ClusterComputerTableSW dim
)
clusterMatWithRPs ClusterCornerTable dim _ = clusterMatWithRPs ClusterCornerTable dim _ =
( M.fromLists ( M.fromLists
[ [Just ImgTableSE, Just ImgTableCorner] [ [Just ImgTableSE, Just ImgTableCorner]
@ -228,7 +237,6 @@ clusterRoom ClusterTableSW = [Offi]
clusterRoom ClusterTableNW = [Offi] clusterRoom ClusterTableNW = [Offi]
clusterRoom ClusterTableNE = [Offi] clusterRoom ClusterTableNE = [Offi]
clusterRoom ClusterTableSE = [Offi] clusterRoom ClusterTableSE = [Offi]
clusterRoom ClusterComputerTableSW = [Offi]
clusterRoom ClusterCornerTable = [Offi] clusterRoom ClusterCornerTable = [Offi]
clusterRoom ClusterTableGroup = [Offi] clusterRoom ClusterTableGroup = [Offi]
clusterRoom ClusterCopier = [Offi] clusterRoom ClusterCopier = [Offi]
@ -247,12 +255,6 @@ clusterPoints ClusterTableNE (h, _) =
[ ReachPoint Table (V2 r 2) SW 0 | r <- [1..h] ] [ ReachPoint Table (V2 r 2) SW 0 | r <- [1..h] ]
clusterPoints ClusterTableNW (_, w) = clusterPoints ClusterTableNW (_, w) =
[ ReachPoint Table (V2 1 c) SE 0 | c <- [1..w] ] [ ReachPoint Table (V2 1 c) SE 0 | c <- [1..w] ]
clusterPoints ClusterTableSW (h, _) =
[ ReachPoint Table (V2 r 1) NE 0 | r <- [1..h] ]
clusterPoints ClusterTableSE (_, w) =
[ ReachPoint Table (V2 2 c) NW 0 | c <- [1..w] ]
clusterPoints ClusterComputerTableSW _ =
[ ReachPoint Computer (V2 1 1) NE 0 ]
clusterPoints ClusterCornerTable _ = clusterPoints ClusterCornerTable _ =
[ ReachPoint Computer (V2 2 1) N 0 [ ReachPoint Computer (V2 2 1) N 0
] ]