public void DrawFreshAnimations(SpriteBatch spriteBatch)
{
for (int index = 0; index < this.data.Length; ++index)
{
++this.data[index].animationTimeElapsed;
}
if (!Main.SettingsEnabled_MinersWobble)
{
return;
}
int num1 = 1;
Vector2 vector2_1 = new Vector2((float)Main.offScreenRange);
if (Main.drawToScreen)
{
vector2_1 = Vector2.Zero;
}
vector2_1 = Vector2.Zero;
for (int index = 0; index < this.data.Length; ++index)
{
if (this.data[index].type == num1)
{
int damage = this.data[index].damage;
if (damage >= 20)
{
int x = this.data[index].X;
int y = this.data[index].Y;
if (WorldGen.InWorld(x, y, 0))
{
bool flag1 = Main.tile[x, y] != null;
if (flag1 && num1 == 1)
{
flag1 = flag1 && Main.tile[x, y].active() && Main.tileSolid[(int)Main.tile[x, y].type];
}
if (flag1 && num1 == 2)
{
flag1 = flag1 && Main.tile[x, y].wall > (ushort)0;
}
if (flag1)
{
bool flag2 = false;
bool flag3 = false;
if (Main.tile[x, y].type == (ushort)10)
{
flag2 = false;
}
else if (Main.tileSolid[(int)Main.tile[x, y].type] && !Main.tileSolidTop[(int)Main.tile[x, y].type])
{
flag2 = true;
}
else if (WorldGen.IsTreeType((int)Main.tile[x, y].type))
{
flag3 = true;
int num2 = (int)Main.tile[x, y].frameX / 22;
int num3 = (int)Main.tile[x, y].frameY / 22;
if (num3 < 9)
{
flag2 = (num2 != 1 && num2 != 2 || (num3 < 6 || num3 > 8)) && ((num2 != 3 || num3 > 2) && ((num2 != 4 || num3 < 3 || num3 > 5) && (num2 != 5 || num3 < 6 || num3 > 8)));
}
}
else if (Main.tile[x, y].type == (ushort)72)
{
flag3 = true;
if (Main.tile[x, y].frameX <= (short)34)
{
flag2 = true;
}
}
if (flag2 && Main.tile[x, y].slope() == (byte)0 && !Main.tile[x, y].halfBrick())
{
int num2 = 0;
if (damage >= 80)
{
num2 = 3;
}
else if (damage >= 60)
{
num2 = 2;
}
else if (damage >= 40)
{
num2 = 1;
}
else if (damage >= 20)
{
num2 = 0;
}
Rectangle rectangle = new Rectangle(this.data[index].crackStyle * 18, num2 * 18, 16, 16);
rectangle.Inflate(-2, -2);
if (flag3)
{
rectangle.X = (4 + this.data[index].crackStyle / 2) * 18;
}
int animationTimeElapsed = this.data[index].animationTimeElapsed;
if ((double)animationTimeElapsed < 10.0)
{
double num3 = (double)animationTimeElapsed / 10.0;
Color color1 = Lighting.GetColor(x, y);
float rotation = 0.0f;
Vector2 zero = Vector2.Zero;
float num4 = 0.5f;
float num5 = (float)num3 % num4 * (1f / num4);
if ((int)(num3 / (double)num4) % 2 == 1)
{
num5 = 1f - num5;
}
Tile tileSafely = Framing.GetTileSafely(x, y);
Tile tile = tileSafely;
Texture2D requestIfNotReady = Main.instance.TilePaintSystem.TryGetTileAndRequestIfNotReady((int)tileSafely.type, 0, (int)tileSafely.color());
if (requestIfNotReady != null)
{
Vector2 origin = new Vector2(8f);
Vector2 vector2_2 = new Vector2(1f);
double num6 = (double)num5 * 0.200000002980232 + 1.0;
float num7 = 1f - num5;
float num8 = 1f;
Color color2 = color1 * (float)((double)num8 * (double)num8 * 0.800000011920929);
Vector2 vector2_3 = vector2_2;
Vector2 scale = (float)num6 * vector2_3;
Vector2 position = (new Vector2((float)(x * 16 - (int)Main.screenPosition.X), (float)(y * 16 - (int)Main.screenPosition.Y)) + vector2_1 + origin + zero).Floor();
spriteBatch.Draw(requestIfNotReady, position, new Rectangle?(new Rectangle((int)tile.frameX, (int)tile.frameY, 16, 16)), color2, rotation, origin, scale, SpriteEffects.None, 0.0f);
color2.A = (byte)180;
spriteBatch.Draw(TextureAssets.TileCrack.get_Value(), position, new Rectangle?(rectangle), color2, rotation, origin, scale, SpriteEffects.None, 0.0f);
}
}
}
}
}
}
}
}
}