+ Improved DoG Death Dissolve (note: DoGDeathAnimationRenderer can be removed)
This commit is contained in:
1 parent
b0969eae62
commit
770efcea10
9 files changed
+171
-23
No files matched your search
@@ -252,6 +252,7 @@ namespace CalamityMod.Effects
|
||||
|
||||
#region Big E's Shaders
|
||||
internal static Asset<Effect> SeaPrismColorBlendingShader;
|
||||
internal static Asset<Effect> Dissolve;
|
||||
#endregion
|
||||
|
||||
internal static Asset<Effect> SunkenSeaMenuLogoWater;
|
||||
@@ -499,6 +500,9 @@ namespace CalamityMod.Effects
|
||||
#region Loading Big E's Shaders
|
||||
SeaPrismColorBlendingShader = LoadShader("SeaPrismColorBlending");
|
||||
RegisterMiscShader(SeaPrismColorBlendingShader, "SeaPrismBlendingPass", "SeaPrismColorBlending");
|
||||
|
||||
Dissolve = LoadShader("Dissolve");
|
||||
RegisterMiscShader(Dissolve, "DissolvePass", "Dissolve");
|
||||
#endregion
|
||||
|
||||
SunkenSeaMenuLogoWater = LoadShader("UI/SunkenSeaMenuLogoWater");
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
sampler baseTexture : register(s0);
|
||||
sampler noiseTexture : register(s1);
|
||||
|
||||
float noiseScale;
|
||||
float dissolveIntensity;
|
||||
float2 sampleOffset;
|
||||
float4 transitionColor;
|
||||
float transitionOffset;
|
||||
|
||||
float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR
|
||||
{
|
||||
float4 color = tex2D(baseTexture, coords) * sampleColor;
|
||||
|
||||
// Sample noise texture for dithering
|
||||
float noise = tex2D(noiseTexture, (coords * noiseScale) + sampleOffset).r;
|
||||
|
||||
if (dissolveIntensity > noise)
|
||||
{
|
||||
if (dissolveIntensity - transitionOffset < noise)
|
||||
{
|
||||
float a = color.a;
|
||||
color = transitionColor;
|
||||
color.a = a;
|
||||
}
|
||||
else
|
||||
color.a = 0;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
technique Technique1
|
||||
{
|
||||
pass DissolvePass
|
||||
{
|
||||
PixelShader = compile ps_2_0 PixelShaderFunction();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,10 +1,13 @@
|
||||
using CalamityMod.Enums;
|
||||
using System;
|
||||
using CalamityMod.Enums;
|
||||
using CalamityMod.NPCs;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Graphics.Renderers.CalamityRenderers
|
||||
{
|
||||
@@ -21,10 +24,12 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
|
||||
|
||||
public override GeneralDrawLayer Layer => GeneralDrawLayer.AfterNPCs;
|
||||
|
||||
public override bool ShouldDraw => !Main.gameMenu && CalamityDrawParameterNPC.DoGDeathAnimationTimer > 0;
|
||||
public override bool ShouldDraw => false;//!Main.gameMenu && CalamityDrawParameterNPC.DoGDeathAnimationTimer > 0;
|
||||
|
||||
public static bool ValidToDraw(NPC npc)
|
||||
{
|
||||
return false;
|
||||
/*
|
||||
// Do not draw inactive npcs, or ones with weird MP types less than or equal to 0.
|
||||
if (!npc.active || npc.type <= NPCID.None)
|
||||
return false;
|
||||
@@ -33,6 +38,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
|
||||
return false;
|
||||
|
||||
return true;
|
||||
*/
|
||||
}
|
||||
|
||||
public override void DrawToTarget(SpriteBatch spriteBatch)
|
||||
@@ -59,20 +65,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers
|
||||
|
||||
public override void DrawTarget(SpriteBatch spriteBatch)
|
||||
{
|
||||
var disintegrationShader = GameShaders.Misc["CalamityMod:DoGDisintegration"].Shader;
|
||||
Vector2 screenSize = new(Main.screenWidth, Main.screenHeight);
|
||||
Vector2 worldPosition = Main.screenPosition / MainTarget.Size;
|
||||
float disintegrationProgress = CalamityDrawParameterNPC.DoGDeathAnimationTimer / 600f;
|
||||
|
||||
disintegrationShader.Parameters["disintegrationProgress"].SetValue(disintegrationProgress);
|
||||
disintegrationShader.Parameters["disintegrationScale"].SetValue(1.75f);
|
||||
disintegrationShader.Parameters["worldPosition"].SetValue(new Vector2(worldPosition.X, worldPosition.Y));
|
||||
disintegrationShader.Parameters["pixelSize"].SetValue(screenSize * 0.5f);
|
||||
|
||||
Main.instance.GraphicsDevice.Textures[1] = Main.Assets.Request<Texture2D>("Images/Misc/Perlin").Value;
|
||||
Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap;
|
||||
|
||||
disintegrationShader.Techniques[0].Passes[0].Apply();
|
||||
|
||||
spriteBatch.Draw(MainTarget, Vector2.Zero, Color.White);
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
@@ -47,7 +47,7 @@ Phases:
|
||||
|
||||
{
|
||||
"Lines": [
|
||||
"[Shaking:[Scale(1.5):[Colors(2, 0.5, 00FFFF, FF00FF):A GOD DOES NOT FEAR DEATH!]]]"
|
||||
"[Colors(2, 0.5, 00FFFF, FF00FF):[Shaking:[Scale(1.5):A]]][Colors(2, 0.5, FF00FF, 00FFFF):[Shaking(5):[Scale(2): [Pause(0.33)]GOD]]][Colors(2, 0.5, 00FFFF, FF00FF):[Shaking:[Scale(1.5): DOES NOT FEAR]]][Colors(2, 0.5, FF00FF, 00FFFF):[Shaking(5):[Scale(2): [Pause(0.33)]DEATH!]]]"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -58,6 +58,7 @@ Death:
|
||||
{
|
||||
"DefaultColor": "6383FF",
|
||||
"DefaultSpeaker": "DevourerOfGods",
|
||||
"AlignType": 1,
|
||||
|
||||
"TextDelay": 2,
|
||||
"BasePunctuationDelay": {
|
||||
@@ -119,6 +120,7 @@ Head:
|
||||
{
|
||||
"DefaultColor": "6383FF",
|
||||
"DefaultSpeaker": "DevourerOfGods",
|
||||
"AlignType": 1,
|
||||
|
||||
"TextDelay": 2,
|
||||
"BasePunctuationDelay": {
|
||||
@@ -230,6 +232,7 @@ Running:
|
||||
{
|
||||
"DefaultColor": "6383FF",
|
||||
"DefaultSpeaker": "DevourerOfGods",
|
||||
"AlignType": 1,
|
||||
|
||||
"TextDelay": 2,
|
||||
"BasePunctuationDelay": {
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Projectiles.Melee.Yoyos;
|
||||
using CalamityMod.Utilities.Daybreak;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
@@ -269,6 +271,8 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
segmentVelocity *= 1.1f;
|
||||
}
|
||||
|
||||
Vector2 noiseOffset = Vector2.Zero;
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
if (NPC.realLife < 0 || NPC.realLife >= Main.maxNPCs || Main.npc[NPC.realLife] is null)
|
||||
@@ -276,6 +280,32 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (Main.npc[NPC.realLife].type != ModContent.NPCType<DevourerofGodsHead>())
|
||||
return true;
|
||||
|
||||
bool shouldUseShader = CalamityDrawParameterNPC.DoGDeathAnimationTimer != 0;
|
||||
SpriteBatchSnapshot snap = new(spriteBatch);
|
||||
|
||||
if (shouldUseShader)
|
||||
{
|
||||
if (noiseOffset == Vector2.zeroVector)
|
||||
noiseOffset = NPC.Center;
|
||||
|
||||
Main.spriteBatch.End(out snap);
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix);
|
||||
|
||||
MiscShaderData dissolveShader = GameShaders.Misc["CalamityMod:Dissolve"];
|
||||
Texture2D dissolveTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/HarshNoise").Value;
|
||||
|
||||
dissolveShader.Shader.Parameters["noiseScale"].SetValue(0.25f);
|
||||
dissolveShader.Shader.Parameters["dissolveIntensity"].SetValue(CalamityDrawParameterNPC.DoGDeathAnimationTimer / 600f);
|
||||
dissolveShader.Shader.Parameters["sampleOffset"].SetValue(noiseOffset * 0.5f);
|
||||
dissolveShader.Shader.Parameters["transitionColor"].SetValue(DevourerofGodsHead.SpecialMoveColor.ToVector4());
|
||||
dissolveShader.Shader.Parameters["transitionOffset"].SetValue(0.05f);
|
||||
|
||||
Main.instance.GraphicsDevice.Textures[1] = dissolveTexture;
|
||||
Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap;
|
||||
|
||||
dissolveShader.Apply();
|
||||
}
|
||||
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (NPC.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
@@ -304,6 +334,12 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor2, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
if (shouldUseShader)
|
||||
{
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(snap);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ using Terraria.GameContent;
|
||||
using Terraria.GameContent.Bestiary;
|
||||
using Terraria.GameContent.Events;
|
||||
using Terraria.GameContent.ItemDropRules;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -2436,6 +2437,8 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
return realSpot;
|
||||
}
|
||||
|
||||
Vector2 noiseOffset = Vector2.Zero;
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
bool actuallyInPhaseTwo = (Phase2Started && NPC.localAI[2] <= 60f);
|
||||
@@ -2451,6 +2454,32 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, TextureP2_Full.Value, DevourerofGodsBody.TextureP2.Value, 4, 26, 0.5f, new Vector2(30, 10), 2, 20);
|
||||
}
|
||||
|
||||
bool shouldUseShader = CalamityDrawParameterNPC.DoGDeathAnimationTimer != 0;
|
||||
SpriteBatchSnapshot snap = new(spriteBatch);
|
||||
|
||||
if (shouldUseShader)
|
||||
{
|
||||
if (noiseOffset == Vector2.zeroVector)
|
||||
noiseOffset = NPC.Center;
|
||||
|
||||
Main.spriteBatch.End(out snap);
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix);
|
||||
|
||||
MiscShaderData dissolveShader = GameShaders.Misc["CalamityMod:Dissolve"];
|
||||
Texture2D dissolveTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/HarshNoise").Value;
|
||||
|
||||
dissolveShader.Shader.Parameters["noiseScale"].SetValue(0.5f);
|
||||
dissolveShader.Shader.Parameters["dissolveIntensity"].SetValue(CalamityDrawParameterNPC.DoGDeathAnimationTimer / 600f);
|
||||
dissolveShader.Shader.Parameters["sampleOffset"].SetValue(noiseOffset * 0.5f);
|
||||
dissolveShader.Shader.Parameters["transitionColor"].SetValue(SpecialMoveColor.ToVector4());
|
||||
dissolveShader.Shader.Parameters["transitionOffset"].SetValue(0.05f);
|
||||
|
||||
Main.instance.GraphicsDevice.Textures[1] = dissolveTexture;
|
||||
Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap;
|
||||
|
||||
dissolveShader.Apply();
|
||||
}
|
||||
|
||||
SpriteEffects spriteEffects = (NPC.spriteDirection == 1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
Vector2 halfSizeTexture = mainTexture.Size() * 0.5f;
|
||||
|
||||
@@ -2500,6 +2529,12 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f);
|
||||
spriteBatch.Draw(mainGlowTexture, drawPosition, NPC.frame, NPC.GetAlpha(glowmaskColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
if (shouldUseShader)
|
||||
{
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(snap);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Projectiles.Melee.Yoyos;
|
||||
using CalamityMod.Utilities.Daybreak;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -9,6 +10,7 @@ using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
@@ -291,6 +293,8 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
segmentVelocity *= 1.1f;
|
||||
}
|
||||
|
||||
Vector2 noiseOffset = Vector2.Zero;
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
if (NPC.realLife < 0 || NPC.realLife >= Main.maxNPCs || Main.npc[NPC.realLife] is null)
|
||||
@@ -298,6 +302,32 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (Main.npc[NPC.realLife].type != ModContent.NPCType<DevourerofGodsHead>())
|
||||
return true;
|
||||
|
||||
bool shouldUseShader = CalamityDrawParameterNPC.DoGDeathAnimationTimer != 0;
|
||||
SpriteBatchSnapshot snap = new(spriteBatch);
|
||||
|
||||
if (shouldUseShader)
|
||||
{
|
||||
if (noiseOffset == Vector2.zeroVector)
|
||||
noiseOffset = NPC.Center;
|
||||
|
||||
Main.spriteBatch.End(out snap);
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.ZoomMatrix);
|
||||
|
||||
MiscShaderData dissolveShader = GameShaders.Misc["CalamityMod:Dissolve"];
|
||||
Texture2D dissolveTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/HarshNoise").Value;
|
||||
|
||||
dissolveShader.Shader.Parameters["noiseScale"].SetValue(1f);
|
||||
dissolveShader.Shader.Parameters["dissolveIntensity"].SetValue(CalamityDrawParameterNPC.DoGDeathAnimationTimer / 600f);
|
||||
dissolveShader.Shader.Parameters["sampleOffset"].SetValue(noiseOffset * 0.5f);
|
||||
dissolveShader.Shader.Parameters["transitionColor"].SetValue(DevourerofGodsHead.SpecialMoveColor.ToVector4());
|
||||
dissolveShader.Shader.Parameters["transitionOffset"].SetValue(0.05f);
|
||||
|
||||
Main.instance.GraphicsDevice.Textures[1] = dissolveTexture;
|
||||
Main.instance.GraphicsDevice.SamplerStates[1] = SamplerState.LinearWrap;
|
||||
|
||||
dissolveShader.Apply();
|
||||
}
|
||||
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (NPC.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
@@ -326,6 +356,12 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
if (shouldUseShader)
|
||||
{
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(snap);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,14 +15,17 @@ namespace CalamityMod.UI.DialogueDisplay.DisplayEffects
|
||||
Vector2 playerPos = Main.LocalPlayer.Center;
|
||||
Vector2 halfSize = textSize * 0.5f;
|
||||
Vector2 newPos = playerPos - halfSize + (Vector2.UnitY * (textSize.Y + 54));
|
||||
|
||||
Vector2 toBoss = (startPos - newPos);
|
||||
float dist = MathHelper.Clamp(toBoss.Length() / 100f, 0f, 36);
|
||||
toBoss = toBoss.SafeNormalize(Vector2.zeroVector);
|
||||
|
||||
return newPos + (toBoss * dist);
|
||||
return newPos;
|
||||
}
|
||||
|
||||
float OffsetDisappearTime(float time, float ratio) => MathHelper.Clamp((time - (ratio * TimeToDisappear / 2f)) / (TimeToDisappear / 2f), 0f, 1f);
|
||||
|
||||
public override Vector2 DisappearPositioning(Vector2 startPos, float time, DialogueCharacterData charData) => Vector2.Lerp(startPos, startPos + (Vector2.unitXVector * 12 * charData.Scale), CalamityUtils.SineOutEasing(OffsetDisappearTime(time, charData.CompletionRatio), 1));
|
||||
|
||||
public override float DisappearOpacity(float startOpacity, float time, DialogueCharacterData charData) => 1 - CalamityUtils.SineOutEasing(OffsetDisappearTime(time, charData.CompletionRatio), 1);
|
||||
|
||||
public override Vector2 DisappearScale(Vector2 startScale, float time, DialogueCharacterData charData) => Vector2.Lerp(startScale, startScale * 0.75f, CalamityUtils.ExpOutEasing(OffsetDisappearTime(time, charData.CompletionRatio), 1));
|
||||
|
||||
public override void PreDraw(SpriteBatch spriteBatch, Vector2 textStart, Vector2 textSize, int textTimer, int switchTimer)
|
||||
{
|
||||
if (textTimer < 0)
|
||||
|
||||
Reference in new issue
Block a user