diff --git a/OpenRA.Editor/Form1.Designer.cs b/OpenRA.Editor/Form1.Designer.cs
new file mode 100644
index 0000000000..7443aba42e
--- /dev/null
+++ b/OpenRA.Editor/Form1.Designer.cs
@@ -0,0 +1,124 @@
+namespace OpenRA.Editor
+{
+ partial class Form1
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.tilePalette = new System.Windows.Forms.FlowLayoutPanel();
+ this.surface1 = new OpenRA.Editor.Surface();
+ this.tt = new System.Windows.Forms.ToolTip(this.components);
+ this.toolStripContainer1.ContentPanel.SuspendLayout();
+ this.toolStripContainer1.SuspendLayout();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // toolStripContainer1
+ //
+ //
+ // toolStripContainer1.ContentPanel
+ //
+ this.toolStripContainer1.ContentPanel.Controls.Add(this.splitContainer1);
+ this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(985, 680);
+ this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.toolStripContainer1.Location = new System.Drawing.Point(0, 0);
+ this.toolStripContainer1.Name = "toolStripContainer1";
+ this.toolStripContainer1.Size = new System.Drawing.Size(985, 705);
+ this.toolStripContainer1.TabIndex = 1;
+ this.toolStripContainer1.Text = "toolStripContainer1";
+ //
+ // splitContainer1
+ //
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer1.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer1.Name = "splitContainer1";
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.tilePalette);
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(this.surface1);
+ this.splitContainer1.Size = new System.Drawing.Size(985, 680);
+ this.splitContainer1.SplitterDistance = 198;
+ this.splitContainer1.TabIndex = 0;
+ //
+ // tilePalette
+ //
+ this.tilePalette.AutoScroll = true;
+ this.tilePalette.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tilePalette.Location = new System.Drawing.Point(0, 0);
+ this.tilePalette.Name = "tilePalette";
+ this.tilePalette.Size = new System.Drawing.Size(198, 680);
+ this.tilePalette.TabIndex = 0;
+ //
+ // surface1
+ //
+ this.surface1.BackColor = System.Drawing.Color.Black;
+ this.surface1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.surface1.Location = new System.Drawing.Point(0, 0);
+ this.surface1.Map = null;
+ this.surface1.Name = "surface1";
+ this.surface1.Size = new System.Drawing.Size(783, 680);
+ this.surface1.TabIndex = 2;
+ this.surface1.Text = "surface1";
+ this.surface1.TileSet = null;
+ //
+ // Form1
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(985, 705);
+ this.Controls.Add(this.toolStripContainer1);
+ this.Name = "Form1";
+ this.Text = "OpenRA Editor";
+ this.toolStripContainer1.ContentPanel.ResumeLayout(false);
+ this.toolStripContainer1.ResumeLayout(false);
+ this.toolStripContainer1.PerformLayout();
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ this.splitContainer1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ToolStripContainer toolStripContainer1;
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private Surface surface1;
+ private System.Windows.Forms.FlowLayoutPanel tilePalette;
+ private System.Windows.Forms.ToolTip tt;
+
+ }
+}
+
diff --git a/OpenRA.Editor/Form1.cs b/OpenRA.Editor/Form1.cs
new file mode 100644
index 0000000000..98c869de99
--- /dev/null
+++ b/OpenRA.Editor/Form1.cs
@@ -0,0 +1,95 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using OpenRA.FileFormats;
+using System.IO;
+
+namespace OpenRA.Editor
+{
+ public partial class Form1 : Form
+ {
+ public Form1()
+ {
+ InitializeComponent();
+ LocateGameRoot();
+
+ var mods = new[] { "ra" };
+
+ var manifest = new Manifest(mods);
+
+ foreach (var folder in manifest.Folders) FileSystem.Mount(folder);
+ foreach (var pkg in manifest.Packages) FileSystem.Mount(pkg);
+
+ // load the map
+ var map = new Map(new Folder("mods/ra/maps/mjolnir"));
+
+ // we're also going to need a tileset...
+ var tsinfo = fileMapping[Pair.New(mods[0], map.Theater)];
+ var tileset = new TileSet("tileset.til", "templates.ini", tsinfo.First);
+
+ var palette = new Palette( FileSystem.Open( map.Theater.ToLowerInvariant() + ".pal" ), true);
+
+ surface1.TileSet = tileset;
+ surface1.Map = map;
+
+ // construct the palette of tiles
+
+ foreach( var n in tileset.tiles.Keys )
+ {
+ try
+ {
+ var bitmap = RenderTemplate(tileset, (ushort)n, palette);
+ var ibox = new PictureBox { Image = bitmap, Width = bitmap.Width, Height = bitmap.Height };
+ tilePalette.Controls.Add(ibox);
+ }
+ catch { }
+ }
+ }
+
+ void LocateGameRoot()
+ {
+ while (!Directory.Exists("mods"))
+ {
+ var current = Directory.GetCurrentDirectory();
+ if (Directory.GetDirectoryRoot(current) == current)
+ throw new InvalidOperationException("Unable to find game root.");
+ Directory.SetCurrentDirectory("..");
+ }
+ }
+
+ static Dictionary, Pair> fileMapping = new Dictionary, Pair>()
+ {
+ {Pair.New("ra","TEMPERAT"),Pair.New("tem","temperat.col")},
+ {Pair.New("ra","SNOW"),Pair.New("sno","snow.col")},
+ {Pair.New("ra","INTERIOR"),Pair.New("int","temperat.col")},
+ {Pair.New("cnc","DESERT"),Pair.New("des","desert.col")},
+ {Pair.New("cnc","TEMPERAT"),Pair.New("tem","temperat.col")},
+ {Pair.New("cnc","WINTER"),Pair.New("win","winter.col")},
+ };
+
+ static Bitmap RenderTemplate(TileSet ts, ushort n, Palette p)
+ {
+ var template = ts.walk[n];
+ var tile = ts.tiles[n];
+
+ var bitmap = new Bitmap(Surface.CellSize * template.Size.X, Surface.CellSize * template.Size.Y);
+
+ for( var u = 0; u < template.Size.X; u++ )
+ for( var v = 0; v < template.Size.Y; v++ )
+ if (template.TerrainType.ContainsKey(u + v * template.Size.X))
+ {
+ var rawImage = tile.TileBitmapBytes[u + v * template.Size.X];
+ for (var i = 0; i < 24; i++)
+ for (var j = 0; j < 24; j++)
+ bitmap.SetPixel(u * 24 + i, v * 24 + j, p.GetColor(rawImage[i + 24 * j]));
+ }
+
+ return bitmap;
+ }
+ }
+}
diff --git a/OpenRA.Editor/Form1.resx b/OpenRA.Editor/Form1.resx
new file mode 100644
index 0000000000..f5bbc6f282
--- /dev/null
+++ b/OpenRA.Editor/Form1.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/OpenRA.Editor/OpenRA.Editor.csproj b/OpenRA.Editor/OpenRA.Editor.csproj
new file mode 100644
index 0000000000..694899b568
--- /dev/null
+++ b/OpenRA.Editor/OpenRA.Editor.csproj
@@ -0,0 +1,98 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {00038B75-405B-44F5-8691-BD2546DBE224}
+ WinExe
+ Properties
+ OpenRA.Editor
+ OpenRA.Editor
+ v3.5
+ 512
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ Form1.cs
+
+
+
+
+ Form1.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+ Component
+
+
+
+
+ {BDAEAB25-991E-46A7-AF1E-4F0E03358DAA}
+ OpenRA.FileFormats
+
+
+
+
+
\ No newline at end of file
diff --git a/OpenRA.Editor/Program.cs b/OpenRA.Editor/Program.cs
new file mode 100644
index 0000000000..950192b52f
--- /dev/null
+++ b/OpenRA.Editor/Program.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+
+namespace OpenRA.Editor
+{
+ static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new Form1());
+ }
+ }
+}
diff --git a/OpenRA.Editor/Properties/AssemblyInfo.cs b/OpenRA.Editor/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..d92b6eb6e5
--- /dev/null
+++ b/OpenRA.Editor/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("OpenRA.Editor")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("OpenRA.Editor")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("e18ea68f-f344-46c9-b026-8bda76fa91f8")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenRA.Editor/Properties/Resources.Designer.cs b/OpenRA.Editor/Properties/Resources.Designer.cs
new file mode 100644
index 0000000000..6a878cefe0
--- /dev/null
+++ b/OpenRA.Editor/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace OpenRA.Editor.Properties
+{
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenRA.Editor.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/OpenRA.Editor/Properties/Resources.resx b/OpenRA.Editor/Properties/Resources.resx
new file mode 100644
index 0000000000..ffecec851a
--- /dev/null
+++ b/OpenRA.Editor/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/OpenRA.Editor/Properties/Settings.Designer.cs b/OpenRA.Editor/Properties/Settings.Designer.cs
new file mode 100644
index 0000000000..3f36e0bd0e
--- /dev/null
+++ b/OpenRA.Editor/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4927
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace OpenRA.Editor.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/OpenRA.Editor/Properties/Settings.settings b/OpenRA.Editor/Properties/Settings.settings
new file mode 100644
index 0000000000..abf36c5d3d
--- /dev/null
+++ b/OpenRA.Editor/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/OpenRA.Editor/Surface.cs b/OpenRA.Editor/Surface.cs
new file mode 100644
index 0000000000..5ee7b9ff4b
--- /dev/null
+++ b/OpenRA.Editor/Surface.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using OpenRA.FileFormats;
+using System.Drawing;
+
+namespace OpenRA.Editor
+{
+ class Surface : Control
+ {
+ public Map Map { get; set; }
+ public TileSet TileSet { get; set; }
+ public int2 Offset { get; set; }
+
+ public Surface()
+ : base()
+ {
+ BackColor = Color.Black;
+
+ SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
+ SetStyle(ControlStyles.ResizeRedraw, true);
+ UpdateStyles();
+ }
+
+ public const int CellSize = 24;
+ static readonly Pen RedPen = new Pen(Color.Red);
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ if (Map == null) return;
+ if (TileSet == null) return;
+
+ var n = (ushort)14;
+
+ var template = TileSet.walk[n];
+ var tile = TileSet.tiles[n];
+
+ for( var u = 0; u < template.Size.X; u++ )
+ for( var v = 0; v < template.Size.Y; v++ )
+ if (template.TerrainType.ContainsKey(u + v * template.Size.X))
+ {
+ e.Graphics.DrawRectangle(RedPen, new Rectangle(CellSize * u, CellSize * v, CellSize, CellSize));
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/OpenRA.sln b/OpenRA.sln
index a89c060e0a..4955cd8d22 100644
--- a/OpenRA.sln
+++ b/OpenRA.sln
@@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Gl", "OpenRA.Gl\Open
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MapConverter", "MapConverter\MapConverter.csproj", "{BA2B4C61-D5EE-4C3E-9BA1-EB32C531FA36}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Editor", "OpenRA.Editor\OpenRA.Editor.csproj", "{00038B75-405B-44F5-8691-BD2546DBE224}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -88,6 +90,14 @@ Global
{BA2B4C61-D5EE-4C3E-9BA1-EB32C531FA36}.Release|Any CPU.Build.0 = Release|Any CPU
{BA2B4C61-D5EE-4C3E-9BA1-EB32C531FA36}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{BA2B4C61-D5EE-4C3E-9BA1-EB32C531FA36}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {00038B75-405B-44F5-8691-BD2546DBE224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {00038B75-405B-44F5-8691-BD2546DBE224}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {00038B75-405B-44F5-8691-BD2546DBE224}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {00038B75-405B-44F5-8691-BD2546DBE224}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {00038B75-405B-44F5-8691-BD2546DBE224}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {00038B75-405B-44F5-8691-BD2546DBE224}.Release|Any CPU.Build.0 = Release|Any CPU
+ {00038B75-405B-44F5-8691-BD2546DBE224}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {00038B75-405B-44F5-8691-BD2546DBE224}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE