Fix most of the x/y issues
This commit is contained in:
@@ -92,9 +92,10 @@ namespace MapConverter
|
||||
Height = int.Parse(map.GetValue("Height", "0"));
|
||||
MapSize = (INIFormat == 3) ? 128 : 64;
|
||||
|
||||
Map.Size.X = MapSize;
|
||||
Map.Size.Y = MapSize;
|
||||
Map.Bounds = new int[] {XOffset, YOffset, Width, Height};
|
||||
Map.MapSize.X = MapSize;
|
||||
Map.MapSize.Y = MapSize;
|
||||
Map.TopLeft = new int2 (XOffset, YOffset);
|
||||
Map.BottomRight = new int2(XOffset+Width,YOffset+Height);
|
||||
|
||||
if (INIFormat == 3) // RA map
|
||||
{
|
||||
@@ -184,28 +185,28 @@ namespace MapConverter
|
||||
void UnpackRATileData( MemoryStream ms )
|
||||
{
|
||||
Map.MapTiles = new TileReference<ushort, byte>[ MapSize, MapSize ];
|
||||
for( int i = 0 ; i < MapSize ; i++ )
|
||||
for( int j = 0 ; j < MapSize ; j++ )
|
||||
Map.MapTiles[j, i] = new TileReference<ushort,byte>();
|
||||
for( int j = 0 ; j < MapSize ; j++ )
|
||||
for( int i = 0 ; i < MapSize ; i++ )
|
||||
Map.MapTiles[i,j] = new TileReference<ushort,byte>();
|
||||
|
||||
for( int i = 0 ; i < MapSize ; i++ )
|
||||
for( int j = 0 ; j < MapSize ; j++ )
|
||||
Map.MapTiles[j, i].type = ReadWord(ms);
|
||||
for( int j = 0 ; j < MapSize ; j++ )
|
||||
for( int i = 0 ; i < MapSize ; i++ )
|
||||
Map.MapTiles[i,j].type = ReadWord(ms);
|
||||
|
||||
for( int i = 0 ; i < MapSize ; i++ )
|
||||
for( int j = 0 ; j < MapSize ; j++ )
|
||||
for( int j = 0 ; j < MapSize ; j++ )
|
||||
for( int i = 0 ; i < MapSize ; i++ )
|
||||
{
|
||||
Map.MapTiles[j, i].index = (byte)ms.ReadByte();
|
||||
if( Map.MapTiles[ j, i ].type == 0xff || Map.MapTiles[ j, i ].type == 0xffff )
|
||||
Map.MapTiles[ j, i ].index = byte.MaxValue;
|
||||
Map.MapTiles[i,j].index = (byte)ms.ReadByte();
|
||||
if( Map.MapTiles[i,j].type == 0xff || Map.MapTiles[i,j].type == 0xffff )
|
||||
Map.MapTiles[i,j].index = byte.MaxValue;
|
||||
}
|
||||
}
|
||||
|
||||
void UnpackRAOverlayData( MemoryStream ms )
|
||||
{
|
||||
Map.MapResources = new TileReference<byte, byte>[ MapSize, MapSize ];
|
||||
for( int i = 0 ; i < MapSize ; i++ )
|
||||
for( int j = 0 ; j < MapSize ; j++ )
|
||||
for( int j = 0 ; j < MapSize ; j++ )
|
||||
for( int i = 0 ; i < MapSize ; i++ )
|
||||
{
|
||||
byte o = ReadByte( ms );
|
||||
var res = Pair.New((byte)0,(byte)0);
|
||||
@@ -213,7 +214,7 @@ namespace MapConverter
|
||||
if (o != 255 && resourceMapping.ContainsKey(raOverlayNames[o]))
|
||||
res = resourceMapping[raOverlayNames[o]];
|
||||
|
||||
Map.MapResources[j, i] = new TileReference<byte,byte>(res.First, res.Second);
|
||||
Map.MapResources[i,j] = new TileReference<byte,byte>(res.First, res.Second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region Copyright & License Information
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||
* This file is part of OpenRA.
|
||||
@@ -30,8 +30,8 @@ namespace OpenRA.FileFormats
|
||||
|
||||
public static int[,] Extract(Map m, Func<int, int, int> f)
|
||||
{
|
||||
var result = new int[m.MapSize, m.MapSize];
|
||||
var types = new int[m.MapSize, m.MapSize];
|
||||
var result = new int[m.MapSize.X, m.MapSize.Y];
|
||||
var types = new int[m.MapSize.X, m.MapSize.Y];
|
||||
var d = new Dictionary<int, Node>();
|
||||
var n = 1;
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace OpenRA.FileFormats
|
||||
public string Author;
|
||||
public int PlayerCount;
|
||||
public string Preview;
|
||||
public int[] Bounds;
|
||||
public string Tileset;
|
||||
|
||||
public Dictionary<string, ActorReference> Actors = new Dictionary<string, ActorReference>();
|
||||
@@ -46,26 +45,25 @@ namespace OpenRA.FileFormats
|
||||
// Binary map data
|
||||
public string Tiledata;
|
||||
public byte TileFormat = 1;
|
||||
public int2 Size;
|
||||
public int2 MapSize;
|
||||
|
||||
public int2 TopLeft;
|
||||
public int2 BottomRight;
|
||||
|
||||
public TileReference<ushort,byte>[ , ] MapTiles;
|
||||
public TileReference<byte, byte>[ , ] MapResources;
|
||||
|
||||
|
||||
// Temporary compat hacks
|
||||
public int MapSize {get {return Size.X;}}
|
||||
public int XOffset {get {return Bounds[0];}}
|
||||
public int YOffset {get {return Bounds[1];}}
|
||||
public int2 Offset { get { return new int2( Bounds[0], Bounds[1] ); } }
|
||||
public int Width {get {return Bounds[2];}}
|
||||
public int Height {get {return Bounds[3];}}
|
||||
public int XOffset {get {return TopLeft.X;}}
|
||||
public int YOffset {get {return TopLeft.Y;}}
|
||||
public int Width {get {return BottomRight.X-TopLeft.X;}}
|
||||
public int Height {get {return BottomRight.Y-TopLeft.Y;}}
|
||||
public string Theater {get {return Tileset;}}
|
||||
public IEnumerable<int2> SpawnPoints {get {return Waypoints.Select(kv => kv.Value);}}
|
||||
|
||||
|
||||
|
||||
|
||||
List<string> SimpleFields = new List<string>() {
|
||||
"MapFormat", "Title", "Description", "Author", "PlayerCount", "Tileset", "Tiledata", "Preview", "Size", "Bounds"
|
||||
"MapFormat", "Title", "Description", "Author", "PlayerCount", "Tileset", "Tiledata", "Preview", "MapSize", "TopLeft", "BottomRight"
|
||||
};
|
||||
|
||||
public Map() {}
|
||||
@@ -150,26 +148,26 @@ namespace OpenRA.FileFormats
|
||||
|
||||
// Load header info
|
||||
byte version = ReadByte(dataStream);
|
||||
Size.X = ReadWord(dataStream);
|
||||
Size.Y = ReadWord(dataStream);
|
||||
MapSize.X = ReadWord(dataStream);
|
||||
MapSize.Y = ReadWord(dataStream);
|
||||
|
||||
MapTiles = new TileReference<ushort, byte>[ Size.X, Size.Y ];
|
||||
MapResources = new TileReference<byte, byte>[ Size.X, Size.Y ];
|
||||
MapTiles = new TileReference<ushort, byte>[ MapSize.X, MapSize.Y ];
|
||||
MapResources = new TileReference<byte, byte>[ MapSize.X, MapSize.Y ];
|
||||
|
||||
// Load tile data
|
||||
for( int i = 0 ; i < Size.X ; i++ )
|
||||
for( int j = 0 ; j < Size.Y ; j++ )
|
||||
for( int i = 0 ; i < MapSize.X ; i++ )
|
||||
for( int j = 0 ; j < MapSize.Y ; j++ )
|
||||
{
|
||||
ushort tile = ReadWord(dataStream);
|
||||
byte index = ReadByte(dataStream);
|
||||
byte image = (index == byte.MaxValue) ? (byte)( i % 4 + ( j % 4 ) * 4 ) : index;
|
||||
MapTiles[i, j] = new TileReference<ushort,byte>(tile,index, image);
|
||||
MapTiles[i,j] = new TileReference<ushort,byte>(tile,index, image);
|
||||
}
|
||||
|
||||
// Load resource data
|
||||
for( int i = 0 ; i < Size.X ; i++ )
|
||||
for( int j = 0 ; j < Size.Y ; j++ )
|
||||
MapResources[i, j] = new TileReference<byte,byte>(ReadByte(dataStream),ReadByte(dataStream));
|
||||
for( int i = 0 ; i < MapSize.X ; i++ )
|
||||
for( int j = 0 ; j < MapSize.Y ; j++ )
|
||||
MapResources[i,j] = new TileReference<byte,byte>(ReadByte(dataStream),ReadByte(dataStream));
|
||||
}
|
||||
|
||||
public void SaveBinaryData(string filepath)
|
||||
@@ -180,23 +178,23 @@ namespace OpenRA.FileFormats
|
||||
|
||||
// File header consists of a version byte, followed by 2 ushorts for width and height
|
||||
writer.Write(TileFormat);
|
||||
writer.Write((ushort)Size.X);
|
||||
writer.Write((ushort)Size.Y);
|
||||
writer.Write((ushort)MapSize.X);
|
||||
writer.Write((ushort)MapSize.Y);
|
||||
|
||||
// Tile data
|
||||
for( int i = 0 ; i < Size.X ; i++ )
|
||||
for( int j = 0 ; j < Size.Y ; j++ )
|
||||
for( int i = 0 ; i < MapSize.X ; i++ )
|
||||
for( int j = 0 ; j < MapSize.Y ; j++ )
|
||||
{
|
||||
writer.Write( MapTiles[j,i].type );
|
||||
writer.Write( MapTiles[ j, i ].index );
|
||||
writer.Write( MapTiles[i,j].type );
|
||||
writer.Write( MapTiles[i,j].index );
|
||||
}
|
||||
|
||||
// Resource data
|
||||
for( int i = 0 ; i < Size.X ; i++ )
|
||||
for( int j = 0 ; j < Size.Y ; j++ )
|
||||
for( int i = 0 ; i < MapSize.X ; i++ )
|
||||
for( int j = 0 ; j < MapSize.Y ; j++ )
|
||||
{
|
||||
writer.Write( MapResources[j,i].type );
|
||||
writer.Write( MapResources[j,i].index );
|
||||
writer.Write( MapResources[i,j].type );
|
||||
writer.Write( MapResources[i,j].index );
|
||||
}
|
||||
|
||||
writer.Flush();
|
||||
@@ -211,7 +209,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
public bool IsInMap(int x, int y)
|
||||
{
|
||||
return (x >= Bounds[0] && y >= Bounds[1] && x < Bounds[0] + Bounds[2] && y < Bounds[1] + Bounds[3]);
|
||||
return (x >= TopLeft.X && y >= TopLeft.Y && x < BottomRight.X && y < BottomRight.Y);
|
||||
}
|
||||
|
||||
public void DebugContents()
|
||||
|
||||
@@ -317,8 +317,8 @@ namespace OpenRA
|
||||
|
||||
if (mapPreviewDirty)
|
||||
{
|
||||
if (mapChooserSheet == null || mapChooserSheet.Size.Width != currentMap.Map.MapSize)
|
||||
mapChooserSheet = new Sheet(renderer, new Size(currentMap.Map.MapSize, currentMap.Map.MapSize));
|
||||
if (mapChooserSheet == null || mapChooserSheet.Size.Width != currentMap.Map.MapSize.X || mapChooserSheet.Size.Height != currentMap.Map.MapSize.Y)
|
||||
mapChooserSheet = new Sheet(renderer, new Size(currentMap.Map.MapSize.X, currentMap.Map.MapSize.Y));
|
||||
|
||||
var b = Minimap.RenderTerrainBitmapWithSpawnPoints(currentMap.Map, Game.world.TileSet); // tileset -> hack
|
||||
mapChooserSheet.Texture.SetData(b);
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace OpenRA
|
||||
Timer.Time( "world: {0}" );
|
||||
|
||||
SequenceProvider.Initialize(manifest.Sequences);
|
||||
viewport = new Viewport(clientSize, Game.world.Map.Offset, Game.world.Map.Offset + Game.world.Map.Size, renderer);
|
||||
viewport = new Viewport(clientSize, Game.world.Map.TopLeft, Game.world.Map.BottomRight, renderer);
|
||||
Timer.Time( "ChromeProv, SeqProv, viewport: {0}" );
|
||||
|
||||
chrome = new Chrome(renderer, manifest);
|
||||
|
||||
@@ -47,8 +47,8 @@ namespace OpenRA.Graphics
|
||||
public Minimap(World world, Renderer r)
|
||||
{
|
||||
this.world = world;
|
||||
sheet = new Sheet(r, new Size(world.Map.MapSize, world.Map.MapSize));
|
||||
mapOnlySheet = new Sheet(r, new Size(world.Map.MapSize, world.Map.MapSize));
|
||||
sheet = new Sheet(r, new Size(world.Map.MapSize.X, world.Map.MapSize.Y));
|
||||
mapOnlySheet = new Sheet(r, new Size(world.Map.MapSize.X, world.Map.MapSize.Y));
|
||||
|
||||
lineRenderer = new LineRenderer(r);
|
||||
rgbaRenderer = new SpriteRenderer(r, true, r.RgbaSpriteShader);
|
||||
@@ -56,7 +56,7 @@ namespace OpenRA.Graphics
|
||||
var dw = (size - world.Map.Width) / 2;
|
||||
var dh = (size - world.Map.Height) / 2;
|
||||
|
||||
bounds = new Rectangle(world.Map.Offset.X - dw, world.Map.Offset.Y - dh, size, size);
|
||||
bounds = new Rectangle(world.Map.TopLeft.X - dw, world.Map.TopLeft.Y - dh, size, size);
|
||||
|
||||
sprite = new Sprite(sheet, bounds, TextureChannel.Alpha);
|
||||
mapOnlySprite = new Sprite(mapOnlySheet, bounds, TextureChannel.Alpha);
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Graphics
|
||||
var dw = (size - m.Width) / 2;
|
||||
var dh = (size - m.Height) / 2;
|
||||
|
||||
return new Rectangle(m.Offset.X - dw, m.Offset.Y - dh, size, size);
|
||||
return new Rectangle(m.TopLeft.X - dw, m.TopLeft.Y - dh, size, size);
|
||||
}
|
||||
|
||||
static Cache<string, TerrainColorSet> terrainTypeColors = new Cache<string, TerrainColorSet>(
|
||||
@@ -88,9 +88,9 @@ namespace OpenRA.Graphics
|
||||
|
||||
public static Bitmap RenderTerrainBitmap(Map map, TileSet tileset)
|
||||
{
|
||||
var terrain = new Bitmap(map.MapSize, map.MapSize);
|
||||
for (var y = 0; y < map.MapSize; y++)
|
||||
for (var x = 0; x < map.MapSize; x++)
|
||||
var terrain = new Bitmap(map.MapSize.X, map.MapSize.Y);
|
||||
for (var y = 0; y < map.MapSize.Y; y++)
|
||||
for (var x = 0; x < map.MapSize.X; x++)
|
||||
terrain.SetPixel(x, y, map.IsInMap(x, y)
|
||||
? Color.FromArgb(alpha, terrainTypeColors[map.Theater].ColorForTerrainType(tileset.GetTerrainType(map.MapTiles[x, y])))
|
||||
: shroudColor);
|
||||
@@ -117,8 +117,8 @@ namespace OpenRA.Graphics
|
||||
var res = world.WorldActor.traits.Get<ResourceLayer>();
|
||||
|
||||
oreLayer = new Bitmap(terrain);
|
||||
for (var y = world.Map.YOffset; y < world.Map.YOffset + world.Map.Height; y++)
|
||||
for (var x = world.Map.XOffset; x < world.Map.XOffset + world.Map.Width; x++)
|
||||
for (var y = world.Map.TopLeft.Y; y < world.Map.BottomRight.Y; y++)
|
||||
for (var x = world.Map.TopLeft.X; x < world.Map.BottomRight.X; x++)
|
||||
if (res.GetResource(new int2(x,y)) != null)
|
||||
oreLayer.SetPixel(x, y, Color.FromArgb(alpha, terrainTypeColors[world.Map.Theater].ColorForTerrainType(TerrainType.Ore)));
|
||||
}
|
||||
@@ -140,8 +140,8 @@ namespace OpenRA.Graphics
|
||||
*(c + (a.Actor.Location.Y * bitmapData.Stride >> 2) + a.Actor.Location.X) =
|
||||
Color.FromArgb(alpha, a.Actor.Owner.Color).ToArgb();
|
||||
|
||||
for (var y = world.Map.YOffset; y < world.Map.YOffset + world.Map.Height; y++)
|
||||
for (var x = world.Map.XOffset; x < world.Map.XOffset + world.Map.Width; x++)
|
||||
for (var y = world.Map.BottomRight.Y; y < world.Map.YOffset + world.Map.BottomRight.Y; y++)
|
||||
for (var x = world.Map.TopLeft.X; x < world.Map.BottomRight.X; x++)
|
||||
{
|
||||
if (!world.LocalPlayer.Shroud.DisplayOnRadar(x, y))
|
||||
{
|
||||
|
||||
@@ -50,10 +50,11 @@ namespace OpenRA.Graphics
|
||||
|
||||
int nv = 0;
|
||||
int ni = 0;
|
||||
for( int j = map.YOffset ; j < map.YOffset + map.Height ; j++ )
|
||||
for( int i = map.XOffset ; i < map.XOffset + map.Width; i++ )
|
||||
for( int i = map.TopLeft.X ; i < map.BottomRight.X; i++ )
|
||||
for( int j = map.TopLeft.Y ; j < map.BottomRight.Y; j++ )
|
||||
{
|
||||
Sprite tile = tileMapping[map.MapTiles[i, j]];
|
||||
Log.Write("{0} {1}",i,j);
|
||||
Sprite tile = tileMapping[map.MapTiles[i, j]];
|
||||
// TODO: The zero below should explicitly refer to the terrain palette, but this code is called
|
||||
// before the palettes are created
|
||||
Util.FastCreateQuad(vertices, indices, Game.CellSize * new float2(i, j), tile, 0, nv, ni, tile.size);
|
||||
@@ -61,7 +62,7 @@ namespace OpenRA.Graphics
|
||||
ni += 6;
|
||||
}
|
||||
|
||||
terrainSheet = tileMapping[map.MapTiles[map.XOffset, map.YOffset]].sheet;
|
||||
terrainSheet = tileMapping[map.MapTiles[map.TopLeft.X, map.TopLeft.Y]].sheet;
|
||||
|
||||
vertexBuffer = renderer.Device.CreateVertexBuffer( vertices.Length );
|
||||
vertexBuffer.SetData( vertices );
|
||||
|
||||
@@ -170,11 +170,11 @@ namespace OpenRA.Graphics
|
||||
lineRenderer.DrawLine(a, a + c, Color.Blue, Color.Blue);
|
||||
}
|
||||
|
||||
for (var j = 0; j < Game.world.Map.MapSize;
|
||||
for (var j = 0; j < Game.world.Map.MapSize.Y;
|
||||
j += Game.world.WorldActor.Info.Traits.Get<SpatialBinsInfo>().BinSize)
|
||||
{
|
||||
lineRenderer.DrawLine(new float2(0, j * 24), new float2(Game.world.Map.MapSize * 24, j * 24), Color.Black, Color.Black);
|
||||
lineRenderer.DrawLine(new float2(j * 24, 0), new float2(j * 24, Game.world.Map.MapSize * 24), Color.Black, Color.Black);
|
||||
lineRenderer.DrawLine(new float2(0, j * 24), new float2(Game.world.Map.MapSize.X * 24, j * 24), Color.Black, Color.Black);
|
||||
lineRenderer.DrawLine(new float2(j * 24, 0), new float2(j * 24, Game.world.Map.MapSize.Y * 24), Color.Black, Color.Black);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,13 +38,13 @@ namespace OpenRA
|
||||
this.world = world;
|
||||
var map = world.Map;
|
||||
for (var umt = UnitMovementType.Foot; umt <= UnitMovementType.Float; umt++)
|
||||
passableCost[(int)umt] = new float[map.MapSize, map.MapSize];
|
||||
for (int x = 0; x < map.MapSize; x++)
|
||||
for (int y = 0; y < map.MapSize; y++)
|
||||
for (var umt = UnitMovementType.Foot; umt <= UnitMovementType.Float; umt++)
|
||||
passableCost[(int)umt][x, y] = (world.Map.IsInMap(x, y))
|
||||
passableCost[(int)umt] = new float[map.MapSize.X, map.MapSize.Y];
|
||||
for( int x = 0 ; x < map.MapSize.X ; x++ )
|
||||
for( int y = 0 ; y < map.MapSize.Y ; y++ )
|
||||
for (var umt = UnitMovementType.Foot; umt <= UnitMovementType.Float; umt++ )
|
||||
passableCost[(int)umt][ x, y ] = ( world.Map.IsInMap( x, y ) )
|
||||
? (float)Rules.TerrainTypes[world.TileSet.GetTerrainType(world.Map.MapTiles[x, y])]
|
||||
.GetCost(umt)
|
||||
.GetCost(umt)
|
||||
: float.PositiveInfinity;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,9 +173,9 @@ namespace OpenRA
|
||||
|
||||
static CellInfo[ , ] InitCellInfo()
|
||||
{
|
||||
var cellInfo = new CellInfo[ Game.world.Map.MapSize, Game.world.Map.MapSize ];
|
||||
for( int x = 0 ; x < Game.world.Map.MapSize ; x++ )
|
||||
for( int y = 0 ; y < Game.world.Map.MapSize ; y++ )
|
||||
var cellInfo = new CellInfo[ Game.world.Map.MapSize.X, Game.world.Map.MapSize.Y ];
|
||||
for( int x = 0 ; x < Game.world.Map.MapSize.X ; x++ )
|
||||
for( int y = 0 ; y < Game.world.Map.MapSize.Y ; y++ )
|
||||
cellInfo[ x, y ] = new CellInfo( float.PositiveInfinity, new int2( x, y ), false );
|
||||
return cellInfo;
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ namespace OpenRA
|
||||
this.owner = owner;
|
||||
this.map = map;
|
||||
|
||||
sprites = new Sprite[map.MapSize, map.MapSize];
|
||||
fogSprites = new Sprite[map.MapSize, map.MapSize];
|
||||
sprites = new Sprite[map.MapSize.X, map.MapSize.Y];
|
||||
fogSprites = new Sprite[map.MapSize.X, map.MapSize.Y];
|
||||
|
||||
shroud.Dirty += () => dirty = true;
|
||||
}
|
||||
@@ -135,11 +135,11 @@ namespace OpenRA
|
||||
if (dirty)
|
||||
{
|
||||
dirty = false;
|
||||
for (int j = map.YOffset; j < map.YOffset + map.Height; j++)
|
||||
for (int i = map.XOffset; i < map.XOffset + map.Width; i++)
|
||||
for (int i = map.TopLeft.X; i < map.BottomRight.X; i++)
|
||||
for (int j = map.TopLeft.Y; j < map.BottomRight.Y; j++)
|
||||
sprites[i, j] = ChooseShroud(i, j);
|
||||
for (int j = map.YOffset; j < map.YOffset + map.Height; j++)
|
||||
for (int i = map.XOffset; i < map.XOffset + map.Width; i++)
|
||||
for (int i = map.TopLeft.X; i < map.BottomRight.X; i++)
|
||||
for (int j = map.TopLeft.Y; j < map.BottomRight.Y; j++)
|
||||
fogSprites[i, j] = ChooseFog(i, j);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace OpenRA.Traits
|
||||
{
|
||||
map = self.World.Map;
|
||||
|
||||
blocked = new bool[map.MapSize, map.MapSize];
|
||||
influence = new Actor[map.MapSize, map.MapSize];
|
||||
blocked = new bool[map.MapSize.X, map.MapSize.Y];
|
||||
influence = new Actor[map.MapSize.X, map.MapSize.Y];
|
||||
|
||||
self.World.ActorAdded +=
|
||||
a => { if (a.traits.Contains<Building>())
|
||||
|
||||
@@ -44,8 +44,8 @@ namespace OpenRA.Traits
|
||||
public Shroud(Actor self, ShroudInfo info)
|
||||
{
|
||||
map = self.World.Map;
|
||||
visibleCells = new int[map.MapSize, map.MapSize];
|
||||
exploredCells = new bool[map.MapSize, map.MapSize];
|
||||
visibleCells = new int[map.MapSize.X, map.MapSize.Y];
|
||||
exploredCells = new bool[map.MapSize.X, map.MapSize.Y];
|
||||
|
||||
self.World.ActorAdded += AddActor;
|
||||
self.World.ActorRemoved += RemoveActor;
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace OpenRA.Traits
|
||||
public SpatialBins(Actor self, SpatialBinsInfo info)
|
||||
{
|
||||
bins = new List<Actor>[
|
||||
self.World.Map.MapSize / info.BinSize,
|
||||
self.World.Map.MapSize / info.BinSize];
|
||||
self.World.Map.MapSize.X / info.BinSize,
|
||||
self.World.Map.MapSize.Y / info.BinSize];
|
||||
|
||||
scale = Game.CellSize * info.BinSize;
|
||||
}
|
||||
|
||||
@@ -39,10 +39,9 @@ namespace OpenRA.Traits
|
||||
public UnitInfluence( Actor self )
|
||||
{
|
||||
map = self.World.Map;
|
||||
var size = self.World.Map.MapSize;
|
||||
influence = new List<Actor>[size, size];
|
||||
for (int i = 0; i < size; i++)
|
||||
for (int j = 0; j < size; j++)
|
||||
influence = new List<Actor>[self.World.Map.MapSize.X, self.World.Map.MapSize.Y];
|
||||
for (int i = 0; i < self.World.Map.MapSize.X; i++)
|
||||
for (int j = 0; j < self.World.Map.MapSize.Y; j++)
|
||||
influence[ i, j ] = new List<Actor>();
|
||||
|
||||
self.World.ActorRemoved += a => Remove( a, a.traits.GetOrDefault<IOccupySpace>() );
|
||||
@@ -77,8 +76,8 @@ namespace OpenRA.Traits
|
||||
[Conditional( "SANITY_CHECKS" )]
|
||||
void SanityCheck( Actor self )
|
||||
{
|
||||
for( int y = 0 ; y < self.World.Map.MapSize ; y++ )
|
||||
for( int x = 0 ; x < self.World.Map.MapSize ; x++ )
|
||||
for( int y = 0 ; y < self.World.Map.MapSize.Y ; y++ )
|
||||
for( int x = 0 ; x < self.World.Map.MapSize.X ; x++ )
|
||||
if( influence[ x, y ] != null )
|
||||
foreach (var a in influence[ x, y ])
|
||||
if (!a.traits.Get<IOccupySpace>().OccupiedCells().Contains( new int2( x, y ) ) )
|
||||
|
||||
@@ -55,8 +55,8 @@ namespace OpenRA
|
||||
public void Draw( World world )
|
||||
{
|
||||
if (Game.Settings.UnitDebug)
|
||||
for (var j = 0; j < world.Map.MapSize; j++)
|
||||
for (var i = 0; i < world.Map.MapSize; i++)
|
||||
for (var j = 0; j < world.Map.MapSize.Y; j++)
|
||||
for (var i = 0; i < world.Map.MapSize.X; i++)
|
||||
if (world.WorldActor.traits.Get<UnitInfluence>().GetUnitsAt(new int2(i, j)).Any())
|
||||
spriteRenderer.DrawSprite(unitDebug, Game.CellSize * new float2(i, j), "terrain");
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace OpenRA
|
||||
Timer.Time( "----World.ctor" );
|
||||
|
||||
Map = new Map( Game.LobbyInfo.GlobalSettings.Map );
|
||||
customTerrain = new ICustomTerrain[Map.MapSize, Map.MapSize];
|
||||
customTerrain = new ICustomTerrain[Map.MapSize.X, Map.MapSize.Y];
|
||||
Timer.Time( "new Map: {0}" );
|
||||
|
||||
var theaterInfo = Rules.Info["world"].Traits.WithInterface<TheaterInfo>()
|
||||
|
||||
@@ -179,8 +179,9 @@ namespace OpenRA
|
||||
|
||||
static int2 ClampToWorld( this World world, int2 xy )
|
||||
{
|
||||
var mapStart = world.Map.Offset;
|
||||
var mapEnd = world.Map.Offset + world.Map.Size;
|
||||
var mapStart = world.Map.TopLeft;
|
||||
// TODO: Revist this and fix properly
|
||||
var mapEnd = world.Map.BottomRight;
|
||||
if( xy.X < mapStart.X )
|
||||
xy.X = mapStart.X;
|
||||
if( xy.X > mapEnd.X )
|
||||
|
||||
Binary file not shown.
@@ -1,68 +1,61 @@
|
||||
MapFormat: 1
|
||||
|
||||
Title: Isle of Fury (6-8)
|
||||
Title: Middle Mayhem (2)
|
||||
|
||||
Author: Westwood Studios
|
||||
|
||||
PlayerCount: 8
|
||||
PlayerCount: 2
|
||||
|
||||
Tileset: TEMPERAT
|
||||
Tileset: SNOW
|
||||
|
||||
Tiledata: testmap.bin
|
||||
|
||||
Size: 128,128
|
||||
MapSize: 128,128
|
||||
|
||||
Bounds: 14,17,96,96
|
||||
TopLeft: 27,26
|
||||
|
||||
BottomRight: 102,91
|
||||
|
||||
Actors:
|
||||
Actor0: TC05 Neutral 93,90
|
||||
Actor1: TC04 Neutral 92,92
|
||||
Actor2: TC01 Neutral 88,92
|
||||
Actor3: T11 Neutral 96,93
|
||||
Actor4: T08 Neutral 90,94
|
||||
Actor5: MINE Neutral 67,103
|
||||
Actor6: MINE Neutral 52,97
|
||||
Actor7: MINE Neutral 48,81
|
||||
Actor8: TC05 Neutral 59,103
|
||||
Actor9: TC01 Neutral 52,102
|
||||
Actor10: T08 Neutral 71,97
|
||||
Actor11: T08 Neutral 50,94
|
||||
Actor12: MINE Neutral 47,78
|
||||
Actor13: T14 Neutral 41,52
|
||||
Actor14: MINE Neutral 37,44
|
||||
Actor15: MINE Neutral 27,52
|
||||
Actor16: MINE Neutral 64,79
|
||||
Actor17: MINE Neutral 64,62
|
||||
Actor18: MINE Neutral 61,24
|
||||
Actor19: MINE Neutral 68,27
|
||||
Actor20: MINE Neutral 61,35
|
||||
Actor21: MINE Neutral 89,50
|
||||
Actor22: MINE Neutral 67,98
|
||||
Actor23: TC04 Neutral 53,73
|
||||
Actor24: TC03 Neutral 81,65
|
||||
Actor25: TC04 Neutral 97,41
|
||||
Actor26: TC05 Neutral 67,49
|
||||
Actor27: TC02 Neutral 53,59
|
||||
Actor28: TC03 Neutral 22,51
|
||||
Actor29: TC01 Neutral 25,53
|
||||
Actor30: TC01 Neutral 47,22
|
||||
Actor31: TC02 Neutral 32,36
|
||||
Actor32: TC02 Neutral 25,77
|
||||
Actor33: TC04 Neutral 28,81
|
||||
Actor34: TC02 Neutral 29,87
|
||||
Actor35: T08 Neutral 25,81
|
||||
Actor36: T08 Neutral 52,59
|
||||
Actor37: T08 Neutral 51,57
|
||||
Actor0: TC05 Neutral 62,58
|
||||
Actor1: TC04 Neutral 64,63
|
||||
Actor2: TC03 Neutral 73,60
|
||||
Actor3: TC03 Neutral 55,48
|
||||
Actor4: TC01 Neutral 58,51
|
||||
Actor5: TC01 Neutral 54,68
|
||||
Actor6: T17 Neutral 60,68
|
||||
Actor7: TC02 Neutral 48,57
|
||||
Actor8: TC05 Neutral 68,63
|
||||
Actor9: T16 Neutral 71,63
|
||||
Actor10: T16 Neutral 70,55
|
||||
Actor11: TC01 Neutral 83,57
|
||||
Actor12: TC02 Neutral 62,54
|
||||
Actor13: T08 Neutral 62,56
|
||||
Actor14: T01 Neutral 49,80
|
||||
Actor15: TC04 Neutral 50,81
|
||||
Actor16: T16 Neutral 53,82
|
||||
Actor17: TC02 Neutral 42,79
|
||||
Actor18: TC03 Neutral 27,26
|
||||
Actor19: T01 Neutral 29,48
|
||||
Actor20: T02 Neutral 31,50
|
||||
Actor21: T03 Neutral 32,59
|
||||
Actor22: TC05 Neutral 56,88
|
||||
Actor23: TC03 Neutral 54,89
|
||||
Actor24: T16 Neutral 56,89
|
||||
Actor25: T15 Neutral 52,89
|
||||
Actor26: T14 Neutral 64,78
|
||||
Actor27: TC01 Neutral 27,44
|
||||
Actor28: TC01 Neutral 45,39
|
||||
Actor29: T17 Neutral 76,26
|
||||
Actor30: MINE Neutral 68,53
|
||||
Actor31: MINE Neutral 54,57
|
||||
Actor32: MINE Neutral 53,65
|
||||
Actor33: MINE Neutral 65,68
|
||||
Actor34: MINE Neutral 80,61
|
||||
|
||||
Waypoints:
|
||||
spawn0: 87,100
|
||||
spawn1: 36,75
|
||||
spawn2: 92,29
|
||||
spawn3: 31,30
|
||||
spawn4: 61,54
|
||||
spawn5: 91,63
|
||||
spawn6: 34,97
|
||||
spawn7: 63,83
|
||||
spawn0: 34,84
|
||||
spawn1: 35,34
|
||||
|
||||
Rules:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user