Fixed Exoblade dash having a jagged trail.
This commit is contained in:
1 parent
618162df38
commit
af8bc849e2
1 file changed
+10
-4
@@ -363,6 +363,10 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
Projectile.velocity = Owner.MountedCenter.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
Projectile.oldPos = new Vector2[Projectile.oldPos.Length];
|
||||
|
||||
// Prevent zeroed out garbage from messing up the trail rendering.
|
||||
for (int i = 0; i < Projectile.oldPos.Length; ++i)
|
||||
Projectile.oldPos[i] = Projectile.position;
|
||||
}
|
||||
|
||||
// Do the dash.
|
||||
@@ -418,8 +422,6 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4 * Direction;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public float SlashWidthFunction(float completionRatio) => SquishAtProgress(RealProgressionAtTrailCompletion(completionRatio)) * Projectile.scale * 60.5f;
|
||||
|
||||
public Color SlashColorFunction(float completionRatio) => Color.Lime * Utils.GetLerpValue(0.9f, 0.4f, completionRatio, true) * Projectile.Opacity;
|
||||
@@ -487,7 +489,6 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
Main.spriteBatch.EnterShaderRegion();
|
||||
|
||||
|
||||
Color mainColor = MulticolorLerp((Main.GlobalTimeWrappedHourly * 2f) % 1, Color.Cyan, Color.Lime, Color.GreenYellow, Color.Goldenrod, Color.Orange);
|
||||
Color secondaryColor = MulticolorLerp((Main.GlobalTimeWrappedHourly * 2f + 0.2f) % 1, Color.Cyan, Color.Lime, Color.GreenYellow, Color.Goldenrod, Color.Orange);
|
||||
|
||||
@@ -500,7 +501,12 @@ namespace CalamityMod.Projectiles.Melee
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor);
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor);
|
||||
GameShaders.Misc["CalamityMod:ExobladePierce"].Apply();
|
||||
PrimitiveRenderer.RenderTrail(Projectile.oldPos.Take(51).ToArray(), new(PierceWidthFunction, PierceColorFunction, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 53);
|
||||
|
||||
// Exoblade tracks 120 positions in oldPos.
|
||||
// Provide 60 points for smoothing, but only render 30
|
||||
int numPoints = 30;
|
||||
var positionsToUse = Projectile.oldPos.Take(numPoints * 2).ToArray();
|
||||
PrimitiveRenderer.RenderTrail(positionsToUse, new(PierceWidthFunction, PierceColorFunction, (_) => trailOffset, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), numPoints);
|
||||
|
||||
Main.spriteBatch.ExitShaderRegion();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user