working toward something sane
This commit is contained in:
3
OpenRA.Editor/Form1.Designer.cs
generated
3
OpenRA.Editor/Form1.Designer.cs
generated
@@ -95,13 +95,10 @@
|
|||||||
this.surface1.BackColor = System.Drawing.Color.Black;
|
this.surface1.BackColor = System.Drawing.Color.Black;
|
||||||
this.surface1.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.surface1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.surface1.Location = new System.Drawing.Point(0, 0);
|
this.surface1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.surface1.Map = null;
|
|
||||||
this.surface1.Name = "surface1";
|
this.surface1.Name = "surface1";
|
||||||
this.surface1.Palette = null;
|
|
||||||
this.surface1.Size = new System.Drawing.Size(783, 680);
|
this.surface1.Size = new System.Drawing.Size(783, 680);
|
||||||
this.surface1.TabIndex = 2;
|
this.surface1.TabIndex = 2;
|
||||||
this.surface1.Text = "surface1";
|
this.surface1.Text = "surface1";
|
||||||
this.surface1.TileSet = null;
|
|
||||||
//
|
//
|
||||||
// tt
|
// tt
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -15,7 +15,14 @@ namespace OpenRA.Editor
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
LocateGameRoot();
|
LocateGameRoot();
|
||||||
|
|
||||||
var mods = new[] { "ra" };
|
LoadMap("ra", "mjolnir");
|
||||||
|
}
|
||||||
|
|
||||||
|
void LoadMap(string mod, string mapname)
|
||||||
|
{
|
||||||
|
tilePalette.Controls.Clear();
|
||||||
|
|
||||||
|
var mods = new[] { mod };
|
||||||
|
|
||||||
var manifest = new Manifest(mods);
|
var manifest = new Manifest(mods);
|
||||||
|
|
||||||
@@ -23,7 +30,7 @@ namespace OpenRA.Editor
|
|||||||
foreach (var pkg in manifest.Packages) FileSystem.Mount(pkg);
|
foreach (var pkg in manifest.Packages) FileSystem.Mount(pkg);
|
||||||
|
|
||||||
// load the map
|
// load the map
|
||||||
var map = new Map(new Folder("mods/ra/maps/scm01ea"));
|
var map = new Map(new Folder("mods/{0}/maps/{1}".F(mod, mapname)));
|
||||||
|
|
||||||
// we're also going to need a tileset...
|
// we're also going to need a tileset...
|
||||||
var tsinfo = fileMapping[Pair.New(mods[0], map.Theater)];
|
var tsinfo = fileMapping[Pair.New(mods[0], map.Theater)];
|
||||||
@@ -31,9 +38,7 @@ namespace OpenRA.Editor
|
|||||||
|
|
||||||
var palette = new Palette(FileSystem.Open(map.Theater.ToLowerInvariant() + ".pal"), true);
|
var palette = new Palette(FileSystem.Open(map.Theater.ToLowerInvariant() + ".pal"), true);
|
||||||
|
|
||||||
surface1.TileSet = tileset;
|
surface1.Bind(map, tileset, palette);
|
||||||
surface1.Map = map;
|
|
||||||
surface1.Palette = palette;
|
|
||||||
|
|
||||||
// construct the palette of tiles
|
// construct the palette of tiles
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,27 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using System;
|
|
||||||
using System.Drawing.Imaging;
|
|
||||||
|
|
||||||
namespace OpenRA.Editor
|
namespace OpenRA.Editor
|
||||||
{
|
{
|
||||||
class Surface : Control
|
class Surface : Control
|
||||||
{
|
{
|
||||||
public Map Map { get; set; }
|
Map Map;
|
||||||
public TileSet TileSet { get; set; }
|
TileSet TileSet;
|
||||||
public Palette Palette { get; set; }
|
Palette Palette;
|
||||||
public int2 Offset { get; set; }
|
int2 Offset;
|
||||||
public Pair<ushort, Bitmap> Brush { get; set; }
|
public Pair<ushort, Bitmap> Brush;
|
||||||
|
|
||||||
|
public void Bind(Map m, TileSet ts, Palette p)
|
||||||
|
{
|
||||||
|
Map = m;
|
||||||
|
TileSet = ts;
|
||||||
|
Palette = p;
|
||||||
|
Brush = Pair.New((ushort)0, null as Bitmap);
|
||||||
|
Chunks.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary<int2, Bitmap> Chunks = new Dictionary<int2, Bitmap>();
|
Dictionary<int2, Bitmap> Chunks = new Dictionary<int2, Bitmap>();
|
||||||
|
|
||||||
@@ -127,8 +135,8 @@ namespace OpenRA.Editor
|
|||||||
if (Map == null) return;
|
if (Map == null) return;
|
||||||
if (TileSet == null) return;
|
if (TileSet == null) return;
|
||||||
|
|
||||||
for( var u = Map.TopLeft.X - Map.TopLeft.X % ChunkSize; u <= Map.BottomRight.X; u += ChunkSize )
|
for( var u = 0; u <= Map.BottomRight.X; u += ChunkSize )
|
||||||
for (var v = Map.TopLeft.Y - Map.TopLeft.Y % ChunkSize; v <= Map.BottomRight.Y; v += ChunkSize)
|
for (var v = 0; v <= Map.BottomRight.Y; v += ChunkSize)
|
||||||
{
|
{
|
||||||
var x = new int2(u/ChunkSize,v/ChunkSize);
|
var x = new int2(u/ChunkSize,v/ChunkSize);
|
||||||
if (!Chunks.ContainsKey(x)) Chunks[x] = RenderChunk(u / ChunkSize, v / ChunkSize);
|
if (!Chunks.ContainsKey(x)) Chunks[x] = RenderChunk(u / ChunkSize, v / ChunkSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user