diff --git a/Makefile b/Makefile index 706f87adba..08505885fd 100644 --- a/Makefile +++ b/Makefile @@ -166,7 +166,7 @@ mod_ts: $(mod_ts_TARGET) editor_SRCS := $(shell find OpenRA.Editor/ -iname '*.cs') editor_TARGET = OpenRA.Editor.exe editor_KIND = winexe -editor_DEPS = $(game_TARGET) +editor_DEPS = $(game_TARGET) $(mod_common_TARGET) editor_LIBS = System.Windows.Forms.dll System.Data.dll System.Drawing.dll $(editor_DEPS) thirdparty/Eluant.dll editor_EXTRA = -resource:OpenRA.Editor.Form1.resources -resource:OpenRA.Editor.MapSelect.resources editor_FLAGS = -win32icon:OpenRA.Editor/OpenRA.Editor.Icon.ico diff --git a/OpenRA.Editor/OpenRA.Editor.csproj b/OpenRA.Editor/OpenRA.Editor.csproj index d4ddf115d0..8c6687a4a5 100644 --- a/OpenRA.Editor/OpenRA.Editor.csproj +++ b/OpenRA.Editor/OpenRA.Editor.csproj @@ -160,6 +160,10 @@ {0DFB103F-2962-400F-8C6D-E2C28CCBA633} OpenRA.Game + + {FE6C8CC0-2F07-442A-B29F-17617B3B7FC6} + OpenRA.Mods.Common + diff --git a/OpenRA.Editor/RenderUtils.cs b/OpenRA.Editor/RenderUtils.cs index a3497a882f..ca8bb84eb7 100644 --- a/OpenRA.Editor/RenderUtils.cs +++ b/OpenRA.Editor/RenderUtils.cs @@ -14,13 +14,14 @@ using System.Linq; using OpenRA.FileFormats; using OpenRA.FileSystem; using OpenRA.Graphics; +using OpenRA.Mods.Common.SpriteLoaders; using OpenRA.Traits; namespace OpenRA.Editor { static class RenderUtils { - static Bitmap RenderShp(ISpriteSource shp, IPalette p) + static Bitmap RenderShp(ShpTDSprite shp, IPalette p) { var frame = shp.Frames.First(); @@ -50,14 +51,14 @@ namespace OpenRA.Editor var image = info.Traits.Get().EditorImage(info); using (var s = GlobalFileSystem.OpenWithExts(image, tileset.Extensions)) { - var shp = new ShpReader(s); + var shp = new ShpTDSprite(s); var bitmap = RenderShp(shp, p); try { using (var s2 = GlobalFileSystem.OpenWithExts(image + "2", tileset.Extensions)) { - var shp2 = new ShpReader(s2); + var shp2 = new ShpTDSprite(s2); var roofBitmap = RenderShp(shp2, p); using (var g = System.Drawing.Graphics.FromImage(bitmap)) @@ -81,7 +82,7 @@ namespace OpenRA.Editor using (var s = GlobalFileSystem.OpenWithExts(image, exts)) { // TODO: Do this properly - var shp = new ShpReader(s) as ISpriteSource; + var shp = new ShpTDSprite(s); var frame = shp.Frames.Last(); var bitmap = new Bitmap(frame.Size.Width, frame.Size.Height, PixelFormat.Format8bppIndexed); diff --git a/OpenRA.Editor/Surface.cs b/OpenRA.Editor/Surface.cs index 20b317ee2b..10b9fffe21 100644 --- a/OpenRA.Editor/Surface.cs +++ b/OpenRA.Editor/Surface.cs @@ -274,7 +274,7 @@ namespace OpenRA.Editor var cell = new CPos(u * ChunkSize + i, v * ChunkSize + j); var tr = Map.MapTiles.Value[cell]; var tile = TileSetRenderer.Data(tr.Type); - var index = (tr.Index < tile.Count) ? tr.Index : (byte)0; + var index = (tr.Index < tile.Length) ? tr.Index : (byte)0; var rawImage = tile[index]; for (var x = 0; x < TileSetRenderer.TileSize; x++) for (var y = 0; y < TileSetRenderer.TileSize; y++) diff --git a/OpenRA.Editor/TileSetRenderer.cs b/OpenRA.Editor/TileSetRenderer.cs index ab23986121..c39b9b5cf4 100644 --- a/OpenRA.Editor/TileSetRenderer.cs +++ b/OpenRA.Editor/TileSetRenderer.cs @@ -50,7 +50,7 @@ namespace OpenRA.Editor this.TileSize = Math.Min(tileSize.Width, tileSize.Height); templates = new Dictionary(); - var spriteLoader = new SpriteLoader(tileset.Extensions, null); + var spriteLoader = new SpriteLoader(Game.modData.SpriteLoaders, tileset.Extensions, null); foreach (var t in tileset.Templates) { var allFrames = spriteLoader.LoadAllFrames(t.Value.Image); @@ -102,7 +102,7 @@ namespace OpenRA.Editor return bitmap; } - public List Data(ushort id) + public byte[][] Data(ushort id) { return templates[id]; }