public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Microsoft.Xna.Framework.Color color25 = Color.White;
            Texture2D texture2D3 = Main.projectileTexture[projectile.type];
            int       num156     = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
            int       y3         = num156 * projectile.frame;

            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156);
            Vector2 origin2 = rectangle.Size() / 2f;

            if (!reverse)
            {
                frick += 0.1f;
            }
            else
            {
                frick -= 0.1f;
            }
            if (frick >= 5f)
            {
                reverse = true;
            }
            if (frick <= 1.9f)
            {
                reverse = false;
            }
            for (int i = 0; i < 8; ++i)
            {
                Main.spriteBatch.Draw(mod.GetTexture("Projectiles/ForbiddenStaffProj2"), projectile.position + (-gayvector.RotatedBy(MathHelper.ToRadians(45 * i)) * frick) + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color25, projectile.rotation, origin2, 1f, SpriteEffects.None, 0f);
            }
            Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), Color.White, projectile.rotation, origin2, projectile.scale, SpriteEffects.None, 0f);
            gayvector = gayvector.RotatedBy(System.Math.PI / 35);
            return(false);
        }
Exemplo n.º 2
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Player        player        = Main.player[projectile.owner];
            SpriteEffects spriteEffects = SpriteEffects.None;

            if (player.direction == -1)
            {
                spriteEffects = SpriteEffects.FlipHorizontally;
            }

            Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            Texture2D texture2D3 = Main.projectileTexture[projectile.type];
            int       num156     = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
            int       y3         = num156 * projectile.frame;

            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156);
            Vector2 origin2    = rectangle.Size() / 2f;
            int     arg_5ADA_0 = projectile.type;
            int     arg_5AE7_0 = projectile.type;
            int     arg_5AF4_0 = projectile.type;
            int     num157     = 10;
            int     num158     = 2;
            int     num159     = 1;
            float   value3     = 1f;
            float   num160     = 0f;


            int num161 = num159;

            while ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))
            {
                Microsoft.Xna.Framework.Color color26 = color25;
                color26 = projectile.GetAlpha(color26);
                {
                    goto IL_6899;
                }
                color26 = Microsoft.Xna.Framework.Color.Lerp(color26, Microsoft.Xna.Framework.Color.Blue, 0.5f);

IL_6881:
                num161 += num158;
                continue;
IL_6899:
                float num164 = (float)(num157 - num161);
                if (num158 < 0)
                {
                    num164 = (float)(num159 - num161);
                }
                color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f);
                Vector2       value4  = projectile.oldPos[num161];
                float         num165  = projectile.rotation;
                SpriteEffects effects = spriteEffects;

                Main.spriteBatch.Draw(texture2D3, value4 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + projectile.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, projectile.scale, effects, 0f);
                goto IL_6881;
            }

            Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25);
            Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color29, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f);
            return(false);
        }
Exemplo n.º 3
0
        public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color lightColor)
        {
            Player    player     = Main.player[projectile.owner];
            Vector2   position1  = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition;
            Texture2D texture2D1 = Main.projectileTexture[projectile.type];

            Microsoft.Xna.Framework.Rectangle r     = texture2D1.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame);
            Microsoft.Xna.Framework.Color     alpha = projectile.GetAlpha(lightColor);
            Vector2 origin1 = r.Size() / 2f;

            origin1.X = (float)(r.Width - 6);
            --origin1.Y;
            r.Height -= 2;
            Texture2D texture2D3 = ModContent.GetTexture("SpiritMod/Effects/Mining_Helmet");

            //Texture2D texture2D3 = Main.glowMaskTexture[251];
            Microsoft.Xna.Framework.Color color4 = new Color(100, 100, 0)
            {
                A = (byte)0
            };
            color4 *= 1.13f;
            origin1 = texture2D3.Size() / 2f;
            if (player.direction == -1)
            {
                Main.spriteBatch.Draw(texture2D3, position1, new Microsoft.Xna.Framework.Rectangle?(), color4, projectile.rotation - 1.570796f, origin1, projectile.scale * 0.9f, SpriteEffects.None, 0.0f);
            }
            else if (player.direction == 1)
            {
                Main.spriteBatch.Draw(texture2D3, position1, new Microsoft.Xna.Framework.Rectangle?(), color4, projectile.rotation - 1.570796f, origin1, projectile.scale * 0.9f, SpriteEffects.FlipVertically, 0.0f);
            }

            return(false);
        }
Exemplo n.º 4
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            SpriteEffects spriteEffects = SpriteEffects.None;

            Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            Texture2D texture2D3 = Main.projectileTexture[projectile.type];
            int       num156     = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
            int       y3         = num156 * projectile.frame;

            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156);
            Vector2 origin2    = rectangle.Size() / 4f;
            int     arg_5ADA_0 = projectile.type;
            int     arg_5AE7_0 = projectile.type;
            int     arg_5AF4_0 = projectile.type;
            int     num157     = 10;
            int     num158     = 1;
            int     num159     = 1;
            float   value3     = 1f;
            float   num160     = 0f;
            float   num153     = 1f / (float)projectile.oldPos.Length * 0.7f;


            int num161 = num159;

            while ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157))
            {
                float num155 = (float)(projectile.oldPos.Length - num161) / (float)projectile.oldPos.Length;
                Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25);
                {
                    goto IL_6899;
                }

IL_6881:
                num161 += num158;
                continue;
IL_6899:
                float num164 = (float)(num157 - num161);
                if (num158 < 0)
                {
                    num164 = (float)(num159 - num161);
                }
                //color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f);
                Vector2       value4  = (projectile.oldPos[num161] + projectile.position * 2) / 3;
                float         num165  = projectile.rotation;
                SpriteEffects effects = spriteEffects;
                if (ProjectileID.Sets.TrailingMode[projectile.type] == 2)
                {
                    num165  = projectile.oldRot[num161];
                    effects = ((projectile.oldSpriteDirection[num161] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
                }
                Main.spriteBatch.Draw(texture2D3, value4 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color29, num165 + projectile.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, projectile.scale * MathHelper.Lerp(0.3f, 1.1f, num155), effects, 0f);
                goto IL_6881;
            }

            Microsoft.Xna.Framework.Color color291 = projectile.GetAlpha(color25);
            Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color291, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f);

            return(false);
        }
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            SpriteEffects spriteEffects = SpriteEffects.None;

            if (projectile.spriteDirection == -1)
            {
                spriteEffects = SpriteEffects.FlipHorizontally;
            }
            Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)(projectile.Center.X / 16), (int)(projectile.Center.Y / 16));

            int num157 = 15;                                             //number of trailing sprites to draw
            int num156 = Main.projectileTexture[projectile.type].Height; //ypos of lower right corner of sprite to draw
            int y3     = 0;                                              //ypos of upper left corner of sprite to draw

            Texture2D texture2D3 = mod.GetTexture("Projectiles/BlightedChakram");

            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156);
            Vector2 origin2 = rectangle.Size() / 2f;

            int   arg_5ADA_0 = projectile.type;
            int   arg_5AE7_0 = projectile.type;
            int   arg_5AF4_0 = projectile.type;
            int   num158     = 2;
            int   num159     = 1;
            float value3     = 1f;
            float num160     = 0f;

            int num161 = num159;

            while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)))             //trail
            {
                Microsoft.Xna.Framework.Color color26 = color25;
                color26 = projectile.GetAlpha(color26);
                {
                    goto IL_6899;
                }
                //color26 = Microsoft.Xna.Framework.Color.Lerp(color26, Microsoft.Xna.Framework.Color.Transparent, 0.75f);
                color26.A += (byte)(150);

IL_6881:
                num161 += num158;
                continue;
IL_6899:
                float num164 = (float)(num157 - num161);
                if (num158 < 0)
                {
                    num164 = (float)(num159 - num161);
                }
                color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f);
                Vector2       value4  = (projectile.oldPos[num161]);
                float         num165  = projectile.rotation;
                SpriteEffects effects = spriteEffects;
                Main.spriteBatch.Draw(texture2D3, value4 + projectile.Size / 2f - Main.screenPosition + new Vector2(0, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + projectile.rotation * num160 * (float)(num161 - 1) * projectile.spriteDirection, origin2, projectile.scale, effects, 0f);
                goto IL_6881;
            }

            Main.spriteBatch.Draw(texture2D3, projectile.position + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin2, projectile.scale, spriteEffects, 0f);
            return(false);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TabContainer"/> class with default settings.
 /// </summary>
 /// <param name="device"> The <see cref="GraphicsDevice"/> to display the <see cref="TabContainer"/> to. </param>
 /// <param name="font"> The <see cref="SpriteFont"/> to use while drawing the text. </param>
 public TabContainer(GraphicsDevice device, SpriteFont font)
     : base(device)
 {
     this.font = font;
     tabs = new KeyValuePair<Label, GuiItemCollection>[0];
     tabRect = DefaultTabSize;
     tabtexture = Drawing.FromColor(Color.White, tabRect.Size(), device);
 }
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            SpriteEffects spriteEffects = SpriteEffects.None;

            Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            Texture2D texture2D3 = Main.projectileTexture[projectile.type];
            int       num156     = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
            int       y3         = num156 * projectile.frame;

            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156);
            Vector2 origin2    = rectangle.Size() / 2f;
            int     arg_5ADA_0 = projectile.type;
            int     arg_5AE7_0 = projectile.type;
            int     arg_5AF4_0 = projectile.type;
            int     num157     = 10;
            int     num158     = 3;
            int     num159     = 1;
            float   value3     = 1f;
            float   num160     = 0f;


            int num161 = num159;

            while (projectile.alpha < 255 && ((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)))
            {
                Microsoft.Xna.Framework.Color color26 = color25;
                color26 = projectile.GetAlpha(color26);
                {
                    goto IL_6899;
                }
                //color26 = Microsoft.Xna.Framework.Color.Lerp(color26, Microsoft.Xna.Framework.Color.Blue, 0.5f);

IL_6881:
                num161 += num158;
                continue;
IL_6899:
                float num164 = (float)(num157 - num161);
                if (num158 < 0)
                {
                    num164 = (float)(num159 - num161);
                }
                color26 *= num164 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f);
                Vector2       value4  = (projectile.oldPos[num161] + 4 * projectile.position) / 5;
                float         num165  = projectile.rotation;
                SpriteEffects effects = spriteEffects;
                if (ProjectileID.Sets.TrailingMode[projectile.type] == 2)
                {
                    num165  = projectile.oldRot[num161];
                    effects = ((projectile.oldSpriteDirection[num161] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
                }
                Main.spriteBatch.Draw(texture2D3, value4 + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + projectile.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, projectile.scale, effects, 0f);
                Main.spriteBatch.Draw(texture2D3, value4 + projectile.Size / 2f - Main.screenPosition + new Vector2(10f, projectile.gfxOffY - 10).RotatedBy(projectile.velocity.ToRotation()), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + projectile.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, projectile.scale, effects, 0f);
                Main.spriteBatch.Draw(texture2D3, value4 + projectile.Size / 2f - Main.screenPosition + new Vector2(10f, projectile.gfxOffY + 10).RotatedBy(projectile.velocity.ToRotation()), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + projectile.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, projectile.scale, effects, 0f);
                goto IL_6881;
            }
            return(true);
        }
 public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
 {
     float num3 = 0f;
     if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * projectile.localAI[1], 22f * projectile.scale, ref num3))
     {
         return true;
     }
     return false;
 }
Exemplo n.º 9
0
 public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
 {
     if (projectile.ai[1] > -warningTime)
     {
         return false;
     }
     float num = 0f;
     Vector2 end = projectile.Center + projectile.localAI[1] * new Vector2((float)Math.Cos(projectile.rotation), (float)Math.Sin(projectile.rotation));
     return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, end, projectile.width, ref num);
 }
Exemplo n.º 10
0
        public override void PostDraw(SpriteBatch spriteBatch, Color drawColor)
        {
            Microsoft.Xna.Framework.Color color1 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0));
            Vector2 drawOrigin = new Vector2(Main.npcTexture[npc.type].Width * 0.5f, npc.height * 0.5f);
            int     r1         = (int)color1.R;

            drawOrigin.Y += 30f;
            drawOrigin.Y += 8f;
            --drawOrigin.X;
            Vector2   position1  = npc.Bottom - Main.screenPosition;
            Texture2D texture2D2 = Main.glowMaskTexture[239];
            float     num11      = (float)((double)Main.GlobalTime % 1.0 / 1.0);
            float     num12      = num11;

            if ((double)num12 > 0.5)
            {
                num12 = 1f - num11;
            }
            if ((double)num12 < 0.0)
            {
                num12 = 0.0f;
            }
            float num13 = (float)(((double)num11 + 0.5) % 1.0);
            float num14 = num13;

            if ((double)num14 > 0.5)
            {
                num14 = 1f - num13;
            }
            if ((double)num14 < 0.0)
            {
                num14 = 0.0f;
            }
            Microsoft.Xna.Framework.Rectangle r2 = texture2D2.Frame(1, 1, 0, 0);
            drawOrigin = r2.Size() / 2f;
            Vector2 position3 = position1 + new Vector2(0.0f, -20f);

            Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color(255, 138, 36) * 1.6f;
            Main.spriteBatch.Draw(texture2D2, position3, new Microsoft.Xna.Framework.Rectangle?(r2), color3, npc.rotation, drawOrigin, npc.scale * .75f, SpriteEffects.None ^ SpriteEffects.FlipHorizontally, 0.0f);
            float num15 = 1f + num11 * 0.75f;

            Main.spriteBatch.Draw(texture2D2, position3, new Microsoft.Xna.Framework.Rectangle?(r2), color3 * num12, npc.rotation, drawOrigin, npc.scale * .75f * num15, SpriteEffects.None ^ SpriteEffects.FlipHorizontally, 0.0f);
            float num16 = 1f + num13 * 0.75f;

            Main.spriteBatch.Draw(texture2D2, position3, new Microsoft.Xna.Framework.Rectangle?(r2), color3 * num14, npc.rotation, drawOrigin, npc.scale * .75f * num16, SpriteEffects.None ^ SpriteEffects.FlipHorizontally, 0.0f);
            Texture2D texture2D3 = Main.extraTexture[89];

            Microsoft.Xna.Framework.Rectangle r3 = texture2D3.Frame(1, 1, 0, 0);
            drawOrigin = r3.Size() / 2f;
            Vector2 scale = new Vector2(0.75f, 1f + num16) * 1.5f;
            float   num17 = 1f + num13 * 0.75f;

            GlowmaskUtils.DrawNPCGlowMask(spriteBatch, npc, mod.GetTexture("NPCs/Boss/SteamRaider/TailProbe_Glow"));
        }
Exemplo n.º 11
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
        {
            if (isFlashing)
            {
                SpriteEffects spriteEffects = SpriteEffects.None;
                if (npc.spriteDirection == 1)
                {
                    spriteEffects = SpriteEffects.FlipHorizontally;
                }

                Texture2D texture2D1 = Main.npcTexture[npc.type];
                Vector2   position1  = npc.Bottom - Main.screenPosition;
                Microsoft.Xna.Framework.Rectangle r1 = texture2D1.Frame(1, 1, 0, 0);
                Vector2 origin = r1.Size() / 2f;
                float   num11  = (float)(Math.Cos((double)Main.GlobalTime % 2.40000009536743 / 2.40000009536743 * 6.28318548202515) / 2 + 0.5);
                float   num12  = num11;
                if ((double)num12 > 0.5)
                {
                    num12 = 1f - num11;
                }
                if ((double)num12 < 0.0)
                {
                    num12 = 0.0f;
                }
                float num13 = (float)(((double)num11 + 0.5) % 1.0);
                float num14 = num13;
                if ((double)num14 > 0.5)
                {
                    num14 = 1f - num13;
                }
                if ((double)num14 < 0.0)
                {
                    num14 = 0.0f;
                }
                float num16 = 1f + num13 * 0.75f;
                Microsoft.Xna.Framework.Color color3  = new Microsoft.Xna.Framework.Color(211, 198, 111, 0) * 1.2f;
                Microsoft.Xna.Framework.Color color9  = new Microsoft.Xna.Framework.Color(211, 198, 111, 0) * 1.9f;
                Microsoft.Xna.Framework.Color color11 = new Microsoft.Xna.Framework.Color(211, 198, 111, 0) * 0.3f;
                Vector2   position3  = position1 + new Vector2(0.0f, -34f);
                Texture2D texture2D3 = mod.GetTexture("Effects/Ripple");
                Microsoft.Xna.Framework.Rectangle r3 = texture2D3.Frame(1, 1, 0, 0);
                origin = r3.Size() / 2f;
                Vector2 scale  = new Vector2(0.75f, 1f + num16) * 1.5f;
                Vector2 scale2 = new Vector2(1f + num16, 0.75f) * 1.5f;
                float   num17  = 1f + num13 * 0.75f;
                position3.Y -= 6f;
                Main.spriteBatch.Draw(texture2D3, position3, new Microsoft.Xna.Framework.Rectangle?(r3), color3 * num14, npc.rotation + 1.570796f, origin, scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f);
                Main.spriteBatch.Draw(texture2D3, position3, new Microsoft.Xna.Framework.Rectangle?(r3), color3 * num14, npc.rotation + 1.570796f, origin, scale2, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f);
                Main.spriteBatch.Draw(texture2D3, position3, new Microsoft.Xna.Framework.Rectangle?(r3), Microsoft.Xna.Framework.Color.Lerp(color9, Microsoft.Xna.Framework.Color.White, 0.7f), npc.rotation + 1.570796f, origin, 1.5f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f);
                Main.spriteBatch.Draw(texture2D3, position3, new Microsoft.Xna.Framework.Rectangle?(r3), Microsoft.Xna.Framework.Color.Lerp(color11, Microsoft.Xna.Framework.Color.White, 0.2f), npc.rotation + 1.570796f, origin, 3f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f);
            }
            return(true);
        }
Exemplo n.º 12
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D texture2D3 = Main.projectileTexture[projectile.type];
            int       num156     = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
            int       y3         = num156 * projectile.frame;

            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156);
            Vector2 origin2 = rectangle.Size() / 2f;

            Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), Color.White, projectile.rotation, origin2, projectile.scale, SpriteEffects.None, 0f);
            return(false);
        }
Exemplo n.º 13
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            SpriteEffects spriteEffects = SpriteEffects.None;

            Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0));
            Texture2D texture2D3 = mod.GetTexture("NPCs/Acheron/AcheronGhost");
            int       num156     = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type];
            int       y3         = num156 * (int)npc.frameCounter;

            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156);
            Vector2 origin2    = rectangle.Size() / 2f;
            int     arg_5ADA_0 = npc.type;
            int     arg_5AE7_0 = npc.type;
            int     arg_5AF4_0 = npc.type;
            int     num157     = 10;
            int     num158     = 2;
            int     num159     = 1;
            float   value3     = 1f;
            float   num160     = 0f;


            int num161 = num159;

            while (((num158 > 0 && num161 < num157) || (num158 < 0 && num161 > num157)))
            {
                Microsoft.Xna.Framework.Color color26 = color25;
                color26 = npc.GetAlpha(color26);
                {
                    goto IL_6899;
                }
                color26    = Microsoft.Xna.Framework.Color.Lerp(color26, Microsoft.Xna.Framework.Color.Blue, 0.5f);
                color26.A += (byte)(150);

IL_6881:
                num161 += num158;
                continue;
IL_6899:
                float num164 = (float)(num157 - num161);
                if (num158 < 0)
                {
                    num164 = (float)(num159 - num161);
                }
                color26 *= num164 / ((float)NPCID.Sets.TrailCacheLength[npc.type] * 1.5f);
                Vector2       value4  = (npc.oldPos[num161]);
                float         num165  = npc.rotation;
                SpriteEffects effects = spriteEffects;
                Main.spriteBatch.Draw(texture2D3, value4 + npc.Size / 2f - Main.screenPosition + new Vector2(0f, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color26, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin2, npc.scale, effects, 0f);
                goto IL_6881;
            }

            Microsoft.Xna.Framework.Color color29 = npc.GetAlpha(color25);
            return(true);
        }
Exemplo n.º 14
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f);

            if (displayCircle)
            {
                Microsoft.Xna.Framework.Color color1 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));

                int r1 = (int)color1.R;
                drawOrigin.Y += 30f;
                --drawOrigin.X;
                Vector2   position1  = projectile.Bottom - Main.screenPosition;
                Texture2D texture2D2 = Main.glowMaskTexture[239];
                float     num11      = (float)((double)Main.GlobalTime % 1.0 / 1.0);
                float     num12      = num11;
                if ((double)num12 > 0.5)
                {
                    num12 = 1f - num11;
                }
                if ((double)num12 < 0.0)
                {
                    num12 = 0.0f;
                }
                float num13 = (float)(((double)num11 + 0.5) % 1.0);
                float num14 = num13;
                if ((double)num14 > 0.5)
                {
                    num14 = 1f - num13;
                }
                if ((double)num14 < 0.0)
                {
                    num14 = 0.0f;
                }
                Microsoft.Xna.Framework.Rectangle r2 = texture2D2.Frame(1, 1, 0, 0);
                drawOrigin = r2.Size() / 2f;
                Vector2 position3 = position1 + new Vector2(0.0f, -5f);
                Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color(255, 54, 23) * 1.6f;
                Main.spriteBatch.Draw(texture2D2, position3, new Microsoft.Xna.Framework.Rectangle?(r2), color3, projectile.rotation, drawOrigin, projectile.scale * 0.2f, SpriteEffects.None ^ SpriteEffects.FlipHorizontally, 0.0f);
                float num15 = 1f + num11 * 0.75f;
                Main.spriteBatch.Draw(texture2D2, position3, new Microsoft.Xna.Framework.Rectangle?(r2), color3 * num12, projectile.rotation, drawOrigin, projectile.scale * 0.2f * num15, SpriteEffects.None ^ SpriteEffects.FlipHorizontally, 0.0f);
                float num16 = 1f + num13 * 0.75f;
                Main.spriteBatch.Draw(texture2D2, position3, new Microsoft.Xna.Framework.Rectangle?(r2), color3 * num14, projectile.rotation, drawOrigin, projectile.scale * 0.2f * num16, SpriteEffects.None ^ SpriteEffects.FlipHorizontally, 0.0f);
                Texture2D texture2D3 = Main.extraTexture[89];
                Microsoft.Xna.Framework.Rectangle r3 = texture2D3.Frame(1, 1, 0, 0);
                drawOrigin = r3.Size() / 2f;
                Vector2 scale = new Vector2(0.75f, 1f + num16) * 1.5f;
                float   num17 = 1f + num13 * 0.75f;
            }
            return(true);
        }
Exemplo n.º 15
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            SpriteEffects spriteEffects = SpriteEffects.None;

            Microsoft.Xna.Framework.Color color1 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            Texture2D texture2D3 = Main.projectileTexture[projectile.type];
            int       num156     = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
            int       y3         = num156 * projectile.frame;

            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156);
            Vector2 origin2 = rectangle.Size() / 2f;

            float num3 = 300f;

            if ((double)ai >= 100.0)
            {
                num3 = MathHelper.Lerp(300f, 400f, (float)(((double)ai - 100.0) / 200.0));
            }
            if ((double)num3 > 400.0)
            {
                num3 = 400f;
            }
            if ((double)ai >= 500.0)
            {
                num3 = MathHelper.Lerp(400f, 600f, (float)(((double)ai - 500.0) / 100.0));
            }
            float     rotation = projectile.rotation;
            Texture2D tex      = Main.projectileTexture[projectile.type];

            Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color1);
            alpha.A = (byte)(((int)alpha.A / 2) + alph);
            int     num5          = (int)((double)ai / 6.0);
            Vector2 spinningpoint = new Vector2(0f, -num3);

            for (int index = 0; (double)index < 10.0; ++index)
            {
                Microsoft.Xna.Framework.Rectangle r = tex.Frame(1, 5, 0, (num5 + index) % 5);
                float   num6    = rotation + 0.6283185f * (float)index;
                Vector2 vector2 = (((spinningpoint.RotatedBy((double)num6) / 3f) + projectile.Center) - Main.screenPosition);
                Main.spriteBatch.Draw(tex, vector2, new Microsoft.Xna.Framework.Rectangle?(r), alpha, num6, (r.Size() / 2f), projectile.scale, SpriteEffects.None, 0.0f);
            }
            for (int index = 0; (double)index < 20.0; ++index)
            {
                Microsoft.Xna.Framework.Rectangle r = tex.Frame(1, 5, 0, (num5 + index) % 5);
                float   num6    = (float)(-(double)rotation + 0.314159274101257 * (double)index) * 2f;
                Vector2 vector2 = ((spinningpoint.RotatedBy((double)num6) + projectile.Center) - Main.screenPosition);
                Main.spriteBatch.Draw(tex, vector2, new Microsoft.Xna.Framework.Rectangle?(r), alpha, num6, (r.Size() / 2f), projectile.scale, SpriteEffects.None, 0.0f);
            }
            return(false);
        }
Exemplo n.º 16
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Texture2D texture2D = Main.projectileTexture[projectile.type];

            Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            int num3 = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
            int num4 = num3 * projectile.frame;

            Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, num4, texture2D.Width, num3);
            Vector2 origin2 = r.Size() / 2f;
            Vector2 vector2 = (r.Size() / 2f);

            vector2.Y = 70;
            int   num5;
            int   num6  = 8;
            int   num7  = 2;
            int   num8  = 1;
            float num9  = 1f;
            float num10 = 0.0f;
            {
                num6 = 9;
                num7 = 3;
                num9 = 0.5f;
            }
            int index1 = num8;

            while (num7 > 0 && index1 < num6 || num7 < 0 && index1 > num6)
            {
                //Microsoft.Xna.Framework.Color newColor = color1;
                index1++;
                Main.spriteBatch.Draw(Main.extraTexture[36], ((projectile.Center - Main.screenPosition) + projectile.Size.RotatedBy(projectile.rotation)), new Microsoft.Xna.Framework.Rectangle?(r), new Color(255, 255, 255, projectile.alpha), projectile.localAI[0], vector2, projectile.scale, SpriteEffects.None, 0.0f);
            }

            Microsoft.Xna.Framework.Color color29 = projectile.GetAlpha(color25);
            Main.spriteBatch.Draw(texture2D, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), color29, projectile.rotation, origin2, projectile.scale, SpriteEffects.None, 0f);
            return(false);
        }
Exemplo n.º 17
0
        /*public override void SendExtraAI(BinaryWriter writer)
         * {
         *  writer.Write(phase2);
         * }
         *
         * public override void ReceiveExtraAI(BinaryReader reader)
         * {
         *  phase2 = reader.ReadBoolean();
         * }*/

        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            SpriteEffects spriteEffects = SpriteEffects.None;

            Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0));
            Texture2D texture2D3 = mod.GetTexture("NPCs/Acheron/AcheronGhost");
            int       num156     = Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type];
            int       y3         = num156 * (int)npc.frameCounter;

            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156);
            Vector2 origin2    = rectangle.Size() / 2f;
            int     arg_5ADA_0 = npc.type;
            int     arg_5AE7_0 = npc.type;
            int     arg_5AF4_0 = npc.type;
            int     num157     = 10;
            int     num158     = 2;
            int     num159     = 1;
            float   value3     = 1f;
            float   num160     = 0f;


            int num161 = num159;

            if (phase2)
            {
                Texture2D texture2D4 = mod.GetTexture("NPCs/FaceOfInsanity/ArteriusP2");
                int       num1561    = texture2D4.Height / Main.npcFrameCount[npc.type];
                int       y31        = num1561 * (int)npc.frameCounter;
                Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle(0, y31, texture2D4.Width, num1561);
                Vector2       origin3 = rectangle2.Size() / 2f;
                SpriteEffects effects = spriteEffects;
                if (npc.spriteDirection > 0)
                {
                    effects = SpriteEffects.FlipHorizontally;
                }
                float num165 = npc.rotation;
                Microsoft.Xna.Framework.Color color29 = npc.GetAlpha(color25);
                Main.spriteBatch.Draw(texture2D4, npc.position + npc.Size / 2f - Main.screenPosition + new Vector2(0f, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle2), color29, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin3, npc.scale, effects, 0f);
                return(false);
            }
            else
            {
                var allahuakbar = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
                spriteBatch.Draw(Main.npcTexture[npc.type], npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame,
                                 lightColor, npc.rotation, npc.frame.Size() / 2, npc.scale, allahuakbar, 0);
            }
            return(false);
        }
Exemplo n.º 18
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            float num391 = 900f;

            if (projectile.type == 657)
            {
                num391 = 300f;
            }
            float num390 = 15f;
            float num389 = 15f;
            float num388 = projectile.ai[0];
            float scale6 = MathHelper.Clamp(num388 / 30f, 0f, 1f);

            if (num388 > num391 - 60f)
            {
                scale6 = MathHelper.Lerp(1f, 0f, (num388 - (num391 - 60f)) / 60f);
            }
            Point center = projectile.Center.ToTileCoordinates();

            Collision.ExpandVertically(center.X, center.Y, out int num571, out int num572, (int)num390, (int)num389);
            num571++;
            num572--;
            float   num387  = 0.2f;
            Vector2 value13 = new Vector2(center.X, num571) * 16f + new Vector2(8f);
            Vector2 value12 = new Vector2(center.X, num572) * 16f + new Vector2(8f);

            Vector2.Lerp(value13, value12, 0.5f);
            Vector2 vector46 = new Vector2(0f, value12.Y - value13.Y);

            vector46.X = vector46.Y * num387;
            new Vector2(value13.X - vector46.X / 2f, value13.Y);
            Texture2D texture2D12 = Main.projectileTexture[projectile.type];

            Microsoft.Xna.Framework.Rectangle rectangle5 = texture2D12.Frame(1, 1, 0, 0);
            Vector2 origin6        = rectangle5.Size() / 2f;
            float   num386         = -0.06283186f * num388;
            Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num388 * 0.1f), default);
            float   num384         = 0f;
            float   num383         = 5.1f;

            Microsoft.Xna.Framework.Color value11 = new Microsoft.Xna.Framework.Color(214, 201, 176);
            for (float num382 = (float)(int)value12.Y; num382 > (float)(int)value13.Y; num382 -= num383)
            {
                num384 += num383;
                float   num381   = num384 / vector46.Y;
                float   num380   = num384 * 6.28318548f / -20f;
                float   num379   = num381 - 0.15f;
                Vector2 vector47 = spinningpoint2.RotatedBy((double)num380, default);
Exemplo n.º 19
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            color25 *= 0.25f;
            Texture2D texture2D3 = Main.projectileTexture[projectile.type];
            int       num156     = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
            int       y3         = num156 * projectile.frame;

            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156);
            Vector2 origin2 = rectangle.Size() / 2f;

            Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin2, projectile.scale, SpriteEffects.None, 0f);
            Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + (gayvector * 1.5f) + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color25, projectile.rotation, origin2, projectile.scale, SpriteEffects.None, 0f);
            Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + (-gayvector * 1.5f) + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color25, projectile.rotation, origin2, projectile.scale, SpriteEffects.None, 0f);
            gayvector = gayvector.RotatedBy(System.Math.PI / 35);
            return(false);
        }
Exemplo n.º 20
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            if (phase >= 1)
            {
                //tf does this supposed to mean
                int           num159                  = 1;
                float         num160                  = 0f;
                int           num161                  = num159;
                SpriteEffects spriteEffects           = SpriteEffects.None;
                Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0));
                Texture2D texture2D4                  = mod.GetTexture("NPCs/Boss/CosmicApparition/CosmicApparition2");
                int       num1561 = texture2D4.Height / Main.npcFrameCount[npc.type];
                int       y31     = num1561 * (int)npc.frameCounter;
                Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle(0, y31, texture2D4.Width, num1561);
                Vector2       origin3 = rectangle2.Size() / 2f;
                SpriteEffects effects = spriteEffects;
                if (npc.spriteDirection > 0)
                {
                    effects = SpriteEffects.FlipHorizontally;
                }
                float num165 = npc.rotation;
                Microsoft.Xna.Framework.Color color29 = npc.GetAlpha(color25);
                Main.spriteBatch.Draw(texture2D4, npc.position + npc.Size / 2f - Main.screenPosition + new Vector2(0f, npc.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle2), color29, num165 + npc.rotation * num160 * (float)(num161 - 1) * -(float)spriteEffects.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt(), origin3, npc.scale, effects, 0f);
                return(false);
            }

            Vector2 drawOrigin = new Vector2(Main.npcTexture[npc.type].Width * 0.5f, npc.height * 0.5f);

            for (int k = 0; k < npc.oldPos.Length; k++)
            {
                Vector2   drawPos       = npc.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, npc.gfxOffY);
                Color     color         = npc.GetAlpha(lightColor) * ((float)(npc.oldPos.Length - k) / (float)npc.oldPos.Length);
                Texture2D shadowTexture = mod.GetTexture("NPCs/Boss/CosmicApparition/CosmicApparition_Shadow");
                spriteBatch.Draw(shadowTexture, drawPos, null, color, npc.rotation, drawOrigin, npc.scale, SpriteEffects.None, 0f);
            }
            return(true);
        }
Exemplo n.º 21
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            color25 *= 0.35f;
            Texture2D texture2D3 = Main.projectileTexture[projectile.type];
            int       num156     = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
            int       y3         = num156 * projectile.frame;

            Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y3, texture2D3.Width, num156);
            Vector2 origin2 = rectangle.Size() / 2f;

            if (timer >= 3)
            {
                if (!reverse)
                {
                    frick += 0.1f;
                }
                else
                {
                    frick -= 0.1f;
                }
                timer = 0;
            }
            if (frick >= 1.8f)
            {
                reverse = true;
            }
            if (frick <= 1f)
            {
                reverse = false;
            }
            timer++;
            Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), color25, projectile.rotation, origin2, frick, SpriteEffects.None, 0f);
            Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.position + projectile.Size / 2f - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), lightColor, projectile.rotation, origin2, projectile.scale, SpriteEffects.None, 0f);
            return(false);
        }
Exemplo n.º 22
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            SpriteEffects effects1 = SpriteEffects.None;

            if (projectile.direction == 1)
            {
                effects1 = SpriteEffects.FlipHorizontally;
            }
            Microsoft.Xna.Framework.Color color3 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            {
                Texture2D texture = Main.projectileTexture[projectile.type];
                Texture2D glow    = Main.projectileTexture[projectile.type];
                int       height  = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
                Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, height * projectile.frame, texture.Width, height);
                Vector2 origin = r.Size() / 2f;
                int     num2   = 5;
                int     num3   = 1;
                int     num4   = 1;
                float   num5   = 1f;
                float   num6   = 0.0f;
                num3 = 1;
                num5 = 3f;
                int index1 = num4;
                while (num3 > 0 && index1 < num2 || num3 < 0 && index1 > num2)
                {
                    Microsoft.Xna.Framework.Color newColor = color3;
                    newColor = Microsoft.Xna.Framework.Color.Lerp(newColor, Microsoft.Xna.Framework.Color.White, 2.5f);
                    Microsoft.Xna.Framework.Color color1 = projectile.GetAlpha(newColor);
                    float num7 = (float)(num2 - index1);
                    if (num3 < 0)
                    {
                        num7 = (float)(num4 - index1);
                    }
                    Microsoft.Xna.Framework.Color color2 = color1 * (num7 / ((float)ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f));
                    Vector2       oldPo    = projectile.oldPos[index1];
                    float         rotation = projectile.rotation;
                    SpriteEffects effects2 = effects1;
                    if (ProjectileID.Sets.TrailingMode[projectile.type] == 2)
                    {
                        rotation = projectile.oldRot[index1];
                        effects2 = projectile.oldSpriteDirection[index1] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
                    }
                    Main.spriteBatch.Draw(glow, oldPo + projectile.Size / 2f - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), color2, rotation + projectile.rotation * num6 * (float)(index1 - 1) * (float)-effects1.HasFlag((Enum)SpriteEffects.FlipHorizontally).ToDirectionInt(), origin, MathHelper.Lerp(projectile.scale, num5, (float)index1 / 15f), effects2, 0.0f);
label_709:
                    index1 += num3;
                }

                Microsoft.Xna.Framework.Color color4 = projectile.GetAlpha(color3);
                Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), new Color(255 - projectile.alpha, 255 - projectile.alpha, 255 - projectile.alpha, 175), projectile.rotation, origin, projectile.scale, effects1, 0.0f);
            }
            for (int a = 0; a < 1; a++)
            {
                SpriteEffects spriteEffects = SpriteEffects.None;
                if (projectile.spriteDirection == 1)
                {
                    spriteEffects = SpriteEffects.FlipHorizontally;
                }
                Texture2D texture   = Main.projectileTexture[projectile.type];
                Vector2   vector2_3 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / 1 / 2));
                int       height    = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type];
                Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, height * projectile.frame, texture.Width, height);
                float addY      = 0f;
                float addHeight = 0f;
                int   num7      = 5;
                float num9      = (float)(Math.Cos((double)Main.GlobalTime % 2.40000009536743 / 2.40000009536743 * 6.28318548202515) / 2.0 + 0.5);
                float num99     = (float)(Math.Cos((double)Main.GlobalTime % 2.40000009536743 / 2.40000009536743 * 6.28318548202515) / 4.0 + 0.5);
                float num8      = 0f;
                Microsoft.Xna.Framework.Color secondColor = Microsoft.Xna.Framework.Color.White;

                float   num10 = 0.0f;
                Vector2 bb    = projectile.Center - Main.screenPosition - new Vector2((float)texture.Width, (float)(texture.Height / 1)) * projectile.scale / 2f + vector2_3 * projectile.scale + new Vector2(0.0f, addY + addHeight + projectile.gfxOffY);
                Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color((int)sbyte.MaxValue - projectile.alpha, (int)sbyte.MaxValue - projectile.alpha, (int)sbyte.MaxValue - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.White);
                for (int index2 = 0; index2 < 4; ++index2)
                {
                    Microsoft.Xna.Framework.Color newColor2 = color2;
                    Microsoft.Xna.Framework.Color faa       = projectile.GetAlpha(newColor2) * (1f - num99);
                    Vector2 position2 = projectile.Center + ((float)((double)index2 / (double)4 * 6.28318548202515) + projectile.rotation + num10).ToRotationVector2() * (float)(8.0 * (double)num99 + 2.0) - Main.screenPosition - new Vector2((float)texture.Width, (float)(texture.Height / 1)) * projectile.scale / 2f + vector2_3 * projectile.scale + new Vector2(0.0f, addY + addHeight + projectile.gfxOffY);
                    Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position2, new Microsoft.Xna.Framework.Rectangle?(r), faa, projectile.rotation, vector2_3, projectile.scale, spriteEffects, 0.0f);
                }
            }

            Lighting.AddLight(projectile.Center, Color.White.ToVector3() / 2f);

            return(false);
        }
		public bool Colliding(Rectangle myRect, Rectangle targetRect)
		{
			if (this.type == 598 && targetRect.Width > 8 && targetRect.Height > 8)
			{
				targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
			}
			else if (this.type == 614 && targetRect.Width > 8 && targetRect.Height > 8)
			{
				targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
			}
			else if (this.type == 636 && targetRect.Width > 8 && targetRect.Height > 8)
			{
				targetRect.Inflate(-targetRect.Width / 8, -targetRect.Height / 8);
			}
			else if (this.type == 607)
			{
				myRect.X += (int)this.velocity.X;
				myRect.Y += (int)this.velocity.Y;
			}
			if (myRect.Intersects(targetRect))
			{
				return true;
			}
			if (this.type == 461)
			{
				float num = 0f;
				if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + this.velocity * this.localAI[1], 22f * this.scale, ref num))
				{
					return true;
				}
			}
			else if (this.type == 642)
			{
				float num2 = 0f;
				if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + this.velocity * this.localAI[1], 30f * this.scale, ref num2))
				{
					return true;
				}
			}
			else if (this.type == 632)
			{
				float num3 = 0f;
				if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + this.velocity * this.localAI[1], 22f * this.scale, ref num3))
				{
					return true;
				}
			}
			else if (this.type == 455)
			{
				float num4 = 0f;
				if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + this.velocity * this.localAI[1], 36f * this.scale, ref num4))
				{
					return true;
				}
			}
			else if (this.type == 611)
			{
				float num5 = 0f;
				if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + this.velocity, 16f * this.scale, ref num5))
				{
					return true;
				}
			}
			else if (this.type == 537)
			{
				float num6 = 0f;
				if (Collision.CheckAABBvLineCollision(targetRect.TopLeft(), targetRect.Size(), base.Center, base.Center + this.velocity * this.localAI[1], 22f * this.scale, ref num6))
				{
					return true;
				}
			}
			else if (this.type == 466 || this.type == 580)
			{
				for (int i = 0; i < this.oldPos.Length; i++)
				{
					myRect.X = (int)this.oldPos[i].X;
					myRect.Y = (int)this.oldPos[i].Y;
					if (myRect.Intersects(targetRect))
					{
						return true;
					}
				}
			}
			else if (this.type == 464 && this.ai[1] != 1f)
			{
				Vector2 value = new Vector2(0f, -720f).RotatedBy((double)this.velocity.ToRotation(), default(Vector2));
				float scaleFactor = this.ai[0] % 45f / 45f;
				Vector2 spinningpoint = value * scaleFactor;
				for (int j = 0; j < 6; j++)
				{
					float num7 = (float)j * 6.28318548f / 6f;
					Vector2 center = base.Center + spinningpoint.RotatedBy((double)num7, default(Vector2));
					if (Utils.CenteredRectangle(center, new Vector2(30f, 30f)).Intersects(targetRect))
					{
						return true;
					}
				}
			}
			return false;
		}
		public static void TurretLaserDraw(int stage, Vector2 currentPosition, float distanceLeft, Rectangle lastFrame, out float distCovered, out Rectangle frame, out Vector2 origin, out Color color)
		{
			color = DelegateMethods.c_1;
			if (stage == 0)
			{
				distCovered = 32f;
				frame = new Rectangle(0, 0, 22, 20);
				origin = frame.Size() / 2f;
				return;
			}
			if (stage == 1)
			{
				DelegateMethods.i_1++;
				int num = DelegateMethods.i_1 % 5;
				frame = new Rectangle(0, 22 * (num + 1), 22, 20);
				distCovered = (float)(frame.Height - 1);
				origin = new Vector2((float)(frame.Width / 2), 0f);
				return;
			}
			if (stage == 2)
			{
				frame = new Rectangle(0, 154, 22, 30);
				distCovered = (float)frame.Height;
				origin = new Vector2((float)(frame.Width / 2), 1f);
				return;
			}
			distCovered = 9999f;
			frame = Rectangle.Empty;
			origin = Vector2.Zero;
			color = Color.Transparent;
		}
Exemplo n.º 25
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Vector2 value10 = projectile.Center;

            value10 -= Main.screenPosition;
            float     num178     = 40f;
            float     num179     = num178 * 2f;
            float     num180     = (float)projectile.frameCounter / num178;
            Texture2D texture2D5 = Main.projectileTexture[projectile.type];

            Microsoft.Xna.Framework.Color color33 = Microsoft.Xna.Framework.Color.Transparent;
            Microsoft.Xna.Framework.Color color34 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0);
            Microsoft.Xna.Framework.Color color35 = new Microsoft.Xna.Framework.Color(30, 30, 180, 200);
            Microsoft.Xna.Framework.Color color36 = new Microsoft.Xna.Framework.Color(0, 0, 30, 30);
            ulong num181 = 1uL;

            for (float num182 = 0f; num182 < 15f; num182 += 1f)
            {
                float   num183  = Utils.RandomFloat(ref num181) * 0.25f - 0.125f;
                Vector2 value11 = (projectile.rotation + num183).ToRotationVector2();
                Vector2 value12 = value10 + value11 * 400f;
                float   num184  = num180 + num182 * 0.06666667f;
                int     num185  = (int)(num184 / 0.06666667f);
                num184 %= 1f;
                if ((num184 <= num180 % 1f || (float)projectile.frameCounter >= num178) && (num184 >= num180 % 1f || (float)projectile.frameCounter < num179 - num178))
                {
                    if (num184 < 0.1f)
                    {
                        color33 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color34, Utils.InverseLerp(0f, 0.1f, num184, true));
                    }
                    else if (num184 < 0.35f)
                    {
                        color33 = color34;
                    }
                    else if (num184 < 0.7f)
                    {
                        color33 = Microsoft.Xna.Framework.Color.Lerp(color34, color35, Utils.InverseLerp(0.35f, 0.7f, num184, true));
                    }
                    else if (num184 < 0.9f)
                    {
                        color33 = Microsoft.Xna.Framework.Color.Lerp(color35, color36, Utils.InverseLerp(0.7f, 0.9f, num184, true));
                    }
                    else if (num184 < 1f)
                    {
                        color33 = Microsoft.Xna.Framework.Color.Lerp(color36, Microsoft.Xna.Framework.Color.Transparent, Utils.InverseLerp(0.9f, 1f, num184, true));
                    }
                    else
                    {
                        color33 = Microsoft.Xna.Framework.Color.Transparent;
                    }
                    float num186 = 0.9f + num184 * 0.8f;
                    num186 *= num186;
                    num186 *= 0.8f;
                    Vector2 position = Vector2.SmoothStep(value10, value12, num184);
                    Microsoft.Xna.Framework.Rectangle rectangle2 = texture2D5.Frame(1, 7, 0, (int)(num184 * 7f));
                    Main.spriteBatch.Draw(texture2D5, position, new Microsoft.Xna.Framework.Rectangle?(rectangle2), color33, projectile.rotation + 6.28318548f * (num184 + Main.GlobalTime * 1.2f) * 0.2f + (float)num185 * 1.2566371f, rectangle2.Size() / 2f, num186, SpriteEffects.None, 0f);
                }
            }
            return(false);
        }
		public static void LightningLaserDraw(int stage, Vector2 currentPosition, float distanceLeft, Rectangle lastFrame, out float distCovered, out Rectangle frame, out Vector2 origin, out Color color)
		{
			color = DelegateMethods.c_1 * DelegateMethods.f_1;
			if (stage == 0)
			{
				distCovered = 0f;
				frame = new Rectangle(0, 0, 21, 8);
				origin = frame.Size() / 2f;
				return;
			}
			if (stage == 1)
			{
				frame = new Rectangle(0, 8, 21, 6);
				distCovered = (float)frame.Height;
				origin = new Vector2((float)(frame.Width / 2), 0f);
				return;
			}
			if (stage == 2)
			{
				distCovered = 8f;
				frame = new Rectangle(0, 14, 21, 8);
				origin = new Vector2((float)(frame.Width / 2), 2f);
				return;
			}
			distCovered = 9999f;
			frame = Rectangle.Empty;
			origin = Vector2.Zero;
			color = Color.Transparent;
		}
Exemplo n.º 27
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter;

            Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
            if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type])
            {
                color25 = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f));
            }
            Vector2 projPos = projectile.position;

            projPos = new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; //f**k it
            Texture2D texture2D22 = Main.projectileTexture[projectile.type];

            Microsoft.Xna.Framework.Color alpha3 = projectile.GetAlpha(color25);
            if (projectile.velocity == Vector2.Zero)
            {
                return(false);
            }
            float   num230  = projectile.velocity.Length() + 16f;
            bool    flag24  = num230 < 100f;
            Vector2 value28 = Vector2.Normalize(projectile.velocity);

            Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 42); //2 and 40
            Vector2 value29    = new Vector2(0f, Main.player[projectile.owner].gfxOffY);
            float   rotation24 = projectile.rotation + 3.14159274f;

            Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, rectangle8.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0f);
            num230 -= 40f * projectile.scale;
            Vector2 vector31 = projectile.Center.Floor();

            vector31  += value28 * projectile.scale * 24f;
            rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 68, texture2D22.Width, 18); //68 and 18
            if (num230 > 0f)
            {
                float num231 = 0f;
                while (num231 + 1f < num230)
                {
                    if (num230 - num231 < (float)rectangle8.Height)
                    {
                        rectangle8.Height = (int)(num230 - num231);
                    }
                    Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f);
                    num231   += (float)rectangle8.Height * projectile.scale;
                    vector31 += value28 * (float)rectangle8.Height * projectile.scale;
                }
            }
            Vector2 value30 = vector31;

            vector31   = projectile.Center.Floor();
            vector31  += value28 * projectile.scale * 24f;
            rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 46, texture2D22.Width, 18); //46 and 18
            int num232 = 18;

            if (flag24)
            {
                num232 = 9;
            }
            float num233 = num230;

            if (num230 > 0f)
            {
                float num234 = 0f;
                float num235 = num233 / (float)num232;
                num234   += num235 * 0.25f;
                vector31 += value28 * num235 * 0.25f;
                for (int num236 = 0; num236 < num232; num236++)
                {
                    float num237 = num235;
                    if (num236 == 0)
                    {
                        num237 *= 0.75f;
                    }
                    Main.spriteBatch.Draw(texture2D22, vector31 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f);
                    num234   += num237;
                    vector31 += value28 * num237;
                }
            }
            rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 90, texture2D22.Width, 48); //90 and 48
            Main.spriteBatch.Draw(texture2D22, value30 - Main.screenPosition + value29, new Microsoft.Xna.Framework.Rectangle?(rectangle8), alpha3, rotation24, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f);
            return(false);
        }
Exemplo n.º 28
0
        /// <summary>
        /// Recalculates the background and the foreground.
        /// </summary>
        public override void Refresh()
        {
            if (suppressRefresh) return;

            if (AutoSize)
            {
                Vector2 dim = font.MeasureString(text);
                dim.X += 3;
                bool width = dim.X != Bounds.Width && dim.X != 0;
                bool height = dim.Y != Bounds.Height && dim.Y != 0;

                if (width && height) Bounds = new Rectangle(Bounds.X, Bounds.Y, (int)dim.X, (int)dim.Y);
                else if (width) Bounds = new Rectangle(Bounds.X, Bounds.Y, (int)dim.X, Bounds.Height);
                else if (height) Bounds = new Rectangle(Bounds.X, Bounds.Y, Bounds.Width, (int)dim.Y);
            }

            foregroundRectangle = Bounds;
            backColorImage = Drawing.FromColor(BackColor, Bounds.Size(), device).ApplyBorderLabel(BorderStyle);
            if (BackgroundImage != null) BackgroundImage = BackgroundImage.ApplyBorderLabel(BorderStyle);
            foregroundTexture = Drawing.FromText(text, font, ForeColor, foregroundRectangle.Size(), true, LineStart, device);
        }
Exemplo n.º 29
0
 public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
 {
     float point = 0f;
     Vector2 endPoint = Main.npc[(int)projectile.ai[1]].Center;
     return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, endPoint, 4f, ref point);
 }
Exemplo n.º 30
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            float num3 = 140f;
            float num4 = 15f;
            float num5 = 15f;
            float num6 = projectile.ai[0];
            float num7 = MathHelper.Clamp(num6 / 30f, 0.0f, 1f);

            if ((double)num6 > (double)num3 - 60.0)
            {
                num7 = MathHelper.Lerp(1f, 0.0f, (float)(((double)num6 - ((double)num3 - 60.0)) / 60.0));
            }
            Point tileCoordinates = projectile.Center.ToTileCoordinates();
            int   topY;
            int   bottomY;

            Collision.ExpandVertically((int)tileCoordinates.X, (int)tileCoordinates.Y, out topY, out bottomY, (int)num4, (int)num5);
            int num8 = topY + 1;

            --bottomY;
            float   num9      = 0.2f;
            Vector2 vector2_1 = ((new Vector2((float)tileCoordinates.X, (float)num8) * 16f) + new Vector2(8f));
            Vector2 vector2_2 = ((new Vector2((float)tileCoordinates.X, (float)bottomY) * 16f) + new Vector2(8f));

            Vector2.Lerp(vector2_1, vector2_2, 0.5f);
            Vector2 vector2_3 = new Vector2(0f, vector2_2.Y - vector2_1.Y);

            vector2_3.X = (vector2_3.Y * num9);
            Vector2   vector2_4 = new Vector2((float)(vector2_1.X - vector2_3.X / 2.0), (float)vector2_1.Y);
            Texture2D tex       = Main.projectileTexture[projectile.type];

            Microsoft.Xna.Framework.Rectangle r = tex.Frame(1, 1, 0, 0);
            Vector2 vector2_5     = (r.Size() / 2f);
            float   num10         = -0.06283186f * num6;
            Vector2 spinningpoint = Vector2.UnitY.RotatedBy((double)num6 * 0.100000001490116);
            float   num11         = 0.0f;
            float   num12         = 5.1f;

            Microsoft.Xna.Framework.Color color2 = new Color(255, 135, 56);
            float y = (float)(int)vector2_2.Y;

            while ((double)y > (double)(int)vector2_1.Y)
            {
                num11 += num12;
                float   num13     = num11 / (float)vector2_3.Y;
                float   num14     = (float)((double)num11 * 6.28318548202515 / -20.0);
                float   num15     = num13 - 0.15f;
                Vector2 vector2_6 = spinningpoint.RotatedBy((double)num14);
                Vector2 vector2_7 = new Vector2(0.0f, num13 + 1f);
                vector2_7.X = (vector2_7.Y * num9);
                Microsoft.Xna.Framework.Color color3 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color2, num13 * 2f);
                if ((double)num13 > 0.5)
                {
                    color3 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color2, (float)(2.0 - (double)num13 * 2.0));
                }
                color3.A   *= (byte)0.5f;
                color3      = (color3 * num7);
                vector2_6   = (vector2_6 * (vector2_7 * 100f));
                vector2_6.Y = 0;
                vector2_6.X = 0;
                vector2_6   = (vector2_6 + (new Vector2((float)vector2_2.X, y) - Main.screenPosition));
                Main.spriteBatch.Draw(tex, vector2_6, new Microsoft.Xna.Framework.Rectangle?(r), color3, num10 + num14, vector2_5, 1f + num15, (SpriteEffects)0, 0.0f);
                y -= num12;
            }
            return(false);
        }
Exemplo n.º 31
0
        /// <summary>
        /// Recalculates the background and the foreground.
        /// </summary>
        public override void Refresh()
        {
            if (suppressRefresh) return;

            if (AutoSize)
            {
                Vector2 dim = font.MeasureString(HeaderText);
                int yAdder = 0;

                for (int i = 0; i < labels.Length; i++)
                {
                    string full = string.Join(" ", labels[i].Select(l => l.Key));
                    Vector2 newDim = font.MeasureString(full);

                    if (newDim.X > dim.X) dim.X = newDim.X;
                    yAdder += (int)newDim.Y;
                }

                dim.X += 3;
                bool width = dim.X != Bounds.Width ? true : false;
                bool height = dim.Y != Bounds.Height ? true : false;

                if (width && height) Bounds = new Rectangle(Bounds.X, Bounds.Y, (int)dim.X, (int)dim.Y + yAdder);
                else if (width) Bounds = new Rectangle(Bounds.X, Bounds.Y, (int)dim.X, Bounds.Height);
                else if (height) Bounds = new Rectangle(Bounds.X, Bounds.Y, Bounds.Width, (int)dim.Y + yAdder);
            }

            foregroundRectangle = Bounds;
            backColorImage = backColorImage.ApplyBorderLabel(BorderStyle);
            if (BackgroundImage != null) BackgroundImage = BackgroundImage.ApplyBorderLabel(BorderStyle);

            foregroundTexture = Drawing.FromText(HeaderText, font, ForeColor, foregroundRectangle.Size(), false, 0, device);
            headerTexture = Drawing.FromColor(HeaderBackgroundColor, new Size(foregroundTexture.Width, (int)font.MeasureString("a").Y), device);

            itemTextures = new KeyValuePair<Texture2D, ButtonStyle>[labels.Length];
            for (int i = 0; i < labels.Length; i++)
            {
                itemTextures[i] = new KeyValuePair<Texture2D, ButtonStyle>(
                    Drawing.FromLabels(labels[i], font, new Size(foregroundTexture.Width, foregroundRectangle.Height / (labels.Length + 1)), device),
                    ButtonStyle.Default);
            }
        }
Exemplo n.º 32
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor)
        {
            var effects = npc.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;

            spriteBatch.Draw(Main.npcTexture[npc.type], npc.Center - Main.screenPosition + new Vector2(0, npc.gfxOffY), npc.frame,
                             drawColor, npc.rotation, npc.frame.Size() / 2, npc.scale, effects, 0);
            Vector2 vector2_3  = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2));
            Vector2 drawOrigin = new Vector2(Main.npcTexture[npc.type].Width * 0.5f, (npc.height / Main.npcFrameCount[npc.type]) * 0.5f);

            SpriteEffects spriteEffects = SpriteEffects.None;

            if (npc.spriteDirection == 1)
            {
                spriteEffects = SpriteEffects.FlipHorizontally;
            }
            Texture2D texture2D1 = Main.npcTexture[npc.type];
            Vector2   position1  = npc.Bottom - Main.screenPosition;

            Microsoft.Xna.Framework.Rectangle r1 = texture2D1.Frame(1, 1, 0, 0);
            Vector2 origin = r1.Size() / 2f;
            float   num11  = (float)(Math.Cos((double)Main.GlobalTime % 2.40000009536743 / 2.40000009536743 * 6.28318548202515) / 2 + 0.5);
            float   num12  = num11;

            if ((double)num12 > 0.5)
            {
                num12 = 1f - num11;
            }
            if ((double)num12 < 0.0)
            {
                num12 = 0.0f;
            }
            float num13 = (float)(((double)num11 + 0.5) % 1.0);
            float num14 = num13;

            if ((double)num14 > 0.5)
            {
                num14 = 1f - num13;
            }
            if ((double)num14 < 0.0)
            {
                num14 = 0.0f;
            }
            float num16 = 1f + num13 * 0.75f;

            Microsoft.Xna.Framework.Color color3  = Color.Gold * 1.2f;
            Microsoft.Xna.Framework.Color color9  = Color.Khaki * 1.9f;
            Microsoft.Xna.Framework.Color color11 = Color.Yellow * 0.3f;
            Vector2   position3  = position1 + new Vector2(0.0f, -10f);
            Texture2D texture2D3 = mod.GetTexture("Effects/Ripple");

            Microsoft.Xna.Framework.Rectangle r3 = texture2D3.Frame(1, 1, 0, 0);
            origin = r3.Size() / 2f;
            Vector2 scale  = new Vector2(0.75f, 1f + num16) * 0.45f * npc.scale;
            Vector2 scale2 = new Vector2(1f + num16, 0.75f) * 0.45f * npc.scale;
            float   num17  = 1f + num13 * 0.75f;

            position3.Y -= 6f;
            Main.spriteBatch.Draw(texture2D3, position3, new Microsoft.Xna.Framework.Rectangle?(r3), color3 * num14, npc.rotation + 1.570796f, origin, scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f);
            Main.spriteBatch.Draw(texture2D3, position3, new Microsoft.Xna.Framework.Rectangle?(r3), color3 * num14, npc.rotation + 1.570796f, origin, scale2, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f);
            return(false);
        }
Exemplo n.º 33
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            var     effects    = npc.direction == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
            Vector2 vector2_3  = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2));
            Vector2 drawOrigin = new Vector2(Main.npcTexture[npc.type].Width * 0.5f, (npc.height / Main.npcFrameCount[npc.type]) * 0.5f);

            if (npc.velocity != Vector2.Zero)
            {
                for (int k = 0; k < npc.oldPos.Length; k++)
                {
                    Vector2 drawPos = npc.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, npc.gfxOffY);
                    Color   color   = npc.GetAlpha(lightColor) * (float)(((float)(npc.oldPos.Length - k) / (float)npc.oldPos.Length) / 2);
                    spriteBatch.Draw(Main.npcTexture[npc.type], drawPos, new Microsoft.Xna.Framework.Rectangle?(npc.frame), color, npc.rotation, drawOrigin, npc.scale, effects, 0f);
                }
            }
            if (displaycircle)
            {
                Microsoft.Xna.Framework.Color color1 = Lighting.GetColor((int)((double)npc.position.X + (double)npc.width * 0.5) / 16, (int)(((double)npc.position.Y + (double)npc.height * 0.5) / 16.0));

                int r1 = (int)color1.R;
                drawOrigin.Y += 30f;
                drawOrigin.Y += 8f;
                --drawOrigin.X;
                Vector2   position1  = npc.Bottom - Main.screenPosition;
                Texture2D texture2D2 = Main.glowMaskTexture[239];
                float     num11      = (float)((double)Main.GlobalTime % 1.0 / 1.0);
                float     num12      = num11;
                if ((double)num12 > 0.5)
                {
                    num12 = 1f - num11;
                }
                if ((double)num12 < 0.0)
                {
                    num12 = 0.0f;
                }
                float num13 = (float)(((double)num11 + 0.5) % 1.0);
                float num14 = num13;
                if ((double)num14 > 0.5)
                {
                    num14 = 1f - num13;
                }
                if ((double)num14 < 0.0)
                {
                    num14 = 0.0f;
                }
                Microsoft.Xna.Framework.Rectangle r2 = texture2D2.Frame(1, 1, 0, 0);
                drawOrigin = r2.Size() / 2f;
                Vector2 position3 = position1 + new Vector2(0.0f, -40f);
                Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color(252, 3, 50) * 1.6f;
                Main.spriteBatch.Draw(texture2D2, position3, new Microsoft.Xna.Framework.Rectangle?(r2), color3, npc.rotation, drawOrigin, npc.scale * 0.75f, SpriteEffects.None ^ SpriteEffects.FlipHorizontally, 0.0f);
                float num15 = 1f + num11 * 0.75f;
                Main.spriteBatch.Draw(texture2D2, position3, new Microsoft.Xna.Framework.Rectangle?(r2), color3 * num12, npc.rotation, drawOrigin, npc.scale * 0.75f * num15, SpriteEffects.None ^ SpriteEffects.FlipHorizontally, 0.0f);
                float num16 = 1f + num13 * 0.75f;
                Main.spriteBatch.Draw(texture2D2, position3, new Microsoft.Xna.Framework.Rectangle?(r2), color3 * num14, npc.rotation, drawOrigin, npc.scale * 0.75f * num16, SpriteEffects.None ^ SpriteEffects.FlipHorizontally, 0.0f);
                Texture2D texture2D3 = Main.extraTexture[89];
                Microsoft.Xna.Framework.Rectangle r3 = texture2D3.Frame(1, 1, 0, 0);
                drawOrigin = r3.Size() / 2f;
                Vector2 scale = new Vector2(0.75f, 1f + num16) * 1.5f;
                float   num17 = 1f + num13 * 0.75f;
            }
            return(true);
        }
Exemplo n.º 34
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            float num391 = 900f;

            if (projectile.type == 657)
            {
                num391 = 300f;
            }
            float num390 = 15f;
            float num389 = 15f;
            float num388 = projectile.ai[0];
            float scale6 = MathHelper.Clamp(num388 / 30f, 0f, 1f);

            if (num388 > num391 - 60f)
            {
                scale6 = MathHelper.Lerp(1f, 0f, (num388 - (num391 - 60f)) / 60f);
            }
            Microsoft.Xna.Framework.Point point5 = projectile.Center.ToTileCoordinates();
            int num571 = default(int);
            int num572 = default(int);

            Collision.ExpandVertically(point5.X, point5.Y, out num571, out num572, (int)num390, (int)num389);
            num571++;
            num572--;
            float   num387  = 0.2f;
            Vector2 value13 = new Vector2((float)point5.X, (float)num571) * 16f + new Vector2(8f);
            Vector2 value12 = new Vector2((float)point5.X, (float)num572) * 16f + new Vector2(8f);

            Vector2.Lerp(value13, value12, 0.5f);
            Vector2 vector46 = new Vector2(0f, value12.Y - value13.Y);

            vector46.X = vector46.Y * num387;
            new Vector2(value13.X - vector46.X / 2f, value13.Y);
            Texture2D texture2D12 = Main.projectileTexture[projectile.type];

            Microsoft.Xna.Framework.Rectangle rectangle5 = texture2D12.Frame(1, 1, 0, 0);
            Vector2 origin6        = rectangle5.Size() / 2f;
            float   num386         = -0.06283186f * num388;
            Vector2 spinningpoint2 = Vector2.UnitY.RotatedBy((double)(num388 * 0.1f), default(Vector2));
            float   num384         = 0f;
            float   num383         = 5.1f;

            Microsoft.Xna.Framework.Color value11 = new Microsoft.Xna.Framework.Color(214, 201, 176);
            for (float num382 = (float)(int)value12.Y; num382 > (float)(int)value13.Y; num382 -= num383)
            {
                num384 += num383;
                float   num381   = num384 / vector46.Y;
                float   num380   = num384 * 6.28318548f / -20f;
                float   num379   = num381 - 0.15f;
                Vector2 vector47 = spinningpoint2.RotatedBy((double)num380, default(Vector2));
                Vector2 value57  = new Vector2(0f, num381 + 1f);
                value57.X = value57.Y * num387;
                Microsoft.Xna.Framework.Color color70 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value11, num381 * 2f);
                if (num381 > 0.5f)
                {
                    color70 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, value11, 2f - num381 * 2f);
                }
                color70.A  = (byte)((float)(int)color70.A * 0.5f);
                color70   *= scale6;
                vector47  *= value57 * 100f;
                vector47.Y = 0f;
                vector47.X = 0f;
                vector47  += new Vector2(value12.X, num382) - Main.screenPosition;
                spriteBatch.Draw(texture2D12, vector47, rectangle5, color70, num386 + num380, origin6, 1f + num379, SpriteEffects.None, 0f);
            }
            return(false);
        }
Exemplo n.º 35
0
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            //if (projectile.velocity == Vector2.Zero)
            //{
            //	return;
            //}
            Texture2D texture2D22 = Main.projectileTexture[projectile.type];
            float     num230      = projectile.localAI[1];

            Microsoft.Xna.Framework.Color     color45    = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.9f;
            Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D22.Width, 22);
            Vector2 value21 = new Vector2(0f, Main.player[projectile.owner].gfxOffY);

            Main.spriteBatch.Draw(texture2D22, projectile.Center.Floor() - Main.screenPosition + value21, new Microsoft.Xna.Framework.Rectangle?(rectangle8), color45, projectile.rotation, rectangle8.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
            num230 -= 33f * projectile.scale;
            Vector2 value22 = projectile.Center.Floor();

            value22   += projectile.velocity * projectile.scale * 10.5f;
            rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 25, texture2D22.Width, 28);
            if (num230 > 0f)
            {
                float num231 = 0f;
                while (num231 + 1f < num230)
                {
                    if (num230 - num231 < (float)rectangle8.Height)
                    {
                        rectangle8.Height = (int)(num230 - num231);
                    }
                    Main.spriteBatch.Draw(texture2D22, value22 - Main.screenPosition + value21, new Microsoft.Xna.Framework.Rectangle?(rectangle8), color45, projectile.rotation, new Vector2((float)(rectangle8.Width / 2), 0f), projectile.scale, SpriteEffects.None, 0f);
                    num231  += (float)rectangle8.Height * projectile.scale;
                    value22 += projectile.velocity * (float)rectangle8.Height * projectile.scale;
                }
            }
            rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 56, texture2D22.Width, 22);
            Main.spriteBatch.Draw(texture2D22, value22 - Main.screenPosition + value21, new Microsoft.Xna.Framework.Rectangle?(rectangle8), color45, projectile.rotation, texture2D22.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f);
            return(true);
        }