public bool DoesChunkMatch(Point point, Stamps.TileChunk CompareChunk, Classes.Scene.EditorLayer EditLayerA, Classes.Scene.EditorLayer EditLayerB, int chunkSize = 8) { Point TileCoord = new Point(point.X * 128, point.Y * 128); for (int x = 0; x < chunkSize; x++) { for (int y = 0; y < chunkSize; y++) { Point p = new Point((TileCoord.X / 16) + x, (TileCoord.Y / 16) + y); if (CompareChunk.TileMapA[x][y] == EditLayerA.GetTileAt(p.X, p.Y)) { if (EditLayerB != null) { if (CompareChunk.TileMapB[x][y] == EditLayerB.GetTileAt(p.X, p.Y)) { continue; } else { return(false); } } else { continue; } } else { return(false); } } } return(true); }
public bool IsChunkEmpty(Point point, Classes.Scene.EditorLayer EditLayer, int chunkSize = 8) { if (EditLayer == null) { return(true); } Point TileCoord = new Point(point.X * 128, point.Y * 128); for (int x = 0; x < chunkSize; x++) { for (int y = 0; y < chunkSize; y++) { Point p = new Point((TileCoord.X / 16) + x, (TileCoord.Y / 16) + y); if (EditLayer.GetTileAt(p.X, p.Y) == 0xffff) { continue; } else { return(false); } } } return(true); }
public void AutoGenerateChunks(Classes.Scene.EditorLayer LayerA, Classes.Scene.EditorLayer LayerB) { Methods.Internal.UserInterface.ShowWaitingBox(); System.Threading.Thread thread = new System.Threading.Thread(() => { int width = (LayerA.Width > LayerB.Width ? LayerA.Width : LayerB.Width); int height = (LayerA.Height > LayerB.Height ? LayerA.Height : LayerB.Height); int ChunkWidth = width / 8; int ChunkHeight = height / 8; for (int i = 0; i < ChunkHeight; ++i) { for (int j = 0; j < ChunkWidth; ++j) { int tileX = j * 8; int tileY = i * 8; int x1 = j * 8; int x2 = x1 + 8; int y1 = i * 8; int y2 = y1 + 8; ushort[][] ChunkMapA = new ushort[8][]; ushort[][] ChunkMapB = new ushort[8][]; for (int x = 0; x < 8; x++) { ChunkMapA[x] = new ushort[8]; ChunkMapB[x] = new ushort[8]; for (int y = 0; y < 8; y++) { ChunkMapA[x][y] = LayerA.GetTileAt(tileX + x, tileY + y); ChunkMapB[x][y] = LayerB.GetTileAt(tileX + x, tileY + y); } } var newChunk = new TexturedStamps.TexturedTileChunk(ChunkMapA, ChunkMapB, 8); var duplicate = StageStamps.StampList.Exists(x => x.TileMapCodeA == newChunk.TileMapCodeA && x.TileMapCodeB == newChunk.TileMapCodeB); if (duplicate == false) { AddChunk(newChunk); } } } Methods.Internal.UserInterface.CloseWaitingBox(); }) { IsBackground = true }; thread.Start(); }