From 79b039d8b9a5478c88f04c0012732df60df0a8a9 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 7 Feb 2016 16:16:12 +0000 Subject: [PATCH 1/2] Change ILoadScreen to take a ModData instance. --- OpenRA.Game/ModData.cs | 4 ++-- OpenRA.Mods.Cnc/CncLoadScreen.cs | 4 ++-- OpenRA.Mods.Common/LoadScreens/BlankLoadScreen.cs | 2 +- OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs | 2 +- OpenRA.Mods.Common/LoadScreens/ModChooserLoadScreen.cs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/OpenRA.Game/ModData.cs b/OpenRA.Game/ModData.cs index 3f3944baf6..caad343c15 100644 --- a/OpenRA.Game/ModData.cs +++ b/OpenRA.Game/ModData.cs @@ -53,7 +53,7 @@ namespace OpenRA if (useLoadScreen) { LoadScreen = ObjectCreator.CreateObject(Manifest.LoadScreen.Value); - LoadScreen.Init(Manifest, Manifest.LoadScreen.ToDictionary(my => my.Value)); + LoadScreen.Init(this, Manifest.LoadScreen.ToDictionary(my => my.Value)); LoadScreen.Display(); } @@ -205,7 +205,7 @@ namespace OpenRA public interface ILoadScreen : IDisposable { - void Init(Manifest m, Dictionary info); + void Init(ModData m, Dictionary info); void Display(); void StartGame(Arguments args); } diff --git a/OpenRA.Mods.Cnc/CncLoadScreen.cs b/OpenRA.Mods.Cnc/CncLoadScreen.cs index 45dcb89473..fe98a46924 100644 --- a/OpenRA.Mods.Cnc/CncLoadScreen.cs +++ b/OpenRA.Mods.Cnc/CncLoadScreen.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Cnc Rectangle bounds; Renderer r; - public override void Init(Manifest m, Dictionary info) + public override void Init(ModData modData, Dictionary info) { loadInfo = info; @@ -67,7 +67,7 @@ namespace OpenRA.Mods.Cnc brightBlock = new Sprite(sheet, new Rectangle(320, 0, 16, 35), TextureChannel.Alpha); dimBlock = new Sprite(sheet, new Rectangle(336, 0, 16, 35), TextureChannel.Alpha); - versionText = m.Mod.Version; + versionText = modData.Manifest.Mod.Version; } bool setup; diff --git a/OpenRA.Mods.Common/LoadScreens/BlankLoadScreen.cs b/OpenRA.Mods.Common/LoadScreens/BlankLoadScreen.cs index 231d3552b8..3ef8c6d62e 100644 --- a/OpenRA.Mods.Common/LoadScreens/BlankLoadScreen.cs +++ b/OpenRA.Mods.Common/LoadScreens/BlankLoadScreen.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.LoadScreens { public LaunchArguments Launch; - public virtual void Init(Manifest m, Dictionary info) { } + public virtual void Init(ModData m, Dictionary info) { } public virtual void Display() { diff --git a/OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs b/OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs index 429080f115..16f8e01dec 100644 --- a/OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs +++ b/OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs @@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.LoadScreens Sprite stripe, logo; string[] messages = { "Loading..." }; - public override void Init(Manifest m, Dictionary info) + public override void Init(ModData modData, Dictionary info) { // Avoid standard loading mechanisms so we // can display the loadscreen as early as possible diff --git a/OpenRA.Mods.Common/LoadScreens/ModChooserLoadScreen.cs b/OpenRA.Mods.Common/LoadScreens/ModChooserLoadScreen.cs index ae2287651a..b578c7713d 100644 --- a/OpenRA.Mods.Common/LoadScreens/ModChooserLoadScreen.cs +++ b/OpenRA.Mods.Common/LoadScreens/ModChooserLoadScreen.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.LoadScreens Sprite sprite; Rectangle bounds; - public void Init(Manifest m, Dictionary info) + public void Init(ModData modData, Dictionary info) { var res = Game.Renderer.Resolution; bounds = new Rectangle(0, 0, res.Width, res.Height); From f8992991f54c9e4bd283ac8ade797351352ea0e1 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 7 Feb 2016 16:18:55 +0000 Subject: [PATCH 2/2] Load the load screen images from the virtual filesystem. --- OpenRA.Mods.Cnc/CncLoadScreen.cs | 2 +- OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs | 2 +- OpenRA.Mods.Common/LoadScreens/ModChooserLoadScreen.cs | 2 +- mods/d2k/mod.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Cnc/CncLoadScreen.cs b/OpenRA.Mods.Cnc/CncLoadScreen.cs index fe98a46924..3c18eae282 100644 --- a/OpenRA.Mods.Cnc/CncLoadScreen.cs +++ b/OpenRA.Mods.Cnc/CncLoadScreen.cs @@ -42,7 +42,7 @@ namespace OpenRA.Mods.Cnc r = Game.Renderer; if (r == null) return; - using (var stream = File.OpenRead(Platform.ResolvePath(loadInfo["Image"]))) + using (var stream = modData.ModFiles.Open(info["Image"])) sheet = new Sheet(SheetType.BGRA, stream); var res = r.Resolution; diff --git a/OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs b/OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs index 16f8e01dec..d32ba40731 100644 --- a/OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs +++ b/OpenRA.Mods.Common/LoadScreens/LogoStripeLoadScreen.cs @@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.LoadScreens if (info.ContainsKey("Image")) { - using (var stream = File.OpenRead(Platform.ResolvePath(info["Image"]))) + using (var stream = modData.ModFiles.Open(info["Image"])) sheet = new Sheet(SheetType.BGRA, stream); logo = new Sprite(sheet, new Rectangle(0, 0, 256, 256), TextureChannel.Alpha); diff --git a/OpenRA.Mods.Common/LoadScreens/ModChooserLoadScreen.cs b/OpenRA.Mods.Common/LoadScreens/ModChooserLoadScreen.cs index b578c7713d..c1a0ca4ba3 100644 --- a/OpenRA.Mods.Common/LoadScreens/ModChooserLoadScreen.cs +++ b/OpenRA.Mods.Common/LoadScreens/ModChooserLoadScreen.cs @@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.LoadScreens var res = Game.Renderer.Resolution; bounds = new Rectangle(0, 0, res.Width, res.Height); - using (var stream = File.OpenRead(info["Image"])) + using (var stream = modData.ModFiles.Open(info["Image"])) { var sheet = new Sheet(SheetType.BGRA, stream); sprite = new Sprite(sheet, new Rectangle(0, 0, 1024, 480), TextureChannel.Alpha); diff --git a/mods/d2k/mod.yaml b/mods/d2k/mod.yaml index 5c6c7978d2..2eed4948b1 100644 --- a/mods/d2k/mod.yaml +++ b/mods/d2k/mod.yaml @@ -126,7 +126,7 @@ Translations: d2k:languages/english.yaml LoadScreen: LogoStripeLoadScreen - Image: d2k:uibits/loadscreen.png + Image: ./mods/d2k/uibits/loadscreen.png Text: Filling Crates..., Breeding Sandworms..., Fuelling carryalls..., Deploying harvesters..., Preparing 'thopters..., Summoning mentats... ContentInstaller: