1894 {
1895 short num = 0;
1896 short num2 = 0;
1897 short num3 = 0;
1898 short num4 = 0;
1899 int num5 = 0;
1900 int num6 = 0;
1901 byte b = 0;
1902 byte[]
array =
new byte[16];
1904 for (
int i = yStart;
i < yStart + height;
i++)
1905 {
1906 for (int j = xStart; j < xStart + width; j++)
1907 {
1908 Tile tile2 = Main.tile[j,
i];
1910 {
1911 num4++;
1912 continue;
1913 }
1914 if (tile != null)
1915 {
1916 if (num4 > 0)
1917 {
1918 array[num5] = (byte)((uint)num4 & 0xFFu);
1919 num5++;
1920 if (num4 > 255)
1921 {
1922 b = (byte)(b | 0x80u);
1923 array[num5] = (byte)((num4 & 0xFF00) >> 8);
1924 num5++;
1925 }
1926 else
1927 {
1928 b = (byte)(b | 0x40u);
1929 }
1930 }
1933 num4 = 0;
1934 }
1935 num5 = 4;
1936 byte b3;
1937 byte b2;
1938 byte b4;
1939 b = (b4 = (b3 = (b2 = 0)));
1940 if (tile2.active())
1941 {
1942 b = (byte)(b | 2u);
1943 array[num5] = (byte)tile2.type;
1944 num5++;
1945 if (tile2.type > 255)
1946 {
1947 array[num5] = (byte)(tile2.type >> 8);
1948 num5++;
1949 b = (byte)(b | 0x20u);
1950 }
1952 {
1953 short num7 = (
short)Chest.FindChest(j, i);
1954 if (num7 != -1)
1955 {
1957 num++;
1958 }
1959 }
1960 if (tile2.type == 88 && tile2.frameX % 54 == 0 && tile2.frameY % 36 == 0)
1961 {
1962 short num8 = (
short)Chest.FindChest(j, i);
1963 if (num8 != -1)
1964 {
1966 num++;
1967 }
1968 }
1969 if (tile2.type == 85 && tile2.frameX % 36 == 0 && tile2.frameY % 36 == 0)
1970 {
1971 short num9 = (
short)
Sign.ReadSign(j, i);
1972 if (num9 != -1)
1973 {
1975 }
1976 }
1977 if (tile2.type == 55 && tile2.frameX % 36 == 0 && tile2.frameY % 36 == 0)
1978 {
1979 short num10 = (
short)
Sign.ReadSign(j, i);
1980 if (num10 != -1)
1981 {
1983 }
1984 }
1985 if (tile2.type == 425 && tile2.frameX % 36 == 0 && tile2.frameY % 36 == 0)
1986 {
1987 short num11 = (
short)
Sign.ReadSign(j, i);
1988 if (num11 != -1)
1989 {
1991 }
1992 }
1993 if (tile2.type == 573 && tile2.frameX % 36 == 0 && tile2.frameY % 36 == 0)
1994 {
1995 short num12 = (
short)
Sign.ReadSign(j, i);
1996 if (num12 != -1)
1997 {
1999 }
2000 }
2001 if (tile2.type == 378 && tile2.frameX % 36 == 0 && tile2.frameY == 0)
2002 {
2004 if (num13 != -1)
2005 {
2007 }
2008 }
2009 if (tile2.type == 395 && tile2.frameX % 36 == 0 && tile2.frameY == 0)
2010 {
2012 if (num14 != -1)
2013 {
2015 }
2016 }
2017 if (tile2.type == 520 && tile2.frameX % 18 == 0 && tile2.frameY == 0)
2018 {
2020 if (num15 != -1)
2021 {
2023 }
2024 }
2025 if (tile2.type == 471 && tile2.frameX % 54 == 0 && tile2.frameY == 0)
2026 {
2028 if (num16 != -1)
2029 {
2031 }
2032 }
2033 if (tile2.type == 470 && tile2.frameX % 36 == 0 && tile2.frameY == 0)
2034 {
2036 if (num17 != -1)
2037 {
2039 }
2040 }
2041 if (tile2.type == 475 && tile2.frameX % 54 == 0 && tile2.frameY == 0)
2042 {
2044 if (num18 != -1)
2045 {
2047 }
2048 }
2049 if (tile2.type == 597 && tile2.frameX % 54 == 0 && tile2.frameY % 72 == 0)
2050 {
2052 if (num19 != -1)
2053 {
2055 }
2056 }
2057 if (Main.tileFrameImportant[tile2.type])
2058 {
2059 array[num5] = (byte)((uint)tile2.frameX & 0xFFu);
2060 num5++;
2061 array[num5] = (byte)((tile2.frameX & 0xFF00) >> 8);
2062 num5++;
2063 array[num5] = (byte)((uint)tile2.frameY & 0xFFu);
2064 num5++;
2065 array[num5] = (byte)((tile2.frameY & 0xFF00) >> 8);
2066 num5++;
2067 }
2068 if (tile2.color() != 0)
2069 {
2070 b3 = (byte)(b3 | 8u);
2071 array[num5] = tile2.color();
2072 num5++;
2073 }
2074 }
2075 if (tile2.wall != 0)
2076 {
2077 b = (byte)(b | 4u);
2078 array[num5] = (byte)tile2.wall;
2079 num5++;
2080 if (tile2.wallColor() != 0)
2081 {
2082 b3 = (byte)(b3 | 0x10u);
2083 array[num5] = tile2.wallColor();
2084 num5++;
2085 }
2086 }
2087 if (tile2.liquid != 0)
2088 {
2089 if (!tile2.shimmer())
2090 {
2091 b = (tile2.lava() ? ((byte)(b | 0x10u)) : ((!tile2.honey()) ? ((byte)(b | 8u)) : ((byte)(b | 0x18u))));
2092 }
2093 else
2094 {
2095 b3 = (byte)(b3 | 0x80u);
2096 b = (byte)(b | 8u);
2097 }
2098 array[num5] = tile2.liquid;
2099 num5++;
2100 }
2101 if (tile2.wire())
2102 {
2103 b4 = (byte)(b4 | 2u);
2104 }
2105 if (tile2.wire2())
2106 {
2107 b4 = (byte)(b4 | 4u);
2108 }
2109 if (tile2.wire3())
2110 {
2111 b4 = (byte)(b4 | 8u);
2112 }
2113 int num20 = (tile2.halfBrick() ? 16 : ((tile2.slope() != 0) ? (tile2.slope() + 1 << 4) : 0));
2114 b4 |= (byte)num20;
2115 if (tile2.actuator())
2116 {
2117 b3 = (byte)(b3 | 2u);
2118 }
2119 if (tile2.inActive())
2120 {
2121 b3 = (byte)(b3 | 4u);
2122 }
2123 if (tile2.wire4())
2124 {
2125 b3 = (byte)(b3 | 0x20u);
2126 }
2127 if (tile2.wall > 255)
2128 {
2129 array[num5] = (byte)(tile2.wall >> 8);
2130 num5++;
2131 b3 = (byte)(b3 | 0x40u);
2132 }
2133 if (tile2.invisibleBlock())
2134 {
2135 b2 = (byte)(b2 | 2u);
2136 }
2137 if (tile2.invisibleWall())
2138 {
2139 b2 = (byte)(b2 | 4u);
2140 }
2141 if (tile2.fullbrightBlock())
2142 {
2143 b2 = (byte)(b2 | 8u);
2144 }
2145 if (tile2.fullbrightWall())
2146 {
2147 b2 = (byte)(b2 | 0x10u);
2148 }
2149 num6 = 3;
2150 if (b2 != 0)
2151 {
2152 b3 = (byte)(b3 | 1u);
2154 num6--;
2155 }
2156 if (b3 != 0)
2157 {
2158 b4 = (byte)(b4 | 1u);
2160 num6--;
2161 }
2162 if (b4 != 0)
2163 {
2164 b = (byte)(b | 1u);
2166 num6--;
2167 }
2168 tile = tile2;
2169 }
2170 }
2171 if (num4 > 0)
2172 {
2173 array[num5] = (byte)((uint)num4 & 0xFFu);
2174 num5++;
2175 if (num4 > 255)
2176 {
2177 b = (byte)(b | 0x80u);
2178 array[num5] = (byte)((num4 & 0xFF00) >> 8);
2179 num5++;
2180 }
2181 else
2182 {
2183 b = (byte)(b | 0x40u);
2184 }
2185 }
2189 for (int k = 0; k < num; k++)
2190 {
2193 writer.Write((
short)chest.x);
2194 writer.Write((
short)chest.y);
2195 writer.Write(chest.name);
2196 }
2198 for (int l = 0; l < num2; l++)
2199 {
2202 writer.Write((
short)sign.x);
2203 writer.Write((
short)sign.y);
2205 }
2207 for (int m = 0; m < num3; m++)
2208 {
2210 }
2211 }
static Dictionary< int, TileEntity > ByID
static void Write(BinaryWriter writer, TileEntity ent, bool networkSend=false)
static int Find(int x, int y)
static int Find(int x, int y)
static int Find(int x, int y)
static int Find(int x, int y)
static int Find(int x, int y)
static int Find(int x, int y)
static int Find(int x, int y)
static bool[] AllowsSaveCompressionBatching
static short[] _compressSignList
static short[] _compressChestList
static short[] _compressEntities