Exemplo n.º 1
0
        // Token: 0x060001EF RID: 495 RVA: 0x000BF614 File Offset: 0x000BD814
        public static void MakeRain()
        {
            if ((double)Main.screenPosition.Y > Main.worldSurface * 16.0)
            {
                return;
            }
            if (Main.gameMenu)
            {
                return;
            }
            float num = (float)Main.screenWidth / 1920f;

            num *= 25f;
            num *= 0.25f + 1f * Main.cloudAlpha;
            if (Filters.Scene["Sandstorm"].IsActive())
            {
                return;
            }
            int num2 = 0;

            while ((float)num2 < num)
            {
                int num3 = 600;
                if (Main.player[Main.myPlayer].velocity.Y < 0f)
                {
                    num3 += (int)(Math.Abs(Main.player[Main.myPlayer].velocity.Y) * 30f);
                }
                Vector2 vector;
                vector.X  = (float)Main.rand.Next((int)Main.screenPosition.X - num3, (int)Main.screenPosition.X + Main.screenWidth + num3);
                vector.Y  = Main.screenPosition.Y - (float)Main.rand.Next(20, 100);
                vector.X -= Main.windSpeed * 15f * 40f;
                vector.X += Main.player[Main.myPlayer].velocity.X * 40f;
                if (vector.X < 0f)
                {
                    vector.X = 0f;
                }
                if (vector.X > (float)((Main.maxTilesX - 1) * 16))
                {
                    vector.X = (float)((Main.maxTilesX - 1) * 16);
                }
                int num4 = (int)vector.X / 16;
                int num5 = (int)vector.Y / 16;
                if (num4 < 0)
                {
                    num4 = 0;
                }
                if (num4 > Main.maxTilesX - 1)
                {
                    num4 = Main.maxTilesX - 1;
                }
                if (Main.gameMenu || (!WorldGen.SolidTile(num4, num5) && Main.tile[num4, num5].wall <= 0))
                {
                    Vector2 vector2 = new Vector2(Main.windSpeed * 12f, 14f);
                    Rain.NewRain(vector, vector2);
                }
                num2++;
            }
        }
Exemplo n.º 2
0
        public static void MakeRain()
        {
            if (Main.netMode == 2 || Main.gamePaused || ((double)Main.screenPosition.Y > Main.worldSurface * 16.0 || Main.gameMenu))
            {
                return;
            }
            float num1 = (float)Main.screenWidth / 1920f * 25f * (float)(0.25 + 1.0 * (double)Main.cloudAlpha);

            if (Filters.Scene["Sandstorm"].IsActive())
            {
                return;
            }
            for (int index = 0; (double)index < (double)num1; ++index)
            {
                int num2 = 600;
                if ((double)Main.player[Main.myPlayer].velocity.Y < 0.0)
                {
                    num2 += (int)((double)Math.Abs(Main.player[Main.myPlayer].velocity.Y) * 30.0);
                }
                Vector2 Position;
                Position.X  = (float)Main.rand.Next((int)Main.screenPosition.X - num2, (int)Main.screenPosition.X + Main.screenWidth + num2);
                Position.Y  = Main.screenPosition.Y - (float)Main.rand.Next(20, 100);
                Position.X -= (float)((double)Main.windSpeedCurrent * 15.0 * 40.0);
                Position.X += Main.player[Main.myPlayer].velocity.X * 40f;
                if ((double)Position.X < 0.0)
                {
                    Position.X = 0.0f;
                }
                if ((double)Position.X > (double)((Main.maxTilesX - 1) * 16))
                {
                    Position.X = (float)((Main.maxTilesX - 1) * 16);
                }
                int i = (int)Position.X / 16;
                int j = (int)Position.Y / 16;
                if (i < 0)
                {
                    i = 0;
                }
                if (i > Main.maxTilesX - 1)
                {
                    i = Main.maxTilesX - 1;
                }
                if (j < 0)
                {
                    j = 0;
                }
                if (j > Main.maxTilesY - 1)
                {
                    j = Main.maxTilesY - 1;
                }
                if (Main.gameMenu || !WorldGen.SolidTile(i, j, false) && Main.tile[i, j].wall <= (ushort)0)
                {
                    Vector2 Velocity = new Vector2(Main.windSpeedCurrent * 18f, 14f);
                    Rain.NewRain(Position, Velocity);
                }
            }
        }
Exemplo n.º 3
0
        // Token: 0x060001F1 RID: 497 RVA: 0x000BF998 File Offset: 0x000BDB98
        public static int NewRain(Vector2 Position, Vector2 Velocity)
        {
            int num  = -1;
            int num2 = (int)((float)Main.maxRain * Main.cloudAlpha);

            if (num2 > Main.maxRain)
            {
                num2 = Main.maxRain;
            }
            float num3 = (float)Main.maxTilesX / 6400f;
            float num4 = Math.Max(0f, Math.Min(1f, (Main.player[Main.myPlayer].position.Y / 16f - 85f * num3) / (60f * num3)));

            num4 *= num4;
            num2  = (int)((float)num2 * num4);
            float num5 = (1f + Main.gfxQuality) / 2f;

            if ((double)num5 < 0.9)
            {
                num2 = (int)((float)num2 * num5);
            }
            float num6 = (float)(800 - Main.snowTiles);

            if (num6 < 0f)
            {
                num6 = 0f;
            }
            num6 /= 800f;
            num2  = (int)((float)num2 * num6);
            for (int i = 0; i < num2; i++)
            {
                if (!Main.rain[i].active)
                {
                    num = i;
                    break;
                }
            }
            if (num == -1)
            {
                return(Main.maxRain);
            }
            Rain rain = Main.rain[num];

            rain.active   = true;
            rain.position = Position;
            rain.scale    = 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
            rain.velocity = Velocity * rain.scale;
            rain.rotation = (float)Math.Atan2((double)rain.velocity.X, (double)(-(double)rain.velocity.Y));
            rain.type     = (byte)Main.rand.Next(3);
            if (Main.bloodMoon)
            {
                Rain expr_18D = rain;
                expr_18D.type += 3;
            }
            return(num);
        }
Exemplo n.º 4
0
        public static int NewRain(Vector2 Position, Vector2 Velocity)
        {
            int index1 = -1;
            int num1   = (int)((double)Main.maxRain * (double)Main.cloudAlpha);

            if (num1 > Main.maxRain)
            {
                num1 = Main.maxRain;
            }
            float num2 = (float)Main.maxTilesX / 6400f;
            float num3 = Math.Max(0.0f, Math.Min(1f, (float)(((double)Main.player[Main.myPlayer].position.Y / 16.0 - 85.0 * (double)num2) / (60.0 * (double)num2))));
            float num4 = num3 * num3;
            int   num5 = (int)((double)num1 * (double)num4);
            float num6 = (float)((1.0 + (double)Main.gfxQuality) / 2.0);

            if ((double)num6 < 0.9)
            {
                num5 = (int)((double)num5 * (double)num6);
            }
            float num7 = (float)(800 - Main.snowTiles);

            if ((double)num7 < 0.0)
            {
                num7 = 0.0f;
            }
            float num8 = num7 / 800f;
            int   num9 = (int)((double)num5 * (double)num8);

            for (int index2 = 0; index2 < num9; ++index2)
            {
                if (!Main.rain[index2].active)
                {
                    index1 = index2;
                    break;
                }
            }
            if (index1 == -1)
            {
                return(Main.maxRain);
            }
            Rain rain = Main.rain[index1];

            rain.active   = true;
            rain.position = Position;
            rain.scale    = (float)(1.0 + (double)Main.rand.Next(-20, 21) * 0.00999999977648258);
            rain.velocity = Velocity * rain.scale;
            rain.rotation = (float)Math.Atan2((double)rain.velocity.X, -(double)rain.velocity.Y);
            rain.type     = (byte)Main.rand.Next(3);
            if (Main.bloodMoon)
            {
                rain.type += (byte)3;
            }
            return(index1);
        }
Exemplo n.º 5
0
        private static int NewRain(Vector2 Position, Vector2 Velocity)
        {
            int num  = -1;
            int num2 = (int)((float)Main.maxRain * Main.cloudAlpha);

            if (num2 > Main.maxRain)
            {
                num2 = Main.maxRain;
            }
            float num3 = (float)Main.maxTilesX / 6400f;

            Math.Max(0f, Math.Min(1f, (Main.player[Main.myPlayer].position.Y / 16f - 85f * num3) / (60f * num3)));
            float num4 = (1f + Main.gfxQuality) / 2f;

            if ((double)num4 < 0.9)
            {
                num2 = (int)((float)num2 * num4);
            }
            float num5 = 800 - Main.SceneMetrics.SnowTileCount;

            if (num5 < 0f)
            {
                num5 = 0f;
            }
            num5 /= 800f;
            num2  = (int)((float)num2 * num5);
            num2  = (int)((double)num2 * Math.Pow(Main.atmo, 9.0));
            if ((double)Main.atmo < 0.4)
            {
                num2 = 0;
            }
            for (int i = 0; i < num2; i++)
            {
                if (!Main.rain[i].active)
                {
                    num = i;
                    break;
                }
            }
            if (num == -1)
            {
                return(Main.maxRain);
            }
            Rain rain = Main.rain[num];

            rain.active   = true;
            rain.position = Position;
            rain.scale    = 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
            rain.velocity = Velocity * rain.scale;
            rain.rotation = (float)Math.Atan2(rain.velocity.X, 0f - rain.velocity.Y);
            rain.type     = (byte)(Main.waterStyle * 3 + Main.rand.Next(3));
            return(num);
        }
Exemplo n.º 6
0
        private static int NewRain(Vector2 Position, Vector2 Velocity)
        {
            int index1 = -1;
            int num1   = (int)((double)Main.maxRain * (double)Main.cloudAlpha);

            if (num1 > Main.maxRain)
            {
                num1 = Main.maxRain;
            }
            float  num2 = (float)Main.maxTilesX / 6400f;
            double num3 = (double)Math.Max(0.0f, Math.Min(1f, (float)(((double)Main.player[Main.myPlayer].position.Y / 16.0 - 85.0 * (double)num2) / (60.0 * (double)num2))));
            float  num4 = (float)((1.0 + (double)Main.gfxQuality) / 2.0);

            if ((double)num4 < 0.9)
            {
                num1 = (int)((double)num1 * (double)num4);
            }
            float num5 = (float)(800 - Main.SceneMetrics.SnowTileCount);

            if ((double)num5 < 0.0)
            {
                num5 = 0.0f;
            }
            float num6 = num5 / 800f;
            int   num7 = (int)((double)(int)((double)num1 * (double)num6) * Math.Pow((double)Main.atmo, 9.0));

            if ((double)Main.atmo < 0.4)
            {
                num7 = 0;
            }
            for (int index2 = 0; index2 < num7; ++index2)
            {
                if (!Main.rain[index2].active)
                {
                    index1 = index2;
                    break;
                }
            }
            if (index1 == -1)
            {
                return(Main.maxRain);
            }
            Rain rain = Main.rain[index1];

            rain.active   = true;
            rain.position = Position;
            rain.scale    = (float)(1.0 + (double)Main.rand.Next(-20, 21) * 0.00999999977648258);
            rain.velocity = Velocity * rain.scale;
            rain.rotation = (float)Math.Atan2((double)rain.velocity.X, -(double)rain.velocity.Y);
            rain.type     = (byte)(Main.waterStyle * 3 + Main.rand.Next(3));
            return(index1);
        }
Exemplo n.º 7
0
        public static int NewRain(Vector2 Position, Vector2 Velocity)
        {
            int index1 = -1;
            int num1   = (int)((double)Main.maxRain * (double)Main.cloudAlpha);

            if (num1 > Main.maxRain)
            {
                num1 = Main.maxRain;
            }
            float num2 = (float)((1.0 + (double)Main.gfxQuality) / 2.0);

            if ((double)num2 < 0.9)
            {
                num1 = (int)((double)num1 * (double)num2);
            }
            float num3 = (float)(800 - Main.snowTiles);

            if ((double)num3 < 0.0)
            {
                num3 = 0.0f;
            }
            float num4 = num3 / 800f;
            int   num5 = (int)((double)num1 * (double)num4);

            for (int index2 = 0; index2 < num5; ++index2)
            {
                if (!Main.rain[index2].active)
                {
                    index1 = index2;
                    break;
                }
            }
            if (index1 == -1)
            {
                return(Main.maxRain);
            }
            Rain rain = Main.rain[index1];

            rain.active   = true;
            rain.position = Position;
            rain.scale    = (float)(1.0 + (double)Main.rand.Next(-20, 21) * 0.00999999977648258);
            rain.velocity = Velocity * rain.scale;
            rain.rotation = (float)Math.Atan2((double)rain.velocity.X, -(double)rain.velocity.Y);
            rain.type     = (byte)Main.rand.Next(3);
            if (Main.bloodMoon)
            {
                rain.type += (byte)3;
            }
            return(index1);
        }
Exemplo n.º 8
0
        public static int NewRain(Vector2 Position, Vector2 Velocity)
        {
            int num  = -1;
            int num2 = (int)((float)Main.maxRain * Main.cloudAlpha);

            if (num2 > Main.maxRain)
            {
                num2 = Main.maxRain;
            }
            float num3 = (1f + Main.gfxQuality) / 2f;

            if ((double)num3 < 0.9)
            {
                num2 = (int)((float)num2 * num3);
            }
            float num4 = (float)(800 - Main.snowTiles);

            if (num4 < 0f)
            {
                num4 = 0f;
            }
            num4 /= 800f;
            num2  = (int)((float)num2 * num4);
            for (int i = 0; i < num2; i++)
            {
                if (!Main.rain[i].active)
                {
                    num = i;
                    break;
                }
            }
            if (num == -1)
            {
                return(Main.maxRain);
            }
            Rain rain = Main.rain[num];

            rain.active   = true;
            rain.position = Position;
            rain.scale    = 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
            rain.velocity = Velocity * rain.scale;
            rain.rotation = (float)Math.Atan2((double)rain.velocity.X, (double)(-(double)rain.velocity.Y));
            rain.type     = (byte)Main.rand.Next(3);
            if (Main.bloodMoon)
            {
                Rain expr_12D = rain;
                expr_12D.type = (byte)(expr_12D.type + 3);
            }
            return(num);
        }
Exemplo n.º 9
0
        public static void MakeRain()
        {
            if ((double)Main.screenPosition.Y > Main.worldSurface * 16.0 || Main.gameMenu)
            {
                return;
            }
            float num1 = (float)Main.screenWidth / 1920f * 25f * (float)(0.25 + 1.0 * (double)Main.cloudAlpha);

            for (int index = 0; (double)index < (double)num1; ++index)
            {
                int num2 = 600;
                if ((double)Main.player[Main.myPlayer].velocity.Y < 0.0)
                {
                    num2 += (int)((double)Math.Abs(Main.player[Main.myPlayer].velocity.Y) * 30.0);
                }
                Vector2 Position;
                Position.X  = (float)Main.rand.Next((int)Main.screenPosition.X - num2, (int)Main.screenPosition.X + Main.screenWidth + num2);
                Position.Y  = Main.screenPosition.Y - (float)Main.rand.Next(20, 100);
                Position.X -= (float)((double)Main.windSpeed * 15.0 * 40.0);
                Position.X += Main.player[Main.myPlayer].velocity.X * 40f;
                if ((double)Position.X < 0.0)
                {
                    Position.X = 0.0f;
                }
                if ((double)Position.X > (double)((Main.maxTilesX - 1) * 16))
                {
                    Position.X = (float)((Main.maxTilesX - 1) * 16);
                }
                int i = (int)Position.X / 16;
                int j = (int)Position.Y / 16;
                if (i < 0)
                {
                    i = 0;
                }
                if (i > Main.maxTilesX - 1)
                {
                    i = Main.maxTilesX - 1;
                }
                if (Main.gameMenu || !WorldGen.SolidTile(i, j) && (int)Main.tile[i, j].wall <= 0)
                {
                    Vector2 Velocity = new Vector2(Main.windSpeed * 12f, 14f);
                    Rain.NewRain(Position, Velocity);
                }
            }
        }
Exemplo n.º 10
0
        public void Update()
        {
            Rain    rain      = this;
            Vector2 vector2_1 = Vector2.op_Addition(rain.position, this.velocity);

            rain.position = vector2_1;
            if (!Collision.SolidCollision(this.position, 2, 2) && this.position.Y <= Main.screenPosition.Y + (double)Main.screenHeight + 100.0 && !Collision.WetCollision(this.position, 2, 2))
            {
                return;
            }
            this.active = false;
            if ((double)Main.rand.Next(100) >= (double)Main.gfxQuality * 100.0)
            {
                return;
            }
            int Type = 154;

            if ((int)this.type == 3 || (int)this.type == 4 || (int)this.type == 5)
            {
                Type = 218;
            }
            int index = Dust.NewDust(Vector2.op_Subtraction(this.position, this.velocity), 2, 2, Type, 0.0f, 0.0f, 0, (Color)null, 1f);
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            Vector2& local = @Main.dust[index].position;
            // ISSUE: explicit reference operation
            double num = (^ local).X - 2.0;

            // ISSUE: explicit reference operation
            (^ local).X            = (__Null)num;
            Main.dust[index].alpha = 38;
            Dust    dust1     = Main.dust[index];
            Vector2 vector2_2 = Vector2.op_Multiply(dust1.velocity, 0.1f);

            dust1.velocity = vector2_2;
            Dust    dust2     = Main.dust[index];
            Vector2 vector2_3 = Vector2.op_Addition(dust2.velocity, Vector2.op_Multiply(Vector2.op_UnaryNegation(this.velocity), 0.025f));

            dust2.velocity         = vector2_3;
            Main.dust[index].scale = 0.75f;
        }
Exemplo n.º 11
0
        public static void MakeRain()
        {
            if ((double)Main.screenPosition.Y > Main.worldSurface * 16.0 || Main.gameMenu)
            {
                return;
            }
            float num1 = (float)Main.screenWidth / 1920f * 25f * (float)(0.25 + 1.0 * (double)Main.cloudAlpha);

            if (Filters.Scene["Sandstorm"].IsActive())
            {
                return;
            }
            for (int index = 0; (double)index < (double)num1; ++index)
            {
                int num2 = 600;
                if (Main.player[Main.myPlayer].velocity.Y < 0.0)
                {
                    num2 += (int)((double)Math.Abs((float)Main.player[Main.myPlayer].velocity.Y) * 30.0);
                }
                Vector2 Position;
                Position.X = (__Null)(double)Main.rand.Next((int)Main.screenPosition.X - num2, (int)Main.screenPosition.X + Main.screenWidth + num2);
                Position.Y = (__Null)(Main.screenPosition.Y - (double)Main.rand.Next(20, 100));
                // ISSUE: explicit reference operation
                // ISSUE: variable of a reference type
                Vector2& local1 = @Position;
                // ISSUE: explicit reference operation
                double num3 = (^ local1).X - (double)Main.windSpeed * 15.0 * 40.0;
                // ISSUE: explicit reference operation
                (^ local1).X = (__Null)num3;
                // ISSUE: explicit reference operation
                // ISSUE: variable of a reference type
                Vector2& local2 = @Position;
                // ISSUE: explicit reference operation
                double num4 = (^ local2).X + Main.player[Main.myPlayer].velocity.X * 40.0;
                // ISSUE: explicit reference operation
                (^ local2).X = (__Null)num4;
                if (Position.X < 0.0)
                {
                    Position.X = (__Null)0.0;
                }
                if (Position.X > (double)((Main.maxTilesX - 1) * 16))
                {
                    Position.X = (__Null)(double)((Main.maxTilesX - 1) * 16);
                }
                int i = (int)Position.X / 16;
                int j = (int)Position.Y / 16;
                if (i < 0)
                {
                    i = 0;
                }
                if (i > Main.maxTilesX - 1)
                {
                    i = Main.maxTilesX - 1;
                }
                if (Main.gameMenu || !WorldGen.SolidTile(i, j) && (int)Main.tile[i, j].wall <= 0)
                {
                    Vector2 Velocity;
                    // ISSUE: explicit reference operation
                    ((Vector2)@Velocity).\u002Ector(Main.windSpeed * 12f, 14f);
                    Rain.NewRain(Position, Velocity);
                }
            }
        }