diff options
Diffstat (limited to 'scene/2d/tile_map.cpp')
-rw-r--r-- | scene/2d/tile_map.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 7ae87b881c..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,13 +384,28 @@ 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;*/ - if (c.flip_h) + if (c.transpose) + SWAP(tile_ofs.x, tile_ofs.y); + + if (c.flip_h) { rect.size.x=-rect.size.x; - if (c.flip_v) + tile_ofs.x=-tile_ofs.x; + } + if (c.flip_v) { rect.size.y=-rect.size.y; + tile_ofs.y=-tile_ofs.y; + } Vector2 center_ofs; |