Exemple #1
0
        public override void Unload()
        {
            ExplosiveProjectiles = null;
            ExplosiveItems       = null;
            ExplosiveAmmo        = null;
            ExplosiveBaseDamage  = null;
            ExplosiveModOnHit    = null;
            VanillaElements      = null;
            celestineBoosters    = null;
            perlinFade0          = null;
            blackHoleShade       = null;
            solventShader        = null;
            rasterizeShader      = null;
            cellNoiseTexture     = null;
            OriginExtensions.drawPlayerItemPos = null;
            Tolruk.glowmasks     = null;
            HelmetGlowMasks      = null;
            BreastplateGlowMasks = null;
            LeggingGlowMasks     = null;
            instance             = null;
            Tiles.Defiled.Defiled_Tree.Unload();
            OriginExtensions.unInitExt();
            OriginTile.IDs = null;
            OriginWorld worldInstance = ModContent.GetInstance <OriginWorld>();

            if (!(worldInstance is null))
            {
                worldInstance.defiledResurgenceTiles    = null;
                worldInstance.defiledAltResurgenceTiles = null;
            }
            Bomboomstick.Unload();
            eyndumCoreUI        = null;
            eyndumCoreUITexture = null;
            eyndumCoreTexture   = null;
        }
        /// <summary>
        /// Applies a shader for the provided PaintingProjectile. Possible results are the Painted, GSPainted, and PaintedNegative shaders.
        /// </summary>
        /// <param name="projectile"></param>
        /// <returns></returns>
        public static MiscShaderData applyShader(PaintingProjectile projectile, PaintData data)
        {
            MiscShaderData shader = getShader(projectile, data);

            if (shader != null)
            {
                shader.Apply();
            }
            return(shader);
        }
        /// <summary>
        /// Applies a shader for the provided PaintingItem. Possible results are the GSPainted and PaintedNegative shader.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="player"></param>
        /// <returns></returns>
        public static MiscShaderData applyShader(PaintingItem item, Player player)
        {
            MiscShaderData shader = getShader(item, player);

            if (shader != null)
            {
                shader.Apply();
            }
            return(shader);
        }
        /// <summary>
        /// Applies a shader for the provided WoMDNPC. Possible results are the Painted, SprayPainted, and PaintedNegative shaders.
        /// </summary>
        /// <param name="globalNpc"></param>
        /// <param name="drawData">This is necessary for the SprayPainted shader to work</param>
        /// <returns></returns>
        public static MiscShaderData applyShader(WoMDNPC globalNpc, PaintData data, DrawData?drawData = null)
        {
            MiscShaderData shader = getShader(globalNpc, data, out bool needsDrawData);

            if (shader != null)
            {
                shader.Apply(needsDrawData ? drawData : null);
            }
            return(shader);
        }
Exemple #5
0
        public void Draw(Projectile proj)
        {
            double         num            = (double)proj.ai[1];
            MiscShaderData miscShaderData = GameShaders.Misc["EmpressBlade"];

            miscShaderData.UseShaderSpecificData(new Vector4(1f, 0.0f, 0.0f, 0.6f));
            miscShaderData.Apply(new DrawData?());
            EmpressBladeDrawer._vertexStrip.PrepareStrip(proj.oldPos, proj.oldRot, new VertexStrip.StripColorFunction(this.StripColors), new VertexStrip.StripHalfWidthFunction(this.StripWidth), -Main.screenPosition + proj.Size / 2f, new int?(proj.oldPos.Length), true);
            EmpressBladeDrawer._vertexStrip.DrawTrail();
            Main.pixelShader.CurrentTechnique.Passes[0].Apply();
        }
Exemple #6
0
        public void Draw(Projectile proj)
        {
            MiscShaderData miscShaderData = GameShaders.Misc["RainbowRod"];

            miscShaderData.UseSaturation(-2.8f);
            miscShaderData.UseOpacity(4f);
            miscShaderData.Apply(new DrawData?());
            RainbowRodDrawer._vertexStrip.PrepareStripWithProceduralPadding(proj.oldPos, proj.oldRot, new VertexStrip.StripColorFunction(this.StripColors), new VertexStrip.StripHalfWidthFunction(this.StripWidth), -Main.screenPosition + proj.Size / 2f, false);
            RainbowRodDrawer._vertexStrip.DrawTrail();
            Main.pixelShader.CurrentTechnique.Passes[0].Apply();
        }
Exemple #7
0
        public void Draw(Projectile proj)
        {
            MiscShaderData miscShaderData = GameShaders.Misc["RainbowRod"];

            miscShaderData.UseSaturation(-2.8f);
            miscShaderData.UseOpacity(4f);
            miscShaderData.Apply();
            _vertexStrip.PrepareStripWithProceduralPadding(proj.oldPos, proj.oldRot, StripColors, StripWidth, -Main.screenPosition + proj.Size / 2f);
            _vertexStrip.DrawTrail();
            Main.pixelShader.CurrentTechnique.Passes[0].Apply();
        }
Exemple #8
0
        public void Draw(Projectile proj)
        {
            transitToDark = Utils.GetLerpValue(0f, 6f, proj.localAI[0], clamped: true);
            MiscShaderData miscShaderData = GameShaders.Misc["FlameLash"];

            miscShaderData.UseSaturation(-2f);
            miscShaderData.UseOpacity(MathHelper.Lerp(4f, 8f, transitToDark));
            miscShaderData.Apply();
            _vertexStrip.PrepareStripWithProceduralPadding(proj.oldPos, proj.oldRot, StripColors, StripWidth, -Main.screenPosition + proj.Size / 2f);
            _vertexStrip.DrawTrail();
            Main.pixelShader.CurrentTechnique.Passes[0].Apply();
        }
Exemple #9
0
        public void Draw(Projectile proj)
        {
            this.transitToDark = Utils.GetLerpValue(0.0f, 6f, proj.localAI[0], true);
            MiscShaderData miscShaderData = GameShaders.Misc["FlameLash"];

            miscShaderData.UseSaturation(-2f);
            miscShaderData.UseOpacity(MathHelper.Lerp(4f, 8f, this.transitToDark));
            miscShaderData.Apply(new DrawData?());
            FlameLashDrawer._vertexStrip.PrepareStripWithProceduralPadding(proj.oldPos, proj.oldRot, new VertexStrip.StripColorFunction(this.StripColors), new VertexStrip.StripHalfWidthFunction(this.StripWidth), -Main.screenPosition + proj.Size / 2f, false);
            FlameLashDrawer._vertexStrip.DrawTrail();
            Main.pixelShader.CurrentTechnique.Passes[0].Apply();
        }
Exemple #10
0
        public void Draw(Projectile proj)
        {
            FinalFractalHelper.FinalFractalProfile finalFractalProfile = FinalFractalHelper.GetFinalFractalProfile((int)proj.ai[1]);
            MiscShaderData miscShaderData = GameShaders.Misc["FinalFractal"];

            miscShaderData.UseShaderSpecificData(new Vector4(4f, 0.0f, 0.0f, 4f));
            miscShaderData.UseImage0("Images/Extra_" + (object)(short)201);
            miscShaderData.UseImage1("Images/Extra_" + (object)(short)193);
            miscShaderData.Apply(new DrawData?());
            FinalFractalHelper._vertexStrip.PrepareStrip(proj.oldPos, proj.oldRot, finalFractalProfile.colorMethod, finalFractalProfile.widthMethod, -Main.screenPosition + proj.Size / 2f, new int?(proj.oldPos.Length), true);
            FinalFractalHelper._vertexStrip.DrawTrail();
            Main.pixelShader.CurrentTechnique.Passes[0].Apply();
        }
        public void Draw(Projectile proj)
        {
            ZenithProfileType zenithProfile  = GetZenithProfile((int)proj.ai[1]);
            MiscShaderData    miscShaderData = GameShaders.Misc["FinalFractal"];
            int num  = 4;
            int num2 = 0;
            int num3 = 0;
            int num4 = 4;

            miscShaderData.Apply();
            _vertexStrip.PrepareStrip(proj.oldPos, proj.oldRot, zenithProfile.colorMethod, zenithProfile.widthMethod, -Main.screenPosition + proj.Size / 2f, proj.oldPos.Length, includeBacksides: true);
            _vertexStrip.DrawTrail();
            Main.pixelShader.CurrentTechnique.Passes[0].Apply();
        }
        public void Draw(Projectile proj)
        {
            _ = proj.ai[1];
            MiscShaderData miscShaderData = GameShaders.Misc["EmpressBlade"];
            int            num            = 1;
            int            num2           = 0;
            int            num3           = 0;
            float          w = 0.6f;

            miscShaderData.UseShaderSpecificData(new Vector4(num, num2, num3, w));
            miscShaderData.Apply();
            _vertexStrip.PrepareStrip(proj.oldPos, proj.oldRot, StripColors, StripWidth, -Main.screenPosition + proj.Size / 2f, proj.oldPos.Length, includeBacksides: true);
            _vertexStrip.DrawTrail();
            Main.pixelShader.CurrentTechnique.Passes[0].Apply();
        }
Exemple #13
0
 public static void Draw()
 {
     Main.graphics.GraphicsDevice.Clear(Color.Transparent);
     Main.graphics.GraphicsDevice.SetRenderTarget(junkoAura);
     Main.graphics.GraphicsDevice.Clear(Color.Transparent);
     Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise);
     if (texture != null && !texture.IsDisposed)
     {
         DrawData       data       = new DrawData(texture, Vector2.Zero, texture.Frame(), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0);
         MiscShaderData shaderData = GameShaders.Misc["WaveShader"];
         shaderData.Apply(data);
         Main.spriteBatch.Draw(texture, Vector2.Zero, texture.Frame(), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0);
         Main.pixelShader.CurrentTechnique.Passes[0].Apply();
     }
     Main.spriteBatch.End();
     Main.graphics.GraphicsDevice.SetRenderTarget(null);
 }
Exemple #14
0
        public void Draw(Projectile proj)
        {
            FinalFractalProfile finalFractalProfile = GetFinalFractalProfile((int)proj.ai[1]);
            MiscShaderData      miscShaderData      = GameShaders.Misc["FinalFractal"];
            int num  = 4;
            int num2 = 0;
            int num3 = 0;
            int num4 = 4;

            miscShaderData.UseShaderSpecificData(new Vector4(num, num2, num3, num4));
            miscShaderData.UseImage0("Images/Extra_" + (short)201);
            miscShaderData.UseImage1("Images/Extra_" + (short)193);
            miscShaderData.Apply();
            _vertexStrip.PrepareStrip(proj.oldPos, proj.oldRot, finalFractalProfile.colorMethod, finalFractalProfile.widthMethod, -Main.screenPosition + proj.Size / 2f, proj.oldPos.Length, includeBacksides: true);
            _vertexStrip.DrawTrail();
            Main.pixelShader.CurrentTechnique.Passes[0].Apply();
        }
Exemple #15
0
        //This is where shaders are applied to items to make them reflect the current paint and tool the player is using
        public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
        {
            Player p = getPlayer(Main.myPlayer);

            if (p == null)
            {
                return(true);
            }
            WoMDPlayer player = p.GetModPlayer <WoMDPlayer>();

            if (player == null)
            {
                return(true);
            }
            MiscShaderData shader = getShader(this, p);

            if ((usesGSShader || ((player.paintData.PaintColor == PaintID.Negative || player.paintData.CustomPaint is NegativeSprayPaint) && !(this is CustomPaint))))
            {
                if (shader != null)
                {
                    spriteBatch.End();
                    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, (player.paintData.PaintColor == PaintID.Negative || player.paintData.CustomPaint is NegativeSprayPaint) ? SamplerState.LinearClamp : SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.UIScaleMatrix);                     // SpriteSortMode needs to be set to Immediate for shaders to work.

                    shader.Apply();
                }

                Texture2D texture = getTexture(player);
                if (texture == null)
                {
                    texture = Main.itemTexture[item.type];
                }

                spriteBatch.Draw(texture, position, frame, drawColor, 0, new Vector2(0, 0), scale, SpriteEffects.None, 0);

                if (shader != null)
                {
                    spriteBatch.End();
                    spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.UIScaleMatrix);
                }
                return(false);
            }
            return(true);
        }
Exemple #16
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            Player   player  = Main.player[Main.myPlayer];
            MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();

            float normalizedVoidCounter = 1f - ((float)mPlayer.voidCounter / (float)mPlayer.voidCounterMax);

            spriteBatch.Draw(VoidBarTexture, voidBarUI.GetClippingRectangle(spriteBatch), new Rectangle(0, 0, VoidBarTexture.Width, VoidBarTexture.Height), Color.White);

            //---------- This shows how to apply shaders to UI elements. In this case it was supposed to be a gradient but it looked worse than a monotone bar either way ----------
            spriteBatch.End();
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.UIScaleMatrix);

            MiscShaderData voidGradientShader = GameShaders.Misc["JoJoStandsVoidGradient"];

            voidGradientShader.UseOpacity(normalizedVoidCounter);

            voidGradientShader.Apply(null);
            spriteBatch.Draw(VoidBarBarTexture, voidBarUI.GetClippingRectangle(spriteBatch), new Rectangle(0, 0, VoidBarTexture.Width, VoidBarTexture.Height), Color.White);

            spriteBatch.End();
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.UIScaleMatrix);
        }
Exemple #17
0
        public override bool PreDrawInInventory(Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
        {
            PaintMethods method;
            string       itemName;

            switch (item.type)
            {
            case ItemID.Paintbrush:
                itemName = "Paintbrush";
                method   = PaintMethods.Blocks;
                break;

            case ItemID.SpectrePaintbrush:
                itemName = "SpectrePaintbrush";
                method   = PaintMethods.Blocks;
                break;

            case ItemID.PaintRoller:
                itemName = "PaintRoller";
                method   = PaintMethods.Walls;
                break;

            case ItemID.SpectrePaintRoller:
                itemName = "SpectrePaintRoller";
                method   = PaintMethods.Walls;
                break;

            default:
                return(true);
            }
            Player p = getPlayer(item.owner);

            if (p == null)
            {
                return(true);
            }
            WoMDPlayer player = p.GetModPlayer <WoMDPlayer>();

            if (player == null)
            {
                return(true);
            }

            Texture2D texture = getTexture(itemName, player);

            if (texture == null)
            {
                texture = Main.itemTexture[item.type];
            }
            MiscShaderData shader = null;

            if (player.paintData.PaintColor != -1 || player.paintData.CustomPaint != null)
            {
                PaintData d = player.paintData.clone();
                if (method != PaintMethods.None)
                {
                    d.paintMethod = method;
                }
                shader = getShader(item.GetGlobalItem <WoMDItem>(), d);
            }

            spriteBatch.End();
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, shader != null ? SamplerState.PointClamp : SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.UIScaleMatrix);             // SpriteSortMode needs to be set to Immediate for shaders to work.

            if (shader != null)
            {
                shader.Apply();
            }

            spriteBatch.Draw(texture, position, frame, drawColor, 0, new Vector2(0, 0), scale, SpriteEffects.None, 0);

            if (shader != null)
            {
                spriteBatch.End();
                spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.UIScaleMatrix);
            }
            return(false);
        }
Exemple #18
0
        public override void Load()
        {
            ExplosiveBaseDamage = new Dictionary <int, int>();
            //Explosive item types
            NonFishItem.ResizeItemArrays += () => {
                ExplosiveItems = ItemID.Sets.ItemsThatCountAsBombsForDemolitionistToSpawn.ToArray();
                ExplosiveItems[ItemID.BouncyBomb]       = true;
                ExplosiveItems[ItemID.HellfireArrow]    = true;
                ExplosiveItems[ItemID.BombFish]         = true;
                ExplosiveItems[ItemID.PartyGirlGrenade] = true;
                ExplosiveItems[ItemID.Beenade]          = true;
                ExplosiveItems[ItemID.MolotovCocktail]  = true;
            };
            //Explosive projectile & ammo types
            NonFishItem.ResizeOtherArrays += () => {
                ExplosiveProjectiles = new bool[ProjectileID.Sets.CanDistortWater.Length];
                ExplosiveProjectiles[ProjectileID.Grenade]          = true;
                ExplosiveProjectiles[ProjectileID.StickyGrenade]    = true;
                ExplosiveProjectiles[ProjectileID.BouncyGrenade]    = true;
                ExplosiveProjectiles[ProjectileID.Bomb]             = true;
                ExplosiveProjectiles[ProjectileID.StickyBomb]       = true;
                ExplosiveProjectiles[ProjectileID.BouncyBomb]       = true;
                ExplosiveProjectiles[ProjectileID.Dynamite]         = true;
                ExplosiveProjectiles[ProjectileID.StickyDynamite]   = true;
                ExplosiveProjectiles[ProjectileID.BouncyDynamite]   = true;
                ExplosiveProjectiles[ProjectileID.HellfireArrow]    = true;
                ExplosiveProjectiles[ProjectileID.BombFish]         = true;
                ExplosiveProjectiles[ProjectileID.PartyGirlGrenade] = true;
                ExplosiveProjectiles[ProjectileID.Beenade]          = true;
                ExplosiveProjectiles[ProjectileID.MolotovCocktail]  = true;
                ExplosiveProjectiles[ProjectileID.RocketI]          = true;
                ExplosiveProjectiles[ProjectileID.RocketII]         = true;
                ExplosiveProjectiles[ProjectileID.RocketIII]        = true;
                ExplosiveProjectiles[ProjectileID.RocketIV]         = true;
                ExplosiveProjectiles[ProjectileID.GrenadeI]         = true;
                ExplosiveProjectiles[ProjectileID.GrenadeII]        = true;
                ExplosiveProjectiles[ProjectileID.GrenadeIII]       = true;
                ExplosiveProjectiles[ProjectileID.GrenadeIV]        = true;
                ExplosiveProjectiles[ProjectileID.ProximityMineI]   = true;
                ExplosiveProjectiles[ProjectileID.ProximityMineII]  = true;
                ExplosiveProjectiles[ProjectileID.ProximityMineIII] = true;
                ExplosiveProjectiles[ProjectileID.ProximityMineIV]  = true;

                ExplosiveModOnHit = new bool[ProjectileID.Sets.CanDistortWater.Length];
                ExplosiveModOnHit[ProjectileID.Bomb]           = true;
                ExplosiveModOnHit[ProjectileID.StickyBomb]     = true;
                ExplosiveModOnHit[ProjectileID.BouncyBomb]     = true;
                ExplosiveModOnHit[ProjectileID.BombFish]       = true;
                ExplosiveModOnHit[ProjectileID.Dynamite]       = true;
                ExplosiveModOnHit[ProjectileID.StickyDynamite] = true;
                ExplosiveModOnHit[ProjectileID.BouncyDynamite] = true;

                ExplosiveAmmo = ExplosiveItems.ToArray();
                ExplosiveAmmo[AmmoID.Rocket]      = true;
                ExplosiveAmmo[AmmoID.StyngerBolt] = true;
            };
            #region vanilla weapon elements
            VanillaElements = ItemID.Sets.Factory.CreateUshortSet(0,
                                                                  #region fire
                                                                  (ushort)ItemID.FlamingArrow, Elements.Fire,
                                                                  (ushort)ItemID.FlareGun, Elements.Fire,
                                                                  (ushort)ItemID.WandofSparking, Elements.Fire,
                                                                  (ushort)ItemID.FieryGreatsword, Elements.Fire,
                                                                  (ushort)ItemID.MoltenPickaxe, Elements.Fire,
                                                                  (ushort)ItemID.MoltenHamaxe, Elements.Fire,
                                                                  (ushort)ItemID.ImpStaff, Elements.Fire,
                                                                  (ushort)ItemID.FlowerofFire, Elements.Fire,
                                                                  (ushort)ItemID.Flamelash, Elements.Fire,
                                                                  (ushort)ItemID.Sunfury, Elements.Fire,
                                                                  (ushort)ItemID.Flamethrower, Elements.Fire,
                                                                  (ushort)ItemID.EldMelter, Elements.Fire,
                                                                  (ushort)ItemID.InfernoFork, Elements.Fire,
                                                                  (ushort)ItemID.Cascade, Elements.Fire,
                                                                  (ushort)ItemID.HelFire, Elements.Fire,
                                                                  (ushort)ItemID.HellwingBow, Elements.Fire,
                                                                  (ushort)ItemID.PhoenixBlaster, Elements.Fire,
                                                                  (ushort)ItemID.MoltenFury, Elements.Fire,
                                                                  (ushort)ItemID.DD2FlameburstTowerT1Popper, Elements.Fire,
                                                                  (ushort)ItemID.DD2FlameburstTowerT2Popper, Elements.Fire,
                                                                  (ushort)ItemID.DD2FlameburstTowerT3Popper, Elements.Fire,
                                                                  (ushort)ItemID.DD2PhoenixBow, Elements.Fire,
                                                                  (ushort)ItemID.FrostburnArrow, Elements.Fire | Elements.Ice,
                                                                  (ushort)ItemID.FlowerofFrost, Elements.Fire | Elements.Ice,
                                                                  (ushort)ItemID.Amarok, Elements.Fire | Elements.Ice,
                                                                  (ushort)ItemID.CursedArrow, Elements.Fire | Elements.Acid,
                                                                  (ushort)ItemID.CursedBullet, Elements.Fire | Elements.Acid,
                                                                  (ushort)ItemID.CursedFlames, Elements.Fire | Elements.Acid,
                                                                  (ushort)ItemID.CursedDart, Elements.Fire | Elements.Acid,
                                                                  (ushort)ItemID.ClingerStaff, Elements.Fire | Elements.Acid,
                                                                  (ushort)ItemID.ShadowFlameBow, Elements.Fire,
                                                                  (ushort)ItemID.ShadowFlameHexDoll, Elements.Fire,
                                                                  (ushort)ItemID.ShadowFlameKnife, Elements.Fire,
                                                                  (ushort)ItemID.SolarFlareAxe, Elements.Fire,
                                                                  (ushort)ItemID.SolarFlareChainsaw, Elements.Fire,
                                                                  (ushort)ItemID.SolarFlareDrill, Elements.Fire,
                                                                  (ushort)ItemID.SolarFlareHammer, Elements.Fire,
                                                                  (ushort)ItemID.SolarFlarePickaxe, Elements.Fire,
                                                                  (ushort)ItemID.DayBreak, Elements.Fire,
                                                                  (ushort)ItemID.SolarEruption, Elements.Fire,
                                                                  #endregion fire
                                                                  #region ice
                                                                  (ushort)ItemID.IceBlade, Elements.Ice,
                                                                  (ushort)ItemID.IceBoomerang, Elements.Ice,
                                                                  (ushort)ItemID.IceRod, Elements.Ice,
                                                                  (ushort)ItemID.IceBow, Elements.Ice,
                                                                  (ushort)ItemID.IceSickle, Elements.Ice,
                                                                  (ushort)ItemID.FrostDaggerfish, Elements.Ice,
                                                                  (ushort)ItemID.FrostStaff, Elements.Ice,
                                                                  (ushort)ItemID.Frostbrand, Elements.Ice,
                                                                  (ushort)ItemID.StaffoftheFrostHydra, Elements.Ice,
                                                                  (ushort)ItemID.NorthPole, Elements.Ice,
                                                                  (ushort)ItemID.BlizzardStaff, Elements.Ice,
                                                                  (ushort)ItemID.SnowballCannon, Elements.Ice,
                                                                  (ushort)ItemID.SnowmanCannon, Elements.Ice,
                                                                  #endregion ice
                                                                  #region earth
                                                                  (ushort)ItemID.CrystalBullet, Elements.Earth,
                                                                  (ushort)ItemID.CrystalDart, Elements.Earth,
                                                                  (ushort)ItemID.CrystalSerpent, Elements.Earth,
                                                                  (ushort)ItemID.CrystalStorm, Elements.Earth,
                                                                  (ushort)ItemID.CrystalVileShard, Elements.Earth,
                                                                  (ushort)ItemID.MeteorStaff, Elements.Earth,
                                                                  (ushort)ItemID.Seedler, Elements.Earth,
                                                                  (ushort)ItemID.MushroomSpear, Elements.Earth,
                                                                  (ushort)ItemID.Hammush, Elements.Earth,
                                                                  (ushort)ItemID.StaffofEarth, Elements.Earth,
                                                                  (ushort)ItemID.BladeofGrass, Elements.Earth,
                                                                  (ushort)ItemID.ThornChakram, Elements.Earth,
                                                                  (ushort)ItemID.PoisonStaff, Elements.Earth,
                                                                  (ushort)ItemID.Toxikarp, Elements.Earth,
                                                                  (ushort)ItemID.VenomArrow, Elements.Earth,
                                                                  (ushort)ItemID.VenomBullet, Elements.Earth,
                                                                  (ushort)ItemID.VenomStaff, Elements.Earth,
                                                                  (ushort)ItemID.SpiderStaff, Elements.Earth,
                                                                  (ushort)ItemID.QueenSpiderStaff, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteArrow, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteBullet, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteChainsaw, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteClaymore, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteDrill, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteGreataxe, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteJackhammer, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophytePartisan, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophytePickaxe, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteSaber, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteShotbow, Elements.Earth,
                                                                  (ushort)ItemID.ChlorophyteWarhammer, Elements.Earth);
            #endregion earth
            #endregion vanilla weapon elements
            HelmetGlowMasks      = new Dictionary <int, Texture2D> {
            };
            BreastplateGlowMasks = new Dictionary <int, Texture2D> {
            };
            LeggingGlowMasks     = new Dictionary <int, Texture2D> {
            };
            if (!Main.dedServ)
            {
                OriginExtensions.drawPlayerItemPos = (Func <float, int, Vector2>) typeof(Main).GetMethod("DrawPlayerItemPos", BindingFlags.NonPublic | BindingFlags.Instance).CreateDelegate(typeof(Func <float, int, Vector2>), Main.instance);
                perlinFade0 = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/PerlinFade")), "RedFade");
                //perlinFade0.UseImage("Images/Misc/Perlin");
                perlinFade0.Shader.Parameters["uThreshold0"].SetValue(0.6f);
                perlinFade0.Shader.Parameters["uThreshold1"].SetValue(0.6f);
                blackHoleShade = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/BlackHole")), "BlackHole");

                Filters.Scene["Origins:ZoneDusk"]    = new Filter(new ScreenShaderData(new Ref <Effect>(GetEffect("Effects/BiomeShade")), "VoidShade"), EffectPriority.High);
                Filters.Scene["Origins:ZoneDefiled"] = new Filter(new ScreenShaderData(new Ref <Effect>(GetEffect("Effects/BiomeShade")), "DefiledShade"), EffectPriority.High);
                Filters.Scene["Origins:ZoneRiven"]   = new Filter(new ScreenShaderData(new Ref <Effect>(GetEffect("Effects/BiomeShade")), "RivenShade"), EffectPriority.High);

                solventShader = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/Solvent")), "Dissolve");
                GameShaders.Misc["Origins:Solvent"] = solventShader;
                cellNoiseTexture = GetTexture("Textures/Cell_Noise_Pixel");

                rasterizeShader = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/Rasterize")), "Rasterize");
                GameShaders.Misc["Origins:Rasterize"] = rasterizeShader;
                //Filters.Scene["Origins:ZoneDusk"].GetShader().UseOpacity(0.35f);
                //Ref<Effect> screenRef = new Ref<Effect>(GetEffect("Effects/ScreenDistort")); // The path to the compiled shader file.
                //Filters.Scene["BlackHole"] = new Filter(new ScreenShaderData(screenRef, "BlackHole"), EffectPriority.VeryHigh);
                //Filters.Scene["BlackHole"].Load();
                eyndumCoreUI        = new UserInterface();
                eyndumCoreUITexture = GetTexture("UI/CoreSlot");
                eyndumCoreTexture   = GetTexture("Items/Armor/Eyndum/Eyndum_Breastplate_Body_Core");
            }
            Sounds.Krunch       = AddSound("Sounds/Custom/BurstCannon", SoundType.Item);
            Sounds.HeavyCannon  = AddSound("Sounds/Custom/HeavyCannon", SoundType.Item);
            Sounds.EnergyRipple = AddSound("Sounds/Custom/EnergyRipple", SoundType.Item);
            //OriginExtensions.initClone();
            Music.Dusk                       = MusicID.Eerie;
            Music.Defiled                    = MusicID.Corruption;
            Music.UndergroundDefiled         = MusicID.UndergroundCorruption;
            On.Terraria.NPC.UpdateCollision += (orig, self) => {
                int realID = self.type;
                if (self.modNPC is ISandsharkNPC shark)
                {
                    self.type = NPCID.SandShark;
                    try {
                        shark.PreUpdateCollision();
                        orig(self);
                    } finally {
                        shark.PostUpdateCollision();
                    }
                    self.type = realID;
                    return;
                }
                ITileCollideNPC tcnpc = self.modNPC as ITileCollideNPC;
                self.type = tcnpc?.CollisionType ?? realID;
                orig(self);
                self.type = realID;
            };
            On.Terraria.NPC.GetMeleeCollisionData += NPC_GetMeleeCollisionData;
            On.Terraria.WorldGen.GERunner         += OriginWorld.GERunnerHook;
            On.Terraria.WorldGen.Convert          += OriginWorld.ConvertHook;
            On.Terraria.Item.NewItem_int_int_int_int_int_int_bool_int_bool_bool += OriginGlobalItem.NewItemHook;
            Mod blockSwap = ModLoader.GetMod("BlockSwap");
            if (!(blockSwap is null || blockSwap.Version > new Version(1, 0, 1)))
            {
                On.Terraria.TileObject.CanPlace += (On.Terraria.TileObject.orig_CanPlace orig, int x, int y, int type, int style, int dir, out TileObject objectData, bool onlyCheck, bool checkStay) => {
                    if (type == 20)
                    {
                        Tile soil = Main.tile[x, y + 1];
                        if (soil.active())
                        {
                            TileLoader.SaplingGrowthType(soil.type, ref type, ref style);
                        }
                    }
                    return(orig(x, y, type, style, dir, out objectData, onlyCheck, checkStay));
                }
            }
            ;
            Tiles.Defiled.Defiled_Tree.Load();
            OriginWorld worldInstance = ModContent.GetInstance <OriginWorld>();
            if (!(worldInstance is null))
            {
                worldInstance.defiledResurgenceTiles    = new List <(int, int)> {
                };
                worldInstance.defiledAltResurgenceTiles = new List <(int, int, ushort)> {
                };
            }
            //IL.Terraria.WorldGen.GERunner+=OriginWorld.GERunnerHook;
            On.Terraria.Main.DrawInterface_Resources_Breath += FixedDrawBreath;
            On.Terraria.WorldGen.CountTiles           += WorldGen_CountTiles;
            On.Terraria.WorldGen.AddUpAlignmentCounts += WorldGen_AddUpAlignmentCounts;
            Terraria.IO.WorldFile.OnWorldLoad         += () => {
                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    for (int i = 0; i < Main.maxTilesX; i++)
                    {
                        WorldGen.CountTiles(i);
                    }
                }
            };
            On.Terraria.Lang.GetDryadWorldStatusDialog += Lang_GetDryadWorldStatusDialog;
            HookEndpointManager.Add(typeof(TileLoader).GetMethod("MineDamage", BindingFlags.Public | BindingFlags.Static), (hook_MinePower)MineDamage);
            On.Terraria.Main.DrawPlayer_DrawAllLayers += Main_DrawPlayer_DrawAllLayers;
        }
        /// <summary>
        /// Gets the data for the PaintedNegative shader
        /// </summary>
        /// <returns></returns>
        private static MiscShaderData getNegativeShader()
        {
            MiscShaderData data = GameShaders.Misc["PaintedNegative"];

            return(data);
        }
        /// <summary>
        /// Gets the data for the SprayPainted shader using the provided color
        /// </summary>
        /// <param name="color"></param>
        /// <param name="drawData"></param>
        /// <returns></returns>
        private static MiscShaderData getSprayPaintedShader(Color color)
        {
            MiscShaderData data = GameShaders.Misc["SprayPainted"].UseColor(color).UseImage("Images/Misc/noise").UseOpacity(1f);

            return(data);
        }
Exemple #21
0
 public PlayerTitaniumStormBuffTextureContent()
 {
     _shaderData = new MiscShaderData(Main.PixelShaderRef, "TitaniumStorm");
     _shaderData.UseImage1("Images/Extra_" + (short)156);
 }
        /// <summary>
        /// Gets the data for the GSPainted shader using the provided color
        /// </summary>
        /// <param name="color"></param>
        /// <returns></returns>
        private static MiscShaderData getGSShader(Color color)
        {
            MiscShaderData data = GameShaders.Misc["GSPainted"].UseColor(color).UseOpacity(1f);

            return(data);
        }
        public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
        {
            if (server())
            {
                return(false);
            }
            //TODO: make this function a little more organized
            if (!hasGraphics)
            {
                return(false);
            }
            if (!usesShader)
            {
                Texture2D texture         = Main.projectileTexture[projectile.type];
                Rectangle sourceRectangle = getSourceRectangle(texture);
                Vector2   origin          = (sourceRectangle.Size() / 2) + drawOriginOffset;
                float     scale           = projectile.scale;

                MiscShaderData shader = null;
                if (usesGSShader)
                {
                    shader = getShader(this, getPaintData());
                    if (shader != null)
                    {
                        spriteBatch.End();
                        //using PointClamp instead of LinearClamp here because it messes with the chroma keying of the shader.
                        spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix);                         // SpriteSortMode needs to be set to Immediate for shaders to work.

                        resetBatchInPost = true;
                    }
                }

                for (int i = trailLength; i >= 0; i--)
                {
                    if (i == 1)
                    {
                        continue;
                    }

                    Vector2 projectilePos = (i == 0 ? projectile.Center : projectile.oldPos[i - 1] + (new Vector2(projectile.width / 2f, projectile.height / 2f) * projectile.scale));
                    Vector2 drawPos       = projectilePos - Main.screenPosition + new Vector2(0f, projectile.gfxOffY);

                    float rotation = (i == 0 ? projectile.rotation : projectile.oldRot[i - 1]);

                    float opacity   = projectile.Opacity - (projectile.Opacity / (trailLength + 1)) * i;
                    float lightness = 1f - (.75f / (trailLength + 1)) * i;

                    if (shader != null)
                    {
                        shader.UseOpacity(opacity).Apply();
                    }

                    spriteBatch.Draw(texture, drawPos, sourceRectangle, Color.Multiply(lightColor, lightness), rotation, origin, scale, SpriteEffects.None, 0f);

                    if (shader != null && i > 0)
                    {
                        spriteBatch.End();
                        //using PointClamp instead of LinearClamp here because it messes with the chroma keying of the shader.
                        spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix);                         // SpriteSortMode needs to be set to Immediate for shaders to work.
                    }
                }
            }
            else
            {
                MiscShaderData data = getShader(this, getPaintData());
                if (data != null)
                {
                    spriteBatch.End();
                    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix);                     // SpriteSortMode needs to be set to Immediate for shaders to work.

                    resetBatchInPost = true;
                }

                Texture2D texture         = Main.projectileTexture[projectile.type];
                Rectangle sourceRectangle = getSourceRectangle(texture);
                Vector2   origin          = (sourceRectangle.Size() / 2) + drawOriginOffset;
                float     scale           = projectile.scale;

                for (int i = trailLength; i >= 0; i--)
                {
                    if (i == 1)
                    {
                        continue;
                    }

                    Vector2 projectilePos = (i == 0 ? projectile.Center : projectile.oldPos[i - 1] + (new Vector2(projectile.width / 2f, projectile.height / 2f)));
                    Vector2 drawPos       = projectilePos - Main.screenPosition + new Vector2(0f, projectile.gfxOffY);

                    float rotation = (i == 0 ? projectile.rotation : projectile.oldRot[i - 1]);

                    float op        = projectile.Opacity - (projectile.Opacity / (trailLength + 1)) * i;
                    float lightness = 1f - (.75f / (trailLength + 1)) * i;

                    if (data != null)
                    {
                        data.UseOpacity(op).Apply();
                    }

                    spriteBatch.Draw(texture, drawPos, sourceRectangle, Color.Multiply(lightColor, lightness), rotation, origin, scale, SpriteEffects.None, 0f);

                    if (i > 0 && data != null)
                    {
                        spriteBatch.End();
                        spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix);                         // SpriteSortMode needs to be set to Immediate for shaders to work.
                    }
                }
            }
            return(false);
        }