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); } } } } } } } } }
public void DrawFreshAnimations(SpriteBatch spriteBatch) { for (int i = 0; i < data.Length; i++) { data[i].animationTimeElapsed++; } if (!Main.SettingsEnabled_MinersWobble) { return; } int num = 1; Vector2 vector = new Vector2(Main.offScreenRange); if (Main.drawToScreen) { vector = Vector2.Zero; } vector = Vector2.Zero; for (int j = 0; j < data.Length; j++) { if (data[j].type != num) { continue; } int damage = data[j].damage; if (damage < 20) { continue; } int x = data[j].X; int y = data[j].Y; if (!WorldGen.InWorld(x, y)) { continue; } bool flag = Main.tile[x, y] != null; if (flag && num == 1) { flag = (flag && Main.tile[x, y].active() && Main.tileSolid[Main.tile[x, y].type]); } if (flag && num == 2) { flag = (flag && Main.tile[x, y].wall != 0); } if (!flag) { continue; } bool flag2 = false; bool flag3 = false; if (Main.tile[x, y].type == 10) { flag2 = false; } else if (Main.tileSolid[Main.tile[x, y].type] && !Main.tileSolidTop[Main.tile[x, y].type]) { flag2 = true; } else if (WorldGen.IsTreeType(Main.tile[x, y].type)) { flag3 = true; int num2 = Main.tile[x, y].frameX / 22; int num3 = 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) ? true : false)); } } else if (Main.tile[x, y].type == 72) { flag3 = true; if (Main.tile[x, y].frameX <= 34) { flag2 = true; } } if (!flag2 || Main.tile[x, y].slope() != 0 || Main.tile[x, y].halfBrick()) { continue; } int num4 = 0; if (damage >= 80) { num4 = 3; } else if (damage >= 60) { num4 = 2; } else if (damage >= 40) { num4 = 1; } else if (damage >= 20) { num4 = 0; } Rectangle value = new Rectangle(data[j].crackStyle * 18, num4 * 18, 16, 16); value.Inflate(-2, -2); if (flag3) { value.X = (4 + data[j].crackStyle / 2) * 18; } int animationTimeElapsed = data[j].animationTimeElapsed; if (!((float)animationTimeElapsed >= 10f)) { float num5 = (float)animationTimeElapsed / 10f; Color color = Lighting.GetColor(x, y); float rotation = 0f; Vector2 zero = Vector2.Zero; float num6 = 0.5f; float num7 = num5 % num6; num7 *= 1f / num6; if ((int)(num5 / num6) % 2 == 1) { num7 = 1f - num7; } Tile tileSafely = Framing.GetTileSafely(x, y); Tile tile = tileSafely; Texture2D texture2D = Main.instance.TilePaintSystem.TryGetTileAndRequestIfNotReady(tileSafely.type, 0, tileSafely.color()); if (texture2D != null) { Vector2 vector2 = new Vector2(8f); Vector2 value2 = new Vector2(1f); float scaleFactor = num7 * 0.2f + 1f; float num8 = 1f - num7; num8 = 1f; color *= num8 * num8 * 0.8f; Vector2 scale = scaleFactor * value2; Vector2 position = (new Vector2(x * 16 - (int)Main.screenPosition.X, y * 16 - (int)Main.screenPosition.Y) + vector + vector2 + zero).Floor(); spriteBatch.Draw(texture2D, position, new Rectangle(tile.frameX, tile.frameY, 16, 16), color, rotation, vector2, scale, SpriteEffects.None, 0f); color.A = 180; spriteBatch.Draw(TextureAssets.TileCrack.get_Value(), position, value, color, rotation, vector2, scale, SpriteEffects.None, 0f); } } } }