Beispiel #1
0
 public void Update()
 {
     if (type == 11 || type == 12 || type == 13 || type == 61 || type == 62 || type == 63 || type == 99)
     {
         velocity.Y *= 0.98f;
         velocity.X *= 0.98f;
         scale      -= 0.007f;
         if (scale < 0.1f)
         {
             active = 0;
             return;
         }
     }
     else if (type == 16 || type == 17)
     {
         velocity.Y *= 0.98f;
         velocity.X *= 0.98f;
         scale      -= 0.01f;
         if (scale < 0.1f)
         {
             active = 0;
             return;
         }
     }
     else
     {
         velocity.Y += 0.2f;
     }
     rotation += velocity.X * 0.1f;
     if (sticky)
     {
         int num = SpriteSheet <_sheetSprites> .src[256 + type].Width;
         if (SpriteSheet <_sheetSprites> .src[256 + type].Height < num)
         {
             num = SpriteSheet <_sheetSprites> .src[256 + type].Height;
         }
         num = (int)((float)num * scale * 0.9f);
         Collision.TileCollision(ref position, ref velocity, num, num);
         if (velocity.Y == 0f)
         {
             velocity.X *= 0.97f;
             if (velocity.X > -0.01f && velocity.X < 0.01f)
             {
                 velocity.X = 0f;
             }
         }
         if (timeLeft > 0)
         {
             timeLeft--;
         }
         else
         {
             alpha++;
         }
     }
     else
     {
         alpha += 2;
     }
     if (alpha >= 255)
     {
         active = 0;
         return;
     }
     position.X += velocity.X;
     position.Y += velocity.Y;
     if (light > 0f)
     {
         float   num2 = light * scale;
         Vector3 rgb  = new Vector3(num2, num2, num2);
         if (type == 16)
         {
             rgb.Y *= 0.8f;
             rgb.Z *= 0.3f;
         }
         else if (type == 17)
         {
             rgb.X *= 0.3f;
             rgb.Y *= 0.6f;
         }
         Lighting.addLight((int)(position.X + (float)SpriteSheet <_sheetSprites> .src[256 + type].Width * scale * 0.5f) >> 4, (int)(position.Y + (float)SpriteSheet <_sheetSprites> .src[256 + type].Height * scale * 0.5f) >> 4, rgb);
     }
 }
Beispiel #2
0
 public void Update()
 {
     if (this.active)
     {
         if ((((this.type == 11) || (this.type == 12)) || ((this.type == 13) || (this.type == 0x3d))) || ((this.type == 0x3e) || (this.type == 0x3f)))
         {
             this.velocity.Y *= 0.98f;
             this.velocity.X *= 0.98f;
             this.scale      -= 0.007f;
             if (this.scale < 0.1)
             {
                 this.scale = 0.1f;
                 this.alpha = 0xff;
             }
         }
         else if ((this.type == 0x10) || (this.type == 0x11))
         {
             this.velocity.Y *= 0.98f;
             this.velocity.X *= 0.98f;
             this.scale      -= 0.01f;
             if (this.scale < 0.1)
             {
                 this.scale = 0.1f;
                 this.alpha = 0xff;
             }
         }
         else
         {
             this.velocity.Y += 0.2f;
         }
         this.rotation += this.velocity.X * 0.1f;
         if (this.sticky)
         {
             int width = Main.goreTexture[this.type].Width;
             if (Main.goreTexture[this.type].Height < width)
             {
                 width = Main.goreTexture[this.type].Height;
             }
             width         = (int)(width * 0.9f);
             this.velocity = Collision.TileCollision(this.position, this.velocity, (int)(width * this.scale), (int)(width * this.scale), false, false);
             if (this.velocity.Y == 0f)
             {
                 this.velocity.X *= 0.97f;
                 if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01))
                 {
                     this.velocity.X = 0f;
                 }
             }
             if (this.timeLeft > 0)
             {
                 this.timeLeft--;
             }
             else
             {
                 this.alpha++;
             }
         }
         else
         {
             this.alpha += 2;
         }
         this.position += this.velocity;
         if (this.alpha >= 0xff)
         {
             this.active = false;
         }
         if (this.light > 0f)
         {
             Lighting.addLight((int)((this.position.X + ((Main.goreTexture[this.type].Width * this.scale) / 2f)) / 16f), (int)((this.position.Y + ((Main.goreTexture[this.type].Height * this.scale) / 2f)) / 16f), this.light);
         }
     }
 }
Beispiel #3
0
 public static void UpdateDust()
 {
     Dust.lavaBubbles = 0;
     Main.snowDust    = 0;
     for (int i = 0; i < 2000; i++)
     {
         if (i < Main.numDust)
         {
             if (Main.dust[i].active)
             {
                 if (Main.dust[i].type == 35)
                 {
                     Dust.lavaBubbles++;
                 }
                 Dust expr_52 = Main.dust[i];
                 expr_52.position += Main.dust[i].velocity;
                 if (Main.dust[i].type == 6 || Main.dust[i].type == 75 || Main.dust[i].type == 29 || (Main.dust[i].type >= 59 && Main.dust[i].type <= 65))
                 {
                     if (!Main.dust[i].noGravity)
                     {
                         Dust expr_DD_cp_0 = Main.dust[i];
                         expr_DD_cp_0.velocity.Y = expr_DD_cp_0.velocity.Y + 0.05f;
                     }
                     if (!Main.dust[i].noLight)
                     {
                         float num = Main.dust[i].scale * 1.4f;
                         if (Main.dust[i].type == 29)
                         {
                             if (num > 1f)
                             {
                                 num = 1f;
                             }
                             Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num * 0.1f, num * 0.4f, num);
                         }
                         if (Main.dust[i].type == 75)
                         {
                             if (num > 1f)
                             {
                                 num = 1f;
                             }
                             Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num * 0.7f, num, num * 0.2f);
                         }
                         else
                         {
                             if (Main.dust[i].type >= 59 && Main.dust[i].type <= 65)
                             {
                                 if (num > 0.8f)
                                 {
                                     num = 0.8f;
                                 }
                                 int   num2 = Main.dust[i].type - 58;
                                 float num3 = 1f;
                                 float num4 = 1f;
                                 float num5 = 1f;
                                 if (num2 == 1)
                                 {
                                     num3 = 0f;
                                     num4 = 0.1f;
                                     num5 = 1.3f;
                                 }
                                 else
                                 {
                                     if (num2 == 2)
                                     {
                                         num3 = 1f;
                                         num4 = 0.1f;
                                         num5 = 0.1f;
                                     }
                                     else
                                     {
                                         if (num2 == 3)
                                         {
                                             num3 = 0f;
                                             num4 = 1f;
                                             num5 = 0.1f;
                                         }
                                         else
                                         {
                                             if (num2 == 4)
                                             {
                                                 num3 = 0.9f;
                                                 num4 = 0f;
                                                 num5 = 0.9f;
                                             }
                                             else
                                             {
                                                 if (num2 == 5)
                                                 {
                                                     num3 = 1.3f;
                                                     num4 = 1.3f;
                                                     num5 = 1.3f;
                                                 }
                                                 else
                                                 {
                                                     if (num2 == 6)
                                                     {
                                                         num3 = 0.9f;
                                                         num4 = 0.9f;
                                                         num5 = 0f;
                                                     }
                                                     else
                                                     {
                                                         if (num2 == 7)
                                                         {
                                                             num3 = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch);
                                                             num4 = 0.3f;
                                                             num5 = 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch);
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                                 Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num * num3, num * num4, num * num5);
                             }
                             else
                             {
                                 if (num > 0.6f)
                                 {
                                     num = 0.6f;
                                 }
                                 Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num, num * 0.65f, num * 0.4f);
                             }
                         }
                     }
                 }
                 else
                 {
                     if (Main.dust[i].type == 14 || Main.dust[i].type == 16 || Main.dust[i].type == 31 || Main.dust[i].type == 46)
                     {
                         Dust expr_40B_cp_0 = Main.dust[i];
                         expr_40B_cp_0.velocity.Y = expr_40B_cp_0.velocity.Y * 0.98f;
                         Dust expr_428_cp_0 = Main.dust[i];
                         expr_428_cp_0.velocity.X = expr_428_cp_0.velocity.X * 0.98f;
                         if (Main.dust[i].type == 31 && Main.dust[i].noGravity)
                         {
                             Dust expr_464 = Main.dust[i];
                             expr_464.velocity  *= 1.02f;
                             Main.dust[i].scale += 0.02f;
                             Main.dust[i].alpha += 4;
                             if (Main.dust[i].alpha > 255)
                             {
                                 Main.dust[i].scale = 0.0001f;
                                 Main.dust[i].alpha = 255;
                             }
                         }
                     }
                     else
                     {
                         if (Main.dust[i].type == 32)
                         {
                             Main.dust[i].scale -= 0.01f;
                             Dust expr_516_cp_0 = Main.dust[i];
                             expr_516_cp_0.velocity.X = expr_516_cp_0.velocity.X * 0.96f;
                             Dust expr_533_cp_0 = Main.dust[i];
                             expr_533_cp_0.velocity.Y = expr_533_cp_0.velocity.Y + 0.1f;
                         }
                         else
                         {
                             if (Main.dust[i].type == 43)
                             {
                                 Main.dust[i].rotation += 0.1f * Main.dust[i].scale;
                                 Color color = Lighting.GetColor((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f));
                                 float num6  = (float)color.R / 270f;
                                 float num7  = (float)color.G / 270f;
                                 float num8  = (float)color.B / 270f;
                                 num6 *= Main.dust[i].scale * 1.07f;
                                 num7 *= Main.dust[i].scale * 1.07f;
                                 num8 *= Main.dust[i].scale * 1.07f;
                                 if (Main.dust[i].alpha < 255)
                                 {
                                     Main.dust[i].scale += 0.09f;
                                     if (Main.dust[i].scale >= 1f)
                                     {
                                         Main.dust[i].scale = 1f;
                                         Main.dust[i].alpha = 255;
                                     }
                                 }
                                 else
                                 {
                                     if ((double)Main.dust[i].scale < 0.8)
                                     {
                                         Main.dust[i].scale -= 0.01f;
                                     }
                                     if ((double)Main.dust[i].scale < 0.5)
                                     {
                                         Main.dust[i].scale -= 0.01f;
                                     }
                                 }
                                 if ((double)num6 < 0.05 && (double)num7 < 0.05 && (double)num8 < 0.05)
                                 {
                                     Main.dust[i].active = false;
                                 }
                                 else
                                 {
                                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num6, num7, num8);
                                 }
                             }
                             else
                             {
                                 if (Main.dust[i].type == 15 || Main.dust[i].type == 57 || Main.dust[i].type == 58)
                                 {
                                     Dust expr_7AD_cp_0 = Main.dust[i];
                                     expr_7AD_cp_0.velocity.Y = expr_7AD_cp_0.velocity.Y * 0.98f;
                                     Dust expr_7CA_cp_0 = Main.dust[i];
                                     expr_7CA_cp_0.velocity.X = expr_7CA_cp_0.velocity.X * 0.98f;
                                     float num9 = Main.dust[i].scale;
                                     if (Main.dust[i].type != 15)
                                     {
                                         num9 = Main.dust[i].scale * 0.8f;
                                     }
                                     if (Main.dust[i].noLight)
                                     {
                                         Dust expr_822 = Main.dust[i];
                                         expr_822.velocity *= 0.95f;
                                     }
                                     if (num9 > 1f)
                                     {
                                         num9 = 1f;
                                     }
                                     if (Main.dust[i].type == 15)
                                     {
                                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num9 * 0.45f, num9 * 0.55f, num9);
                                     }
                                     else
                                     {
                                         if (Main.dust[i].type == 57)
                                         {
                                             Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num9 * 0.95f, num9 * 0.95f, num9 * 0.45f);
                                         }
                                         else
                                         {
                                             if (Main.dust[i].type == 58)
                                             {
                                                 Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num9, num9 * 0.55f, num9 * 0.75f);
                                             }
                                         }
                                     }
                                 }
                                 else
                                 {
                                     if (Main.dust[i].type == 66)
                                     {
                                         if (Main.dust[i].velocity.X < 0f)
                                         {
                                             Main.dust[i].rotation -= 1f;
                                         }
                                         else
                                         {
                                             Main.dust[i].rotation += 1f;
                                         }
                                         Dust expr_9CD_cp_0 = Main.dust[i];
                                         expr_9CD_cp_0.velocity.Y = expr_9CD_cp_0.velocity.Y * 0.98f;
                                         Dust expr_9EA_cp_0 = Main.dust[i];
                                         expr_9EA_cp_0.velocity.X = expr_9EA_cp_0.velocity.X * 0.98f;
                                         Main.dust[i].scale      += 0.02f;
                                         float num10 = Main.dust[i].scale;
                                         if (Main.dust[i].type != 15)
                                         {
                                             num10 = Main.dust[i].scale * 0.8f;
                                         }
                                         if (num10 > 1f)
                                         {
                                             num10 = 1f;
                                         }
                                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num10 * ((float)Main.dust[i].color.R / 255f), num10 * ((float)Main.dust[i].color.G / 255f), num10 * ((float)Main.dust[i].color.B / 255f));
                                     }
                                     else
                                     {
                                         if (Main.dust[i].type == 20 || Main.dust[i].type == 21)
                                         {
                                             Main.dust[i].scale += 0.005f;
                                             Dust expr_B27_cp_0 = Main.dust[i];
                                             expr_B27_cp_0.velocity.Y = expr_B27_cp_0.velocity.Y * 0.94f;
                                             Dust expr_B44_cp_0 = Main.dust[i];
                                             expr_B44_cp_0.velocity.X = expr_B44_cp_0.velocity.X * 0.94f;
                                             float num11 = Main.dust[i].scale * 0.8f;
                                             if (num11 > 1f)
                                             {
                                                 num11 = 1f;
                                             }
                                             if (Main.dust[i].type == 21)
                                             {
                                                 num11 = Main.dust[i].scale * 0.4f;
                                                 Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num11 * 0.8f, num11 * 0.3f, num11);
                                             }
                                             else
                                             {
                                                 Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num11 * 0.3f, num11 * 0.6f, num11);
                                             }
                                         }
                                         else
                                         {
                                             if (Main.dust[i].type == 27 || Main.dust[i].type == 45)
                                             {
                                                 Dust expr_C5F = Main.dust[i];
                                                 expr_C5F.velocity  *= 0.94f;
                                                 Main.dust[i].scale += 0.002f;
                                                 float num12 = Main.dust[i].scale;
                                                 if (Main.dust[i].noLight)
                                                 {
                                                     num12 *= 0.1f;
                                                     Main.dust[i].scale -= 0.06f;
                                                     if (Main.dust[i].scale < 1f)
                                                     {
                                                         Main.dust[i].scale -= 0.06f;
                                                     }
                                                     if (Main.player[Main.myPlayer].wet)
                                                     {
                                                         Dust expr_D11 = Main.dust[i];
                                                         expr_D11.position += Main.player[Main.myPlayer].velocity * 0.5f;
                                                     }
                                                     else
                                                     {
                                                         Dust expr_D44 = Main.dust[i];
                                                         expr_D44.position += Main.player[Main.myPlayer].velocity;
                                                     }
                                                 }
                                                 if (num12 > 1f)
                                                 {
                                                     num12 = 1f;
                                                 }
                                                 Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num12 * 0.6f, num12 * 0.2f, num12);
                                             }
                                             else
                                             {
                                                 if (Main.dust[i].type == 55 || Main.dust[i].type == 56 || Main.dust[i].type == 73 || Main.dust[i].type == 74)
                                                 {
                                                     Dust expr_E0A = Main.dust[i];
                                                     expr_E0A.velocity *= 0.98f;
                                                     float num13 = Main.dust[i].scale * 0.8f;
                                                     if (Main.dust[i].type == 55)
                                                     {
                                                         if (num13 > 1f)
                                                         {
                                                             num13 = 1f;
                                                         }
                                                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num13, num13, num13 * 0.6f);
                                                     }
                                                     else
                                                     {
                                                         if (Main.dust[i].type == 73)
                                                         {
                                                             if (num13 > 1f)
                                                             {
                                                                 num13 = 1f;
                                                             }
                                                             Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num13, num13 * 0.35f, num13 * 0.5f);
                                                         }
                                                         else
                                                         {
                                                             if (Main.dust[i].type == 74)
                                                             {
                                                                 if (num13 > 1f)
                                                                 {
                                                                     num13 = 1f;
                                                                 }
                                                                 Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num13 * 0.35f, num13, num13 * 0.5f);
                                                             }
                                                             else
                                                             {
                                                                 num13 = Main.dust[i].scale * 1.2f;
                                                                 if (num13 > 1f)
                                                                 {
                                                                     num13 = 1f;
                                                                 }
                                                                 Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num13 * 0.35f, num13 * 0.5f, num13);
                                                             }
                                                         }
                                                     }
                                                 }
                                                 else
                                                 {
                                                     if (Main.dust[i].type == 71 || Main.dust[i].type == 72)
                                                     {
                                                         Dust expr_100B = Main.dust[i];
                                                         expr_100B.velocity *= 0.98f;
                                                         float num14 = Main.dust[i].scale;
                                                         if (num14 > 1f)
                                                         {
                                                             num14 = 1f;
                                                         }
                                                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num14 * 0.2f, 0f, num14 * 0.1f);
                                                     }
                                                     else
                                                     {
                                                         if (Main.dust[i].type == 76)
                                                         {
                                                             Main.snowDust++;
                                                             Main.dust[i].scale += 0.009f;
                                                             Dust expr_10C8 = Main.dust[i];
                                                             expr_10C8.position += Main.player[Main.myPlayer].velocity * 0.2f;
                                                         }
                                                         else
                                                         {
                                                             if (!Main.dust[i].noGravity && Main.dust[i].type != 41 && Main.dust[i].type != 44)
                                                             {
                                                                 Dust expr_112E_cp_0 = Main.dust[i];
                                                                 expr_112E_cp_0.velocity.Y = expr_112E_cp_0.velocity.Y + 0.1f;
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 if (Main.dust[i].type == 5 && Main.dust[i].noGravity)
                 {
                     Main.dust[i].scale -= 0.04f;
                 }
                 if (Main.dust[i].type == 33 || Main.dust[i].type == 52)
                 {
                     if (Main.dust[i].velocity.X == 0f)
                     {
                         if (Collision.SolidCollision(Main.dust[i].position, 2, 2))
                         {
                             Main.dust[i].scale = 0f;
                         }
                         Main.dust[i].rotation += 0.5f;
                         Main.dust[i].scale    -= 0.01f;
                     }
                     bool flag = Collision.WetCollision(new Vector2(Main.dust[i].position.X, Main.dust[i].position.Y), 4, 4);
                     if (flag)
                     {
                         Main.dust[i].alpha += 20;
                         Main.dust[i].scale -= 0.1f;
                     }
                     Main.dust[i].alpha += 2;
                     Main.dust[i].scale -= 0.005f;
                     if (Main.dust[i].alpha > 255)
                     {
                         Main.dust[i].scale = 0f;
                     }
                     Dust expr_12C2_cp_0 = Main.dust[i];
                     expr_12C2_cp_0.velocity.X = expr_12C2_cp_0.velocity.X * 0.93f;
                     if (Main.dust[i].velocity.Y > 4f)
                     {
                         Main.dust[i].velocity.Y = 4f;
                     }
                     if (Main.dust[i].noGravity)
                     {
                         if (Main.dust[i].velocity.X < 0f)
                         {
                             Main.dust[i].rotation -= 0.2f;
                         }
                         else
                         {
                             Main.dust[i].rotation += 0.2f;
                         }
                         Main.dust[i].scale += 0.03f;
                         Dust expr_1380_cp_0 = Main.dust[i];
                         expr_1380_cp_0.velocity.X = expr_1380_cp_0.velocity.X * 1.05f;
                         Dust expr_139D_cp_0 = Main.dust[i];
                         expr_139D_cp_0.velocity.Y = expr_139D_cp_0.velocity.Y + 0.15f;
                     }
                 }
                 if (Main.dust[i].type == 35 && Main.dust[i].noGravity)
                 {
                     Main.dust[i].scale += 0.03f;
                     if (Main.dust[i].scale < 1f)
                     {
                         Dust expr_1409_cp_0 = Main.dust[i];
                         expr_1409_cp_0.velocity.Y = expr_1409_cp_0.velocity.Y + 0.075f;
                     }
                     Dust expr_1426_cp_0 = Main.dust[i];
                     expr_1426_cp_0.velocity.X = expr_1426_cp_0.velocity.X * 1.08f;
                     if (Main.dust[i].velocity.X > 0f)
                     {
                         Main.dust[i].rotation += 0.01f;
                     }
                     else
                     {
                         Main.dust[i].rotation -= 0.01f;
                     }
                     float num15 = Main.dust[i].scale * 0.6f;
                     if (num15 > 1f)
                     {
                         num15 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f + 1f), num15, num15 * 0.3f, num15 * 0.1f);
                 }
                 else
                 {
                     if (Main.dust[i].type == 67)
                     {
                         float num16 = Main.dust[i].scale;
                         if (num16 > 1f)
                         {
                             num16 = 1f;
                         }
                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), 0f, num16 * 0.8f, num16);
                     }
                     else
                     {
                         if (Main.dust[i].type == 34 || Main.dust[i].type == 35)
                         {
                             if (!Collision.WetCollision(new Vector2(Main.dust[i].position.X, Main.dust[i].position.Y - 8f), 4, 4))
                             {
                                 Main.dust[i].scale = 0f;
                             }
                             else
                             {
                                 Main.dust[i].alpha += Main.rand.Next(2);
                                 if (Main.dust[i].alpha > 255)
                                 {
                                     Main.dust[i].scale = 0f;
                                 }
                                 Main.dust[i].velocity.Y = -0.5f;
                                 if (Main.dust[i].type == 34)
                                 {
                                     Main.dust[i].scale += 0.005f;
                                 }
                                 else
                                 {
                                     Main.dust[i].alpha++;
                                     Main.dust[i].scale     -= 0.01f;
                                     Main.dust[i].velocity.Y = -0.2f;
                                 }
                                 Dust expr_16B1_cp_0 = Main.dust[i];
                                 expr_16B1_cp_0.velocity.X = expr_16B1_cp_0.velocity.X + (float)Main.rand.Next(-10, 10) * 0.002f;
                                 if ((double)Main.dust[i].velocity.X < -0.25)
                                 {
                                     Main.dust[i].velocity.X = -0.25f;
                                 }
                                 if ((double)Main.dust[i].velocity.X > 0.25)
                                 {
                                     Main.dust[i].velocity.X = 0.25f;
                                 }
                             }
                             if (Main.dust[i].type == 35)
                             {
                                 float num17 = Main.dust[i].scale * 0.3f + 0.4f;
                                 if (num17 > 1f)
                                 {
                                     num17 = 1f;
                                 }
                                 Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num17, num17 * 0.5f, num17 * 0.3f);
                             }
                         }
                     }
                 }
                 if (Main.dust[i].type == 68)
                 {
                     float num18 = Main.dust[i].scale * 0.3f;
                     if (num18 > 1f)
                     {
                         num18 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num18 * 0.1f, num18 * 0.2f, num18);
                 }
                 if (Main.dust[i].type == 70)
                 {
                     float num19 = Main.dust[i].scale * 0.3f;
                     if (num19 > 1f)
                     {
                         num19 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num19 * 0.5f, 0f, num19);
                 }
                 if (Main.dust[i].type == 41)
                 {
                     Dust expr_18CB_cp_0 = Main.dust[i];
                     expr_18CB_cp_0.velocity.X = expr_18CB_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.01f;
                     Dust expr_18F8_cp_0 = Main.dust[i];
                     expr_18F8_cp_0.velocity.Y = expr_18F8_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.01f;
                     if ((double)Main.dust[i].velocity.X > 0.75)
                     {
                         Main.dust[i].velocity.X = 0.75f;
                     }
                     if ((double)Main.dust[i].velocity.X < -0.75)
                     {
                         Main.dust[i].velocity.X = -0.75f;
                     }
                     if ((double)Main.dust[i].velocity.Y > 0.75)
                     {
                         Main.dust[i].velocity.Y = 0.75f;
                     }
                     if ((double)Main.dust[i].velocity.Y < -0.75)
                     {
                         Main.dust[i].velocity.Y = -0.75f;
                     }
                     Main.dust[i].scale += 0.007f;
                     float num20 = Main.dust[i].scale * 0.7f;
                     if (num20 > 1f)
                     {
                         num20 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num20 * 0.4f, num20 * 0.9f, num20);
                 }
                 else
                 {
                     if (Main.dust[i].type == 44)
                     {
                         Dust expr_1A8C_cp_0 = Main.dust[i];
                         expr_1A8C_cp_0.velocity.X = expr_1A8C_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.003f;
                         Dust expr_1AB9_cp_0 = Main.dust[i];
                         expr_1AB9_cp_0.velocity.Y = expr_1AB9_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.003f;
                         if ((double)Main.dust[i].velocity.X > 0.35)
                         {
                             Main.dust[i].velocity.X = 0.35f;
                         }
                         if ((double)Main.dust[i].velocity.X < -0.35)
                         {
                             Main.dust[i].velocity.X = -0.35f;
                         }
                         if ((double)Main.dust[i].velocity.Y > 0.35)
                         {
                             Main.dust[i].velocity.Y = 0.35f;
                         }
                         if ((double)Main.dust[i].velocity.Y < -0.35)
                         {
                             Main.dust[i].velocity.Y = -0.35f;
                         }
                         Main.dust[i].scale += 0.0085f;
                         float num21 = Main.dust[i].scale * 0.7f;
                         if (num21 > 1f)
                         {
                             num21 = 1f;
                         }
                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num21 * 0.7f, num21, num21 * 0.8f);
                     }
                     else
                     {
                         Dust expr_1C37_cp_0 = Main.dust[i];
                         expr_1C37_cp_0.velocity.X = expr_1C37_cp_0.velocity.X * 0.99f;
                     }
                 }
                 if (Main.dust[i].type != 79)
                 {
                     Main.dust[i].rotation += Main.dust[i].velocity.X * 0.5f;
                 }
                 if (Main.dust[i].fadeIn > 0f)
                 {
                     if (Main.dust[i].type == 46)
                     {
                         Main.dust[i].scale += 0.1f;
                     }
                     else
                     {
                         Main.dust[i].scale += 0.03f;
                     }
                     if (Main.dust[i].scale > Main.dust[i].fadeIn)
                     {
                         Main.dust[i].fadeIn = 0f;
                     }
                 }
                 else
                 {
                     Main.dust[i].scale -= 0.01f;
                 }
                 if (Main.dust[i].noGravity)
                 {
                     Dust expr_1D31 = Main.dust[i];
                     expr_1D31.velocity *= 0.92f;
                     if (Main.dust[i].fadeIn == 0f)
                     {
                         Main.dust[i].scale -= 0.04f;
                     }
                 }
                 if (Main.dust[i].position.Y > Main.screenPosition.Y + (float)Main.screenHeight)
                 {
                     Main.dust[i].active = false;
                 }
                 if ((double)Main.dust[i].scale < 0.1)
                 {
                     Main.dust[i].active = false;
                 }
             }
         }
         else
         {
             Main.dust[i].active = false;
         }
     }
 }
Beispiel #4
0
        public unsafe void UpdateDust()
        {
            lavaBubbles = 0;
            snowDust    = 0;
            Vector3 rgb = default(Vector3);

            try
            {
                fixed(Dust *ptr = dust)
                {
                    Dust *ptr2 = ptr;

                    for (int num = size - 1; num >= 0; ptr2++, num--)
                    {
                        if (ptr2->active == 0)
                        {
                            continue;
                        }
                        int   type = ptr2->type;
                        float num2 = ptr2->scale;
                        ptr2->position.X += ptr2->velocity.X;
                        ptr2->position.Y += ptr2->velocity.Y;
                        int num3 = (int)ptr2->position.X;
                        int num4 = (int)ptr2->position.Y;
                        switch (type)
                        {
                        case 6:
                        case 29:
                        case 59:
                        case 60:
                        case 61:
                        case 62:
                        case 63:
                        case 64:
                        case 65:
                        case 75:
                            if (!ptr2->noLight)
                            {
                                if (ClipDust(num3, num4))
                                {
                                    ptr2->active = 0;
                                    continue;
                                }
                                num2 *= 1.4f;
                                switch (type)
                                {
                                case 6:
                                    if (num2 > 0.6f)
                                    {
                                        num2 = 0.6f;
                                    }
                                    rgb.X = num2;
                                    rgb.Y = num2 * 0.65f;
                                    rgb.Z = num2 * 0.4f;
                                    break;

                                case 29:
                                    if (num2 > 1f)
                                    {
                                        num2 = 1f;
                                    }
                                    rgb.X = num2 * 0.1f;
                                    rgb.Y = num2 * 0.4f;
                                    rgb.Z = num2;
                                    break;

                                case 59:
                                    if (num2 > 0.8f)
                                    {
                                        num2 = 0.8f;
                                    }
                                    rgb.X = 0f;
                                    rgb.Y = num2 * 0.1f;
                                    rgb.Z = num2 * 1.3f;
                                    break;

                                case 60:
                                    if (num2 > 0.8f)
                                    {
                                        num2 = 0.8f;
                                    }
                                    rgb.X = num2;
                                    rgb.Y = (rgb.Z = num2 * 0.1f);
                                    break;

                                case 61:
                                    if (num2 > 0.8f)
                                    {
                                        num2 = 0.8f;
                                    }
                                    rgb.X = 0f;
                                    rgb.Y = num2;
                                    rgb.Z = num2 * 0.1f;
                                    break;

                                case 62:
                                    if (num2 > 0.8f)
                                    {
                                        num2 = 0.8f;
                                    }
                                    rgb.X = (rgb.Z = num2 * 0.9f);
                                    rgb.Y = 0f;
                                    break;

                                default:
                                    if (num2 > 0.8f)
                                    {
                                        num2 = 0.8f;
                                    }
                                    rgb.X = (rgb.Y = (rgb.Z = num2 * 1.3f));
                                    break;

                                case 64:
                                    if (num2 > 0.8f)
                                    {
                                        num2 = 0.8f;
                                    }
                                    rgb.X = (rgb.Y = num2 * 0.9f);
                                    rgb.Z = 0f;
                                    break;

                                case 65:
                                    if (num2 > 0.8f)
                                    {
                                        num2 = 0.8f;
                                    }
                                    rgb.X = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch);
                                    rgb.Y = 0.3f;
                                    rgb.Z = Main.demonTorch + 0.5f * (1f - Main.demonTorch);
                                    break;

                                case 75:
                                    if (num2 > 1f)
                                    {
                                        num2 = 1f;
                                    }
                                    rgb.X = num2 * 0.7f;
                                    rgb.Y = num2;
                                    rgb.Z = num2 * 0.2f;
                                    break;
                                }
                                Lighting.addLight(num3 >> 4, num4 >> 4, rgb);
                            }
                            if (!ptr2->noGravity)
                            {
                                ptr2->velocity.Y += 0.05f;
                            }
                            break;

                        default:
                            switch (type)
                            {
                            case 14:
                            case 16:
                            case 46:
                                ptr2->velocity.X *= 0.98f;
                                ptr2->velocity.Y *= 0.98f;
                                break;

                            case 31:
                                ptr2->velocity.X *= 0.98f;
                                ptr2->velocity.Y *= 0.98f;
                                if (ptr2->noGravity)
                                {
                                    ptr2->alpha += 4;
                                    if (ptr2->alpha > 255)
                                    {
                                        ptr2->active = 0;
                                        continue;
                                    }
                                    ptr2->velocity.X *= 1.02f;
                                    ptr2->velocity.Y *= 1.02f;
                                    ptr2->scale      += 0.02f;
                                }
                                break;

                            case 32:
                                ptr2->scale      -= 0.01f;
                                ptr2->velocity.X *= 0.96f;
                                ptr2->velocity.Y += 0.1f;
                                break;

                            case 43:
                                ptr2->rotation += 0.1f * ptr2->scale;
                                if (!(num2 > 0.048f))
                                {
                                    ptr2->active = 0;
                                    continue;
                                }
                                rgb.X = (rgb.Y = (rgb.Z = num2 * 1.01055562f));
                                Lighting.addLight(num3 >> 4, num4 >> 4, rgb);
                                if (ptr2->alpha < 255)
                                {
                                    ptr2->scale += 0.09f;
                                    if (ptr2->scale >= 1f)
                                    {
                                        ptr2->scale = 1f;
                                        ptr2->alpha = 255;
                                    }
                                }
                                else if (ptr2->scale < 0.5f)
                                {
                                    ptr2->scale -= 0.02f;
                                }
                                else if (ptr2->scale < 0.8f)
                                {
                                    ptr2->scale -= 0.01f;
                                }
                                break;

                            case 15:
                            case 57:
                            case 58:
                                ptr2->velocity.X *= 0.98f;
                                ptr2->velocity.Y *= 0.98f;
                                if (type != 15)
                                {
                                    num2 *= 0.8f;
                                }
                                if (ptr2->noLight)
                                {
                                    ptr2->velocity.X *= 0.95f;
                                    ptr2->velocity.Y *= 0.95f;
                                }
                                if (num2 > 1f)
                                {
                                    num2 = 1f;
                                }
                                switch (type)
                                {
                                case 15:
                                    Lighting.addLight(num3 >> 4, num4 >> 4, new Vector3(num2 * 0.45f, num2 * 0.55f, num2));
                                    break;

                                case 57:
                                    Lighting.addLight(num3 >> 4, num4 >> 4, new Vector3(num2 * 0.95f, num2 * 0.95f, num2 * 0.45f));
                                    break;

                                case 58:
                                    Lighting.addLight(num3 >> 4, num4 >> 4, new Vector3(num2, num2 * 0.55f, num2 * 0.75f));
                                    break;
                                }
                                break;

                            case 66:
                                if (ptr2->velocity.X < 0f)
                                {
                                    ptr2->rotation -= 1f;
                                }
                                else
                                {
                                    ptr2->rotation += 1f;
                                }
                                ptr2->velocity.X *= 0.98f;
                                ptr2->velocity.Y *= 0.98f;
                                ptr2->scale      += 0.02f;
                                num2             *= 0.00313725485f;
                                if (num2 > 0.003921569f)
                                {
                                    num2 = 0.003921569f;
                                }
                                rgb.X = num2 * (float)(int)ptr2->color.R;
                                rgb.Y = num2 * (float)(int)ptr2->color.G;
                                rgb.Z = num2 * (float)(int)ptr2->color.B;
                                Lighting.addLight(num3 >> 4, num4 >> 4, rgb);
                                break;

                            case 20:
                            case 21:
                                ptr2->scale      += 0.005f;
                                ptr2->velocity.X *= 0.94f;
                                ptr2->velocity.Y *= 0.94f;
                                if (type == 21)
                                {
                                    num2 *= 0.4f;
                                    rgb.X = num2 * 0.8f;
                                    rgb.Y = num2 * 0.3f;
                                }
                                else
                                {
                                    num2 *= 0.8f;
                                    if (num2 > 1f)
                                    {
                                        num2 = 1f;
                                    }
                                    rgb.X = num2 * 0.3f;
                                    rgb.Y = num2 * 0.6f;
                                }
                                rgb.Z = num2;
                                Lighting.addLight(num3 >> 4, num4 >> 4, rgb);
                                break;

                            case 27:
                            case 45:
                                ptr2->velocity.X *= 0.94f;
                                ptr2->velocity.Y *= 0.94f;
                                ptr2->scale      += 0.002f;
                                if (ptr2->noLight)
                                {
                                    num2        *= 0.1f;
                                    ptr2->scale -= 0.06f;
                                    if (ptr2->scale < 1f)
                                    {
                                        ptr2->scale -= 0.06f;
                                    }
                                    if (view != null)
                                    {
                                        if (view.player.wet)
                                        {
                                            ptr2->position.X += view.player.velocity.X * 0.5f;
                                            ptr2->position.Y += view.player.velocity.Y * 0.5f;
                                        }
                                        else
                                        {
                                            ptr2->position.X += view.player.velocity.X;
                                            ptr2->position.Y += view.player.velocity.Y;
                                        }
                                    }
                                }
                                if (num2 > 1f)
                                {
                                    num2 = 1f;
                                }
                                Lighting.addLight((int)ptr2->position.X >> 4, (int)ptr2->position.Y >> 4, new Vector3(num2 * 0.6f, num2 * 0.2f, num2));
                                break;

                            case 55:
                            case 56:
                            case 73:
                            case 74:
                                ptr2->velocity.X *= 0.98f;
                                ptr2->velocity.Y *= 0.98f;
                                switch (type)
                                {
                                case 55:
                                    num2 *= 0.8f;
                                    if (num2 > 1f)
                                    {
                                        num2 = 1f;
                                    }
                                    rgb = new Vector3(num2, num2, num2 * 0.6f);
                                    break;

                                case 73:
                                    num2 *= 0.8f;
                                    if (num2 > 1f)
                                    {
                                        num2 = 1f;
                                    }
                                    rgb = new Vector3(num2, num2 * 0.35f, num2 * 0.5f);
                                    break;

                                case 74:
                                    num2 *= 0.8f;
                                    if (num2 > 1f)
                                    {
                                        num2 = 1f;
                                    }
                                    rgb = new Vector3(num2 * 0.35f, num2, num2 * 0.5f);
                                    break;

                                default:
                                    num2 *= 1.2f;
                                    if (num2 > 1f)
                                    {
                                        num2 = 1f;
                                    }
                                    rgb = new Vector3(num2 * 0.35f, num2 * 0.5f, num2);
                                    break;
                                }
                                Lighting.addLight(num3 >> 4, num4 >> 4, rgb);
                                break;

                            case 71:
                            case 72:
                                ptr2->velocity.X *= 0.98f;
                                ptr2->velocity.Y *= 0.98f;
                                if (num2 > 1f)
                                {
                                    num2 = 1f;
                                }
                                Lighting.addLight(num3 >> 4, num4 >> 4, new Vector3(num2 * 0.2f, 0f, num2 * 0.1f));
                                break;

                            case 76:
                                snowDust++;
                                ptr2->scale += 0.009f;
                                if (view != null)
                                {
                                    if (Collision.SolidCollision(ref ptr2->position, 1, 1))
                                    {
                                        ptr2->active = 0;
                                        continue;
                                    }
                                    ptr2->position.X += view.player.velocity.X * 0.2f;
                                    ptr2->position.Y += view.player.velocity.Y * 0.2f;
                                }
                                break;

                            default:
                                if (!ptr2->noGravity)
                                {
                                    if (type != 41 && type != 44)
                                    {
                                        ptr2->velocity.Y += 0.1f;
                                    }
                                }
                                else if (type == 5)
                                {
                                    ptr2->scale -= 0.04f;
                                }
                                break;
                            }
                            break;
                        }
                        if (type == 33 || type == 52)
                        {
                            if (ptr2->velocity.X == 0f)
                            {
                                if (Collision.SolidCollision(ref ptr2->position, 2, 2))
                                {
                                    ptr2->active = 0;
                                    continue;
                                }
                                ptr2->rotation += 0.5f;
                                ptr2->scale    -= 0.01f;
                            }
                            if (Collision.WetCollision(ref ptr2->position, 4, 4))
                            {
                                ptr2->scale -= 0.105f;
                                ptr2->alpha += 22;
                            }
                            else
                            {
                                ptr2->scale -= 0.005f;
                                ptr2->alpha += 2;
                            }
                            if (ptr2->alpha > 255)
                            {
                                ptr2->active = 0;
                                continue;
                            }
                            ptr2->velocity.X *= 0.93f;
                            if (ptr2->velocity.Y > 4f)
                            {
                                ptr2->velocity.Y = 4f;
                            }
                            if (ptr2->noGravity)
                            {
                                if (ptr2->velocity.X < 0f)
                                {
                                    ptr2->rotation -= 0.2f;
                                }
                                else
                                {
                                    ptr2->rotation += 0.2f;
                                }
                                ptr2->scale      += 0.03f;
                                ptr2->velocity.X *= 1.05f;
                                ptr2->velocity.Y += 0.15f;
                            }
                        }
                        else if (type == 67)
                        {
                            if (num2 > 1f)
                            {
                                num2 = 1f;
                            }
                            Lighting.addLight(num3 >> 4, num4 >> 4, new Vector3(0f, num2 * 0.8f, num2));
                        }
                        else if (type == 34 || type == 35)
                        {
                            if (type == 35)
                            {
                                lavaBubbles++;
                                if (ptr2->noGravity)
                                {
                                    ptr2->scale += 0.03f;
                                    if (ptr2->scale < 1f)
                                    {
                                        ptr2->velocity.Y += 0.075f;
                                    }
                                    ptr2->velocity.X *= 1.08f;
                                    if (ptr2->velocity.X > 0f)
                                    {
                                        ptr2->rotation += 0.01f;
                                    }
                                    else
                                    {
                                        ptr2->rotation -= 0.01f;
                                    }
                                    ptr2->velocity.X *= 0.99f;
                                    num2              = num2 * 0.6f + 0.018f;
                                    if (num2 > 1f)
                                    {
                                        num2 = 1f;
                                    }
                                    rgb.X = num2;
                                    rgb.Y = num2 * 0.3f;
                                    rgb.Z = num2 * 0.1f;
                                    Lighting.addLight(num3 >> 4, (num4 >> 4) + 1, rgb);
                                    goto IL_152a;
                                }
                                num2 = num2 * 0.3f + 0.4f;
                                if (num2 > 1f)
                                {
                                    num2 = 1f;
                                }
                                rgb.X = num2;
                                rgb.Y = num2 * 0.5f;
                                rgb.Z = num2 * 0.3f;
                                Lighting.addLight(num3 >> 4, num4 >> 4, rgb);
                                ptr2->scale     -= 0.01f;
                                ptr2->velocity.Y = -0.2f;
                                ptr2->alpha     += (short)Main.rand.Next(2);
                            }
                            else
                            {
                                ptr2->scale     += 0.005f;
                                ptr2->velocity.Y = -0.5f;
                            }
                            if (++ptr2->alpha > 255)
                            {
                                ptr2->active = 0;
                                continue;
                            }
                            ptr2->position.Y -= 8f;
                            if (!Collision.WetCollision(ref ptr2->position, 4, 4))
                            {
                                ptr2->active = 0;
                                continue;
                            }
                            ptr2->position.Y += 8f;
                            ptr2->velocity.X += (float)Main.rand.Next(-10, 10) * 0.002f;
                            if (ptr2->velocity.X < -0.25f)
                            {
                                ptr2->velocity.X = -0.25f;
                            }
                            else if (ptr2->velocity.X > 0.25f)
                            {
                                ptr2->velocity.X = 0.25f;
                            }
                        }
                        else
                        {
                            switch (type)
                            {
                            case 68:
                                num2 *= 0.3f;
                                if (num2 > 1f)
                                {
                                    num2 = 1f;
                                }
                                Lighting.addLight(num3 >> 4, num4 >> 4, new Vector3(num2 * 0.1f, num2 * 0.2f, num2));
                                break;

                            case 70:
                                num2 *= 0.3f;
                                if (num2 > 1f)
                                {
                                    num2 = 1f;
                                }
                                Lighting.addLight(num3 >> 4, num4 >> 4, new Vector3(num2 * 0.5f, 0f, num2));
                                break;
                            }
                        }
                        switch (type)
                        {
                        case 41:
                            ptr2->velocity.X += (float)Main.rand.Next(-10, 11) * 0.01f;
                            ptr2->velocity.Y += (float)Main.rand.Next(-10, 11) * 0.01f;
                            if (ptr2->velocity.X > 0.75f)
                            {
                                ptr2->velocity.X = 0.75f;
                            }
                            else if (ptr2->velocity.X < -0.75f)
                            {
                                ptr2->velocity.X = -0.75f;
                            }
                            if (ptr2->velocity.Y > 0.75f)
                            {
                                ptr2->velocity.Y = 0.75f;
                            }
                            else if (ptr2->velocity.Y < -0.75f)
                            {
                                ptr2->velocity.Y = -0.75f;
                            }
                            ptr2->scale += 0.007f;
                            num2         = num2 * 0.7f + 0.0049f;
                            if (num2 > 1f)
                            {
                                num2 = 1f;
                            }
                            Lighting.addLight(num3 >> 4, num4 >> 4, new Vector3(num2 * 0.4f, num2 * 0.9f, num2));
                            break;

                        case 44:
                            ptr2->velocity.X += (float)Main.rand.Next(-10, 11) * 0.003f;
                            ptr2->velocity.Y += (float)Main.rand.Next(-10, 11) * 0.003f;
                            if (ptr2->velocity.X > 0.35f)
                            {
                                ptr2->velocity.X = 0.35f;
                            }
                            else if (ptr2->velocity.X < -0.35f)
                            {
                                ptr2->velocity.X = -0.35f;
                            }
                            if (ptr2->velocity.Y > 0.35f)
                            {
                                ptr2->velocity.Y = 0.35f;
                            }
                            else if (ptr2->velocity.Y < -0.35f)
                            {
                                ptr2->velocity.Y = -0.35f;
                            }
                            ptr2->scale += 0.0085f;
                            num2         = num2 * 0.7f + 0.00595f;
                            if (num2 > 1f)
                            {
                                num2 = 1f;
                            }
                            Lighting.addLight(num3 >> 4, num4 >> 4, new Vector3(num2 * 0.7f, num2, num2 * 0.8f));
                            break;

                        default:
                            ptr2->velocity.X *= 0.99f;
                            break;
                        }
                        goto IL_152a;
IL_152a:
                        if (ptr2->fadeIn > 0f)
                        {
                            if (type == 46)
                            {
                                ptr2->scale += 0.1f;
                            }
                            else
                            {
                                ptr2->scale += 0.03f;
                            }
                            if (ptr2->scale > ptr2->fadeIn)
                            {
                                ptr2->fadeIn = 0f;
                            }
                        }
                        else
                        {
                            ptr2->scale -= 0.01f;
                        }
                        if (ptr2->noGravity)
                        {
                            ptr2->velocity.X *= 0.92f;
                            ptr2->velocity.Y *= 0.92f;
                            if (ptr2->fadeIn == 0f)
                            {
                                ptr2->scale -= 0.04f;
                            }
                        }
                        if (ptr2->scale < 0.1f)
                        {
                            ptr2->active = 0;
                        }
                        else if (type != 79)
                        {
                            ptr2->rotation += ptr2->velocity.X * 0.5f;
                        }
                    }
                }
            }
            finally
            {
            }
        }
Beispiel #5
0
        private void DrawWaterfall(SpriteBatch spriteBatch, int Style = 0, float Alpha = 1f)
        {
            float num   = 0f;
            float num2  = 99999f;
            float num3  = 99999f;
            int   num4  = -1;
            int   num5  = -1;
            float num6  = 0f;
            float num7  = 99999f;
            float num8  = 99999f;
            int   num9  = -1;
            int   num10 = -1;
            int   i     = 0;

            while (i < this.currentMax)
            {
                int num11 = 0;
                int num12 = this.waterfalls[i].type;
                int num13 = this.waterfalls[i].x;
                int num14 = this.waterfalls[i].y;
                int num15 = 0;
                int num16 = 0;
                int num17 = 0;
                int num18 = 0;
                int num19 = 0;
                int num20 = 0;
                int num22;
                int num21;
                if (num12 == 1 || num12 == 14)
                {
                    if (!Main.drewLava && this.waterfalls[i].stopAtStep != 0)
                    {
                        num21 = 32 * this.slowFrame;
                        goto IL_3FA;
                    }
                }
                else
                {
                    if (num12 != 11)
                    {
                        if (num12 == 0)
                        {
                            num12 = Style;
                        }
                        else
                        {
                            if (num12 == 2 && Main.drewLava)
                            {
                                goto IL_1879;
                            }
                        }
                        num21 = 32 * this.regularFrame;
                        goto IL_3FA;
                    }
                    if (!Main.drewLava)
                    {
                        num22 = this.waterfallDist / 4;
                        if (this.waterfalls[i].stopAtStep > num22)
                        {
                            this.waterfalls[i].stopAtStep = num22;
                        }
                        if (this.waterfalls[i].stopAtStep != 0 && (float)(num14 + num22) >= Main.screenPosition.Y / 16f && (float)num13 >= Main.screenPosition.X / 16f - 1f && (float)num13 <= (Main.screenPosition.X + (float)Main.screenWidth) / 16f + 1f)
                        {
                            int num23;
                            int num24;
                            if (num13 % 2 == 0)
                            {
                                num23 = this.rainFrameForeground + 3;
                                if (num23 > 7)
                                {
                                    num23 -= 8;
                                }
                                num24 = this.rainFrameBackground + 2;
                                if (num24 > 7)
                                {
                                    num24 -= 8;
                                }
                            }
                            else
                            {
                                num23 = this.rainFrameForeground;
                                num24 = this.rainFrameBackground;
                            }
                            Rectangle value  = new Rectangle(num24 * 18, 0, 16, 16);
                            Rectangle value2 = new Rectangle(num23 * 18, 0, 16, 16);
                            Vector2   origin = new Vector2(8f, 8f);
                            Vector2   position;
                            if (num14 % 2 == 0)
                            {
                                position = new Vector2((float)(num13 * 16 + 9), (float)(num14 * 16 + 8)) - Main.screenPosition;
                            }
                            else
                            {
                                position = new Vector2((float)(num13 * 16 + 8), (float)(num14 * 16 + 8)) - Main.screenPosition;
                            }
                            bool flag = false;
                            for (int j = 0; j < num22; j++)
                            {
                                Color color = Lighting.GetColor(num13, num14);
                                float num25 = 0.6f;
                                float num26 = 0.3f;
                                if (j > num22 - 8)
                                {
                                    float num27 = (float)(num22 - j) / 8f;
                                    num25 *= num27;
                                    num26 *= num27;
                                }
                                Color color2 = color * num25;
                                Color color3 = color * num26;
                                spriteBatch.Draw(this.waterfallTexture[12], position, new Rectangle?(value), color3, 0f, origin, 1f, SpriteEffects.None, 0f);
                                spriteBatch.Draw(this.waterfallTexture[11], position, new Rectangle?(value2), color2, 0f, origin, 1f, SpriteEffects.None, 0f);
                                if (flag)
                                {
                                    break;
                                }
                                num14++;
                                Tile tile = Main.tile[num13, num14];
                                if (WorldGen.SolidTile(tile))
                                {
                                    flag = true;
                                }
                                if (tile.liquid > 0)
                                {
                                    int num28 = (int)(16f * ((float)tile.liquid / 255f)) & 254;
                                    if (num28 >= 15)
                                    {
                                        break;
                                    }
                                    value2.Height -= num28;
                                    value.Height  -= num28;
                                }
                                if (num14 % 2 == 0)
                                {
                                    position.X += 1f;
                                }
                                else
                                {
                                    position.X -= 1f;
                                }
                                position.Y += 16f;
                            }
                            this.waterfalls[i].stopAtStep = 0;
                        }
                    }
                }
IL_1879:
                i++;
                continue;
IL_3FA:
                int num29 = 0;
                num22     = this.waterfallDist;
                Color color4 = Color.White;
                for (int k = 0; k < num22; k++)
                {
                    if (num29 < 2)
                    {
                        int num30 = num12;
                        switch (num30)
                        {
                        case 1:
                        {
                            float num31 = 0.55f;
                            num31 += (float)(270 - (int)Main.mouseTextColor) / 900f;
                            num31 *= 0.4f;
                            float num32 = num31;
                            float num33 = num31 * 0.3f;
                            float num34 = num31 * 0.1f;
                            Lighting.addLight(num13, num14, num32, num33, num34);
                            break;
                        }

                        case 2:
                        {
                            float num32 = (float)Main.DiscoR / 255f;
                            float num33 = (float)Main.DiscoG / 255f;
                            float num34 = (float)Main.DiscoB / 255f;
                            num32 *= 0.2f;
                            num33 *= 0.2f;
                            num34 *= 0.2f;
                            Lighting.addLight(num13, num14, num32, num33, num34);
                            break;
                        }

                        default:
                            switch (num30)
                            {
                            case 15:
                            {
                                float num32 = 0f;
                                float num33 = 0f;
                                float num34 = 0.2f;
                                Lighting.addLight(num13, num14, num32, num33, num34);
                                break;
                            }

                            case 16:
                            {
                                float num32 = 0f;
                                float num33 = 0.2f;
                                float num34 = 0f;
                                Lighting.addLight(num13, num14, num32, num33, num34);
                                break;
                            }

                            case 17:
                            {
                                float num32 = 0f;
                                float num33 = 0f;
                                float num34 = 0.2f;
                                Lighting.addLight(num13, num14, num32, num33, num34);
                                break;
                            }

                            case 18:
                            {
                                float num32 = 0f;
                                float num33 = 0.2f;
                                float num34 = 0f;
                                Lighting.addLight(num13, num14, num32, num33, num34);
                                break;
                            }

                            case 19:
                            {
                                float num32 = 0.2f;
                                float num33 = 0f;
                                float num34 = 0f;
                                Lighting.addLight(num13, num14, num32, num33, num34);
                                break;
                            }

                            case 20:
                                Lighting.addLight(num13, num14, 0.2f, 0.2f, 0.2f);
                                break;

                            case 21:
                            {
                                float num32 = 0.2f;
                                float num33 = 0f;
                                float num34 = 0f;
                                Lighting.addLight(num13, num14, num32, num33, num34);
                                break;
                            }
                            }
                            break;
                        }
                        Tile tile2 = Main.tile[num13, num14];
                        if (tile2 == null)
                        {
                            tile2 = new Tile();
                            Main.tile[num13, num14] = tile2;
                        }
                        Tile tile3 = Main.tile[num13 - 1, num14];
                        if (tile3 == null)
                        {
                            tile3 = new Tile();
                            Main.tile[num13 - 1, num14] = tile3;
                        }
                        Tile tile4 = Main.tile[num13, num14 + 1];
                        if (tile4 == null)
                        {
                            tile4 = new Tile();
                            Main.tile[num13, num14 + 1] = tile4;
                        }
                        Tile tile5 = Main.tile[num13 + 1, num14];
                        if (tile5 == null)
                        {
                            tile5 = new Tile();
                            Main.tile[num13 + 1, num14] = tile5;
                        }
                        int num35 = (int)(tile2.liquid / 16);
                        int num36 = 0;
                        int num37 = num18;
                        int num38;
                        int num39;
                        if (tile4.topSlope())
                        {
                            if (tile4.slope() == 1)
                            {
                                num36 = 1;
                                num38 = 1;
                                num17 = 1;
                                num18 = num17;
                            }
                            else
                            {
                                num36 = -1;
                                num38 = -1;
                                num17 = -1;
                                num18 = num17;
                            }
                            num39 = 1;
                        }
                        else
                        {
                            if ((((!WorldGen.SolidTile(tile4) && !tile4.bottomSlope()) || tile4.type == 162) && !tile2.halfBrick()) || (!tile4.active() && !tile2.halfBrick()))
                            {
                                num29 = 0;
                                num39 = 1;
                                num38 = 0;
                            }
                            else
                            {
                                if ((WorldGen.SolidTile(tile3) || tile3.topSlope() || tile3.liquid > 0) && !WorldGen.SolidTile(tile5) && tile5.liquid == 0)
                                {
                                    if (num17 == -1)
                                    {
                                        num29++;
                                    }
                                    num38 = 1;
                                    num39 = 0;
                                    num17 = 1;
                                }
                                else
                                {
                                    if ((WorldGen.SolidTile(tile5) || tile5.topSlope() || tile5.liquid > 0) && !WorldGen.SolidTile(tile3) && tile3.liquid == 0)
                                    {
                                        if (num17 == 1)
                                        {
                                            num29++;
                                        }
                                        num38 = -1;
                                        num39 = 0;
                                        num17 = -1;
                                    }
                                    else
                                    {
                                        if (((!WorldGen.SolidTile(tile5) && !tile2.topSlope()) || tile5.liquid == 0) && !WorldGen.SolidTile(tile3) && !tile2.topSlope() && tile3.liquid == 0)
                                        {
                                            num39 = 0;
                                            num38 = num17;
                                        }
                                        else
                                        {
                                            num29++;
                                            num39 = 0;
                                            num38 = 0;
                                        }
                                    }
                                }
                            }
                        }
                        if (num29 >= 2)
                        {
                            num17 *= -1;
                            num38 *= -1;
                        }
                        int num40 = -1;
                        if (num12 != 1 && num12 != 14)
                        {
                            if (tile4.active())
                            {
                                num40 = (int)tile4.type;
                            }
                            if (tile2.active())
                            {
                                num40 = (int)tile2.type;
                            }
                        }
                        if (num40 != -1)
                        {
                            if (num40 == 160)
                            {
                                num12 = 2;
                            }
                            else
                            {
                                if (num40 >= 262 && num40 <= 268)
                                {
                                    num12 = 15 + num40 - 262;
                                }
                            }
                        }
                        if (WorldGen.SolidTile(tile4) && !tile2.halfBrick())
                        {
                            num11 = 8;
                        }
                        else
                        {
                            if (num16 != 0)
                            {
                                num11 = 0;
                            }
                        }
                        Color color5 = Lighting.GetColor(num13, num14);
                        Color color6 = color5;
                        float num41;
                        if (num12 == 1)
                        {
                            num41 = 1f;
                        }
                        else
                        {
                            if (num12 == 14)
                            {
                                num41 = 0.8f;
                            }
                            else
                            {
                                if (tile2.wall == 0 && (double)num14 < Main.worldSurface)
                                {
                                    num41 = Alpha;
                                }
                                else
                                {
                                    num41 = 0.6f * Alpha;
                                }
                            }
                        }
                        if (k > num22 - 10)
                        {
                            num41 *= (float)(num22 - k) / 10f;
                        }
                        float num42 = (float)color5.R * num41;
                        float num43 = (float)color5.G * num41;
                        float num44 = (float)color5.B * num41;
                        float num45 = (float)color5.A * num41;
                        if (num12 == 1)
                        {
                            if (num42 < 190f * num41)
                            {
                                num42 = 190f * num41;
                            }
                            if (num43 < 190f * num41)
                            {
                                num43 = 190f * num41;
                            }
                            if (num44 < 190f * num41)
                            {
                                num44 = 190f * num41;
                            }
                        }
                        else
                        {
                            if (num12 == 2)
                            {
                                num42 = (float)Main.DiscoR * num41;
                                num43 = (float)Main.DiscoG * num41;
                                num44 = (float)Main.DiscoB * num41;
                            }
                            else
                            {
                                if (num12 >= 15 && num12 <= 21)
                                {
                                    num42 = 255f * num41;
                                    num43 = 255f * num41;
                                    num44 = 255f * num41;
                                }
                            }
                        }
                        color5 = new Color((int)num42, (int)num43, (int)num44, (int)num45);
                        if (num12 == 1)
                        {
                            float num46 = Math.Abs((float)(num13 * 16 + 8) - (Main.screenPosition.X + (float)(Main.screenWidth / 2)));
                            float num47 = Math.Abs((float)(num14 * 16 + 8) - (Main.screenPosition.Y + (float)(Main.screenHeight / 2)));
                            if (num46 < (float)(Main.screenWidth * 2) && num47 < (float)(Main.screenHeight * 2))
                            {
                                float num48 = (float)Math.Sqrt((double)(num46 * num46 + num47 * num47));
                                float num49 = 1f - num48 / ((float)Main.screenWidth * 0.75f);
                                if (num49 > 0f)
                                {
                                    num6 += num49;
                                }
                            }
                            if (num46 < num7)
                            {
                                num7 = num46;
                                num9 = num13 * 16 + 8;
                            }
                            if (num47 < num8)
                            {
                                num8  = num46;
                                num10 = num14 * 16 + 8;
                            }
                        }
                        else
                        {
                            if (num12 != 1 && num12 != 14 && num12 != 11 && num12 != 12)
                            {
                                float num50 = Math.Abs((float)(num13 * 16 + 8) - (Main.screenPosition.X + (float)(Main.screenWidth / 2)));
                                float num51 = Math.Abs((float)(num14 * 16 + 8) - (Main.screenPosition.Y + (float)(Main.screenHeight / 2)));
                                if (num50 < (float)(Main.screenWidth * 2) && num51 < (float)(Main.screenHeight * 2))
                                {
                                    float num52 = (float)Math.Sqrt((double)(num50 * num50 + num51 * num51));
                                    float num53 = 1f - num52 / ((float)Main.screenWidth * 0.75f);
                                    if (num53 > 0f)
                                    {
                                        num += num53;
                                    }
                                }
                                if (num50 < num2)
                                {
                                    num2 = num50;
                                    num4 = num13 * 16 + 8;
                                }
                                if (num51 < num3)
                                {
                                    num3 = num50;
                                    num5 = num14 * 16 + 8;
                                }
                            }
                        }
                        if (k > 50 && (color6.R > 20 || color6.B > 20 || color6.G > 20))
                        {
                            float num54 = (float)color6.R;
                            if ((float)color6.G > num54)
                            {
                                num54 = (float)color6.G;
                            }
                            if ((float)color6.B > num54)
                            {
                                num54 = (float)color6.B;
                            }
                            if ((float)Main.rand.Next(20000) < num54 / 30f)
                            {
                                int num55 = Dust.NewDust(new Vector2((float)(num13 * 16 - num17 * 7), (float)(num14 * 16 + 6)), 10, 8, 43, 0f, 0f, 254, Color.White, 0.5f);
                                Main.dust[num55].velocity *= 0f;
                            }
                        }
                        if (num15 == 0 && num36 != 0 && num16 == 1 && num17 != num18)
                        {
                            num36  = 0;
                            num17  = num18;
                            color5 = Color.White;
                            if (num17 == 1)
                            {
                                spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16 - 16), (float)(num14 * 16 + 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 16 - num35)), color5, 0f, Vector2.Zero, 1f, SpriteEffects.FlipHorizontally, 0f);
                            }
                            else
                            {
                                spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16 - 16), (float)(num14 * 16 + 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 8)), color5, 0f, Vector2.Zero, 1f, SpriteEffects.FlipHorizontally, 0f);
                            }
                        }
                        if (num19 != 0 && num38 == 0 && num39 == 1)
                        {
                            if (num17 == 1)
                            {
                                if (num20 != num12)
                                {
                                    spriteBatch.Draw(this.waterfallTexture[num20], new Vector2((float)(num13 * 16), (float)(num14 * 16 + num11 + 8)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 0, 16, 16 - num35 - 8)), color4, 0f, Vector2.Zero, 1f, SpriteEffects.FlipHorizontally, 0f);
                                }
                                else
                                {
                                    spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16), (float)(num14 * 16 + num11 + 8)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 0, 16, 16 - num35 - 8)), color5, 0f, Vector2.Zero, 1f, SpriteEffects.FlipHorizontally, 0f);
                                }
                            }
                            else
                            {
                                spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16), (float)(num14 * 16 + num11 + 8)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 0, 16, 16 - num35 - 8)), color5, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
                            }
                        }
                        if (num11 == 8 && num16 == 1 && num19 == 0)
                        {
                            if (num18 == -1)
                            {
                                if (num20 != num12)
                                {
                                    spriteBatch.Draw(this.waterfallTexture[num20], new Vector2((float)(num13 * 16), (float)(num14 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 8)), color4, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
                                }
                                else
                                {
                                    spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16), (float)(num14 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 8)), color5, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
                                }
                            }
                            else
                            {
                                if (num20 != num12)
                                {
                                    spriteBatch.Draw(this.waterfallTexture[num20], new Vector2((float)(num13 * 16 - 16), (float)(num14 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 8)), color4, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f);
                                }
                                else
                                {
                                    spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16 - 16), (float)(num14 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 8)), color5, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f);
                                }
                            }
                        }
                        if (num36 != 0 && num15 == 0)
                        {
                            if (num37 == 1)
                            {
                                if (num20 != num12)
                                {
                                    spriteBatch.Draw(this.waterfallTexture[num20], new Vector2((float)(num13 * 16 - 16), (float)(num14 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 16 - num35)), color4, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f);
                                }
                                else
                                {
                                    spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16 - 16), (float)(num14 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 16 - num35)), color5, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f);
                                }
                            }
                            else
                            {
                                if (num20 != num12)
                                {
                                    spriteBatch.Draw(this.waterfallTexture[num20], new Vector2((float)(num13 * 16), (float)(num14 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 16 - num35)), color4, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
                                }
                                else
                                {
                                    spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16), (float)(num14 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 16 - num35)), color5, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
                                }
                            }
                        }
                        if (num39 == 1 && num36 == 0 && num19 == 0)
                        {
                            if (num17 == -1)
                            {
                                if (num16 == 0)
                                {
                                    spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16), (float)(num14 * 16 + num11)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 0, 16, 16 - num35)), color5, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
                                }
                                else
                                {
                                    if (num20 != num12)
                                    {
                                        spriteBatch.Draw(this.waterfallTexture[num20], new Vector2((float)(num13 * 16), (float)(num14 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 16 - num35)), color4, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
                                    }
                                    else
                                    {
                                        spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16), (float)(num14 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 16 - num35)), color5, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
                                    }
                                }
                            }
                            else
                            {
                                if (num16 == 0)
                                {
                                    spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16), (float)(num14 * 16 + num11)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 0, 16, 16 - num35)), color5, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f);
                                }
                                else
                                {
                                    if (num20 != num12)
                                    {
                                        spriteBatch.Draw(this.waterfallTexture[num20], new Vector2((float)(num13 * 16 - 16), (float)(num14 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 16 - num35)), color4, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f);
                                    }
                                    else
                                    {
                                        spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16 - 16), (float)(num14 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num21, 24, 32, 16 - num35)), color5, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f);
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (num38 == 1)
                            {
                                if (Main.tile[num13, num14].liquid <= 0 || Main.tile[num13, num14].halfBrick())
                                {
                                    if (num36 == 1)
                                    {
                                        for (int l = 0; l < 8; l++)
                                        {
                                            int num56 = l * 2;
                                            int num57 = 14 - l * 2;
                                            int num58 = num56;
                                            num11 = 8;
                                            if (num15 == 0 && l < 2)
                                            {
                                                num58 = 4;
                                            }
                                            spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16 + num56), (float)(num14 * 16 + num11 + num58)) - Main.screenPosition, new Rectangle?(new Rectangle(16 + num21 + num57, 0, 2, 16 - num11)), color5, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f);
                                        }
                                    }
                                    else
                                    {
                                        spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16), (float)(num14 * 16 + num11)) - Main.screenPosition, new Rectangle?(new Rectangle(16 + num21, 0, 16, 16)), color5, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f);
                                    }
                                }
                            }
                            else
                            {
                                if (num38 == -1)
                                {
                                    if (Main.tile[num13, num14].liquid <= 0 || Main.tile[num13, num14].halfBrick())
                                    {
                                        if (num36 == -1)
                                        {
                                            for (int m = 0; m < 8; m++)
                                            {
                                                int num59 = m * 2;
                                                int num60 = m * 2;
                                                int num61 = 14 - m * 2;
                                                num11 = 8;
                                                if (num15 == 0 && m > 5)
                                                {
                                                    num61 = 4;
                                                }
                                                spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16 + num59), (float)(num14 * 16 + num11 + num61)) - Main.screenPosition, new Rectangle?(new Rectangle(16 + num21 + num60, 0, 2, 16 - num11)), color5, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f);
                                            }
                                        }
                                        else
                                        {
                                            spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16), (float)(num14 * 16 + num11)) - Main.screenPosition, new Rectangle?(new Rectangle(16 + num21, 0, 16, 16)), color5, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
                                        }
                                    }
                                }
                                else
                                {
                                    if (num38 == 0 && num39 == 0)
                                    {
                                        if (Main.tile[num13, num14].liquid <= 0 || Main.tile[num13, num14].halfBrick())
                                        {
                                            spriteBatch.Draw(this.waterfallTexture[num12], new Vector2((float)(num13 * 16), (float)(num14 * 16 + num11)) - Main.screenPosition, new Rectangle?(new Rectangle(16 + num21, 0, 16, 16)), color5, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
                                        }
                                        k = 1000;
                                    }
                                }
                            }
                        }
                        if (tile2.liquid > 0 && !tile2.halfBrick())
                        {
                            k = 1000;
                        }
                        num16  = num39;
                        num18  = num17;
                        num15  = num38;
                        num13 += num38;
                        num14 += num39;
                        num19  = num36;
                        color4 = color5;
                        if (num20 != num12)
                        {
                            num20 = num12;
                        }
                        if ((tile3.active() && (tile3.type == 189 || tile3.type == 196)) || (tile5.active() && (tile5.type == 189 || tile5.type == 196)) || (tile4.active() && (tile4.type == 189 || tile4.type == 196)))
                        {
                            num22 = (int)((float)(40 * (Main.maxTilesX / 4200)) * Main.gfxQuality);
                        }
                    }
                }
                goto IL_1879;
            }
            Main.ambientWaterfallX        = (float)num4;
            Main.ambientWaterfallY        = (float)num5;
            Main.ambientWaterfallStrength = num;
            Main.ambientLavafallX         = (float)num9;
            Main.ambientLavafallY         = (float)num10;
            Main.ambientLavafallStrength  = num6;
        }
Beispiel #6
0
 public void Update()
 {
     if (Main.netMode != 2)
     {
         if (this.active)
         {
             if (this.type == 11 || this.type == 12 || this.type == 13 || this.type == 61 || this.type == 62 || this.type == 63 || this.type == 99)
             {
                 this.velocity.Y = this.velocity.Y * 0.98f;
                 this.velocity.X = this.velocity.X * 0.98f;
                 this.scale     -= 0.007f;
                 if ((double)this.scale < 0.1)
                 {
                     this.scale = 0.1f;
                     this.alpha = 255;
                 }
             }
             else if (this.type == 16 || this.type == 17)
             {
                 this.velocity.Y = this.velocity.Y * 0.98f;
                 this.velocity.X = this.velocity.X * 0.98f;
                 this.scale     -= 0.01f;
                 if ((double)this.scale < 0.1)
                 {
                     this.scale = 0.1f;
                     this.alpha = 255;
                 }
             }
             else
             {
                 this.velocity.Y = this.velocity.Y + 0.2f;
             }
             this.rotation += this.velocity.X * 0.1f;
             if (this.sticky)
             {
                 int num = Main.goreTexture[this.type].Width;
                 if (Main.goreTexture[this.type].Height < num)
                 {
                     num = Main.goreTexture[this.type].Height;
                 }
                 num           = (int)((float)num * 0.9f);
                 this.velocity = Collision.TileCollision(this.position, this.velocity, (int)((float)num * this.scale), (int)((float)num * this.scale), false, false);
                 if (this.velocity.Y == 0f)
                 {
                     this.velocity.X = this.velocity.X * 0.97f;
                     if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01)
                     {
                         this.velocity.X = 0f;
                     }
                 }
                 if (this.timeLeft > 0)
                 {
                     this.timeLeft--;
                 }
                 else
                 {
                     this.alpha++;
                 }
             }
             else
             {
                 this.alpha += 2;
             }
             this.position += this.velocity;
             if (this.alpha >= 255)
             {
                 this.active = false;
             }
             if (this.light > 0f)
             {
                 float num2 = this.light * this.scale;
                 float num3 = this.light * this.scale;
                 float num4 = this.light * this.scale;
                 if (this.type == 16)
                 {
                     num4 *= 0.3f;
                     num3 *= 0.8f;
                 }
                 else if (this.type == 17)
                 {
                     num3 *= 0.6f;
                     num2 *= 0.3f;
                 }
                 Lighting.addLight((int)((this.position.X + (float)Main.goreTexture[this.type].Width * this.scale / 2f) / 16f), (int)((this.position.Y + (float)Main.goreTexture[this.type].Height * this.scale / 2f) / 16f), num2, num3, num4);
             }
         }
     }
 }
Beispiel #7
0
        public static void UpdateDust()
        {
            lavaBubbles   = 0;
            Main.snowDust = 0;
            for (int i = 0; i < 0x7d0; i++)
            {
                if (i < Main.numDust)
                {
                    if (!Main.dust[i].active)
                    {
                        continue;
                    }
                    if (Main.dust[i].type == 0x23)
                    {
                        lavaBubbles++;
                    }
                    Dust dust1 = Main.dust[i];
                    dust1.position += Main.dust[i].velocity;
                    if (((Main.dust[i].type == 6) || (Main.dust[i].type == 0x4b)) || ((Main.dust[i].type == 0x1d) || ((Main.dust[i].type >= 0x3b) && (Main.dust[i].type <= 0x41))))
                    {
                        if (!Main.dust[i].noGravity)
                        {
                            Main.dust[i].velocity.Y += 0.05f;
                        }
                        if (!Main.dust[i].noLight)
                        {
                            float b = Main.dust[i].scale * 1.4f;
                            if (Main.dust[i].type == 0x1d)
                            {
                                if (b > 1f)
                                {
                                    b = 1f;
                                }
                                Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), b * 0.1f, b * 0.4f, b);
                            }
                            if (Main.dust[i].type == 0x4b)
                            {
                                if (b > 1f)
                                {
                                    b = 1f;
                                }
                                Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), b * 0.7f, b, b * 0.2f);
                            }
                            else if ((Main.dust[i].type >= 0x3b) && (Main.dust[i].type <= 0x41))
                            {
                                if (b > 0.8f)
                                {
                                    b = 0.8f;
                                }
                                int   num3 = Main.dust[i].type - 0x3a;
                                float num4 = 1f;
                                float num5 = 1f;
                                float num6 = 1f;
                                switch (num3)
                                {
                                case 1:
                                    num4 = 0f;
                                    num5 = 0.1f;
                                    num6 = 1.3f;
                                    break;

                                case 2:
                                    num4 = 1f;
                                    num5 = 0.1f;
                                    num6 = 0.1f;
                                    break;

                                case 3:
                                    num4 = 0f;
                                    num5 = 1f;
                                    num6 = 0.1f;
                                    break;

                                case 4:
                                    num4 = 0.9f;
                                    num5 = 0f;
                                    num6 = 0.9f;
                                    break;

                                case 5:
                                    num4 = 1.3f;
                                    num5 = 1.3f;
                                    num6 = 1.3f;
                                    break;

                                case 6:
                                    num4 = 0.9f;
                                    num5 = 0.9f;
                                    num6 = 0f;
                                    break;

                                case 7:
                                    num4 = (0.5f * Main.demonTorch) + (1f * (1f - Main.demonTorch));
                                    num5 = 0.3f;
                                    num6 = (1f * Main.demonTorch) + (0.5f * (1f - Main.demonTorch));
                                    break;
                                }
                                Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), b * num4, b * num5, b * num6);
                            }
                            else
                            {
                                if (b > 0.6f)
                                {
                                    b = 0.6f;
                                }
                                Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), b, b * 0.65f, b * 0.4f);
                            }
                        }
                    }
                    else if (((Main.dust[i].type == 14) || (Main.dust[i].type == 0x10)) || ((Main.dust[i].type == 0x1f) || (Main.dust[i].type == 0x2e)))
                    {
                        Main.dust[i].velocity.Y *= 0.98f;
                        Main.dust[i].velocity.X *= 0.98f;
                        if ((Main.dust[i].type == 0x1f) && Main.dust[i].noGravity)
                        {
                            Dust dust2 = Main.dust[i];
                            dust2.velocity = (Vector2)(dust2.velocity * 1.02f);
                            Dust dust3 = Main.dust[i];
                            dust3.scale += 0.02f;
                            Dust dust4 = Main.dust[i];
                            dust4.alpha += 4;
                            if (Main.dust[i].alpha > 0xff)
                            {
                                Main.dust[i].scale = 0.0001f;
                                Main.dust[i].alpha = 0xff;
                            }
                        }
                    }
                    else if (Main.dust[i].type == 0x20)
                    {
                        Dust dust5 = Main.dust[i];
                        dust5.scale             -= 0.01f;
                        Main.dust[i].velocity.X *= 0.96f;
                        Main.dust[i].velocity.Y += 0.1f;
                    }
                    else if (Main.dust[i].type == 0x2b)
                    {
                        Dust dust6 = Main.dust[i];
                        dust6.rotation += 0.1f * Main.dust[i].scale;
                        Color color = Lighting.GetColor((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f));
                        float r     = ((float)color.R) / 270f;
                        float g     = ((float)color.G) / 270f;
                        float num9  = ((float)color.B) / 270f;
                        r    *= Main.dust[i].scale * 1.07f;
                        g    *= Main.dust[i].scale * 1.07f;
                        num9 *= Main.dust[i].scale * 1.07f;
                        if (Main.dust[i].alpha < 0xff)
                        {
                            Dust dust7 = Main.dust[i];
                            dust7.scale += 0.09f;
                            if (Main.dust[i].scale >= 1f)
                            {
                                Main.dust[i].scale = 1f;
                                Main.dust[i].alpha = 0xff;
                            }
                        }
                        else
                        {
                            if (Main.dust[i].scale < 0.8)
                            {
                                Dust dust8 = Main.dust[i];
                                dust8.scale -= 0.01f;
                            }
                            if (Main.dust[i].scale < 0.5)
                            {
                                Dust dust9 = Main.dust[i];
                                dust9.scale -= 0.01f;
                            }
                        }
                        if (((r < 0.05) && (g < 0.05)) && (num9 < 0.05))
                        {
                            Main.dust[i].active = false;
                        }
                        else
                        {
                            Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), r, g, num9);
                        }
                    }
                    else if (((Main.dust[i].type == 15) || (Main.dust[i].type == 0x39)) || (Main.dust[i].type == 0x3a))
                    {
                        Main.dust[i].velocity.Y *= 0.98f;
                        Main.dust[i].velocity.X *= 0.98f;
                        float scale = Main.dust[i].scale;
                        if (Main.dust[i].type != 15)
                        {
                            scale = Main.dust[i].scale * 0.8f;
                        }
                        if (Main.dust[i].noLight)
                        {
                            Dust dust10 = Main.dust[i];
                            dust10.velocity = (Vector2)(dust10.velocity * 0.95f);
                        }
                        if (scale > 1f)
                        {
                            scale = 1f;
                        }
                        if (Main.dust[i].type == 15)
                        {
                            Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), scale * 0.45f, scale * 0.55f, scale);
                        }
                        else if (Main.dust[i].type == 0x39)
                        {
                            Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), scale * 0.95f, scale * 0.95f, scale * 0.45f);
                        }
                        else if (Main.dust[i].type == 0x3a)
                        {
                            Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), scale, scale * 0.55f, scale * 0.75f);
                        }
                    }
                    else if (Main.dust[i].type == 0x42)
                    {
                        if (Main.dust[i].velocity.X < 0f)
                        {
                            Dust dust11 = Main.dust[i];
                            dust11.rotation--;
                        }
                        else
                        {
                            Dust dust12 = Main.dust[i];
                            dust12.rotation++;
                        }
                        Main.dust[i].velocity.Y *= 0.98f;
                        Main.dust[i].velocity.X *= 0.98f;
                        Dust dust13 = Main.dust[i];
                        dust13.scale += 0.02f;
                        float num11 = Main.dust[i].scale;
                        if (Main.dust[i].type != 15)
                        {
                            num11 = Main.dust[i].scale * 0.8f;
                        }
                        if (num11 > 1f)
                        {
                            num11 = 1f;
                        }
                        Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num11 * (((float)Main.dust[i].color.R) / 255f), num11 * (((float)Main.dust[i].color.G) / 255f), num11 * (((float)Main.dust[i].color.B) / 255f));
                    }
                    else if ((Main.dust[i].type == 20) || (Main.dust[i].type == 0x15))
                    {
                        Dust dust14 = Main.dust[i];
                        dust14.scale            += 0.005f;
                        Main.dust[i].velocity.Y *= 0.94f;
                        Main.dust[i].velocity.X *= 0.94f;
                        float num12 = Main.dust[i].scale * 0.8f;
                        if (num12 > 1f)
                        {
                            num12 = 1f;
                        }
                        if (Main.dust[i].type == 0x15)
                        {
                            num12 = Main.dust[i].scale * 0.4f;
                            Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num12 * 0.8f, num12 * 0.3f, num12);
                        }
                        else
                        {
                            Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num12 * 0.3f, num12 * 0.6f, num12);
                        }
                    }
                    else if ((Main.dust[i].type == 0x1b) || (Main.dust[i].type == 0x2d))
                    {
                        Dust dust15 = Main.dust[i];
                        dust15.velocity = (Vector2)(dust15.velocity * 0.94f);
                        Dust dust16 = Main.dust[i];
                        dust16.scale += 0.002f;
                        float num13 = Main.dust[i].scale;
                        if (Main.dust[i].noLight)
                        {
                            num13 *= 0.1f;
                            Dust dust17 = Main.dust[i];
                            dust17.scale -= 0.06f;
                            if (Main.dust[i].scale < 1f)
                            {
                                Dust dust18 = Main.dust[i];
                                dust18.scale -= 0.06f;
                            }
                            if (Main.player[Main.myPlayer].wet)
                            {
                                Dust dust19 = Main.dust[i];
                                dust19.position += (Vector2)(Main.player[Main.myPlayer].velocity * 0.5f);
                            }
                            else
                            {
                                Dust dust20 = Main.dust[i];
                                dust20.position += Main.player[Main.myPlayer].velocity;
                            }
                        }
                        if (num13 > 1f)
                        {
                            num13 = 1f;
                        }
                        Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num13 * 0.6f, num13 * 0.2f, num13);
                    }
                    else if (((Main.dust[i].type == 0x37) || (Main.dust[i].type == 0x38)) || ((Main.dust[i].type == 0x49) || (Main.dust[i].type == 0x4a)))
                    {
                        Dust dust21 = Main.dust[i];
                        dust21.velocity = (Vector2)(dust21.velocity * 0.98f);
                        float num14 = Main.dust[i].scale * 0.8f;
                        if (Main.dust[i].type == 0x37)
                        {
                            if (num14 > 1f)
                            {
                                num14 = 1f;
                            }
                            Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num14, num14, num14 * 0.6f);
                        }
                        else if (Main.dust[i].type == 0x49)
                        {
                            if (num14 > 1f)
                            {
                                num14 = 1f;
                            }
                            Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num14, num14 * 0.35f, num14 * 0.5f);
                        }
                        else if (Main.dust[i].type == 0x4a)
                        {
                            if (num14 > 1f)
                            {
                                num14 = 1f;
                            }
                            Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num14 * 0.35f, num14, num14 * 0.5f);
                        }
                        else
                        {
                            num14 = Main.dust[i].scale * 1.2f;
                            if (num14 > 1f)
                            {
                                num14 = 1f;
                            }
                            Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num14 * 0.35f, num14 * 0.5f, num14);
                        }
                    }
                    else if ((Main.dust[i].type == 0x47) || (Main.dust[i].type == 0x48))
                    {
                        Dust dust22 = Main.dust[i];
                        dust22.velocity = (Vector2)(dust22.velocity * 0.98f);
                        float num15 = Main.dust[i].scale;
                        if (num15 > 1f)
                        {
                            num15 = 1f;
                        }
                        Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num15 * 0.2f, 0f, num15 * 0.1f);
                    }
                    else if (Main.dust[i].type == 0x4c)
                    {
                        Main.snowDust++;
                        Dust dust23 = Main.dust[i];
                        dust23.scale += 0.009f;
                        Dust dust24 = Main.dust[i];
                        dust24.position += (Vector2)(Main.player[Main.myPlayer].velocity * 0.2f);
                    }
                    else if ((!Main.dust[i].noGravity && (Main.dust[i].type != 0x29)) && (Main.dust[i].type != 0x2c))
                    {
                        Main.dust[i].velocity.Y += 0.1f;
                    }
                    if ((Main.dust[i].type == 5) && Main.dust[i].noGravity)
                    {
                        Dust dust25 = Main.dust[i];
                        dust25.scale -= 0.04f;
                    }
                    if ((Main.dust[i].type == 0x21) || (Main.dust[i].type == 0x34))
                    {
                        if (Main.dust[i].velocity.X == 0f)
                        {
                            if (Collision.SolidCollision(Main.dust[i].position, 2, 2))
                            {
                                Main.dust[i].scale = 0f;
                            }
                            Dust dust26 = Main.dust[i];
                            dust26.rotation += 0.5f;
                            Dust dust27 = Main.dust[i];
                            dust27.scale -= 0.01f;
                        }
                        if (Collision.WetCollision(new Vector2(Main.dust[i].position.X, Main.dust[i].position.Y), 4, 4))
                        {
                            Dust dust28 = Main.dust[i];
                            dust28.alpha += 20;
                            Dust dust29 = Main.dust[i];
                            dust29.scale -= 0.1f;
                        }
                        Dust dust30 = Main.dust[i];
                        dust30.alpha += 2;
                        Dust dust31 = Main.dust[i];
                        dust31.scale -= 0.005f;
                        if (Main.dust[i].alpha > 0xff)
                        {
                            Main.dust[i].scale = 0f;
                        }
                        Main.dust[i].velocity.X *= 0.93f;
                        if (Main.dust[i].velocity.Y > 4f)
                        {
                            Main.dust[i].velocity.Y = 4f;
                        }
                        if (Main.dust[i].noGravity)
                        {
                            if (Main.dust[i].velocity.X < 0f)
                            {
                                Dust dust32 = Main.dust[i];
                                dust32.rotation -= 0.2f;
                            }
                            else
                            {
                                Dust dust33 = Main.dust[i];
                                dust33.rotation += 0.2f;
                            }
                            Dust dust34 = Main.dust[i];
                            dust34.scale            += 0.03f;
                            Main.dust[i].velocity.X *= 1.05f;
                            Main.dust[i].velocity.Y += 0.15f;
                        }
                    }
                    if ((Main.dust[i].type == 0x23) && Main.dust[i].noGravity)
                    {
                        Dust dust35 = Main.dust[i];
                        dust35.scale += 0.03f;
                        if (Main.dust[i].scale < 1f)
                        {
                            Main.dust[i].velocity.Y += 0.075f;
                        }
                        Main.dust[i].velocity.X *= 1.08f;
                        if (Main.dust[i].velocity.X > 0f)
                        {
                            Dust dust36 = Main.dust[i];
                            dust36.rotation += 0.01f;
                        }
                        else
                        {
                            Dust dust37 = Main.dust[i];
                            dust37.rotation -= 0.01f;
                        }
                        float num16 = Main.dust[i].scale * 0.6f;
                        if (num16 > 1f)
                        {
                            num16 = 1f;
                        }
                        Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)((Main.dust[i].position.Y / 16f) + 1f), num16, num16 * 0.3f, num16 * 0.1f);
                    }
                    else if (Main.dust[i].type == 0x43)
                    {
                        float num17 = Main.dust[i].scale;
                        if (num17 > 1f)
                        {
                            num17 = 1f;
                        }
                        Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), 0f, num17 * 0.8f, num17);
                    }
                    else if ((Main.dust[i].type == 0x22) || (Main.dust[i].type == 0x23))
                    {
                        if (!Collision.WetCollision(new Vector2(Main.dust[i].position.X, Main.dust[i].position.Y - 8f), 4, 4))
                        {
                            Main.dust[i].scale = 0f;
                        }
                        else
                        {
                            Dust dust38 = Main.dust[i];
                            dust38.alpha += Main.rand.Next(2);
                            if (Main.dust[i].alpha > 0xff)
                            {
                                Main.dust[i].scale = 0f;
                            }
                            Main.dust[i].velocity.Y = -0.5f;
                            if (Main.dust[i].type == 0x22)
                            {
                                Dust dust39 = Main.dust[i];
                                dust39.scale += 0.005f;
                            }
                            else
                            {
                                Dust dust40 = Main.dust[i];
                                dust40.alpha++;
                                Dust dust41 = Main.dust[i];
                                dust41.scale           -= 0.01f;
                                Main.dust[i].velocity.Y = -0.2f;
                            }
                            Main.dust[i].velocity.X += Main.rand.Next(-10, 10) * 0.002f;
                            if (Main.dust[i].velocity.X < -0.25)
                            {
                                Main.dust[i].velocity.X = -0.25f;
                            }
                            if (Main.dust[i].velocity.X > 0.25)
                            {
                                Main.dust[i].velocity.X = 0.25f;
                            }
                        }
                        if (Main.dust[i].type == 0x23)
                        {
                            float num18 = (Main.dust[i].scale * 0.3f) + 0.4f;
                            if (num18 > 1f)
                            {
                                num18 = 1f;
                            }
                            Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num18, num18 * 0.5f, num18 * 0.3f);
                        }
                    }
                    if (Main.dust[i].type == 0x44)
                    {
                        float num19 = Main.dust[i].scale * 0.3f;
                        if (num19 > 1f)
                        {
                            num19 = 1f;
                        }
                        Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num19 * 0.1f, num19 * 0.2f, num19);
                    }
                    if (Main.dust[i].type == 70)
                    {
                        float num20 = Main.dust[i].scale * 0.3f;
                        if (num20 > 1f)
                        {
                            num20 = 1f;
                        }
                        Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num20 * 0.5f, 0f, num20);
                    }
                    if (Main.dust[i].type == 0x29)
                    {
                        Main.dust[i].velocity.X += Main.rand.Next(-10, 11) * 0.01f;
                        Main.dust[i].velocity.Y += Main.rand.Next(-10, 11) * 0.01f;
                        if (Main.dust[i].velocity.X > 0.75)
                        {
                            Main.dust[i].velocity.X = 0.75f;
                        }
                        if (Main.dust[i].velocity.X < -0.75)
                        {
                            Main.dust[i].velocity.X = -0.75f;
                        }
                        if (Main.dust[i].velocity.Y > 0.75)
                        {
                            Main.dust[i].velocity.Y = 0.75f;
                        }
                        if (Main.dust[i].velocity.Y < -0.75)
                        {
                            Main.dust[i].velocity.Y = -0.75f;
                        }
                        Dust dust42 = Main.dust[i];
                        dust42.scale += 0.007f;
                        float num21 = Main.dust[i].scale * 0.7f;
                        if (num21 > 1f)
                        {
                            num21 = 1f;
                        }
                        Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num21 * 0.4f, num21 * 0.9f, num21);
                    }
                    else if (Main.dust[i].type == 0x2c)
                    {
                        Main.dust[i].velocity.X += Main.rand.Next(-10, 11) * 0.003f;
                        Main.dust[i].velocity.Y += Main.rand.Next(-10, 11) * 0.003f;
                        if (Main.dust[i].velocity.X > 0.35)
                        {
                            Main.dust[i].velocity.X = 0.35f;
                        }
                        if (Main.dust[i].velocity.X < -0.35)
                        {
                            Main.dust[i].velocity.X = -0.35f;
                        }
                        if (Main.dust[i].velocity.Y > 0.35)
                        {
                            Main.dust[i].velocity.Y = 0.35f;
                        }
                        if (Main.dust[i].velocity.Y < -0.35)
                        {
                            Main.dust[i].velocity.Y = -0.35f;
                        }
                        Dust dust43 = Main.dust[i];
                        dust43.scale += 0.0085f;
                        float num22 = Main.dust[i].scale * 0.7f;
                        if (num22 > 1f)
                        {
                            num22 = 1f;
                        }
                        Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num22 * 0.7f, num22, num22 * 0.8f);
                    }
                    else
                    {
                        Main.dust[i].velocity.X *= 0.99f;
                    }
                    if (Main.dust[i].type != 0x4f)
                    {
                        Dust dust44 = Main.dust[i];
                        dust44.rotation += Main.dust[i].velocity.X * 0.5f;
                    }
                    if (Main.dust[i].fadeIn > 0f)
                    {
                        if (Main.dust[i].type == 0x2e)
                        {
                            Dust dust45 = Main.dust[i];
                            dust45.scale += 0.1f;
                        }
                        else
                        {
                            Dust dust46 = Main.dust[i];
                            dust46.scale += 0.03f;
                        }
                        if (Main.dust[i].scale > Main.dust[i].fadeIn)
                        {
                            Main.dust[i].fadeIn = 0f;
                        }
                    }
                    else
                    {
                        Dust dust47 = Main.dust[i];
                        dust47.scale -= 0.01f;
                    }
                    if (Main.dust[i].noGravity)
                    {
                        Dust dust48 = Main.dust[i];
                        dust48.velocity = (Vector2)(dust48.velocity * 0.92f);
                        if (Main.dust[i].fadeIn == 0f)
                        {
                            Dust dust49 = Main.dust[i];
                            dust49.scale -= 0.04f;
                        }
                    }
                    if (Main.dust[i].position.Y > (Main.screenPosition.Y + Main.screenHeight))
                    {
                        Main.dust[i].active = false;
                    }
                    if (Main.dust[i].scale < 0.1)
                    {
                        Main.dust[i].active = false;
                    }
                    continue;
                }
                Main.dust[i].active = false;
            }
        }
Beispiel #8
0
 public static void UpdateDust()
 {
     for (int i = 0; i < 0x7d0; i++)
     {
         if (Main.dust[i].active)
         {
             Dust dust1 = Main.dust[i];
             dust1.position += Main.dust[i].velocity;
             if ((Main.dust[i].type == 6) || (Main.dust[i].type == 0x1d))
             {
                 if (!Main.dust[i].noGravity)
                 {
                     Main.dust[i].velocity.Y += 0.05f;
                 }
                 if (!Main.dust[i].noLight)
                 {
                     float lightness = Main.dust[i].scale * 1.6f;
                     if (Main.dust[i].type == 0x1d)
                     {
                         lightness *= 0.3f;
                     }
                     if (lightness > 1f)
                     {
                         lightness = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), lightness);
                 }
             }
             else if (((Main.dust[i].type == 14) || (Main.dust[i].type == 0x10)) || (Main.dust[i].type == 0x1f))
             {
                 Main.dust[i].velocity.Y *= 0.98f;
                 Main.dust[i].velocity.X *= 0.98f;
             }
             else if (Main.dust[i].type == 0x20)
             {
                 Dust dust2 = Main.dust[i];
                 dust2.scale             -= 0.01f;
                 Main.dust[i].velocity.X *= 0.96f;
                 Main.dust[i].velocity.Y += 0.1f;
             }
             else if (Main.dust[i].type == 15)
             {
                 Main.dust[i].velocity.Y *= 0.98f;
                 Main.dust[i].velocity.X *= 0.98f;
                 float scale = Main.dust[i].scale;
                 if (scale > 1f)
                 {
                     scale = 1f;
                 }
                 Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), scale);
             }
             else if ((Main.dust[i].type == 20) || (Main.dust[i].type == 0x15))
             {
                 Dust dust3 = Main.dust[i];
                 dust3.scale             += 0.005f;
                 Main.dust[i].velocity.Y *= 0.94f;
                 Main.dust[i].velocity.X *= 0.94f;
                 float num4 = Main.dust[i].scale * 0.8f;
                 if (Main.dust[i].type == 0x15)
                 {
                     num4 = Main.dust[i].scale * 0.4f;
                 }
                 if (num4 > 1f)
                 {
                     num4 = 1f;
                 }
                 Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num4);
             }
             else if (Main.dust[i].type == 0x1b)
             {
                 Dust dust4 = Main.dust[i];
                 dust4.velocity = (Vector2)(dust4.velocity * 0.94f);
                 Dust dust5 = Main.dust[i];
                 dust5.scale += 0.002f;
                 float num5 = Main.dust[i].scale;
                 if (num5 > 1f)
                 {
                     num5 = 1f;
                 }
                 Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num5);
             }
             else if (!Main.dust[i].noGravity && (Main.dust[i].type != 0x29))
             {
                 Main.dust[i].velocity.Y += 0.1f;
             }
             if ((Main.dust[i].type == 5) && Main.dust[i].noGravity)
             {
                 Dust dust6 = Main.dust[i];
                 dust6.scale -= 0.04f;
             }
             if (Main.dust[i].type == 0x21)
             {
                 if (Collision.WetCollision(new Vector2(Main.dust[i].position.X, Main.dust[i].position.Y), 4, 4))
                 {
                     Dust dust7 = Main.dust[i];
                     dust7.alpha += 20;
                     Dust dust8 = Main.dust[i];
                     dust8.scale -= 0.1f;
                 }
                 Dust dust9 = Main.dust[i];
                 dust9.alpha += 2;
                 Dust dust10 = Main.dust[i];
                 dust10.scale -= 0.005f;
                 if (Main.dust[i].alpha > 0xff)
                 {
                     Main.dust[i].scale = 0f;
                 }
                 Main.dust[i].velocity.X *= 0.93f;
                 if (Main.dust[i].velocity.Y > 4f)
                 {
                     Main.dust[i].velocity.Y = 4f;
                 }
                 if (Main.dust[i].noGravity)
                 {
                     if (Main.dust[i].velocity.X < 0f)
                     {
                         Dust dust11 = Main.dust[i];
                         dust11.rotation -= 0.2f;
                     }
                     else
                     {
                         Dust dust12 = Main.dust[i];
                         dust12.rotation += 0.2f;
                     }
                     Dust dust13 = Main.dust[i];
                     dust13.scale            += 0.03f;
                     Main.dust[i].velocity.X *= 1.05f;
                     Main.dust[i].velocity.Y += 0.15f;
                 }
             }
             if ((Main.dust[i].type == 0x23) && Main.dust[i].noGravity)
             {
                 Dust dust14 = Main.dust[i];
                 dust14.scale += 0.02f;
                 if (Main.dust[i].scale < 1f)
                 {
                     Main.dust[i].velocity.Y += 0.075f;
                 }
                 Main.dust[i].velocity.X *= 1.08f;
                 if (Main.dust[i].velocity.X > 0f)
                 {
                     Dust dust15 = Main.dust[i];
                     dust15.rotation += 0.01f;
                 }
                 else
                 {
                     Dust dust16 = Main.dust[i];
                     dust16.rotation -= 0.01f;
                 }
             }
             else if ((Main.dust[i].type == 0x22) || (Main.dust[i].type == 0x23))
             {
                 if (!Collision.WetCollision(new Vector2(Main.dust[i].position.X, Main.dust[i].position.Y - 8f), 4, 4))
                 {
                     Main.dust[i].scale = 0f;
                 }
                 else
                 {
                     Dust dust17 = Main.dust[i];
                     dust17.alpha += Main.rand.Next(2);
                     if (Main.dust[i].alpha > 0xff)
                     {
                         Main.dust[i].scale = 0f;
                     }
                     Main.dust[i].velocity.Y = -0.5f;
                     if (Main.dust[i].type == 0x22)
                     {
                         Dust dust18 = Main.dust[i];
                         dust18.scale += 0.005f;
                     }
                     else
                     {
                         Dust dust19 = Main.dust[i];
                         dust19.alpha++;
                         Dust dust20 = Main.dust[i];
                         dust20.scale           -= 0.01f;
                         Main.dust[i].velocity.Y = -0.2f;
                     }
                     Main.dust[i].velocity.X += Main.rand.Next(-10, 10) * 0.002f;
                     if (Main.dust[i].velocity.X < -0.25)
                     {
                         Main.dust[i].velocity.X = -0.25f;
                     }
                     if (Main.dust[i].velocity.X > 0.25)
                     {
                         Main.dust[i].velocity.X = 0.25f;
                     }
                 }
                 if (Main.dust[i].type == 0x23)
                 {
                     float num6 = Main.dust[i].scale * 1.6f;
                     if (num6 > 1f)
                     {
                         num6 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num6);
                 }
             }
             if (Main.dust[i].type == 0x29)
             {
                 Main.dust[i].velocity.X += Main.rand.Next(-10, 11) * 0.01f;
                 Main.dust[i].velocity.Y += Main.rand.Next(-10, 11) * 0.01f;
                 if (Main.dust[i].velocity.X > 0.75)
                 {
                     Main.dust[i].velocity.X = 0.75f;
                 }
                 if (Main.dust[i].velocity.X < -0.75)
                 {
                     Main.dust[i].velocity.X = -0.75f;
                 }
                 if (Main.dust[i].velocity.Y > 0.75)
                 {
                     Main.dust[i].velocity.Y = 0.75f;
                 }
                 if (Main.dust[i].velocity.Y < -0.75)
                 {
                     Main.dust[i].velocity.Y = -0.75f;
                 }
                 Dust dust21 = Main.dust[i];
                 dust21.scale += 0.007f;
                 float num7 = Main.dust[i].scale * 0.7f;
                 if (num7 > 1f)
                 {
                     num7 = 1f;
                 }
                 Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num7);
             }
             else
             {
                 Main.dust[i].velocity.X *= 0.99f;
             }
             Dust dust22 = Main.dust[i];
             dust22.rotation += Main.dust[i].velocity.X * 0.5f;
             Dust dust23 = Main.dust[i];
             dust23.scale -= 0.01f;
             if (Main.dust[i].noGravity)
             {
                 Dust dust24 = Main.dust[i];
                 dust24.velocity = (Vector2)(dust24.velocity * 0.92f);
                 Dust dust25 = Main.dust[i];
                 dust25.scale -= 0.04f;
             }
             if (Main.dust[i].position.Y > (Main.screenPosition.Y + Main.screenHeight))
             {
                 Main.dust[i].active = false;
             }
             if (Main.dust[i].scale < 0.1)
             {
                 Main.dust[i].active = false;
             }
         }
     }
 }
Beispiel #9
0
 public void Update()
 {
     if (Main.netMode == 2 || !active)
     {
         return;
     }
     if (type == 11 || type == 12 || type == 13 || type == 61 || type == 62 || type == 63 || type == 99)
     {
         velocity.Y *= 0.98f;
         velocity.X *= 0.98f;
         scale      -= 0.007f;
         if ((double)scale < 0.1)
         {
             scale = 0.1f;
             alpha = 255;
         }
     }
     else if (type == 16 || type == 17)
     {
         velocity.Y *= 0.98f;
         velocity.X *= 0.98f;
         scale      -= 0.01f;
         if ((double)scale < 0.1)
         {
             scale = 0.1f;
             alpha = 255;
         }
     }
     else
     {
         velocity.Y += 0.2f;
     }
     rotation += velocity.X * 0.1f;
     if (sticky)
     {
         int num = Main.goreTexture[type].Width;
         if (Main.goreTexture[type].Height < num)
         {
             num = Main.goreTexture[type].Height;
         }
         num      = (int)((float)num * 0.9f);
         velocity = Collision.TileCollision(position, velocity, (int)((float)num * scale), (int)((float)num * scale));
         if (velocity.Y == 0f)
         {
             velocity.X *= 0.97f;
             if ((double)velocity.X > -0.01 && (double)velocity.X < 0.01)
             {
                 velocity.X = 0f;
             }
         }
         if (timeLeft > 0)
         {
             timeLeft--;
         }
         else
         {
             alpha++;
         }
     }
     else
     {
         alpha += 2;
     }
     position += velocity;
     if (alpha >= 255)
     {
         active = false;
     }
     if (light > 0f)
     {
         float num2 = light * scale;
         float num3 = light * scale;
         float num4 = light * scale;
         if (type == 16)
         {
             num4 *= 0.3f;
             num3 *= 0.8f;
         }
         else if (type == 17)
         {
             num3 *= 0.6f;
             num2 *= 0.3f;
         }
         Lighting.addLight((int)((position.X + (float)Main.goreTexture[type].Width * scale / 2f) / 16f), (int)((position.Y + (float)Main.goreTexture[type].Height * scale / 2f) / 16f), num2, num3, num4);
     }
 }
Beispiel #10
0
 public void Update()
 {
     if (Main.netMode == 2)
     {
         return;
     }
     if (this.active)
     {
         if (this.type >= 276 && this.type <= 282)
         {
             this.velocity.X = this.velocity.X * 0.98f;
             this.velocity.Y = this.velocity.Y * 0.98f;
             if (this.velocity.Y < this.scale)
             {
                 this.velocity.Y = this.velocity.Y + 0.05f;
             }
             if ((double)this.velocity.Y > 0.1)
             {
                 if (this.velocity.X > 0f)
                 {
                     this.rotation += 0.01f;
                 }
                 else
                 {
                     this.rotation -= 0.01f;
                 }
             }
         }
         if (this.type >= 570 && this.type <= 572)
         {
             this.scale -= 0.001f;
             if ((double)this.scale <= 0.01)
             {
                 this.scale    = 0.01f;
                 Gore.goreTime = 0;
             }
             this.sticky   = false;
             this.rotation = this.velocity.X * 0.1f;
         }
         else
         {
             if (this.type == 11 || this.type == 12 || this.type == 13 || this.type == 61 || this.type == 62 || this.type == 63 || this.type == 99 || this.type == 220 || this.type == 221 || this.type == 222 || (this.type >= 375 && this.type <= 377) || (this.type >= 435 && this.type <= 437))
             {
                 this.velocity.Y = this.velocity.Y * 0.98f;
                 this.velocity.X = this.velocity.X * 0.98f;
                 this.scale     -= 0.007f;
                 if ((double)this.scale < 0.1)
                 {
                     this.scale = 0.1f;
                     this.alpha = 255;
                 }
             }
             else
             {
                 if (this.type == 16 || this.type == 17)
                 {
                     this.velocity.Y = this.velocity.Y * 0.98f;
                     this.velocity.X = this.velocity.X * 0.98f;
                     this.scale     -= 0.01f;
                     if ((double)this.scale < 0.1)
                     {
                         this.scale = 0.1f;
                         this.alpha = 255;
                     }
                 }
                 else
                 {
                     if (this.type == 331)
                     {
                         this.alpha     += 5;
                         this.velocity.Y = this.velocity.Y * 0.95f;
                         this.velocity.X = this.velocity.X * 0.95f;
                         this.rotation   = this.velocity.X * 0.1f;
                     }
                     else
                     {
                         if (this.type < 411 || this.type > 430)
                         {
                             this.velocity.Y = this.velocity.Y + 0.2f;
                         }
                     }
                 }
             }
         }
         this.rotation += this.velocity.X * 0.1f;
         if (this.type >= 411 && this.type <= 430)
         {
             this.alpha      = 50;
             this.velocity.X = (this.velocity.X * 50f + Main.windSpeed * 2f + (float)Main.rand.Next(-10, 11) * 0.1f) / 51f;
             this.velocity.Y = (this.velocity.Y * 50f + -0.25f + (float)Main.rand.Next(-10, 11) * 0.2f) / 51f;
             this.rotation   = this.velocity.X * 0.3f;
             if (Main.goreLoaded[this.type])
             {
                 Rectangle rectangle = new Rectangle((int)this.position.X, (int)this.position.Y, (int)((float)Main.goreTexture[this.type].Width * this.scale), (int)((float)Main.goreTexture[this.type].Height * this.scale));
                 for (int i = 0; i < 255; i++)
                 {
                     if (Main.player[i].active && !Main.player[i].dead)
                     {
                         Rectangle value = new Rectangle((int)Main.player[i].position.X, (int)Main.player[i].position.Y, Main.player[i].width, Main.player[i].height);
                         if (rectangle.Intersects(value))
                         {
                             this.timeLeft = 0;
                         }
                     }
                 }
                 if (Collision.SolidCollision(this.position, (int)((float)Main.goreTexture[this.type].Width * this.scale), (int)((float)Main.goreTexture[this.type].Height * this.scale)))
                 {
                     this.timeLeft = 0;
                 }
             }
             if (this.timeLeft > 0)
             {
                 if (Main.rand.Next(2) == 0)
                 {
                     this.timeLeft--;
                 }
                 if (Main.rand.Next(50) == 0)
                 {
                     this.timeLeft -= 5;
                 }
                 if (Main.rand.Next(100) == 0)
                 {
                     this.timeLeft -= 10;
                 }
             }
             else
             {
                 this.alpha = 255;
                 if (Main.goreLoaded[this.type])
                 {
                     float num  = (float)Main.goreTexture[this.type].Width * this.scale * 0.8f;
                     float x    = this.position.X;
                     float y    = this.position.Y;
                     float num2 = (float)Main.goreTexture[this.type].Width * this.scale;
                     float num3 = (float)Main.goreTexture[this.type].Height * this.scale;
                     int   num4 = 176;
                     if (this.type >= 416 && this.type <= 420)
                     {
                         num4 = 177;
                     }
                     if (this.type >= 421 && this.type <= 425)
                     {
                         num4 = 178;
                     }
                     if (this.type >= 426 && this.type <= 430)
                     {
                         num4 = 179;
                     }
                     int num5 = 0;
                     while ((float)num5 < num)
                     {
                         int num6 = Dust.NewDust(new Vector2(x, y), (int)num2, (int)num3, num4, 0f, 0f, 0, default(Color), 1f);
                         Main.dust[num6].noGravity = true;
                         Main.dust[num6].alpha     = 100;
                         Main.dust[num6].scale     = this.scale;
                         num5++;
                     }
                 }
             }
         }
         else
         {
             if (this.sticky)
             {
                 int num7 = 32;
                 if (Main.goreLoaded[this.type])
                 {
                     num7 = Main.goreTexture[this.type].Width;
                     if (Main.goreTexture[this.type].Height < num7)
                     {
                         num7 = Main.goreTexture[this.type].Height;
                     }
                 }
                 num7          = (int)((float)num7 * 0.9f);
                 this.velocity = Collision.TileCollision(this.position, this.velocity, (int)((float)num7 * this.scale), (int)((float)num7 * this.scale), false, false, 1);
                 if (this.velocity.Y == 0f)
                 {
                     this.velocity.X = this.velocity.X * 0.97f;
                     if ((double)this.velocity.X > -0.01 && (double)this.velocity.X < 0.01)
                     {
                         this.velocity.X = 0f;
                     }
                 }
                 if (this.timeLeft > 0)
                 {
                     this.timeLeft--;
                 }
                 else
                 {
                     this.alpha++;
                 }
             }
             else
             {
                 this.alpha += 2;
             }
         }
         this.position += this.velocity;
         if (this.alpha >= 255)
         {
             this.active = false;
         }
         if (this.light > 0f)
         {
             float num8  = this.light * this.scale;
             float num9  = this.light * this.scale;
             float num10 = this.light * this.scale;
             if (this.type == 16)
             {
                 num10 *= 0.3f;
                 num9  *= 0.8f;
             }
             else
             {
                 if (this.type == 17)
                 {
                     num9 *= 0.6f;
                     num8 *= 0.3f;
                 }
             }
             if (Main.goreLoaded[this.type])
             {
                 Lighting.addLight((int)((this.position.X + (float)Main.goreTexture[this.type].Width * this.scale / 2f) / 16f), (int)((this.position.Y + (float)Main.goreTexture[this.type].Height * this.scale / 2f) / 16f), num8, num9, num10);
                 return;
             }
             Lighting.addLight((int)((this.position.X + 32f * this.scale / 2f) / 16f), (int)((this.position.Y + 32f * this.scale / 2f) / 16f), num8, num9, num10);
         }
     }
 }
Beispiel #11
0
 public static void UpdateDust()
 {
     Dust.lavaBubbles = 0;
     Main.snowDust    = 0;
     for (int i = 0; i < 2000; i++)
     {
         if (i < Main.numDust)
         {
             if (Main.dust[i].active)
             {
                 if (Main.dust[i].type == 35)
                 {
                     Dust.lavaBubbles++;
                 }
                 Dust dust = Main.dust[i];
                 dust.position += Main.dust[i].velocity;
                 if (Main.dust[i].type == 6 || Main.dust[i].type == 75 || Main.dust[i].type == 29 || (Main.dust[i].type >= 59 && Main.dust[i].type <= 65))
                 {
                     if (!Main.dust[i].noGravity)
                     {
                         Dust dust2 = Main.dust[i];
                         dust2.velocity.Y = dust2.velocity.Y + 0.05f;
                     }
                     if (!Main.dust[i].noLight)
                     {
                         float num = Main.dust[i].scale * 1.4f;
                         if (Main.dust[i].type == 29)
                         {
                             if (num > 1f)
                             {
                                 num = 1f;
                             }
                             Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num * 0.1f, num * 0.4f, num);
                         }
                         if (Main.dust[i].type == 75)
                         {
                             if (num > 1f)
                             {
                                 num = 1f;
                             }
                             Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num * 0.7f, num, num * 0.2f);
                         }
                         else if (Main.dust[i].type >= 59 && Main.dust[i].type <= 65)
                         {
                             if (num > 0.8f)
                             {
                                 num = 0.8f;
                             }
                             int   num2 = Main.dust[i].type - 58;
                             float num3 = 1f;
                             float num4 = 1f;
                             float num5 = 1f;
                             if (num2 == 1)
                             {
                                 num3 = 0f;
                                 num4 = 0.1f;
                                 num5 = 1.3f;
                             }
                             else if (num2 == 2)
                             {
                                 num3 = 1f;
                                 num4 = 0.1f;
                                 num5 = 0.1f;
                             }
                             else if (num2 == 3)
                             {
                                 num3 = 0f;
                                 num4 = 1f;
                                 num5 = 0.1f;
                             }
                             else if (num2 == 4)
                             {
                                 num3 = 0.9f;
                                 num4 = 0f;
                                 num5 = 0.9f;
                             }
                             else if (num2 == 5)
                             {
                                 num3 = 1.3f;
                                 num4 = 1.3f;
                                 num5 = 1.3f;
                             }
                             else if (num2 == 6)
                             {
                                 num3 = 0.9f;
                                 num4 = 0.9f;
                                 num5 = 0f;
                             }
                             else if (num2 == 7)
                             {
                                 num3 = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch);
                                 num4 = 0.3f;
                                 num5 = 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch);
                             }
                             Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num * num3, num * num4, num * num5);
                         }
                         else
                         {
                             if (num > 0.6f)
                             {
                                 num = 0.6f;
                             }
                             Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num, num * 0.65f, num * 0.4f);
                         }
                     }
                 }
                 else if (Main.dust[i].type == 14 || Main.dust[i].type == 16 || Main.dust[i].type == 31 || Main.dust[i].type == 46)
                 {
                     Dust dust3 = Main.dust[i];
                     dust3.velocity.Y = dust3.velocity.Y * 0.98f;
                     Dust dust4 = Main.dust[i];
                     dust4.velocity.X = dust4.velocity.X * 0.98f;
                     if (Main.dust[i].type == 31 && Main.dust[i].noGravity)
                     {
                         Dust dust5 = Main.dust[i];
                         dust5.velocity     *= 1.02f;
                         Main.dust[i].scale += 0.02f;
                         Main.dust[i].alpha += 4;
                         if (Main.dust[i].alpha > 255)
                         {
                             Main.dust[i].scale = 0.0001f;
                             Main.dust[i].alpha = 255;
                         }
                     }
                 }
                 else if (Main.dust[i].type == 32)
                 {
                     Main.dust[i].scale -= 0.01f;
                     Dust dust6 = Main.dust[i];
                     dust6.velocity.X = dust6.velocity.X * 0.96f;
                     Dust dust7 = Main.dust[i];
                     dust7.velocity.Y = dust7.velocity.Y + 0.1f;
                 }
                 else if (Main.dust[i].type == 43)
                 {
                     Main.dust[i].rotation += 0.1f * Main.dust[i].scale;
                     Color color = Lighting.GetColor((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f));
                     float num6  = (float)color.R / 270f;
                     float num7  = (float)color.G / 270f;
                     float num8  = (float)color.B / 270f;
                     num6 *= Main.dust[i].scale * 1.07f;
                     num7 *= Main.dust[i].scale * 1.07f;
                     num8 *= Main.dust[i].scale * 1.07f;
                     if (Main.dust[i].alpha < 255)
                     {
                         Main.dust[i].scale += 0.09f;
                         if (Main.dust[i].scale >= 1f)
                         {
                             Main.dust[i].scale = 1f;
                             Main.dust[i].alpha = 255;
                         }
                     }
                     else
                     {
                         if ((double)Main.dust[i].scale < 0.8)
                         {
                             Main.dust[i].scale -= 0.01f;
                         }
                         if ((double)Main.dust[i].scale < 0.5)
                         {
                             Main.dust[i].scale -= 0.01f;
                         }
                     }
                     if ((double)num6 < 0.05 && (double)num7 < 0.05 && (double)num8 < 0.05)
                     {
                         Main.dust[i].active = false;
                     }
                     else
                     {
                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num6, num7, num8);
                     }
                 }
                 else if (Main.dust[i].type == 15 || Main.dust[i].type == 57 || Main.dust[i].type == 58)
                 {
                     Dust dust8 = Main.dust[i];
                     dust8.velocity.Y = dust8.velocity.Y * 0.98f;
                     Dust dust9 = Main.dust[i];
                     dust9.velocity.X = dust9.velocity.X * 0.98f;
                     float num9 = Main.dust[i].scale;
                     if (Main.dust[i].type != 15)
                     {
                         num9 = Main.dust[i].scale * 0.8f;
                     }
                     if (Main.dust[i].noLight)
                     {
                         Dust dust10 = Main.dust[i];
                         dust10.velocity *= 0.95f;
                     }
                     if (num9 > 1f)
                     {
                         num9 = 1f;
                     }
                     if (Main.dust[i].type == 15)
                     {
                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num9 * 0.45f, num9 * 0.55f, num9);
                     }
                     else if (Main.dust[i].type == 57)
                     {
                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num9 * 0.95f, num9 * 0.95f, num9 * 0.45f);
                     }
                     else if (Main.dust[i].type == 58)
                     {
                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num9, num9 * 0.55f, num9 * 0.75f);
                     }
                 }
                 else if (Main.dust[i].type == 66)
                 {
                     if (Main.dust[i].velocity.X < 0f)
                     {
                         Main.dust[i].rotation -= 1f;
                     }
                     else
                     {
                         Main.dust[i].rotation += 1f;
                     }
                     Dust dust11 = Main.dust[i];
                     dust11.velocity.Y = dust11.velocity.Y * 0.98f;
                     Dust dust12 = Main.dust[i];
                     dust12.velocity.X   = dust12.velocity.X * 0.98f;
                     Main.dust[i].scale += 0.02f;
                     float num10 = Main.dust[i].scale;
                     if (Main.dust[i].type != 15)
                     {
                         num10 = Main.dust[i].scale * 0.8f;
                     }
                     if (num10 > 1f)
                     {
                         num10 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num10 * ((float)Main.dust[i].color.R / 255f), num10 * ((float)Main.dust[i].color.G / 255f), num10 * ((float)Main.dust[i].color.B / 255f));
                 }
                 else if (Main.dust[i].type == 20 || Main.dust[i].type == 21)
                 {
                     Main.dust[i].scale += 0.005f;
                     Dust dust13 = Main.dust[i];
                     dust13.velocity.Y = dust13.velocity.Y * 0.94f;
                     Dust dust14 = Main.dust[i];
                     dust14.velocity.X = dust14.velocity.X * 0.94f;
                     float num11 = Main.dust[i].scale * 0.8f;
                     if (num11 > 1f)
                     {
                         num11 = 1f;
                     }
                     if (Main.dust[i].type == 21)
                     {
                         num11 = Main.dust[i].scale * 0.4f;
                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num11 * 0.8f, num11 * 0.3f, num11);
                     }
                     else
                     {
                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num11 * 0.3f, num11 * 0.6f, num11);
                     }
                 }
                 else if (Main.dust[i].type == 27 || Main.dust[i].type == 45)
                 {
                     Dust dust15 = Main.dust[i];
                     dust15.velocity    *= 0.94f;
                     Main.dust[i].scale += 0.002f;
                     float num12 = Main.dust[i].scale;
                     if (Main.dust[i].noLight)
                     {
                         num12 *= 0.1f;
                         Main.dust[i].scale -= 0.06f;
                         if (Main.dust[i].scale < 1f)
                         {
                             Main.dust[i].scale -= 0.06f;
                         }
                         if (Main.player[Main.myPlayer].wet)
                         {
                             Dust dust16 = Main.dust[i];
                             dust16.position += Main.player[Main.myPlayer].velocity * 0.5f;
                         }
                         else
                         {
                             Dust dust17 = Main.dust[i];
                             dust17.position += Main.player[Main.myPlayer].velocity;
                         }
                     }
                     if (num12 > 1f)
                     {
                         num12 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num12 * 0.6f, num12 * 0.2f, num12);
                 }
                 else if (Main.dust[i].type == 55 || Main.dust[i].type == 56 || Main.dust[i].type == 73 || Main.dust[i].type == 74)
                 {
                     Dust dust18 = Main.dust[i];
                     dust18.velocity *= 0.98f;
                     float num13 = Main.dust[i].scale * 0.8f;
                     if (Main.dust[i].type == 55)
                     {
                         if (num13 > 1f)
                         {
                             num13 = 1f;
                         }
                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num13, num13, num13 * 0.6f);
                     }
                     else if (Main.dust[i].type == 73)
                     {
                         if (num13 > 1f)
                         {
                             num13 = 1f;
                         }
                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num13, num13 * 0.35f, num13 * 0.5f);
                     }
                     else if (Main.dust[i].type == 74)
                     {
                         if (num13 > 1f)
                         {
                             num13 = 1f;
                         }
                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num13 * 0.35f, num13, num13 * 0.5f);
                     }
                     else
                     {
                         num13 = Main.dust[i].scale * 1.2f;
                         if (num13 > 1f)
                         {
                             num13 = 1f;
                         }
                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num13 * 0.35f, num13 * 0.5f, num13);
                     }
                 }
                 else if (Main.dust[i].type == 71 || Main.dust[i].type == 72)
                 {
                     Dust dust19 = Main.dust[i];
                     dust19.velocity *= 0.98f;
                     float num14 = Main.dust[i].scale;
                     if (num14 > 1f)
                     {
                         num14 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num14 * 0.2f, 0f, num14 * 0.1f);
                 }
                 else if (Main.dust[i].type == 76)
                 {
                     Main.snowDust++;
                     Main.dust[i].scale += 0.009f;
                     Dust dust20 = Main.dust[i];
                     dust20.position += Main.player[Main.myPlayer].velocity * 0.2f;
                 }
                 else if (!Main.dust[i].noGravity && Main.dust[i].type != 41 && Main.dust[i].type != 44)
                 {
                     Dust dust21 = Main.dust[i];
                     dust21.velocity.Y = dust21.velocity.Y + 0.1f;
                 }
                 if (Main.dust[i].type == 5 && Main.dust[i].noGravity)
                 {
                     Main.dust[i].scale -= 0.04f;
                 }
                 if (Main.dust[i].type == 33 || Main.dust[i].type == 52)
                 {
                     if (Main.dust[i].velocity.X == 0f)
                     {
                         if (Collision.SolidCollision(Main.dust[i].position, 2, 2))
                         {
                             Main.dust[i].scale = 0f;
                         }
                         Main.dust[i].rotation += 0.5f;
                         Main.dust[i].scale    -= 0.01f;
                     }
                     bool flag = Collision.WetCollision(new Vector2(Main.dust[i].position.X, Main.dust[i].position.Y), 4, 4);
                     if (flag)
                     {
                         Main.dust[i].alpha += 20;
                         Main.dust[i].scale -= 0.1f;
                     }
                     Main.dust[i].alpha += 2;
                     Main.dust[i].scale -= 0.005f;
                     if (Main.dust[i].alpha > 255)
                     {
                         Main.dust[i].scale = 0f;
                     }
                     Dust dust22 = Main.dust[i];
                     dust22.velocity.X = dust22.velocity.X * 0.93f;
                     if (Main.dust[i].velocity.Y > 4f)
                     {
                         Main.dust[i].velocity.Y = 4f;
                     }
                     if (Main.dust[i].noGravity)
                     {
                         if (Main.dust[i].velocity.X < 0f)
                         {
                             Main.dust[i].rotation -= 0.2f;
                         }
                         else
                         {
                             Main.dust[i].rotation += 0.2f;
                         }
                         Main.dust[i].scale += 0.03f;
                         Dust dust23 = Main.dust[i];
                         dust23.velocity.X = dust23.velocity.X * 1.05f;
                         Dust dust24 = Main.dust[i];
                         dust24.velocity.Y = dust24.velocity.Y + 0.15f;
                     }
                 }
                 if (Main.dust[i].type == 35 && Main.dust[i].noGravity)
                 {
                     Main.dust[i].scale += 0.03f;
                     if (Main.dust[i].scale < 1f)
                     {
                         Dust dust25 = Main.dust[i];
                         dust25.velocity.Y = dust25.velocity.Y + 0.075f;
                     }
                     Dust dust26 = Main.dust[i];
                     dust26.velocity.X = dust26.velocity.X * 1.08f;
                     if (Main.dust[i].velocity.X > 0f)
                     {
                         Main.dust[i].rotation += 0.01f;
                     }
                     else
                     {
                         Main.dust[i].rotation -= 0.01f;
                     }
                     float num15 = Main.dust[i].scale * 0.6f;
                     if (num15 > 1f)
                     {
                         num15 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f + 1f), num15, num15 * 0.3f, num15 * 0.1f);
                 }
                 else if (Main.dust[i].type == 67)
                 {
                     float num16 = Main.dust[i].scale;
                     if (num16 > 1f)
                     {
                         num16 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), 0f, num16 * 0.8f, num16);
                 }
                 else if (Main.dust[i].type == 34 || Main.dust[i].type == 35)
                 {
                     if (!Collision.WetCollision(new Vector2(Main.dust[i].position.X, Main.dust[i].position.Y - 8f), 4, 4))
                     {
                         Main.dust[i].scale = 0f;
                     }
                     else
                     {
                         Main.dust[i].alpha += Main.rand.Next(2);
                         if (Main.dust[i].alpha > 255)
                         {
                             Main.dust[i].scale = 0f;
                         }
                         Main.dust[i].velocity.Y = -0.5f;
                         if (Main.dust[i].type == 34)
                         {
                             Main.dust[i].scale += 0.005f;
                         }
                         else
                         {
                             Main.dust[i].alpha++;
                             Main.dust[i].scale     -= 0.01f;
                             Main.dust[i].velocity.Y = -0.2f;
                         }
                         Dust dust27 = Main.dust[i];
                         dust27.velocity.X = dust27.velocity.X + (float)Main.rand.Next(-10, 10) * 0.002f;
                         if ((double)Main.dust[i].velocity.X < -0.25)
                         {
                             Main.dust[i].velocity.X = -0.25f;
                         }
                         if ((double)Main.dust[i].velocity.X > 0.25)
                         {
                             Main.dust[i].velocity.X = 0.25f;
                         }
                     }
                     if (Main.dust[i].type == 35)
                     {
                         float num17 = Main.dust[i].scale * 0.3f + 0.4f;
                         if (num17 > 1f)
                         {
                             num17 = 1f;
                         }
                         Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num17, num17 * 0.5f, num17 * 0.3f);
                     }
                 }
                 if (Main.dust[i].type == 68)
                 {
                     float num18 = Main.dust[i].scale * 0.3f;
                     if (num18 > 1f)
                     {
                         num18 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num18 * 0.1f, num18 * 0.2f, num18);
                 }
                 if (Main.dust[i].type == 70)
                 {
                     float num19 = Main.dust[i].scale * 0.3f;
                     if (num19 > 1f)
                     {
                         num19 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num19 * 0.5f, 0f, num19);
                 }
                 if (Main.dust[i].type == 41)
                 {
                     Dust dust28 = Main.dust[i];
                     dust28.velocity.X = dust28.velocity.X + (float)Main.rand.Next(-10, 11) * 0.01f;
                     Dust dust29 = Main.dust[i];
                     dust29.velocity.Y = dust29.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.01f;
                     if ((double)Main.dust[i].velocity.X > 0.75)
                     {
                         Main.dust[i].velocity.X = 0.75f;
                     }
                     if ((double)Main.dust[i].velocity.X < -0.75)
                     {
                         Main.dust[i].velocity.X = -0.75f;
                     }
                     if ((double)Main.dust[i].velocity.Y > 0.75)
                     {
                         Main.dust[i].velocity.Y = 0.75f;
                     }
                     if ((double)Main.dust[i].velocity.Y < -0.75)
                     {
                         Main.dust[i].velocity.Y = -0.75f;
                     }
                     Main.dust[i].scale += 0.007f;
                     float num20 = Main.dust[i].scale * 0.7f;
                     if (num20 > 1f)
                     {
                         num20 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num20 * 0.4f, num20 * 0.9f, num20);
                 }
                 else if (Main.dust[i].type == 44)
                 {
                     Dust dust30 = Main.dust[i];
                     dust30.velocity.X = dust30.velocity.X + (float)Main.rand.Next(-10, 11) * 0.003f;
                     Dust dust31 = Main.dust[i];
                     dust31.velocity.Y = dust31.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.003f;
                     if ((double)Main.dust[i].velocity.X > 0.35)
                     {
                         Main.dust[i].velocity.X = 0.35f;
                     }
                     if ((double)Main.dust[i].velocity.X < -0.35)
                     {
                         Main.dust[i].velocity.X = -0.35f;
                     }
                     if ((double)Main.dust[i].velocity.Y > 0.35)
                     {
                         Main.dust[i].velocity.Y = 0.35f;
                     }
                     if ((double)Main.dust[i].velocity.Y < -0.35)
                     {
                         Main.dust[i].velocity.Y = -0.35f;
                     }
                     Main.dust[i].scale += 0.0085f;
                     float num21 = Main.dust[i].scale * 0.7f;
                     if (num21 > 1f)
                     {
                         num21 = 1f;
                     }
                     Lighting.addLight((int)(Main.dust[i].position.X / 16f), (int)(Main.dust[i].position.Y / 16f), num21 * 0.7f, num21, num21 * 0.8f);
                 }
                 else
                 {
                     Dust dust32 = Main.dust[i];
                     dust32.velocity.X = dust32.velocity.X * 0.99f;
                 }
                 if (Main.dust[i].type != 79)
                 {
                     Main.dust[i].rotation += Main.dust[i].velocity.X * 0.5f;
                 }
                 if (Main.dust[i].fadeIn > 0f)
                 {
                     if (Main.dust[i].type == 46)
                     {
                         Main.dust[i].scale += 0.1f;
                     }
                     else
                     {
                         Main.dust[i].scale += 0.03f;
                     }
                     if (Main.dust[i].scale > Main.dust[i].fadeIn)
                     {
                         Main.dust[i].fadeIn = 0f;
                     }
                 }
                 else
                 {
                     Main.dust[i].scale -= 0.01f;
                 }
                 if (Main.dust[i].noGravity)
                 {
                     Dust dust33 = Main.dust[i];
                     dust33.velocity *= 0.92f;
                     if (Main.dust[i].fadeIn == 0f)
                     {
                         Main.dust[i].scale -= 0.04f;
                     }
                 }
                 if (Main.dust[i].position.Y > Main.screenPosition.Y + (float)Main.screenHeight)
                 {
                     Main.dust[i].active = false;
                 }
                 if ((double)Main.dust[i].scale < 0.1)
                 {
                     Main.dust[i].active = false;
                 }
             }
         }
         else
         {
             Main.dust[i].active = false;
         }
     }
 }