diff options
| author | Ignacio Etcheverry | 2016-01-04 15:28:11 +0100 |
|---|---|---|
| committer | Ignacio Etcheverry | 2016-01-04 15:28:11 +0100 |
| commit | a9dbe83155ec707f87f5eb6fae782e4947d84aa5 (patch) | |
| tree | a1856aa52e4775efc666da698e947d0412323496 /scene/2d/tile_map.cpp | |
| parent | e22e0cecf7bdf7f16956e4657df4b6de77bdee24 (diff) | |
| download | godot-a9dbe83155ec707f87f5eb6fae782e4947d84aa5.tar.gz godot-a9dbe83155ec707f87f5eb6fae782e4947d84aa5.tar.zst godot-a9dbe83155ec707f87f5eb6fae782e4947d84aa5.zip | |
TileMap: Properly flip/rotate tiles with non-square region
Diffstat (limited to 'scene/2d/tile_map.cpp')
| -rw-r--r-- | scene/2d/tile_map.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 70937c68d..179d1f451 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;*/ |
