fix trailing whitespace everywhere
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Editor
|
||||
|
||||
public void Preview(Surface surface, SGraphics g)
|
||||
{
|
||||
/* todo: include the player
|
||||
/* todo: include the player
|
||||
* in the brush so we can color new buildings too */
|
||||
|
||||
surface.DrawActor(g, surface.GetBrushLocation(), Actor, null);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
18
OpenRA.Editor/ErrorListDialog.Designer.cs
generated
18
OpenRA.Editor/ErrorListDialog.Designer.cs
generated
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -42,9 +42,9 @@ namespace OpenRA.Editor
|
||||
this.listBox1 = new System.Windows.Forms.ListBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
//
|
||||
// label1
|
||||
//
|
||||
//
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label1.Location = new System.Drawing.Point(10, 9);
|
||||
@@ -52,9 +52,9 @@ namespace OpenRA.Editor
|
||||
this.label1.Size = new System.Drawing.Size(610, 23);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Your map import completed, but with errors:";
|
||||
//
|
||||
//
|
||||
// listBox1
|
||||
//
|
||||
//
|
||||
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
@@ -63,9 +63,9 @@ namespace OpenRA.Editor
|
||||
this.listBox1.Name = "listBox1";
|
||||
this.listBox1.Size = new System.Drawing.Size(607, 316);
|
||||
this.listBox1.TabIndex = 1;
|
||||
//
|
||||
//
|
||||
// button1
|
||||
//
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.button1.Location = new System.Drawing.Point(545, 359);
|
||||
@@ -74,9 +74,9 @@ namespace OpenRA.Editor
|
||||
this.button1.TabIndex = 2;
|
||||
this.button1.Text = "Close";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// ErrorListDialog
|
||||
//
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(632, 394);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
186
OpenRA.Editor/Form1.Designer.cs
generated
186
OpenRA.Editor/Form1.Designer.cs
generated
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -96,44 +96,44 @@ namespace OpenRA.Editor
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
//
|
||||
// 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.splitContainer2);
|
||||
//
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.surface1);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(985, 744);
|
||||
this.splitContainer1.SplitterDistance = 198;
|
||||
this.splitContainer1.TabIndex = 0;
|
||||
//
|
||||
//
|
||||
// splitContainer2
|
||||
//
|
||||
//
|
||||
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer2.Name = "splitContainer2";
|
||||
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
//
|
||||
// splitContainer2.Panel1
|
||||
//
|
||||
//
|
||||
this.splitContainer2.Panel1.Controls.Add(this.pmMiniMap);
|
||||
//
|
||||
//
|
||||
// splitContainer2.Panel2
|
||||
//
|
||||
//
|
||||
this.splitContainer2.Panel2.Controls.Add(this.tabControl1);
|
||||
this.splitContainer2.Size = new System.Drawing.Size(198, 744);
|
||||
this.splitContainer2.SplitterDistance = 164;
|
||||
this.splitContainer2.TabIndex = 1;
|
||||
//
|
||||
//
|
||||
// pmMiniMap
|
||||
//
|
||||
//
|
||||
this.pmMiniMap.BackColor = System.Drawing.Color.Black;
|
||||
this.pmMiniMap.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.pmMiniMap.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
@@ -143,9 +143,9 @@ namespace OpenRA.Editor
|
||||
this.pmMiniMap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.pmMiniMap.TabIndex = 1;
|
||||
this.pmMiniMap.TabStop = false;
|
||||
//
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
//
|
||||
this.tabControl1.Controls.Add(this.tabPage1);
|
||||
this.tabControl1.Controls.Add(this.tabPage2);
|
||||
this.tabControl1.Controls.Add(this.tabPage3);
|
||||
@@ -158,9 +158,9 @@ namespace OpenRA.Editor
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(198, 576);
|
||||
this.tabControl1.TabIndex = 0;
|
||||
//
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.tilePalette);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 20);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
@@ -169,9 +169,9 @@ namespace OpenRA.Editor
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "Templates";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// tilePalette
|
||||
//
|
||||
//
|
||||
this.tilePalette.AutoScroll = true;
|
||||
this.tilePalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tilePalette.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
@@ -179,9 +179,9 @@ namespace OpenRA.Editor
|
||||
this.tilePalette.Name = "tilePalette";
|
||||
this.tilePalette.Size = new System.Drawing.Size(184, 546);
|
||||
this.tilePalette.TabIndex = 1;
|
||||
//
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.actorPalette);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 20);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
@@ -190,9 +190,9 @@ namespace OpenRA.Editor
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "Actors";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// actorPalette
|
||||
//
|
||||
//
|
||||
this.actorPalette.AutoScroll = true;
|
||||
this.actorPalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.actorPalette.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
@@ -200,9 +200,9 @@ namespace OpenRA.Editor
|
||||
this.actorPalette.Name = "actorPalette";
|
||||
this.actorPalette.Size = new System.Drawing.Size(184, 546);
|
||||
this.actorPalette.TabIndex = 2;
|
||||
//
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.resourcePalette);
|
||||
this.tabPage3.Location = new System.Drawing.Point(4, 20);
|
||||
this.tabPage3.Name = "tabPage3";
|
||||
@@ -210,9 +210,9 @@ namespace OpenRA.Editor
|
||||
this.tabPage3.TabIndex = 2;
|
||||
this.tabPage3.Text = "Resources";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// resourcePalette
|
||||
//
|
||||
//
|
||||
this.resourcePalette.AutoScroll = true;
|
||||
this.resourcePalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.resourcePalette.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
@@ -220,9 +220,9 @@ namespace OpenRA.Editor
|
||||
this.resourcePalette.Name = "resourcePalette";
|
||||
this.resourcePalette.Size = new System.Drawing.Size(190, 552);
|
||||
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);
|
||||
@@ -230,39 +230,39 @@ namespace OpenRA.Editor
|
||||
this.surface1.Size = new System.Drawing.Size(783, 744);
|
||||
this.surface1.TabIndex = 5;
|
||||
this.surface1.Text = "surface1";
|
||||
//
|
||||
//
|
||||
// tt
|
||||
//
|
||||
//
|
||||
this.tt.ShowAlways = true;
|
||||
//
|
||||
//
|
||||
// saveFileDialog
|
||||
//
|
||||
//
|
||||
this.saveFileDialog.DefaultExt = "*.png";
|
||||
this.saveFileDialog.Filter = "PNG Image (*.png)|";
|
||||
this.saveFileDialog.Title = "Export minimap to PNG";
|
||||
//
|
||||
//
|
||||
// splitContainer3
|
||||
//
|
||||
//
|
||||
this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
|
||||
this.splitContainer3.IsSplitterFixed = true;
|
||||
this.splitContainer3.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer3.Name = "splitContainer3";
|
||||
this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
//
|
||||
// splitContainer3.Panel1
|
||||
//
|
||||
//
|
||||
this.splitContainer3.Panel1.Controls.Add(this.menuStrip1);
|
||||
//
|
||||
//
|
||||
// splitContainer3.Panel2
|
||||
//
|
||||
//
|
||||
this.splitContainer3.Panel2.Controls.Add(this.splitContainer1);
|
||||
this.splitContainer3.Size = new System.Drawing.Size(985, 773);
|
||||
this.splitContainer3.SplitterDistance = 25;
|
||||
this.splitContainer3.TabIndex = 6;
|
||||
//
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem,
|
||||
this.mapToolStripMenuItem,
|
||||
@@ -273,9 +273,9 @@ namespace OpenRA.Editor
|
||||
this.menuStrip1.Size = new System.Drawing.Size(985, 27);
|
||||
this.menuStrip1.TabIndex = 1;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.newToolStripMenuItem,
|
||||
this.toolStripSeparator1,
|
||||
@@ -290,107 +290,107 @@ namespace OpenRA.Editor
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 23);
|
||||
this.fileToolStripMenuItem.Text = "&File";
|
||||
//
|
||||
//
|
||||
// newToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.newToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripMenuItem.Image")));
|
||||
this.newToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Fuchsia;
|
||||
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
|
||||
this.newToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
|
||||
this.newToolStripMenuItem.Text = "&New...";
|
||||
this.newToolStripMenuItem.Click += new System.EventHandler(this.NewClicked);
|
||||
//
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(120, 6);
|
||||
//
|
||||
//
|
||||
// openToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.openToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripMenuItem.Image")));
|
||||
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
|
||||
this.openToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
|
||||
this.openToolStripMenuItem.Text = "&Open...";
|
||||
this.openToolStripMenuItem.Click += new System.EventHandler(this.OpenClicked);
|
||||
//
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.saveToolStripMenuItem.Enabled = false;
|
||||
this.saveToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem.Image")));
|
||||
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
this.saveToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
|
||||
this.saveToolStripMenuItem.Text = "&Save";
|
||||
this.saveToolStripMenuItem.Click += new System.EventHandler(this.SaveClicked);
|
||||
//
|
||||
//
|
||||
// saveAsToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.saveAsToolStripMenuItem.Enabled = false;
|
||||
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
|
||||
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
|
||||
this.saveAsToolStripMenuItem.Text = "Save &As...";
|
||||
this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.SaveAsClicked);
|
||||
//
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
//
|
||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
this.toolStripSeparator2.Size = new System.Drawing.Size(120, 6);
|
||||
//
|
||||
//
|
||||
// toolStripMenuItem1
|
||||
//
|
||||
//
|
||||
this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.cCRedAlertMapToolStripMenuItem,
|
||||
this.bitmapToolStripMenuItem});
|
||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(123, 22);
|
||||
this.toolStripMenuItem1.Text = "&Import";
|
||||
//
|
||||
//
|
||||
// cCRedAlertMapToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.cCRedAlertMapToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("cCRedAlertMapToolStripMenuItem.Image")));
|
||||
this.cCRedAlertMapToolStripMenuItem.Name = "cCRedAlertMapToolStripMenuItem";
|
||||
this.cCRedAlertMapToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
|
||||
this.cCRedAlertMapToolStripMenuItem.Text = "&C&&C / Red Alert Map...";
|
||||
this.cCRedAlertMapToolStripMenuItem.Click += new System.EventHandler(this.ImportLegacyMapClicked);
|
||||
//
|
||||
//
|
||||
// bitmapToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.bitmapToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("bitmapToolStripMenuItem.Image")));
|
||||
this.bitmapToolStripMenuItem.Name = "bitmapToolStripMenuItem";
|
||||
this.bitmapToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
|
||||
this.bitmapToolStripMenuItem.Text = "&Bitmap...";
|
||||
this.bitmapToolStripMenuItem.Visible = false;
|
||||
//
|
||||
//
|
||||
// mnuExport
|
||||
//
|
||||
//
|
||||
this.mnuExport.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mnuMinimapToPNG});
|
||||
this.mnuExport.Name = "mnuExport";
|
||||
this.mnuExport.Size = new System.Drawing.Size(123, 22);
|
||||
this.mnuExport.Text = "&Export";
|
||||
//
|
||||
//
|
||||
// mnuMinimapToPNG
|
||||
//
|
||||
//
|
||||
this.mnuMinimapToPNG.Enabled = false;
|
||||
this.mnuMinimapToPNG.Image = ((System.Drawing.Image)(resources.GetObject("mnuMinimapToPNG.Image")));
|
||||
this.mnuMinimapToPNG.Name = "mnuMinimapToPNG";
|
||||
this.mnuMinimapToPNG.Size = new System.Drawing.Size(163, 22);
|
||||
this.mnuMinimapToPNG.Text = "Minimap to PNG";
|
||||
this.mnuMinimapToPNG.Click += new System.EventHandler(this.ExportMinimap);
|
||||
//
|
||||
//
|
||||
// toolStripSeparator3
|
||||
//
|
||||
//
|
||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(120, 6);
|
||||
//
|
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
|
||||
this.exitToolStripMenuItem.Text = "E&xit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.CloseClicked);
|
||||
//
|
||||
//
|
||||
// mapToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.mapToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.propertiesToolStripMenuItem,
|
||||
this.resizeToolStripMenuItem,
|
||||
@@ -399,48 +399,48 @@ namespace OpenRA.Editor
|
||||
this.mapToolStripMenuItem.Name = "mapToolStripMenuItem";
|
||||
this.mapToolStripMenuItem.Size = new System.Drawing.Size(43, 23);
|
||||
this.mapToolStripMenuItem.Text = "&Map";
|
||||
//
|
||||
//
|
||||
// propertiesToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.propertiesToolStripMenuItem.Enabled = false;
|
||||
this.propertiesToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("propertiesToolStripMenuItem.Image")));
|
||||
this.propertiesToolStripMenuItem.Name = "propertiesToolStripMenuItem";
|
||||
this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
|
||||
this.propertiesToolStripMenuItem.Text = "&Properties...";
|
||||
this.propertiesToolStripMenuItem.Click += new System.EventHandler(this.PropertiesClicked);
|
||||
//
|
||||
//
|
||||
// resizeToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.resizeToolStripMenuItem.Enabled = false;
|
||||
this.resizeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("resizeToolStripMenuItem.Image")));
|
||||
this.resizeToolStripMenuItem.Name = "resizeToolStripMenuItem";
|
||||
this.resizeToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
|
||||
this.resizeToolStripMenuItem.Text = "&Resize...";
|
||||
this.resizeToolStripMenuItem.Click += new System.EventHandler(this.ResizeClicked);
|
||||
//
|
||||
//
|
||||
// showActorNamesToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.showActorNamesToolStripMenuItem.Name = "showActorNamesToolStripMenuItem";
|
||||
this.showActorNamesToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
|
||||
this.showActorNamesToolStripMenuItem.Text = "Show Actor &Names";
|
||||
this.showActorNamesToolStripMenuItem.Click += new System.EventHandler(this.ShowActorNamesClicked);
|
||||
//
|
||||
//
|
||||
// toolStripComboBox1
|
||||
//
|
||||
//
|
||||
this.toolStripComboBox1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
||||
this.toolStripComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.toolStripComboBox1.Name = "toolStripComboBox1";
|
||||
this.toolStripComboBox1.Size = new System.Drawing.Size(121, 23);
|
||||
//
|
||||
//
|
||||
// toolStripLabel1
|
||||
//
|
||||
//
|
||||
this.toolStripLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
||||
this.toolStripLabel1.Name = "toolStripLabel1";
|
||||
this.toolStripLabel1.Size = new System.Drawing.Size(71, 20);
|
||||
this.toolStripLabel1.Text = "Active Mod:";
|
||||
//
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
//
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripStatusLabelFiller,
|
||||
this.toolStripStatusLabelMousePosition});
|
||||
@@ -449,29 +449,29 @@ namespace OpenRA.Editor
|
||||
this.statusStrip1.Size = new System.Drawing.Size(985, 22);
|
||||
this.statusStrip1.TabIndex = 7;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
//
|
||||
// toolStripStatusLabelFiller
|
||||
//
|
||||
//
|
||||
this.toolStripStatusLabelFiller.Name = "toolStripStatusLabelFiller";
|
||||
this.toolStripStatusLabelFiller.Size = new System.Drawing.Size(948, 17);
|
||||
this.toolStripStatusLabelFiller.Spring = true;
|
||||
//
|
||||
//
|
||||
// toolStripStatusLabelMousePosition
|
||||
//
|
||||
//
|
||||
this.toolStripStatusLabelMousePosition.Name = "toolStripStatusLabelMousePosition";
|
||||
this.toolStripStatusLabelMousePosition.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.toolStripStatusLabelMousePosition.Size = new System.Drawing.Size(22, 17);
|
||||
this.toolStripStatusLabelMousePosition.Text = "0,0";
|
||||
//
|
||||
//
|
||||
// fixOpenAreasToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.fixOpenAreasToolStripMenuItem.Name = "fixOpenAreasToolStripMenuItem";
|
||||
this.fixOpenAreasToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
|
||||
this.fixOpenAreasToolStripMenuItem.Text = "&Fix Open Areas";
|
||||
this.fixOpenAreasToolStripMenuItem.Click += new System.EventHandler(this.FixOpenAreas);
|
||||
//
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(985, 773);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -29,8 +29,8 @@ namespace OpenRA.Editor
|
||||
currentMod = args.FirstOrDefault() ?? "ra";
|
||||
|
||||
toolStripComboBox1.Items.AddRange(Mod.AllMods.Keys.ToArray());
|
||||
|
||||
toolStripComboBox1.SelectedIndexChanged += (_, e) =>
|
||||
|
||||
toolStripComboBox1.SelectedIndexChanged += (_, e) =>
|
||||
{
|
||||
tilePalette.SuspendLayout();
|
||||
actorPalette.SuspendLayout();
|
||||
@@ -44,19 +44,19 @@ namespace OpenRA.Editor
|
||||
surface1.Bind(null, null, null);
|
||||
pmMiniMap.Image = null;
|
||||
currentMod = toolStripComboBox1.SelectedItem as string;
|
||||
|
||||
|
||||
Text = "OpenRA Editor (mod:{0})".F(currentMod);
|
||||
Game.modData = new ModData(currentMod);
|
||||
FileSystem.LoadFromManifest(Game.modData.Manifest);
|
||||
Rules.LoadRules(Game.modData.Manifest, new Map());
|
||||
loadedMapName = null;
|
||||
};
|
||||
|
||||
|
||||
toolStripComboBox1.SelectedItem = currentMod;
|
||||
|
||||
|
||||
surface1.AfterChange += OnMapChanged;
|
||||
surface1.MousePositionChanged += s => toolStripStatusLabelMousePosition.Text = s;
|
||||
|
||||
|
||||
if (args.Length >= 2)
|
||||
LoadMap(args[1]);
|
||||
}
|
||||
@@ -366,7 +366,7 @@ namespace OpenRA.Editor
|
||||
|
||||
void ImportLegacyMapClicked(object sender, EventArgs e)
|
||||
{
|
||||
using (var ofd = new OpenFileDialog { RestoreDirectory = true,
|
||||
using (var ofd = new OpenFileDialog { RestoreDirectory = true,
|
||||
Filter = "Legacy maps (*.ini;*.mpr)|*.ini;*.mpr" })
|
||||
if (DialogResult.OK == ofd.ShowDialog())
|
||||
{
|
||||
@@ -385,7 +385,7 @@ namespace OpenRA.Editor
|
||||
eld.ShowDialog();
|
||||
|
||||
map.MakeDefaultPlayers();
|
||||
|
||||
|
||||
map.Save(savePath);
|
||||
LoadMap(savePath);
|
||||
loadedMapName = null; /* editor needs to think this hasnt been saved */
|
||||
@@ -433,7 +433,7 @@ namespace OpenRA.Editor
|
||||
{
|
||||
var tr = surface1.Map.MapTiles.Value[i, j];
|
||||
if (tr.type == 0xff || tr.type == 0xffff || tr.type == 1 || tr.type == 2)
|
||||
tr.index = (byte)r.Next(0,
|
||||
tr.index = (byte)r.Next(0,
|
||||
Rules.TileSets[surface1.Map.Tileset].Tiles[tr.type].TileBitmapBytes.Count);
|
||||
|
||||
surface1.Map.MapTiles.Value[i, j] = tr;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -39,12 +39,12 @@ namespace OpenRA.Editor
|
||||
{ "gold02", new Pair<byte,byte>(1,1) },
|
||||
{ "gold03", new Pair<byte,byte>(1,2) },
|
||||
{ "gold04", new Pair<byte,byte>(1,3) },
|
||||
|
||||
|
||||
{ "gem01", new Pair<byte,byte>(2,0) },
|
||||
{ "gem02", new Pair<byte,byte>(2,1) },
|
||||
{ "gem03", new Pair<byte,byte>(2,2) },
|
||||
{ "gem04", new Pair<byte,byte>(2,3) },
|
||||
|
||||
|
||||
// cnc tiberium
|
||||
{ "ti1", new Pair<byte,byte>(1,0) },
|
||||
{ "ti2", new Pair<byte,byte>(1,1) },
|
||||
@@ -67,7 +67,7 @@ namespace OpenRA.Editor
|
||||
{"brik","brik"},
|
||||
{"fenc","fenc"},
|
||||
{"wood","wood"},
|
||||
|
||||
|
||||
// Fields
|
||||
{"v12","v12"},
|
||||
{"v13","v13"},
|
||||
@@ -76,12 +76,12 @@ namespace OpenRA.Editor
|
||||
{"v16","v16"},
|
||||
{"v17","v17"},
|
||||
{"v18","v18"},
|
||||
|
||||
|
||||
// Crates
|
||||
// {"wcrate","crate"},
|
||||
// {"scrate","crate"},
|
||||
};
|
||||
|
||||
|
||||
// todo: fix this -- will have bitrotted pretty badly.
|
||||
static Dictionary<string,Pair<Color,Color>> namedColorMapping = new Dictionary<string, Pair<Color, Color>>()
|
||||
{
|
||||
@@ -96,13 +96,13 @@ namespace OpenRA.Editor
|
||||
{"white",Pair.New(Color.FromArgb(255,255,255),Color.FromArgb(75,75,75))},
|
||||
{"black",Pair.New(Color.FromArgb(80,80,80),Color.FromArgb(5,5,5))},
|
||||
};
|
||||
|
||||
|
||||
int MapSize;
|
||||
int ActorCount = 0;
|
||||
Map Map = new Map();
|
||||
List<string> Players = new List<string>();
|
||||
Action<string> errorHandler;
|
||||
|
||||
|
||||
LegacyMapImporter(string filename, Action<string> errorHandler)
|
||||
{
|
||||
this.errorHandler = errorHandler;
|
||||
@@ -116,10 +116,10 @@ namespace OpenRA.Editor
|
||||
}
|
||||
|
||||
enum IniMapFormat { RedAlert = 3, /* otherwise, cnc (2 variants exist, we don't care to differentiate) */ };
|
||||
|
||||
|
||||
public void ConvertIniMap(string iniFile)
|
||||
{
|
||||
|
||||
|
||||
var file = new IniFile(FileSystem.Open(iniFile));
|
||||
var basic = file.GetSection("Basic");
|
||||
var map = file.GetSection("Map");
|
||||
@@ -137,12 +137,12 @@ namespace OpenRA.Editor
|
||||
Map.MapSize.Y = MapSize;
|
||||
Map.Bounds = Rectangle.FromLTRB(XOffset, YOffset, XOffset + Width, YOffset + Height);
|
||||
Map.Selectable = true;
|
||||
|
||||
|
||||
Map.Smudges = Lazy.New(() => new List<SmudgeReference>());
|
||||
Map.Actors = Lazy.New(() => new Dictionary<string, ActorReference>());
|
||||
Map.MapResources = Lazy.New(() => new TileReference<byte, byte>[MapSize, MapSize]);
|
||||
Map.MapTiles = Lazy.New(() => new TileReference<ushort, byte>[MapSize, MapSize]);
|
||||
|
||||
|
||||
if (legacyMapFormat == IniMapFormat.RedAlert)
|
||||
{
|
||||
UnpackRATileData(ReadPackedSection(file.GetSection("MapPack")));
|
||||
@@ -155,22 +155,22 @@ namespace OpenRA.Editor
|
||||
ReadCncOverlay(file);
|
||||
ReadCncTrees(file);
|
||||
}
|
||||
|
||||
|
||||
LoadActors(file, "STRUCTURES");
|
||||
LoadActors(file, "UNITS");
|
||||
LoadActors(file, "INFANTRY");
|
||||
LoadSmudges(file, "SMUDGE");
|
||||
|
||||
|
||||
foreach (var p in Players)
|
||||
LoadPlayer(file, p, (legacyMapFormat == IniMapFormat.RedAlert));
|
||||
|
||||
|
||||
var wps = file.GetSection("Waypoints")
|
||||
.Where(kv => int.Parse(kv.Value) > 0)
|
||||
.Select(kv => Pair.New(int.Parse(kv.Key),
|
||||
LocationFromMapOffset(int.Parse(kv.Value), MapSize)))
|
||||
.ToArray();
|
||||
|
||||
|
||||
|
||||
|
||||
// Add waypoint actors
|
||||
foreach( var kv in wps )
|
||||
{
|
||||
@@ -179,7 +179,7 @@ namespace OpenRA.Editor
|
||||
a.Add(new OwnerInit("Neutral"));
|
||||
Map.Actors.Value.Add("spawn" + kv.First, a);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static int2 LocationFromMapOffset(int offset, int mapSize)
|
||||
@@ -243,7 +243,7 @@ namespace OpenRA.Editor
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void UnpackRATileData(MemoryStream ms)
|
||||
{
|
||||
for (int i = 0; i < MapSize; i++)
|
||||
@@ -274,10 +274,10 @@ namespace OpenRA.Editor
|
||||
|
||||
if (o != 255 && overlayActorMapping.ContainsKey(raOverlayNames[o]))
|
||||
Map.Actors.Value.Add("Actor" + ActorCount++,
|
||||
new ActorReference(overlayActorMapping[raOverlayNames[o]])
|
||||
{
|
||||
new ActorReference(overlayActorMapping[raOverlayNames[o]])
|
||||
{
|
||||
new LocationInit( new int2(i, j) ),
|
||||
new OwnerInit( "Neutral" )
|
||||
new OwnerInit( "Neutral" )
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -291,7 +291,7 @@ namespace OpenRA.Editor
|
||||
foreach (KeyValuePair<string, string> kv in terrain)
|
||||
{
|
||||
var loc = int.Parse(kv.Key);
|
||||
Map.Actors.Value.Add("Actor" + ActorCount++,
|
||||
Map.Actors.Value.Add("Actor" + ActorCount++,
|
||||
new ActorReference(kv.Value.ToLowerInvariant())
|
||||
{
|
||||
new LocationInit(new int2(loc % MapSize, loc / MapSize)),
|
||||
@@ -313,7 +313,7 @@ namespace OpenRA.Editor
|
||||
Map.MapTiles.Value[i, j].index = ReadByte(ms);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ReadCncOverlay(IniFile file)
|
||||
{
|
||||
IniSection overlay = file.GetSection("OVERLAY", true);
|
||||
@@ -332,7 +332,7 @@ namespace OpenRA.Editor
|
||||
Map.MapResources.Value[cell.X, cell.Y] = new TileReference<byte, byte>(res.First, res.Second);
|
||||
|
||||
if (overlayActorMapping.ContainsKey(kv.Value.ToLower()))
|
||||
Map.Actors.Value.Add("Actor" + ActorCount++,
|
||||
Map.Actors.Value.Add("Actor" + ActorCount++,
|
||||
new ActorReference(overlayActorMapping[kv.Value.ToLower()])
|
||||
{
|
||||
new LocationInit(cell),
|
||||
@@ -340,7 +340,7 @@ namespace OpenRA.Editor
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ReadCncTrees(IniFile file)
|
||||
{
|
||||
IniSection terrain = file.GetSection("TERRAIN", true);
|
||||
@@ -401,7 +401,7 @@ namespace OpenRA.Editor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LoadSmudges(IniFile file, string section)
|
||||
{
|
||||
foreach (var s in file.GetSection(section, true))
|
||||
@@ -412,14 +412,14 @@ namespace OpenRA.Editor
|
||||
Map.Smudges.Value.Add(new SmudgeReference(parts[0].ToLowerInvariant(), new int2(loc % MapSize, loc / MapSize), int.Parse(parts[2])));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LoadPlayer(IniFile file, string section, bool isRA)
|
||||
{
|
||||
{
|
||||
var c = section == "BadGuy" ? "red" :
|
||||
isRA ? "blue" : "gold";
|
||||
|
||||
|
||||
var color = namedColorMapping[c];
|
||||
|
||||
|
||||
var pr = new PlayerReference
|
||||
{
|
||||
Name = section,
|
||||
@@ -432,7 +432,7 @@ namespace OpenRA.Editor
|
||||
(byte)(color.First.GetBrightness() * 255),
|
||||
(byte)(color.Second.GetBrightness() * 255))
|
||||
};
|
||||
|
||||
|
||||
var Neutral = new [] {"Neutral"};
|
||||
foreach (var s in file.GetSection(section, true))
|
||||
{
|
||||
@@ -448,7 +448,7 @@ namespace OpenRA.Editor
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Map.Players.Add(section, pr);
|
||||
}
|
||||
|
||||
|
||||
110
OpenRA.Editor/MapSelect.Designer.cs
generated
110
OpenRA.Editor/MapSelect.Designer.cs
generated
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -70,9 +70,9 @@ namespace OpenRA.Editor
|
||||
this.splitContainer1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
//
|
||||
// MapList
|
||||
//
|
||||
//
|
||||
this.MapList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.MapList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.colMapName});
|
||||
@@ -89,20 +89,20 @@ namespace OpenRA.Editor
|
||||
this.MapList.UseCompatibleStateImageBehavior = false;
|
||||
this.MapList.View = System.Windows.Forms.View.Details;
|
||||
this.MapList.SelectedIndexChanged += new System.EventHandler(this.MapList_SelectedIndexChanged);
|
||||
//
|
||||
//
|
||||
// colMapName
|
||||
//
|
||||
//
|
||||
this.colMapName.Text = "Map name";
|
||||
this.colMapName.Width = 240;
|
||||
//
|
||||
//
|
||||
// MapIconsList
|
||||
//
|
||||
//
|
||||
this.MapIconsList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
|
||||
this.MapIconsList.ImageSize = new System.Drawing.Size(24, 24);
|
||||
this.MapIconsList.TransparentColor = System.Drawing.Color.Transparent;
|
||||
//
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
//
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Location = new System.Drawing.Point(407, 35);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
@@ -110,9 +110,9 @@ namespace OpenRA.Editor
|
||||
this.btnCancel.TabIndex = 3;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// btnOk
|
||||
//
|
||||
//
|
||||
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.btnOk.Location = new System.Drawing.Point(326, 35);
|
||||
this.btnOk.Name = "btnOk";
|
||||
@@ -120,9 +120,9 @@ namespace OpenRA.Editor
|
||||
this.btnOk.TabIndex = 2;
|
||||
this.btnOk.Text = "Open";
|
||||
this.btnOk.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// lblNew
|
||||
//
|
||||
//
|
||||
this.lblNew.AutoSize = true;
|
||||
this.lblNew.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.lblNew.Location = new System.Drawing.Point(12, 40);
|
||||
@@ -130,18 +130,18 @@ namespace OpenRA.Editor
|
||||
this.lblNew.Size = new System.Drawing.Size(69, 13);
|
||||
this.lblNew.TabIndex = 3;
|
||||
this.lblNew.Text = "Map name:";
|
||||
//
|
||||
//
|
||||
// txtNew
|
||||
//
|
||||
//
|
||||
this.txtNew.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.txtNew.Location = new System.Drawing.Point(88, 37);
|
||||
this.txtNew.Name = "txtNew";
|
||||
this.txtNew.ReadOnly = true;
|
||||
this.txtNew.Size = new System.Drawing.Size(232, 20);
|
||||
this.txtNew.TabIndex = 1;
|
||||
//
|
||||
//
|
||||
// pbMinimap
|
||||
//
|
||||
//
|
||||
this.pbMinimap.BackColor = System.Drawing.Color.Black;
|
||||
this.pbMinimap.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.pbMinimap.Location = new System.Drawing.Point(32, 25);
|
||||
@@ -150,9 +150,9 @@ namespace OpenRA.Editor
|
||||
this.pbMinimap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.pbMinimap.TabIndex = 5;
|
||||
this.pbMinimap.TabStop = false;
|
||||
//
|
||||
//
|
||||
// pnlBottom
|
||||
//
|
||||
//
|
||||
this.pnlBottom.Controls.Add(this.pictureBox1);
|
||||
this.pnlBottom.Controls.Add(this.txtPathOut);
|
||||
this.pnlBottom.Controls.Add(this.lblPathOut);
|
||||
@@ -167,9 +167,9 @@ namespace OpenRA.Editor
|
||||
this.pnlBottom.Name = "pnlBottom";
|
||||
this.pnlBottom.Size = new System.Drawing.Size(494, 70);
|
||||
this.pnlBottom.TabIndex = 6;
|
||||
//
|
||||
//
|
||||
// txtPathOut
|
||||
//
|
||||
//
|
||||
this.txtPathOut.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.txtPathOut.Location = new System.Drawing.Point(55, 10);
|
||||
this.txtPathOut.Name = "txtPathOut";
|
||||
@@ -177,17 +177,17 @@ namespace OpenRA.Editor
|
||||
this.txtPathOut.Size = new System.Drawing.Size(265, 20);
|
||||
this.txtPathOut.TabIndex = 0;
|
||||
this.txtPathOut.TextChanged += new System.EventHandler(this.txtPathOut_TextChanged);
|
||||
//
|
||||
//
|
||||
// lblPathOut
|
||||
//
|
||||
//
|
||||
this.lblPathOut.AutoSize = true;
|
||||
this.lblPathOut.Location = new System.Drawing.Point(55, 13);
|
||||
this.lblPathOut.Name = "lblPathOut";
|
||||
this.lblPathOut.Size = new System.Drawing.Size(0, 13);
|
||||
this.lblPathOut.TabIndex = 6;
|
||||
//
|
||||
//
|
||||
// lblPath
|
||||
//
|
||||
//
|
||||
this.lblPath.AutoSize = true;
|
||||
this.lblPath.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.lblPath.Location = new System.Drawing.Point(12, 13);
|
||||
@@ -195,20 +195,20 @@ namespace OpenRA.Editor
|
||||
this.lblPath.Size = new System.Drawing.Size(37, 13);
|
||||
this.lblPath.TabIndex = 5;
|
||||
this.lblPath.Text = "Path:";
|
||||
//
|
||||
//
|
||||
// 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.lblMapList);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.MapList);
|
||||
//
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.txtDesc);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.lblDesc);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.txtTheater);
|
||||
@@ -222,90 +222,90 @@ namespace OpenRA.Editor
|
||||
this.splitContainer1.Size = new System.Drawing.Size(494, 332);
|
||||
this.splitContainer1.SplitterDistance = 300;
|
||||
this.splitContainer1.TabIndex = 7;
|
||||
//
|
||||
//
|
||||
// lblMapList
|
||||
//
|
||||
//
|
||||
this.lblMapList.AutoSize = true;
|
||||
this.lblMapList.Location = new System.Drawing.Point(12, 9);
|
||||
this.lblMapList.Name = "lblMapList";
|
||||
this.lblMapList.Size = new System.Drawing.Size(81, 13);
|
||||
this.lblMapList.TabIndex = 1;
|
||||
this.lblMapList.Text = "Available maps:";
|
||||
//
|
||||
//
|
||||
// txtDesc
|
||||
//
|
||||
//
|
||||
this.txtDesc.BackColor = System.Drawing.SystemColors.ButtonFace;
|
||||
this.txtDesc.Location = new System.Drawing.Point(16, 289);
|
||||
this.txtDesc.Name = "txtDesc";
|
||||
this.txtDesc.ReadOnly = true;
|
||||
this.txtDesc.Size = new System.Drawing.Size(162, 20);
|
||||
this.txtDesc.TabIndex = 14;
|
||||
//
|
||||
//
|
||||
// lblDesc
|
||||
//
|
||||
//
|
||||
this.lblDesc.AutoSize = true;
|
||||
this.lblDesc.Location = new System.Drawing.Point(13, 273);
|
||||
this.lblDesc.Name = "lblDesc";
|
||||
this.lblDesc.Size = new System.Drawing.Size(63, 13);
|
||||
this.lblDesc.TabIndex = 13;
|
||||
this.lblDesc.Text = "Description:";
|
||||
//
|
||||
//
|
||||
// txtTheater
|
||||
//
|
||||
//
|
||||
this.txtTheater.BackColor = System.Drawing.SystemColors.ButtonFace;
|
||||
this.txtTheater.Location = new System.Drawing.Point(16, 252);
|
||||
this.txtTheater.Name = "txtTheater";
|
||||
this.txtTheater.ReadOnly = true;
|
||||
this.txtTheater.Size = new System.Drawing.Size(162, 20);
|
||||
this.txtTheater.TabIndex = 12;
|
||||
//
|
||||
//
|
||||
// lblTheater
|
||||
//
|
||||
//
|
||||
this.lblTheater.AutoSize = true;
|
||||
this.lblTheater.Location = new System.Drawing.Point(13, 236);
|
||||
this.lblTheater.Name = "lblTheater";
|
||||
this.lblTheater.Size = new System.Drawing.Size(47, 13);
|
||||
this.lblTheater.TabIndex = 11;
|
||||
this.lblTheater.Text = "Tileset:";
|
||||
//
|
||||
//
|
||||
// txtAuthor
|
||||
//
|
||||
//
|
||||
this.txtAuthor.BackColor = System.Drawing.SystemColors.ButtonFace;
|
||||
this.txtAuthor.Location = new System.Drawing.Point(16, 214);
|
||||
this.txtAuthor.Name = "txtAuthor";
|
||||
this.txtAuthor.ReadOnly = true;
|
||||
this.txtAuthor.Size = new System.Drawing.Size(162, 20);
|
||||
this.txtAuthor.TabIndex = 10;
|
||||
//
|
||||
//
|
||||
// lblAuthor
|
||||
//
|
||||
//
|
||||
this.lblAuthor.AutoSize = true;
|
||||
this.lblAuthor.Location = new System.Drawing.Point(13, 198);
|
||||
this.lblAuthor.Name = "lblAuthor";
|
||||
this.lblAuthor.Size = new System.Drawing.Size(41, 13);
|
||||
this.lblAuthor.TabIndex = 9;
|
||||
this.lblAuthor.Text = "Author:";
|
||||
//
|
||||
//
|
||||
// txtTitle
|
||||
//
|
||||
//
|
||||
this.txtTitle.BackColor = System.Drawing.SystemColors.ButtonFace;
|
||||
this.txtTitle.Location = new System.Drawing.Point(16, 177);
|
||||
this.txtTitle.Name = "txtTitle";
|
||||
this.txtTitle.ReadOnly = true;
|
||||
this.txtTitle.Size = new System.Drawing.Size(162, 20);
|
||||
this.txtTitle.TabIndex = 8;
|
||||
//
|
||||
//
|
||||
// lblMapName
|
||||
//
|
||||
//
|
||||
this.lblMapName.AutoSize = true;
|
||||
this.lblMapName.Location = new System.Drawing.Point(13, 161);
|
||||
this.lblMapName.Name = "lblMapName";
|
||||
this.lblMapName.Size = new System.Drawing.Size(30, 13);
|
||||
this.lblMapName.TabIndex = 7;
|
||||
this.lblMapName.Text = "Title:";
|
||||
//
|
||||
//
|
||||
// lblMinimap
|
||||
//
|
||||
//
|
||||
this.lblMinimap.AutoSize = true;
|
||||
this.lblMinimap.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.lblMinimap.Location = new System.Drawing.Point(29, 9);
|
||||
@@ -313,9 +313,9 @@ namespace OpenRA.Editor
|
||||
this.lblMinimap.Size = new System.Drawing.Size(71, 13);
|
||||
this.lblMinimap.TabIndex = 6;
|
||||
this.lblMinimap.Text = "Map preview:";
|
||||
//
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
//
|
||||
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
|
||||
this.pictureBox1.Location = new System.Drawing.Point(336, -9);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
@@ -323,9 +323,9 @@ namespace OpenRA.Editor
|
||||
this.pictureBox1.TabIndex = 7;
|
||||
this.pictureBox1.TabStop = false;
|
||||
this.pictureBox1.Visible = false;
|
||||
//
|
||||
//
|
||||
// MapSelect
|
||||
//
|
||||
//
|
||||
this.AcceptButton = this.btnOk;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Editor
|
||||
{
|
||||
MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", currentMod, "maps" }
|
||||
.Aggregate(Path.Combine);
|
||||
|
||||
|
||||
InitializeComponent();
|
||||
MapIconsList.Images.Add(pictureBox1.Image);
|
||||
}
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Editor
|
||||
{
|
||||
MapList.Items.Clear();
|
||||
txtPathOut.Text = MapFolderPath;
|
||||
|
||||
|
||||
foreach (var map in ModData.FindMapsIn(MapFolderPath))
|
||||
{
|
||||
ListViewItem map1 = new ListViewItem();
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Editor
|
||||
map1.ImageIndex = 0;
|
||||
MapList.Items.Add(map1);
|
||||
}
|
||||
|
||||
|
||||
// hack
|
||||
if (txtNew.Text != "unnamed")
|
||||
MapList.Items[0].Selected = true;
|
||||
@@ -62,7 +62,7 @@ namespace OpenRA.Editor
|
||||
txtTheater.Text = map.Tileset;
|
||||
txtDesc.Text = map.Description;
|
||||
pbMinimap.Image = null;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
pbMinimap.Image = Minimap.AddStaticResources(map, Minimap.TerrainBitmap(map, true));
|
||||
|
||||
58
OpenRA.Editor/NewMapDialog.Designer.cs
generated
58
OpenRA.Editor/NewMapDialog.Designer.cs
generated
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -58,9 +58,9 @@ namespace OpenRA.Editor
|
||||
((System.ComponentModel.ISupportInitialize)(this.height)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.width)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
//
|
||||
// button2
|
||||
//
|
||||
//
|
||||
this.button2.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.button2.Location = new System.Drawing.Point(229, 160);
|
||||
this.button2.Name = "button2";
|
||||
@@ -68,9 +68,9 @@ namespace OpenRA.Editor
|
||||
this.button2.TabIndex = 7;
|
||||
this.button2.Text = "OK";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// button1
|
||||
//
|
||||
//
|
||||
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.button1.Location = new System.Drawing.Point(310, 160);
|
||||
this.button1.Name = "button1";
|
||||
@@ -78,36 +78,36 @@ namespace OpenRA.Editor
|
||||
this.button1.TabIndex = 8;
|
||||
this.button1.Text = "Cancel";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// label3
|
||||
//
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(31, 77);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(107, 13);
|
||||
this.label3.TabIndex = 9;
|
||||
this.label3.Text = "Cordon Right/Bottom";
|
||||
//
|
||||
//
|
||||
// label2
|
||||
//
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(31, 51);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(86, 13);
|
||||
this.label2.TabIndex = 11;
|
||||
this.label2.Text = "Cordon Left/Top";
|
||||
//
|
||||
//
|
||||
// label1
|
||||
//
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(31, 25);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(27, 13);
|
||||
this.label1.TabIndex = 10;
|
||||
this.label1.Text = "Size";
|
||||
//
|
||||
//
|
||||
// cordonBottom
|
||||
//
|
||||
//
|
||||
this.cordonBottom.Location = new System.Drawing.Point(280, 75);
|
||||
this.cordonBottom.Maximum = new decimal(new int[] {
|
||||
2048,
|
||||
@@ -123,9 +123,9 @@ namespace OpenRA.Editor
|
||||
0,
|
||||
0});
|
||||
this.cordonBottom.Enter += new System.EventHandler(this.SelectText);
|
||||
//
|
||||
//
|
||||
// cordonTop
|
||||
//
|
||||
//
|
||||
this.cordonTop.Location = new System.Drawing.Point(280, 49);
|
||||
this.cordonTop.Maximum = new decimal(new int[] {
|
||||
2048,
|
||||
@@ -141,9 +141,9 @@ namespace OpenRA.Editor
|
||||
0,
|
||||
0});
|
||||
this.cordonTop.Enter += new System.EventHandler(this.SelectText);
|
||||
//
|
||||
//
|
||||
// cordonRight
|
||||
//
|
||||
//
|
||||
this.cordonRight.Location = new System.Drawing.Point(169, 75);
|
||||
this.cordonRight.Maximum = new decimal(new int[] {
|
||||
2048,
|
||||
@@ -159,9 +159,9 @@ namespace OpenRA.Editor
|
||||
0,
|
||||
0});
|
||||
this.cordonRight.Enter += new System.EventHandler(this.SelectText);
|
||||
//
|
||||
//
|
||||
// cordonLeft
|
||||
//
|
||||
//
|
||||
this.cordonLeft.Location = new System.Drawing.Point(169, 49);
|
||||
this.cordonLeft.Maximum = new decimal(new int[] {
|
||||
2048,
|
||||
@@ -177,9 +177,9 @@ namespace OpenRA.Editor
|
||||
0,
|
||||
0});
|
||||
this.cordonLeft.Enter += new System.EventHandler(this.SelectText);
|
||||
//
|
||||
//
|
||||
// height
|
||||
//
|
||||
//
|
||||
this.height.Increment = new decimal(new int[] {
|
||||
8,
|
||||
0,
|
||||
@@ -200,9 +200,9 @@ namespace OpenRA.Editor
|
||||
0,
|
||||
0});
|
||||
this.height.Enter += new System.EventHandler(this.SelectText);
|
||||
//
|
||||
//
|
||||
// width
|
||||
//
|
||||
//
|
||||
this.width.Increment = new decimal(new int[] {
|
||||
8,
|
||||
0,
|
||||
@@ -223,27 +223,27 @@ namespace OpenRA.Editor
|
||||
0,
|
||||
0});
|
||||
this.width.Enter += new System.EventHandler(this.SelectText);
|
||||
//
|
||||
//
|
||||
// label4
|
||||
//
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(31, 124);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(44, 13);
|
||||
this.label4.TabIndex = 14;
|
||||
this.label4.Text = "Tileset";
|
||||
//
|
||||
//
|
||||
// theater
|
||||
//
|
||||
//
|
||||
this.theater.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.theater.FormattingEnabled = true;
|
||||
this.theater.Location = new System.Drawing.Point(169, 121);
|
||||
this.theater.Name = "theater";
|
||||
this.theater.Size = new System.Drawing.Size(216, 21);
|
||||
this.theater.TabIndex = 6;
|
||||
//
|
||||
//
|
||||
// NewMapDialog
|
||||
//
|
||||
//
|
||||
this.AcceptButton = this.button2;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -30,19 +30,19 @@ namespace OpenRA.Editor
|
||||
UpgradeMaps(args[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Application.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
Application.Run(new Form1(args));
|
||||
}
|
||||
|
||||
|
||||
static void UpgradeMaps(string mod)
|
||||
{
|
||||
var MapFolderPath = new string[] { Environment.CurrentDirectory, "mods", mod, "maps" }
|
||||
.Aggregate(Path.Combine);
|
||||
|
||||
|
||||
foreach (var path in ModData.FindMapsIn(MapFolderPath))
|
||||
{
|
||||
var map = new Map(path);
|
||||
@@ -54,6 +54,6 @@ namespace OpenRA.Editor
|
||||
map.Save(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -12,7 +12,7 @@ using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// 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")]
|
||||
@@ -24,8 +24,8 @@ using System.Runtime.InteropServices;
|
||||
[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
|
||||
// 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)]
|
||||
|
||||
@@ -35,11 +35,11 @@ using System.Runtime.InteropServices;
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// 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")]
|
||||
|
||||
46
OpenRA.Editor/PropertiesDialog.Designer.cs
generated
46
OpenRA.Editor/PropertiesDialog.Designer.cs
generated
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -49,9 +49,9 @@ namespace OpenRA.Editor
|
||||
this.author = new System.Windows.Forms.TextBox();
|
||||
this.useAsShellmap = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
//
|
||||
// button2
|
||||
//
|
||||
//
|
||||
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button2.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.button2.Location = new System.Drawing.Point(196, 193);
|
||||
@@ -60,9 +60,9 @@ namespace OpenRA.Editor
|
||||
this.button2.TabIndex = 14;
|
||||
this.button2.Text = "OK";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// button1
|
||||
//
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.button1.Location = new System.Drawing.Point(277, 193);
|
||||
@@ -71,41 +71,41 @@ namespace OpenRA.Editor
|
||||
this.button1.TabIndex = 15;
|
||||
this.button1.Text = "Cancel";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// label1
|
||||
//
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 50);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(27, 13);
|
||||
this.label1.TabIndex = 16;
|
||||
this.label1.Text = "Title";
|
||||
//
|
||||
//
|
||||
// title
|
||||
//
|
||||
//
|
||||
this.title.Location = new System.Drawing.Point(66, 47);
|
||||
this.title.Name = "title";
|
||||
this.title.Size = new System.Drawing.Size(286, 20);
|
||||
this.title.TabIndex = 17;
|
||||
//
|
||||
//
|
||||
// label2
|
||||
//
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 76);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(32, 13);
|
||||
this.label2.TabIndex = 16;
|
||||
this.label2.Text = "Desc";
|
||||
//
|
||||
//
|
||||
// desc
|
||||
//
|
||||
//
|
||||
this.desc.Location = new System.Drawing.Point(66, 73);
|
||||
this.desc.Name = "desc";
|
||||
this.desc.Size = new System.Drawing.Size(286, 20);
|
||||
this.desc.TabIndex = 17;
|
||||
//
|
||||
//
|
||||
// selectable
|
||||
//
|
||||
//
|
||||
this.selectable.AutoSize = true;
|
||||
this.selectable.Location = new System.Drawing.Point(118, 138);
|
||||
this.selectable.Name = "selectable";
|
||||
@@ -113,25 +113,25 @@ namespace OpenRA.Editor
|
||||
this.selectable.TabIndex = 18;
|
||||
this.selectable.Text = "Show in Map Chooser";
|
||||
this.selectable.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// label3
|
||||
//
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(12, 102);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(38, 13);
|
||||
this.label3.TabIndex = 16;
|
||||
this.label3.Text = "Author";
|
||||
//
|
||||
//
|
||||
// author
|
||||
//
|
||||
//
|
||||
this.author.Location = new System.Drawing.Point(66, 99);
|
||||
this.author.Name = "author";
|
||||
this.author.Size = new System.Drawing.Size(286, 20);
|
||||
this.author.TabIndex = 17;
|
||||
//
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
//
|
||||
this.useAsShellmap.AutoSize = true;
|
||||
this.useAsShellmap.Location = new System.Drawing.Point(118, 161);
|
||||
this.useAsShellmap.Name = "checkBox1";
|
||||
@@ -139,9 +139,9 @@ namespace OpenRA.Editor
|
||||
this.useAsShellmap.TabIndex = 18;
|
||||
this.useAsShellmap.Text = "Use as Shellmap";
|
||||
this.useAsShellmap.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// PropertiesDialog
|
||||
//
|
||||
//
|
||||
this.AcceptButton = this.button2;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -85,7 +85,7 @@ namespace OpenRA.Editor
|
||||
public static ActorTemplate RenderActor(ActorInfo info, TileSet tileset, Palette p)
|
||||
{
|
||||
var image = RenderSimple.GetImage(info);
|
||||
|
||||
|
||||
using (var s = FileSystem.OpenWithExts(image, tileset.Extensions))
|
||||
{
|
||||
var shp = new ShpReader(s);
|
||||
|
||||
50
OpenRA.Editor/ResizeDialog.Designer.cs
generated
50
OpenRA.Editor/ResizeDialog.Designer.cs
generated
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -56,9 +56,9 @@ namespace OpenRA.Editor
|
||||
((System.ComponentModel.ISupportInitialize)(this.cordonBottom)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.height)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
//
|
||||
// width
|
||||
//
|
||||
//
|
||||
this.width.Increment = new decimal(new int[] {
|
||||
8,
|
||||
0,
|
||||
@@ -73,27 +73,27 @@ namespace OpenRA.Editor
|
||||
this.width.Name = "width";
|
||||
this.width.Size = new System.Drawing.Size(105, 20);
|
||||
this.width.TabIndex = 0;
|
||||
//
|
||||
//
|
||||
// label1
|
||||
//
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(23, 20);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(27, 13);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Size";
|
||||
//
|
||||
//
|
||||
// label2
|
||||
//
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(23, 46);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(86, 13);
|
||||
this.label2.TabIndex = 1;
|
||||
this.label2.Text = "Cordon Left/Top";
|
||||
//
|
||||
//
|
||||
// cordonLeft
|
||||
//
|
||||
//
|
||||
this.cordonLeft.Location = new System.Drawing.Point(161, 44);
|
||||
this.cordonLeft.Maximum = new decimal(new int[] {
|
||||
2048,
|
||||
@@ -103,9 +103,9 @@ namespace OpenRA.Editor
|
||||
this.cordonLeft.Name = "cordonLeft";
|
||||
this.cordonLeft.Size = new System.Drawing.Size(105, 20);
|
||||
this.cordonLeft.TabIndex = 0;
|
||||
//
|
||||
//
|
||||
// cordonTop
|
||||
//
|
||||
//
|
||||
this.cordonTop.Location = new System.Drawing.Point(272, 44);
|
||||
this.cordonTop.Maximum = new decimal(new int[] {
|
||||
2048,
|
||||
@@ -115,9 +115,9 @@ namespace OpenRA.Editor
|
||||
this.cordonTop.Name = "cordonTop";
|
||||
this.cordonTop.Size = new System.Drawing.Size(105, 20);
|
||||
this.cordonTop.TabIndex = 0;
|
||||
//
|
||||
//
|
||||
// cordonRight
|
||||
//
|
||||
//
|
||||
this.cordonRight.Location = new System.Drawing.Point(161, 70);
|
||||
this.cordonRight.Maximum = new decimal(new int[] {
|
||||
2048,
|
||||
@@ -127,9 +127,9 @@ namespace OpenRA.Editor
|
||||
this.cordonRight.Name = "cordonRight";
|
||||
this.cordonRight.Size = new System.Drawing.Size(105, 20);
|
||||
this.cordonRight.TabIndex = 0;
|
||||
//
|
||||
//
|
||||
// cordonBottom
|
||||
//
|
||||
//
|
||||
this.cordonBottom.Location = new System.Drawing.Point(272, 70);
|
||||
this.cordonBottom.Maximum = new decimal(new int[] {
|
||||
2048,
|
||||
@@ -139,18 +139,18 @@ namespace OpenRA.Editor
|
||||
this.cordonBottom.Name = "cordonBottom";
|
||||
this.cordonBottom.Size = new System.Drawing.Size(105, 20);
|
||||
this.cordonBottom.TabIndex = 0;
|
||||
//
|
||||
//
|
||||
// label3
|
||||
//
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(23, 72);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(107, 13);
|
||||
this.label3.TabIndex = 1;
|
||||
this.label3.Text = "Cordon Right/Bottom";
|
||||
//
|
||||
//
|
||||
// button1
|
||||
//
|
||||
//
|
||||
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.button1.Location = new System.Drawing.Point(302, 111);
|
||||
this.button1.Name = "button1";
|
||||
@@ -158,9 +158,9 @@ namespace OpenRA.Editor
|
||||
this.button1.TabIndex = 2;
|
||||
this.button1.Text = "Cancel";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// button2
|
||||
//
|
||||
//
|
||||
this.button2.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.button2.Location = new System.Drawing.Point(221, 111);
|
||||
this.button2.Name = "button2";
|
||||
@@ -168,9 +168,9 @@ namespace OpenRA.Editor
|
||||
this.button2.TabIndex = 2;
|
||||
this.button2.Text = "OK";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// height
|
||||
//
|
||||
//
|
||||
this.height.Increment = new decimal(new int[] {
|
||||
8,
|
||||
0,
|
||||
@@ -185,9 +185,9 @@ namespace OpenRA.Editor
|
||||
this.height.Name = "height";
|
||||
this.height.Size = new System.Drawing.Size(105, 20);
|
||||
this.height.TabIndex = 0;
|
||||
//
|
||||
//
|
||||
// ResizeDialog
|
||||
//
|
||||
//
|
||||
this.AcceptButton = this.button2;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Editor
|
||||
index = (byte)random.Next(Resource.Info.SpriteNames.Length)
|
||||
};
|
||||
|
||||
var ch = new int2((surface.GetBrushLocation().X) / Surface.ChunkSize,
|
||||
var ch = new int2((surface.GetBrushLocation().X) / Surface.ChunkSize,
|
||||
(surface.GetBrushLocation().Y) / Surface.ChunkSize);
|
||||
|
||||
if (surface.Chunks.ContainsKey(ch))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Editor
|
||||
public float Zoom = 1.0f;
|
||||
|
||||
ITool Tool;
|
||||
|
||||
|
||||
public bool IsPanning;
|
||||
public bool ShowActorNames;
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace OpenRA.Editor
|
||||
return;
|
||||
|
||||
Tool = null;
|
||||
|
||||
|
||||
var key = Map.Actors.Value.FirstOrDefault(a => a.Value.Location() == BrushLocation);
|
||||
if (key.Key != null) Map.Actors.Value.Remove(key.Key);
|
||||
|
||||
@@ -286,7 +286,7 @@ namespace OpenRA.Editor
|
||||
{
|
||||
var centered = t.Appearance == null || !t.Appearance.RelativeToTopLeft;
|
||||
var drawPos = GetDrawPosition(p, t.Bitmap, centered);
|
||||
|
||||
|
||||
g.DrawRectangle(CordonPen,
|
||||
drawPos.X, drawPos.Y,
|
||||
t.Bitmap.Width * Zoom, t.Bitmap.Height * Zoom);
|
||||
@@ -360,7 +360,7 @@ namespace OpenRA.Editor
|
||||
|
||||
if (Tool != null)
|
||||
Tool.Preview(this, e.Graphics);
|
||||
|
||||
|
||||
if (Tool == null)
|
||||
{
|
||||
var x = Map.Actors.Value.FirstOrDefault(a => a.Value.Location() == GetBrushLocation());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -61,11 +61,11 @@ namespace OpenRA.FileFormats
|
||||
while ((temp = s.Pop()) != "(") yield return temp;
|
||||
}
|
||||
else if (char.IsNumber(t[0])) yield return t;
|
||||
else if (char.IsLetter(t[0]))
|
||||
else if (char.IsLetter(t[0]))
|
||||
{
|
||||
if (!syms.ContainsKey(t))
|
||||
throw new InvalidOperationException("Substitution `{0}` undefined".F(t));
|
||||
|
||||
|
||||
yield return syms[t].ToString();
|
||||
}
|
||||
else
|
||||
@@ -74,7 +74,7 @@ namespace OpenRA.FileFormats
|
||||
s.Push(t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while (s.Count > 0) yield return s.Pop();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -111,11 +111,11 @@ namespace OpenRA
|
||||
{
|
||||
return (k & mod) == mod;
|
||||
}
|
||||
|
||||
|
||||
public static bool IsValidInput(this KeyInput key)
|
||||
{
|
||||
return char.IsLetter(key.UnicodeChar) || char.IsDigit(key.UnicodeChar) ||
|
||||
char.IsSymbol(key.UnicodeChar) || char.IsSeparator(key.UnicodeChar) ||
|
||||
return char.IsLetter(key.UnicodeChar) || char.IsDigit(key.UnicodeChar) ||
|
||||
char.IsSymbol(key.UnicodeChar) || char.IsSeparator(key.UnicodeChar) ||
|
||||
char.IsPunctuation(key.UnicodeChar);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace OpenRA
|
||||
// this is probably a shockingly-slow way to do this, but it's concise.
|
||||
return xs.Except(ys).Concat(ys.Except(xs));
|
||||
}
|
||||
|
||||
|
||||
public static IEnumerable<T> Iterate<T>( this T t, Func<T,T> f )
|
||||
{
|
||||
for(;;) { yield return t; t = f(t); }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.FileFormats
|
||||
field.SetValue( self, GetValue( field.Name, field.FieldType, value ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var prop = self.GetType().GetProperty( key.Trim() );
|
||||
|
||||
if (prop != null)
|
||||
@@ -207,7 +207,7 @@ namespace OpenRA.FileFormats
|
||||
var argValues = new object[] { parts };
|
||||
return fieldType.GetConstructor(argTypes).Invoke(argValues);
|
||||
}
|
||||
|
||||
|
||||
UnknownFieldAction("[Type] {0}".F(x),fieldType);
|
||||
return null;
|
||||
}
|
||||
@@ -304,7 +304,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
return new MiniYamlNode(field, FieldSaver.FormatValue( o, o.GetType().GetField(field) ));
|
||||
}
|
||||
|
||||
|
||||
public static string FormatValue(object o, FieldInfo f)
|
||||
{
|
||||
var v = f.GetValue(o);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -109,13 +109,13 @@ namespace OpenRA.FileFormats
|
||||
/*var dataSize = */ br.ReadInt32();
|
||||
var outputSize = br.ReadInt32();
|
||||
var flags = (SoundFlags) br.ReadByte();
|
||||
|
||||
|
||||
var samples = outputSize;
|
||||
if (0 != (flags & SoundFlags.Stereo)) samples /= 2;
|
||||
if (0 != (flags & SoundFlags._16Bit)) samples /= 2;
|
||||
return samples / sampleRate;
|
||||
}
|
||||
|
||||
|
||||
public static byte[] LoadSound(Stream s)
|
||||
{
|
||||
var br = new BinaryReader(s);
|
||||
@@ -140,9 +140,9 @@ namespace OpenRA.FileFormats
|
||||
var t = DecodeSample(b, ref index, ref currentSample);
|
||||
output[offset++] = (byte)t;
|
||||
output[offset++] = (byte)(t >> 8);
|
||||
|
||||
|
||||
if (offset < outputSize)
|
||||
{
|
||||
{
|
||||
/* possible that only half of the final byte is used! */
|
||||
t = DecodeSample((byte)(b >> 4), ref index, ref currentSample);
|
||||
output[offset++] = (byte)t;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*
|
||||
* This file is based on the blast routines (version 1.1 by Mark Adler)
|
||||
* This file is based on the blast routines (version 1.1 by Mark Adler)
|
||||
* included in zlib/contrib
|
||||
*/
|
||||
#endregion
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
public static readonly int MAXBITS = 13; // maximum code length
|
||||
public static readonly int MAXWIN = 4096; // maximum window size
|
||||
|
||||
|
||||
static byte[] litlen = new byte[] {
|
||||
11, 124, 8, 7, 28, 7, 188, 13, 76, 4,
|
||||
10, 8, 12, 10, 12, 10, 8, 23, 8, 9,
|
||||
@@ -51,28 +51,28 @@ namespace OpenRA.FileFormats
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
|
||||
3, 4, 5, 6, 7, 8
|
||||
};
|
||||
|
||||
|
||||
static Huffman litcode = new Huffman(litlen, litlen.Length, 256);
|
||||
static Huffman lencode = new Huffman(lenlen, lenlen.Length, 16);
|
||||
static Huffman distcode = new Huffman(distlen, distlen.Length, 64);
|
||||
|
||||
|
||||
// Decode PKWare Compression Library stream.
|
||||
public static byte[] Decompress(byte[] src)
|
||||
{
|
||||
BitReader br = new BitReader(src);
|
||||
|
||||
|
||||
// Are literals coded?
|
||||
int coded = br.ReadBits(8);
|
||||
|
||||
|
||||
if (coded < 0 || coded > 1)
|
||||
throw new NotImplementedException("Invalid datastream");
|
||||
bool EncodedLiterals = (coded == 1);
|
||||
|
||||
|
||||
// log2(dictionary size) - 6
|
||||
int dict = br.ReadBits(8);
|
||||
if (dict < 4 || dict > 6)
|
||||
throw new InvalidDataException("Invalid dictionary size");
|
||||
|
||||
throw new InvalidDataException("Invalid dictionary size");
|
||||
|
||||
// output state
|
||||
ushort next = 0; // index of next write location in out[]
|
||||
bool first = true; // true to check distances (for first 4K)
|
||||
@@ -94,33 +94,33 @@ namespace OpenRA.FileFormats
|
||||
ms.WriteByte(outBuffer[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Distance
|
||||
symbol = len == 2 ? 2 : dict;
|
||||
int dist = Decode(distcode, br) << symbol;
|
||||
dist += br.ReadBits(symbol);
|
||||
dist++;
|
||||
|
||||
|
||||
if (first && dist > next)
|
||||
throw new InvalidDataException("Attempt to jump before data");
|
||||
|
||||
|
||||
// copy length bytes from distance bytes back
|
||||
do
|
||||
{
|
||||
int dest = next;
|
||||
int source = dest - dist;
|
||||
|
||||
|
||||
int copy = MAXWIN;
|
||||
if (next < dist)
|
||||
{
|
||||
source += copy;
|
||||
copy = dist;
|
||||
}
|
||||
|
||||
|
||||
copy -= next;
|
||||
if (copy > len)
|
||||
copy = len;
|
||||
|
||||
|
||||
len -= copy;
|
||||
next += (ushort)copy;
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace OpenRA.FileFormats
|
||||
// the same as Array.Copy()
|
||||
while( copy-- > 0 )
|
||||
outBuffer[dest++] = outBuffer[source++];
|
||||
|
||||
|
||||
// Flush window to outstream
|
||||
if (next == MAXWIN)
|
||||
{
|
||||
@@ -153,11 +153,11 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
|
||||
|
||||
return ms.ToArray();
|
||||
}
|
||||
|
||||
// Decode a code using huffman table h.
|
||||
|
||||
// Decode a code using huffman table h.
|
||||
static int Decode(Huffman h, BitReader br)
|
||||
{
|
||||
int code = 0; // len bits being decoded
|
||||
@@ -178,7 +178,7 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class BitReader
|
||||
{
|
||||
readonly byte[] src;
|
||||
@@ -190,7 +190,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
this.src = src;
|
||||
}
|
||||
|
||||
|
||||
public int ReadBits(int count)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -202,7 +202,7 @@ namespace OpenRA.FileFormats
|
||||
bitBuffer = src[offset++];
|
||||
bitCount = 8;
|
||||
}
|
||||
|
||||
|
||||
ret |= (bitBuffer & 1) << filled;
|
||||
bitBuffer >>= 1;
|
||||
bitCount--;
|
||||
@@ -230,7 +230,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
short[] length = new short[256]; // code lengths
|
||||
int s = 0; // current symbol
|
||||
|
||||
|
||||
// convert compact repeat counts into symbol bit length list
|
||||
foreach (byte code in rep)
|
||||
{
|
||||
@@ -242,16 +242,16 @@ namespace OpenRA.FileFormats
|
||||
} while (--num > 0);
|
||||
}
|
||||
n = s;
|
||||
|
||||
|
||||
// count number of codes of each length
|
||||
Count = new short[Blast.MAXBITS + 1];
|
||||
for (int i = 0; i < n; i++)
|
||||
Count[length[i]]++;
|
||||
|
||||
|
||||
// no codes!
|
||||
if (Count[0] == n)
|
||||
return;
|
||||
|
||||
|
||||
// check for an over-subscribed or incomplete set of lengths
|
||||
int left = 1; // one possible code of zero length
|
||||
for (int len = 1; len <= Blast.MAXBITS; len++)
|
||||
@@ -263,12 +263,12 @@ namespace OpenRA.FileFormats
|
||||
if (left < 0)
|
||||
throw new InvalidDataException ("over subscribed code set");
|
||||
}
|
||||
|
||||
|
||||
// generate offsets into symbol table for each length for sorting
|
||||
short[] offs = new short[Blast.MAXBITS + 1];
|
||||
for (int len = 1; len < Blast.MAXBITS; len++)
|
||||
offs[len + 1] = (short)(offs[len] + Count[len]);
|
||||
|
||||
|
||||
// put symbols in table sorted by length, by symbol order within each length
|
||||
Symbol = new short[SymbolCount];
|
||||
for (short i = 0; i < n; i++)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -385,7 +385,7 @@ namespace OpenRA.FileFormats
|
||||
void dec_bignum(uint[] n, uint len)
|
||||
{
|
||||
int i = 0;
|
||||
while ((--n[i] == 0xffffffff) && (--len > 0))
|
||||
while ((--n[i] == 0xffffffff) && (--len > 0))
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ namespace OpenRA.FileFormats
|
||||
uint[] n3 = new uint[64];
|
||||
|
||||
uint a = (pubkey.len - 1) / 8;
|
||||
while (a + 1 <= pre_len)
|
||||
while (a + 1 <= pre_len)
|
||||
{
|
||||
init_bignum(n2, 0, 64);
|
||||
fixed( uint * pn2 = &n2[0] )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -129,7 +129,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
/* quick & dirty format80 encoder -- only uses raw copy operator, terminated with a zero-run. */
|
||||
/* this does not produce good compression, but it's valid format80 */
|
||||
|
||||
|
||||
var ctx = new FastByteReader(src);
|
||||
var ms = new MemoryStream();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.FileFormats
|
||||
else
|
||||
return new Folder(filename, order, content);
|
||||
}
|
||||
|
||||
|
||||
public static IFolder OpenPackage(string filename, int order)
|
||||
{
|
||||
if (filename.EndsWith(".mix", StringComparison.InvariantCultureIgnoreCase))
|
||||
@@ -73,11 +73,11 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
var optional = name.StartsWith("~");
|
||||
if (optional) name = name.Substring(1);
|
||||
|
||||
|
||||
// paths starting with ^ are relative to the support dir
|
||||
if (name.StartsWith("^"))
|
||||
name = Platform.SupportDir+name.Substring(1);
|
||||
|
||||
|
||||
var a = (Action)(() => FileSystem.MountInner(OpenPackage(name)));
|
||||
|
||||
if (optional)
|
||||
@@ -198,7 +198,7 @@ namespace OpenRA.FileFormats
|
||||
assemblyCache.Add(filename, a);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -27,10 +27,10 @@ namespace OpenRA.FileFormats
|
||||
this.priority = priority;
|
||||
if (Directory.Exists(path))
|
||||
Directory.Delete(path, true);
|
||||
|
||||
|
||||
Write(contents);
|
||||
}
|
||||
|
||||
|
||||
public Folder(string path, int priority)
|
||||
{
|
||||
this.path = path;
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA.FileFormats
|
||||
foreach( var filename in Directory.GetFiles( path, "*", SearchOption.TopDirectoryOnly ) )
|
||||
yield return PackageEntry.HashFilename( Path.GetFileName(filename) );
|
||||
}
|
||||
|
||||
|
||||
public bool Exists(string filename)
|
||||
{
|
||||
return File.Exists(Path.Combine(path,filename));
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
get { return priority; }
|
||||
}
|
||||
|
||||
|
||||
public void Write(Dictionary<string, byte[]> contents)
|
||||
{
|
||||
if (!Directory.Exists(path))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.FileFormats
|
||||
uint signature = reader.ReadUInt32();
|
||||
if (signature != 0x8C655D13)
|
||||
throw new InvalidDataException("Not an Installshield package");
|
||||
|
||||
|
||||
reader.ReadBytes(8);
|
||||
/*var FileCount = */reader.ReadUInt16();
|
||||
reader.ReadBytes(4);
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.FileFormats
|
||||
var TOCAddress = reader.ReadInt32();
|
||||
reader.ReadBytes(4);
|
||||
var DirCount = reader.ReadUInt16();
|
||||
|
||||
|
||||
// Parse the directory list
|
||||
s.Seek(TOCAddress, SeekOrigin.Begin);
|
||||
BinaryReader TOCreader = new BinaryReader(s);
|
||||
@@ -56,15 +56,15 @@ namespace OpenRA.FileFormats
|
||||
var ChunkSize = reader.ReadUInt16();
|
||||
var NameLength = reader.ReadUInt16();
|
||||
reader.ReadChars(NameLength); //var DirName = new String(reader.ReadChars(NameLength));
|
||||
|
||||
|
||||
// Skip to the end of the chunk
|
||||
reader.ReadBytes(ChunkSize - NameLength - 6);
|
||||
|
||||
|
||||
// Parse files
|
||||
for (var i = 0; i < FileCount; i++)
|
||||
ParseFile(reader);
|
||||
}
|
||||
|
||||
|
||||
uint AccumulatedData = 0;
|
||||
void ParseFile(BinaryReader reader)
|
||||
{
|
||||
@@ -79,11 +79,11 @@ namespace OpenRA.FileFormats
|
||||
var hash = PackageEntry.HashFilename(FileName);
|
||||
index.Add(hash, new PackageEntry(hash,AccumulatedData, CompressedSize));
|
||||
AccumulatedData += CompressedSize;
|
||||
|
||||
|
||||
// Skip to the end of the chunk
|
||||
reader.ReadBytes(ChunkSize - NameLength - 30);
|
||||
}
|
||||
|
||||
|
||||
public Stream GetContent(uint hash)
|
||||
{
|
||||
PackageEntry e;
|
||||
@@ -93,7 +93,7 @@ namespace OpenRA.FileFormats
|
||||
s.Seek( dataStart + e.Offset, SeekOrigin.Begin );
|
||||
byte[] data = new byte[ e.Length ];
|
||||
s.Read( data, 0, (int)e.Length );
|
||||
|
||||
|
||||
return new MemoryStream(Blast.Decompress(data));
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
return index.Keys;
|
||||
}
|
||||
|
||||
|
||||
public bool Exists(string filename)
|
||||
{
|
||||
return index.ContainsKey(PackageEntry.HashFilename(filename));
|
||||
@@ -117,7 +117,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
get { return 2000 + priority; }
|
||||
}
|
||||
|
||||
|
||||
public void Write(Dictionary<string, byte[]> contents)
|
||||
{
|
||||
throw new NotImplementedException("Cannot save InstallShieldPackages.");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -31,14 +31,14 @@ namespace OpenRA.FileFormats
|
||||
readonly long dataStart;
|
||||
readonly Stream s;
|
||||
int priority;
|
||||
|
||||
|
||||
// Create a new MixFile
|
||||
public MixFile(string filename, int priority, Dictionary<string, byte[]> contents)
|
||||
{
|
||||
this.priority = priority;
|
||||
if (File.Exists(filename))
|
||||
File.Delete(filename);
|
||||
|
||||
|
||||
s = File.Create(filename);
|
||||
Write(contents);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ namespace OpenRA.FileFormats
|
||||
dataStart = s.Position;
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
public Stream GetContent(uint hash)
|
||||
{
|
||||
PackageEntry e;
|
||||
@@ -159,7 +159,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
return index.Keys;
|
||||
}
|
||||
|
||||
|
||||
public bool Exists(string filename)
|
||||
{
|
||||
return index.ContainsKey(PackageEntry.HashFilename(filename));
|
||||
@@ -170,17 +170,17 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
get { return 1000 + priority; }
|
||||
}
|
||||
|
||||
|
||||
public void Write(Dictionary<string, byte[]> contents)
|
||||
{
|
||||
// Cannot modify existing mixfile - rename existing file and
|
||||
// create a new one with original content plus modifications
|
||||
FileSystem.Unmount(this);
|
||||
|
||||
|
||||
// TODO: Add existing data to the contents list
|
||||
if (index.Count > 0)
|
||||
throw new NotImplementedException("Updating mix files unfinished");
|
||||
|
||||
|
||||
// Construct a list of entries for the file header
|
||||
uint dataSize = 0;
|
||||
var items = new List<PackageEntry>();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
if (File.Exists(filename))
|
||||
File.Delete(filename);
|
||||
|
||||
|
||||
pkg = SZipFile.Create(filename);
|
||||
Write(contents);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ namespace OpenRA.FileFormats
|
||||
foreach(ZipEntry entry in pkg)
|
||||
yield return PackageEntry.HashFilename(entry.Name);
|
||||
}
|
||||
|
||||
|
||||
public bool Exists(string filename)
|
||||
{
|
||||
return pkg.GetEntry(filename) != null;
|
||||
@@ -80,7 +80,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
get { return 500 + priority; }
|
||||
}
|
||||
|
||||
|
||||
public void Write(Dictionary<string, byte[]> contents)
|
||||
{
|
||||
pkg.Close();
|
||||
@@ -108,7 +108,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
public Stream GetSource()
|
||||
{
|
||||
return new MemoryStream(data);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -83,14 +83,14 @@ namespace OpenRA.FileFormats
|
||||
BinaryReader reader = new BinaryReader(stream);
|
||||
|
||||
ImageCount = reader.ReadUInt16();
|
||||
|
||||
|
||||
//Last offset is pointer to end of file.
|
||||
uint[] offsets = new uint[ImageCount + 1];
|
||||
|
||||
uint temp = reader.ReadUInt32();
|
||||
|
||||
//If fourth byte in file is non-zero, the offsets are two bytes each.
|
||||
bool twoByteOffsets = (temp & 0xFF0000) > 0;
|
||||
bool twoByteOffsets = (temp & 0xFF0000) > 0;
|
||||
if (twoByteOffsets)
|
||||
{
|
||||
offsets[0] = ((temp & 0xFFFF0000) >> 16) + 2; //Offset does not account for image count bytes
|
||||
@@ -132,7 +132,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
get { return headers[index]; }
|
||||
}
|
||||
|
||||
|
||||
public IEnumerator<Dune2ImageHeader> GetEnumerator()
|
||||
{
|
||||
return headers.GetEnumerator();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.FileFormats.Graphics
|
||||
|
||||
public interface IDeviceFactory
|
||||
{
|
||||
IGraphicsDevice Create( Size size, WindowMode windowMode );
|
||||
IGraphicsDevice Create( Size size, WindowMode windowMode );
|
||||
}
|
||||
|
||||
public interface IGraphicsDevice
|
||||
@@ -75,8 +75,8 @@ namespace OpenRA.FileFormats.Graphics
|
||||
|
||||
public enum PrimitiveType
|
||||
{
|
||||
PointList,
|
||||
LineList,
|
||||
PointList,
|
||||
LineList,
|
||||
TriangleList,
|
||||
QuadList,
|
||||
}
|
||||
@@ -86,7 +86,7 @@ namespace OpenRA.FileFormats.Graphics
|
||||
public readonly T Start, End;
|
||||
public Range( T start, T end ) { Start = start; End = end; }
|
||||
}
|
||||
|
||||
|
||||
public enum WindowMode
|
||||
{
|
||||
Windowed,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.FileFormats
|
||||
public readonly byte Framerate;
|
||||
public readonly ushort Width;
|
||||
public readonly ushort Height;
|
||||
|
||||
|
||||
Stream stream;
|
||||
int currentFrame;
|
||||
ushort numColors;
|
||||
@@ -32,75 +32,75 @@ namespace OpenRA.FileFormats
|
||||
|
||||
// Stores a list of subpixels, referenced by the VPTZ chunk
|
||||
byte[] cbf;
|
||||
byte[] cbp;
|
||||
byte[] cbp;
|
||||
int cbChunk = 0;
|
||||
int cbOffset = 0;
|
||||
|
||||
|
||||
// Top half contains block info, bottom half contains references to cbf array
|
||||
byte[] origData;
|
||||
|
||||
|
||||
// Final frame output
|
||||
uint[,] frameData;
|
||||
byte[] audioData; // audio for this frame: 22050Hz 16bit mono pcm, uncompressed.
|
||||
|
||||
public byte[] AudioData { get { return audioData; } }
|
||||
public int CurrentFrame { get { return currentFrame; } }
|
||||
|
||||
|
||||
public VqaReader( Stream stream )
|
||||
{
|
||||
this.stream = stream;
|
||||
BinaryReader reader = new BinaryReader( stream );
|
||||
|
||||
|
||||
// Decode FORM chunk
|
||||
if (new String(reader.ReadChars(4)) != "FORM")
|
||||
throw new InvalidDataException("Invalid vqa (invalid FORM section)");
|
||||
/*var length = */ reader.ReadUInt32();
|
||||
|
||||
|
||||
if (new String(reader.ReadChars(8)) != "WVQAVQHD")
|
||||
throw new InvalidDataException("Invalid vqa (not WVQAVQHD)");
|
||||
/* var length = */reader.ReadUInt32();
|
||||
|
||||
|
||||
/*var version = */reader.ReadUInt16();
|
||||
/*var flags = */reader.ReadUInt16();
|
||||
Frames = reader.ReadUInt16();
|
||||
Width = reader.ReadUInt16();
|
||||
Height = reader.ReadUInt16();
|
||||
|
||||
|
||||
blockWidth = reader.ReadByte();
|
||||
blockHeight = reader.ReadByte();
|
||||
Framerate = reader.ReadByte();
|
||||
cbParts = reader.ReadByte();
|
||||
blocks = new int2(Width / blockWidth, Height / blockHeight);
|
||||
|
||||
|
||||
numColors = reader.ReadUInt16();
|
||||
/*var maxBlocks = */reader.ReadUInt16();
|
||||
/*var unknown1 = */reader.ReadUInt16();
|
||||
/*var unknown2 = */reader.ReadUInt32();
|
||||
|
||||
|
||||
// Audio
|
||||
/*var freq = */reader.ReadUInt16();
|
||||
/*var channels = */reader.ReadByte();
|
||||
/*var bits = */reader.ReadByte();
|
||||
/*var unknown3 = */reader.ReadChars(14);
|
||||
|
||||
|
||||
|
||||
|
||||
var frameSize = Exts.NextPowerOf2(Math.Max(Width,Height));
|
||||
cbf = new byte[Width*Height];
|
||||
cbp = new byte[Width*Height];
|
||||
palette = new uint[numColors];
|
||||
origData = new byte[2*blocks.X*blocks.Y];
|
||||
frameData = new uint[frameSize,frameSize];
|
||||
|
||||
|
||||
var type = new String(reader.ReadChars(4));
|
||||
if (type != "FINF")
|
||||
{
|
||||
reader.ReadBytes(27);
|
||||
type = new String(reader.ReadChars(4));
|
||||
}
|
||||
|
||||
|
||||
/*var length = */reader.ReadUInt16();
|
||||
/*var unknown4 = */reader.ReadUInt16();
|
||||
|
||||
|
||||
// Frame offsets
|
||||
offsets = new UInt32[Frames];
|
||||
for (int i = 0; i < Frames; i++)
|
||||
@@ -111,7 +111,7 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
|
||||
CollectAudioData();
|
||||
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace OpenRA.FileFormats
|
||||
currentFrame = cbOffset = cbChunk = 0;
|
||||
LoadFrame();
|
||||
}
|
||||
|
||||
|
||||
void CollectAudioData()
|
||||
{
|
||||
var ms = new MemoryStream();
|
||||
@@ -163,17 +163,17 @@ namespace OpenRA.FileFormats
|
||||
currentFrame++;
|
||||
LoadFrame();
|
||||
}
|
||||
|
||||
|
||||
void LoadFrame()
|
||||
{
|
||||
{
|
||||
if (currentFrame >= Frames)
|
||||
return;
|
||||
|
||||
|
||||
// Seek to the start of the frame
|
||||
stream.Seek(offsets[currentFrame], SeekOrigin.Begin);
|
||||
BinaryReader reader = new BinaryReader(stream);
|
||||
var end = (currentFrame < Frames - 1) ? offsets[currentFrame+1] : stream.Length;
|
||||
|
||||
|
||||
while(reader.BaseStream.Position < end)
|
||||
{
|
||||
var type = new String(reader.ReadChars(4));
|
||||
@@ -189,17 +189,17 @@ namespace OpenRA.FileFormats
|
||||
reader.ReadBytes((int)length);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Chunks are aligned on even bytes; advance by a byte if the next one is null
|
||||
if (reader.PeekChar() == 0) reader.ReadByte();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// VQA Frame
|
||||
public void DecodeVQFR(BinaryReader reader)
|
||||
{
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
{
|
||||
// Chunks are aligned on even bytes; may be padded with a single null
|
||||
if (reader.PeekChar() == 0) reader.ReadByte();
|
||||
var type = new String(reader.ReadChars(4));
|
||||
@@ -214,9 +214,9 @@ namespace OpenRA.FileFormats
|
||||
case "CBF0":
|
||||
cbf = reader.ReadBytes(subchunkLength);
|
||||
break;
|
||||
|
||||
|
||||
// frame-modifier chunk
|
||||
case "CBP0":
|
||||
case "CBP0":
|
||||
case "CBPZ":
|
||||
// Partial buffer is full; dump and recreate
|
||||
if (cbChunk == cbParts)
|
||||
@@ -225,16 +225,16 @@ namespace OpenRA.FileFormats
|
||||
cbf = (byte[])cbp.Clone();
|
||||
else
|
||||
Format80.DecodeInto( cbp, cbf );
|
||||
|
||||
|
||||
cbOffset = cbChunk = 0;
|
||||
}
|
||||
|
||||
|
||||
var bytes = reader.ReadBytes(subchunkLength);
|
||||
bytes.CopyTo(cbp,cbOffset);
|
||||
cbOffset += subchunkLength;
|
||||
cbChunk++;
|
||||
break;
|
||||
|
||||
|
||||
// Palette
|
||||
case "CPL0":
|
||||
for (int i = 0; i < numColors; i++)
|
||||
@@ -245,7 +245,7 @@ namespace OpenRA.FileFormats
|
||||
palette[i] = (uint)((255 << 24) | (r << 16) | (g << 8) | b);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
// Frame data
|
||||
case "VPTZ":
|
||||
Format80.DecodeInto( reader.ReadBytes(subchunkLength), origData );
|
||||
@@ -256,7 +256,7 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int cachedFrame = -1;
|
||||
|
||||
void DecodeFrameData( int frame )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
if (!Directory.Exists(destPath))
|
||||
Directory.CreateDirectory(destPath);
|
||||
|
||||
|
||||
if (!Directory.Exists(srcPath)) { onError("Cannot find "+package); return false; }
|
||||
FileSystem.Mount(srcPath);
|
||||
if (!FileSystem.Exists(package)) { onError("Cannot find "+package); return false; }
|
||||
@@ -60,7 +60,7 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static bool CopyFiles(string srcPath, string[] files, string destPath, Action<string> onProgress, Action<string> onError)
|
||||
{
|
||||
foreach (var file in files)
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static bool ExtractZip(string zipFile, string dest, Action<string> onProgress, Action<string> onError)
|
||||
{
|
||||
if (!File.Exists(zipFile))
|
||||
@@ -85,7 +85,7 @@ namespace OpenRA.FileFormats
|
||||
onError("Invalid path: "+zipFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
List<string> extracted = new List<string>();
|
||||
try
|
||||
{
|
||||
@@ -96,26 +96,26 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
foreach(var f in extracted)
|
||||
File.Delete(f);
|
||||
|
||||
|
||||
onError("Invalid archive");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// TODO: this belongs in FileSystem/ZipFile
|
||||
static void ExtractZip(this ZipInputStream z, string destPath, List<string> extracted, Action<string> onProgress)
|
||||
{
|
||||
foreach (var entry in z.GetEntries())
|
||||
{
|
||||
if (!entry.IsFile) continue;
|
||||
|
||||
|
||||
onProgress(entry.Name);
|
||||
|
||||
|
||||
Directory.CreateDirectory(Path.Combine(destPath, Path.GetDirectoryName(entry.Name)));
|
||||
var path = Path.Combine(destPath, entry.Name);
|
||||
extracted.Add(path);
|
||||
|
||||
|
||||
using (var f = File.Create(path))
|
||||
{
|
||||
int bufSize = 2048;
|
||||
@@ -124,7 +124,7 @@ namespace OpenRA.FileFormats
|
||||
f.Write(buf, 0, bufSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
z.Close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.FileFormats
|
||||
Movies = YamlList(yaml, "Movies");
|
||||
TileSets = YamlList(yaml, "TileSets");
|
||||
ChromeMetrics = YamlList(yaml, "ChromeMetrics");
|
||||
|
||||
|
||||
LoadScreen = yaml["LoadScreen"];
|
||||
Fonts = yaml["Fonts"].NodesDict.ToDictionary(x => x.Key, x => Pair.New(x.Value.NodesDict["Font"].Value,
|
||||
int.Parse(x.Value.NodesDict["Size"].Value)));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.FileFormats
|
||||
public int InitialCash = 0;
|
||||
public string[] Allies = {};
|
||||
public string[] Enemies = {};
|
||||
|
||||
|
||||
public PlayerReference() {}
|
||||
public PlayerReference(MiniYaml my)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.FileFormats
|
||||
Location = location;
|
||||
Depth = depth;
|
||||
}
|
||||
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return string.Format("{0} {1},{2} {3}", Type, Location.X,Location.Y, Depth);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -18,35 +18,35 @@ namespace OpenRA.FileFormats
|
||||
public readonly List<byte[]> TileBitmapBytes = new List<byte[]>();
|
||||
|
||||
public Terrain( Stream stream, int size )
|
||||
{
|
||||
{
|
||||
// Try loading as a cnc .tem
|
||||
BinaryReader reader = new BinaryReader( stream );
|
||||
int Width = reader.ReadUInt16();
|
||||
int Height = reader.ReadUInt16();
|
||||
|
||||
|
||||
if( Width != size || Height != size )
|
||||
throw new InvalidDataException( "{0}x{1} != {2}x{2}".F(Width, Height, size ) );
|
||||
|
||||
|
||||
/*NumTiles = */reader.ReadUInt16();
|
||||
/*Zero1 = */reader.ReadUInt16();
|
||||
/*Zero1 = */reader.ReadUInt16();
|
||||
/*uint Size = */reader.ReadUInt32();
|
||||
uint ImgStart = reader.ReadUInt32();
|
||||
/*Zero2 = */reader.ReadUInt32();
|
||||
|
||||
|
||||
int IndexEnd, IndexStart;
|
||||
if (reader.ReadUInt16() == 65535) // ID1 = FFFFh for cnc
|
||||
{
|
||||
/*ID2 = */reader.ReadUInt16();
|
||||
/*ID2 = */reader.ReadUInt16();
|
||||
IndexEnd = reader.ReadInt32();
|
||||
IndexStart = reader.ReadInt32();
|
||||
}
|
||||
else // Load as a ra .tem
|
||||
{
|
||||
stream.Position = 0;
|
||||
stream.Position = 0;
|
||||
reader = new BinaryReader( stream );
|
||||
Width = reader.ReadUInt16();
|
||||
Height = reader.ReadUInt16();
|
||||
|
||||
|
||||
/*NumTiles = */reader.ReadUInt16();
|
||||
reader.ReadUInt16();
|
||||
/*XDim = */reader.ReadUInt16();
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.FileFormats
|
||||
reader.ReadUInt32();
|
||||
IndexEnd = reader.ReadInt32();
|
||||
reader.ReadUInt32();
|
||||
IndexStart = reader.ReadInt32();
|
||||
IndexStart = reader.ReadInt32();
|
||||
}
|
||||
stream.Position = IndexStart;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -14,7 +14,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
public T type;
|
||||
public U index;
|
||||
|
||||
|
||||
public TileReference(T t, U i)
|
||||
{
|
||||
type = t;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.FileFormats
|
||||
public TerrainTypeInfo(MiniYaml my) { FieldLoader.Load(this, my); }
|
||||
public MiniYaml Save() { return FieldSaver.Save(this); }
|
||||
}
|
||||
|
||||
|
||||
public class TileTemplate
|
||||
{
|
||||
public ushort Id;
|
||||
@@ -37,7 +37,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
[FieldLoader.LoadUsing( "LoadTiles" )]
|
||||
public Dictionary<byte, string> Tiles = new Dictionary<byte, string>();
|
||||
|
||||
|
||||
public TileTemplate() {}
|
||||
public TileTemplate(MiniYaml my)
|
||||
{
|
||||
@@ -50,7 +50,7 @@ namespace OpenRA.FileFormats
|
||||
t => byte.Parse(t.Key),
|
||||
t => t.Value.Value );
|
||||
}
|
||||
|
||||
|
||||
public MiniYaml Save()
|
||||
{
|
||||
var root = new List<MiniYamlNode>();
|
||||
@@ -63,11 +63,11 @@ namespace OpenRA.FileFormats
|
||||
|
||||
root.Add( new MiniYamlNode( "Tiles", null,
|
||||
Tiles.Select( x => new MiniYamlNode( x.Key.ToString(), x.Value ) ).ToList() ) );
|
||||
|
||||
|
||||
return new MiniYaml(null, root);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class TileSet
|
||||
{
|
||||
public string Name;
|
||||
@@ -84,7 +84,7 @@ namespace OpenRA.FileFormats
|
||||
public TileSet( string filepath )
|
||||
{
|
||||
var yaml = MiniYaml.DictFromFile( filepath );
|
||||
|
||||
|
||||
// General info
|
||||
FieldLoader.Load(this, yaml["General"]);
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace OpenRA.FileFormats
|
||||
Templates = yaml["Templates"].NodesDict.Values
|
||||
.Select(y => new TileTemplate(y)).ToDictionary(t => t.Id);
|
||||
}
|
||||
|
||||
|
||||
public void LoadTiles()
|
||||
{
|
||||
foreach (var t in Templates)
|
||||
@@ -106,9 +106,9 @@ namespace OpenRA.FileFormats
|
||||
Tiles.Add( t.Key, new Terrain( s, TileSize ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Save(string filepath)
|
||||
{
|
||||
{
|
||||
var root = new List<MiniYamlNode>();
|
||||
var gen = new List<MiniYamlNode>();
|
||||
foreach (var field in fields)
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
root.Add( new MiniYamlNode( "General", null, gen ) );
|
||||
|
||||
root.Add( new MiniYamlNode( "Terrain", null,
|
||||
root.Add( new MiniYamlNode( "Terrain", null,
|
||||
Terrain.Select( t => new MiniYamlNode(
|
||||
"TerrainType@{0}".F( t.Value.Type ),
|
||||
t.Value.Save() ) ).ToList() ) );
|
||||
@@ -129,14 +129,14 @@ namespace OpenRA.FileFormats
|
||||
"Template@{0}".F( t.Value.Id ),
|
||||
t.Value.Save() ) ).ToList() ) );
|
||||
root.WriteToFile(filepath);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public byte[] GetBytes(TileReference<ushort,byte> r)
|
||||
{
|
||||
Terrain tile;
|
||||
if( Tiles.TryGetValue( r.type, out tile ) )
|
||||
return tile.TileBitmapBytes[ r.index ];
|
||||
|
||||
|
||||
byte[] missingTile = new byte[ TileSize * TileSize ];
|
||||
for( int i = 0 ; i < missingTile.Length ; i++ )
|
||||
missingTile[ i ] = 0x36;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
return new MiniYaml( null, list.Select( x => new MiniYamlNode( x.ToString(), new MiniYaml( null ) ) ).ToList() );
|
||||
}
|
||||
|
||||
|
||||
static List<MiniYamlNode> FromLines(string[] lines, string filename)
|
||||
{
|
||||
var levels = new List<List<MiniYamlNode>>();
|
||||
@@ -121,7 +121,7 @@ namespace OpenRA.FileFormats
|
||||
var d = new List<MiniYamlNode>();
|
||||
var rhs = SplitAtColon( ref t );
|
||||
levels[ level ].Add( new MiniYamlNode( t, rhs, d, new MiniYamlNode.SourceLocation { Filename = filename, Line = lineNo } ) );
|
||||
|
||||
|
||||
levels.Add(d);
|
||||
}
|
||||
return levels[ 0 ];
|
||||
@@ -143,11 +143,11 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
StreamReader reader = new StreamReader( FileSystem.Open(path) );
|
||||
List<string> lines = new List<string>();
|
||||
|
||||
|
||||
while( !reader.EndOfStream )
|
||||
lines.Add(reader.ReadLine());
|
||||
reader.Close();
|
||||
|
||||
|
||||
return FromLines(lines.ToArray(), path);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
|
||||
public static List<MiniYamlNode> FromFile( string path )
|
||||
{
|
||||
{
|
||||
return FromLines(File.ReadAllLines( path ), path);
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
return string.Join("\n", y.ToLines(true).Select(x => x.TrimEnd()).ToArray());
|
||||
}
|
||||
|
||||
|
||||
public static IEnumerable<string> ToLines(this MiniYamlNodes y, bool lowest)
|
||||
{
|
||||
foreach (var kv in y)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -20,21 +20,21 @@ namespace OpenRA.FileFormats
|
||||
public readonly uint Offset;
|
||||
public readonly uint Length;
|
||||
|
||||
|
||||
|
||||
public PackageEntry(uint hash, uint offset, uint length)
|
||||
{
|
||||
Hash = hash;
|
||||
Offset = offset;
|
||||
Length = length;
|
||||
}
|
||||
|
||||
|
||||
public PackageEntry(BinaryReader r)
|
||||
{
|
||||
Hash = r.ReadUInt32();
|
||||
Offset = r.ReadUInt32();
|
||||
Length = r.ReadUInt32();
|
||||
}
|
||||
|
||||
|
||||
public void Write(BinaryWriter w)
|
||||
{
|
||||
w.Write(Hash);
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.FileFormats
|
||||
MemoryStream ms = new MemoryStream(Encoding.ASCII.GetBytes(name));
|
||||
BinaryReader reader = new BinaryReader(ms);
|
||||
|
||||
int len = name.Length >> 2;
|
||||
int len = name.Length >> 2;
|
||||
uint result = 0;
|
||||
|
||||
while (len-- != 0)
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
|
||||
static Dictionary<uint, string> Names = new Dictionary<uint,string>();
|
||||
|
||||
|
||||
public static void AddStandardName(string s)
|
||||
{
|
||||
uint hash = HashFilename(s);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -23,26 +23,26 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
return Color.FromArgb((int)colors[index]);
|
||||
}
|
||||
|
||||
|
||||
public void SetColor(int index, Color color)
|
||||
{
|
||||
colors[index] = (uint)color.ToArgb();
|
||||
}
|
||||
|
||||
|
||||
public void SetColor(int index, uint color)
|
||||
{
|
||||
colors[index] = (uint)color;
|
||||
}
|
||||
|
||||
|
||||
public uint[] Values
|
||||
{
|
||||
{
|
||||
get { return colors; }
|
||||
}
|
||||
|
||||
public Palette(Stream s, bool remapTransparent)
|
||||
{
|
||||
colors = new uint[256];
|
||||
|
||||
|
||||
using (BinaryReader reader = new BinaryReader(s))
|
||||
{
|
||||
for (int i = 0; i < 256; i++)
|
||||
@@ -69,26 +69,26 @@ namespace OpenRA.FileFormats
|
||||
for(int i = 0; i < 256; i++)
|
||||
colors[i] = (uint)r.GetRemappedColor(Color.FromArgb((int)p.colors[i]),i).ToArgb();
|
||||
}
|
||||
|
||||
|
||||
public Palette(Palette p)
|
||||
{
|
||||
colors = (uint[])p.colors.Clone();
|
||||
}
|
||||
|
||||
|
||||
public ColorPalette AsSystemPalette()
|
||||
{
|
||||
ColorPalette pal;
|
||||
using (var b = new Bitmap(1, 1, PixelFormat.Format8bppIndexed))
|
||||
pal = b.Palette;
|
||||
|
||||
|
||||
for (var i = 0; i < 256; i++)
|
||||
pal.Entries[i] = GetColor(i);
|
||||
|
||||
// hack around a mono bug -- the palette flags get set wrong.
|
||||
if (Platform.CurrentPlatform != PlatformType.Windows)
|
||||
typeof(ColorPalette).GetField("flags",
|
||||
typeof(ColorPalette).GetField("flags",
|
||||
BindingFlags.Instance | BindingFlags.NonPublic).SetValue(pal, 1);
|
||||
|
||||
|
||||
return pal;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA
|
||||
public static PlatformType CurrentPlatform { get { return currentPlatform.Value; } }
|
||||
|
||||
static Lazy<PlatformType> currentPlatform = new Lazy<PlatformType>(GetCurrentPlatform);
|
||||
|
||||
|
||||
static PlatformType GetCurrentPlatform()
|
||||
{
|
||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -42,11 +42,11 @@ namespace OpenRA.FileFormats
|
||||
(int)(t * c2.G + (1 - t) * c1.G),
|
||||
(int)(t * c2.B + (1 - t) * c1.B));
|
||||
}
|
||||
|
||||
|
||||
public Color GetRemappedColor(Color original, int index)
|
||||
{
|
||||
Color c;
|
||||
return remapColors.TryGetValue(index, out c)
|
||||
return remapColors.TryGetValue(index, out c)
|
||||
? c : original;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
|
||||
public T Force() { return Value; }
|
||||
|
||||
|
||||
public void Invalidate()
|
||||
{
|
||||
hasValue = false;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -74,7 +74,7 @@ namespace OpenRA.FileFormats
|
||||
public static class Pair
|
||||
{
|
||||
public static Pair<T, U> New<T, U>(T t, U u) { return new Pair<T, U>(t, u); }
|
||||
|
||||
|
||||
static Pair()
|
||||
{
|
||||
Pair<char,Color>.uc = new ColorEqualityComparer();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -56,7 +56,7 @@ namespace OpenRA
|
||||
public float2 ToFloat2() { return new float2(X, Y); }
|
||||
|
||||
public override string ToString() { return string.Format("{0},{1}", X, Y); }
|
||||
|
||||
|
||||
// Change endianness of a uint32
|
||||
public static uint Swap(uint orig)
|
||||
{
|
||||
@@ -72,13 +72,13 @@ namespace OpenRA
|
||||
{
|
||||
return a + ( b - a ) * mul / div;
|
||||
}
|
||||
|
||||
|
||||
public int2 Clamp(Rectangle r)
|
||||
{
|
||||
return new int2(Math.Min(r.Right, Math.Max(X, r.Left)),
|
||||
Math.Min(r.Bottom, Math.Max(Y, r.Top)));
|
||||
}
|
||||
|
||||
|
||||
public static int Dot(int2 a, int2 b) { return a.X * b.X + a.Y * b.Y; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA
|
||||
get { return LogPathPrefix; }
|
||||
set
|
||||
{
|
||||
LogPathPrefix = value;
|
||||
LogPathPrefix = value;
|
||||
Directory.CreateDirectory(LogPathPrefix);
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA
|
||||
static IEnumerable<string> FilenamesForChannel(string channelName, string baseFilename)
|
||||
{
|
||||
for(var i = 0;; i++ )
|
||||
yield return Path.Combine(LogPathPrefix,
|
||||
yield return Path.Combine(LogPathPrefix,
|
||||
i > 0 ? "{0}.{1}".F(baseFilename, i) : baseFilename);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
6
OpenRA.FileFormats/Thirdparty/Random.cs
vendored
6
OpenRA.FileFormats/Thirdparty/Random.cs
vendored
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -18,11 +18,11 @@ namespace OpenRA.Thirdparty
|
||||
{
|
||||
uint[] mt = new uint[624];
|
||||
int index = 0;
|
||||
|
||||
|
||||
public int Last;
|
||||
|
||||
public Random() : this(Environment.TickCount) { }
|
||||
|
||||
|
||||
public Random(int seed)
|
||||
{
|
||||
mt[0] = (uint)seed;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA
|
||||
public IOccupySpace OccupiesSpace { get { return occupySpace.Value; } }
|
||||
|
||||
public int2 Location { get { return occupySpace.Value.TopLeft; } }
|
||||
|
||||
|
||||
public int2 CenterLocation
|
||||
{
|
||||
get
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA
|
||||
return HasLocation.PxPosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Sync]
|
||||
public Player Owner;
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace OpenRA
|
||||
foreach (var trait in Info.TraitsInConstructOrder())
|
||||
AddTrait(trait.Create(init));
|
||||
}
|
||||
|
||||
|
||||
Move = Lazy.New( () => TraitOrDefault<IMove>() );
|
||||
|
||||
Size = Lazy.New(() =>
|
||||
@@ -88,7 +88,7 @@ namespace OpenRA
|
||||
|
||||
ApplyIRender = x => x.Render(this);
|
||||
ApplyRenderModifier = (m, p) => p.ModifyRender(this, m);
|
||||
|
||||
|
||||
Bounds = Cached.New( () => CalculateBounds(false) );
|
||||
ExtendedBounds = Cached.New( () => CalculateBounds(true) );
|
||||
}
|
||||
@@ -97,7 +97,7 @@ namespace OpenRA
|
||||
{
|
||||
Bounds.Invalidate();
|
||||
ExtendedBounds.Invalidate();
|
||||
|
||||
|
||||
currentActivity = Util.RunActivity( this, currentActivity );
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace OpenRA
|
||||
var sprites = TraitsImplementing<IRender>().SelectMany(ApplyIRender);
|
||||
return mods.Aggregate(sprites, ApplyRenderModifier);
|
||||
}
|
||||
|
||||
|
||||
// When useAltitude = true, the bounding box is extended
|
||||
// vertically to altitude = 0 to support FindUnitsInCircle queries
|
||||
// When false, the bounding box is given for the actor
|
||||
@@ -126,7 +126,7 @@ namespace OpenRA
|
||||
{
|
||||
var size = Size.Value;
|
||||
var loc = CenterLocation - size / 2;
|
||||
|
||||
|
||||
var si = Info.Traits.GetOrDefault<SelectableInfo>();
|
||||
if (si != null && si.Bounds != null && si.Bounds.Length > 2)
|
||||
{
|
||||
@@ -141,7 +141,7 @@ namespace OpenRA
|
||||
if (useAltitude)
|
||||
size = new int2(size.X, size.Y + move.Altitude);
|
||||
}
|
||||
|
||||
|
||||
return new Rectangle(loc.X, loc.Y, size.X, size.Y);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA
|
||||
public U Get<T,U>() where T : IActorInit<U> { return dict.Get<T>().Value( world ); }
|
||||
public bool Contains<T>() where T : IActorInit { return dict.Contains<T>(); }
|
||||
}
|
||||
|
||||
|
||||
public interface IActorInit {}
|
||||
|
||||
public interface IActorInit<T> : IActorInit
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA
|
||||
BottomLeft,
|
||||
BottomRight
|
||||
}
|
||||
|
||||
|
||||
public class ActorMap
|
||||
{
|
||||
class InfluenceNode
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA
|
||||
public SubCell subCell;
|
||||
public Actor actor;
|
||||
}
|
||||
|
||||
|
||||
InfluenceNode[,] influence;
|
||||
Map map;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace OpenRA
|
||||
if (!i.actor.Destroyed)
|
||||
yield return i.actor;
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<Actor> GetUnitsAt( int2 a, SubCell sub )
|
||||
{
|
||||
if (!map.IsInMap(a)) yield break;
|
||||
@@ -65,12 +65,12 @@ namespace OpenRA
|
||||
if (!i.actor.Destroyed && (i.subCell == sub || i.subCell == SubCell.FullCell))
|
||||
yield return i.actor;
|
||||
}
|
||||
|
||||
|
||||
public bool HasFreeSubCell(int2 a)
|
||||
{
|
||||
if (!AnyUnitsAt(a))
|
||||
return true;
|
||||
|
||||
|
||||
return new[]{ SubCell.TopLeft, SubCell.TopRight, SubCell.Center,
|
||||
SubCell.BottomLeft, SubCell.BottomRight }.Any(b => !AnyUnitsAt(a,b));
|
||||
}
|
||||
@@ -79,9 +79,9 @@ namespace OpenRA
|
||||
{
|
||||
return influence[ a.X, a.Y ] != null;
|
||||
}
|
||||
|
||||
|
||||
public bool AnyUnitsAt(int2 a, SubCell sub)
|
||||
{
|
||||
{
|
||||
for( var i = influence[ a.X, a.Y ] ; i != null ; i = i.next )
|
||||
if (i.subCell == sub || i.subCell == SubCell.FullCell)
|
||||
return true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -18,33 +18,33 @@ namespace OpenRA
|
||||
{
|
||||
WebClient wc;
|
||||
bool cancelled;
|
||||
|
||||
|
||||
public Download(string url, string path, Action<DownloadProgressChangedEventArgs> onProgress, Action<AsyncCompletedEventArgs, bool> onComplete)
|
||||
{
|
||||
wc = new WebClient();
|
||||
wc.Proxy = null;
|
||||
|
||||
|
||||
wc.DownloadProgressChanged += (_,a) => onProgress(a);
|
||||
wc.DownloadFileCompleted += (_,a) => onComplete(a, cancelled);
|
||||
|
||||
|
||||
Game.OnQuit += () => Cancel();
|
||||
wc.DownloadFileCompleted += (_,a) => {Game.OnQuit -= () => Cancel();};
|
||||
|
||||
wc.DownloadFileAsync(new Uri(url), path);
|
||||
|
||||
wc.DownloadFileAsync(new Uri(url), path);
|
||||
}
|
||||
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
Game.OnQuit -= () => Cancel();
|
||||
wc.CancelAsync();
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
|
||||
public static string FormatErrorMessage(Exception e)
|
||||
{
|
||||
var ex = e as System.Net.WebException;
|
||||
if (ex == null) return e.Message;
|
||||
|
||||
|
||||
switch(ex.Status)
|
||||
{
|
||||
case WebExceptionStatus.NameResolutionFailure:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Effects
|
||||
{
|
||||
if (!target.IsInWorld)
|
||||
yield break;
|
||||
|
||||
|
||||
if (remainingTicks % 2 == 0)
|
||||
foreach (var r in target.Render())
|
||||
yield return r.WithPalette("highlight");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -55,9 +55,9 @@ namespace OpenRA
|
||||
if( !Directory.Exists( path ) ) Directory.CreateDirectory( path );
|
||||
var replayFile = File.Create( Path.Combine( path, replayFilename ) );
|
||||
|
||||
JoinInner(new OrderManager(host, port,
|
||||
JoinInner(new OrderManager(host, port,
|
||||
new ReplayRecorderConnection(new NetworkConnection(host, port), replayFile)));
|
||||
}
|
||||
}
|
||||
|
||||
static string ChooseReplayFilename()
|
||||
{
|
||||
@@ -90,14 +90,14 @@ namespace OpenRA
|
||||
public static event Action<OrderManager> ConnectionStateChanged = _ => { };
|
||||
static ConnectionState lastConnectionState = ConnectionState.PreConnecting;
|
||||
public static int LocalClientId { get { return orderManager.Connection.LocalClientId; } }
|
||||
|
||||
|
||||
|
||||
|
||||
// Hacky workaround for orderManager visibility
|
||||
public static Widget OpenWindow(World world, string widget)
|
||||
{
|
||||
return Widget.OpenWindow(widget, new WidgetArgs() {{ "world", world }, { "orderManager", orderManager }, { "worldRenderer", worldRenderer }});
|
||||
}
|
||||
|
||||
|
||||
// Who came up with the great idea of making these things
|
||||
// impossible for the things that want them to access them directly?
|
||||
public static Widget OpenWindow(string widget, WidgetArgs args)
|
||||
@@ -109,7 +109,7 @@ namespace OpenRA
|
||||
{ "worldRenderer", worldRenderer },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Load a widget with world, orderManager, worldRenderer args, without adding it to the widget tree
|
||||
public static Widget LoadWidget(World world, string id, Widget parent, WidgetArgs args)
|
||||
{
|
||||
@@ -227,7 +227,7 @@ namespace OpenRA
|
||||
{
|
||||
get { return orderManager.Connection.LocalClientId == 0; }
|
||||
}
|
||||
|
||||
|
||||
public static Dictionary<String, Mod> CurrentMods
|
||||
{
|
||||
get { return Mod.AllMods.Where( k => modData.Manifest.Mods.Contains( k.Key )).ToDictionary( k => k.Key, k => k.Value ); }
|
||||
@@ -242,7 +242,7 @@ namespace OpenRA
|
||||
Console.WriteLine("Platform is {0}", Platform.CurrentPlatform);
|
||||
|
||||
AppDomain.CurrentDomain.AssemblyResolve += FileSystem.ResolveAssembly;
|
||||
|
||||
|
||||
Settings = new Settings(Platform.SupportDir + "settings.yaml", args);
|
||||
Settings.Save();
|
||||
|
||||
@@ -254,15 +254,15 @@ namespace OpenRA
|
||||
FileSystem.Mount("."); // Needed to access shaders
|
||||
Renderer.Initialize( Game.Settings.Graphics.Mode );
|
||||
Renderer = new Renderer();
|
||||
|
||||
|
||||
Console.WriteLine("Available mods:");
|
||||
foreach(var mod in Mod.AllMods)
|
||||
Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Title, mod.Value.Version);
|
||||
|
||||
|
||||
Sound.Create();
|
||||
InitializeWithMods(Settings.Game.Mods);
|
||||
}
|
||||
|
||||
|
||||
public static void InitializeWithMods(string[] mods)
|
||||
{
|
||||
// Clear static state if we have switched mods
|
||||
@@ -277,7 +277,7 @@ namespace OpenRA
|
||||
server.Shutdown();
|
||||
if (orderManager != null)
|
||||
orderManager.Dispose();
|
||||
|
||||
|
||||
// Discard any invalid mods
|
||||
var mm = mods.Where( m => Mod.AllMods.ContainsKey( m ) ).ToArray();
|
||||
Console.WriteLine("Loading mods: {0}",string.Join(",",mm));
|
||||
@@ -287,12 +287,12 @@ namespace OpenRA
|
||||
Sound.StopMusic();
|
||||
Sound.StopVideo();
|
||||
Sound.Initialize();
|
||||
|
||||
|
||||
modData = new ModData( mm );
|
||||
Renderer.InitializeFonts(modData.Manifest);
|
||||
modData.LoadInitialAssets();
|
||||
|
||||
|
||||
|
||||
|
||||
PerfHistory.items["render"].hasNormalTick = false;
|
||||
PerfHistory.items["batches"].hasNormalTick = false;
|
||||
PerfHistory.items["render_widgets"].hasNormalTick = false;
|
||||
@@ -300,23 +300,23 @@ namespace OpenRA
|
||||
|
||||
JoinLocal();
|
||||
viewport = new Viewport(new int2(Renderer.Resolution), Rectangle.Empty, Renderer);
|
||||
|
||||
|
||||
modData.LoadScreen.StartGame();
|
||||
}
|
||||
|
||||
|
||||
public static void LoadShellMap()
|
||||
{
|
||||
StartGame(ChooseShellmap());
|
||||
}
|
||||
|
||||
|
||||
static string ChooseShellmap()
|
||||
{
|
||||
var shellmaps = modData.AvailableMaps
|
||||
.Where(m => m.Value.UseAsShellmap);
|
||||
|
||||
|
||||
if (shellmaps.Count() == 0)
|
||||
throw new InvalidDataException("No valid shellmaps available");
|
||||
|
||||
|
||||
return shellmaps.Random(CosmeticRandom).Key;
|
||||
}
|
||||
|
||||
@@ -336,9 +336,9 @@ namespace OpenRA
|
||||
|
||||
public static void Debug(string s, params object[] args)
|
||||
{
|
||||
AddChatLine(Color.White, "Debug", String.Format(s,args));
|
||||
AddChatLine(Color.White, "Debug", String.Format(s,args));
|
||||
}
|
||||
|
||||
|
||||
public static void Disconnect()
|
||||
{
|
||||
if (orderManager.world != null)
|
||||
@@ -347,7 +347,7 @@ namespace OpenRA
|
||||
JoinLocal();
|
||||
orderManager.Dispose();
|
||||
}
|
||||
|
||||
|
||||
public static void CloseServer()
|
||||
{
|
||||
if (server != null)
|
||||
@@ -358,7 +358,7 @@ namespace OpenRA
|
||||
{
|
||||
return modData.ObjectCreator.CreateObject<T>( name );
|
||||
}
|
||||
|
||||
|
||||
public static void CreateServer(ServerSettings settings)
|
||||
{
|
||||
server = new Server.Server(new IPEndPoint(IPAddress.Any, settings.ListenPort),
|
||||
@@ -366,7 +366,7 @@ namespace OpenRA
|
||||
settings,
|
||||
modData);
|
||||
}
|
||||
|
||||
|
||||
public static int CreateLocalServer(string map)
|
||||
{
|
||||
var settings = new ServerSettings()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -28,16 +28,16 @@ namespace OpenRA.GameRules
|
||||
Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key)+"."+ext;
|
||||
if (!FileSystem.Exists(Filename))
|
||||
return;
|
||||
|
||||
|
||||
Exists = true;
|
||||
Length = (int)AudLoader.SoundLength(FileSystem.Open(Filename));
|
||||
}
|
||||
|
||||
|
||||
public void Reload()
|
||||
{
|
||||
if (!FileSystem.Exists(Filename))
|
||||
return;
|
||||
|
||||
|
||||
Exists = true;
|
||||
Length = (int)AudLoader.SoundLength(FileSystem.Open(Filename));
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA
|
||||
Voices = LoadYamlRules(m.Voices, map.Voices, (k, _) => new VoiceInfo(k.Value));
|
||||
Music = LoadYamlRules(m.Music, new List<MiniYamlNode>(), (k, _) => new MusicInfo(k.Key, k.Value));
|
||||
Movies = LoadYamlRules(m.Movies, new List<MiniYamlNode>(), (k, v) => k.Value.Value);
|
||||
|
||||
|
||||
TileSets = new Dictionary<string, TileSet>();
|
||||
foreach (var file in m.TileSets)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA
|
||||
TileSets.Add(t.Id,t);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static Dictionary<string, T> LoadYamlRules<T>(string[] files, List<MiniYamlNode> dict, Func<MiniYamlNode, Dictionary<string, MiniYaml>, T> f)
|
||||
{
|
||||
var y = files.Select(a => MiniYaml.FromFile(a)).Aggregate(dict,MiniYaml.MergeLiberal);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -98,11 +98,11 @@ namespace OpenRA.GameRules
|
||||
// Internal game settings
|
||||
public int Timestep = 40;
|
||||
}
|
||||
|
||||
|
||||
public class Settings
|
||||
{
|
||||
string SettingsFile;
|
||||
|
||||
|
||||
public PlayerSettings Player = new PlayerSettings();
|
||||
public GameSettings Game = new GameSettings();
|
||||
public SoundSettings Sound = new SoundSettings();
|
||||
@@ -111,7 +111,7 @@ namespace OpenRA.GameRules
|
||||
public DebugSettings Debug = new DebugSettings();
|
||||
public Dictionary<string, object> Sections;
|
||||
public Settings(string file, Arguments args)
|
||||
{
|
||||
{
|
||||
SettingsFile = file;
|
||||
Sections = new Dictionary<string, object>()
|
||||
{
|
||||
@@ -122,46 +122,46 @@ namespace OpenRA.GameRules
|
||||
{"Server", Server},
|
||||
{"Debug", Debug},
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// Override fieldloader to ignore invalid entries
|
||||
var err1 = FieldLoader.UnknownFieldAction;
|
||||
var err2 = FieldLoader.InvalidValueAction;
|
||||
|
||||
|
||||
FieldLoader.UnknownFieldAction = (s,f) =>
|
||||
{
|
||||
Console.WriteLine( "Ignoring unknown field `{0}` on `{1}`".F( s, f.Name ) );
|
||||
};
|
||||
|
||||
|
||||
if (File.Exists(SettingsFile))
|
||||
{
|
||||
//Console.WriteLine("Loading settings file {0}",SettingsFile);
|
||||
var yaml = MiniYaml.DictFromFile(SettingsFile);
|
||||
|
||||
|
||||
foreach (var kv in Sections)
|
||||
if (yaml.ContainsKey(kv.Key))
|
||||
LoadSectionYaml(yaml[kv.Key], kv.Value);
|
||||
}
|
||||
|
||||
|
||||
// Override with commandline args
|
||||
foreach (var kv in Sections)
|
||||
foreach (var f in kv.Value.GetType().GetFields())
|
||||
if (args.Contains(kv.Key+"."+f.Name))
|
||||
FieldLoader.LoadField( kv.Value, f.Name, args.GetValue(kv.Key+"."+f.Name, "") );
|
||||
|
||||
|
||||
FieldLoader.UnknownFieldAction = err1;
|
||||
FieldLoader.InvalidValueAction = err2;
|
||||
}
|
||||
|
||||
|
||||
public void Save()
|
||||
{
|
||||
var root = new List<MiniYamlNode>();
|
||||
foreach( var kv in Sections )
|
||||
root.Add( new MiniYamlNode( kv.Key, FieldSaver.SaveDifferences(kv.Value, Activator.CreateInstance(kv.Value.GetType())) ) );
|
||||
|
||||
|
||||
root.WriteToFile(SettingsFile);
|
||||
}
|
||||
|
||||
|
||||
void LoadSectionYaml(MiniYaml yaml, object section)
|
||||
{
|
||||
object defaults = Activator.CreateInstance(section.GetType());
|
||||
@@ -171,7 +171,7 @@ namespace OpenRA.GameRules
|
||||
System.Console.WriteLine("FieldLoader: Cannot parse `{0}` into `{2}:{1}`; substituting default `{3}`".F(s,t.Name,f,ret) );
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
FieldLoader.Load(section, yaml);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -36,15 +36,15 @@ namespace OpenRA.GameRules
|
||||
public VoiceInfo( MiniYaml y )
|
||||
{
|
||||
FieldLoader.Load( this, y );
|
||||
Variants = Load(y, "Variants");
|
||||
Variants = Load(y, "Variants");
|
||||
Voices = Load(y, "Voices");
|
||||
|
||||
|
||||
if (!Voices.ContainsKey("Attack"))
|
||||
Voices.Add("Attack", Voices["Move"]);
|
||||
|
||||
if (!Voices.ContainsKey("AttackMove"))
|
||||
Voices.Add("AttackMove", Voices["Move"]);
|
||||
|
||||
|
||||
Pools = Lazy.New(() => Voices.ToDictionary( a => a.Key, a => new VoicePool(a.Value) ));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.GameRules
|
||||
public class WarheadInfo
|
||||
{
|
||||
public readonly int Spread = 1; // distance (in pixels) from the explosion center at which damage is 1/2.
|
||||
[FieldLoader.LoadUsing( "LoadVersus" )]
|
||||
[FieldLoader.LoadUsing( "LoadVersus" )]
|
||||
public readonly Dictionary<string, float> Versus; // damage vs each armortype
|
||||
public readonly bool Ore = false; // can this damage ore?
|
||||
public readonly string Explosion = null; // explosion effect to use
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.GameRules
|
||||
if (health == null) return 0f;
|
||||
var armor = self.Info.Traits.GetOrDefault<ArmorInfo>();
|
||||
if (armor == null || armor.Type == null) return 1;
|
||||
|
||||
|
||||
float versus;
|
||||
return Versus.TryGetValue(armor.Type, out versus) ? versus : 1;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.GameRules
|
||||
{
|
||||
FieldLoader.Load( this, yaml );
|
||||
}
|
||||
|
||||
|
||||
static object LoadVersus( MiniYaml y )
|
||||
{
|
||||
return y.NodesDict.ContainsKey( "Versus" )
|
||||
@@ -59,7 +59,7 @@ namespace OpenRA.GameRules
|
||||
: new Dictionary<string, float>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public enum DamageModel
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -136,7 +136,7 @@ namespace OpenRA.Graphics
|
||||
public void ChangeImage(string newImage, string newAnimIfMissing)
|
||||
{
|
||||
newImage = newImage.ToLowerInvariant();
|
||||
|
||||
|
||||
if (name != newImage)
|
||||
{
|
||||
name = newImage.ToLowerInvariant();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Graphics
|
||||
public string src;
|
||||
public Dictionary<string, MappedImage> regions;
|
||||
}
|
||||
|
||||
|
||||
static Dictionary<string, Collection> collections;
|
||||
static Dictionary<string, Sheet> cachedSheets;
|
||||
static Dictionary<string, Dictionary<string, Sprite>> cachedSprites;
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Graphics
|
||||
collections = new Dictionary<string, Collection>();
|
||||
cachedSheets = new Dictionary<string, Sheet>();
|
||||
cachedSprites = new Dictionary<string, Dictionary<string, Sprite>>();
|
||||
|
||||
|
||||
if (chromeFiles.Length == 0)
|
||||
return;
|
||||
|
||||
@@ -41,34 +41,34 @@ namespace OpenRA.Graphics
|
||||
foreach (var c in chrome)
|
||||
LoadCollection(c.Key, c.Value);
|
||||
}
|
||||
|
||||
|
||||
public static void Save(string file)
|
||||
{
|
||||
var root = new List<MiniYamlNode>();
|
||||
foreach (var kv in collections)
|
||||
root.Add(new MiniYamlNode(kv.Key, SaveCollection(kv.Value)));
|
||||
|
||||
|
||||
root.WriteToFile(file);
|
||||
}
|
||||
|
||||
|
||||
static MiniYaml SaveCollection(Collection collection)
|
||||
{
|
||||
var root = new List<MiniYamlNode>();
|
||||
foreach (var kv in collection.regions)
|
||||
root.Add(new MiniYamlNode(kv.Key, kv.Value.Save(collection.src)));
|
||||
|
||||
|
||||
return new MiniYaml(collection.src, root);
|
||||
}
|
||||
|
||||
static void LoadCollection(string name, MiniYaml yaml)
|
||||
{
|
||||
Game.modData.LoadScreen.Display();
|
||||
Game.modData.LoadScreen.Display();
|
||||
var collection = new Collection()
|
||||
{
|
||||
src = yaml.Value,
|
||||
regions = yaml.Nodes.ToDictionary(n => n.Key, n => new MappedImage(yaml.Value, n.Value))
|
||||
};
|
||||
|
||||
|
||||
collections.Add(name, collection);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace OpenRA.Graphics
|
||||
throw new InvalidOperationException(
|
||||
"Collection `{0}` does not have an image `{1}`".F(collection, image));
|
||||
}
|
||||
|
||||
|
||||
// Cached sheet
|
||||
Sheet sheet;
|
||||
if (cachedSheets.ContainsKey(mi.src))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -20,12 +20,12 @@ namespace OpenRA.Graphics
|
||||
public static class CursorProvider
|
||||
{
|
||||
static Dictionary<string, CursorSequence> cursors;
|
||||
|
||||
|
||||
public static void Initialize(string[] sequenceFiles)
|
||||
{
|
||||
{
|
||||
cursors = new Dictionary<string, CursorSequence>();
|
||||
var sequences = new MiniYaml(null, sequenceFiles.Select(s => MiniYaml.FromFile(s)).Aggregate(MiniYaml.MergeLiberal));
|
||||
|
||||
|
||||
foreach (var s in sequences.NodesDict["Palettes"].Nodes)
|
||||
Game.modData.Palette.AddPalette(s.Key, new Palette(FileSystem.Open(s.Value.Value), false));
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Graphics
|
||||
foreach (var sequence in cursor.Nodes)
|
||||
cursors.Add(sequence.Key, new CursorSequence(cursorSrc, cursor.Value, sequence.Value));
|
||||
}
|
||||
|
||||
|
||||
public static bool HasCursorSequence(string cursor)
|
||||
{
|
||||
return cursors.ContainsKey(cursor);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
start = int.Parse(d["start"].Value);
|
||||
this.palette = palette;
|
||||
|
||||
|
||||
if ((d.ContainsKey("length") && d["length"].Value == "*") || (d.ContainsKey("end") && d["end"].Value == "*"))
|
||||
length = sprites.Length - start;
|
||||
else if (d.ContainsKey("length"))
|
||||
@@ -42,7 +42,7 @@ namespace OpenRA.Graphics
|
||||
length = int.Parse(d["end"].Value) - start;
|
||||
else
|
||||
length = 1;
|
||||
|
||||
|
||||
if (d.ContainsKey("x"))
|
||||
int.TryParse(d["x"].Value, out Hotspot.X );
|
||||
if (d.ContainsKey("y"))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -21,18 +21,18 @@ namespace OpenRA.Graphics
|
||||
{
|
||||
public const int MaxPalettes = 256;
|
||||
int allocated = 0;
|
||||
|
||||
|
||||
ITexture texture;
|
||||
Dictionary<string, Palette> palettes;
|
||||
Dictionary<string, int> indices;
|
||||
|
||||
|
||||
public HardwarePalette()
|
||||
{
|
||||
palettes = new Dictionary<string, Palette>();
|
||||
indices = new Dictionary<string, int>();
|
||||
texture = Game.Renderer.Device.CreateTexture();
|
||||
}
|
||||
|
||||
|
||||
public Palette GetPalette(string name)
|
||||
{
|
||||
Palette ret;
|
||||
@@ -48,12 +48,12 @@ namespace OpenRA.Graphics
|
||||
throw new InvalidOperationException("Palette `{0}` does not exist".F(name));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public void AddPalette(string name, Palette p)
|
||||
{
|
||||
if (palettes.ContainsKey(name))
|
||||
throw new InvalidOperationException("Palette {0} has already been defined".F(name));
|
||||
|
||||
|
||||
palettes.Add(name, p);
|
||||
indices.Add(name, allocated++);
|
||||
}
|
||||
@@ -62,10 +62,10 @@ namespace OpenRA.Graphics
|
||||
public void Update(IEnumerable<IPaletteModifier> paletteMods)
|
||||
{
|
||||
var copy = palettes.ToDictionary(p => p.Key, p => new Palette(p.Value));
|
||||
|
||||
|
||||
foreach (var mod in paletteMods)
|
||||
mod.AdjustPalette(copy);
|
||||
|
||||
|
||||
foreach (var pal in copy)
|
||||
{
|
||||
var j = indices[pal.Key];
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Graphics
|
||||
for (var i = 0; i < 256; i++)
|
||||
data[j,i] = c[i];
|
||||
}
|
||||
|
||||
|
||||
// Doesn't work
|
||||
texture.SetData(data);
|
||||
Game.Renderer.PaletteTexture = texture;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -71,7 +71,7 @@ namespace OpenRA.Graphics
|
||||
new float2( endColor.R / 255.0f, endColor.G / 255.0f ),
|
||||
new float2( endColor.B / 255.0f, endColor.A / 255.0f ) );
|
||||
}
|
||||
|
||||
|
||||
public void FillRect( RectangleF r, Color color )
|
||||
{
|
||||
for (float y = r.Top; y < r.Bottom; y++)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user