smoother game start
This commit is contained in:
parent
49aba30955
commit
687d5f5b58
1 changed files with 10 additions and 14 deletions
|
@ -200,12 +200,6 @@ loadMapFork ud ad future progress = do
|
||||||
( p + increment
|
( p + increment
|
||||||
, "Registering NPCs into WorldState"
|
, "Registering NPCs into WorldState"
|
||||||
)))
|
)))
|
||||||
-- posbounds <- efor allEnts $ do
|
|
||||||
-- with pos
|
|
||||||
-- with obstacle
|
|
||||||
-- pos' <- query pos
|
|
||||||
-- bnds <- query obstacle
|
|
||||||
-- return (pos', bnds)
|
|
||||||
mapM_ (\crp -> do
|
mapM_ (\crp -> do
|
||||||
fact <- liftIO $ randomRIO (0.5, 1.5)
|
fact <- liftIO $ randomRIO (0.5, 1.5)
|
||||||
-- fut <- liftIO newEmptyMVar
|
-- fut <- liftIO newEmptyMVar
|
||||||
|
@ -234,16 +228,15 @@ loadMapFork ud ad future progress = do
|
||||||
)))
|
)))
|
||||||
return mmimgmat
|
return mmimgmat
|
||||||
)) ad
|
)) ad
|
||||||
-- nstate <- evalStateT
|
let retMat = M.fromList (nrows inter) (ncols inter) $
|
||||||
-- (runState $ yieldSystemT nws (updateNPCs mmimgmat nws rps 0)) ad
|
|
||||||
putMVar future (nws, MainData
|
|
||||||
{ mapMat = mat
|
|
||||||
, imgMat = M.fromList (nrows inter) (ncols inter) $
|
|
||||||
Prelude.map
|
Prelude.map
|
||||||
(\a -> if a == Just ImgEmpty || a == Just ImgEmptyNoWalk
|
(\a -> if a == Just ImgEmpty || a == Just ImgEmptyNoWalk
|
||||||
then Nothing
|
then Nothing
|
||||||
else a)
|
else a)
|
||||||
(M.toList inter)
|
(M.toList inter)
|
||||||
|
putMVar future (nws, MainData
|
||||||
|
{ mapMat = mat
|
||||||
|
, imgMat = retMat
|
||||||
, reachPoints = rps
|
, reachPoints = rps
|
||||||
, mmImgMat = mmimgmat
|
, mmImgMat = mmimgmat
|
||||||
})
|
})
|
||||||
|
@ -527,15 +520,18 @@ drawTile ud ctx posanims pr pc row col img =
|
||||||
updateMap :: Double -> Affection UserData ()
|
updateMap :: Double -> Affection UserData ()
|
||||||
updateMap dt = do
|
updateMap dt = do
|
||||||
ud <- getAffection
|
ud <- getAffection
|
||||||
isFut <- liftIO $ isEmptyMVar (stateMVar ud)
|
if stateData ud == None
|
||||||
if not isFut && stateData ud == None
|
|
||||||
then do
|
then do
|
||||||
liftIO $ logIO A.Debug "Loaded game data"
|
liftIO $ logIO A.Debug "Loaded game data"
|
||||||
Just (nws, mendat) <- liftIO $ tryTakeMVar (stateMVar ud)
|
(nws, mendat) <- liftIO $ takeMVar (stateMVar ud)
|
||||||
putAffection ud
|
putAffection ud
|
||||||
{ worldState = nws
|
{ worldState = nws
|
||||||
, stateData = mendat
|
, stateData = mendat
|
||||||
}
|
}
|
||||||
|
updateMap 0.1
|
||||||
|
updateMap 0.1
|
||||||
|
updateMap 0.1
|
||||||
|
updateMap 19
|
||||||
else do
|
else do
|
||||||
(nws, _) <- yieldSystemT (worldState ud) $ do
|
(nws, _) <- yieldSystemT (worldState ud) $ do
|
||||||
emap allEnts $ do
|
emap allEnts $ do
|
||||||
|
|
Loading…
Reference in a new issue