summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2016-01-04 15:28:11 +0100
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2016-01-04 15:28:11 +0100
commita9dbe83155ec707f87f5eb6fae782e4947d84aa5 (patch)
treea1856aa52e4775efc666da698e947d0412323496 /scene/2d
parente22e0cecf7bdf7f16956e4657df4b6de77bdee24 (diff)
TileMap: Properly flip/rotate tiles with non-square region
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/tile_map.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 70937c68da..179d1f451a 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -223,6 +223,14 @@ void TileMap::_fix_cell_transform(Matrix32& xform,const Cell& p_cell, const Vect
Size2 s=p_sc;
Vector2 offset = p_offset;
+ if (s.y > s.x) {
+ if ((p_cell.flip_h && (p_cell.flip_v || p_cell.transpose)) || (p_cell.flip_v && !p_cell.transpose))
+ offset.y += s.y - s.x;
+ } else if (s.y < s.x) {
+ if ((p_cell.flip_v && (p_cell.flip_h || p_cell.transpose)) || (p_cell.flip_h && !p_cell.transpose))
+ offset.x += s.x - s.y;
+ }
+
if (p_cell.transpose) {
SWAP(xform.elements[0].x, xform.elements[0].y);
SWAP(xform.elements[1].x, xform.elements[1].y);
@@ -376,6 +384,14 @@ void TileMap::_update_dirty_quadrants() {
rect.pos=offset.floor();
rect.size=s;
+ if (rect.size.y > rect.size.x) {
+ if ((c.flip_h && (c.flip_v || c.transpose)) || (c.flip_v && !c.transpose))
+ tile_ofs.y += rect.size.y - rect.size.x;
+ } else if (rect.size.y < rect.size.x) {
+ if ((c.flip_v && (c.flip_h || c.transpose)) || (c.flip_h && !c.transpose))
+ tile_ofs.x += rect.size.x - rect.size.y;
+ }
+
/* rect.size.x+=fp_adjust;
rect.size.y+=fp_adjust;*/