Terraria 1.4.0.5 Source Code

This commit is contained in:
MikeyIsBaeYT 2021-10-26 12:45:26 -04:00
commit 05205f009e
1059 changed files with 563450 additions and 0 deletions

View file

@ -0,0 +1,36 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.GameContent.Drawing.ParticleOrchestraSettings
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using System.IO;
namespace Terraria.GameContent.Drawing
{
public struct ParticleOrchestraSettings
{
public Vector2 PositionInWorld;
public Vector2 MovementVector;
public int PackedShaderIndex;
public byte IndexOfPlayerWhoInvokedThis;
public const int SerializationSize = 21;
public void Serialize(BinaryWriter writer)
{
writer.WriteVector2(this.PositionInWorld);
writer.WriteVector2(this.MovementVector);
writer.Write(this.PackedShaderIndex);
writer.Write(this.IndexOfPlayerWhoInvokedThis);
}
public void DeserializeFrom(BinaryReader reader)
{
this.PositionInWorld = reader.ReadVector2();
this.MovementVector = reader.ReadVector2();
this.PackedShaderIndex = reader.ReadInt32();
this.IndexOfPlayerWhoInvokedThis = reader.ReadByte();
}
}
}

View file

@ -0,0 +1,20 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.GameContent.Drawing.ParticleOrchestraType
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
namespace Terraria.GameContent.Drawing
{
public enum ParticleOrchestraType : byte
{
Keybrand,
FlameWaders,
StellarTune,
WallOfFleshGoatMountFlames,
BlackLightningHit,
RainbowRodHit,
BlackLightningSmall,
StardustPunch,
}
}

View file

@ -0,0 +1,420 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.GameContent.Drawing.ParticleOrchestrator
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Terraria.GameContent.NetModules;
using Terraria.Graphics.Renderers;
using Terraria.Graphics.Shaders;
using Terraria.Net;
namespace Terraria.GameContent.Drawing
{
public class ParticleOrchestrator
{
private static ParticlePool<FadingParticle> _poolFading = new ParticlePool<FadingParticle>(200, new ParticlePool<FadingParticle>.ParticleInstantiator(ParticleOrchestrator.GetNewFadingParticle));
private static ParticlePool<FlameParticle> _poolFlame = new ParticlePool<FlameParticle>(200, new ParticlePool<FlameParticle>.ParticleInstantiator(ParticleOrchestrator.GetNewFlameParticle));
private static ParticlePool<RandomizedFrameParticle> _poolRandomizedFrame = new ParticlePool<RandomizedFrameParticle>(200, new ParticlePool<RandomizedFrameParticle>.ParticleInstantiator(ParticleOrchestrator.GetNewRandomizedFrameParticle));
private static ParticlePool<PrettySparkleParticle> _poolPrettySparkle = new ParticlePool<PrettySparkleParticle>(200, new ParticlePool<PrettySparkleParticle>.ParticleInstantiator(ParticleOrchestrator.GetNewPrettySparkleParticle));
public static void RequestParticleSpawn(
bool clientOnly,
ParticleOrchestraType type,
ParticleOrchestraSettings settings,
int? overrideInvokingPlayerIndex = null)
{
settings.IndexOfPlayerWhoInvokedThis = (byte) Main.myPlayer;
if (overrideInvokingPlayerIndex.HasValue)
settings.IndexOfPlayerWhoInvokedThis = (byte) overrideInvokingPlayerIndex.Value;
if (clientOnly)
ParticleOrchestrator.SpawnParticlesDirect(type, settings);
else
NetManager.Instance.SendToServerOrLoopback(NetParticlesModule.Serialize(type, settings));
}
private static FadingParticle GetNewFadingParticle() => new FadingParticle();
private static FlameParticle GetNewFlameParticle() => new FlameParticle();
private static RandomizedFrameParticle GetNewRandomizedFrameParticle() => new RandomizedFrameParticle();
private static PrettySparkleParticle GetNewPrettySparkleParticle() => new PrettySparkleParticle();
public static void SpawnParticlesDirect(
ParticleOrchestraType type,
ParticleOrchestraSettings settings)
{
if (Main.netMode == 2)
return;
switch (type)
{
case ParticleOrchestraType.Keybrand:
ParticleOrchestrator.Spawn_Keybrand(settings);
break;
case ParticleOrchestraType.FlameWaders:
ParticleOrchestrator.Spawn_FlameWaders(settings);
break;
case ParticleOrchestraType.StellarTune:
ParticleOrchestrator.Spawn_StellarTune(settings);
break;
case ParticleOrchestraType.WallOfFleshGoatMountFlames:
ParticleOrchestrator.Spawn_WallOfFleshGoatMountFlames(settings);
break;
case ParticleOrchestraType.BlackLightningHit:
ParticleOrchestrator.Spawn_BlackLightningHit(settings);
break;
case ParticleOrchestraType.RainbowRodHit:
ParticleOrchestrator.Spawn_RainbowRodHit(settings);
break;
case ParticleOrchestraType.BlackLightningSmall:
ParticleOrchestrator.Spawn_BlackLightningSmall(settings);
break;
case ParticleOrchestraType.StardustPunch:
ParticleOrchestrator.Spawn_StardustPunch(settings);
break;
}
}
private static void Spawn_StardustPunch(ParticleOrchestraSettings settings)
{
float num1 = Main.rand.NextFloat() * 6.283185f;
float num2 = 1f;
for (float num3 = 0.0f; (double) num3 < 1.0; num3 += 1f / num2)
{
Vector2 vector2_1 = settings.MovementVector * (float) (0.300000011920929 + (double) Main.rand.NextFloat() * 0.349999994039536);
Vector2 vector2_2 = new Vector2((float) ((double) Main.rand.NextFloat() * 0.400000005960464 + 0.400000005960464));
float f = num1 + Main.rand.NextFloat() * 6.283185f;
float num4 = 1.570796f;
Vector2 vector2_3 = 0.1f * vector2_2;
float num5 = 60f;
Vector2 vector2_4 = Main.rand.NextVector2Circular(8f, 8f) * vector2_2;
PrettySparkleParticle prettySparkleParticle1 = ParticleOrchestrator._poolPrettySparkle.RequestParticle();
prettySparkleParticle1.Velocity = f.ToRotationVector2() * vector2_3 + vector2_1;
prettySparkleParticle1.AccelerationPerFrame = f.ToRotationVector2() * -(vector2_3 / num5) - vector2_1 * 1f / 60f;
prettySparkleParticle1.ColorTint = Main.hslToRgb((float) ((0.600000023841858 + (double) Main.rand.NextFloat() * 0.0500000007450581) % 1.0), 1f, (float) (0.400000005960464 + (double) Main.rand.NextFloat() * 0.25));
prettySparkleParticle1.ColorTint.A = (byte) 0;
prettySparkleParticle1.LocalPosition = settings.PositionInWorld + vector2_4;
prettySparkleParticle1.Rotation = num4;
prettySparkleParticle1.Scale = vector2_2;
Main.ParticleSystem_World_OverPlayers.Add((IParticle) prettySparkleParticle1);
PrettySparkleParticle prettySparkleParticle2 = ParticleOrchestrator._poolPrettySparkle.RequestParticle();
prettySparkleParticle2.Velocity = f.ToRotationVector2() * vector2_3 + vector2_1;
prettySparkleParticle2.AccelerationPerFrame = f.ToRotationVector2() * -(vector2_3 / num5) - vector2_1 * 1f / 30f;
prettySparkleParticle2.ColorTint = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
prettySparkleParticle2.LocalPosition = settings.PositionInWorld + vector2_4;
prettySparkleParticle2.Rotation = num4;
prettySparkleParticle2.Scale = vector2_2 * 0.6f;
Main.ParticleSystem_World_OverPlayers.Add((IParticle) prettySparkleParticle2);
}
for (int index = 0; index < 2; ++index)
{
Color rgb = Main.hslToRgb((float) ((0.589999973773956 + (double) Main.rand.NextFloat() * 0.0500000007450581) % 1.0), 1f, (float) (0.400000005960464 + (double) Main.rand.NextFloat() * 0.25));
int dustIndex = Dust.NewDust(settings.PositionInWorld, 0, 0, 267, newColor: rgb);
Main.dust[dustIndex].velocity = Main.rand.NextVector2Circular(2f, 2f);
Main.dust[dustIndex].velocity += settings.MovementVector * (float) (0.5 + 0.5 * (double) Main.rand.NextFloat()) * 1.4f;
Main.dust[dustIndex].noGravity = true;
Main.dust[dustIndex].scale = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 2.0);
Main.dust[dustIndex].position += Main.rand.NextVector2Circular(16f, 16f);
if (dustIndex != 6000)
{
Dust dust = Dust.CloneDust(dustIndex);
dust.scale /= 2f;
dust.fadeIn *= 0.75f;
dust.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
}
}
}
private static void Spawn_RainbowRodHit(ParticleOrchestraSettings settings)
{
float num1 = Main.rand.NextFloat() * 6.283185f;
float num2 = 6f;
float num3 = Main.rand.NextFloat();
for (float num4 = 0.0f; (double) num4 < 1.0; num4 += 1f / num2)
{
Vector2 vector2_1 = settings.MovementVector * Main.rand.NextFloatDirection() * 0.15f;
Vector2 vector2_2 = new Vector2((float) ((double) Main.rand.NextFloat() * 0.400000005960464 + 0.400000005960464));
float f = num1 + Main.rand.NextFloat() * 6.283185f;
float num5 = 1.570796f;
Vector2 vector2_3 = 1.5f * vector2_2;
float num6 = 60f;
Vector2 vector2_4 = Main.rand.NextVector2Circular(8f, 8f) * vector2_2;
PrettySparkleParticle prettySparkleParticle1 = ParticleOrchestrator._poolPrettySparkle.RequestParticle();
prettySparkleParticle1.Velocity = f.ToRotationVector2() * vector2_3 + vector2_1;
prettySparkleParticle1.AccelerationPerFrame = f.ToRotationVector2() * -(vector2_3 / num6) - vector2_1 * 1f / 60f;
prettySparkleParticle1.ColorTint = Main.hslToRgb((float) (((double) num3 + (double) Main.rand.NextFloat() * 0.330000013113022) % 1.0), 1f, (float) (0.400000005960464 + (double) Main.rand.NextFloat() * 0.25));
prettySparkleParticle1.ColorTint.A = (byte) 0;
prettySparkleParticle1.LocalPosition = settings.PositionInWorld + vector2_4;
prettySparkleParticle1.Rotation = num5;
prettySparkleParticle1.Scale = vector2_2;
Main.ParticleSystem_World_OverPlayers.Add((IParticle) prettySparkleParticle1);
PrettySparkleParticle prettySparkleParticle2 = ParticleOrchestrator._poolPrettySparkle.RequestParticle();
prettySparkleParticle2.Velocity = f.ToRotationVector2() * vector2_3 + vector2_1;
prettySparkleParticle2.AccelerationPerFrame = f.ToRotationVector2() * -(vector2_3 / num6) - vector2_1 * 1f / 60f;
prettySparkleParticle2.ColorTint = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0);
prettySparkleParticle2.LocalPosition = settings.PositionInWorld + vector2_4;
prettySparkleParticle2.Rotation = num5;
prettySparkleParticle2.Scale = vector2_2 * 0.6f;
Main.ParticleSystem_World_OverPlayers.Add((IParticle) prettySparkleParticle2);
}
for (int index = 0; index < 12; ++index)
{
Color rgb = Main.hslToRgb((float) (((double) num3 + (double) Main.rand.NextFloat() * 0.119999997317791) % 1.0), 1f, (float) (0.400000005960464 + (double) Main.rand.NextFloat() * 0.25));
int dustIndex = Dust.NewDust(settings.PositionInWorld, 0, 0, 267, newColor: rgb);
Main.dust[dustIndex].velocity = Main.rand.NextVector2Circular(1f, 1f);
Main.dust[dustIndex].velocity += settings.MovementVector * Main.rand.NextFloatDirection() * 0.5f;
Main.dust[dustIndex].noGravity = true;
Main.dust[dustIndex].scale = (float) (0.600000023841858 + (double) Main.rand.NextFloat() * 0.899999976158142);
Main.dust[dustIndex].fadeIn = (float) (0.699999988079071 + (double) Main.rand.NextFloat() * 0.800000011920929);
if (dustIndex != 6000)
{
Dust dust = Dust.CloneDust(dustIndex);
dust.scale /= 2f;
dust.fadeIn *= 0.75f;
dust.color = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
}
}
}
private static void Spawn_BlackLightningSmall(ParticleOrchestraSettings settings)
{
float num1 = Main.rand.NextFloat() * 6.283185f;
float num2 = (float) Main.rand.Next(1, 3);
float num3 = 0.7f;
int i = 916;
Main.instance.LoadProjectile(i);
Color color1 = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
Color indigo = Color.Indigo;
indigo.A = (byte) 0;
for (float num4 = 0.0f; (double) num4 < 1.0; num4 += 1f / num2)
{
float f = (float) (6.28318548202515 * (double) num4 + (double) num1 + (double) Main.rand.NextFloatDirection() * 0.25);
float num5 = (float) ((double) Main.rand.NextFloat() * 4.0 + 0.100000001490116);
Vector2 initialLocalPosition = Main.rand.NextVector2Circular(12f, 12f) * num3;
Color.Lerp(Color.Lerp(Color.Black, indigo, Main.rand.NextFloat() * 0.5f), color1, Main.rand.NextFloat() * 0.6f);
Color color2 = new Color(0, 0, 0, (int) byte.MaxValue);
int num6 = Main.rand.Next(4);
if (num6 == 1)
color2 = Color.Lerp(new Color(106, 90, 205, (int) sbyte.MaxValue), Color.Black, (float) (0.100000001490116 + 0.699999988079071 * (double) Main.rand.NextFloat()));
if (num6 == 2)
color2 = Color.Lerp(new Color(106, 90, 205, 60), Color.Black, (float) (0.100000001490116 + 0.800000011920929 * (double) Main.rand.NextFloat()));
RandomizedFrameParticle randomizedFrameParticle = ParticleOrchestrator._poolRandomizedFrame.RequestParticle();
randomizedFrameParticle.SetBasicInfo(TextureAssets.Projectile[i], new Rectangle?(), Vector2.Zero, initialLocalPosition);
randomizedFrameParticle.SetTypeInfo(Main.projFrames[i], 2, 24f);
randomizedFrameParticle.Velocity = f.ToRotationVector2() * num5 * new Vector2(1f, 0.5f) * 0.2f + settings.MovementVector;
randomizedFrameParticle.ColorTint = color2;
randomizedFrameParticle.LocalPosition = settings.PositionInWorld + initialLocalPosition;
randomizedFrameParticle.Rotation = randomizedFrameParticle.Velocity.ToRotation();
randomizedFrameParticle.Scale = Vector2.One * 0.5f;
randomizedFrameParticle.FadeInNormalizedTime = 0.01f;
randomizedFrameParticle.FadeOutNormalizedTime = 0.5f;
randomizedFrameParticle.ScaleVelocity = new Vector2(0.025f);
Main.ParticleSystem_World_OverPlayers.Add((IParticle) randomizedFrameParticle);
}
}
private static void Spawn_BlackLightningHit(ParticleOrchestraSettings settings)
{
float num1 = Main.rand.NextFloat() * 6.283185f;
float num2 = 7f;
float num3 = 0.7f;
int i = 916;
Main.instance.LoadProjectile(i);
Color color1 = new Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue);
Color indigo = Color.Indigo;
indigo.A = (byte) 0;
for (float num4 = 0.0f; (double) num4 < 1.0; num4 += 1f / num2)
{
float f = (float) (6.28318548202515 * (double) num4 + (double) num1 + (double) Main.rand.NextFloatDirection() * 0.25);
float num5 = (float) ((double) Main.rand.NextFloat() * 4.0 + 0.100000001490116);
Vector2 initialLocalPosition = Main.rand.NextVector2Circular(12f, 12f) * num3;
Color.Lerp(Color.Lerp(Color.Black, indigo, Main.rand.NextFloat() * 0.5f), color1, Main.rand.NextFloat() * 0.6f);
Color color2 = new Color(0, 0, 0, (int) byte.MaxValue);
int num6 = Main.rand.Next(4);
if (num6 == 1)
color2 = Color.Lerp(new Color(106, 90, 205, (int) sbyte.MaxValue), Color.Black, (float) (0.100000001490116 + 0.699999988079071 * (double) Main.rand.NextFloat()));
if (num6 == 2)
color2 = Color.Lerp(new Color(106, 90, 205, 60), Color.Black, (float) (0.100000001490116 + 0.800000011920929 * (double) Main.rand.NextFloat()));
RandomizedFrameParticle randomizedFrameParticle = ParticleOrchestrator._poolRandomizedFrame.RequestParticle();
randomizedFrameParticle.SetBasicInfo(TextureAssets.Projectile[i], new Rectangle?(), Vector2.Zero, initialLocalPosition);
randomizedFrameParticle.SetTypeInfo(Main.projFrames[i], 2, 24f);
randomizedFrameParticle.Velocity = f.ToRotationVector2() * num5 * new Vector2(1f, 0.5f);
randomizedFrameParticle.ColorTint = color2;
randomizedFrameParticle.LocalPosition = settings.PositionInWorld + initialLocalPosition;
randomizedFrameParticle.Rotation = f;
randomizedFrameParticle.Scale = Vector2.One;
randomizedFrameParticle.FadeInNormalizedTime = 0.01f;
randomizedFrameParticle.FadeOutNormalizedTime = 0.5f;
randomizedFrameParticle.ScaleVelocity = new Vector2(0.05f);
Main.ParticleSystem_World_OverPlayers.Add((IParticle) randomizedFrameParticle);
}
}
private static void Spawn_StellarTune(ParticleOrchestraSettings settings)
{
float num1 = Main.rand.NextFloat() * 6.283185f;
float num2 = 5f;
Vector2 vector2_1 = new Vector2(0.7f);
for (float num3 = 0.0f; (double) num3 < 1.0; num3 += 1f / num2)
{
float f = (float) (6.28318548202515 * (double) num3 + (double) num1 + (double) Main.rand.NextFloatDirection() * 0.25);
Vector2 vector2_2 = 1.5f * vector2_1;
float num4 = 60f;
Vector2 vector2_3 = Main.rand.NextVector2Circular(12f, 12f) * vector2_1;
Color color = Color.Lerp(Color.Gold, Color.HotPink, Main.rand.NextFloat());
if (Main.rand.Next(2) == 0)
color = Color.Lerp(Color.Violet, Color.HotPink, Main.rand.NextFloat());
PrettySparkleParticle prettySparkleParticle = ParticleOrchestrator._poolPrettySparkle.RequestParticle();
prettySparkleParticle.Velocity = f.ToRotationVector2() * vector2_2;
prettySparkleParticle.AccelerationPerFrame = f.ToRotationVector2() * -(vector2_2 / num4);
prettySparkleParticle.ColorTint = color;
prettySparkleParticle.LocalPosition = settings.PositionInWorld + vector2_3;
prettySparkleParticle.Rotation = f;
prettySparkleParticle.Scale = vector2_1 * (float) ((double) Main.rand.NextFloat() * 0.800000011920929 + 0.200000002980232);
Main.ParticleSystem_World_OverPlayers.Add((IParticle) prettySparkleParticle);
}
}
private static void Spawn_Keybrand(ParticleOrchestraSettings settings)
{
float num1 = Main.rand.NextFloat() * 6.283185f;
float num2 = 3f;
Vector2 vector2_1 = new Vector2(0.7f);
for (float num3 = 0.0f; (double) num3 < 1.0; num3 += 1f / num2)
{
float f = (float) (6.28318548202515 * (double) num3 + (double) num1 + (double) Main.rand.NextFloatDirection() * 0.100000001490116);
Vector2 vector2_2 = 1.5f * vector2_1;
float num4 = 60f;
Vector2 vector2_3 = Main.rand.NextVector2Circular(4f, 4f) * vector2_1;
PrettySparkleParticle prettySparkleParticle = ParticleOrchestrator._poolPrettySparkle.RequestParticle();
prettySparkleParticle.Velocity = f.ToRotationVector2() * vector2_2;
prettySparkleParticle.AccelerationPerFrame = f.ToRotationVector2() * -(vector2_2 / num4);
prettySparkleParticle.ColorTint = Color.Lerp(Color.Gold, Color.OrangeRed, Main.rand.NextFloat());
prettySparkleParticle.LocalPosition = settings.PositionInWorld + vector2_3;
prettySparkleParticle.Rotation = f;
prettySparkleParticle.Scale = vector2_1 * 0.8f;
Main.ParticleSystem_World_OverPlayers.Add((IParticle) prettySparkleParticle);
}
float num5 = num1 + (float) (1.0 / (double) num2 / 2.0 * 6.28318548202515);
float num6 = Main.rand.NextFloat() * 6.283185f;
for (float num7 = 0.0f; (double) num7 < 1.0; num7 += 1f / num2)
{
float f = (float) (6.28318548202515 * (double) num7 + (double) num6 + (double) Main.rand.NextFloatDirection() * 0.100000001490116);
Vector2 vector2_4 = 1f * vector2_1;
float timeToLive = 30f;
Color color = Color.Lerp(Color.White, Color.Lerp(Color.Gold, Color.OrangeRed, Main.rand.NextFloat()), 0.5f);
color.A = (byte) 0;
Vector2 vector2_5 = Main.rand.NextVector2Circular(4f, 4f) * vector2_1;
FadingParticle fadingParticle = ParticleOrchestrator._poolFading.RequestParticle();
fadingParticle.SetBasicInfo(TextureAssets.Extra[98], new Rectangle?(), Vector2.Zero, Vector2.Zero);
fadingParticle.SetTypeInfo(timeToLive);
fadingParticle.Velocity = f.ToRotationVector2() * vector2_4;
fadingParticle.AccelerationPerFrame = f.ToRotationVector2() * -(vector2_4 / timeToLive);
fadingParticle.ColorTint = color;
fadingParticle.LocalPosition = settings.PositionInWorld + f.ToRotationVector2() * vector2_4 * vector2_1 * timeToLive * 0.2f + vector2_5;
fadingParticle.Rotation = f + 1.570796f;
fadingParticle.FadeInNormalizedTime = 0.3f;
fadingParticle.FadeOutNormalizedTime = 0.4f;
fadingParticle.Scale = new Vector2(0.5f, 1.2f) * 0.8f * vector2_1;
Main.ParticleSystem_World_OverPlayers.Add((IParticle) fadingParticle);
}
float num8 = 1f;
float num9 = Main.rand.NextFloat() * 6.283185f;
for (float num10 = 0.0f; (double) num10 < 1.0; num10 += 1f / num8)
{
float num11 = 6.283185f * num10 + num9;
float timeToLive = 30f;
Color color = Color.Lerp(Color.CornflowerBlue, Color.White, Main.rand.NextFloat());
color.A = (byte) 127;
Vector2 vector2_6 = Main.rand.NextVector2Circular(4f, 4f) * vector2_1;
Vector2 vector2_7 = Main.rand.NextVector2Square(0.7f, 1.3f);
FadingParticle fadingParticle = ParticleOrchestrator._poolFading.RequestParticle();
fadingParticle.SetBasicInfo(TextureAssets.Extra[174], new Rectangle?(), Vector2.Zero, Vector2.Zero);
fadingParticle.SetTypeInfo(timeToLive);
fadingParticle.ColorTint = color;
fadingParticle.LocalPosition = settings.PositionInWorld + vector2_6;
fadingParticle.Rotation = num11 + 1.570796f;
fadingParticle.FadeInNormalizedTime = 0.1f;
fadingParticle.FadeOutNormalizedTime = 0.4f;
fadingParticle.Scale = new Vector2(0.1f, 0.1f) * vector2_1;
fadingParticle.ScaleVelocity = vector2_7 * 1f / 60f;
fadingParticle.ScaleAcceleration = vector2_7 * -0.01666667f / 60f;
Main.ParticleSystem_World_OverPlayers.Add((IParticle) fadingParticle);
}
}
private static void Spawn_FlameWaders(ParticleOrchestraSettings settings)
{
float timeToLive = 60f;
for (int index = -1; index <= 1; ++index)
{
int i = (int) Main.rand.NextFromList<short>((short) 326, (short) 327, (short) 328);
Main.instance.LoadProjectile(i);
Player player = Main.player[(int) settings.IndexOfPlayerWhoInvokedThis];
float num = (float) ((double) Main.rand.NextFloat() * 0.899999976158142 + 0.100000001490116);
Vector2 vector2 = settings.PositionInWorld + new Vector2((float) index * 5.333333f, 0.0f);
FlameParticle flameParticle = ParticleOrchestrator._poolFlame.RequestParticle();
flameParticle.SetBasicInfo(TextureAssets.Projectile[i], new Rectangle?(), Vector2.Zero, vector2);
flameParticle.SetTypeInfo(timeToLive, (int) settings.IndexOfPlayerWhoInvokedThis, player.cShoe);
flameParticle.FadeOutNormalizedTime = 0.4f;
flameParticle.ScaleAcceleration = Vector2.One * num * -0.01666667f / timeToLive;
flameParticle.Scale = Vector2.One * num;
Main.ParticleSystem_World_BehindPlayers.Add((IParticle) flameParticle);
if (Main.rand.Next(16) == 0)
{
Dust dust = Dust.NewDustDirect(vector2, 4, 4, 6, Alpha: 100);
if (Main.rand.Next(2) == 0)
{
dust.noGravity = true;
dust.fadeIn = 1.15f;
}
else
dust.scale = 0.6f;
dust.velocity *= 0.6f;
dust.velocity.Y -= 1.2f;
dust.noLight = true;
dust.position.Y -= 4f;
dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShoe, player);
}
}
}
private static void Spawn_WallOfFleshGoatMountFlames(ParticleOrchestraSettings settings)
{
float timeToLive = 50f;
for (int index = -1; index <= 1; ++index)
{
int i = (int) Main.rand.NextFromList<short>((short) 326, (short) 327, (short) 328);
Main.instance.LoadProjectile(i);
Player player = Main.player[(int) settings.IndexOfPlayerWhoInvokedThis];
float num = (float) ((double) Main.rand.NextFloat() * 0.899999976158142 + 0.100000001490116);
Vector2 vector2 = settings.PositionInWorld + new Vector2((float) index * 5.333333f, 0.0f);
FlameParticle flameParticle = ParticleOrchestrator._poolFlame.RequestParticle();
flameParticle.SetBasicInfo(TextureAssets.Projectile[i], new Rectangle?(), Vector2.Zero, vector2);
flameParticle.SetTypeInfo(timeToLive, (int) settings.IndexOfPlayerWhoInvokedThis, player.cMount);
flameParticle.FadeOutNormalizedTime = 0.3f;
flameParticle.ScaleAcceleration = Vector2.One * num * -0.01666667f / timeToLive;
flameParticle.Scale = Vector2.One * num;
Main.ParticleSystem_World_BehindPlayers.Add((IParticle) flameParticle);
if (Main.rand.Next(8) == 0)
{
Dust dust = Dust.NewDustDirect(vector2, 4, 4, 6, Alpha: 100);
if (Main.rand.Next(2) == 0)
{
dust.noGravity = true;
dust.fadeIn = 1.15f;
}
else
dust.scale = 0.6f;
dust.velocity *= 0.6f;
dust.velocity.Y -= 1.2f;
dust.noLight = true;
dust.position.Y -= 4f;
dust.shader = GameShaders.Armor.GetSecondaryShader(player.cMount, player);
}
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,178 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.GameContent.Drawing.WallDrawing
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Diagnostics;
using Terraria.Graphics;
using Terraria.ID;
namespace Terraria.GameContent.Drawing
{
public class WallDrawing
{
private static VertexColors _glowPaintColors = new VertexColors(Color.White);
private Tile[,] _tileArray;
private TilePaintSystemV2 _paintSystem;
public WallDrawing(TilePaintSystemV2 paintSystem) => this._paintSystem = paintSystem;
public void DrawWalls()
{
float gfxQuality = Main.gfxQuality;
int offScreenRange = Main.offScreenRange;
int num1 = Main.drawToScreen ? 1 : 0;
Vector2 screenPosition = Main.screenPosition;
int screenWidth = Main.screenWidth;
int screenHeight = Main.screenHeight;
int maxTilesX = Main.maxTilesX;
int maxTilesY = Main.maxTilesY;
int[] wallBlend = Main.wallBlend;
SpriteBatch spriteBatch = Main.spriteBatch;
TileBatch tileBatch = Main.tileBatch;
this._tileArray = Main.tile;
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
int num2;
int num3 = (int) ((double) (num2 = (int) (120.0 * (1.0 - (double) gfxQuality) + 40.0 * (double) gfxQuality)) * 0.400000005960464);
int num4 = (int) ((double) num2 * 0.349999994039536);
int num5 = (int) ((double) num2 * 0.300000011920929);
Vector2 vector2 = new Vector2((float) offScreenRange, (float) offScreenRange);
if (num1 != 0)
vector2 = Vector2.Zero;
int num6 = (int) (((double) screenPosition.X - (double) vector2.X) / 16.0 - 1.0);
int num7 = (int) (((double) screenPosition.X + (double) screenWidth + (double) vector2.X) / 16.0) + 2;
int num8 = (int) (((double) screenPosition.Y - (double) vector2.Y) / 16.0 - 1.0);
int num9 = (int) (((double) screenPosition.Y + (double) screenHeight + (double) vector2.Y) / 16.0) + 5;
int num10 = offScreenRange / 16;
int num11 = offScreenRange / 16;
if (num6 - num10 < 4)
num6 = num10 + 4;
if (num7 + num10 > maxTilesX - 4)
num7 = maxTilesX - num10 - 4;
if (num8 - num11 < 4)
num8 = num11 + 4;
if (num9 + num11 > maxTilesY - 4)
num9 = maxTilesY - num11 - 4;
VertexColors vertices = new VertexColors();
Rectangle rectangle = new Rectangle(0, 0, 32, 32);
int underworldLayer = Main.UnderworldLayer;
Point screenOverdrawOffset = Main.GetScreenOverdrawOffset();
for (int index1 = num8 - num11 + screenOverdrawOffset.Y; index1 < num9 + num11 - screenOverdrawOffset.Y; ++index1)
{
for (int index2 = num6 - num10 + screenOverdrawOffset.X; index2 < num7 + num10 - screenOverdrawOffset.X; ++index2)
{
Tile tile = this._tileArray[index2, index1];
if (tile == null)
{
tile = new Tile();
this._tileArray[index2, index1] = tile;
}
ushort wall = tile.wall;
if (wall > (ushort) 0 && !this.FullTile(index2, index1))
{
Color color1 = Lighting.GetColor(index2, index1);
if (tile.wallColor() == (byte) 31)
color1 = Color.White;
if (color1.R != (byte) 0 || color1.G != (byte) 0 || color1.B != (byte) 0 || index1 >= underworldLayer)
{
Main.instance.LoadWall((int) wall);
rectangle.X = tile.wallFrameX();
rectangle.Y = tile.wallFrameY() + (int) Main.wallFrame[(int) wall] * 180;
switch (tile.wall)
{
case 242:
case 243:
int num12 = 20;
int num13 = ((int) Main.wallFrameCounter[(int) wall] + index2 * 11 + index1 * 27) % (num12 * 8);
rectangle.Y = tile.wallFrameY() + 180 * (num13 / num12);
break;
}
if (Lighting.NotRetro && !Main.wallLight[(int) wall] && tile.wall != (ushort) 241 && (tile.wall < (ushort) 88 || tile.wall > (ushort) 93) && !WorldGen.SolidTile(tile))
{
Texture2D tileDrawTexture = this.GetTileDrawTexture(tile, index2, index1);
if (tile.wall == (ushort) 44)
{
Color color2 = new Color((int) (byte) Main.DiscoR, (int) (byte) Main.DiscoG, (int) (byte) Main.DiscoB);
vertices.BottomLeftColor = color2;
vertices.BottomRightColor = color2;
vertices.TopLeftColor = color2;
vertices.TopRightColor = color2;
}
else
{
Lighting.GetCornerColors(index2, index1, out vertices);
if (tile.wallColor() == (byte) 31)
vertices = WallDrawing._glowPaintColors;
}
tileBatch.Draw(tileDrawTexture, new Vector2((float) (index2 * 16 - (int) screenPosition.X - 8), (float) (index1 * 16 - (int) screenPosition.Y - 8)) + vector2, new Rectangle?(rectangle), vertices, Vector2.Zero, 1f, SpriteEffects.None);
}
else
{
Color color3 = color1;
if (wall == (ushort) 44)
color3 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
Texture2D tileDrawTexture = this.GetTileDrawTexture(tile, index2, index1);
spriteBatch.Draw(tileDrawTexture, new Vector2((float) (index2 * 16 - (int) screenPosition.X - 8), (float) (index1 * 16 - (int) screenPosition.Y - 8)) + vector2, new Rectangle?(rectangle), color3, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
if ((int) color1.R > num3 || (int) color1.G > num4 || (int) color1.B > num5)
{
int num14 = this._tileArray[index2 - 1, index1].wall <= (ushort) 0 ? 0 : (wallBlend[(int) this._tileArray[index2 - 1, index1].wall] != wallBlend[(int) tile.wall] ? 1 : 0);
bool flag1 = this._tileArray[index2 + 1, index1].wall > (ushort) 0 && wallBlend[(int) this._tileArray[index2 + 1, index1].wall] != wallBlend[(int) tile.wall];
bool flag2 = this._tileArray[index2, index1 - 1].wall > (ushort) 0 && wallBlend[(int) this._tileArray[index2, index1 - 1].wall] != wallBlend[(int) tile.wall];
bool flag3 = this._tileArray[index2, index1 + 1].wall > (ushort) 0 && wallBlend[(int) this._tileArray[index2, index1 + 1].wall] != wallBlend[(int) tile.wall];
if (num14 != 0)
spriteBatch.Draw(TextureAssets.WallOutline.Value, new Vector2((float) (index2 * 16 - (int) screenPosition.X), (float) (index1 * 16 - (int) screenPosition.Y)) + vector2, new Rectangle?(new Rectangle(0, 0, 2, 16)), color1, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
if (flag1)
spriteBatch.Draw(TextureAssets.WallOutline.Value, new Vector2((float) (index2 * 16 - (int) screenPosition.X + 14), (float) (index1 * 16 - (int) screenPosition.Y)) + vector2, new Rectangle?(new Rectangle(14, 0, 2, 16)), color1, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
if (flag2)
spriteBatch.Draw(TextureAssets.WallOutline.Value, new Vector2((float) (index2 * 16 - (int) screenPosition.X), (float) (index1 * 16 - (int) screenPosition.Y)) + vector2, new Rectangle?(new Rectangle(0, 0, 16, 2)), color1, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
if (flag3)
spriteBatch.Draw(TextureAssets.WallOutline.Value, new Vector2((float) (index2 * 16 - (int) screenPosition.X), (float) (index1 * 16 - (int) screenPosition.Y + 14)) + vector2, new Rectangle?(new Rectangle(0, 14, 16, 2)), color1, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f);
}
}
}
}
}
Main.instance.DrawTileCracks(2, Main.LocalPlayer.hitReplace);
Main.instance.DrawTileCracks(2, Main.LocalPlayer.hitTile);
TimeLogger.DrawTime(2, stopwatch.Elapsed.TotalMilliseconds);
}
private Texture2D GetTileDrawTexture(Tile tile, int tileX, int tileY)
{
Texture2D texture2D = TextureAssets.Wall[(int) tile.wall].Value;
Texture2D requestIfNotReady = this._paintSystem.TryGetWallAndRequestIfNotReady((int) tile.wall, (int) tile.wallColor());
if (requestIfNotReady != null)
texture2D = requestIfNotReady;
return texture2D;
}
protected bool FullTile(int x, int y)
{
if (this._tileArray[x - 1, y] == null || this._tileArray[x - 1, y].blockType() != 0 || this._tileArray[x + 1, y] == null || this._tileArray[x + 1, y].blockType() != 0)
return false;
Tile tile = this._tileArray[x, y];
if (tile == null || !tile.active() || (int) tile.type < TileID.Sets.DrawsWalls.Length && TileID.Sets.DrawsWalls[(int) tile.type] || !Main.tileSolid[(int) tile.type] || Main.tileSolidTop[(int) tile.type])
return false;
int frameX = (int) tile.frameX;
int frameY = (int) tile.frameY;
if (Main.tileLargeFrames[(int) tile.type] > (byte) 0)
{
if ((frameY == 18 || frameY == 108) && (frameX >= 18 && frameX <= 54 || frameX >= 108 && frameX <= 144))
return true;
}
else if (frameY == 18)
{
if (frameX >= 18 && frameX <= 54 || frameX >= 108 && frameX <= 144)
return true;
}
else if (frameY >= 90 && frameY <= 196 && (frameX <= 70 || frameX >= 144 && frameX <= 232))
return true;
return false;
}
}
}

View file

@ -0,0 +1,92 @@
// Decompiled with JetBrains decompiler
// Type: Terraria.GameContent.Drawing.WindGrid
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using System;
namespace Terraria.GameContent.Drawing
{
public class WindGrid
{
private WindGrid.WindCoord[,] _grid = new WindGrid.WindCoord[1, 1];
private int _width = 1;
private int _height = 1;
private int _gameTime;
public void SetSize(int targetWidth, int targetHeight)
{
this._width = Math.Max(this._width, targetWidth);
this._height = Math.Max(this._height, targetHeight);
this.ResizeGrid();
}
public void Update()
{
++this._gameTime;
if (!Main.SettingsEnabled_TilesSwayInWind)
return;
this.ScanPlayers();
}
public void GetWindTime(
int tileX,
int tileY,
int timeThreshold,
out int windTimeLeft,
out int direction)
{
WindGrid.WindCoord windCoord = this._grid[tileX % this._width, tileY % this._height];
direction = windCoord.Direction;
if (windCoord.Time + timeThreshold < this._gameTime)
windTimeLeft = 0;
else
windTimeLeft = this._gameTime - windCoord.Time;
}
private void ResizeGrid()
{
if (this._width <= this._grid.GetLength(0) && this._height <= this._grid.GetLength(1))
return;
this._grid = new WindGrid.WindCoord[this._width, this._height];
}
private void SetWindTime(int tileX, int tileY, int direction)
{
this._grid[tileX % this._width, tileY % this._height].Time = this._gameTime;
this._grid[tileX % this._width, tileY % this._height].Direction = direction;
}
private void ScanPlayers()
{
switch (Main.netMode)
{
case 0:
this.ScanPlayer(Main.myPlayer);
break;
case 1:
for (int i = 0; i < (int) byte.MaxValue; ++i)
this.ScanPlayer(i);
break;
}
}
private void ScanPlayer(int i)
{
Player player = Main.player[i];
if (!player.active || player.dead || (double) player.velocity.X == 0.0 || !Utils.CenteredRectangle(Main.Camera.Center, Main.Camera.UnscaledSize).Intersects(player.Hitbox) || player.velocity.HasNaNs())
return;
int direction = Math.Sign(player.velocity.X);
foreach (Point point in Collision.GetTilesIn(player.TopLeft, player.BottomRight))
this.SetWindTime(point.X, point.Y, direction);
}
private struct WindCoord
{
public int Time;
public int Direction;
}
}
}