1781 {
1782 Tile tile = Main.tile[
i, j];
1783 if (tile == null)
1784 {
1785 return default(MapTile);
1786 }
1787 int num = 0;
1788 int num2 = Light;
1790 int num3 = 0;
1791 int baseOption = 0;
1792 if (tile.active())
1793 {
1794 int num4 = tile.type;
1796 bool flag = tile.invisibleBlock();
1797 if (tile.fullbrightBlock() && !flag)
1798 {
1799 num2 = 255;
1800 }
1801 if (flag)
1802 {
1803 num3 = 0;
1804 }
1805 else if (num4 == 5)
1806 {
1807 if (
WorldGen.IsThisAMushroomTree(i, j))
1808 {
1809 baseOption = 1;
1810 }
1811 num = tile.color();
1812 }
1813 else
1814 {
1815 switch (num4)
1816 {
1817 case 51:
1818 if ((i + j) % 2 == 0)
1819 {
1820 num3 = 0;
1821 }
1822 break;
1823 case 19:
1824 if (tile.frameY == 864)
1825 {
1826 num3 = 0;
1827 }
1828 break;
1829 case 184:
1830 if (tile.frameX / 22 == 10)
1831 {
1832 num4 = 627;
1834 }
1835 break;
1836 }
1837 if (num3 != 0)
1838 {
1840 num = ((num4 != 160) ? tile.color() : 0);
1841 }
1842 }
1843 }
1844 if (num3 == 0)
1845 {
1846 bool flag2 = tile.invisibleWall();
1847 if (tile.wall > 0 && tile.fullbrightWall() && !flag2)
1848 {
1849 num2 = 255;
1850 }
1851 if (tile.liquid > 32)
1852 {
1853 int num5 = tile.liquidType();
1855 }
1856 else if (!tile.invisibleWall() && tile.wall > 0 && tile.wall <
WallID.
Count)
1857 {
1858 int wall = tile.wall;
1860 num = tile.wallColor();
1861 switch (wall)
1862 {
1863 case 21:
1864 case 88:
1865 case 89:
1866 case 90:
1867 case 91:
1868 case 92:
1869 case 93:
1870 case 168:
1871 case 241:
1872 num = 0;
1873 break;
1874 case 27:
1876 break;
1877 default:
1878 baseOption = 0;
1879 break;
1880 }
1881 }
1882 }
1883 if (num3 == 0)
1884 {
1885 if ((double)j < Main.worldSurface)
1886 {
1887 if (Main.remixWorld)
1888 {
1889 num2 = 5;
1890 num3 = 100;
1891 }
1892 else
1893 {
1894 int num6 = (byte)(255.0 * ((double)j / Main.worldSurface));
1896 num2 = 255;
1897 num = 0;
1898 }
1899 }
1900 else if (j < Main.UnderworldLayer)
1901 {
1902 num = 0;
1903 byte b = 0;
1904 float num7 = Main.screenPosition.X / 16f - 5f;
1905 float num8 = (Main.screenPosition.X + (float)Main.screenWidth) / 16f + 5f;
1906 float num9 = Main.screenPosition.Y / 16f - 5f;
1907 float num10 = (Main.screenPosition.Y + (float)Main.screenHeight) / 16f + 5f;
1908 if (((
float)
i < num7 || (float)i > num8 || (
float)j < num9 || (float)j > num10) &&
i > 40 &&
i < Main.maxTilesX - 40 && j > 40 && j < Main.maxTilesY - 40)
1909 {
1910 for (
int k = i - 36; k <=
i + 30; k += 10)
1911 {
1912 for (int l = j - 36; l <= j + 30; l += 10)
1913 {
1914 int type = Main.Map[k, l].Type;
1915 for (
int m = 0; m <
snowTypes.Length; m++)
1916 {
1918 {
1919 b = byte.MaxValue;
1921 l = j + 31;
1922 break;
1923 }
1924 }
1925 }
1926 }
1927 }
1928 else
1929 {
1930 float num11 = (float)Main.SceneMetrics.SnowTileCount / (float)SceneMetrics.SnowTileMax;
1931 num11 *= 255f;
1932 if (num11 > 255f)
1933 {
1934 num11 = 255f;
1935 }
1936 b = (byte)num11;
1937 }
1939 }
1940 else
1941 {
1943 }
1944 }
1945 return MapTile.Create((ushort)(num3 + baseOption), (byte)num2, (byte)num);
1946 }
static readonly ushort Count
static ushort[] snowTypes
static ushort rockPosition
static ushort dirtPosition
static ushort[] wallLookup
static void GetTileBaseOption(int x, int y, int tileType, Tile tileCache, ref int baseOption)
static ushort[] tileLookup
static ushort hellPosition
static ushort skyPosition
static ushort liquidPosition