Create valid maps for custom tilesets

This commit is contained in:
Paul Chote
2010-09-15 19:27:39 +12:00
parent 051c451867
commit 303613b052
7 changed files with 17 additions and 33 deletions

View File

@@ -362,13 +362,12 @@ namespace OpenRA.Editor
if (DialogResult.OK == nmd.ShowDialog())
{
var map = new Map();
var map = new Map(nmd.theater.SelectedItem as string);
map.Resize((int)nmd.width.Value, (int)nmd.height.Value);
map.TopLeft = new int2((int)nmd.cordonLeft.Value, (int)nmd.cordonTop.Value);
map.BottomRight = new int2((int)nmd.cordonRight.Value, (int)nmd.cordonBottom.Value);
map.Tileset = nmd.theater.SelectedItem as string;
map.Players.Add("Neutral", new PlayerReference("Neutral", Rules.Info["world"].Traits.WithInterface<CountryInfo>().First().Race, true, true));
NewMap(map);
}

View File

@@ -62,14 +62,22 @@ namespace OpenRA
public Rectangle Bounds { get { return Rectangle.FromLTRB(TopLeft.X, TopLeft.Y, BottomRight.X, BottomRight.Y); } }
public Map()
{
// Do nothing; not a valid map (editor hack)
}
public Map(string tileset)
{
MapSize = new int2(1, 1);
Tileset = tileset;
MapResources = new TileReference<byte, byte>[1, 1];
MapTiles = new TileReference<ushort, byte>[1, 1]
{ { new TileReference<ushort, byte> {
type = (ushort)0xffffu,
image = (byte)0xffu,
index = (byte)0xffu } } };
var tile = OpenRA.Rules.TileSets[Tileset].Templates.First();
MapTiles = new TileReference<ushort, byte>[1, 1]
{ { new TileReference<ushort, byte> {
type = tile.Key,
image = (byte)(tile.Value.PickAny ? 0xffu : 0),
index = (byte)(tile.Value.PickAny ? 0xffu : 0) } } };
PlayerCount = 0;
TopLeft = new int2(0, 0);

Binary file not shown.

View File

@@ -1 +1 @@
899fa73ce1ffd82799e84b63256930514db5e048
1e36d6874ef7960ac0e21edf36bbe1490a4650eb

View File

@@ -32,27 +32,11 @@ Players:
InitialCash: 0
Allies:
Enemies:
PlayerReference@Multi0:
Name: Multi0
Palette:
Race: Random
OwnsWorld: False
NonCombatant: False
Playable: True
DefaultStartingUnits: True
Color: 255,238,238,238
Color2: 255,44,28,24
InitialCash: 0
Allies:
Enemies:
Actors:
Actor0: mcv
Location: 16,17
Owner: Neutral
Waypoints:
wp0: 18,18
wp0: 20,20
Smudges:

View File

@@ -33,5 +33,5 @@ TileSets:
Music:
Movies:
LoadScreen: NullLoadScreen
ShellmapUid:899fa73ce1ffd82799e84b63256930514db5e048
ShellmapUid:1e36d6874ef7960ac0e21edf36bbe1490a4650eb
TileSize:32

View File

@@ -14,13 +14,6 @@ Terrain:
Color: 255,255,255,255
Templates:
Template@65535:
Id: 65535
Image: t00
Size: 1,1
PickAny: False
Tiles:
0: Clear
Template@0:
Id: 0
Image: t00