Support rectangular tiles.
This commit is contained in:
@@ -27,8 +27,6 @@ namespace OpenRA
|
||||
{
|
||||
public static class Game
|
||||
{
|
||||
public static int CellSize { get { return modData.Manifest.TileSize; } }
|
||||
|
||||
public static MouseButtonPreference mouseButtonPreference = new MouseButtonPreference();
|
||||
|
||||
public static ModData modData;
|
||||
|
||||
@@ -235,8 +235,8 @@ namespace OpenRA.Graphics
|
||||
// Conversion between world and screen coordinates
|
||||
public float2 ScreenPosition(WPos pos)
|
||||
{
|
||||
var c = Game.CellSize / 1024f;
|
||||
return new float2(c * pos.X, c * (pos.Y - pos.Z));
|
||||
var ts = Game.modData.Manifest.TileSize;
|
||||
return new float2(ts.Width * pos.X / 1024f, ts.Height * (pos.Y - pos.Z) / 1024f);
|
||||
}
|
||||
|
||||
public int2 ScreenPxPosition(WPos pos)
|
||||
@@ -249,8 +249,8 @@ namespace OpenRA.Graphics
|
||||
// For scaling vectors to pixel sizes in the voxel renderer
|
||||
public float[] ScreenVector(WVec vec)
|
||||
{
|
||||
var c = Game.CellSize / 1024f;
|
||||
return new float[] { c * vec.X, c * vec.Y, c * vec.Z, 1 };
|
||||
var ts = Game.modData.Manifest.TileSize;
|
||||
return new float[] { ts.Width * vec.X / 1024f, ts.Height * vec.Y / 1024f, ts.Height * vec.Z / 1024f, 1 };
|
||||
}
|
||||
|
||||
public int2 ScreenPxOffset(WVec vec)
|
||||
@@ -262,12 +262,14 @@ namespace OpenRA.Graphics
|
||||
|
||||
public float ScreenZPosition(WPos pos, int offset)
|
||||
{
|
||||
return (pos.Y + pos.Z + offset) * Game.CellSize / 1024f;
|
||||
var ts = Game.modData.Manifest.TileSize;
|
||||
return (pos.Y + pos.Z + offset) * ts.Height / 1024f;
|
||||
}
|
||||
|
||||
public WPos Position(int2 screenPx)
|
||||
{
|
||||
return new WPos(1024 * screenPx.X / Game.CellSize, 1024 * screenPx.Y / Game.CellSize, 0);
|
||||
var ts = Game.modData.Manifest.TileSize;
|
||||
return new WPos(1024 * screenPx.X / ts.Width, 1024 * screenPx.Y / ts.Height, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,9 @@ namespace OpenRA.Traits
|
||||
public ScreenMap(World world, ScreenMapInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
cols = world.Map.MapSize.X * Game.CellSize / info.BinSize + 1;
|
||||
rows = world.Map.MapSize.Y * Game.CellSize / info.BinSize + 1;
|
||||
var ts = Game.modData.Manifest.TileSize;
|
||||
cols = world.Map.MapSize.X * ts.Width / info.BinSize + 1;
|
||||
rows = world.Map.MapSize.Y * ts.Height / info.BinSize + 1;
|
||||
|
||||
frozen = new Cache<Player, Dictionary<FrozenActor, Rectangle>[]>(InitializeFrozenActors);
|
||||
actors = new Dictionary<Actor, Rectangle>[rows * cols];
|
||||
|
||||
Reference in New Issue
Block a user