public static void SelfFrame8Way(int i, int j, Tile centerTile, bool resetFrame) { if (!centerTile.active()) { return; } BlockStyle blockStyle = FindBlockStyle(centerTile); int num = 0; BlockStyle blockStyle2 = default(BlockStyle); if (blockStyle.top) { Tile tileSafely = GetTileSafely(i, j - 1); if (tileSafely.active() && WillItBlend(centerTile.type, tileSafely.type)) { blockStyle2 = FindBlockStyle(tileSafely); if (blockStyle2.bottom) { num |= 1; } else { blockStyle2.Clear(); } } } BlockStyle blockStyle3 = default(BlockStyle); if (blockStyle.left) { Tile tileSafely2 = GetTileSafely(i - 1, j); if (tileSafely2.active() && WillItBlend(centerTile.type, tileSafely2.type)) { blockStyle3 = FindBlockStyle(tileSafely2); if (blockStyle3.right) { num |= 2; } else { blockStyle3.Clear(); } } } BlockStyle blockStyle4 = default(BlockStyle); if (blockStyle.right) { Tile tileSafely3 = GetTileSafely(i + 1, j); if (tileSafely3.active() && WillItBlend(centerTile.type, tileSafely3.type)) { blockStyle4 = FindBlockStyle(tileSafely3); if (blockStyle4.left) { num |= 4; } else { blockStyle4.Clear(); } } } BlockStyle blockStyle5 = default(BlockStyle); if (blockStyle.bottom) { Tile tileSafely4 = GetTileSafely(i, j + 1); if (tileSafely4.active() && WillItBlend(centerTile.type, tileSafely4.type)) { blockStyle5 = FindBlockStyle(tileSafely4); if (blockStyle5.top) { num |= 8; } else { blockStyle5.Clear(); } } } if (blockStyle2.left && blockStyle3.top) { Tile tileSafely5 = GetTileSafely(i - 1, j - 1); if (tileSafely5.active() && WillItBlend(centerTile.type, tileSafely5.type)) { BlockStyle blockStyle6 = FindBlockStyle(tileSafely5); if (blockStyle6.right && blockStyle6.bottom) { num |= 0x10; } } } if (blockStyle2.right && blockStyle4.top) { Tile tileSafely6 = GetTileSafely(i + 1, j - 1); if (tileSafely6.active() && WillItBlend(centerTile.type, tileSafely6.type)) { BlockStyle blockStyle7 = FindBlockStyle(tileSafely6); if (blockStyle7.left && blockStyle7.bottom) { num |= 0x20; } } } if (blockStyle5.left && blockStyle3.bottom) { Tile tileSafely7 = GetTileSafely(i - 1, j + 1); if (tileSafely7.active() && WillItBlend(centerTile.type, tileSafely7.type)) { BlockStyle blockStyle8 = FindBlockStyle(tileSafely7); if (blockStyle8.right && blockStyle8.top) { num |= 0x40; } } } if (blockStyle5.right && blockStyle4.bottom) { Tile tileSafely8 = GetTileSafely(i + 1, j + 1); if (tileSafely8.active() && WillItBlend(centerTile.type, tileSafely8.type)) { BlockStyle blockStyle9 = FindBlockStyle(tileSafely8); if (blockStyle9.left && blockStyle9.top) { num |= 0x80; } } } if (resetFrame) { centerTile.frameNumber((byte)WorldGen.genRand.Next(0, 3)); } Point16 point = selfFrame8WayLookup[num][centerTile.frameNumber()]; centerTile.frameX = point.X; centerTile.frameY = point.Y; }
public static void SelfFrame8Way(int i, int j, Tile centerTile, bool resetFrame) { if (!centerTile.active()) { return; } ushort num = centerTile.type; Framing.BlockStyle blockStyle = Framing.FindBlockStyle(centerTile); int num1 = 0; Framing.BlockStyle blockStyle1 = new Framing.BlockStyle(); if (blockStyle.top) { Tile tileSafely = Framing.GetTileSafely(i, j - 1); if (tileSafely.active() && tileSafely.type == num) { blockStyle1 = Framing.FindBlockStyle(tileSafely); if (!blockStyle1.bottom) { blockStyle1.Clear(); } else { num1 = num1 | 1; } } } Framing.BlockStyle blockStyle2 = new Framing.BlockStyle(); if (blockStyle.left) { Tile tile = Framing.GetTileSafely(i - 1, j); if (tile.active() && tile.type == num) { blockStyle2 = Framing.FindBlockStyle(tile); if (!blockStyle2.right) { blockStyle2.Clear(); } else { num1 = num1 | 2; } } } Framing.BlockStyle blockStyle3 = new Framing.BlockStyle(); if (blockStyle.right) { Tile tileSafely1 = Framing.GetTileSafely(i + 1, j); if (tileSafely1.active() && tileSafely1.type == num) { blockStyle3 = Framing.FindBlockStyle(tileSafely1); if (!blockStyle3.left) { blockStyle3.Clear(); } else { num1 = num1 | 4; } } } Framing.BlockStyle blockStyle4 = new Framing.BlockStyle(); if (blockStyle.bottom) { Tile tile1 = Framing.GetTileSafely(i, j + 1); if (tile1.active() && tile1.type == num) { blockStyle4 = Framing.FindBlockStyle(tile1); if (!blockStyle4.top) { blockStyle4.Clear(); } else { num1 = num1 | 8; } } } if (blockStyle1.left && blockStyle2.top) { Tile tileSafely2 = Framing.GetTileSafely(i - 1, j - 1); if (tileSafely2.active() && tileSafely2.type == num) { Framing.BlockStyle blockStyle5 = Framing.FindBlockStyle(tileSafely2); if (blockStyle5.right && blockStyle5.bottom) { num1 = num1 | 16; } } } if (blockStyle1.right && blockStyle3.top) { Tile tile2 = Framing.GetTileSafely(i + 1, j - 1); if (tile2.active() && tile2.type == num) { Framing.BlockStyle blockStyle6 = Framing.FindBlockStyle(tile2); if (blockStyle6.left && blockStyle6.bottom) { num1 = num1 | 32; } } } if (blockStyle4.left && blockStyle2.bottom) { Tile tileSafely3 = Framing.GetTileSafely(i - 1, j + 1); if (tileSafely3.active() && tileSafely3.type == num) { Framing.BlockStyle blockStyle7 = Framing.FindBlockStyle(tileSafely3); if (blockStyle7.right && blockStyle7.top) { num1 = num1 | 64; } } } if (blockStyle4.right && blockStyle3.bottom) { Tile tile3 = Framing.GetTileSafely(i + 1, j + 1); if (tile3.active() && tile3.type == num) { Framing.BlockStyle blockStyle8 = Framing.FindBlockStyle(tile3); if (blockStyle8.left && blockStyle8.top) { num1 = num1 | 128; } } } if (resetFrame) { centerTile.frameNumber((byte)WorldGen.genRand.Next(0, 3)); } Point16 point16 = Framing.selfFrame8WayLookup[num1][centerTile.frameNumber()]; centerTile.frameX = point16.X; centerTile.frameY = point16.Y; }
public static void SelfFrame8Way(int i, int j, Tile centerTile, bool resetFrame) { if (!centerTile.active()) { return; } ushort gemsparkFramingType = TileID.Sets.GemsparkFramingTypes[(int)centerTile.type]; Framing.BlockStyle blockStyle1 = Framing.FindBlockStyle(centerTile); int index = 0; Framing.BlockStyle blockStyle2 = new Framing.BlockStyle(); if (blockStyle1.top) { Tile tileSafely = Framing.GetTileSafely(i, j - 1); if (tileSafely.active() && (int)TileID.Sets.GemsparkFramingTypes[(int)tileSafely.type] == (int)gemsparkFramingType) { blockStyle2 = Framing.FindBlockStyle(tileSafely); if (blockStyle2.bottom) { index |= 1; } else { blockStyle2.Clear(); } } } Framing.BlockStyle blockStyle3 = new Framing.BlockStyle(); if (blockStyle1.left) { Tile tileSafely = Framing.GetTileSafely(i - 1, j); if (tileSafely.active() && (int)TileID.Sets.GemsparkFramingTypes[(int)tileSafely.type] == (int)gemsparkFramingType) { blockStyle3 = Framing.FindBlockStyle(tileSafely); if (blockStyle3.right) { index |= 2; } else { blockStyle3.Clear(); } } } Framing.BlockStyle blockStyle4 = new Framing.BlockStyle(); if (blockStyle1.right) { Tile tileSafely = Framing.GetTileSafely(i + 1, j); if (tileSafely.active() && (int)TileID.Sets.GemsparkFramingTypes[(int)tileSafely.type] == (int)gemsparkFramingType) { blockStyle4 = Framing.FindBlockStyle(tileSafely); if (blockStyle4.left) { index |= 4; } else { blockStyle4.Clear(); } } } Framing.BlockStyle blockStyle5 = new Framing.BlockStyle(); if (blockStyle1.bottom) { Tile tileSafely = Framing.GetTileSafely(i, j + 1); if (tileSafely.active() && (int)TileID.Sets.GemsparkFramingTypes[(int)tileSafely.type] == (int)gemsparkFramingType) { blockStyle5 = Framing.FindBlockStyle(tileSafely); if (blockStyle5.top) { index |= 8; } else { blockStyle5.Clear(); } } } if (blockStyle2.left && blockStyle3.top) { Tile tileSafely = Framing.GetTileSafely(i - 1, j - 1); if (tileSafely.active() && (int)TileID.Sets.GemsparkFramingTypes[(int)tileSafely.type] == (int)gemsparkFramingType) { Framing.BlockStyle blockStyle6 = Framing.FindBlockStyle(tileSafely); if (blockStyle6.right && blockStyle6.bottom) { index |= 16; } } } if (blockStyle2.right && blockStyle4.top) { Tile tileSafely = Framing.GetTileSafely(i + 1, j - 1); if (tileSafely.active() && (int)TileID.Sets.GemsparkFramingTypes[(int)tileSafely.type] == (int)gemsparkFramingType) { Framing.BlockStyle blockStyle6 = Framing.FindBlockStyle(tileSafely); if (blockStyle6.left && blockStyle6.bottom) { index |= 32; } } } if (blockStyle5.left && blockStyle3.bottom) { Tile tileSafely = Framing.GetTileSafely(i - 1, j + 1); if (tileSafely.active() && (int)TileID.Sets.GemsparkFramingTypes[(int)tileSafely.type] == (int)gemsparkFramingType) { Framing.BlockStyle blockStyle6 = Framing.FindBlockStyle(tileSafely); if (blockStyle6.right && blockStyle6.top) { index |= 64; } } } if (blockStyle5.right && blockStyle4.bottom) { Tile tileSafely = Framing.GetTileSafely(i + 1, j + 1); if (tileSafely.active() && (int)TileID.Sets.GemsparkFramingTypes[(int)tileSafely.type] == (int)gemsparkFramingType) { Framing.BlockStyle blockStyle6 = Framing.FindBlockStyle(tileSafely); if (blockStyle6.left && blockStyle6.top) { index |= 128; } } } if (resetFrame) { centerTile.frameNumber((byte)WorldGen.genRand.Next(0, 3)); } Point16 point16 = Framing.selfFrame8WayLookup[index][(int)centerTile.frameNumber()]; centerTile.frameX = point16.X; centerTile.frameY = point16.Y; }
// Token: 0x0600087C RID: 2172 RVA: 0x003AD110 File Offset: 0x003AB310 public static void SelfFrame8Way(int i, int j, Tile centerTile, bool resetFrame) { if (!centerTile.active()) { return; } ushort num = TileID.Sets.GemsparkFramingTypes[(int)centerTile.type]; Framing.BlockStyle arg_28_0 = Framing.FindBlockStyle(centerTile); int num2 = 0; Framing.BlockStyle blockStyle = default(Framing.BlockStyle); if (arg_28_0.top) { Tile tileSafely = Framing.GetTileSafely(i, j - 1); if (tileSafely.active() && TileID.Sets.GemsparkFramingTypes[(int)tileSafely.type] == num) { blockStyle = Framing.FindBlockStyle(tileSafely); if (blockStyle.bottom) { num2 |= 1; } else { blockStyle.Clear(); } } } Framing.BlockStyle blockStyle2 = default(Framing.BlockStyle); if (arg_28_0.left) { Tile tileSafely2 = Framing.GetTileSafely(i - 1, j); if (tileSafely2.active() && TileID.Sets.GemsparkFramingTypes[(int)tileSafely2.type] == num) { blockStyle2 = Framing.FindBlockStyle(tileSafely2); if (blockStyle2.right) { num2 |= 2; } else { blockStyle2.Clear(); } } } Framing.BlockStyle blockStyle3 = default(Framing.BlockStyle); if (arg_28_0.right) { Tile tileSafely3 = Framing.GetTileSafely(i + 1, j); if (tileSafely3.active() && TileID.Sets.GemsparkFramingTypes[(int)tileSafely3.type] == num) { blockStyle3 = Framing.FindBlockStyle(tileSafely3); if (blockStyle3.left) { num2 |= 4; } else { blockStyle3.Clear(); } } } Framing.BlockStyle blockStyle4 = default(Framing.BlockStyle); if (arg_28_0.bottom) { Tile tileSafely4 = Framing.GetTileSafely(i, j + 1); if (tileSafely4.active() && TileID.Sets.GemsparkFramingTypes[(int)tileSafely4.type] == num) { blockStyle4 = Framing.FindBlockStyle(tileSafely4); if (blockStyle4.top) { num2 |= 8; } else { blockStyle4.Clear(); } } } if (blockStyle.left && blockStyle2.top) { Tile tileSafely5 = Framing.GetTileSafely(i - 1, j - 1); if (tileSafely5.active() && TileID.Sets.GemsparkFramingTypes[(int)tileSafely5.type] == num) { Framing.BlockStyle blockStyle5 = Framing.FindBlockStyle(tileSafely5); if (blockStyle5.right && blockStyle5.bottom) { num2 |= 16; } } } if (blockStyle.right && blockStyle3.top) { Tile tileSafely6 = Framing.GetTileSafely(i + 1, j - 1); if (tileSafely6.active() && TileID.Sets.GemsparkFramingTypes[(int)tileSafely6.type] == num) { Framing.BlockStyle blockStyle6 = Framing.FindBlockStyle(tileSafely6); if (blockStyle6.left && blockStyle6.bottom) { num2 |= 32; } } } if (blockStyle4.left && blockStyle2.bottom) { Tile tileSafely7 = Framing.GetTileSafely(i - 1, j + 1); if (tileSafely7.active() && TileID.Sets.GemsparkFramingTypes[(int)tileSafely7.type] == num) { Framing.BlockStyle blockStyle7 = Framing.FindBlockStyle(tileSafely7); if (blockStyle7.right && blockStyle7.top) { num2 |= 64; } } } if (blockStyle4.right && blockStyle3.bottom) { Tile tileSafely8 = Framing.GetTileSafely(i + 1, j + 1); if (tileSafely8.active() && TileID.Sets.GemsparkFramingTypes[(int)tileSafely8.type] == num) { Framing.BlockStyle blockStyle8 = Framing.FindBlockStyle(tileSafely8); if (blockStyle8.left && blockStyle8.top) { num2 |= 128; } } } if (resetFrame) { centerTile.frameNumber((byte)WorldGen.genRand.Next(0, 3)); } Point16 point = Framing.selfFrame8WayLookup[num2][(int)centerTile.frameNumber()]; centerTile.frameX = point.X; centerTile.frameY = point.Y; }
public static void SelfFrame8Way(int i, int j, Tile centerTile, bool resetFrame) { if (!centerTile.active()) { return; } ushort type = centerTile.type; Framing.BlockStyle blockStyle = Framing.FindBlockStyle(centerTile); int num = 0; Framing.BlockStyle blockStyle2 = default(Framing.BlockStyle); if (blockStyle.top) { Tile tileSafely = Framing.GetTileSafely(i, j - 1); if (tileSafely.active() && tileSafely.type == type) { blockStyle2 = Framing.FindBlockStyle(tileSafely); if (blockStyle2.bottom) { num |= 1; } else { blockStyle2.Clear(); } } } Framing.BlockStyle blockStyle3 = default(Framing.BlockStyle); if (blockStyle.left) { Tile tileSafely2 = Framing.GetTileSafely(i - 1, j); if (tileSafely2.active() && tileSafely2.type == type) { blockStyle3 = Framing.FindBlockStyle(tileSafely2); if (blockStyle3.right) { num |= 2; } else { blockStyle3.Clear(); } } } Framing.BlockStyle blockStyle4 = default(Framing.BlockStyle); if (blockStyle.right) { Tile tileSafely3 = Framing.GetTileSafely(i + 1, j); if (tileSafely3.active() && tileSafely3.type == type) { blockStyle4 = Framing.FindBlockStyle(tileSafely3); if (blockStyle4.left) { num |= 4; } else { blockStyle4.Clear(); } } } Framing.BlockStyle blockStyle5 = default(Framing.BlockStyle); if (blockStyle.bottom) { Tile tileSafely4 = Framing.GetTileSafely(i, j + 1); if (tileSafely4.active() && tileSafely4.type == type) { blockStyle5 = Framing.FindBlockStyle(tileSafely4); if (blockStyle5.top) { num |= 8; } else { blockStyle5.Clear(); } } } if (blockStyle2.left && blockStyle3.top) { Tile tileSafely5 = Framing.GetTileSafely(i - 1, j - 1); if (tileSafely5.active() && tileSafely5.type == type) { Framing.BlockStyle blockStyle6 = Framing.FindBlockStyle(tileSafely5); if (blockStyle6.right && blockStyle6.bottom) { num |= 16; } } } if (blockStyle2.right && blockStyle4.top) { Tile tileSafely6 = Framing.GetTileSafely(i + 1, j - 1); if (tileSafely6.active() && tileSafely6.type == type) { Framing.BlockStyle blockStyle7 = Framing.FindBlockStyle(tileSafely6); if (blockStyle7.left && blockStyle7.bottom) { num |= 32; } } } if (blockStyle5.left && blockStyle3.bottom) { Tile tileSafely7 = Framing.GetTileSafely(i - 1, j + 1); if (tileSafely7.active() && tileSafely7.type == type) { Framing.BlockStyle blockStyle8 = Framing.FindBlockStyle(tileSafely7); if (blockStyle8.right && blockStyle8.top) { num |= 64; } } } if (blockStyle5.right && blockStyle4.bottom) { Tile tileSafely8 = Framing.GetTileSafely(i + 1, j + 1); if (tileSafely8.active() && tileSafely8.type == type) { Framing.BlockStyle blockStyle9 = Framing.FindBlockStyle(tileSafely8); if (blockStyle9.left && blockStyle9.top) { num |= 128; } } } if (resetFrame) { centerTile.frameNumber((byte)WorldGen.genRand.Next(0, 3)); } Point16 point = Framing.selfFrame8WayLookup[num][(int)centerTile.frameNumber()]; centerTile.frameX = point.x; centerTile.frameY = point.y; }
public static void SelfFrame8Way(int i, int j, Tile centerTile, bool resetFrame) { if (!centerTile.active()) { return; } ushort type = centerTile.type; Framing.BlockStyle blockStyle = Framing.FindBlockStyle(centerTile); int num = 0; Framing.BlockStyle blockStyle2 = default(Framing.BlockStyle); if (blockStyle.top) { Tile tileSafely = Framing.GetTileSafely(i, j - 1); if (tileSafely.active() && tileSafely.type == type) { blockStyle2 = Framing.FindBlockStyle(tileSafely); if (blockStyle2.bottom) { num |= 1; } else { blockStyle2.Clear(); } } } Framing.BlockStyle blockStyle3 = default(Framing.BlockStyle); if (blockStyle.left) { Tile tileSafely2 = Framing.GetTileSafely(i - 1, j); if (tileSafely2.active() && tileSafely2.type == type) { blockStyle3 = Framing.FindBlockStyle(tileSafely2); if (blockStyle3.right) { num |= 2; } else { blockStyle3.Clear(); } } } Framing.BlockStyle blockStyle4 = default(Framing.BlockStyle); if (blockStyle.right) { Tile tileSafely3 = Framing.GetTileSafely(i + 1, j); if (tileSafely3.active() && tileSafely3.type == type) { blockStyle4 = Framing.FindBlockStyle(tileSafely3); if (blockStyle4.left) { num |= 4; } else { blockStyle4.Clear(); } } } Framing.BlockStyle blockStyle5 = default(Framing.BlockStyle); if (blockStyle.bottom) { Tile tileSafely4 = Framing.GetTileSafely(i, j + 1); if (tileSafely4.active() && tileSafely4.type == type) { blockStyle5 = Framing.FindBlockStyle(tileSafely4); if (blockStyle5.top) { num |= 8; } else { blockStyle5.Clear(); } } } if (blockStyle2.left && blockStyle3.top) { Tile tileSafely5 = Framing.GetTileSafely(i - 1, j - 1); if (tileSafely5.active() && tileSafely5.type == type) { Framing.BlockStyle blockStyle6 = Framing.FindBlockStyle(tileSafely5); if (blockStyle6.right && blockStyle6.bottom) { num |= 16; } } } if (blockStyle2.right && blockStyle4.top) { Tile tileSafely6 = Framing.GetTileSafely(i + 1, j - 1); if (tileSafely6.active() && tileSafely6.type == type) { Framing.BlockStyle blockStyle7 = Framing.FindBlockStyle(tileSafely6); if (blockStyle7.left && blockStyle7.bottom) { num |= 32; } } } if (blockStyle5.left && blockStyle3.bottom) { Tile tileSafely7 = Framing.GetTileSafely(i - 1, j + 1); if (tileSafely7.active() && tileSafely7.type == type) { Framing.BlockStyle blockStyle8 = Framing.FindBlockStyle(tileSafely7); if (blockStyle8.right && blockStyle8.top) { num |= 64; } } } if (blockStyle5.right && blockStyle4.bottom) { Tile tileSafely8 = Framing.GetTileSafely(i + 1, j + 1); if (tileSafely8.active() && tileSafely8.type == type) { Framing.BlockStyle blockStyle9 = Framing.FindBlockStyle(tileSafely8); if (blockStyle9.left && blockStyle9.top) { num |= 128; } } } if (resetFrame) { centerTile.frameNumber((byte)WorldGen.genRand.Next(0, 3)); } Point16 point = Framing.selfFrame8WayLookup[num][(int)centerTile.frameNumber()]; centerTile.frameX = point.X; centerTile.frameY = point.Y; }
public static void WriteTile(BinaryWriter writer, Tile tile) { byte flags = 0; if (tile.active()) { flags |= 1; } if (tile.wall != 0) { flags |= 2; } if (tile.liquid > 0) { flags |= 4; } if (tile.lava()) { flags |= 8; } if (tile.wire()) { flags |= 16; } writer.Write(flags); if ((flags & 1) == 1) { writer.Write(tile.type); if (Main.tileFrameImportant[tile.type]) { writer.Write(tile.frameNumber()); writer.Write(tile.frameX); writer.Write(tile.frameY); } } if ((flags & 2) == 2) { writer.Write(tile.wall); } if ((flags & 4) == 4) { writer.Write(tile.liquid); } }
public static Tile ReadTile(BinaryReader reader) { Tile tile = new Tile(); byte flags = reader.ReadByte(); if ((flags & 1) == 1) { byte type = reader.ReadByte(); tile.active(true); tile.type = type; if (Main.tileFrameImportant[type]) { tile.frameNumber(reader.ReadByte()); tile.frameX = reader.ReadInt16(); tile.frameY = reader.ReadInt16(); } else { tile.frameX = -1; tile.frameY = -1; } } if ((flags & 2) == 2) { tile.wall = reader.ReadByte(); } if ((flags & 4) == 4) { tile.liquid = reader.ReadByte(); } if ((flags & 8) == 8) { tile.lava(true); } if ((flags & 16) == 16) { tile.wire(true); } return tile; }
public static void SelfFrame8Way(int i, int j, Tile centerTile, bool resetFrame) { if (!centerTile.active()) return; ushort num = centerTile.type; Framing.BlockStyle blockStyle1 = Framing.FindBlockStyle(centerTile); int index = 0; Framing.BlockStyle blockStyle2 = new Framing.BlockStyle(); if (blockStyle1.top) { Tile tileSafely = Framing.GetTileSafely(i, j - 1); if (tileSafely.active() && (int)tileSafely.type == (int)num) { blockStyle2 = Framing.FindBlockStyle(tileSafely); if (blockStyle2.bottom) index |= 1; else blockStyle2.Clear(); } } Framing.BlockStyle blockStyle3 = new Framing.BlockStyle(); if (blockStyle1.left) { Tile tileSafely = Framing.GetTileSafely(i - 1, j); if (tileSafely.active() && (int)tileSafely.type == (int)num) { blockStyle3 = Framing.FindBlockStyle(tileSafely); if (blockStyle3.right) index |= 2; else blockStyle3.Clear(); } } Framing.BlockStyle blockStyle4 = new Framing.BlockStyle(); if (blockStyle1.right) { Tile tileSafely = Framing.GetTileSafely(i + 1, j); if (tileSafely.active() && (int)tileSafely.type == (int)num) { blockStyle4 = Framing.FindBlockStyle(tileSafely); if (blockStyle4.left) index |= 4; else blockStyle4.Clear(); } } Framing.BlockStyle blockStyle5 = new Framing.BlockStyle(); if (blockStyle1.bottom) { Tile tileSafely = Framing.GetTileSafely(i, j + 1); if (tileSafely.active() && (int)tileSafely.type == (int)num) { blockStyle5 = Framing.FindBlockStyle(tileSafely); if (blockStyle5.top) index |= 8; else blockStyle5.Clear(); } } if (blockStyle2.left && blockStyle3.top) { Tile tileSafely = Framing.GetTileSafely(i - 1, j - 1); if (tileSafely.active() && (int)tileSafely.type == (int)num) { Framing.BlockStyle blockStyle6 = Framing.FindBlockStyle(tileSafely); if (blockStyle6.right && blockStyle6.bottom) index |= 16; } } if (blockStyle2.right && blockStyle4.top) { Tile tileSafely = Framing.GetTileSafely(i + 1, j - 1); if (tileSafely.active() && (int)tileSafely.type == (int)num) { Framing.BlockStyle blockStyle6 = Framing.FindBlockStyle(tileSafely); if (blockStyle6.left && blockStyle6.bottom) index |= 32; } } if (blockStyle5.left && blockStyle3.bottom) { Tile tileSafely = Framing.GetTileSafely(i - 1, j + 1); if (tileSafely.active() && (int)tileSafely.type == (int)num) { Framing.BlockStyle blockStyle6 = Framing.FindBlockStyle(tileSafely); if (blockStyle6.right && blockStyle6.top) index |= 64; } } if (blockStyle5.right && blockStyle4.bottom) { Tile tileSafely = Framing.GetTileSafely(i + 1, j + 1); if (tileSafely.active() && (int)tileSafely.type == (int)num) { Framing.BlockStyle blockStyle6 = Framing.FindBlockStyle(tileSafely); if (blockStyle6.left && blockStyle6.top) index |= 128; } } if (resetFrame) centerTile.frameNumber((byte)WorldGen.genRand.Next(0, 3)); Point16 point16 = Framing.selfFrame8WayLookup[index][(int)centerTile.frameNumber()]; centerTile.frameX = point16.X; centerTile.frameY = point16.Y; }