(567dd3eb2) Wait for the splash videos to finish before continuing with loading if the loading coroutine cannot be run in a separate thread. Not an ideal solution, but better than the unbearably choppy videos. TODO: figure out a way to run the loading screen and the loading coroutine in separate threads on Mac & Linux

This commit is contained in:
Joonas Rikkonen
2019-05-16 05:47:18 +03:00
parent bb6bffe88a
commit c09df5c602
15 changed files with 355 additions and 73 deletions
+17 -5
View File
@@ -270,15 +270,17 @@ namespace Barotrauma
WaterRenderer.Instance = new WaterRenderer(base.GraphicsDevice, Content);
loadingScreenOpen = true;
TitleScreen = new LoadingScreen(GraphicsDevice);
TitleScreen.WaitForLanguageSelection = Config.ShowLanguageSelectionPrompt;
TitleScreen = new LoadingScreen(GraphicsDevice)
{
WaitForLanguageSelection = Config.ShowLanguageSelectionPrompt
};
bool canLoadInSeparateThread = false;
#if WINDOWS
canLoadInSeparateThread = true;
#endif
loadingCoroutine = CoroutineManager.StartCoroutine(Load(), "", canLoadInSeparateThread);
loadingCoroutine = CoroutineManager.StartCoroutine(Load(canLoadInSeparateThread), "", canLoadInSeparateThread);
}
private void InitUserStats()
@@ -314,7 +316,7 @@ namespace Barotrauma
}
}
private IEnumerable<object> Load()
private IEnumerable<object> Load(bool isSeparateThread)
{
if (GameSettings.VerboseLogging)
{
@@ -334,12 +336,22 @@ namespace Barotrauma
SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume);
if (Config.EnableSplashScreen)
{
var pendingSplashScreens = (TitleScreen as LoadingScreen).PendingSplashScreens;
var pendingSplashScreens = TitleScreen.PendingSplashScreens;
pendingSplashScreens?.Enqueue(new Pair<string, Point>("Content/Splash_UTG.mp4", new Point(1280, 720)));
pendingSplashScreens?.Enqueue(new Pair<string, Point>("Content/Splash_FF.mp4", new Point(1280, 720)));
pendingSplashScreens?.Enqueue(new Pair<string, Point>("Content/Splash_Daedalic.mp4", new Point(1920, 1080)));
}
//if not loading in a separate thread, wait for the splash screens to finish before continuing the loading
//otherwise the videos will look extremely choppy
if (!isSeparateThread)
{
while (TitleScreen.PlayingSplashScreen || TitleScreen.PendingSplashScreens.Count > 0)
{
yield return CoroutineStatus.Running;
}
}
GUI.Init(Window, Config.SelectedContentPackages, GraphicsDevice);
DebugConsole.Init();