@@ -641,7 +641,7 @@ namespace OpenRA
|
|||||||
// - ax + by adds (a - b) * 512 + 512 to u
|
// - ax + by adds (a - b) * 512 + 512 to u
|
||||||
// - ax + by adds (a + b) * 512 + 512 to v
|
// - ax + by adds (a + b) * 512 + 512 to v
|
||||||
var z = Contains(cell) ? 512 * MapHeight.Value[cell] : 0;
|
var z = Contains(cell) ? 512 * MapHeight.Value[cell] : 0;
|
||||||
return new WPos(512 * (cell.X - cell.Y + 1), 512 * (cell.X + cell.Y + 1), z);
|
return new WPos(512 * (cell.X - cell.Y), 512 * (cell.X + cell.Y + 1), z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WPos CenterOfSubCell(CPos cell, SubCell subCell)
|
public WPos CenterOfSubCell(CPos cell, SubCell subCell)
|
||||||
@@ -660,10 +660,10 @@ namespace OpenRA
|
|||||||
// Convert from world position to diamond cell position:
|
// Convert from world position to diamond cell position:
|
||||||
// (a) Subtract (512, 512) to move the rotation center to the middle of the corner cell
|
// (a) Subtract (512, 512) to move the rotation center to the middle of the corner cell
|
||||||
// (b) Rotate axes by -pi/4
|
// (b) Rotate axes by -pi/4
|
||||||
// (c) Add 512 to x (but not y) to realign the cell
|
// (c) Add (512, 512) to move back to the center of the cell
|
||||||
// (d) Divide by 1024 to find final cell coords
|
// (d) Divide by 1024 to find final cell coords
|
||||||
var u = (pos.Y + pos.X - 512) / 1024;
|
var u = (pos.Y + pos.X - 512) / 1024;
|
||||||
var v = (pos.Y - pos.X) / 1024;
|
var v = (pos.Y - pos.X - 512) / 1024;
|
||||||
return new CPos(u, v);
|
return new CPos(u, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user