hack in spawnpoint support
This commit is contained in:
@@ -23,4 +23,8 @@ namespace OpenRA.Editor
|
|||||||
public ResourceTypeInfo Info;
|
public ResourceTypeInfo Info;
|
||||||
public int Value;
|
public int Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WaypointTemplate
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
42
OpenRA.Editor/Form1.Designer.cs
generated
42
OpenRA.Editor/Form1.Designer.cs
generated
@@ -39,16 +39,17 @@
|
|||||||
this.actorPalette = new System.Windows.Forms.FlowLayoutPanel();
|
this.actorPalette = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||||
this.resourcePalette = new System.Windows.Forms.FlowLayoutPanel();
|
this.resourcePalette = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
this.surface1 = new OpenRA.Editor.Surface();
|
||||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||||
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
|
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
|
||||||
this.toolStripButton5 = new System.Windows.Forms.ToolStripButton();
|
this.toolStripButton5 = new System.Windows.Forms.ToolStripButton();
|
||||||
this.toolStripButton4 = new System.Windows.Forms.ToolStripButton();
|
this.toolStripButton4 = new System.Windows.Forms.ToolStripButton();
|
||||||
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||||
this.toolStripButton6 = new System.Windows.Forms.ToolStripButton();
|
this.toolStripButton6 = new System.Windows.Forms.ToolStripButton();
|
||||||
|
this.toolStripButton7 = new System.Windows.Forms.ToolStripButton();
|
||||||
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
|
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
|
||||||
this.tt = new System.Windows.Forms.ToolTip(this.components);
|
this.tt = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
|
this.folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
|
||||||
this.surface1 = new OpenRA.Editor.Surface();
|
|
||||||
this.toolStripContainer1.ContentPanel.SuspendLayout();
|
this.toolStripContainer1.ContentPanel.SuspendLayout();
|
||||||
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
|
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
|
||||||
this.toolStripContainer1.SuspendLayout();
|
this.toolStripContainer1.SuspendLayout();
|
||||||
@@ -173,6 +174,16 @@
|
|||||||
this.resourcePalette.Size = new System.Drawing.Size(171, 672);
|
this.resourcePalette.Size = new System.Drawing.Size(171, 672);
|
||||||
this.resourcePalette.TabIndex = 3;
|
this.resourcePalette.TabIndex = 3;
|
||||||
//
|
//
|
||||||
|
// 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.Name = "surface1";
|
||||||
|
this.surface1.Size = new System.Drawing.Size(783, 680);
|
||||||
|
this.surface1.TabIndex = 2;
|
||||||
|
this.surface1.Text = "surface1";
|
||||||
|
//
|
||||||
// toolStrip1
|
// toolStrip1
|
||||||
//
|
//
|
||||||
this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None;
|
this.toolStrip1.Dock = System.Windows.Forms.DockStyle.None;
|
||||||
@@ -182,10 +193,11 @@
|
|||||||
this.toolStripButton4,
|
this.toolStripButton4,
|
||||||
this.toolStripButton1,
|
this.toolStripButton1,
|
||||||
this.toolStripButton6,
|
this.toolStripButton6,
|
||||||
|
this.toolStripButton7,
|
||||||
this.toolStripButton2});
|
this.toolStripButton2});
|
||||||
this.toolStrip1.Location = new System.Drawing.Point(3, 0);
|
this.toolStrip1.Location = new System.Drawing.Point(3, 0);
|
||||||
this.toolStrip1.Name = "toolStrip1";
|
this.toolStrip1.Name = "toolStrip1";
|
||||||
this.toolStrip1.Size = new System.Drawing.Size(385, 25);
|
this.toolStrip1.Size = new System.Drawing.Size(511, 25);
|
||||||
this.toolStrip1.TabIndex = 0;
|
this.toolStrip1.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// toolStripButton3
|
// toolStripButton3
|
||||||
@@ -233,29 +245,28 @@
|
|||||||
this.toolStripButton6.Text = "Resize";
|
this.toolStripButton6.Text = "Resize";
|
||||||
this.toolStripButton6.Click += new System.EventHandler(this.ResizeClicked);
|
this.toolStripButton6.Click += new System.EventHandler(this.ResizeClicked);
|
||||||
//
|
//
|
||||||
|
// toolStripButton7
|
||||||
|
//
|
||||||
|
this.toolStripButton7.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton7.Image")));
|
||||||
|
this.toolStripButton7.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
|
this.toolStripButton7.Name = "toolStripButton7";
|
||||||
|
this.toolStripButton7.Size = new System.Drawing.Size(80, 22);
|
||||||
|
this.toolStripButton7.Text = "Properties";
|
||||||
|
this.toolStripButton7.Click += new System.EventHandler(this.PropertiesClicked);
|
||||||
|
//
|
||||||
// toolStripButton2
|
// toolStripButton2
|
||||||
//
|
//
|
||||||
this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image")));
|
this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image")));
|
||||||
this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
|
this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
this.toolStripButton2.Name = "toolStripButton2";
|
this.toolStripButton2.Name = "toolStripButton2";
|
||||||
this.toolStripButton2.Size = new System.Drawing.Size(80, 22);
|
this.toolStripButton2.Size = new System.Drawing.Size(95, 22);
|
||||||
this.toolStripButton2.Text = "Properties";
|
this.toolStripButton2.Text = "Spawnpoints";
|
||||||
this.toolStripButton2.Click += new System.EventHandler(this.PropertiesClicked);
|
this.toolStripButton2.Click += new System.EventHandler(this.SpawnPointsClicked);
|
||||||
//
|
//
|
||||||
// tt
|
// tt
|
||||||
//
|
//
|
||||||
this.tt.ShowAlways = true;
|
this.tt.ShowAlways = true;
|
||||||
//
|
//
|
||||||
// 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.Name = "surface1";
|
|
||||||
this.surface1.Size = new System.Drawing.Size(783, 680);
|
|
||||||
this.surface1.TabIndex = 2;
|
|
||||||
this.surface1.Text = "surface1";
|
|
||||||
//
|
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@@ -303,6 +314,7 @@
|
|||||||
private System.Windows.Forms.ToolStripButton toolStripButton4;
|
private System.Windows.Forms.ToolStripButton toolStripButton4;
|
||||||
private System.Windows.Forms.FolderBrowserDialog folderBrowser;
|
private System.Windows.Forms.FolderBrowserDialog folderBrowser;
|
||||||
private System.Windows.Forms.ToolStripButton toolStripButton6;
|
private System.Windows.Forms.ToolStripButton toolStripButton6;
|
||||||
|
private System.Windows.Forms.ToolStripButton toolStripButton7;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -432,5 +432,10 @@ namespace OpenRA.Editor
|
|||||||
surface1.Map.Selectable = pd.selectable.Checked;
|
surface1.Map.Selectable = pd.selectable.Checked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpawnPointsClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
surface1.SetWaypoint(new WaypointTemplate()); // hack
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -194,6 +194,21 @@
|
|||||||
xGIF4KjoGBLzY1OrF9k6OOFxnwDC4wxIMX1G0pMhgVyMNyoA13PAtS7OrJk1PrC69LUdQWxuF6IybHrX
|
xGIF4KjoGBLzY1OrF9k6OOFxnwDC4wxIMX1G0pMhgVyMNyoA13PAtS7OrJk1PrC69LUdQWxuF6IybHrX
|
||||||
LRI7JrtZdoDAo1XmbjMyD+tjSXxGcXRmnYg5ttD9QuxDhN0uUgDOmbvNTpPOJaGAo2K36cyaGZvOFIfd
|
LRI7JrtZdoDAo1XmbjMyD+tjSXxGcXRmnYg5ttD9QuxDhN0uUgDOmbvNTpPOJaGAo2K36cyaGZvOFIfd
|
||||||
KlSA8/zRh9ABIDUG+1JpAAAAAElFTkSuQmCC
|
KlSA8/zRh9ABIDUG+1JpAAAAAElFTkSuQmCC
|
||||||
|
</value>
|
||||||
|
</data>
|
||||||
|
<data name="toolStripButton7.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>
|
||||||
|
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||||
|
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIISURBVDhPpZP7S1NxGMbPPxKaXVUkMEq8IpKUCoY/hGgI
|
||||||
|
ymqkDYYXcCjDZOANURSjCNGFQUTsl4GXVMxKk62YU4fXQpaIlygHQxBRH8/zwvyaIAYe+HLgnPN8nue9
|
||||||
|
HA3nvDTq63oW/jm13XOwvPTB3DYFY5MH+bXfcN8ygfTSMSSXfESicQDxBqdYHwH29g9w2tnZ3UcguIvN
|
||||||
|
rR3417exuBJE5N1n/wfwLgXEOc38Bc6xNRHb+/y4nm49G0Bnit2zf9H6bkliE/jKuYxrd6oVgDWfjB+K
|
||||||
|
TWeKMyrGEVfowITvD9re/9ABVQrAhh0HHK+ZselMMaN/mvwtDb+aVqkA7HYIwIj3ysfluPTorJnP6Ezx
|
||||||
|
oHsD1s5ZXEktUwCOioB5f1CEPR9+wTG6iuiserTo8dkwng7HT/R+XUPF8xlcTjErAOdMcW6NW8STiwG8
|
||||||
|
7vej8oUPN/PsEv3t8Ao0TZP3T1u8uJRkUgAuSYHtO97oLxmXd5t9Ho8aPTK+GzntqNfrLm2fFoihwYOI
|
||||||
|
xGIF4KjoGBLzY1OrF9k6OOFxnwDC4wxIMX1G0pMhgVyMNyoA13PAtS7OrJk1PrC69LUdQWxuF6IybHrX
|
||||||
|
LRI7JrtZdoDAo1XmbjMyD+tjSXxGcXRmnYg5ttD9QuxDhN0uUgDOmbvNTpPOJaGAo2K36cyaGZvOFIfd
|
||||||
|
KlSA8/zRh9ABIDUG+1JpAAAAAElFTkSuQmCC
|
||||||
</value>
|
</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="toolStripButton2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="toolStripButton2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace OpenRA.Editor
|
|||||||
public BrushTemplate Brush;
|
public BrushTemplate Brush;
|
||||||
public ActorTemplate Actor;
|
public ActorTemplate Actor;
|
||||||
public ResourceTemplate Resource;
|
public ResourceTemplate Resource;
|
||||||
|
public WaypointTemplate Waypoint;
|
||||||
|
|
||||||
Dictionary<string, ActorTemplate> ActorTemplates = new Dictionary<string, ActorTemplate>();
|
Dictionary<string, ActorTemplate> ActorTemplates = new Dictionary<string, ActorTemplate>();
|
||||||
Dictionary<int, ResourceTemplate> ResourceTemplates = new Dictionary<int, ResourceTemplate>();
|
Dictionary<int, ResourceTemplate> ResourceTemplates = new Dictionary<int, ResourceTemplate>();
|
||||||
@@ -31,9 +32,10 @@ namespace OpenRA.Editor
|
|||||||
Chunks.Clear();
|
Chunks.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetBrush(BrushTemplate brush) { Actor = null; Brush = brush; Resource = null; }
|
public void SetBrush(BrushTemplate brush) { Actor = null; Brush = brush; Resource = null; Waypoint = null; }
|
||||||
public void SetActor(ActorTemplate actor) { Brush = null; Actor = actor; Resource = null; }
|
public void SetActor(ActorTemplate actor) { Brush = null; Actor = actor; Resource = null; Waypoint = null; }
|
||||||
public void SetResource(ResourceTemplate resource) { Brush = null; Actor = null; Resource = resource; }
|
public void SetResource(ResourceTemplate resource) { Brush = null; Actor = null; Resource = resource; Waypoint = null; }
|
||||||
|
public void SetWaypoint(WaypointTemplate waypoint) { Brush = null; Actor = null; Resource = null; Waypoint = waypoint; }
|
||||||
|
|
||||||
public void BindActorTemplates(IEnumerable<ActorTemplate> templates)
|
public void BindActorTemplates(IEnumerable<ActorTemplate> templates)
|
||||||
{
|
{
|
||||||
@@ -77,12 +79,8 @@ namespace OpenRA.Editor
|
|||||||
if (e.Button == MouseButtons.Right)
|
if (e.Button == MouseButtons.Right)
|
||||||
Erase();
|
Erase();
|
||||||
|
|
||||||
if (e.Button == MouseButtons.Left && Brush != null)
|
if (e.Button == MouseButtons.Left)
|
||||||
DrawWithBrush();
|
Draw();
|
||||||
if (e.Button == MouseButtons.Left && Actor != null)
|
|
||||||
DrawWithActor();
|
|
||||||
if (e.Button == MouseButtons.Left && Resource != null)
|
|
||||||
DrawWithResource();
|
|
||||||
|
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
@@ -115,11 +113,31 @@ namespace OpenRA.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wpid;
|
||||||
|
string NextWpid()
|
||||||
|
{
|
||||||
|
for (; ; )
|
||||||
|
{
|
||||||
|
var a = "wp{0}".F(wpid++);
|
||||||
|
if (!Map.Waypoints.ContainsKey(a))
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawWithWaypoint()
|
||||||
|
{
|
||||||
|
var k = Map.Waypoints.FirstOrDefault(a => a.Value == GetBrushLocation());
|
||||||
|
if (k.Key != null) Map.Waypoints.Remove(k.Key);
|
||||||
|
|
||||||
|
Map.Waypoints.Add(NextWpid(), GetBrushLocation());
|
||||||
|
}
|
||||||
|
|
||||||
void Erase()
|
void Erase()
|
||||||
{
|
{
|
||||||
Actor = null;
|
Actor = null;
|
||||||
Brush = null;
|
Brush = null;
|
||||||
Resource = null;
|
Resource = null;
|
||||||
|
Waypoint = null;
|
||||||
|
|
||||||
var key = Map.Actors.FirstOrDefault(a => a.Value.Location == GetBrushLocation());
|
var key = Map.Actors.FirstOrDefault(a => a.Value.Location == GetBrushLocation());
|
||||||
if (key.Key != null) Map.Actors.Remove(key.Key);
|
if (key.Key != null) Map.Actors.Remove(key.Key);
|
||||||
@@ -134,6 +152,17 @@ namespace OpenRA.Editor
|
|||||||
Chunks.Remove(ch);
|
Chunks.Remove(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var k = Map.Waypoints.FirstOrDefault(a => a.Value == GetBrushLocation());
|
||||||
|
if (k.Key != null) Map.Waypoints.Remove(k.Key);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Draw()
|
||||||
|
{
|
||||||
|
if (Brush != null) DrawWithBrush();
|
||||||
|
if (Actor != null) DrawWithActor();
|
||||||
|
if (Resource != null) DrawWithResource();
|
||||||
|
if (Waypoint != null) DrawWithWaypoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
@@ -178,15 +207,8 @@ namespace OpenRA.Editor
|
|||||||
{
|
{
|
||||||
base.OnMouseDown(e);
|
base.OnMouseDown(e);
|
||||||
|
|
||||||
if (e.Button == MouseButtons.Right)
|
if (e.Button == MouseButtons.Right) Erase();
|
||||||
Erase();
|
if (e.Button == MouseButtons.Left) Draw();
|
||||||
|
|
||||||
if (e.Button == MouseButtons.Left && Brush != null)
|
|
||||||
DrawWithBrush();
|
|
||||||
if (e.Button == MouseButtons.Left && Actor != null)
|
|
||||||
DrawWithActor();
|
|
||||||
if (e.Button == MouseButtons.Left && Resource != null)
|
|
||||||
DrawWithResource();
|
|
||||||
|
|
||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
@@ -289,6 +311,12 @@ namespace OpenRA.Editor
|
|||||||
foreach (var ar in Map.Actors)
|
foreach (var ar in Map.Actors)
|
||||||
DrawActor(e.Graphics, ar.Value.Location, ActorTemplates[ar.Value.Name]);
|
DrawActor(e.Graphics, ar.Value.Location, ActorTemplates[ar.Value.Name]);
|
||||||
|
|
||||||
|
foreach (var wp in Map.Waypoints)
|
||||||
|
e.Graphics.DrawRectangle(Pens.LimeGreen, new Rectangle(
|
||||||
|
24 * wp.Value.X + Offset.X + 4,
|
||||||
|
24 * wp.Value.Y + Offset.Y + 4,
|
||||||
|
16, 16));
|
||||||
|
|
||||||
if (Brush != null)
|
if (Brush != null)
|
||||||
e.Graphics.DrawImage(Brush.Bitmap,
|
e.Graphics.DrawImage(Brush.Bitmap,
|
||||||
(24 * GetBrushLocation() + Offset).ToPoint());
|
(24 * GetBrushLocation() + Offset).ToPoint());
|
||||||
@@ -300,6 +328,12 @@ namespace OpenRA.Editor
|
|||||||
e.Graphics.DrawImage(Resource.Bitmap,
|
e.Graphics.DrawImage(Resource.Bitmap,
|
||||||
(24 * GetBrushLocation() + Offset).ToPoint());
|
(24 * GetBrushLocation() + Offset).ToPoint());
|
||||||
|
|
||||||
|
if (Waypoint != null)
|
||||||
|
e.Graphics.DrawRectangle(Pens.LimeGreen, new Rectangle(
|
||||||
|
24 * GetBrushLocation().X + Offset.X + 4,
|
||||||
|
24 * GetBrushLocation().Y + Offset.Y + 4,
|
||||||
|
16, 16));
|
||||||
|
|
||||||
if (Brush == null && Actor == null && Resource == null)
|
if (Brush == null && Actor == null && Resource == null)
|
||||||
{
|
{
|
||||||
var x = Map.Actors.FirstOrDefault(a => a.Value.Location == GetBrushLocation());
|
var x = Map.Actors.FirstOrDefault(a => a.Value.Location == GetBrushLocation());
|
||||||
|
|||||||
Reference in New Issue
Block a user