public static void Move(byte Index, byte Movement) { byte x = Character(Index).X, y = Character(Index).Y; short Map_Num = Character(Index).Map; short Next_X = x, Next_Y = y; short Link = Lists.Map[Map_Num].Link[(byte)Character(Index).Direction]; bool SecondMovement = false; // Previne erros if (Movement < 1 || Movement > 2) { return; } if (Lists.Temp_Player[Index].GettingMap) { return; } // Próximo azulejo Map.NextTile(Character(Index).Direction, ref Next_X, ref Next_Y); // Ponto de ligação if (Map.OutLimit(Map_Num, Next_X, Next_Y)) { if (Link > 0) { switch (Character(Index).Direction) { case Game.Directions.Up: Warp(Index, Link, x, Lists.Map[Map_Num].Height); return; case Game.Directions.Down: Warp(Index, Link, x, 0); return; case Game.Directions.Right: Warp(Index, Link, 0, y); return; case Game.Directions.Left: Warp(Index, Link, Lists.Map[Map_Num].Width, y); return; } } else { Send.Player_Position(Index); return; } } // Bloqueio else if (!Map.Tile_Blocked(Map_Num, x, y, Character(Index).Direction)) { Character(Index).X = (byte)Next_X; Character(Index).Y = (byte)Next_Y; } // Atributos Lists.Structures.Map_Tile Azulejo = Lists.Map[Map_Num].Tile[Next_X, Next_Y]; switch ((Map.Attributes)Azulejo.Attribute) { // Teletransporte case Map.Attributes.Warp: if (Azulejo.Data_4 > 0) { Character(Index).Direction = (Game.Directions)Azulejo.Data_4 - 1; } Warp(Index, Azulejo.Data_1, (byte)Azulejo.Data_2, (byte)Azulejo.Data_3); SecondMovement = true; break; } // Envia os dados if (!SecondMovement && (x != Character(Index).X || y != Character(Index).Y)) { Send.Player_Move(Index, Movement); } else { Send.Player_Position(Index); } }
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; }