Add text messages on loading screens
This commit is contained in:
+8
-17
@@ -1,13 +1,9 @@
|
|||||||
module Main (
|
module Main (main) where
|
||||||
main,
|
|
||||||
) where
|
|
||||||
|
|
||||||
import Dodge.StartNewGame
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Control.Parallel
|
import Control.Parallel
|
||||||
import qualified Data.Map.Strict as M
|
import qualified Data.Map.Strict as M
|
||||||
--import Data.Preload.Render
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Dodge.Concurrent
|
import Dodge.Concurrent
|
||||||
import Dodge.Config
|
import Dodge.Config
|
||||||
@@ -15,25 +11,19 @@ import Dodge.Data
|
|||||||
import Dodge.Event
|
import Dodge.Event
|
||||||
import Dodge.Initialisation
|
import Dodge.Initialisation
|
||||||
import Dodge.LoadSeed
|
import Dodge.LoadSeed
|
||||||
--import Dodge.Menu
|
|
||||||
import Dodge.Render
|
import Dodge.Render
|
||||||
import Dodge.SoundLogic.LoadSound
|
import Dodge.SoundLogic.LoadSound
|
||||||
|
import Dodge.StartNewGame
|
||||||
import Dodge.TestString
|
import Dodge.TestString
|
||||||
import Dodge.Update
|
import Dodge.Update
|
||||||
--import qualified IntMapHelp as IM
|
|
||||||
import Loop
|
import Loop
|
||||||
--import Picture
|
|
||||||
import Preload
|
import Preload
|
||||||
import Preload.Render
|
import Preload.Render
|
||||||
--import Render
|
|
||||||
|
|
||||||
import SDL (($=))
|
import SDL (($=))
|
||||||
import qualified SDL
|
import qualified SDL
|
||||||
--import qualified SDL.Mixer as Mix
|
|
||||||
import Sound
|
import Sound
|
||||||
import System.Directory
|
import System.Directory
|
||||||
|
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
-- load the config to get the window size and position
|
-- load the config to get the window size and position
|
||||||
@@ -112,7 +102,8 @@ theUpdateStep win = doSideEffects <=< updateRenderSplit win
|
|||||||
|
|
||||||
updateRenderSplit :: SDL.Window -> Universe -> IO Universe
|
updateRenderSplit :: SDL.Window -> Universe -> IO Universe
|
||||||
updateRenderSplit win u = do
|
updateRenderSplit win u = do
|
||||||
updateUniverse u `par` void (doDrawing win u)
|
--updateUniverse u `par` void (doDrawing win u)
|
||||||
|
updateUniverse u `par` doDrawing win u
|
||||||
return $! updateUniverse u
|
return $! updateUniverse u
|
||||||
|
|
||||||
playSoundUnlessRewinding :: Universe -> IO (M.Map SoundOrigin Sound)
|
playSoundUnlessRewinding :: Universe -> IO (M.Map SoundOrigin Sound)
|
||||||
@@ -144,13 +135,13 @@ doPreload = do
|
|||||||
putStrLn "Start sound preload"
|
putStrLn "Start sound preload"
|
||||||
lChunks <- loadSounds
|
lChunks <- loadSounds
|
||||||
putStrLn "Skip music preload!"
|
putStrLn "Skip music preload!"
|
||||||
-- lMusic <- loadMusic
|
-- lMusic <- loadMusic
|
||||||
-- Mix.playMusic Mix.Forever (lMusic IM.! 0)
|
-- Mix.playMusic Mix.Forever (lMusic IM.! 0)
|
||||||
putStrLn "Return PreloadData"
|
putStrLn "Return PreloadData"
|
||||||
return
|
return
|
||||||
PreloadData
|
PreloadData
|
||||||
{ _renderData = rData
|
{ _renderData = rData
|
||||||
, _soundData = lChunks
|
, _soundData = lChunks
|
||||||
--, _musicData = MusicData{_loadedMusic = lMusic}
|
, --, _musicData = MusicData{_loadedMusic = lMusic}
|
||||||
, _musicData = mempty
|
_musicData = mempty
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
The cortical interface is an incredible interdisciplinary breakthrough
|
||||||
|
in neurophysiology and computer science.
|
||||||
|
It allows clients to directly receive information transmitted wirelessly.
|
||||||
|
We expect this to allow for better, faster learning, allowing
|
||||||
|
humans to reach unheard of levels of knowledge and ability.
|
||||||
|
|
||||||
|
Non-human animal trials did not appear to reduce lifespans significantly.
|
||||||
|
Human trials are now in progress.
|
||||||
|
|
||||||
|
I hate the way the interface just dumps information on you.
|
||||||
|
The way time just seems to stop...
|
||||||
|
makes me feel sick.
|
||||||
|
|
||||||
|
I heard @name downloaded War and Peace,
|
||||||
|
but didn't expect it to be in russian.
|
||||||
|
Took him a week to recover.
|
||||||
|
|
||||||
|
What's the deal with the cortical interface?
|
||||||
|
So, like, what happens if I constantly request info dumps?
|
||||||
|
Does that mean I live forever?
|
||||||
|
|
||||||
|
Temporal distortion is a common side effect when using the cortical interface.
|
||||||
|
Information is processed near instantaneously, causing other
|
||||||
|
external events to appear paused.
|
||||||
|
|
||||||
|
The cortical interface has some neat uses.
|
||||||
|
I set up a timer to remind me of our anniversary.
|
||||||
|
It's great, the AI even suggested the perfect present!
|
||||||
|
|
||||||
|
Mood disorders.
|
||||||
|
|
||||||
|
Anxiety.
|
||||||
|
|
||||||
|
Epilepsy.
|
||||||
|
|
||||||
|
Dizzyness, nauseau, tinitus.
|
||||||
|
|
||||||
|
Autism.
|
||||||
|
|
||||||
|
Schizoprenia.
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
Something has gone wrong.
|
||||||
|
|
||||||
|
My last memory is entering the reconstitution scanner.
|
||||||
|
Though experimental,
|
||||||
|
this techology theoretically allows for perfect duplication.
|
||||||
|
But there are strict rules, this would only happen if my old body is...
|
||||||
|
non-functional.
|
||||||
|
|
||||||
|
Hopefully I can take better care of this one.
|
||||||
+4
-15
@@ -32,9 +32,10 @@ addSideEffect f s = uvSideEffects %~ (|> NewSideEffect f s)
|
|||||||
hardQuit :: Universe -> Universe
|
hardQuit :: Universe -> Universe
|
||||||
hardQuit = uvSideEffects %~ (HardQuit <|)
|
hardQuit = uvSideEffects %~ (HardQuit <|)
|
||||||
|
|
||||||
blockingLoad :: String -> IO (Universe -> Maybe Universe) -> Universe -> Universe
|
blockingLoad
|
||||||
blockingLoad str f u =
|
:: [String] -> String -> IO (Universe -> Maybe Universe) -> Universe -> Universe
|
||||||
u & uvScreenLayers .:~ loadingScreen str
|
blockingLoad p str f u =
|
||||||
|
u & uvScreenLayers .:~ LoadingScreen p LoadWaiting
|
||||||
& addSideEffect f str
|
& addSideEffect f str
|
||||||
|
|
||||||
--hardQuit = addSideEffect (return $ const Nothing) "QUITTING"
|
--hardQuit = addSideEffect (return $ const Nothing) "QUITTING"
|
||||||
@@ -53,15 +54,3 @@ blockingLoad str f u =
|
|||||||
-- f <- eff
|
-- f <- eff
|
||||||
-- return (f . (uvConcEffects .~ NoConcEffect))
|
-- return (f . (uvConcEffects .~ NoConcEffect))
|
||||||
|
|
||||||
loadingScreen :: String -> ScreenLayer
|
|
||||||
loadingScreen str =
|
|
||||||
OptionScreen
|
|
||||||
{ _scTitle = str
|
|
||||||
, _scOptions = mempty
|
|
||||||
, _scOffset = 0
|
|
||||||
, _scPositionedMenuOption = NoExtraMenuOption
|
|
||||||
, _scOptionFlag = LoadingScreen
|
|
||||||
, _scSelectionList = mempty
|
|
||||||
, _scAvailableLines = 0
|
|
||||||
, _scDisplayTime = 0
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ data PSType
|
|||||||
| PutMachine
|
| PutMachine
|
||||||
{ _putMachinePoly :: [Point2]
|
{ _putMachinePoly :: [Point2]
|
||||||
, _putMachineMachine :: Machine
|
, _putMachineMachine :: Machine
|
||||||
-- , _putMachineWall :: Wall
|
|
||||||
, _putMachineMaybeItem :: Maybe Item
|
, _putMachineMaybeItem :: Maybe Item
|
||||||
}
|
}
|
||||||
| PutLS LightSource
|
| PutLS LightSource
|
||||||
|
|||||||
+26
-13
@@ -11,20 +11,21 @@ module Dodge.Data.Universe (
|
|||||||
module Loop.Data,
|
module Loop.Data,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import qualified Data.IntMap.Strict as IM
|
|
||||||
import Geometry.Data
|
|
||||||
import Sound.Data
|
|
||||||
import qualified Data.Map.Strict as M
|
|
||||||
import GHC.Word (Word32)
|
|
||||||
import Dodge.Data.SelectionList
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
import qualified Data.IntMap.Strict as IM
|
||||||
|
import qualified Data.Map.Strict as M
|
||||||
--import qualified Data.Map.Strict as M
|
--import qualified Data.Map.Strict as M
|
||||||
import Data.Preload
|
import Data.Preload
|
||||||
import Data.Sequence (Seq (..))
|
import Data.Sequence (Seq (..))
|
||||||
import Dodge.Data.Config
|
import Dodge.Data.Config
|
||||||
|
import Dodge.Data.SelectionList
|
||||||
import Dodge.Data.World
|
import Dodge.Data.World
|
||||||
|
import GHC.Word (Word32)
|
||||||
|
import Geometry.Data
|
||||||
import Loop.Data
|
import Loop.Data
|
||||||
import Picture.Data
|
import Picture.Data
|
||||||
|
import Sound.Data
|
||||||
|
|
||||||
--import SDL (Scancode)
|
--import SDL (Scancode)
|
||||||
|
|
||||||
data Universe = Universe
|
data Universe = Universe
|
||||||
@@ -54,7 +55,7 @@ data Universe = Universe
|
|||||||
data PathShowType
|
data PathShowType
|
||||||
= PathBetweenLeftRightClick
|
= PathBetweenLeftRightClick
|
||||||
| PathBetweenDebugV2s
|
| PathBetweenDebugV2s
|
||||||
deriving (Show,Eq,Ord,Enum,Bounded)
|
deriving (Show, Eq, Ord, Enum, Bounded)
|
||||||
|
|
||||||
data DebugItem = DebugItem
|
data DebugItem = DebugItem
|
||||||
{ _debugMessage :: String
|
{ _debugMessage :: String
|
||||||
@@ -69,13 +70,15 @@ data SideEffect
|
|||||||
| RunningSideEffect {_ceString :: String}
|
| RunningSideEffect {_ceString :: String}
|
||||||
| HardQuit
|
| HardQuit
|
||||||
|
|
||||||
data OptionScreenFlag = NormalOptions | GameOverOptions | SplashOptions
|
data OptionScreenFlag
|
||||||
| LoadingScreen
|
= NormalOptions
|
||||||
|
| GameOverOptions
|
||||||
|
| SplashOptions
|
||||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|
||||||
data ExtraMenuOption
|
data ExtraMenuOption
|
||||||
= BottomMenuOption { _emoMenuOption :: MenuOption }
|
= BottomMenuOption {_emoMenuOption :: MenuOption}
|
||||||
| TopMenuOption { _emoMenuOption :: MenuOption }
|
| TopMenuOption {_emoMenuOption :: MenuOption}
|
||||||
| NoExtraMenuOption
|
| NoExtraMenuOption
|
||||||
|
|
||||||
data ScreenLayer
|
data ScreenLayer
|
||||||
@@ -85,11 +88,21 @@ data ScreenLayer
|
|||||||
, _scOffset :: Int
|
, _scOffset :: Int
|
||||||
, _scPositionedMenuOption :: ExtraMenuOption
|
, _scPositionedMenuOption :: ExtraMenuOption
|
||||||
, _scOptionFlag :: OptionScreenFlag
|
, _scOptionFlag :: OptionScreenFlag
|
||||||
, _scSelectionList :: [SelectionItem (Universe -> Universe,Universe->Universe)]
|
, _scSelectionList :: [SelectionItem (Universe -> Universe, Universe -> Universe)]
|
||||||
, _scAvailableLines :: Int
|
, _scAvailableLines :: Int
|
||||||
, _scDisplayTime :: Int
|
, _scDisplayTime :: Int
|
||||||
}
|
}
|
||||||
| InputScreen { _scInput :: String }
|
| InputScreen {_scInput :: String}
|
||||||
|
| LoadingScreen
|
||||||
|
{ _scPara :: [String]
|
||||||
|
, _scBlockStatus :: BlockStatus
|
||||||
|
}
|
||||||
|
|
||||||
|
data BlockStatus
|
||||||
|
= LoadWaitingClicked
|
||||||
|
| LoadWaiting
|
||||||
|
| LoadReady
|
||||||
|
deriving (Show)
|
||||||
|
|
||||||
data MenuOptionDisplay
|
data MenuOptionDisplay
|
||||||
= MODString {_modString :: String}
|
= MODString {_modString :: String}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ module Dodge.Data.World (
|
|||||||
module Dodge.Data.Input,
|
module Dodge.Data.Input,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Color.Data
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
import NewInt
|
import NewInt
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
@@ -81,6 +82,10 @@ data TimeFlowStatus
|
|||||||
{ _timeFlowCharge :: Int
|
{ _timeFlowCharge :: Int
|
||||||
, _scrollItemID :: NewInt ItmInt
|
, _scrollItemID :: NewInt ItmInt
|
||||||
}
|
}
|
||||||
|
| PauseTimeMessage
|
||||||
|
{ _pauseTimeMesage :: String
|
||||||
|
, _pauseTimeMesageColor :: Color
|
||||||
|
}
|
||||||
|
|
||||||
makeLenses ''TimeFlowStatus
|
makeLenses ''TimeFlowStatus
|
||||||
makeLenses ''World
|
makeLenses ''World
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import qualified IntMapHelp as IM
|
|||||||
import Dodge.SpawnAt
|
import Dodge.SpawnAt
|
||||||
|
|
||||||
splashScreen :: World
|
splashScreen :: World
|
||||||
splashScreen =
|
splashScreen = defaultWorld & cWorld . lWorld . creatures .~ IM.fromList [(0, startCr)]
|
||||||
defaultWorld
|
|
||||||
& cWorld . lWorld . creatures .~ IM.fromList [(0, startCr)]
|
|
||||||
|
|
||||||
initialWorld :: World
|
initialWorld :: World
|
||||||
initialWorld = respawn defaultWorld
|
initialWorld = respawn defaultWorld
|
||||||
|
|||||||
@@ -28,5 +28,5 @@ analyserWithPrompt l pst pslight psmc = extTrigLitPos pslight $ \tp ->
|
|||||||
themachine =
|
themachine =
|
||||||
defaultMachine & mcColor .~ aquamarine
|
defaultMachine & mcColor .~ aquamarine
|
||||||
& mcType .~ McTerminal
|
& mcType .~ McTerminal
|
||||||
& mcHP .~ 100
|
& mcHP .~ 10000
|
||||||
& mcType .~ McProxSensor (ProxSensor pst Nothing)
|
& mcType .~ McProxSensor (ProxSensor pst Nothing)
|
||||||
|
|||||||
+5
-5
@@ -201,10 +201,10 @@ doDrawing' win pdata u = do
|
|||||||
|
|
||||||
--setup downscale viewport for blurring bloom
|
--setup downscale viewport for blurring bloom
|
||||||
setViewport _gr_downsize_res cfig
|
setViewport _gr_downsize_res cfig
|
||||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboHalf pdata)))
|
glBindFramebuffer GL_FRAMEBUFFER $ pdata ^. fboHalf . _1 . unFBO
|
||||||
glDepthFunc GL_ALWAYS
|
glDepthFunc GL_ALWAYS
|
||||||
glBindTextureUnit 0 (pdata ^. fboBloom . _2 . unTO)
|
|
||||||
glGenerateTextureMipmap (pdata ^. fboBloom . _2 . unTO)
|
glGenerateTextureMipmap (pdata ^. fboBloom . _2 . unTO)
|
||||||
|
glBindTextureUnit 0 (pdata ^. fboBloom . _2 . unTO)
|
||||||
glDisable GL_BLEND
|
glDisable GL_BLEND
|
||||||
-- this all needs more tuning + more thought
|
-- this all needs more tuning + more thought
|
||||||
-- a fade effect would be cool, so not to fully reset last frames bloom
|
-- a fade effect would be cool, so not to fully reset last frames bloom
|
||||||
@@ -398,7 +398,8 @@ doDrawing' win pdata u = do
|
|||||||
glDrawArrays GL_TRIANGLES 0 6
|
glDrawArrays GL_TRIANGLES 0 6
|
||||||
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||||
-- draw the overlay
|
-- draw the overlay
|
||||||
glDepthFunc GL_ALWAYS
|
glDepthFunc GL_LEQUAL
|
||||||
|
--glDepthFunc GL_ALWAYS
|
||||||
glDepthMask GL_FALSE
|
glDepthMask GL_FALSE
|
||||||
glEnable GL_BLEND
|
glEnable GL_BLEND
|
||||||
--glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
--glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||||
@@ -406,9 +407,8 @@ doDrawing' win pdata u = do
|
|||||||
renderLayer DebugLayer shadV pokeCounts
|
renderLayer DebugLayer shadV pokeCounts
|
||||||
withArray (scaleMatrix (2 / windowXFloat cfig) (2 / windowYFloat cfig)) $
|
withArray (scaleMatrix (2 / windowXFloat cfig) (2 / windowYFloat cfig)) $
|
||||||
glNamedBufferSubData (pdata ^. matUBO) 0 64
|
glNamedBufferSubData (pdata ^. matUBO) 0 64
|
||||||
glDepthFunc GL_GEQUAL
|
|
||||||
glDepthMask GL_TRUE
|
glDepthMask GL_TRUE
|
||||||
with (-1) $ glClearNamedFramebufferfv 0 GL_DEPTH 0
|
with 1 $ glClearNamedFramebufferfv 0 GL_DEPTH 0
|
||||||
renderLayer FixedCoordLayer shadV pokeCounts
|
renderLayer FixedCoordLayer shadV pokeCounts
|
||||||
checkGLError "during doDrawing'"
|
checkGLError "during doDrawing'"
|
||||||
SDL.glSwapWindow win
|
SDL.glSwapWindow win
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
{-# LANGUAGE LambdaCase #-}
|
{-# LANGUAGE LambdaCase #-}
|
||||||
module Dodge.Render.MenuScreen (drawMenuScreen) where
|
module Dodge.Render.MenuScreen (drawMenuScreen) where
|
||||||
|
|
||||||
|
import Geometry.Polygon
|
||||||
|
import Linear
|
||||||
|
import Dodge.Data.ScreenPos
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Dodge.Base.Window
|
import Dodge.Base.Window
|
||||||
import Dodge.Data.CardinalPoint
|
import Dodge.Data.CardinalPoint
|
||||||
@@ -15,6 +18,15 @@ drawMenuScreen :: Maybe Int -> ScreenLayer -> Config -> Picture
|
|||||||
drawMenuScreen mi = \case
|
drawMenuScreen mi = \case
|
||||||
OptionScreen{_scTitle = s, _scSelectionList = l} -> drawOptions s mi l
|
OptionScreen{_scTitle = s, _scSelectionList = l} -> drawOptions s mi l
|
||||||
InputScreen inputstr -> drawInputMenu ('>' : inputstr)
|
InputScreen inputstr -> drawInputMenu ('>' : inputstr)
|
||||||
|
LoadingScreen ss t -> drawLoadingScreen ss t
|
||||||
|
|
||||||
|
drawLoadingScreen :: [String] -> BlockStatus -> Config -> Picture
|
||||||
|
drawLoadingScreen s _ cfig =
|
||||||
|
polygon (rectWH (fromIntegral (cfig ^.windowX)) (fromIntegral (cfig ^. windowY))) <>
|
||||||
|
translateScreenPos cfig
|
||||||
|
(ScreenPos (V2 0 0.2) (V2 (-300) (10 * fromIntegral (length s))))
|
||||||
|
(drawList $ map text s -- <> [text $ show t])
|
||||||
|
)
|
||||||
|
|
||||||
drawInputMenu :: String -> Config -> Picture
|
drawInputMenu :: String -> Config -> Picture
|
||||||
drawInputMenu s cf = darkenBackground cf <> drawTitle cf s
|
drawInputMenu s cf = darkenBackground cf <> drawTitle cf s
|
||||||
|
|||||||
@@ -263,8 +263,8 @@ tutHub = do
|
|||||||
=<< roomNgon 6 100
|
=<< roomNgon 6 100
|
||||||
bcor <- treeAttachDeep (return door) <$> blockedCorridor
|
bcor <- treeAttachDeep (return door) <$> blockedCorridor
|
||||||
--bcor <- treeAttachDeep (return door) <$> return (return $ cleatOnward door)
|
--bcor <- treeAttachDeep (return door) <$> return (return $ cleatOnward door)
|
||||||
r1 <- r burstRifle <&> rmPmnts .:~ t
|
r1 <- r burstRifle <&> rmPmnts .:~ itemshiftterminal
|
||||||
r2 <- r (drumMag & itConsumables ?~ 90)
|
r2 <- ammoroom (drumMag & itConsumables ?~ 90) -- <&> rmPmnts .:~ tutorialterminal
|
||||||
--r2 <- r (tinMag & itConsumables ?~ 500)
|
--r2 <- r (tinMag & itConsumables ?~ 500)
|
||||||
return $
|
return $
|
||||||
tToBTree "DoorTest" $
|
tToBTree "DoorTest" $
|
||||||
@@ -290,7 +290,8 @@ tutHub = do
|
|||||||
, makeTermLine ""
|
, makeTermLine ""
|
||||||
]
|
]
|
||||||
r x = roomRectAutoLinks 100 100 <&> rmPmnts .:~ sps (PS 50 0) (PutFlIt x)
|
r x = roomRectAutoLinks 100 100 <&> rmPmnts .:~ sps (PS 50 0) (PutFlIt x)
|
||||||
t =
|
ammoroom x = roomRectAutoLinks 100 100 <&> rmPmnts .:~ sps (PS 50 0) (PutFlIt x)
|
||||||
|
itemshiftterminal =
|
||||||
putMessageTerminal
|
putMessageTerminal
|
||||||
terminalColor
|
terminalColor
|
||||||
(defaultTerminal & tmBootLines .~ ss' <> tlSetStatus (TerminalPressTo "QUIT") <> tlDoEffect TmWdWdPowerDownTerminal)
|
(defaultTerminal & tmBootLines .~ ss' <> tlSetStatus (TerminalPressTo "QUIT") <> tlDoEffect TmWdWdPowerDownTerminal)
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ reloadLevelStart :: Universe -> Universe
|
|||||||
reloadLevelStart = loadSaveSlot (LevelStartSlot 0)
|
reloadLevelStart = loadSaveSlot (LevelStartSlot 0)
|
||||||
|
|
||||||
loadSaveSlot :: SaveSlot -> Universe -> Universe
|
loadSaveSlot :: SaveSlot -> Universe -> Universe
|
||||||
loadSaveSlot slot = blockingLoad ("DESERIALISING " ++ show slot) $ readSaveSlot slot
|
loadSaveSlot slot = blockingLoad [] ("DESERIALISING " ++ show slot) $ readSaveSlot slot
|
||||||
|
|
||||||
doQuicksave :: Universe -> Universe
|
doQuicksave :: Universe -> Universe
|
||||||
doQuicksave u =
|
doQuicksave u =
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ import Dodge.Data.Universe
|
|||||||
import Dodge.LevelGen
|
import Dodge.LevelGen
|
||||||
import Dodge.Save
|
import Dodge.Save
|
||||||
import Dodge.WorldLoad
|
import Dodge.WorldLoad
|
||||||
|
import Justify
|
||||||
import LensHelp
|
import LensHelp
|
||||||
import System.Random
|
|
||||||
import System.Directory
|
import System.Directory
|
||||||
|
import System.Random
|
||||||
|
|
||||||
startNewGameInSlot :: Int -> Universe -> Universe
|
startNewGameInSlot :: Int -> Universe -> Universe
|
||||||
startNewGameInSlot slot u = startSeedGame slot i u
|
startNewGameInSlot slot u = startSeedGame slot i u
|
||||||
@@ -20,10 +21,28 @@ startNewGameInSlot slot u = startSeedGame slot i u
|
|||||||
startSeedGame :: Int -> Int -> Universe -> Universe
|
startSeedGame :: Int -> Int -> Universe -> Universe
|
||||||
startSeedGame _ i u =
|
startSeedGame _ i u =
|
||||||
blockingLoad
|
blockingLoad
|
||||||
|
startPara
|
||||||
("GENERATING FROM SEED " ++ show i)
|
("GENERATING FROM SEED " ++ show i)
|
||||||
(startSeedGameConc i $ u ^. preloadData)
|
(startSeedGameConc i $ u ^. preloadData)
|
||||||
u
|
u
|
||||||
|
|
||||||
|
startPara :: [String]
|
||||||
|
startPara =
|
||||||
|
[ "Something has gone wrong."
|
||||||
|
, ""
|
||||||
|
, ""
|
||||||
|
, ""
|
||||||
|
]
|
||||||
|
<> makeParagraph
|
||||||
|
55
|
||||||
|
( "My last memory is the reconstitution scan. "
|
||||||
|
<> "Though experimental, this techology allows for perfect duplication. "
|
||||||
|
<> "At least in theory, "
|
||||||
|
<> "it hasn't been tested on humans. "
|
||||||
|
<> "I'd only be duplicated if my original body was... non-functional."
|
||||||
|
)
|
||||||
|
<> ["", "","", "Hopefully I can take better care of this one."]
|
||||||
|
|
||||||
startSeedGameConc :: Int -> PreloadData -> IO (Universe -> Maybe Universe)
|
startSeedGameConc :: Int -> PreloadData -> IO (Universe -> Maybe Universe)
|
||||||
startSeedGameConc seed pdata = do
|
startSeedGameConc seed pdata = do
|
||||||
w <- generateWorldFromSeed (pdata ^?! renderData) seed
|
w <- generateWorldFromSeed (pdata ^?! renderData) seed
|
||||||
@@ -32,6 +51,11 @@ startSeedGameConc seed pdata = do
|
|||||||
return $
|
return $
|
||||||
Just
|
Just
|
||||||
. saveWorldInSlot (LevelStartSlot 0)
|
. saveWorldInSlot (LevelStartSlot 0)
|
||||||
. (uvScreenLayers .~ [])
|
. maybeClearLoadingScreen
|
||||||
. (uvWorld .~ w)
|
. (uvWorld .~ w)
|
||||||
. postUniverseLoadSideEffect
|
. postUniverseLoadSideEffect
|
||||||
|
|
||||||
|
maybeClearLoadingScreen :: Universe -> Universe
|
||||||
|
maybeClearLoadingScreen u = case u ^? uvScreenLayers . ix 0 . scBlockStatus of
|
||||||
|
Just LoadWaitingClicked -> u & uvScreenLayers .~ []
|
||||||
|
_ -> u & uvScreenLayers . ix 0 . scBlockStatus .~ LoadReady
|
||||||
|
|||||||
@@ -32,12 +32,7 @@ import Data.Foldable
|
|||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
|
|
||||||
testStringInit :: Universe -> [String]
|
testStringInit :: Universe -> [String]
|
||||||
testStringInit u = [ show (u ^. uvConfig . windowX)
|
testStringInit _ = []
|
||||||
, show (u ^. uvConfig . windowY)
|
|
||||||
,show $ fmap (
|
|
||||||
worldPosToScreen (u ^. uvWorld . wCam) )
|
|
||||||
$ u ^? uvWorld . cWorld . lWorld . creatures . ix 0 . crPos . _xy
|
|
||||||
]
|
|
||||||
-- [show $ foldMap (foldMap (Sum . length . (^. seObstacles)))
|
-- [show $ foldMap (foldMap (Sum . length . (^. seObstacles)))
|
||||||
-- $ u ^. uvWorld . cWorld . incGraph]
|
-- $ u ^. uvWorld . cWorld . incGraph]
|
||||||
-- foldMap prettyShort $ u ^? uvWorld . cWorld . lWorld . machines . ix 0 . mcType . _McProxSensor
|
-- foldMap prettyShort $ u ^? uvWorld . cWorld . lWorld . machines . ix 0 . mcType . _McProxSensor
|
||||||
@@ -81,3 +76,4 @@ showTimeFlow tfs = case tfs of
|
|||||||
CameraScrollTimeFlow {_reverseAmount = ra } -> "CameraScrollTimeFlow" ++ show ra
|
CameraScrollTimeFlow {_reverseAmount = ra } -> "CameraScrollTimeFlow" ++ show ra
|
||||||
RewindLeftClick {_reverseAmount = ra } -> "RewindLeftClick" ++ show ra
|
RewindLeftClick {_reverseAmount = ra } -> "RewindLeftClick" ++ show ra
|
||||||
PausedTimeFlow {_timeFlowCharge = ra } -> "PausedTimeFlow" ++ show ra
|
PausedTimeFlow {_timeFlowCharge = ra } -> "PausedTimeFlow" ++ show ra
|
||||||
|
PauseTimeMessage {} -> "PausedTimeMessage"
|
||||||
|
|||||||
+2
-2
@@ -136,7 +136,7 @@ openConsole = \case
|
|||||||
updateUniverseLast :: Universe -> Universe
|
updateUniverseLast :: Universe -> Universe
|
||||||
updateUniverseLast u =
|
updateUniverseLast u =
|
||||||
u
|
u
|
||||||
& over (uvWorld . input . textInput) (const mempty)
|
& uvWorld . input . textInput .~ mempty
|
||||||
& maybeOpenConsole
|
& maybeOpenConsole
|
||||||
& advanceScrollAmount
|
& advanceScrollAmount
|
||||||
& updateWorldEventFlags
|
& updateWorldEventFlags
|
||||||
@@ -155,7 +155,6 @@ updateUniverseLast u =
|
|||||||
{- For most menus the only way to change the world is using event handling. -}
|
{- For most menus the only way to change the world is using event handling. -}
|
||||||
updateUniverseMid :: Universe -> Universe
|
updateUniverseMid :: Universe -> Universe
|
||||||
updateUniverseMid u = case _uvScreenLayers u of
|
updateUniverseMid u = case _uvScreenLayers u of
|
||||||
(OptionScreen{_scOptionFlag = LoadingScreen} : _) -> u
|
|
||||||
(sl : _) -> u & uvWorld . unpauseClock .~ 0 & updateUseInputOnScreen sl
|
(sl : _) -> u & uvWorld . unpauseClock .~ 0 & updateUseInputOnScreen sl
|
||||||
[] ->
|
[] ->
|
||||||
(uvWorld . unpauseClock +~ 1)
|
(uvWorld . unpauseClock +~ 1)
|
||||||
@@ -178,6 +177,7 @@ timeFlowUpdate u = case u ^. uvWorld . timeFlow of
|
|||||||
RewindLeftClick _ _ -> over uvWorld scrollTimeBack u
|
RewindLeftClick _ _ -> over uvWorld scrollTimeBack u
|
||||||
RespawnDelay{} -> functionalUpdate u
|
RespawnDelay{} -> functionalUpdate u
|
||||||
PausedTimeFlow _ itmloc -> over uvWorld (pauseTime itmloc) u
|
PausedTimeFlow _ itmloc -> over uvWorld (pauseTime itmloc) u
|
||||||
|
PauseTimeMessage {} -> u
|
||||||
|
|
||||||
pauseTime :: NewInt ItmInt -> World -> World
|
pauseTime :: NewInt ItmInt -> World -> World
|
||||||
pauseTime _ w
|
pauseTime _ w
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE LambdaCase #-}
|
||||||
module Dodge.Update.Input.ScreenLayer (
|
module Dodge.Update.Input.ScreenLayer (
|
||||||
updateUseInputOnScreen,
|
updateUseInputOnScreen,
|
||||||
ldpSelection,
|
ldpSelection,
|
||||||
@@ -21,9 +22,18 @@ import Linear
|
|||||||
import SDL
|
import SDL
|
||||||
|
|
||||||
updateUseInputOnScreen :: ScreenLayer -> Universe -> Universe
|
updateUseInputOnScreen :: ScreenLayer -> Universe -> Universe
|
||||||
updateUseInputOnScreen sl = case sl of
|
updateUseInputOnScreen = \case
|
||||||
InputScreen{} -> doInputScreenInput (sl ^. scInput)
|
InputScreen{_scInput = s} -> doInputScreenInput s
|
||||||
_ -> optionScreenUpdate
|
OptionScreen{} -> optionScreenUpdate
|
||||||
|
LoadingScreen{} -> loadingScreenUpdate
|
||||||
|
|
||||||
|
loadingScreenUpdate :: Universe -> Universe
|
||||||
|
loadingScreenUpdate u
|
||||||
|
| isJust $ u ^. uvWorld . input . pressedKeys . at ScancodeSpace
|
||||||
|
= case u ^? uvScreenLayers . ix 0 . scBlockStatus of
|
||||||
|
Just LoadReady -> u & uvScreenLayers .~ []
|
||||||
|
_ -> u & uvScreenLayers . ix 0 . scBlockStatus .~ LoadWaitingClicked
|
||||||
|
| otherwise = u
|
||||||
|
|
||||||
doInputScreenInput :: String -> Universe -> Universe
|
doInputScreenInput :: String -> Universe -> Universe
|
||||||
doInputScreenInput s u =
|
doInputScreenInput s u =
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ damageWall wlid dt w = fromMaybe (mempty,w) $ do
|
|||||||
MachinePart mcid -> (,) mempty
|
MachinePart mcid -> (,) mempty
|
||||||
$ w' & cWorld . lWorld . machines . ix mcid . mcDamage .:~ dt
|
$ w' & cWorld . lWorld . machines . ix mcid . mcDamage .:~ dt
|
||||||
BlockPart blid ->
|
BlockPart blid ->
|
||||||
w' & damageBlock (wl ^. wlMaterial) dmam blid -- cWorld . lWorld . blocks . ix blid . blHP -~ dmam
|
w' & damageBlock (wl ^. wlMaterial) dmam blid
|
||||||
-- & maybeDestroyBlock blid
|
|
||||||
DoorPart drid _ ->
|
DoorPart drid _ ->
|
||||||
w' & cWorld . lWorld . doors . ix drid . drHP -~ dmam
|
w' & cWorld . lWorld . doors . ix drid . drHP -~ dmam
|
||||||
& maybeDestroyDoor drid
|
& maybeDestroyDoor drid
|
||||||
|
|||||||
+2
-1
@@ -242,7 +242,8 @@ doConLoop' ::
|
|||||||
-- | Current simulation state.
|
-- | Current simulation state.
|
||||||
world ->
|
world ->
|
||||||
IO ()
|
IO ()
|
||||||
doConLoop' themvar spf window coneffs worldSideEffects eventFn !startWorld = go startWorld
|
--doConLoop' themvar spf window coneffs worldSideEffects eventFn !startWorld = go startWorld
|
||||||
|
doConLoop' themvar spf window coneffs worldSideEffects eventFn = go
|
||||||
where
|
where
|
||||||
worldSideEffectsWindow = worldSideEffects window
|
worldSideEffectsWindow = worldSideEffects window
|
||||||
go sw = do
|
go sw = do
|
||||||
|
|||||||
Reference in New Issue
Block a user