Example #1
0
        public static void EmitDust()
        {
            if (Main.gamePaused)
            {
                return;
            }
            int    sandTiles = Main.sandTiles;
            Player player    = Main.player[Main.myPlayer];
            bool   flag;

            Sandstorm.HandleEffectAndSky((flag = Sandstorm.Happening && player.ZoneSandstorm && ((Main.bgStyle == 2 || Main.bgStyle == 5) && Main.bgDelay < 50)) && Main.UseStormEffects);
            if (sandTiles < 100 || (double)player.position.Y > Main.worldSurface * 16.0 || player.ZoneBeach)
            {
                return;
            }
            int maxValue1 = 1;

            if (!flag || Main.rand.Next(maxValue1) != 0)
            {
                return;
            }
            int   num1   = Math.Sign(Main.windSpeed);
            float amount = Math.Abs(Main.windSpeed);

            if ((double)amount < 0.00999999977648258)
            {
                return;
            }
            float num2 = (float)num1 * MathHelper.Lerp(0.9f, 1f, amount);
            float num3 = 2000f / (float)sandTiles;
            float num4 = MathHelper.Clamp(3f / num3, 0.77f, 1f);
            int   num5 = (int)num3;
            int   num6 = (int)(1000.0 * (double)((float)Main.screenWidth / (float)Main.maxScreenW));
            float num7 = 20f * Sandstorm.Severity;
            float num8 = (float)((double)num6 * ((double)Main.gfxQuality * 0.5 + 0.5) + (double)num6 * 0.100000001490116) - (float)Dust.SandStormCount;

            if ((double)num8 <= 0.0)
            {
                return;
            }
            float   num9         = (float)Main.screenWidth + 1000f;
            float   screenHeight = (float)Main.screenHeight;
            Vector2 vector2      = Main.screenPosition + player.velocity;
            WeightedRandom <Color> weightedRandom = new WeightedRandom <Color>();

            weightedRandom.Add(new Color(200, 160, 20, 180), (double)(Main.screenTileCounts[53] + Main.screenTileCounts[396] + Main.screenTileCounts[397]));
            weightedRandom.Add(new Color(103, 98, 122, 180), (double)(Main.screenTileCounts[112] + Main.screenTileCounts[400] + Main.screenTileCounts[398]));
            weightedRandom.Add(new Color(135, 43, 34, 180), (double)(Main.screenTileCounts[234] + Main.screenTileCounts[401] + Main.screenTileCounts[399]));
            weightedRandom.Add(new Color(213, 196, 197, 180), (double)(Main.screenTileCounts[116] + Main.screenTileCounts[403] + Main.screenTileCounts[402]));
            float num10     = MathHelper.Lerp(0.2f, 0.35f, Sandstorm.Severity);
            float num11     = MathHelper.Lerp(0.5f, 0.7f, Sandstorm.Severity);
            int   maxValue2 = (int)MathHelper.Lerp(1f, 10f, (float)(((double)num4 - 0.769999980926514) / 0.230000019073486));

            for (int index1 = 0; (double)index1 < (double)num7; ++index1)
            {
                if (Main.rand.Next(num5 / 4) == 0)
                {
                    Vector2 Position = new Vector2((float)((double)Main.rand.NextFloat() * (double)num9 - 500.0), Main.rand.NextFloat() * -50f);
                    if (Main.rand.Next(3) == 0 && num1 == 1)
                    {
                        Position.X = (float)(Main.rand.Next(500) - 500);
                    }
                    else if (Main.rand.Next(3) == 0 && num1 == -1)
                    {
                        Position.X = (float)(Main.rand.Next(500) + Main.screenWidth);
                    }
                    if ((double)Position.X < 0.0 || (double)Position.X > (double)Main.screenWidth)
                    {
                        Position.Y += (float)((double)Main.rand.NextFloat() * (double)screenHeight * 0.899999976158142);
                    }
                    Position += vector2;
                    int index2 = (int)Position.X / 16;
                    int index3 = (int)Position.Y / 16;
                    if (Main.tile[index2, index3] != null && (int)Main.tile[index2, index3].wall == 0)
                    {
                        for (int index4 = 0; index4 < 1; ++index4)
                        {
                            Dust dust = Main.dust[Dust.NewDust(Position, 10, 10, 268, 0.0f, 0.0f, 0, new Color(), 1f)];
                            dust.velocity.Y  = (float)(2.0 + (double)Main.rand.NextFloat() * 0.200000002980232);
                            dust.velocity.Y *= dust.scale;
                            dust.velocity.Y *= 0.35f;
                            dust.velocity.X  = (float)((double)num2 * 5.0 + (double)Main.rand.NextFloat() * 1.0);
                            dust.velocity.X += (float)((double)num2 * (double)num11 * 20.0);
                            dust.fadeIn     += num11 * 0.2f;
                            dust.velocity   *= (float)(1.0 + (double)num10 * 0.5);
                            dust.color       = (Color)weightedRandom;
                            dust.velocity   *= 1f + num10;
                            dust.velocity   *= num4;
                            dust.scale       = 0.9f;
                            --num8;
                            if ((double)num8 > 0.0)
                            {
                                if (Main.rand.Next(maxValue2) != 0)
                                {
                                    --index4;
                                    Position += Utils.RandomVector2(Main.rand, -10f, 10f) + dust.velocity * -1.1f;
                                    int x = (int)Position.X / 16;
                                    int y = (int)Position.Y / 16;
                                    if (WorldGen.InWorld(x, y, 10) && Main.tile[x, y] != null)
                                    {
                                        int wall = (int)Main.tile[x, y].wall;
                                    }
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                        if ((double)num8 <= 0.0)
                        {
                            break;
                        }
                    }
                }
            }
        }
Example #2
0
        public static void EmitDust()
        {
            if (Main.gamePaused)
            {
                return;
            }
            int    sandTiles = Main.sandTiles;
            Player player    = Main.player[Main.myPlayer];
            bool   flag      = Sandstorm.Happening && player.ZoneSandstorm && ((Main.bgStyle == 2 || Main.bgStyle == 5) && Main.bgDelay < 50);

            Sandstorm.HandleEffectAndSky(flag && Main.UseStormEffects);
            if (sandTiles < 100 || (double)player.position.Y > Main.worldSurface * 16.0 || player.ZoneBeach)
            {
                return;
            }
            int maxValue1 = 1;

            if (!flag || Main.rand.Next(maxValue1) != 0)
            {
                return;
            }
            int   num1 = Math.Sign(Main.windSpeed);
            float num2 = Math.Abs(Main.windSpeed);

            if ((double)num2 < 0.00999999977648258)
            {
                return;
            }
            float num3 = (float)num1 * MathHelper.Lerp(0.9f, 1f, num2);
            float num4 = 2000f / (float)sandTiles;
            float num5 = MathHelper.Clamp(3f / num4, 0.77f, 1f);
            int   num6 = (int)num4;
            int   num7 = (int)(1000.0 * (double)((float)Main.screenWidth / (float)Main.maxScreenW));
            float num8 = 20f * Sandstorm.Severity;
            float num9 = (float)((double)num7 * ((double)Main.gfxQuality * 0.5 + 0.5) + (double)num7 * 0.100000001490116) - (float)Dust.SandStormCount;

            if ((double)num9 <= 0.0)
            {
                return;
            }
            float   num10        = (float)Main.screenWidth + 1000f;
            float   screenHeight = (float)Main.screenHeight;
            Vector2 vector2_1    = Vector2.op_Addition(Main.screenPosition, player.velocity);
            WeightedRandom <Color> weightedRandom = new WeightedRandom <Color>();

            weightedRandom.Add(new Color(200, 160, 20, 180), (double)(Main.screenTileCounts[53] + Main.screenTileCounts[396] + Main.screenTileCounts[397]));
            weightedRandom.Add(new Color(103, 98, 122, 180), (double)(Main.screenTileCounts[112] + Main.screenTileCounts[400] + Main.screenTileCounts[398]));
            weightedRandom.Add(new Color(135, 43, 34, 180), (double)(Main.screenTileCounts[234] + Main.screenTileCounts[401] + Main.screenTileCounts[399]));
            weightedRandom.Add(new Color(213, 196, 197, 180), (double)(Main.screenTileCounts[116] + Main.screenTileCounts[403] + Main.screenTileCounts[402]));
            float num11     = MathHelper.Lerp(0.2f, 0.35f, Sandstorm.Severity);
            float num12     = MathHelper.Lerp(0.5f, 0.7f, Sandstorm.Severity);
            int   maxValue2 = (int)MathHelper.Lerp(1f, 10f, (float)(((double)num5 - 0.769999980926514) / 0.230000019073486));

            for (int index1 = 0; (double)index1 < (double)num8; ++index1)
            {
                if (Main.rand.Next(num6 / 4) == 0)
                {
                    Vector2 Position;
                    // ISSUE: explicit reference operation
                    ((Vector2)@Position).\u002Ector((float)((double)Main.rand.NextFloat() * (double)num10 - 500.0), Main.rand.NextFloat() * -50f);
                    if (Main.rand.Next(3) == 0 && num1 == 1)
                    {
                        Position.X = (__Null)(double)(Main.rand.Next(500) - 500);
                    }
                    else if (Main.rand.Next(3) == 0 && num1 == -1)
                    {
                        Position.X = (__Null)(double)(Main.rand.Next(500) + Main.screenWidth);
                    }
                    if (Position.X < 0.0 || Position.X > (double)Main.screenWidth)
                    {
                        // ISSUE: explicit reference operation
                        // ISSUE: variable of a reference type
                        __Null& local = @Position.Y;
                        // ISSUE: cast to a reference type
                        // ISSUE: explicit reference operation
                        double num13 = (double) ^ (float&)local + (double)Main.rand.NextFloat() * (double)screenHeight * 0.899999976158142;
Example #3
0
        // Token: 0x06001263 RID: 4707 RVA: 0x00416DB4 File Offset: 0x00414FB4
        public static void EmitDust()
        {
            if (Main.gamePaused)
            {
                return;
            }
            int    sandTiles = Main.sandTiles;
            Player player    = Main.player[Main.myPlayer];
            bool   flag      = Sandstorm.Happening && player.ZoneSandstorm && (Main.bgStyle == 2 || Main.bgStyle == 5) && Main.bgDelay < 50;

            Sandstorm.HandleEffectAndSky(flag && Main.UseStormEffects);
            if (sandTiles < 100 || (double)player.position.Y > Main.worldSurface * 16.0 || player.ZoneBeach)
            {
                return;
            }
            int maxValue = 1;

            if (!flag)
            {
                return;
            }
            if (Main.rand.Next(maxValue) != 0)
            {
                return;
            }
            int   num  = Math.Sign(Main.windSpeed);
            float num2 = Math.Abs(Main.windSpeed);

            if (num2 < 0.01f)
            {
                return;
            }
            float num3 = (float)num * MathHelper.Lerp(0.9f, 1f, num2);
            float num4 = 2000f / (float)sandTiles;
            float num5 = 3f / num4;

            num5 = MathHelper.Clamp(num5, 0.77f, 1f);
            int   num6  = (int)num4;
            float num7  = (float)Main.screenWidth / (float)Main.maxScreenW;
            int   num8  = (int)(1000f * num7);
            float num9  = 20f * Sandstorm.Severity;
            float num10 = (float)num8 * (Main.gfxQuality * 0.5f + 0.5f) + (float)num8 * 0.1f - (float)Dust.SandStormCount;

            if (num10 <= 0f)
            {
                return;
            }
            float   num11 = (float)Main.screenWidth + 1000f;
            float   num12 = (float)Main.screenHeight;
            Vector2 value = Main.screenPosition + player.velocity;
            WeightedRandom <Color> weightedRandom = new WeightedRandom <Color>();

            weightedRandom.Add(new Color(200, 160, 20, 180), (double)(Main.screenTileCounts[53] + Main.screenTileCounts[396] + Main.screenTileCounts[397]));
            weightedRandom.Add(new Color(103, 98, 122, 180), (double)(Main.screenTileCounts[112] + Main.screenTileCounts[400] + Main.screenTileCounts[398]));
            weightedRandom.Add(new Color(135, 43, 34, 180), (double)(Main.screenTileCounts[234] + Main.screenTileCounts[401] + Main.screenTileCounts[399]));
            weightedRandom.Add(new Color(213, 196, 197, 180), (double)(Main.screenTileCounts[116] + Main.screenTileCounts[403] + Main.screenTileCounts[402]));
            float num13     = MathHelper.Lerp(0.2f, 0.35f, Sandstorm.Severity);
            float num14     = MathHelper.Lerp(0.5f, 0.7f, Sandstorm.Severity);
            float amount    = (num5 - 0.77f) / 0.230000019f;
            int   maxValue2 = (int)MathHelper.Lerp(1f, 10f, amount);
            int   num15     = 0;

            while ((float)num15 < num9)
            {
                if (Main.rand.Next(num6 / 4) == 0)
                {
                    Vector2 vector = new Vector2(Main.rand.NextFloat() * num11 - 500f, Main.rand.NextFloat() * -50f);
                    if (Main.rand.Next(3) == 0 && num == 1)
                    {
                        vector.X = (float)(Main.rand.Next(500) - 500);
                    }
                    else if (Main.rand.Next(3) == 0 && num == -1)
                    {
                        vector.X = (float)(Main.rand.Next(500) + Main.screenWidth);
                    }
                    if (vector.X < 0f || vector.X > (float)Main.screenWidth)
                    {
                        vector.Y += Main.rand.NextFloat() * num12 * 0.9f;
                    }
                    vector += value;
                    int num16 = (int)vector.X / 16;
                    int num17 = (int)vector.Y / 16;
                    if (Main.tile[num16, num17] != null && Main.tile[num16, num17].wall == 0)
                    {
                        for (int i = 0; i < 1; i++)
                        {
                            Dust dust = Main.dust[Dust.NewDust(vector, 10, 10, 268, 0f, 0f, 0, default(Color), 1f)];
                            dust.velocity.Y = 2f + Main.rand.NextFloat() * 0.2f;
                            Dust expr_462_cp_0_cp_0 = dust;
                            expr_462_cp_0_cp_0.velocity.Y = expr_462_cp_0_cp_0.velocity.Y * dust.scale;
                            Dust expr_479_cp_0_cp_0 = dust;
                            expr_479_cp_0_cp_0.velocity.Y = expr_479_cp_0_cp_0.velocity.Y * 0.35f;
                            dust.velocity.X = num3 * 5f + Main.rand.NextFloat() * 1f;
                            Dust expr_4B3_cp_0_cp_0 = dust;
                            expr_4B3_cp_0_cp_0.velocity.X = expr_4B3_cp_0_cp_0.velocity.X + num3 * num14 * 20f;
                            dust.fadeIn   += num14 * 0.2f;
                            dust.velocity *= 1f + num13 * 0.5f;
                            dust.color     = weightedRandom;
                            dust.velocity *= 1f + num13;
                            dust.velocity *= num5;
                            dust.scale     = 0.9f;
                            num10         -= 1f;
                            if (num10 <= 0f)
                            {
                                break;
                            }
                            if (Main.rand.Next(maxValue2) != 0)
                            {
                                i--;
                                vector += Utils.RandomVector2(Main.rand, -10f, 10f) + dust.velocity * -1.1f;
                                num16   = (int)vector.X / 16;
                                num17   = (int)vector.Y / 16;
                                if (WorldGen.InWorld(num16, num17, 10) && Main.tile[num16, num17] != null)
                                {
                                    byte arg_5EA_0 = Main.tile[num16, num17].wall;
                                }
                            }
                        }
                        if (num10 <= 0f)
                        {
                            break;
                        }
                    }
                }
                num15++;
            }
        }
Example #4
0
        public static void EmitDust()
        {
            if (Main.gamePaused)
            {
                return;
            }
            int    sandTiles = Main.sandTiles;
            Player player    = Main.player[Main.myPlayer];
            bool   flag      = Sandstorm.Happening && player.ZoneSandstorm && ((Main.bgStyle == 2 || Main.bgStyle == 5) && Main.bgDelay < 50);

            Sandstorm.HandleEffectAndSky(flag && Main.UseStormEffects);
            if (sandTiles < 100 || (double)player.position.Y > Main.worldSurface * 16.0 || player.ZoneBeach)
            {
                return;
            }
            int maxValue1 = 1;

            if (!flag || Main.rand.Next(maxValue1) != 0)
            {
                return;
            }
            int   num1 = Math.Sign(Main.windSpeed);
            float num2 = Math.Abs(Main.windSpeed);

            if ((double)num2 < 0.00999999977648258)
            {
                return;
            }
            float num3 = (float)num1 * MathHelper.Lerp(0.9f, 1f, num2);
            float num4 = 2000f / (float)sandTiles;
            float num5 = MathHelper.Clamp(3f / num4, 0.77f, 1f);
            int   num6 = (int)num4;
            int   num7 = (int)(1000.0 * (double)((float)Main.screenWidth / (float)Main.maxScreenW));
            float num8 = 20f * Sandstorm.Severity;
            float num9 = (float)((double)num7 * ((double)Main.gfxQuality * 0.5 + 0.5) + (double)num7 * 0.100000001490116) - (float)Dust.SandStormCount;

            if ((double)num9 <= 0.0)
            {
                return;
            }
            float   num10        = (float)Main.screenWidth + 1000f;
            float   screenHeight = (float)Main.screenHeight;
            Vector2 vector2_1    = Vector2.op_Addition(Main.screenPosition, player.velocity);
            WeightedRandom <Color> weightedRandom = new WeightedRandom <Color>();

            weightedRandom.Add(new Color(200, 160, 20, 180), (double)(Main.screenTileCounts[53] + Main.screenTileCounts[396] + Main.screenTileCounts[397]));
            weightedRandom.Add(new Color(103, 98, 122, 180), (double)(Main.screenTileCounts[112] + Main.screenTileCounts[400] + Main.screenTileCounts[398]));
            weightedRandom.Add(new Color(135, 43, 34, 180), (double)(Main.screenTileCounts[234] + Main.screenTileCounts[401] + Main.screenTileCounts[399]));
            weightedRandom.Add(new Color(213, 196, 197, 180), (double)(Main.screenTileCounts[116] + Main.screenTileCounts[403] + Main.screenTileCounts[402]));
            float num11     = MathHelper.Lerp(0.2f, 0.35f, Sandstorm.Severity);
            float num12     = MathHelper.Lerp(0.5f, 0.7f, Sandstorm.Severity);
            int   maxValue2 = (int)MathHelper.Lerp(1f, 10f, (float)(((double)num5 - 0.769999980926514) / 0.230000019073486));

            for (int index1 = 0; (double)index1 < (double)num8; ++index1)
            {
                if (Main.rand.Next(num6 / 4) == 0)
                {
                    Vector2 Position;
                    // ISSUE: explicit reference operation
                    ((Vector2)@Position).\u002Ector((float)((double)Main.rand.NextFloat() * (double)num10 - 500.0), Main.rand.NextFloat() * -50f);
                    if (Main.rand.Next(3) == 0 && num1 == 1)
                    {
                        Position.X = (__Null)(double)(Main.rand.Next(500) - 500);
                    }
                    else if (Main.rand.Next(3) == 0 && num1 == -1)
                    {
                        Position.X = (__Null)(double)(Main.rand.Next(500) + Main.screenWidth);
                    }
                    if (Position.X < 0.0 || Position.X > (double)Main.screenWidth)
                    {
                        // ISSUE: explicit reference operation
                        // ISSUE: variable of a reference type
                        Vector2& local = @Position;
                        // ISSUE: explicit reference operation
                        double num13 = (^ local).Y + (double)Main.rand.NextFloat() * (double)screenHeight * 0.899999976158142;
                        // ISSUE: explicit reference operation
                        (^ local).Y = (__Null)num13;
                    }
                    Position = Vector2.op_Addition(Position, vector2_1);
                    int index2 = (int)Position.X / 16;
                    int index3 = (int)Position.Y / 16;
                    if (Main.tile[index2, index3] != null && (int)Main.tile[index2, index3].wall == 0)
                    {
                        for (int index4 = 0; index4 < 1; ++index4)
                        {
                            Dust dust1 = Main.dust[Dust.NewDust(Position, 10, 10, 268, 0.0f, 0.0f, 0, (Color)null, 1f)];
                            dust1.velocity.Y = (__Null)(2.0 + (double)Main.rand.NextFloat() * 0.200000002980232);
                            // ISSUE: explicit reference operation
                            // ISSUE: variable of a reference type
                            Vector2& local1 = @dust1.velocity;
                            // ISSUE: explicit reference operation
                            double num13 = (^ local1).Y * (double)dust1.scale;
                            // ISSUE: explicit reference operation
                            (^ local1).Y = (__Null)num13;
                            // ISSUE: explicit reference operation
                            // ISSUE: variable of a reference type
                            Vector2& local2 = @dust1.velocity;
                            // ISSUE: explicit reference operation
                            double num14 = (^ local2).Y * 0.349999994039536;
                            // ISSUE: explicit reference operation
                            (^ local2).Y     = (__Null)num14;
                            dust1.velocity.X = (__Null)((double)num3 * 5.0 + (double)Main.rand.NextFloat() * 1.0);
                            // ISSUE: explicit reference operation
                            // ISSUE: variable of a reference type
                            Vector2& local3 = @dust1.velocity;
                            // ISSUE: explicit reference operation
                            double num15 = (^ local3).X + (double)num3 * (double)num12 * 20.0;
                            // ISSUE: explicit reference operation
                            (^ local3).X  = (__Null)num15;
                            dust1.fadeIn += num12 * 0.2f;
                            Dust    dust2     = dust1;
                            Vector2 vector2_2 = Vector2.op_Multiply(dust2.velocity, (float)(1.0 + (double)num11 * 0.5));
                            dust2.velocity = vector2_2;
                            dust1.color    = (Color)weightedRandom;
                            Dust    dust3     = dust1;
                            Vector2 vector2_3 = Vector2.op_Multiply(dust3.velocity, 1f + num11);
                            dust3.velocity = vector2_3;
                            Dust    dust4     = dust1;
                            Vector2 vector2_4 = Vector2.op_Multiply(dust4.velocity, num5);
                            dust4.velocity = vector2_4;
                            dust1.scale    = 0.9f;
                            --num9;
                            if ((double)num9 > 0.0)
                            {
                                if (Main.rand.Next(maxValue2) != 0)
                                {
                                    --index4;
                                    Position = Vector2.op_Addition(Position, Vector2.op_Addition(Utils.RandomVector2(Main.rand, -10f, 10f), Vector2.op_Multiply(dust1.velocity, -1.1f)));
                                    int x = (int)Position.X / 16;
                                    int y = (int)Position.Y / 16;
                                    if (WorldGen.InWorld(x, y, 10) && Main.tile[x, y] != null)
                                    {
                                        int wall = (int)Main.tile[x, y].wall;
                                    }
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                        if ((double)num9 <= 0.0)
                        {
                            break;
                        }
                    }
                }
            }
        }