wallFrameX() public method

public wallFrameX ( ) : int
return int
Beispiel #1
0
        public static void WallFrame(int i, int j, bool resetFrame = false)
        {
            if (i <= 0 || j <= 0 || i >= Main.maxTilesX - 1 || j >= Main.maxTilesY - 1 || Main.tile[i, j] == null)
            {
                return;
            }
            Tile tile = Main.tile[i, j];

            if (tile.wall == 0)
            {
                tile.wallColor(0);
                return;
            }
            int  num   = 0;
            Tile tile2 = Main.tile[i, j - 1];

            if (tile2 != null && tile2.wall > 0)
            {
                num = 1;
            }
            tile2 = Main.tile[i - 1, j];
            if (tile2 != null && tile2.wall > 0)
            {
                num |= 2;
            }
            tile2 = Main.tile[i + 1, j];
            if (tile2 != null && tile2.wall > 0)
            {
                num |= 4;
            }
            tile2 = Main.tile[i, j + 1];
            if (tile2 != null && tile2.wall > 0)
            {
                num |= 8;
            }
            int num2;

            if (Main.wallLargeFrames[(int)tile.wall] == 1)
            {
                num2 = Framing.largeTileFrameNumberLookup[j % 4][i % 3] - 1;
                tile.wallFrameNumber((byte)num2);
            }
            else if (resetFrame)
            {
                num2 = WorldGen.genRand.Next(0, 3);
                tile.wallFrameNumber((byte)num2);
            }
            else
            {
                num2 = (int)tile.wallFrameNumber();
            }
            if (num == 15)
            {
                num += Framing.centerWallFrameLookup[i % 3][j % 3];
            }
            Point16 point = Framing.wallFrameLookup[num][num2];

            tile.wallFrameX((int)point.x);
            tile.wallFrameY((int)point.y);
        }
Beispiel #2
0
        public static void WallFrame(int i, int j, bool resetFrame = false)
        {
            if (WorldGen.SkipFramingBecauseOfGen || i <= 0 || j <= 0 || i >= Main.maxTilesX - 1 || j >= Main.maxTilesY - 1 || Main.tile[i, j] == null)
            {
                return;
            }
            WorldGen.UpdateMapTile(i, j);
            Tile tile = Main.tile[i, j];

            if (tile.wall == 0)
            {
                tile.wallColor(0);
                return;
            }
            int  num   = 0;
            Tile tile2 = Main.tile[i, j - 1];

            if (tile2 != null && (tile2.wall > 0 || (tile2.active() && tile2.type == 54)))
            {
                num = 1;
            }
            tile2 = Main.tile[i - 1, j];
            if (tile2 != null && (tile2.wall > 0 || (tile2.active() && tile2.type == 54)))
            {
                num |= 2;
            }
            tile2 = Main.tile[i + 1, j];
            if (tile2 != null && (tile2.wall > 0 || (tile2.active() && tile2.type == 54)))
            {
                num |= 4;
            }
            tile2 = Main.tile[i, j + 1];
            if (tile2 != null && (tile2.wall > 0 || (tile2.active() && tile2.type == 54)))
            {
                num |= 8;
            }
            int num2 = 0;

            if (Main.wallLargeFrames[tile.wall] == 1)
            {
                num2 = phlebasTileFrameNumberLookup[j % 4][i % 3] - 1;
                tile.wallFrameNumber((byte)num2);
            }
            else if (Main.wallLargeFrames[tile.wall] == 2)
            {
                num2 = lazureTileFrameNumberLookup[i % 2][j % 2] - 1;
                tile.wallFrameNumber((byte)num2);
            }
            else if (resetFrame)
            {
                num2 = WorldGen.genRand.Next(0, 3);
                if (tile.wall == 21 && WorldGen.genRand.Next(2) == 0)
                {
                    num2 = 2;
                }
                tile.wallFrameNumber((byte)num2);
            }
            else
            {
                num2 = tile.wallFrameNumber();
            }
            if (num == 15)
            {
                num += centerWallFrameLookup[i % 3][j % 3];
            }
            Point16 point = wallFrameLookup[num][num2];

            tile.wallFrameX(point.X);
            tile.wallFrameY(point.Y);
        }
Beispiel #3
0
        public static void WallFrame(int i, int j, bool resetFrame = false)
        {
            if (i <= 0 || j <= 0 || (i >= Main.maxTilesX - 1 || j >= Main.maxTilesY - 1) || Main.tile[i, j] == null)
            {
                return;
            }
            WorldGen.UpdateMapTile(i, j, true);
            Tile tile1 = Main.tile[i, j];

            if ((int)tile1.wall == 0)
            {
                tile1.wallColor((byte)0);
            }
            else
            {
                int  index1 = 0;
                Tile tile2  = Main.tile[i, j - 1];
                if (tile2 != null && ((int)tile2.wall > 0 || tile2.active() && (int)tile2.type == 54))
                {
                    index1 = 1;
                }
                Tile tile3 = Main.tile[i - 1, j];
                if (tile3 != null && ((int)tile3.wall > 0 || tile3.active() && (int)tile3.type == 54))
                {
                    index1 |= 2;
                }
                Tile tile4 = Main.tile[i + 1, j];
                if (tile4 != null && ((int)tile4.wall > 0 || tile4.active() && (int)tile4.type == 54))
                {
                    index1 |= 4;
                }
                Tile tile5 = Main.tile[i, j + 1];
                if (tile5 != null && ((int)tile5.wall > 0 || tile5.active() && (int)tile5.type == 54))
                {
                    index1 |= 8;
                }
                int index2;
                if ((int)Main.wallLargeFrames[(int)tile1.wall] == 1)
                {
                    index2 = Framing.phlebasTileFrameNumberLookup[j % 4][i % 3] - 1;
                    tile1.wallFrameNumber((byte)index2);
                }
                else if ((int)Main.wallLargeFrames[(int)tile1.wall] == 2)
                {
                    index2 = Framing.lazureTileFrameNumberLookup[i % 2][j % 2] - 1;
                    tile1.wallFrameNumber((byte)index2);
                }
                else if (resetFrame)
                {
                    index2 = WorldGen.genRand.Next(0, 3);
                    tile1.wallFrameNumber((byte)index2);
                }
                else
                {
                    index2 = (int)tile1.wallFrameNumber();
                }
                if (index1 == 15)
                {
                    index1 += Framing.centerWallFrameLookup[i % 3][j % 3];
                }
                Point16 point16 = Framing.wallFrameLookup[index1][index2];
                tile1.wallFrameX((int)point16.X);
                tile1.wallFrameY((int)point16.Y);
            }
        }
Beispiel #4
0
        public static void WallFrame(int i, int j, bool resetFrame = false)
        {
            if (i <= 0 || j <= 0 || i >= Main.maxTilesX - 1 || j >= Main.maxTilesY - 1 || Main.tile[i, j] == null)
            {
                return;
            }
            WorldGen.UpdateMapTile(i, j, true);
            Tile tile = Main.tile[i, j];

            if (tile.wall == WallID.None)
            {
                tile.wallColor(0);
                return;
            }
            int  num   = 0;
            Tile tile1 = Main.tile[i, j - 1];

            if (tile1 != null && (tile1.wall > 0 || tile1.active() && tile1.type == 54))
            {
                num = 1;
            }
            tile1 = Main.tile[i - 1, j];
            if (tile1 != null && (tile1.wall > 0 || tile1.active() && tile1.type == 54))
            {
                num = num | 2;
            }
            tile1 = Main.tile[i + 1, j];
            if (tile1 != null && (tile1.wall > 0 || tile1.active() && tile1.type == 54))
            {
                num = num | 4;
            }
            tile1 = Main.tile[i, j + 1];
            if (tile1 != null && (tile1.wall > 0 || tile1.active() && tile1.type == 54))
            {
                num = num | 8;
            }
            int num1 = 0;

            if (Main.wallLargeFrames[tile.wall] == 1)
            {
                num1 = Framing.phlebasTileFrameNumberLookup[j % 4][i % 3] - 1;
                tile.wallFrameNumber((byte)num1);
            }
            else if (Main.wallLargeFrames[tile.wall] == 2)
            {
                num1 = Framing.lazureTileFrameNumberLookup[i % 2][j % 2] - 1;
                tile.wallFrameNumber((byte)num1);
            }
            else if (!resetFrame)
            {
                num1 = tile.wallFrameNumber();
            }
            else
            {
                num1 = WorldGen.genRand.Next(0, 3);
                tile.wallFrameNumber((byte)num1);
            }
            if (num == 15)
            {
                num = num + Framing.centerWallFrameLookup[i % 3][j % 3];
            }
            Point16 point16 = Framing.wallFrameLookup[num][num1];

            tile.wallFrameX(point16.X);
            tile.wallFrameY(point16.Y);
        }