Files
CalamityModPublic/Skies/DoGScreenShaderData.cs
fryzahh 10fcee19a0 DoGSky full revamp
- Entirely revamped DoGSky and cleaned up some of its older code
- - Moved DoGSky and DoGShaderData from CalamityMod/NPCs/DevourerofGods to CalamityMod/Skies
- - Added three new shaders which are used in the new sky, DoGDistortionWindsShader, DoGBackgroundFogShader and CircularOpacityShader
- - Removed MonolithDistortionScene and adjusted DoGBackgroundScene to account for both monoliths when activating background visuals
- - Added a new field to PrimitiveSettings which allows primitives to render with the same unscaled perspective matrices used for pixelating them. This was a necessary addition as the new DoGSky utilizes the primitive drawing system for a special visual effect and wasn't scaling correctly with the rest of the background due to the normal perspective matrices for primitives using the game's zoom setting to scale them accordingly. Backgrounds and any associated effects do not scale with zoom, for further context.
2025-06-30 18:17:39 -04:00

64 lines
1.8 KiB
C#

using CalamityMod.NPCs.DevourerofGods;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ModLoader;
namespace CalamityMod.Skies
{
public class DoGScreenShaderData : ScreenShaderData
{
private int DoGIndex;
public DoGScreenShaderData(string passName)
: base(passName)
{
}
private void UpdateDoGIndex()
{
var DoGType = ModContent.NPCType<DevourerofGodsHead>();
if (DoGIndex >= 0 && Main.npc[DoGIndex].active && Main.npc[DoGIndex].type == DoGType)
{
return;
}
DoGIndex = -1;
foreach (var n in Main.ActiveNPCs)
{
if (n.type == DoGType)
{
DoGIndex = n.whoAmI;
break;
}
}
}
public override void Update(GameTime gameTime)
{
if (DoGIndex == -1)
{
UpdateDoGIndex();
if (DoGIndex == -1 && Main.LocalPlayer.Calamity().monolithDevourerPShader <= 0 && Main.LocalPlayer.Calamity().monolithDevourerBShader <= 0)
Filters.Scene["CalamityMod:DevourerofGodsHead"].Deactivate();
}
}
public override void Apply()
{
UpdateDoGIndex();
if (DoGIndex != -1)
{
UseTargetPosition(Main.npc[DoGIndex].Center);
}
else if (Main.LocalPlayer.Calamity().monolithDevourerPShader > 0 || Main.LocalPlayer.Calamity().monolithDevourerBShader > 0)
{
UseTargetPosition(Main.LocalPlayer.Center);
}
UseColor(DoGSky.DoGSkyColor);
base.Apply();
}
}
}