IT MOOOOVVVVVVEEEEEEESSSSS

* Horrible Hog is now animated
* Added a separate sprite for Horrible Hog's balled up form since RotateSprite only works properly with square sprites
This commit is contained in:
fryzahh committed 2026-06-04 00:23:51 -04:00
1 parent 08e5887658
commit d8bf3bca62
7 files changed
+197 -21

No files matched your search

+3 -1
View File
@@ -1,5 +1,7 @@
sampler baseTexture : register(s0);
float rotation; // The rotation of the sprite.
float rotation; // The rotation of the sprite.
float2 spriteDimensions; // Dimensions of the sprite.
float4 spriteRectangle; // For use with animated sprites.
float realCos(float value)
{
Binary file not shown.
@@ -93,6 +93,9 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
float idealRotation = (NPC.velocity.Y != 0f) ? NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi) : 0f;
NPC.rotation = idealRotation;
int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, ChasePlayer_MaxSpeed, 9, 3, true);
Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true);
}
public void MainBehavior_HogCharge(Player target)
@@ -110,6 +113,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.velocity.X -= backupSpeed * NPC.direction;
}
Animate(MinFrame_Walking, MaxFrame_Walking, 7, true, dynamicChanges: true);
NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt();
}
@@ -145,6 +149,8 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
AfterimageTrailOpacity = MathHelper.Lerp(AfterimageTrailOpacity, 0f, 0.15f);
if (Timer == -10 && !finishedWithCharges)
DoEyeGlintEffect(0.4f);
FrameY = 20;
}
else
{
@@ -203,6 +209,9 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
}
}
int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, maxSpeed, 6, 2, true);
Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true);
NPC.damage = 0;
NPC.rotation = 0f;
}
@@ -234,6 +243,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.velocity.Y = -JumpAndDash_MaxJumpHeight * 1.2f;
NPC.velocity.X += JumpAndDash_MaxDashSpeed * 0.4f * NPC.direction;
DoJumpEffects();
UseBalledSprite = true;
}
if (Timer <= HogCharge_PreDashTime)
@@ -259,6 +269,8 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.noGravity = true;
NPC.velocity = NPC.SafeDirectionTo(LastPlayerPosition) * JumpAndDash_MaxDashSpeed;
UseBalledSprite = false;
FrameY = JumpFrame;
SetSquashVectors(new Vector2(1.12f, 0.96f));
SpriteRotation = 0f;
NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi);
@@ -280,6 +292,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
Collision.HitTiles(NPC.position, NPC.velocity, NPC.width, NPC.height);
SoundEngine.PlaySound(GroundImpactSound, NPC.Center);
UseBalledSprite = true;
NPC.velocity.X = NPC.DirectionFrom(target.Center).SafeNormalize(Vector2.UnitX).X * 3f;
NPC.velocity.Y = -10f;
LocalAIState = 3f;
@@ -289,12 +302,15 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.noGravity = true;
NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi);
FrameY = JumpFrame;
}
if (Timer >= HogCharge_PreDashTime + HogCharge_DashTime)
{
if (NPC.velocity.Y == 0f)
{
UseBalledSprite = false;
FrameY = IdleFrame;
SetSquashVectors();
LocalAIState = 3f;
Timer = 0f;
@@ -304,6 +320,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.GravityMultiplier *= 3f;
NPC.velocity.X *= 0.95f;
SpriteRotation = 0f;
UseBalledSprite = true;
}
SetSquashVectors(VelocityBasedSquashNStretch);
@@ -334,7 +351,11 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
float interpolant = Utils.GetLerpValue(preJumpVisualsTime, VomitBarrage_PreJumpTime, Timer, true);
HorizontalShakeStrength = MathHelper.Lerp(0f, 6f, interpolant);
SetSquashVectors(new Vector2(1.24f, 0.84f));
FrameY = BalledUpFrame;
}
int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, ChasePlayer_MaxSpeed, 8, 2, true);
Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true);
}
if (Timer == JumpAndDash_PreJumpTime)
@@ -343,6 +364,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.velocity.X += JumpAndDash_MaxDashSpeed * 0.2f * NPC.direction;
DoJumpEffects();
UseBalledSprite = true;
SetSquashVectors(new Vector2(0.84f, 1.14f));
HorizontalShakeStrength = 0f;
}
@@ -364,6 +386,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.noGravity = true;
NPC.velocity = NPC.SafeDirectionTo(LastPlayerPosition) * JumpAndDash_MaxDashSpeed;
UseBalledSprite = false;
SpriteRotation = 0f;
NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi);
SoundEngine.PlaySound(SoundID.Zombie38, NPC.Center);
@@ -389,6 +412,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
Timer = 0f;
AltAttackVariant = Main.rand.Next(2);
UseBalledSprite = true;
CalamityUtils.AddScreenshakeAt(NPC.Center, 6f);
Collision.HitTiles(NPC.position, NPC.velocity, NPC.width, NPC.height);
SoundEngine.PlaySound(GroundImpactSound, NPC.Center);
@@ -398,12 +422,15 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.noGravity = true;
NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi);
FrameY = JumpFrame;
}
if (Timer >= JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime + JumpAndDash_DashTime)
{
if (NPC.velocity.Y == 0f)
{
UseBalledSprite = false;
FrameY = IdleFrame;
LocalAIState = 2f;
Timer = 0f;
NPC.netUpdate = true;
@@ -459,6 +486,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.velocity.X *= 0.94f;
if (NPC.velocity.Y == 0f)
{
UseBalledSprite = false;
NPC.rotation = 0f;
SpriteRotation = 0f;
}
@@ -467,6 +495,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.rotation = NPC.rotation.AngleLerp(0f, 0.075f);
SpriteRotation = SpriteRotation.AngleLerp(0f, 0.075f);
SetSquashVectors();
FrameY = IdleFrame;
if (Timer >= JumpAndDash_CooldownTime && NPC.velocity.Y == 0f)
{
@@ -506,6 +535,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
Vector2 knockbackVelocity = NPC.DirectionFrom(target.Center).SafeNormalize(-Vector2.UnitY);
NPC.velocity = knockbackVelocity * new Vector2(3f, 5f);
FrameY = VomitFrame;
SoundEngine.PlaySound(SoundID.DD2_OgreSpit, NPC.Center);
MiscAttackCounter++;
NPC.netUpdate = true;
@@ -513,10 +543,13 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
if (MiscAttackCounter >= JumpAndDash_MaxVomitChunks && NPC.velocity.Y == 0f)
{
FrameY = JumpFrame;
LocalAIState = 2f;
Timer = 0f;
NPC.netUpdate = true;
}
FrameY = JumpFrame;
}
SetSquashVectors();
@@ -626,6 +659,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.rotation = NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi);
SpriteRotation -= (MathHelper.TwoPi / 20f) * NPC.direction;
SetSquashVectors(VelocityBasedSquashNStretch);
UseBalledSprite = true;
}
public void MainBehavior_HorribleHoller(Player target)
@@ -659,8 +693,14 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
}
}
}
if (Timer >= HorribleHoller_RoarTime - 30)
Animate(MinFrame_Roar, MaxFrame_Roar, HorribleHoller_RoarTime / (MaxFrame_Roar + 1), true, MaxFrame_Roar - 1);
}
if (Timer >= HorribleHoller_RoarTime)
Animate(MinFrame_RoarFinish, MaxFrame_RoarFinish, 4, false);
float targetAngle = (NPC.velocity.Y != 0f) ? NPC.velocity.X * 0.125f * (NPC.velocity.Y < 0).ToDirectionInt() : 0f;
if (Timer >= HorribleHoller_RoarTime - 30 && Timer <= HorribleHoller_RoarTime)
targetAngle = (NPC.velocity.Y != 0f) ? (NPC.direction < 0 ? MathHelper.ToRadians(50f) : MathHelper.ToRadians(-50f)) : 0f;
@@ -705,6 +745,9 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
HorizontalShakeStrength = MathHelper.Lerp(0f, 6f, interpolant);
SetSquashVectors(new Vector2(1.24f, 0.84f));
}
int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, VomitBarrage_MaxSpeed, 9, 3, true);
Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true);
}
// Jump and shoot a bunch of vomit projectiles shortly afterwards.
@@ -774,6 +817,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
Dust.NewDust(NPC.Center, 1, 1, dustType, velocity.X, velocity.Y, Scale: Main.rand.NextFloat(1.8f, 2.4f));
}
FrameY = VomitFrame;
SoundEngine.PlaySound(VomitSound with { Volume = 1.3f }, NPC.Center);
NPC.velocity.X = 6f * -NPC.direction;
NPC.velocity.Y += 2f;
@@ -781,6 +825,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
if (Timer > JumpAndDash_JumpPreDashTime + JumpAndDash_PreJumpTime && NPC.velocity.Y == 0f)
{
FrameY = IdleFrame;
LocalAIState = 1f;
Timer = 0f;
NPC.netUpdate = true;
@@ -822,6 +867,9 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
targetAngle = (NPC.velocity.Y != 0f) ? (NPC.direction < 0 ? MathHelper.ToRadians(30f) : MathHelper.ToRadians(-30f)) : 0f;
NPC.rotation = NPC.rotation.AngleLerp(targetAngle, 0.125f);
NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt();
int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, VomitBarrage_MaxSpeed, 9, 3, true);
Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true);
}
}
@@ -110,6 +110,8 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.netUpdate = true;
}
}
Animate(IdleFrame, IdleFrame, 0, false, dynamicChanges: true);
}
public void MainBehavior_EngageAnimation(Player target)
@@ -117,13 +119,24 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
if (Timer >= 45f)
{
if (Timer == 45f)
{
FrameY = 0;
NPC.frameCounter = 0;
SoundEngine.PlaySound(SoundID.ForceRoarPitched, NPC.Center);
}
if (Timer % 10f == 0f)
{
PulseRing hogRoar = new(NPC.Center, Vector2.Zero, Color.Red, 0f, 1.2f, 20);
GeneralParticleHandler.SpawnParticle(hogRoar, true);
}
NPC.frameCounter++;
if (NPC.frameCounter >= 5 && FrameY < MaxFrame_RoarFinish)
{
FrameY++;
NPC.frameCounter = 0;
}
}
if (Timer >= 120f)
@@ -133,7 +146,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.spriteDirection = (target.Center.X > NPC.Center.X).ToDirectionInt();
}
public void MainBehavior_LaughADeadPlayer()
public void MainBehavior_LaughAtDeadPlayer()
{
if (NPC.velocity.Y == 0f)
{
@@ -159,6 +172,8 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
float targetAngle = NPC.direction < 0 ? MathHelper.ToRadians(50f) : MathHelper.ToRadians(-50f);
NPC.rotation = (NPC.velocity.Y != 0f) ? NPC.rotation.AngleLerp(targetAngle, 0.075f) : 0f;
Animate(MinFrame_Laughing, MaxFrame_Laughing);
if (Timer >= 130f)
{
BehaviorState nextAttack = NPC.HasValidTarget ? BehaviorState.ChasePlayer : BehaviorState.Idle;
@@ -236,6 +251,9 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
float idealRotation = (NPC.velocity.Y != 0f) ? NPC.velocity.ToRotation() + (NPC.direction > 0 ? 0f : -MathHelper.Pi) : 0f;
NPC.rotation = idealRotation;
int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, VomitBarrage_MaxSpeed, 120, 8, true);
Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true);
}
public void MainBehavior_DeathAnimation()
@@ -280,6 +298,8 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
CalamityUtils.AddScreenshakeAt(NPC.Center, 4f);
}
FrameY = BalledUpFrame;
NPC.damage = 0;
NPC.dontTakeDamage = true;
}
@@ -329,6 +349,10 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.velocity.Y -= 6f;
}
// Animation.
Animate(MinFrame_Walking, MaxFrame_Walking, 5, true, dynamicChanges: true);
NPC.rotation = 0f;
// Idle sounds.
if (NPC.soundDelay == 0f && Main.rand.NextBool(250))
{
@@ -355,6 +379,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.chaseable = false;
SearchForTargetEveryFrame = true;
HorizontalShakeStrength = 0f;
}
public void MainBehavior_DigTowardsTarget(Player target)
@@ -401,12 +426,15 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
GeneralParticleHandler.SpawnParticle(dustCloud, true);
}
NPC.rotation = 0f;
SoundEngine.PlaySound(SoundID.Item70, NPC.Center);
LocalAIState = 1f;
Timer = 0f;
SetSquashVectors();
NPC.netUpdate = true;
}
NPC.rotation = MathHelper.Lerp(NPC.rotation, -MathHelper.PiOver2, 0.175f);
}
}
@@ -512,6 +540,9 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
NPC.direction = (target.Center.X > NPC.Center.X).ToDirectionInt();
}
int frameSpeed = (int)Utils.Remap(MathF.Abs(NPC.velocity.X), 0f, VomitBarrage_MaxSpeed, 120, 8, true);
Animate(MinFrame_Walking, MaxFrame_Walking, frameSpeed, true, dynamicChanges: true);
DigTimer = 0f;
SearchForTargetEveryFrame = true;
}
+114 -19
View File
@@ -55,6 +55,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
VomitBarrage,
}
private static Asset<Texture2D> HorribleHog_BalledUp;
private static Asset<Texture2D> BloomCircle;
private static Asset<Texture2D> ShineFlare;
private static Asset<Texture2D> VortexTexture;
@@ -104,6 +105,10 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
public bool ReadyToPlayLaughingAnimation;
public bool UseBalledSprite;
public int FrameY;
public float EyeGlintScale;
public float AfterimageTrailOpacity;
@@ -143,6 +148,19 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
public static int MaxAttacksPerCycle => CalamityWorld.revenge ? 5 : Main.expertMode ? 4 : 3;
public static int MaxTimeToStartDigging => 300;
public static int MinFrame_Roar => 0;
public static int MaxFrame_Roar => 9;
public static int MinFrame_RoarFinish => 10;
public static int MaxFrame_RoarFinish => 13;
public static int MinFrame_Laughing => 8;
public static int MaxFrame_Laughing => 9;
public static int MinFrame_Walking => 15;
public static int MaxFrame_Walking => 23;
public static int JumpFrame => 24;
public static int IdleFrame => 14;
public static int BalledUpFrame => 19;
public static int VomitFrame => 2;
#endregion
public ref float Timer => ref NPC.ai[0];
@@ -187,6 +205,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
{
if (!Main.dedServ)
{
HorribleHog_BalledUp = ModContent.Request<Texture2D>("CalamityMod/NPCs/NormalNPCs/HorribleHog/HorribleHog_BalledUp");
BloomCircle = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
ShineFlare = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/ShineFlare");
VortexTexture = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/Neurons2");
@@ -197,6 +216,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
public override void SetStaticDefaults()
{
Main.npcFrameCount[Type] = 25;
NPCID.Sets.TrailCacheLength[Type] = 5;
NPCID.Sets.TrailingMode[Type] = 0;
NPCID.Sets.CantTakeLunchMoney[Type] = true;
@@ -374,7 +394,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
break;
case BehaviorState.LaughAtDeadPlayer:
MainBehavior_LaughADeadPlayer();
MainBehavior_LaughAtDeadPlayer();
break;
case BehaviorState.DespawnAnimation:
@@ -489,6 +509,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
SpriteRotation = 0f;
AfterimageTrailOpacity = 0f;
SearchForTargetEveryFrame = false;
UseBalledSprite = false;
SetSquashVectors();
KillChargeHitboxProjectile();
@@ -790,16 +811,64 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, velocity.X, velocity.Y, Scale: scale);
}
}
//Always drops Disgusting Meat, 50% chance to drop Money Trough, 25%/33% chance to drop Laudanum
public override void ModifyNPCLoot(NPCLoot npcLoot)
{
//Always drops Disgusting Meat, 50% chance to drop Money Trough, 25%/33% chance to drop Laudanum
npcLoot.Add(ModContent.ItemType<DisgustingMeat>());
npcLoot.Add(ModContent.ItemType<Laudanum>(), Main.expertMode ? 3 : 4);
npcLoot.Add(ItemID.MoneyTrough, 2);
// 10-12 Blood Orbs Post-EoC to match Wandering Eye Fish and Zombie Merman as Blood Moon's faux minibosses.
LeadingConditionRule postEoC = npcLoot.DefineConditionalDropSet(DropHelper.PostEoC());
postEoC.Add(ModContent.ItemType<BloodOrb>(), 1, 10, 12);
}
public override void FindFrame(int frameHeight)
{
NPC.frame.Y = FrameY * frameHeight;
}
public void Animate(int startingFrame, int endingFrame, int frameSpeed = 6, bool loop = true, int? loopStartingFrame = null, bool dynamicChanges = false)
{
bool jumping = dynamicChanges && NPC.velocity.Y != 0f;
bool idling = dynamicChanges && MathF.Abs(NPC.velocity.X) < 0.06f && NPC.velocity.Y == 0f;
if (jumping)
{
FrameY = JumpFrame;
}
else if (idling)
{
FrameY = IdleFrame;
}
else
{
if (FrameY < startingFrame)
FrameY = startingFrame;
if (NPC.frameCounter % frameSpeed == 0)
{
FrameY++;
if (FrameY > endingFrame)
{
if (loop)
{
if (loopStartingFrame.HasValue)
FrameY = loopStartingFrame.Value;
else
FrameY = startingFrame;
}
else
{
FrameY = endingFrame;
}
}
}
NPC.frameCounter += 1;
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
{
if (NPC.IsABestiaryIconDummy)
@@ -809,10 +878,12 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
}
Texture2D baseTexture = TextureAssets.Npc[Type].Value;
Texture2D balledTexture = HorribleHog_BalledUp.Value;
SpriteEffects effects = NPC.spriteDirection > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Vector2 scale = NPC.scale * SquashVector;
float yOffset = scale.Y * baseTexture.Height * 0.05f;
float textureHeight = baseTexture.Height / Main.npcFrameCount[Type];
float yOffset = scale.Y * textureHeight * 0.05f;
Vector2 drawPosition = NPC.Center + new Vector2(0f, NPC.gfxOffY - yOffset) - screenPos;
// Background effect when Horrible Hog is idling and its nearby loop is playing.
@@ -825,23 +896,47 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
using var lease = RenderTargetPool.Shared.Rent(Main.graphics.GraphicsDevice, Main.screenWidth, Main.screenHeight, RenderTargetDescriptor.Default);
using (lease.Scope(clearColor: Color.Transparent))
{
Effect rotateSpriteShader = CalamityShaders.RotateSprite.Value;
rotateSpriteShader.Parameters["rotation"].SetValue(SpriteRotation);
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, rotateSpriteShader, Matrix.Identity);
if (CalamityClientConfig.Instance.Afterimages && AfterimageTrailOpacity > 0.05f)
if (UseBalledSprite)
{
for (int i = 0; i < NPC.oldPos.Length; i++)
{
Color afterimageColor = Color.Red * AfterimageTrailOpacity * 0.76f;
afterimageColor *= (float)(NPC.oldPos.Length - i) / (float)NPC.oldPos.Length;
Vector2 afterimageDrawPosition = NPC.oldPos[i] - Vector2.UnitY * yOffset + NPC.Size * 0.5f - screenPos;
spriteBatch.Draw(baseTexture, afterimageDrawPosition, NPC.frame, NPC.GetAlpha(afterimageColor), NPC.rotation, NPC.frame.Size() * 0.5f, scale, effects, 0f);
}
}
Rectangle frameRec = balledTexture.Frame();
Effect rotateSpriteShader = CalamityShaders.RotateSprite.Value;
rotateSpriteShader.Parameters["rotation"].SetValue(SpriteRotation);
rotateSpriteShader.Parameters["spriteDimensions"].SetValue(balledTexture.Size());
rotateSpriteShader.Parameters["spriteRectangle"].SetValue(new Vector4(frameRec.X, frameRec.Y, frameRec.Width, frameRec.Height));
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, rotateSpriteShader, Matrix.Identity);
spriteBatch.Draw(baseTexture, drawPosition + Main.rand.NextVector2Circular(HorizontalShakeStrength, 0f), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, scale, effects, 0f);
spriteBatch.End();
if (CalamityClientConfig.Instance.Afterimages && AfterimageTrailOpacity > 0.05f)
{
for (int i = 0; i < NPC.oldPos.Length; i++)
{
Color afterimageColor = Color.Red * AfterimageTrailOpacity * 0.76f;
afterimageColor *= (float)(NPC.oldPos.Length - i) / (float)NPC.oldPos.Length;
Vector2 afterimageDrawPosition = NPC.oldPos[i] - Vector2.UnitY * yOffset + NPC.Size * 0.5f - screenPos;
spriteBatch.Draw(balledTexture, afterimageDrawPosition, null, NPC.GetAlpha(afterimageColor), NPC.rotation, balledTexture.Size() * 0.5f, scale, effects, 0f);
}
}
spriteBatch.Draw(balledTexture, drawPosition + Main.rand.NextVector2Circular(HorizontalShakeStrength, 0f), frameRec, NPC.GetAlpha(drawColor), NPC.rotation, balledTexture.Size() * 0.5f, scale, effects, 0f);
spriteBatch.End();
}
else
{
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Matrix.Identity);
if (CalamityClientConfig.Instance.Afterimages && AfterimageTrailOpacity > 0.05f)
{
for (int i = 0; i < NPC.oldPos.Length; i++)
{
Color afterimageColor = Color.Red * AfterimageTrailOpacity * 0.76f;
afterimageColor *= (float)(NPC.oldPos.Length - i) / (float)NPC.oldPos.Length;
Vector2 afterimageDrawPosition = NPC.oldPos[i] - Vector2.UnitY * yOffset + NPC.Size * 0.5f - screenPos;
spriteBatch.Draw(baseTexture, afterimageDrawPosition, NPC.frame, NPC.GetAlpha(afterimageColor), NPC.rotation, NPC.frame.Size() * 0.5f, scale, effects, 0f);
}
}
spriteBatch.Draw(baseTexture, drawPosition + Main.rand.NextVector2Circular(HorizontalShakeStrength, 0f), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() * 0.5f, scale, effects, 0f);
spriteBatch.End();
}
}
Effect tintShader = CalamityShaders.BasicTintShader.Value;
@@ -855,7 +950,7 @@ namespace CalamityMod.NPCs.NormalNPCs.HorribleHog
// Eye glint.
if (EyeGlintScale > 0.05f)
{
Vector2 eyeGlintDrawPosition = drawPosition + new Vector2(6f * NPC.spriteDirection, -2f).RotatedBy(NPC.rotation) + Main.rand.NextVector2Circular(HorizontalShakeStrength, 0f);
Vector2 eyeGlintDrawPosition = drawPosition + new Vector2(18f * NPC.spriteDirection, -2f).RotatedBy(NPC.rotation) + Main.rand.NextVector2Circular(HorizontalShakeStrength, 0f);
spriteBatch.SetBlendState(CalamityUtils.SubtractiveBlending);
for (int i = 0; i < 2; i++)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B