Rename MapGridType.Rectangle to MapGridType.Rectangular

This commit is contained in:
Pavel Penev
2015-10-01 00:52:20 +03:00
parent bb3aea338a
commit 0e417a3cf3
9 changed files with 13 additions and 13 deletions

View File

@@ -49,7 +49,7 @@ namespace OpenRA
public MPos ToMPos(MapGridType gridType) public MPos ToMPos(MapGridType gridType)
{ {
if (gridType == MapGridType.Rectangle) if (gridType == MapGridType.Rectangular)
return new MPos(X, Y); return new MPos(X, Y);
// Convert from diamond cell (x, y) position to rectangular map position (u, v) // Convert from diamond cell (x, y) position to rectangular map position (u, v)

View File

@@ -125,8 +125,8 @@ namespace OpenRA.Graphics
continue; continue;
var sprite = TileSprite(tile); var sprite = TileSprite(tile);
var u = mapGrid == MapGridType.Rectangle ? x : (x - y) / 2f; var u = mapGrid == MapGridType.Rectangular ? x : (x - y) / 2f;
var v = mapGrid == MapGridType.Rectangle ? y : (x + y) / 2f; var v = mapGrid == MapGridType.Rectangular ? y : (x + y) / 2f;
var tl = new float2(u * tileSize.Width, (v - 0.5f * tileInfo.Height) * tileSize.Height) - 0.5f * sprite.Size; var tl = new float2(u * tileSize.Width, (v - 0.5f * tileInfo.Height) * tileSize.Height) - 0.5f * sprite.Size;
var rect = new Rectangle((int)(tl.X + sprite.Offset.X), (int)(tl.Y + sprite.Offset.Y), (int)sprite.Size.X, (int)sprite.Size.Y); var rect = new Rectangle((int)(tl.X + sprite.Offset.X), (int)(tl.Y + sprite.Offset.Y), (int)sprite.Size.X, (int)sprite.Size.Y);

View File

@@ -43,7 +43,7 @@ namespace OpenRA
public CPos ToCPos(MapGridType gridType) public CPos ToCPos(MapGridType gridType)
{ {
if (gridType == MapGridType.Rectangle) if (gridType == MapGridType.Rectangular)
return new CPos(U, V); return new CPos(U, V);
// Convert from rectangular map position to diamond cell position // Convert from rectangular map position to diamond cell position

View File

@@ -786,7 +786,7 @@ namespace OpenRA
public WPos CenterOfCell(CPos cell) public WPos CenterOfCell(CPos cell)
{ {
if (Grid.Type == MapGridType.Rectangle) if (Grid.Type == MapGridType.Rectangular)
return new WPos(1024 * cell.X + 512, 1024 * cell.Y + 512, 0); return new WPos(1024 * cell.X + 512, 1024 * cell.Y + 512, 0);
// Convert from diamond cell position (x, y) to world position (u, v): // Convert from diamond cell position (x, y) to world position (u, v):
@@ -818,7 +818,7 @@ namespace OpenRA
public CPos CellContaining(WPos pos) public CPos CellContaining(WPos pos)
{ {
if (Grid.Type == MapGridType.Rectangle) if (Grid.Type == MapGridType.Rectangular)
return new CPos(pos.X / 1024, pos.Y / 1024); return new CPos(pos.X / 1024, pos.Y / 1024);
// Convert from world position to diamond cell position: // Convert from world position to diamond cell position:

View File

@@ -13,11 +13,11 @@ using System.IO;
namespace OpenRA namespace OpenRA
{ {
public enum MapGridType { Rectangle, Diamond } public enum MapGridType { Rectangular, Diamond }
public class MapGrid : IGlobalModData public class MapGrid : IGlobalModData
{ {
public readonly MapGridType Type = MapGridType.Rectangle; public readonly MapGridType Type = MapGridType.Rectangular;
public readonly Size TileSize = new Size(24, 24); public readonly Size TileSize = new Size(24, 24);
public readonly byte MaximumTerrainHeight = 0; public readonly byte MaximumTerrainHeight = 0;
public readonly byte SubCellDefaultIndex = byte.MaxValue; public readonly byte SubCellDefaultIndex = byte.MaxValue;

View File

@@ -90,8 +90,8 @@ namespace OpenRA.Mods.Common.Widgets
var sprite = worldRenderer.Theater.TileSprite(tile, 0); var sprite = worldRenderer.Theater.TileSprite(tile, 0);
var size = new float2(sprite.Size.X * scale, sprite.Size.Y * scale); var size = new float2(sprite.Size.X * scale, sprite.Size.Y * scale);
var u = gridType == MapGridType.Rectangle ? x : (x - y) / 2f; var u = gridType == MapGridType.Rectangular ? x : (x - y) / 2f;
var v = gridType == MapGridType.Rectangle ? y : (x + y) / 2f; var v = gridType == MapGridType.Rectangular ? y : (x + y) / 2f;
var pos = origin + scale * (new float2(u * ts.Width, (v - 0.5f * tileInfo.Height) * ts.Height) - 0.5f * sprite.Size); var pos = origin + scale * (new float2(u * ts.Width, (v - 0.5f * tileInfo.Height) * ts.Height) - 0.5f * sprite.Size);
Game.Renderer.SpriteRenderer.DrawSprite(sprite, pos, worldRenderer.Palette(Palette), size); Game.Renderer.SpriteRenderer.DrawSprite(sprite, pos, worldRenderer.Palette(Palette), size);
} }

View File

@@ -207,7 +207,7 @@ Missions:
MapGrid: MapGrid:
TileSize: 24,24 TileSize: 24,24
Type: Rectangle Type: Rectangular
SupportsMapsFrom: cnc SupportsMapsFrom: cnc

View File

@@ -51,7 +51,7 @@ TileSets:
MapGrid: MapGrid:
TileSize: 32,32 TileSize: 32,32
Type: Rectangle Type: Rectangular
Cursors: Cursors:
./mods/d2k/cursors.yaml ./mods/d2k/cursors.yaml

View File

@@ -207,7 +207,7 @@ Missions:
MapGrid: MapGrid:
TileSize: 24,24 TileSize: 24,24
Type: Rectangle Type: Rectangular
SupportsMapsFrom: ra SupportsMapsFrom: ra