cache/MapImageDumper: draw cross region objs when drawing single regions

This commit is contained in:
Max Weber
2022-05-01 16:34:07 -06:00
parent fa4776f396
commit c04534b7cb

View File

@@ -181,6 +181,17 @@ public class MapImageDumper
return image; return image;
} }
private void drawNeighborObjects(BufferedImage image, int rx, int ry, int dx, int dy, int z)
{
Region neighbor = regionLoader.findRegionForRegionCoordinates(rx + dx, ry + dy);
if (neighbor == null)
{
return;
}
drawObjects(image, Region.X * dx, Region.Y * -dy, neighbor, z);
}
public BufferedImage drawRegion(Region region, int z) public BufferedImage drawRegion(Region region, int z)
{ {
int pixelsX = Region.X * MAP_SCALE; int pixelsX = Region.X * MAP_SCALE;
@@ -189,7 +200,16 @@ public class MapImageDumper
BufferedImage image = new BufferedImage(pixelsX, pixelsY, transparency ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB); BufferedImage image = new BufferedImage(pixelsX, pixelsY, transparency ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB);
drawMap(image, 0, 0, z, region); drawMap(image, 0, 0, z, region);
drawNeighborObjects(image, region.getRegionX(), region.getRegionY(), -1, -1, z);
drawNeighborObjects(image, region.getRegionX(), region.getRegionY(), -1, 0, z);
drawNeighborObjects(image, region.getRegionX(), region.getRegionY(), -1, 1, z);
drawNeighborObjects(image, region.getRegionX(), region.getRegionY(), 0, -1, z);
drawObjects(image, 0, 0, region, z); drawObjects(image, 0, 0, region, z);
drawNeighborObjects(image, region.getRegionX(), region.getRegionY(), 0, 1, z);
drawNeighborObjects(image, region.getRegionX(), region.getRegionY(), 1, -1, z);
drawNeighborObjects(image, region.getRegionX(), region.getRegionY(), 1, 0, z);
drawNeighborObjects(image, region.getRegionX(), region.getRegionY(), 1, 1, z);
drawMapIcons(image, 0, 0, region, z); drawMapIcons(image, 0, 0, region, z);
return image; return image;
@@ -607,7 +627,7 @@ public class MapImageDumper
{ {
blitMapDecoration(image, drawX, drawY, object); blitMapDecoration(image, drawX, drawY, object);
} }
else else if (drawX >= 0 && drawY >= 0 && drawX < image.getWidth() && drawY < image.getHeight())
{ {
if (type == 0 || type == 2) if (type == 0 || type == 2)
{ {
@@ -714,6 +734,8 @@ public class MapImageDumper
continue; continue;
} }
if (drawX >= 0 && drawY >= 0 && drawX < image.getWidth() && drawY < image.getHeight())
{
int rgb = 0xFFEE_EEEE; int rgb = 0xFFEE_EEEE;
if (object.getWallOrDoor() != 0) if (object.getWallOrDoor() != 0)
{ {
@@ -736,6 +758,7 @@ public class MapImageDumper
} }
} }
} }
}
for (Location location : locs) for (Location location : locs)
{ {