color() public method

public color ( ) : byte
return byte
Exemplo n.º 1
0
        public void DrawFreshAnimations(SpriteBatch spriteBatch)
        {
            for (int index = 0; index < this.data.Length; ++index)
            {
                ++this.data[index].animationTimeElapsed;
            }
            if (!Main.SettingsEnabled_MinersWobble)
            {
                return;
            }
            int     num1      = 1;
            Vector2 vector2_1 = new Vector2((float)Main.offScreenRange);

            if (Main.drawToScreen)
            {
                vector2_1 = Vector2.Zero;
            }
            vector2_1 = Vector2.Zero;
            for (int index = 0; index < this.data.Length; ++index)
            {
                if (this.data[index].type == num1)
                {
                    int damage = this.data[index].damage;
                    if (damage >= 20)
                    {
                        int x = this.data[index].X;
                        int y = this.data[index].Y;
                        if (WorldGen.InWorld(x, y, 0))
                        {
                            bool flag1 = Main.tile[x, y] != null;
                            if (flag1 && num1 == 1)
                            {
                                flag1 = flag1 && Main.tile[x, y].active() && Main.tileSolid[(int)Main.tile[x, y].type];
                            }
                            if (flag1 && num1 == 2)
                            {
                                flag1 = flag1 && Main.tile[x, y].wall > (ushort)0;
                            }
                            if (flag1)
                            {
                                bool flag2 = false;
                                bool flag3 = false;
                                if (Main.tile[x, y].type == (ushort)10)
                                {
                                    flag2 = false;
                                }
                                else if (Main.tileSolid[(int)Main.tile[x, y].type] && !Main.tileSolidTop[(int)Main.tile[x, y].type])
                                {
                                    flag2 = true;
                                }
                                else if (WorldGen.IsTreeType((int)Main.tile[x, y].type))
                                {
                                    flag3 = true;
                                    int num2 = (int)Main.tile[x, y].frameX / 22;
                                    int num3 = (int)Main.tile[x, y].frameY / 22;
                                    if (num3 < 9)
                                    {
                                        flag2 = (num2 != 1 && num2 != 2 || (num3 < 6 || num3 > 8)) && ((num2 != 3 || num3 > 2) && ((num2 != 4 || num3 < 3 || num3 > 5) && (num2 != 5 || num3 < 6 || num3 > 8)));
                                    }
                                }
                                else if (Main.tile[x, y].type == (ushort)72)
                                {
                                    flag3 = true;
                                    if (Main.tile[x, y].frameX <= (short)34)
                                    {
                                        flag2 = true;
                                    }
                                }
                                if (flag2 && Main.tile[x, y].slope() == (byte)0 && !Main.tile[x, y].halfBrick())
                                {
                                    int num2 = 0;
                                    if (damage >= 80)
                                    {
                                        num2 = 3;
                                    }
                                    else if (damage >= 60)
                                    {
                                        num2 = 2;
                                    }
                                    else if (damage >= 40)
                                    {
                                        num2 = 1;
                                    }
                                    else if (damage >= 20)
                                    {
                                        num2 = 0;
                                    }
                                    Rectangle rectangle = new Rectangle(this.data[index].crackStyle * 18, num2 * 18, 16, 16);
                                    rectangle.Inflate(-2, -2);
                                    if (flag3)
                                    {
                                        rectangle.X = (4 + this.data[index].crackStyle / 2) * 18;
                                    }
                                    int animationTimeElapsed = this.data[index].animationTimeElapsed;
                                    if ((double)animationTimeElapsed < 10.0)
                                    {
                                        double  num3     = (double)animationTimeElapsed / 10.0;
                                        Color   color1   = Lighting.GetColor(x, y);
                                        float   rotation = 0.0f;
                                        Vector2 zero     = Vector2.Zero;
                                        float   num4     = 0.5f;
                                        float   num5     = (float)num3 % num4 * (1f / num4);
                                        if ((int)(num3 / (double)num4) % 2 == 1)
                                        {
                                            num5 = 1f - num5;
                                        }
                                        Tile      tileSafely        = Framing.GetTileSafely(x, y);
                                        Tile      tile              = tileSafely;
                                        Texture2D requestIfNotReady = Main.instance.TilePaintSystem.TryGetTileAndRequestIfNotReady((int)tileSafely.type, 0, (int)tileSafely.color());
                                        if (requestIfNotReady != null)
                                        {
                                            Vector2 origin    = new Vector2(8f);
                                            Vector2 vector2_2 = new Vector2(1f);
                                            double  num6      = (double)num5 * 0.200000002980232 + 1.0;
                                            float   num7      = 1f - num5;
                                            float   num8      = 1f;
                                            Color   color2    = color1 * (float)((double)num8 * (double)num8 * 0.800000011920929);
                                            Vector2 vector2_3 = vector2_2;
                                            Vector2 scale     = (float)num6 * vector2_3;
                                            Vector2 position  = (new Vector2((float)(x * 16 - (int)Main.screenPosition.X), (float)(y * 16 - (int)Main.screenPosition.Y)) + vector2_1 + origin + zero).Floor();
                                            spriteBatch.Draw(requestIfNotReady, position, new Rectangle?(new Rectangle((int)tile.frameX, (int)tile.frameY, 16, 16)), color2, rotation, origin, scale, SpriteEffects.None, 0.0f);
                                            color2.A = (byte)180;
                                            spriteBatch.Draw(TextureAssets.TileCrack.get_Value(), position, new Rectangle?(rectangle), color2, rotation, origin, scale, SpriteEffects.None, 0.0f);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 public bool isTheSameAs(Tile compTile)
 {
     if (compTile == null)
     {
         return(false);
     }
     if (this.active() != compTile.active())
     {
         return(false);
     }
     if (this.active())
     {
         if (this.type != compTile.type)
         {
             return(false);
         }
         if (Main.tileFrameImportant[(int)this.type])
         {
             if (this.frameX != compTile.frameX)
             {
                 return(false);
             }
             if (this.frameY != compTile.frameY)
             {
                 return(false);
             }
         }
     }
     return(this.wall == compTile.wall && this.liquid == compTile.liquid && this.lava() == compTile.lava() && this.honey() == compTile.honey() && this.wire() == compTile.wire() && this.wire2() == compTile.wire2() && this.wire3() == compTile.wire3() && this.halfBrick() == compTile.halfBrick() && this.actuator() == compTile.actuator() && this.inActive() == compTile.inActive() && this.wallColor() == compTile.wallColor() && this.color() == compTile.color() && this.slope() == compTile.slope());
 }
Exemplo n.º 3
0
 public static void TrackColors(int i, int j, Tile trackTile, out int frontColor, out int backColor)
 {
     int num;
     int num1;
     Tile tile;
     int num2;
     if (trackTile.type != 314)
     {
         frontColor = 0;
         backColor = 0;
     }
     else
     {
         frontColor = trackTile.color();
         backColor = frontColor;
         if (trackTile.frameY == -1)
         {
             return;
         }
         int num3 = Minecart._leftSideConnection[trackTile.frameX];
         int num4 = Minecart._rightSideConnection[trackTile.frameX];
         int num5 = Minecart._leftSideConnection[trackTile.frameY];
         int num6 = Minecart._rightSideConnection[trackTile.frameY];
         int num7 = 0;
         int num8 = 0;
         int num9 = 0;
         int num10 = 0;
         for (int i1 = 0; i1 < 4; i1++)
         {
             switch (i1)
             {
                 case 1:
                 {
                     num = num4;
                     break;
                 }
                 case 2:
                 {
                     num = num5;
                     break;
                 }
                 case 3:
                 {
                     num = num6;
                     break;
                 }
                 default:
                 {
                     num = num3;
                     break;
                 }
             }
             switch (num)
             {
                 case 0:
                 {
                     num1 = -1;
                     break;
                 }
                 case 1:
                 {
                     num1 = 0;
                     break;
                 }
                 case 2:
                 {
                     num1 = 1;
                     break;
                 }
                 default:
                 {
                     num1 = 0;
                     break;
                 }
             }
             tile = (i1 % 2 != 0 ? Main.tile[i + 1, j + num1] : Main.tile[i - 1, j + num1]);
             if (tile == null || !tile.active() || tile.type != 314)
             {
                 num2 = 0;
             }
             else
             {
                 num2 = tile.color();
             }
             switch (i1)
             {
                 case 1:
                 {
                     num8 = num2;
                     break;
                 }
                 case 2:
                 {
                     num9 = num2;
                     break;
                 }
                 case 3:
                 {
                     num10 = num2;
                     break;
                 }
                 default:
                 {
                     num7 = num2;
                     break;
                 }
             }
         }
         if (num3 == num5)
         {
             if (num8 != 0)
             {
                 frontColor = num8;
             }
             else if (num7 != 0)
             {
                 frontColor = num7;
             }
             if (num10 != 0)
             {
                 backColor = num10;
                 return;
             }
             if (num9 != 0)
             {
                 backColor = num9;
                 return;
             }
         }
         else if (num4 != num6)
         {
             if (num8 == 0)
             {
                 if (num7 != 0)
                 {
                     frontColor = num7;
                 }
             }
             else if (num7 != 0)
             {
                 frontColor = (num4 <= num3 ? num8 : num7);
             }
             if (num10 == 0)
             {
                 if (num9 != 0)
                 {
                     backColor = num9;
                     return;
                 }
             }
             else if (num9 != 0)
             {
                 backColor = (num6 <= num5 ? num10 : num9);
                 return;
             }
         }
         else
         {
             if (num7 != 0)
             {
                 frontColor = num7;
             }
             else if (num8 != 0)
             {
                 frontColor = num8;
             }
             if (num9 != 0)
             {
                 backColor = num9;
                 return;
             }
             if (num10 != 0)
             {
                 backColor = num10;
                 return;
             }
         }
     }
 }
Exemplo n.º 4
0
 public static void TrackColors(int i, int j, Tile trackTile, out int frontColor, out int backColor)
 {
     if (trackTile.type == 314)
     {
         frontColor = (int)trackTile.color();
         backColor = frontColor;
         if (trackTile.frameY == -1)
         {
             return;
         }
         int num = Minecart._leftSideConnection[(int)trackTile.frameX];
         int num2 = Minecart._rightSideConnection[(int)trackTile.frameX];
         int num3 = Minecart._leftSideConnection[(int)trackTile.frameY];
         int num4 = Minecart._rightSideConnection[(int)trackTile.frameY];
         int num5 = 0;
         int num6 = 0;
         int num7 = 0;
         int num8 = 0;
         for (int k = 0; k < 4; k++)
         {
             int num9;
             switch (k)
             {
             case 1:
                 num9 = num2;
                 break;
             case 2:
                 num9 = num3;
                 break;
             case 3:
                 num9 = num4;
                 break;
             default:
                 num9 = num;
                 break;
             }
             int num10;
             switch (num9)
             {
             case 0:
                 num10 = -1;
                 break;
             case 1:
                 num10 = 0;
                 break;
             case 2:
                 num10 = 1;
                 break;
             default:
                 num10 = 0;
                 break;
             }
             Tile tile;
             if (k % 2 == 0)
             {
                 tile = Main.tile[i - 1, j + num10];
             }
             else
             {
                 tile = Main.tile[i + 1, j + num10];
             }
             int num11;
             if (tile == null || !tile.active() || tile.type != 314)
             {
                 num11 = 0;
             }
             else
             {
                 num11 = (int)tile.color();
             }
             switch (k)
             {
             case 1:
                 num6 = num11;
                 break;
             case 2:
                 num7 = num11;
                 break;
             case 3:
                 num8 = num11;
                 break;
             default:
                 num5 = num11;
                 break;
             }
         }
         if (num == num3)
         {
             if (num6 != 0)
             {
                 frontColor = num6;
             }
             else if (num5 != 0)
             {
                 frontColor = num5;
             }
             if (num8 != 0)
             {
                 backColor = num8;
                 return;
             }
             if (num7 != 0)
             {
                 backColor = num7;
                 return;
             }
         }
         else if (num2 == num4)
         {
             if (num5 != 0)
             {
                 frontColor = num5;
             }
             else if (num6 != 0)
             {
                 frontColor = num6;
             }
             if (num7 != 0)
             {
                 backColor = num7;
                 return;
             }
             if (num8 != 0)
             {
                 backColor = num8;
                 return;
             }
         }
         else
         {
             if (num6 == 0)
             {
                 if (num5 != 0)
                 {
                     frontColor = num5;
                 }
             }
             else if (num5 != 0)
             {
                 frontColor = ((num2 <= num) ? num6 : num5);
             }
             if (num8 == 0)
             {
                 if (num7 != 0)
                 {
                     backColor = num7;
                     return;
                 }
             }
             else if (num7 != 0)
             {
                 backColor = ((num4 <= num3) ? num8 : num7);
                 return;
             }
         }
     }
     else
     {
         frontColor = 0;
         backColor = 0;
     }
 }
Exemplo n.º 5
0
 public bool isTheSameAs(Tile compTile)
 {
     if (compTile == null)
     {
         return false;
     }
     if (this.active() != compTile.active())
     {
         return false;
     }
     if (this.active())
     {
         if (this.type != compTile.type)
         {
             return false;
         }
         if (Main.tileFrameImportant[(int)this.type])
         {
             if (this.frameX != compTile.frameX)
             {
                 return false;
             }
             if (this.frameY != compTile.frameY)
             {
                 return false;
             }
         }
     }
     if (this.wall != compTile.wall)
     {
         return false;
     }
     if (this.liquid != compTile.liquid)
     {
         return false;
     }
     if (this.liquid > 0)
     {
         if (this.lava() != compTile.lava())
         {
             return false;
         }
         if (this.honey() != compTile.honey())
         {
             return false;
         }
     }
     return this.wire() == compTile.wire() && this.wire2() == compTile.wire2() && this.wire3() == compTile.wire3() && this.halfBrick() == compTile.halfBrick() && this.actuator() == compTile.actuator() && this.inActive() == compTile.inActive() && this.wallColor() == compTile.wallColor() && this.color() == compTile.color() && this.slope() == compTile.slope();
 }
Exemplo n.º 6
0
        public void DrawFreshAnimations(SpriteBatch spriteBatch)
        {
            for (int index = 0; index < this.data.Length; ++index)
            {
                ++this.data[index].animationTimeElapsed;
            }
            if (!Main.SettingsEnabled_MinersWobble)
            {
                return;
            }
            int     num1 = 1;
            Vector2 zero1;

            // ISSUE: explicit reference operation
            ((Vector2)@zero1).\u002Ector((float)Main.offScreenRange);
            if (Main.drawToScreen)
            {
                zero1 = Vector2.get_Zero();
            }
            zero1 = Vector2.get_Zero();
            for (int index = 0; index < this.data.Length; ++index)
            {
                if (this.data[index].type == num1)
                {
                    int damage = this.data[index].damage;
                    if (damage >= 20)
                    {
                        int x = this.data[index].X;
                        int y = this.data[index].Y;
                        if (WorldGen.InWorld(x, y, 0))
                        {
                            bool flag1 = Main.tile[x, y] != null;
                            if (flag1 && num1 == 1)
                            {
                                flag1 = flag1 && Main.tile[x, y].active() && Main.tileSolid[(int)Main.tile[x, y].type];
                            }
                            if (flag1 && num1 == 2)
                            {
                                flag1 = flag1 && (int)Main.tile[x, y].wall != 0;
                            }
                            if (flag1)
                            {
                                bool flag2 = false;
                                bool flag3 = false;
                                if ((int)Main.tile[x, y].type == 10)
                                {
                                    flag2 = false;
                                }
                                else if (Main.tileSolid[(int)Main.tile[x, y].type] && !Main.tileSolidTop[(int)Main.tile[x, y].type])
                                {
                                    flag2 = true;
                                }
                                else if ((int)Main.tile[x, y].type == 5)
                                {
                                    flag3 = true;
                                    int num2 = (int)Main.tile[x, y].frameX / 22;
                                    int num3 = (int)Main.tile[x, y].frameY / 22;
                                    if (num3 < 9)
                                    {
                                        flag2 = (num2 != 1 && num2 != 2 || (num3 < 6 || num3 > 8)) && ((num2 != 3 || num3 > 2) && ((num2 != 4 || num3 < 3 || num3 > 5) && (num2 != 5 || num3 < 6 || num3 > 8)));
                                    }
                                }
                                else if ((int)Main.tile[x, y].type == 72)
                                {
                                    flag3 = true;
                                    if ((int)Main.tile[x, y].frameX <= 34)
                                    {
                                        flag2 = true;
                                    }
                                }
                                if (flag2 && (int)Main.tile[x, y].slope() == 0 && !Main.tile[x, y].halfBrick())
                                {
                                    int num2 = 0;
                                    if (damage >= 80)
                                    {
                                        num2 = 3;
                                    }
                                    else if (damage >= 60)
                                    {
                                        num2 = 2;
                                    }
                                    else if (damage >= 40)
                                    {
                                        num2 = 1;
                                    }
                                    else if (damage >= 20)
                                    {
                                        num2 = 0;
                                    }
                                    Rectangle rectangle;
                                    // ISSUE: explicit reference operation
                                    ((Rectangle)@rectangle).\u002Ector(this.data[index].crackStyle * 18, num2 * 18, 16, 16);
                                    // ISSUE: explicit reference operation
                                    ((Rectangle)@rectangle).Inflate(-2, -2);
                                    if (flag3)
                                    {
                                        rectangle.X = (__Null)((4 + this.data[index].crackStyle / 2) * 18);
                                    }
                                    int animationTimeElapsed = this.data[index].animationTimeElapsed;
                                    if ((double)animationTimeElapsed < 10.0)
                                    {
                                        float   num3   = (float)animationTimeElapsed / 10f;
                                        float   num4   = 1f;
                                        Color   color1 = Lighting.GetColor(x, y);
                                        float   num5   = 0.0f;
                                        Vector2 zero2  = Vector2.get_Zero();
                                        float   num6   = num3;
                                        float   num7   = 0.5f;
                                        float   num8   = num6 % num7 * (1f / num7);
                                        if ((int)((double)num6 / (double)num7) % 2 == 1)
                                        {
                                            num8 = 1f - num8;
                                        }
                                        num4 = (float)((double)num8 * 0.449999988079071 + 1.0);
                                        Tile      tileSafely = Framing.GetTileSafely(x, y);
                                        Tile      tile       = tileSafely;
                                        Texture2D texture2D  = !Main.canDrawColorTile(tileSafely.type, (int)tileSafely.color()) ? Main.tileTexture[(int)tileSafely.type] : (Texture2D)Main.tileAltTexture[(int)tileSafely.type, (int)tileSafely.color()];
                                        Vector2   vector2_1;
                                        // ISSUE: explicit reference operation
                                        ((Vector2)@vector2_1).\u002Ector(8f);
                                        Vector2 vector2_2;
                                        // ISSUE: explicit reference operation
                                        ((Vector2)@vector2_2).\u002Ector(1f);
                                        float   num9      = (float)((double)num8 * 0.200000002980232 + 1.0);
                                        float   num10     = 1f - num8;
                                        float   num11     = 1f;
                                        Color   color2    = Color.op_Multiply(color1, (float)((double)num11 * (double)num11 * 0.800000011920929));
                                        Vector2 vector2_3 = Vector2.op_Multiply(num9, vector2_2);
                                        Vector2 vector2_4 = Vector2.op_Addition(Vector2.op_Addition(Vector2.op_Addition(new Vector2((float)(x * 16 - (int)Main.screenPosition.X), (float)(y * 16 - (int)Main.screenPosition.Y)), zero1), vector2_1), zero2).Floor();
                                        spriteBatch.Draw(texture2D, vector2_4, new Rectangle?(new Rectangle((int)tile.frameX, (int)tile.frameY, 16, 16)), color2, num5, vector2_1, vector2_3, (SpriteEffects)0, 0.0f);
                                        // ISSUE: explicit reference operation
                                        ((Color)@color2).set_A((byte)180);
                                        spriteBatch.Draw(Main.tileCrackTexture, vector2_4, new Rectangle?(rectangle), color2, num5, vector2_1, vector2_3, (SpriteEffects)0, 0.0f);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 7
0
        public void DrawFreshAnimations(SpriteBatch spriteBatch)
        {
            for (int index = 0; index < this.data.Length; ++index)
            {
                ++this.data[index].animationTimeElapsed;
            }
            if (!Main.SettingsEnabled_MinersWobble)
            {
                return;
            }
            int     num1      = 1;
            Vector2 vector2_1 = new Vector2((float)Main.offScreenRange);

            if (Main.drawToScreen)
            {
                vector2_1 = Vector2.Zero;
            }
            vector2_1 = Vector2.Zero;
            for (int index = 0; index < this.data.Length; ++index)
            {
                if (this.data[index].type == num1)
                {
                    int damage = this.data[index].damage;
                    if (damage >= 20)
                    {
                        int x = this.data[index].X;
                        int y = this.data[index].Y;
                        if (WorldGen.InWorld(x, y, 0))
                        {
                            bool flag1 = Main.tile[x, y] != null;
                            if (flag1 && num1 == 1)
                            {
                                flag1 = flag1 && Main.tile[x, y].active() && Main.tileSolid[(int)Main.tile[x, y].type];
                            }
                            if (flag1 && num1 == 2)
                            {
                                flag1 = flag1 && (int)Main.tile[x, y].wall != 0;
                            }
                            if (flag1)
                            {
                                bool flag2 = false;
                                bool flag3 = false;
                                if ((int)Main.tile[x, y].type == 10)
                                {
                                    flag2 = false;
                                }
                                else if (Main.tileSolid[(int)Main.tile[x, y].type] && !Main.tileSolidTop[(int)Main.tile[x, y].type])
                                {
                                    flag2 = true;
                                }
                                else if ((int)Main.tile[x, y].type == 5)
                                {
                                    flag3 = true;
                                    int num2 = (int)Main.tile[x, y].frameX / 22;
                                    int num3 = (int)Main.tile[x, y].frameY / 22;
                                    if (num3 < 9)
                                    {
                                        flag2 = (num2 != 1 && num2 != 2 || (num3 < 6 || num3 > 8)) && ((num2 != 3 || num3 > 2) && ((num2 != 4 || num3 < 3 || num3 > 5) && (num2 != 5 || num3 < 6 || num3 > 8)));
                                    }
                                }
                                else if ((int)Main.tile[x, y].type == 72)
                                {
                                    flag3 = true;
                                    if ((int)Main.tile[x, y].frameX <= 34)
                                    {
                                        flag2 = true;
                                    }
                                }
                                if (flag2 && (int)Main.tile[x, y].slope() == 0 && !Main.tile[x, y].halfBrick())
                                {
                                    int num2 = 0;
                                    if (damage >= 80)
                                    {
                                        num2 = 3;
                                    }
                                    else if (damage >= 60)
                                    {
                                        num2 = 2;
                                    }
                                    else if (damage >= 40)
                                    {
                                        num2 = 1;
                                    }
                                    else if (damage >= 20)
                                    {
                                        num2 = 0;
                                    }
                                    Rectangle rectangle = new Rectangle(this.data[index].crackStyle * 18, num2 * 18, 16, 16);
                                    rectangle.Inflate(-2, -2);
                                    if (flag3)
                                    {
                                        rectangle.X = (4 + this.data[index].crackStyle / 2) * 18;
                                    }
                                    int animationTimeElapsed = this.data[index].animationTimeElapsed;
                                    if ((double)animationTimeElapsed < 10.0)
                                    {
                                        float   num3     = (float)animationTimeElapsed / 10f;
                                        float   num4     = 1f;
                                        Color   color1   = Lighting.GetColor(x, y);
                                        float   rotation = 0.0f;
                                        Vector2 zero     = Vector2.Zero;
                                        float   num5     = num3;
                                        float   num6     = 0.5f;
                                        float   num7     = num5 % num6 * (1f / num6);
                                        if ((int)((double)num5 / (double)num6) % 2 == 1)
                                        {
                                            num7 = 1f - num7;
                                        }
                                        num4 = (float)((double)num7 * 0.449999988079071 + 1.0);
                                        Tile      tileSafely = Framing.GetTileSafely(x, y);
                                        Tile      tile       = tileSafely;
                                        Texture2D texture    = !Main.canDrawColorTile(tileSafely.type, (int)tileSafely.color()) ? Main.tileTexture[(int)tileSafely.type] : (Texture2D)Main.tileAltTexture[(int)tileSafely.type, (int)tileSafely.color()];
                                        Vector2   origin     = new Vector2(8f);
                                        Vector2   vector2_2  = new Vector2(1f);
                                        float     num8       = (float)((double)num7 * 0.200000002980232 + 1.0);
                                        float     num9       = 1f - num7;
                                        float     num10      = 1f;
                                        Color     color2     = color1 * (float)((double)num10 * (double)num10 * 0.800000011920929);
                                        Vector2   scale      = num8 * vector2_2;
                                        Vector2   position   = (new Vector2((float)(x * 16 - (int)Main.screenPosition.X), (float)(y * 16 - (int)Main.screenPosition.Y)) + vector2_1 + origin + zero).Floor();
                                        spriteBatch.Draw(texture, position, new Rectangle?(new Rectangle((int)tile.frameX, (int)tile.frameY, 16, 16)), color2, rotation, origin, scale, SpriteEffects.None, 0.0f);
                                        color2.A = (byte)180;
                                        spriteBatch.Draw(Main.tileCrackTexture, position, new Rectangle?(rectangle), color2, rotation, origin, scale, SpriteEffects.None, 0.0f);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 8
0
 public static bool validateWorld(string validatePath)
 {
     Stopwatch stopwatch = new Stopwatch();
     stopwatch.Start();
     if (WorldGen.genRand == null)
     {
         WorldGen.genRand = new Random((int)DateTime.Now.Ticks);
     }
     bool result;
     using (FileStream fileStream = new FileStream(validatePath, FileMode.Open))
     {
         using (BinaryReader binaryReader = new BinaryReader(fileStream))
         {
             try
             {
                 int num = binaryReader.ReadInt32();
                 if (num > Main.curRelease)
                 {
                     try
                     {
                         binaryReader.Close();
                         fileStream.Close();
                     }
                     catch
                     {
                     }
                     result = false;
                 }
                 else
                 {
                     string b = binaryReader.ReadString();
                     int num2 = binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     int num3 = binaryReader.ReadInt32();
                     int num4 = binaryReader.ReadInt32();
                     if (num >= 63)
                     {
                         binaryReader.ReadByte();
                     }
                     if (num >= 44)
                     {
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                     }
                     if (num >= 60)
                     {
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         if (num >= 61)
                         {
                             binaryReader.ReadInt32();
                             binaryReader.ReadInt32();
                         }
                     }
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     binaryReader.ReadDouble();
                     binaryReader.ReadDouble();
                     binaryReader.ReadDouble();
                     binaryReader.ReadBoolean();
                     binaryReader.ReadInt32();
                     binaryReader.ReadBoolean();
                     if (num >= 70)
                     {
                         binaryReader.ReadBoolean();
                     }
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     if (num >= 56)
                     {
                         binaryReader.ReadBoolean();
                     }
                     binaryReader.ReadBoolean();
                     binaryReader.ReadBoolean();
                     binaryReader.ReadBoolean();
                     if (num >= 66)
                     {
                         binaryReader.ReadBoolean();
                     }
                     if (num >= 44)
                     {
                         binaryReader.ReadBoolean();
                         binaryReader.ReadBoolean();
                         binaryReader.ReadBoolean();
                         binaryReader.ReadBoolean();
                     }
                     if (num >= 64)
                     {
                         binaryReader.ReadBoolean();
                         binaryReader.ReadBoolean();
                     }
                     if (num >= 29)
                     {
                         binaryReader.ReadBoolean();
                         binaryReader.ReadBoolean();
                         if (num >= 34)
                         {
                             binaryReader.ReadBoolean();
                         }
                         binaryReader.ReadBoolean();
                     }
                     if (num >= 32)
                     {
                         binaryReader.ReadBoolean();
                     }
                     if (num >= 37)
                     {
                         binaryReader.ReadBoolean();
                     }
                     if (num >= 56)
                     {
                         binaryReader.ReadBoolean();
                     }
                     binaryReader.ReadBoolean();
                     binaryReader.ReadBoolean();
                     binaryReader.ReadByte();
                     if (num >= 23)
                     {
                         binaryReader.ReadInt32();
                         binaryReader.ReadBoolean();
                     }
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     binaryReader.ReadInt32();
                     binaryReader.ReadDouble();
                     if (num >= 53)
                     {
                         binaryReader.ReadBoolean();
                         binaryReader.ReadInt32();
                         binaryReader.ReadSingle();
                     }
                     if (num >= 54)
                     {
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                     }
                     if (num >= 55)
                     {
                         binaryReader.ReadByte();
                         binaryReader.ReadByte();
                         binaryReader.ReadByte();
                     }
                     if (num >= 60)
                     {
                         binaryReader.ReadByte();
                         binaryReader.ReadByte();
                         binaryReader.ReadByte();
                         binaryReader.ReadByte();
                         binaryReader.ReadByte();
                     }
                     if (num >= 60)
                     {
                         binaryReader.ReadInt32();
                     }
                     if (num >= 62)
                     {
                         binaryReader.ReadInt16();
                         binaryReader.ReadSingle();
                     }
                     for (int i = 0; i < num4; i++)
                     {
                         float num5 = (float)i / (float)Main.maxTilesX;
                         Main.statusText = string.Concat(new object[]
                         {
                             Lang.gen[73],
                             " ",
                             (int)(num5 * 100f + 1f),
                             "%"
                         });
                         for (int j = 0; j < num3; j++)
                         {
                             Tile tile = new Tile();
                             tile.active(binaryReader.ReadBoolean());
                             if (tile.active())
                             {
                                 tile.type = binaryReader.ReadByte();
                                 if (tile.type == 127)
                                 {
                                     tile.active(false);
                                 }
                                 if (num < 72 && (tile.type == 35 || tile.type == 36 || tile.type == 170 || tile.type == 171 || tile.type == 172))
                                 {
                                     tile.frameX = binaryReader.ReadInt16();
                                     tile.frameY = binaryReader.ReadInt16();
                                 }
                                 else if (Main.tileFrameImportant[(int)tile.type])
                                 {
                                     if (num < 28 && tile.type == 4)
                                     {
                                         tile.frameX = 0;
                                         tile.frameY = 0;
                                     }
                                     else if (num < 40 && tile.type == 19)
                                     {
                                         tile.frameX = 0;
                                         tile.frameY = 0;
                                     }
                                     else
                                     {
                                         tile.frameX = binaryReader.ReadInt16();
                                         tile.frameY = binaryReader.ReadInt16();
                                         if (tile.type == 144)
                                         {
                                             tile.frameY = 0;
                                         }
                                     }
                                 }
                                 else
                                 {
                                     tile.frameX = -1;
                                     tile.frameY = -1;
                                 }
                                 if (num >= 48 && binaryReader.ReadBoolean())
                                 {
                                     tile.color(binaryReader.ReadByte());
                                 }
                             }
                             if (num <= 25)
                             {
                                 binaryReader.ReadBoolean();
                             }
                             if (binaryReader.ReadBoolean())
                             {
                                 tile.wall = binaryReader.ReadByte();
                                 if (num >= 48 && binaryReader.ReadBoolean())
                                 {
                                     tile.wallColor(binaryReader.ReadByte());
                                 }
                             }
                             if (binaryReader.ReadBoolean())
                             {
                                 tile.liquid = binaryReader.ReadByte();
                                 tile.lava(binaryReader.ReadBoolean());
                                 if (num >= 51)
                                 {
                                     tile.honey(binaryReader.ReadBoolean());
                                 }
                             }
                             if (num >= 33)
                             {
                                 tile.wire(binaryReader.ReadBoolean());
                             }
                             if (num >= 43)
                             {
                                 tile.wire2(binaryReader.ReadBoolean());
                                 tile.wire3(binaryReader.ReadBoolean());
                             }
                             if (num >= 41)
                             {
                                 tile.halfBrick(binaryReader.ReadBoolean());
                                 if (!Main.tileSolid[(int)tile.type])
                                 {
                                     tile.halfBrick(false);
                                 }
                                 if (num >= 49)
                                 {
                                     tile.slope(binaryReader.ReadByte());
                                     if (!Main.tileSolid[(int)tile.type])
                                     {
                                         tile.slope(0);
                                     }
                                 }
                             }
                             if (num >= 42)
                             {
                                 tile.actuator(binaryReader.ReadBoolean());
                                 tile.inActive(binaryReader.ReadBoolean());
                             }
                             if (num >= 25)
                             {
                                 int num6 = (int)binaryReader.ReadInt16();
                                 j += num6;
                             }
                         }
                     }
                     int num7 = 40;
                     if (num < 58)
                     {
                         num7 = 20;
                     }
                     for (int k = 0; k < 1000; k++)
                     {
                         if (binaryReader.ReadBoolean())
                         {
                             binaryReader.ReadInt32();
                             binaryReader.ReadInt32();
                             for (int l = 0; l < 40; l++)
                             {
                                 if (l < num7)
                                 {
                                     int num8;
                                     if (num >= 59)
                                     {
                                         num8 = (int)binaryReader.ReadInt16();
                                     }
                                     else
                                     {
                                         num8 = (int)binaryReader.ReadByte();
                                     }
                                     if (num8 > 0)
                                     {
                                         if (num >= 38)
                                         {
                                             binaryReader.ReadInt32();
                                         }
                                         else
                                         {
                                             binaryReader.ReadString();
                                         }
                                         binaryReader.ReadByte();
                                     }
                                 }
                             }
                         }
                     }
                     for (int m = 0; m < 1000; m++)
                     {
                         if (binaryReader.ReadBoolean())
                         {
                             binaryReader.ReadString();
                             binaryReader.ReadInt32();
                             binaryReader.ReadInt32();
                         }
                     }
                     bool flag = binaryReader.ReadBoolean();
                     int num9 = 0;
                     while (flag)
                     {
                         binaryReader.ReadString();
                         binaryReader.ReadSingle();
                         binaryReader.ReadSingle();
                         binaryReader.ReadBoolean();
                         binaryReader.ReadInt32();
                         binaryReader.ReadInt32();
                         flag = binaryReader.ReadBoolean();
                         num9++;
                     }
                     if (num >= 31)
                     {
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         binaryReader.ReadString();
                         if (num >= 35)
                         {
                             binaryReader.ReadString();
                             if (num >= 65)
                             {
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                                 binaryReader.ReadString();
                             }
                         }
                     }
                     if (num >= 7)
                     {
                         bool flag2 = binaryReader.ReadBoolean();
                         string text = binaryReader.ReadString();
                         int num10 = binaryReader.ReadInt32();
                         if (!flag2 || (!(text == b) && num10 != num2))
                         {
                             binaryReader.Close();
                             fileStream.Close();
                             result = false;
                             return result;
                         }
                     }
                     binaryReader.Close();
                     fileStream.Close();
                     result = true;
                 }
             }
             catch
             {
                 try
                 {
                     binaryReader.Close();
                     fileStream.Close();
                 }
                 catch
                 {
                 }
                 result = false;
             }
         }
     }
     return result;
 }
Exemplo n.º 9
0
        // Token: 0x0600008F RID: 143 RVA: 0x0000BB70 File Offset: 0x00009D70
        public void DrawFreshAnimations(SpriteBatch spriteBatch)
        {
            for (int i = 0; i < this.data.Length; i++)
            {
                this.data[i].animationTimeElapsed++;
            }
            if (!Main.SettingsEnabled_MinersWobble)
            {
                return;
            }
            int     num  = 1;
            Vector2 zero = new Vector2((float)Main.offScreenRange);

            if (Main.drawToScreen)
            {
                zero = Vector2.Zero;
            }
            zero = Vector2.Zero;
            for (int j = 0; j < this.data.Length; j++)
            {
                if (this.data[j].type == num)
                {
                    int damage = this.data[j].damage;
                    if (damage >= 20)
                    {
                        int x = this.data[j].X;
                        int y = this.data[j].Y;
                        if (WorldGen.InWorld(x, y, 0))
                        {
                            bool flag = Main.tile[x, y] != null;
                            if (flag && num == 1)
                            {
                                flag = (flag && Main.tile[x, y].active() && Main.tileSolid[(int)Main.tile[x, y].type]);
                            }
                            if (flag && num == 2)
                            {
                                flag = (flag && Main.tile[x, y].wall > 0);
                            }
                            if (flag)
                            {
                                bool flag2 = false;
                                bool flag3 = false;
                                if (Main.tile[x, y].type == 10)
                                {
                                    flag2 = false;
                                }
                                else if (Main.tileSolid[(int)Main.tile[x, y].type] && !Main.tileSolidTop[(int)Main.tile[x, y].type])
                                {
                                    flag2 = true;
                                }
                                else if (Main.tile[x, y].type == 5)
                                {
                                    flag3 = true;
                                    int num2 = (int)(Main.tile[x, y].frameX / 22);
                                    int num3 = (int)(Main.tile[x, y].frameY / 22);
                                    if (num3 < 9)
                                    {
                                        flag2 = (((num2 != 1 && num2 != 2) || num3 < 6 || num3 > 8) && (num2 != 3 || num3 > 2) && (num2 != 4 || num3 < 3 || num3 > 5) && (num2 != 5 || num3 < 6 || num3 > 8));
                                    }
                                }
                                else if (Main.tile[x, y].type == 72)
                                {
                                    flag3 = true;
                                    if (Main.tile[x, y].frameX <= 34)
                                    {
                                        flag2 = true;
                                    }
                                }
                                if (flag2 && Main.tile[x, y].slope() == 0 && !Main.tile[x, y].halfBrick())
                                {
                                    int num4 = 0;
                                    if (damage >= 80)
                                    {
                                        num4 = 3;
                                    }
                                    else if (damage >= 60)
                                    {
                                        num4 = 2;
                                    }
                                    else if (damage >= 40)
                                    {
                                        num4 = 1;
                                    }
                                    else if (damage >= 20)
                                    {
                                        num4 = 0;
                                    }
                                    Rectangle value = new Rectangle(this.data[j].crackStyle * 18, num4 * 18, 16, 16);
                                    value.Inflate(-2, -2);
                                    if (flag3)
                                    {
                                        value.X = (4 + this.data[j].crackStyle / 2) * 18;
                                    }
                                    int animationTimeElapsed = this.data[j].animationTimeElapsed;
                                    if ((float)animationTimeElapsed < 10f)
                                    {
                                        float   arg_365_0 = (float)animationTimeElapsed / 10f;
                                        Color   color     = Lighting.GetColor(x, y);
                                        float   rotation  = 0f;
                                        Vector2 zero2     = Vector2.Zero;
                                        float   num5      = 0.5f;
                                        float   num6      = arg_365_0 % num5;
                                        num6 *= 1f / num5;
                                        if ((int)(arg_365_0 / num5) % 2 == 1)
                                        {
                                            num6 = 1f - num6;
                                        }
                                        Tile      tileSafely = Framing.GetTileSafely(x, y);
                                        Tile      tile       = tileSafely;
                                        Texture2D texture;
                                        if (Main.canDrawColorTile(tileSafely.type, (int)tileSafely.color()))
                                        {
                                            texture = Main.tileAltTexture[(int)tileSafely.type, (int)tileSafely.color()];
                                        }
                                        else
                                        {
                                            texture = Main.tileTexture[(int)tileSafely.type];
                                        }
                                        Vector2 vector    = new Vector2(8f);
                                        Vector2 value2    = new Vector2(1f);
                                        float   arg_427_0 = num6 * 0.2f + 1f;
                                        float   num7      = 1f - num6;
                                        num7   = 1f;
                                        color *= num7 * num7 * 0.8f;
                                        Vector2 scale    = arg_427_0 * value2;
                                        Vector2 position = (new Vector2((float)(x * 16 - (int)Main.screenPosition.X), (float)(y * 16 - (int)Main.screenPosition.Y)) + zero + vector + zero2).Floor();
                                        spriteBatch.Draw(texture, position, new Rectangle?(new Rectangle((int)tile.frameX, (int)tile.frameY, 16, 16)), color, rotation, vector, scale, SpriteEffects.None, 0f);
                                        color.A = 180;
                                        spriteBatch.Draw(Main.tileCrackTexture, position, new Rectangle?(value), color, rotation, vector, scale, SpriteEffects.None, 0f);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 10
0
        public void DrawFreshAnimations(SpriteBatch spriteBatch)
        {
            for (int i = 0; i < data.Length; i++)
            {
                data[i].animationTimeElapsed++;
            }
            if (!Main.SettingsEnabled_MinersWobble)
            {
                return;
            }
            int     num    = 1;
            Vector2 vector = new Vector2(Main.offScreenRange);

            if (Main.drawToScreen)
            {
                vector = Vector2.Zero;
            }
            vector = Vector2.Zero;
            for (int j = 0; j < data.Length; j++)
            {
                if (data[j].type != num)
                {
                    continue;
                }
                int damage = data[j].damage;
                if (damage < 20)
                {
                    continue;
                }
                int x = data[j].X;
                int y = data[j].Y;
                if (!WorldGen.InWorld(x, y))
                {
                    continue;
                }
                bool flag = Main.tile[x, y] != null;
                if (flag && num == 1)
                {
                    flag = (flag && Main.tile[x, y].active() && Main.tileSolid[Main.tile[x, y].type]);
                }
                if (flag && num == 2)
                {
                    flag = (flag && Main.tile[x, y].wall != 0);
                }
                if (!flag)
                {
                    continue;
                }
                bool flag2 = false;
                bool flag3 = false;
                if (Main.tile[x, y].type == 10)
                {
                    flag2 = false;
                }
                else if (Main.tileSolid[Main.tile[x, y].type] && !Main.tileSolidTop[Main.tile[x, y].type])
                {
                    flag2 = true;
                }
                else if (WorldGen.IsTreeType(Main.tile[x, y].type))
                {
                    flag3 = true;
                    int num2 = Main.tile[x, y].frameX / 22;
                    int num3 = Main.tile[x, y].frameY / 22;
                    if (num3 < 9)
                    {
                        flag2 = (((num2 != 1 && num2 != 2) || num3 < 6 || num3 > 8) && (num2 != 3 || num3 > 2) && (num2 != 4 || num3 < 3 || num3 > 5) && ((num2 != 5 || num3 < 6 || num3 > 8) ? true : false));
                    }
                }
                else if (Main.tile[x, y].type == 72)
                {
                    flag3 = true;
                    if (Main.tile[x, y].frameX <= 34)
                    {
                        flag2 = true;
                    }
                }
                if (!flag2 || Main.tile[x, y].slope() != 0 || Main.tile[x, y].halfBrick())
                {
                    continue;
                }
                int num4 = 0;
                if (damage >= 80)
                {
                    num4 = 3;
                }
                else if (damage >= 60)
                {
                    num4 = 2;
                }
                else if (damage >= 40)
                {
                    num4 = 1;
                }
                else if (damage >= 20)
                {
                    num4 = 0;
                }
                Rectangle value = new Rectangle(data[j].crackStyle * 18, num4 * 18, 16, 16);
                value.Inflate(-2, -2);
                if (flag3)
                {
                    value.X = (4 + data[j].crackStyle / 2) * 18;
                }
                int animationTimeElapsed = data[j].animationTimeElapsed;
                if (!((float)animationTimeElapsed >= 10f))
                {
                    float   num5     = (float)animationTimeElapsed / 10f;
                    Color   color    = Lighting.GetColor(x, y);
                    float   rotation = 0f;
                    Vector2 zero     = Vector2.Zero;
                    float   num6     = 0.5f;
                    float   num7     = num5 % num6;
                    num7 *= 1f / num6;
                    if ((int)(num5 / num6) % 2 == 1)
                    {
                        num7 = 1f - num7;
                    }
                    Tile      tileSafely = Framing.GetTileSafely(x, y);
                    Tile      tile       = tileSafely;
                    Texture2D texture2D  = Main.instance.TilePaintSystem.TryGetTileAndRequestIfNotReady(tileSafely.type, 0, tileSafely.color());
                    if (texture2D != null)
                    {
                        Vector2 vector2     = new Vector2(8f);
                        Vector2 value2      = new Vector2(1f);
                        float   scaleFactor = num7 * 0.2f + 1f;
                        float   num8        = 1f - num7;
                        num8   = 1f;
                        color *= num8 * num8 * 0.8f;
                        Vector2 scale    = scaleFactor * value2;
                        Vector2 position = (new Vector2(x * 16 - (int)Main.screenPosition.X, y * 16 - (int)Main.screenPosition.Y) + vector + vector2 + zero).Floor();
                        spriteBatch.Draw(texture2D, position, new Rectangle(tile.frameX, tile.frameY, 16, 16), color, rotation, vector2, scale, SpriteEffects.None, 0f);
                        color.A = 180;
                        spriteBatch.Draw(TextureAssets.TileCrack.get_Value(), position, value, color, rotation, vector2, scale, SpriteEffects.None, 0f);
                    }
                }
            }
        }
Exemplo n.º 11
0
		public static void TrackColors(int i, int j, Tile trackTile, out int frontColor, out int backColor)
		{
			if (trackTile.type == 314)
			{
				frontColor = (int)trackTile.color();
				backColor = frontColor;
				if (trackTile.frameY == -1)
				{
					return;
				}
				int num = Minecart.leftSideConnection[(int)trackTile.frameX];
				int num2 = Minecart.rightSideConnection[(int)trackTile.frameX];
				int num3 = Minecart.leftSideConnection[(int)trackTile.frameY];
				int num4 = Minecart.rightSideConnection[(int)trackTile.frameY];
				int num5 = 0;
				int num6 = 0;
				int num7 = 0;
				int num8 = 0;
				for (int k = 0; k < 4; k++)
				{
					int num9 = num;
					switch (k)
					{
					case 0:
						num9 = num;
						goto IL_9C;
					case 1:
						num9 = num2;
						goto IL_9C;
					case 2:
						num9 = num3;
						goto IL_9C;
					case 3:
						num9 = num4;
						goto IL_9C;
					}
                    goto IL_9C;
					IL_9C:
					int num10;
					switch (num9)
					{
					case 0:
						num10 = -1;
						break;
					case 1:
						num10 = 0;
						break;
					case 2:
						num10 = 1;
						break;
					default:
						num10 = 0;
						break;
					}
					Tile tile;
					if (k % 2 == 0)
					{
						tile = Main.tile[i - 1, j + num10];
					}
					else
					{
						tile = Main.tile[i + 1, j + num10];
					}
					int num11;
					if (tile == null || !tile.active() || tile.type != 314)
					{
						num11 = 0;
					}
					else
					{
						num11 = (int)tile.color();
					}
					switch (k)
					{
					case 0:
						IL_139:
						num5 = num11;
						goto IL_14F;
					case 1:
						num6 = num11;
						goto IL_14F;
					case 2:
						num7 = num11;
						goto IL_14F;
					case 3:
						num8 = num11;
						goto IL_14F;
					}
					//EDIT: goto IL_139; // This whole part does nothing anyway..?
					IL_14F:;
				}
				if (num == num3)
				{
					if (num6 != 0)
					{
						frontColor = num6;
					}
					else if (num5 != 0)
					{
						frontColor = num5;
					}
					if (num8 != 0)
					{
						backColor = num8;
						return;
					}
					if (num7 != 0)
					{
						backColor = num7;
						return;
					}
				}
				else if (num2 == num4)
				{
					if (num5 != 0)
					{
						frontColor = num5;
					}
					else if (num6 != 0)
					{
						frontColor = num6;
					}
					if (num7 != 0)
					{
						backColor = num7;
						return;
					}
					if (num8 != 0)
					{
						backColor = num8;
						return;
					}
				}
				else
				{
					if (num6 == 0)
					{
						if (num5 != 0)
						{
							frontColor = num5;
						}
					}
					else if (num5 != 0)
					{
						if (num2 <= num)
						{
							frontColor = num6;
						}
						else
						{
							frontColor = num5;
						}
					}
					if (num8 == 0)
					{
						if (num7 != 0)
						{
							backColor = num7;
							return;
						}
					}
					else if (num7 != 0)
					{
						if (num4 <= num3)
						{
							backColor = num8;
							return;
						}
						backColor = num7;
						return;
					}
				}
			}
			else
			{
				frontColor = 0;
				backColor = 0;
			}
		}
        private void Tile(Tile tile)
        {
            byte flags = 0;

            var active = tile.active();
            var wall = tile.wall;
            var liquid = tile.liquid;

            if (active) flags += 1;
            //if (tile.Lighted)    flags += 2; //UNUSED
            if (wall > 0) flags += 4;
            if (liquid > 0) flags += 8;
            if (tile.wire()) flags += 16;
            if (tile.halfBrick()) flags += 32;
            if (tile.actuator()) flags += 64;
            if (tile.inActive()) flags += 128;

            Byte(flags);

            byte tileColour = 0, wallColour = 0;
            flags = 0;
            if (tile.wire2()) flags += 1;
            if (tile.wire3()) flags += 2;
            if (tile.active() && tile.color() > 0)
            {
                flags += 4;
                tileColour = tile.color();
            }
            if (tile.wall > 0 && tile.wallColor() > 0)
            {
                flags += 8;
                wallColour = tile.wallColor();
            }
            Byte(flags + (byte)(tile.slope() << 4));

            if (tileColour > 0) Byte(tileColour);
            if (wallColour > 0) Byte(wallColour);

            if (tile.active())
            {
                UShort(tile.type);
                if (Main.tileFrameImportant[(int)tile.type])
                {
                    Short(tile.frameX);
                    Short(tile.frameY);
                }
            }
            if (tile.wall > 0) Byte(tile.wall);

            if (tile.liquid > 0)
            {
                Byte(tile.liquid);
                Byte(tile.liquidType());
            }
        }