TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ SelfFrame8Way()

static void Terraria.Framing.SelfFrame8Way ( int i,
int j,
Tile centerTile,
bool resetFrame )
inlinestatic

Definition at line 202 of file Framing.cs.

203 {
204 if (!centerTile.active())
205 {
206 return;
207 }
209 int num = 0;
210 BlockStyle blockStyle2 = default(BlockStyle);
211 if (blockStyle10.top)
212 {
213 Tile tileSafely = GetTileSafely(i, j - 1);
214 if (tileSafely.active() && WillItBlend(centerTile.type, tileSafely.type))
215 {
217 if (blockStyle2.bottom)
218 {
219 num |= 1;
220 }
221 else
222 {
223 blockStyle2.Clear();
224 }
225 }
226 }
227 BlockStyle blockStyle3 = default(BlockStyle);
228 if (blockStyle10.left)
229 {
231 if (tileSafely2.active() && WillItBlend(centerTile.type, tileSafely2.type))
232 {
234 if (blockStyle3.right)
235 {
236 num |= 2;
237 }
238 else
239 {
240 blockStyle3.Clear();
241 }
242 }
243 }
244 BlockStyle blockStyle4 = default(BlockStyle);
245 if (blockStyle10.right)
246 {
248 if (tileSafely3.active() && WillItBlend(centerTile.type, tileSafely3.type))
249 {
251 if (blockStyle4.left)
252 {
253 num |= 4;
254 }
255 else
256 {
257 blockStyle4.Clear();
258 }
259 }
260 }
261 BlockStyle blockStyle5 = default(BlockStyle);
262 if (blockStyle10.bottom)
263 {
265 if (tileSafely4.active() && WillItBlend(centerTile.type, tileSafely4.type))
266 {
268 if (blockStyle5.top)
269 {
270 num |= 8;
271 }
272 else
273 {
274 blockStyle5.Clear();
275 }
276 }
277 }
278 if (blockStyle2.left && blockStyle3.top)
279 {
280 Tile tileSafely5 = GetTileSafely(i - 1, j - 1);
281 if (tileSafely5.active() && WillItBlend(centerTile.type, tileSafely5.type))
282 {
284 if (blockStyle6.right && blockStyle6.bottom)
285 {
286 num |= 0x10;
287 }
288 }
289 }
290 if (blockStyle2.right && blockStyle4.top)
291 {
292 Tile tileSafely6 = GetTileSafely(i + 1, j - 1);
293 if (tileSafely6.active() && WillItBlend(centerTile.type, tileSafely6.type))
294 {
296 if (blockStyle7.left && blockStyle7.bottom)
297 {
298 num |= 0x20;
299 }
300 }
301 }
302 if (blockStyle5.left && blockStyle3.bottom)
303 {
304 Tile tileSafely7 = GetTileSafely(i - 1, j + 1);
305 if (tileSafely7.active() && WillItBlend(centerTile.type, tileSafely7.type))
306 {
308 if (blockStyle8.right && blockStyle8.top)
309 {
310 num |= 0x40;
311 }
312 }
313 }
314 if (blockStyle5.right && blockStyle4.bottom)
315 {
316 Tile tileSafely8 = GetTileSafely(i + 1, j + 1);
317 if (tileSafely8.active() && WillItBlend(centerTile.type, tileSafely8.type))
318 {
320 if (blockStyle9.left && blockStyle9.top)
321 {
322 num |= 0x80;
323 }
324 }
325 }
326 if (resetFrame)
327 {
328 centerTile.frameNumber((byte)WorldGen.genRand.Next(0, 3));
329 }
330 Point16 point = selfFrame8WayLookup[num][centerTile.frameNumber()];
331 centerTile.frameX = point.X;
332 centerTile.frameY = point.Y;
333 }
static Point16[][] selfFrame8WayLookup
Definition Framing.cs:34
static bool WillItBlend(ushort myType, ushort otherType)
Definition Framing.cs:189
static BlockStyle FindBlockStyle(Tile blockTile)
Definition Framing.cs:150
static Tile GetTileSafely(Vector2 position)
Definition Framing.cs:421

References Terraria.Framing.FindBlockStyle(), Terraria.WorldGen.genRand, Terraria.Framing.GetTileSafely(), Terraria.Framing.selfFrame8WayLookup, Terraria.Framing.WillItBlend(), Terraria.DataStructures.Point16.X, and Terraria.DataStructures.Point16.Y.

Referenced by Terraria.WorldGen.TileFrame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: