diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 6bca989e9f..416d4e72b4 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -235,6 +235,9 @@ namespace OpenRA public static void HandleKeyEvent(KeyInput e) { + if (world == null) + return; + int sync = world.SyncHash(); if (Widget.HandleKeyPress(e)) diff --git a/OpenRA.Game/Graphics/SequenceProvider.cs b/OpenRA.Game/Graphics/SequenceProvider.cs index b9358ecfdc..196ccc2ee2 100644 --- a/OpenRA.Game/Graphics/SequenceProvider.cs +++ b/OpenRA.Game/Graphics/SequenceProvider.cs @@ -45,6 +45,7 @@ namespace OpenRA.Graphics static void LoadSequencesForCursor(XmlElement eCursor) { + Viewport.DrawLoadScreen(); string cursorSrc = eCursor.GetAttribute("src"); string palette = eCursor.GetAttribute("palette"); @@ -55,6 +56,7 @@ namespace OpenRA.Graphics static void LoadSequencesForUnit(XmlElement eUnit) { + Viewport.DrawLoadScreen(); string unitName = eUnit.GetAttribute("name"); try { var sequences = eUnit.SelectNodes("./sequence").OfType() diff --git a/OpenRA.Game/Graphics/Viewport.cs b/OpenRA.Game/Graphics/Viewport.cs index 852d04c2a1..3a56467d54 100644 --- a/OpenRA.Game/Graphics/Viewport.cs +++ b/OpenRA.Game/Graphics/Viewport.cs @@ -70,12 +70,35 @@ namespace OpenRA.Graphics Timer.Time( "endFrame: {0}" ); } - public static void DrawLoadScreen( Renderer r, float loadFraction ) + static string[] loadComments = new[] { "Filling Crates...", "Charging Capacitors...", "Reticulating Splines...", + "Planting Trees...", "Building Bridges...", "Aging Empires...", + "Compiling EVA...", "Constructing Pylons...", "Activating Skynet...", + "Splitting Atoms..." + }; + static Stopwatch lastLoadScreen = new Stopwatch(); + public static void DrawLoadScreen() { + // Update text at most every 0.5 seconds + if (lastLoadScreen.ElapsedTime() < 0.5) + return; + + lastLoadScreen.Reset(); + + var r = Game.Renderer; + var font = r.BoldFont; r.BeginFrame(float2.Zero); - // Do stuff + // Hardcode layout for now + WidgetUtils.FillRectWithSprite(new Rectangle(0, Renderer.Resolution.Height/2 - 64, Renderer.Resolution.Width, 128), ChromeProvider.GetImage("loadscreen", "stripe")); + var logo = ChromeProvider.GetImage("loadscreen","logo"); + var logoPos = new float2((Renderer.Resolution.Width - logo.size.X)/2,(Renderer.Resolution.Height - logo.size.Y)/2); + r.RgbaSpriteRenderer.DrawSprite(logo, logoPos); + + var text = loadComments.Random(Game.CosmeticRandom); + var textSize = font.Measure(text); + + font.DrawText(text, new float2(Renderer.Resolution.Width - textSize.X - 20, Renderer.Resolution.Height - textSize.Y - 20), Color.White); r.RgbaSpriteRenderer.Flush(); r.EndFrame(); } diff --git a/OpenRA.Game/ModData.cs b/OpenRA.Game/ModData.cs index a5f430e9ed..c006515c1f 100755 --- a/OpenRA.Game/ModData.cs +++ b/OpenRA.Game/ModData.cs @@ -31,7 +31,7 @@ namespace OpenRA FileSystem.LoadFromManifest( Manifest ); ChromeProvider.Initialize( Manifest.Chrome ); - Viewport.DrawLoadScreen(Game.Renderer, 0f); + Viewport.DrawLoadScreen(); ObjectCreator = new ObjectCreator( Manifest ); SheetBuilder = new SheetBuilder( TextureChannel.Red ); @@ -52,7 +52,7 @@ namespace OpenRA string cachedTheatre = null; public Map PrepareMap(string uid) { - Viewport.DrawLoadScreen(Game.Renderer, 0f); + Viewport.DrawLoadScreen(); if (!AvailableMaps.ContainsKey(uid)) throw new InvalidDataException("Invalid map uid: {0}".F(uid)); diff --git a/OpenRA.Mods.RA/Widgets/Delegates/IngameChromeDelegate.cs b/OpenRA.Mods.RA/Widgets/Delegates/IngameChromeDelegate.cs index 0908d165f3..77d5c8bdcd 100755 --- a/OpenRA.Mods.RA/Widgets/Delegates/IngameChromeDelegate.cs +++ b/OpenRA.Mods.RA/Widgets/Delegates/IngameChromeDelegate.cs @@ -64,7 +64,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates var postgameText = postgameBG.GetWidget("TEXT"); postgameBG.IsVisible = () => { - return Game.world.LocalPlayer.WinState != WinState.Undefined; + return Game.world.LocalPlayer != null && Game.world.LocalPlayer.WinState != WinState.Undefined; }; postgameText.GetText = () => diff --git a/mods/ra/chrome.xml b/mods/ra/chrome.xml index 1b74499780..ce0e659fd0 100644 --- a/mods/ra/chrome.xml +++ b/mods/ra/chrome.xml @@ -208,4 +208,8 @@ + + + + diff --git a/mods/ra/dialog.png b/mods/ra/dialog.png index b7047caefa..77b83b1e51 100644 Binary files a/mods/ra/dialog.png and b/mods/ra/dialog.png differ