private static void Set(byte x, byte y, byte Layer_Num, byte Layer_Type, byte Part, string Index) { Point Position = new Point(0); // Posições exatas dos mini azulejos (16x16) switch (Index) { // Quinas case "a": Position = new Point(32, 0); break; case "b": Position = new Point(48, 0); break; case "c": Position = new Point(32, 16); break; case "d": Position = new Point(48, 16); break; // Noroeste case "e": Position = new Point(0, 32); break; case "f": Position = new Point(16, 32); break; case "g": Position = new Point(0, 48); break; case "h": Position = new Point(16, 48); break; // Nordeste case "i": Position = new Point(32, 32); break; case "j": Position = new Point(48, 32); break; case "k": Position = new Point(32, 48); break; case "l": Position = new Point(48, 48); break; // Sudoeste case "m": Position = new Point(0, 64); break; case "n": Position = new Point(16, 64); break; case "o": Position = new Point(0, 80); break; case "p": Position = new Point(16, 80); break; // Sudeste case "q": Position = new Point(32, 64); break; case "r": Position = new Point(48, 64); break; case "s": Position = new Point(32, 80); break; case "t": Position = new Point(48, 80); break; } // Define a posição do mini azulejo Lists.Structures.Map_Tile_Data Data = Lists.Map.Tile[x, y].Data[Layer_Type, Layer_Num]; Lists.Map.Tile[x, y].Data[Layer_Type, Layer_Num].Mini[Part].X = Data.X * Game.Grid + Position.X; Lists.Map.Tile[x, y].Data[Layer_Type, Layer_Num].Mini[Part].Y = Data.Y * Game.Grid + Position.Y; }
private static void Map_Autotile(Point Position, Lists.Structures.Map_Tile_Data Dados, SFML.Graphics.Color Cor) { // Desenha os 4 mini azulejos for (byte i = 0; i <= 3; i++) { Point Destiny = Position, Source = Dados.Mini[i]; // Partes do azulejo switch (i) { case 1: Destiny.X += 16; break; case 2: Destiny.Y += 16; break; case 3: Destiny.X += 16; Destiny.Y += 16; break; } // Renderiza o mini azulejo Render(Tex_Tile[Dados.Tile], new Rectangle(Source.X, Source.Y, 16, 16), new Rectangle(Destiny, new Size(16, 16)), Cor); } }
private void Map_Resize() { byte Width_New = (byte)numWidth.Value, Height_New = (byte)numHeight.Value; int Width_Difference, Height_Difference; // Somente se necessário if (Lists.Map[Selected].Width == Width_New && Lists.Map[Selected].Height == Height_New) { return; } // Redimensiona os azulejos Lists.Structures.Map_Tile_Data[,] TempTile; Lists.Structures.Map_Tile[,] TempTile2; // Calcula a diferença Width_Difference = Width_New - Lists.Map[Selected].Width; Height_Difference = Height_New - Lists.Map[Selected].Height; // Azulejo1 for (byte c = 0; c < Lists.Map[Selected].Layer.Count; c++) { TempTile = new Lists.Structures.Map_Tile_Data[Width_New + 1, Height_New + 1]; for (byte x = 0; x <= Width_New; x++) { for (byte y = 0; y <= Height_New; y++) { // Redimensiona para frente if (!chkReverse.Checked) { if (x <= Lists.Map[Selected].Width && y <= Lists.Map[Selected].Height) { TempTile[x, y] = Lists.Map[Selected].Layer[c].Tile[x, y]; } else { TempTile[x, y] = new Lists.Structures.Map_Tile_Data(); TempTile[x, y].Mini = new Point[4]; } } // Redimensiona para trás else { if (x < Width_Difference || y < Height_Difference) { TempTile[x, y] = new Lists.Structures.Map_Tile_Data(); TempTile[x, y].Mini = new Point[4]; } else { TempTile[x, y] = Lists.Map[Selected].Layer[c].Tile[x - Width_Difference, y - Height_Difference]; } } } } // Define os dados Lists.Map[Selected].Layer[c].Tile = TempTile; } // Dados do azulejo TempTile2 = new Lists.Structures.Map_Tile[Width_New + 1, Height_New + 1]; for (byte x = 0; x <= Width_New; x++) { for (byte y = 0; y <= Height_New; y++) { // Redimensiona para frente if (!chkReverse.Checked) { if (x <= Lists.Map[Selected].Width && y <= Lists.Map[Selected].Height) { TempTile2[x, y] = Lists.Map[Selected].Tile[x, y]; } else { TempTile2[x, y] = new Lists.Structures.Map_Tile(); TempTile2[x, y].Block = new bool[4]; } } // Redimensiona para trás else { if (x < Width_Difference || y < Height_Difference) { TempTile2[x, y] = new Lists.Structures.Map_Tile(); TempTile2[x, y].Block = new bool[4]; } else { TempTile2[x, y] = Lists.Map[Selected].Tile[x - Width_Difference, y - Height_Difference]; } } } } // Define os dados Lists.Map[Selected].Tile = TempTile2; }