|
@@ -845,16 +845,37 @@ void TileMap::update_cell_bitmask(int p_x, int p_y) {
|
|
if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) {
|
|
if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) {
|
|
mask |= TileSet::BIND_BOTTOMRIGHT;
|
|
mask |= TileSet::BIND_BOTTOMRIGHT;
|
|
}
|
|
}
|
|
- } else if (tile_set->autotile_get_bitmask_mode(id) == TileSet::BITMASK_3X3) {
|
|
|
|
- if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y - 1))) {
|
|
|
|
- mask |= TileSet::BIND_TOPLEFT;
|
|
|
|
|
|
+ } else {
|
|
|
|
+ if (tile_set->autotile_get_bitmask_mode(id) == TileSet::BITMASK_3X3_MINIMAL) {
|
|
|
|
+ if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) {
|
|
|
|
+ mask |= TileSet::BIND_TOPLEFT;
|
|
|
|
+ }
|
|
|
|
+ if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1)) && tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) {
|
|
|
|
+ mask |= TileSet::BIND_TOPRIGHT;
|
|
|
|
+ }
|
|
|
|
+ if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) {
|
|
|
|
+ mask |= TileSet::BIND_BOTTOMLEFT;
|
|
|
|
+ }
|
|
|
|
+ if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1)) && tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) {
|
|
|
|
+ mask |= TileSet::BIND_BOTTOMRIGHT;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y - 1))) {
|
|
|
|
+ mask |= TileSet::BIND_TOPLEFT;
|
|
|
|
+ }
|
|
|
|
+ if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y - 1))) {
|
|
|
|
+ mask |= TileSet::BIND_TOPRIGHT;
|
|
|
|
+ }
|
|
|
|
+ if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y + 1))) {
|
|
|
|
+ mask |= TileSet::BIND_BOTTOMLEFT;
|
|
|
|
+ }
|
|
|
|
+ if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y + 1))) {
|
|
|
|
+ mask |= TileSet::BIND_BOTTOMRIGHT;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1))) {
|
|
if (tile_set->is_tile_bound(id, get_cell(p_x, p_y - 1))) {
|
|
mask |= TileSet::BIND_TOP;
|
|
mask |= TileSet::BIND_TOP;
|
|
}
|
|
}
|
|
- if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y - 1))) {
|
|
|
|
- mask |= TileSet::BIND_TOPRIGHT;
|
|
|
|
- }
|
|
|
|
if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) {
|
|
if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y))) {
|
|
mask |= TileSet::BIND_LEFT;
|
|
mask |= TileSet::BIND_LEFT;
|
|
}
|
|
}
|
|
@@ -862,15 +883,9 @@ void TileMap::update_cell_bitmask(int p_x, int p_y) {
|
|
if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) {
|
|
if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y))) {
|
|
mask |= TileSet::BIND_RIGHT;
|
|
mask |= TileSet::BIND_RIGHT;
|
|
}
|
|
}
|
|
- if (tile_set->is_tile_bound(id, get_cell(p_x - 1, p_y + 1))) {
|
|
|
|
- mask |= TileSet::BIND_BOTTOMLEFT;
|
|
|
|
- }
|
|
|
|
if (tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1))) {
|
|
if (tile_set->is_tile_bound(id, get_cell(p_x, p_y + 1))) {
|
|
mask |= TileSet::BIND_BOTTOM;
|
|
mask |= TileSet::BIND_BOTTOM;
|
|
}
|
|
}
|
|
- if (tile_set->is_tile_bound(id, get_cell(p_x + 1, p_y + 1))) {
|
|
|
|
- mask |= TileSet::BIND_BOTTOMRIGHT;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
Vector2 coord = tile_set->autotile_get_subtile_for_bitmask(id, mask, this, Vector2(p_x, p_y));
|
|
Vector2 coord = tile_set->autotile_get_subtile_for_bitmask(id, mask, this, Vector2(p_x, p_y));
|
|
E->get().autotile_coord_x = (int)coord.x;
|
|
E->get().autotile_coord_x = (int)coord.x;
|