Pixelated dust variants
* Added the following pixelated variants for their respective ModDust types: * DiamondDustPixelated * SquareDustPixelated * SquashDustPixelated * SquashDustHollowPixelated * SquashDustTileTouchPixelated * UnstableDustPixelated * VoidDustPixelated * VoidDustInvertedPixelated * Added missing documentation comment for the new "pixelate" parameter in GeneralParticleHandler.SpawnParticle.
This commit is contained in:
1 parent
a16bd3ec6e
commit
4b962167cf
11 files changed
+336
-86
No files matched your search
+44
-8
@@ -1,5 +1,7 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -7,7 +9,16 @@ namespace CalamityMod.Dusts
|
||||
{
|
||||
public class DiamondDust : ModDust
|
||||
{
|
||||
public static Asset<Texture2D> GlowDiamond { get; private set; }
|
||||
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
GlowDiamond = ModContent.Request<Texture2D>("CalamityMod/Particles/SquareRotated");
|
||||
}
|
||||
|
||||
public override void OnSpawn(Dust dust)
|
||||
{
|
||||
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
|
||||
@@ -38,26 +49,51 @@ namespace CalamityMod.Dusts
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
|
||||
|
||||
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/SquareRotated").Value;
|
||||
|
||||
// dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash
|
||||
float squashLerp = Utils.GetLerpValue(10, 25, dust.fadeIn, true);
|
||||
Vector2 squash = new Vector2(MathHelper.Lerp(1, 0.3f, squashLerp), MathHelper.Lerp(1, 7f, squashLerp));
|
||||
|
||||
// Glow Orb
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
|
||||
if (!dust.noLight)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha) * (i == 0 ? 1f : 0.7f), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.08f * (i == 0 ? 0.7f : 1), SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha) * (i == 0 ? 1f : 0.7f), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.08f * (i == 0 ? 0.7f : 1), SpriteEffects.None, 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class DiamondDustPixelated : DiamondDust
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void DrawPixelated(Dust dust)
|
||||
{
|
||||
// dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash
|
||||
float squashLerp = Utils.GetLerpValue(10, 25, dust.fadeIn, true);
|
||||
Vector2 squash = new Vector2(MathHelper.Lerp(1, 0.3f, squashLerp), MathHelper.Lerp(1, 7f, squashLerp));
|
||||
|
||||
// Glow Orb
|
||||
Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
|
||||
if (!dust.noLight)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha) * (i == 0 ? 1f : 0.7f), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.08f * (i == 0 ? 0.7f : 1), SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
-13
@@ -11,9 +11,9 @@ namespace CalamityMod.Dusts
|
||||
{
|
||||
public class LightDust : ModDust
|
||||
{
|
||||
public static Asset<Texture2D> SolidCircle;
|
||||
public static Asset<Texture2D> SolidCircle { get; private set; }
|
||||
|
||||
public static Asset<Texture2D> BloomCircle;
|
||||
public static Asset<Texture2D> BloomCircle { get; private set; }
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
@@ -47,15 +47,12 @@ namespace CalamityMod.Dusts
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
|
||||
|
||||
// Glow Orb
|
||||
Main.EntitySpriteDraw(BloomCircle.Value, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.EntitySpriteDraw(BloomCircle.Value, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
|
||||
if (!dust.noLight)
|
||||
Main.EntitySpriteDraw(SolidCircle.Value, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
|
||||
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -72,14 +69,12 @@ namespace CalamityMod.Dusts
|
||||
|
||||
private static void DrawPixelated(Dust dust)
|
||||
{
|
||||
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
|
||||
|
||||
// Glow Orb
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
|
||||
if (!dust.noLight)
|
||||
Main.spriteBatch.Draw(SolidCircle.Value, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
-7
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -8,7 +10,16 @@ namespace CalamityMod.Dusts
|
||||
{
|
||||
public class SquareDust : ModDust
|
||||
{
|
||||
public static Asset<Texture2D> GlowSquare { get; private set; }
|
||||
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
GlowSquare = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSquareParticleThick");
|
||||
}
|
||||
|
||||
public override void OnSpawn(Dust dust)
|
||||
{
|
||||
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
|
||||
@@ -42,22 +53,44 @@ namespace CalamityMod.Dusts
|
||||
}
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
|
||||
|
||||
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSquareParticleThick").Value;
|
||||
|
||||
Vector2 squash = Vector2.One;
|
||||
|
||||
// Glow Orb
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0f);
|
||||
if (dust.alpha < 1)
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.095f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.095f, SpriteEffects.None, 0f);
|
||||
if (!dust.noLight)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class SquareDustPixelated : SquareDust
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts);
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void DrawPixelated(Dust dust)
|
||||
{
|
||||
Vector2 squash = Vector2.One;
|
||||
|
||||
// Glow Orb
|
||||
Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0f);
|
||||
if (dust.alpha < 1)
|
||||
Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.095f, SpriteEffects.None, 0f);
|
||||
if (!dust.noLight)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+46
-9
@@ -1,5 +1,7 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -7,7 +9,21 @@ namespace CalamityMod.Dusts
|
||||
{
|
||||
public class SquashDust : ModDust
|
||||
{
|
||||
public static Asset<Texture2D> SolidCircle { get; private set; }
|
||||
|
||||
public static Asset<Texture2D> BloomCircle { get; private set; }
|
||||
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
SolidCircle = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle");
|
||||
BloomCircle = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
|
||||
}
|
||||
|
||||
public override void OnSpawn(Dust dust)
|
||||
{
|
||||
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
|
||||
@@ -37,24 +53,45 @@ namespace CalamityMod.Dusts
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
|
||||
Texture2D solidCenter = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
|
||||
|
||||
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
|
||||
Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f));
|
||||
|
||||
// Glow Orb
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0);
|
||||
if (!dust.noLight)
|
||||
{
|
||||
Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class SquashDustPixelated : SquashDust
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts);
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void DrawPixelated(Dust dust)
|
||||
{
|
||||
Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f));
|
||||
|
||||
// Glow Orb
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0);
|
||||
if (!dust.noLight)
|
||||
{
|
||||
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -7,7 +9,16 @@ namespace CalamityMod.Dusts
|
||||
{
|
||||
public class SquashDustHollow : ModDust
|
||||
{
|
||||
public static Asset<Texture2D> BloomRing { get; private set; }
|
||||
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
BloomRing = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomRing");
|
||||
}
|
||||
|
||||
public override void OnSpawn(Dust dust)
|
||||
{
|
||||
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
|
||||
@@ -36,25 +47,49 @@ namespace CalamityMod.Dusts
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
|
||||
|
||||
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomRing").Value;
|
||||
|
||||
// dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash
|
||||
Vector2 squash = Vector2.Lerp(new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)), Vector2.One, dust.fadeIn);
|
||||
|
||||
// Glow Orb
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
|
||||
Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
|
||||
if (!dust.noLight)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class SquashDustHollowPixelated : SquashDustHollow
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts);
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void DrawPixelated(Dust dust)
|
||||
{
|
||||
// dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash
|
||||
Vector2 squash = Vector2.Lerp(new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)), Vector2.One, dust.fadeIn);
|
||||
|
||||
// Glow Orb
|
||||
Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
|
||||
if (!dust.noLight)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Dusts
|
||||
{
|
||||
public class SquashDustTileTouch : ModDust
|
||||
public class SquashDustTileTouch : SquashDust
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void OnSpawn(Dust dust)
|
||||
{
|
||||
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
|
||||
@@ -16,12 +18,14 @@ namespace CalamityMod.Dusts
|
||||
public override bool Update(Dust dust)
|
||||
{
|
||||
bool touchedTiles = false;
|
||||
int size = (int)(2);
|
||||
int size = 2;
|
||||
|
||||
if (Collision.SolidCollision(dust.position, size, size))
|
||||
{
|
||||
touchedTiles = true;
|
||||
dust.velocity = Vector2.Zero;
|
||||
}
|
||||
|
||||
float fadeSpeed = (dust.fadeIn + 1); // For this dust, fadeIn is used to increase the power of gravity if it's active, otherwise it makes it's lifetime change
|
||||
dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
dust.velocity *= 0.96f;
|
||||
@@ -45,24 +49,30 @@ namespace CalamityMod.Dusts
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class SquashDustTileTouchPixelated : SquashDustTileTouch
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
|
||||
Texture2D solidCenter = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
|
||||
|
||||
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts);
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void DrawPixelated(Dust dust)
|
||||
{
|
||||
Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f));
|
||||
|
||||
// Glow Orb
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0);
|
||||
if (!dust.noLight)
|
||||
{
|
||||
Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
-7
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -8,7 +10,16 @@ namespace CalamityMod.Dusts
|
||||
{
|
||||
public class UnstableDust : ModDust
|
||||
{
|
||||
public static Asset<Texture2D> GlowStar { get; private set; }
|
||||
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
GlowStar = ModContent.Request<Texture2D>("CalamityMod/Particles/FullStar");
|
||||
}
|
||||
|
||||
public override void OnSpawn(Dust dust)
|
||||
{
|
||||
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
|
||||
@@ -41,23 +52,45 @@ namespace CalamityMod.Dusts
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
|
||||
|
||||
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/FullStar").Value;
|
||||
|
||||
Vector2 squash = new Vector2(0.4f, 1);
|
||||
float texScaling = 6;
|
||||
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f * texScaling, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.1f * texScaling, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f * texScaling, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.04f * texScaling, SpriteEffects.None, 0);
|
||||
if (!dust.noLight)
|
||||
{
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.025f * texScaling, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.025f * texScaling, SpriteEffects.None, 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class UnstableDustPixelated : UnstableDust
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts);
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void DrawPixelated(Dust dust)
|
||||
{
|
||||
Vector2 squash = new Vector2(0.4f, 1);
|
||||
float texScaling = 6;
|
||||
|
||||
Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.1f * texScaling, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.04f * texScaling, SpriteEffects.None, 0);
|
||||
if (!dust.noLight)
|
||||
{
|
||||
Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.025f * texScaling, SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+43
-6
@@ -1,6 +1,9 @@
|
||||
using System;
|
||||
using CalamityMod.Enums;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -8,6 +11,19 @@ namespace CalamityMod.Dusts
|
||||
{
|
||||
public class VoidDust : ModDust
|
||||
{
|
||||
public static Asset<Texture2D> SolidCircle { get; private set; }
|
||||
|
||||
public static Asset<Texture2D> BloomCircle { get; private set; }
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
SolidCircle = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle");
|
||||
BloomCircle = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
|
||||
}
|
||||
|
||||
public override void OnSpawn(Dust dust)
|
||||
{
|
||||
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
|
||||
@@ -28,20 +44,41 @@ namespace CalamityMod.Dusts
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
|
||||
Texture2D solidCenter = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
|
||||
if (!dust.noLight)
|
||||
{
|
||||
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
// Glow Orb
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
|
||||
}
|
||||
Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class VoidDustPixelated : VoidDust
|
||||
{
|
||||
public override string Texture => "CalamityMod/Dusts/VoidDust";
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), GeneralDrawLayer.AfterDusts);
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void DrawPixelated(Dust dust)
|
||||
{
|
||||
if (!dust.noLight)
|
||||
{
|
||||
// Glow Orb
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
|
||||
}
|
||||
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
+46
-11
@@ -1,6 +1,9 @@
|
||||
using System;
|
||||
using CalamityMod.Enums;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -8,6 +11,22 @@ namespace CalamityMod.Dusts
|
||||
{
|
||||
public class VoidDustInverted : ModDust
|
||||
{
|
||||
public static Asset<Texture2D> SolidCircle { get; private set; }
|
||||
|
||||
public static Asset<Texture2D> BloomCircle { get; private set; }
|
||||
|
||||
public static Asset<Texture2D> SmallBloomCircle { get; private set; }
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
SolidCircle = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle");
|
||||
BloomCircle = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
|
||||
SmallBloomCircle = ModContent.Request<Texture2D>("CalamityMod/Particles/SmallBloom");
|
||||
}
|
||||
|
||||
public override void OnSpawn(Dust dust)
|
||||
{
|
||||
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
|
||||
@@ -28,23 +47,39 @@ namespace CalamityMod.Dusts
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
|
||||
|
||||
Texture2D solidCenter = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
|
||||
Texture2D bloom2 = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
|
||||
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/SmallBloom").Value;
|
||||
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Black * 0.4f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.068f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(SmallBloomCircle.Value, dust.position - Main.screenPosition, null, Color.Black * 0.4f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SmallBloomCircle.Size() * 0.5f, dust.scale * 0.068f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.057f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(SmallBloomCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SmallBloomCircle.Size() * 0.5f, dust.scale * 0.057f, SpriteEffects.None, 0);
|
||||
|
||||
Main.EntitySpriteDraw(bloom2, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom2.Size() * 0.5f, dust.scale * 0.07f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.07f, SpriteEffects.None, 0);
|
||||
if (!dust.noLight)
|
||||
Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.75f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.75f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class VoidDustInvertedPixelated : VoidDustInverted
|
||||
{
|
||||
public override string Texture => "CalamityMod/Dusts/VoidDustInverted";
|
||||
|
||||
public override bool PreDraw(Dust dust)
|
||||
{
|
||||
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), GeneralDrawLayer.AfterDusts);
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void DrawPixelated(Dust dust)
|
||||
{
|
||||
Main.spriteBatch.Draw(SmallBloomCircle.Value, dust.position - Main.screenPosition, null, Color.Black * 0.4f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SmallBloomCircle.Size() * 0.5f, dust.scale * 0.068f, SpriteEffects.None, 0);
|
||||
if (dust.alpha < 1)
|
||||
Main.spriteBatch.Draw(SmallBloomCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SmallBloomCircle.Size() * 0.5f, dust.scale * 0.057f, SpriteEffects.None, 0);
|
||||
|
||||
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.07f, SpriteEffects.None, 0);
|
||||
if (!dust.noLight)
|
||||
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.75f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,15 +57,13 @@ namespace CalamityMod.Particles
|
||||
/// </summary>
|
||||
internal static Dictionary<int, Texture2D> particleTexturesByIDs;
|
||||
|
||||
/// <summary>
|
||||
/// All <see cref="ParticleAutoDrawingOverride"/> types defined across all mods, identified by the type of the particle the drawers target.
|
||||
/// </summary>
|
||||
internal static Dictionary<Type, ParticleAutoDrawingOverride> particleAutoDrawingOverrides;
|
||||
private static Dictionary<Type, ParticleAutoDrawingOverride> particleAutoDrawingOverrides;
|
||||
|
||||
private static List<Particle> activeParticles;
|
||||
private static List<Particle> particlesToKill;
|
||||
private static Dictionary<GeneralDrawLayer, Queue<Particle>> particlesToSpawnNextFrame;
|
||||
private static Dictionary<GeneralDrawLayer, Queue<Particle>> particlesToSpawnNextFrame_Pixelated;
|
||||
|
||||
private static Dictionary<BlendState, List<Particle>> particlesToDraw;
|
||||
private static Dictionary<BlendState, List<Particle>> particlesToDraw_Pixelated;
|
||||
#endregion
|
||||
@@ -166,6 +164,7 @@ namespace CalamityMod.Particles
|
||||
/// <summary>
|
||||
/// Spawns the particle instance provided into the world. If the particle limit is reached but the particle is marked as important, it will try to replace a non important particle.
|
||||
/// </summary>
|
||||
/// <param name="pixelate">Set to true to force the particle being spawned to be drawn pixelated.</param>
|
||||
/// <param name="manualDrawLayerOverride">Only set this to a non-null value if you'd like to manually override the draw layer of the particle instance you are spawning.</param>
|
||||
public static void SpawnParticle(Particle particle, bool pixelate = false, GeneralDrawLayer? manualDrawLayerOverride = null)
|
||||
{
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace CalamityMod.Systems.Graphic.PixelationSystem
|
||||
{
|
||||
blendStateTargetPair.Value.SwapTo();
|
||||
|
||||
Main.spriteBatch.Begin(default, blendStateTargetPair.Key, SamplerState.LinearClamp, default, default, null, pixelationMatrix);
|
||||
Main.spriteBatch.Begin(default, blendStateTargetPair.Key, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, pixelationMatrix);
|
||||
|
||||
// Select only drawers who match this target's BlendState.
|
||||
var drawersByBlendState = drawerCollection.Where(d => d.DefaultBlendState == blendStateTargetPair.Key).ToList();
|
||||
@@ -236,7 +236,7 @@ namespace CalamityMod.Systems.Graphic.PixelationSystem
|
||||
foreach (var keyValuePair in targetCollection)
|
||||
{
|
||||
Main.spriteBatch.TryEnd();
|
||||
Main.spriteBatch.TryBegin(SpriteSortMode.Deferred, keyValuePair.Key, Main.DefaultSamplerState, default, default, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
Main.spriteBatch.TryBegin(default, keyValuePair.Key, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
float targetScale = 1f / PixelationResolution;
|
||||
Main.spriteBatch.Draw(keyValuePair.Value, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, targetScale, SpriteEffects.None, 0f);
|
||||
|
||||
Reference in new issue
Block a user