public static Objects.MiniMapTile[] getMapTiles(string fileName) { if (fileExists(fileName)) { Objects.Location pos = getFileCoordinates(fileName); byte[] fileContents = ReadFile(Environment.ExpandEnvironmentVariables(fileName)); int index = 0; Objects.MiniMapTile[] Tiles = new Objects.MiniMapTile[65536]; for (int x = 0; x < 256; x++) { for (int y = 0; y < 256; y++) { Tiles[index].color = fileContents[index]; Tiles[index].speed = fileContents[index + 65536]; Tiles[index].x = pos.x + x; Tiles[index].y = pos.y + y; Tiles[index].z = pos.z; Tiles[index].walkable = false; if (fileContents[index + 65536] != 255) { Tiles[index].walkable = true; } Tiles[index].fishable = false; if (fileContents[index] == 40) { Tiles[index].fishable = true; } index++; } } return(Tiles); } else { return(new Objects.MiniMapTile[0]); } }
public static Objects.MiniMapTile[] getMapTiles(string fileName) { if (fileExists(fileName)) { Objects.Location pos = getFileCoordinates(fileName); byte[] fileContents = ReadFile(Environment.ExpandEnvironmentVariables(fileName)); int index = 0; Objects.MiniMapTile[] Tiles = new Objects.MiniMapTile[65536]; for (int x = 0; x < 256; x++) { for (int y = 0; y < 256; y++) { Tiles[index].color = fileContents[index]; Tiles[index].speed = fileContents[index + 65536]; Tiles[index].x = pos.x + x; Tiles[index].y = pos.y + y; Tiles[index].z = pos.z; Tiles[index].walkable = false; if (fileContents[index + 65536] != 255) { Tiles[index].walkable = true; } Tiles[index].fishable = false; if (fileContents[index] == 40) { Tiles[index].fishable = true; } index++; } } return Tiles; } else { return new Objects.MiniMapTile[0]; } }