Create post world load function

This commit is contained in:
2023-03-18 09:37:09 +00:00
parent d8fb7a1f99
commit 77c88f68a7
14 changed files with 80 additions and 48 deletions
+3 -7
View File
@@ -3,9 +3,7 @@ module Dodge.StartNewGame (
startSeedGame,
) where
import Data.Preload.Render
import Shader.Data
import Shader.Poke -- it would be very nice to remove/rework the poking dependencies
import Dodge.WorldLoad
import Dodge.Menu.Loading
import Dodge.Concurrent
--import Dodge.Menu.Option
@@ -30,12 +28,10 @@ startSeedGame _ i u = blockingLoad "LOADING" (startSeedGameConc i $ u ^. preload
startSeedGameConc :: Int -> PreloadData -> IO (Universe -> Maybe Universe)
startSeedGameConc seed pdata = do
w' <- generateWorldFromSeed seed
nfloorvxs <- pokeFloors (pdata ^?! renderData . textureArrayShader . _2 . vboPtr)
(w' ^. cWorld . floorTiles)
let w = w' & numberFloorVerxs .~ nfloorvxs
w <- generateWorldFromSeed (pdata ^?! renderData) seed
writeFile "saveSlot/seed" $ show seed
return $ Just
. saveWorldInSlot (LevelStartSlot 0)
. (uvScreenLayers .~ [])
. (uvWorld .~ w)
. (uvIOEffects %~ (\f uv -> ( (uvWorld . cWorld) (postWorldLoad (pdata ^?! renderData)) uv >>= f)))