private void DrawOverlay(Ship ship) { if (this.LookingAtPlanet || this.viewState > UniverseScreen.UnivScreenState.SystemView || (!this.ShowShipNames || ship.dying) || !ship.InFrustum) return; Vector2 vector2_1 = new Vector2((float)(ResourceManager.TextureDict["TacticalIcons/symbol_fighter"].Width / 2), (float)(ResourceManager.TextureDict["TacticalIcons/symbol_fighter"].Width / 2)); foreach (ModuleSlot moduleSlot in ship.ModuleSlotList) { Vector2 vector2_2 = new Vector2(moduleSlot.module.Center.X, moduleSlot.module.Center.Y); float scale = 0.75f * (float)this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / this.camHeight; Vector3 vector3 = this.ScreenManager.GraphicsDevice.Viewport.Project(new Vector3(vector2_2, 0.0f), this.projection, this.view, Matrix.Identity); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Modules/tile_concreteglass_1x1"], new Vector2(vector3.X, vector3.Y), new Rectangle?(), Color.White, ship.Rotation, new Vector2(8f, 8f), scale, SpriteEffects.None, 1f); } bool flag = false; if (flag) { foreach (Projectile projectile in (List<Projectile>)ship.Projectiles) { Vector3 vector3_1 = this.ScreenManager.GraphicsDevice.Viewport.Project(new Vector3(projectile.Center, 0.0f), this.projection, this.view, Matrix.Identity); Vector2 center = new Vector2(vector3_1.X, vector3_1.Y); Vector2 vector2_2 = projectile.Center + new Vector2(8f, 0.0f); Vector3 vector3_2 = this.ScreenManager.GraphicsDevice.Viewport.Project(new Vector3(vector2_2.X, vector2_2.Y, 0.0f), this.projection, this.view, Matrix.Identity); float radius = Vector2.Distance(center, new Vector2(vector3_2.X, vector3_2.Y)); Primitives2D.DrawCircle(this.ScreenManager.SpriteBatch, center, radius, 50, Color.Red, 3f); } } Viewport viewport; foreach (ModuleSlot moduleSlot in ship.ModuleSlotList) { if ((double)this.camHeight > 6000.0) { string index = "TacticalIcons/symbol_fighter"; viewport = this.ScreenManager.GraphicsDevice.Viewport; Vector3 vector3_1 = viewport.Project(new Vector3(moduleSlot.module.Center, 0.0f), this.projection, this.view, Matrix.Identity); Vector2 origin1 = new Vector2((float)(ResourceManager.TextureDict["TacticalIcons/symbol_fighter"].Width / 2), (float)(ResourceManager.TextureDict["TacticalIcons/symbol_fighter"].Height / 2)); float num1 = moduleSlot.module.Health / moduleSlot.module.HealthMax; float scale = 500f / this.camHeight; if (this.Debug && moduleSlot.module.isExternal) this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.Blue, ship.Rotation, origin1, scale, SpriteEffects.None, 1f); else if ((double)num1 >= 0.899999976158142) this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.Green, ship.Rotation, origin1, scale, SpriteEffects.None, 1f); else if ((double)num1 >= 0.649999976158142) this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.GreenYellow, ship.Rotation, origin1, scale, SpriteEffects.None, 1f); else if ((double)num1 >= 0.449999988079071) this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.Yellow, ship.Rotation, origin1, scale, SpriteEffects.None, 1f); else if ((double)num1 >= 0.150000005960464) this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.OrangeRed, ship.Rotation, origin1, scale, SpriteEffects.None, 1f); else if ((double)num1 <= 0.150000005960464 && (double)num1 > 0.0) this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.Red, ship.Rotation, origin1, scale, SpriteEffects.None, 1f); else this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.Black, ship.Rotation, origin1, scale, SpriteEffects.None, 1f); if (ship.isPlayerShip() && (double)moduleSlot.module.FieldOfFire != 0.0 && moduleSlot.module.InstalledWeapon != null) { float num2 = moduleSlot.module.FieldOfFire / 2f; Vector2 angleAndDistance1 = this.findPointFromAngleAndDistance(moduleSlot.module.Center, (float)((double)MathHelper.ToDegrees(ship.Rotation) + (double)moduleSlot.module.facing + -(double)num2), moduleSlot.module.InstalledWeapon.Range); Vector2 angleAndDistance2 = this.findPointFromAngleAndDistance(moduleSlot.module.Center, MathHelper.ToDegrees(ship.Rotation) + moduleSlot.module.facing + num2, moduleSlot.module.InstalledWeapon.Range); viewport = this.ScreenManager.GraphicsDevice.Viewport; Vector3 vector3_2 = viewport.Project(new Vector3(angleAndDistance1, 0.0f), this.projection, this.view, Matrix.Identity); viewport = this.ScreenManager.GraphicsDevice.Viewport; Vector3 vector3_3 = viewport.Project(new Vector3(angleAndDistance2, 0.0f), this.projection, this.view, Matrix.Identity); Vector2 point1 = new Vector2(vector3_1.X, vector3_1.Y); Vector2 point2_1 = new Vector2(vector3_2.X, vector3_2.Y); Vector2 point2_2 = new Vector2(vector3_3.X, vector3_3.Y); float num3 = Vector2.Distance(point1, point2_1); Color color1 = new Color(byte.MaxValue, (byte)165, (byte)0, (byte)100); Vector2 origin2 = new Vector2(250f, 250f); if (moduleSlot.module.InstalledWeapon.WeaponType == "Flak" || moduleSlot.module.InstalledWeapon.WeaponType == "Vulcan") { Color color2 = new Color(byte.MaxValue, byte.MaxValue, (byte)0, byte.MaxValue); Rectangle destinationRectangle = new Rectangle((int)point1.X, (int)point1.Y, (int)num3 * 2, (int)num3 * 2); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Arcs/Arc90"], destinationRectangle, new Rectangle?(), color2, MathHelper.ToRadians(moduleSlot.module.facing) + ship.Rotation, origin2, SpriteEffects.None, (float)(1.0 - (double)moduleSlot.module.InstalledWeapon.Range / 99999.0)); } else if (moduleSlot.module.InstalledWeapon.WeaponType == "Laser" || moduleSlot.module.InstalledWeapon.WeaponType == "HeavyLaser") { Color color2 = new Color(byte.MaxValue, (byte)0, (byte)0, byte.MaxValue); Rectangle destinationRectangle = new Rectangle((int)point1.X, (int)point1.Y, (int)num3 * 2, (int)num3 * 2); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Arcs/Arc90"], destinationRectangle, new Rectangle?(), color2, MathHelper.ToRadians(moduleSlot.module.facing) + ship.Rotation, origin2, SpriteEffects.None, (float)(1.0 - (double)moduleSlot.module.InstalledWeapon.Range / 99999.0)); } else if (moduleSlot.module.InstalledWeapon.WeaponType == "PhotonCannon") { Color color2 = new Color((byte)0, (byte)0, byte.MaxValue, byte.MaxValue); Rectangle destinationRectangle = new Rectangle((int)point1.X, (int)point1.Y, (int)num3 * 2, (int)num3 * 2); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Arcs/Arc90"], destinationRectangle, new Rectangle?(), color2, MathHelper.ToRadians(moduleSlot.module.facing) + ship.Rotation, origin2, SpriteEffects.None, (float)(1.0 - (double)moduleSlot.module.InstalledWeapon.Range / 99999.0)); } else { Primitives2D.DrawLine(this.ScreenManager.SpriteBatch, point1, point2_1, new Color(byte.MaxValue, (byte)0, (byte)0, (byte)75), 1f); Primitives2D.DrawLine(this.ScreenManager.SpriteBatch, point1, point2_2, new Color(byte.MaxValue, (byte)0, (byte)0, (byte)75), 1f); } } } else if (this.Debug) { if (this.Debug && moduleSlot.module.isExternal && moduleSlot.module.Active) { string index = "TacticalIcons/symbol_fighter"; viewport = this.ScreenManager.GraphicsDevice.Viewport; Vector3 vector3 = viewport.Project(new Vector3(moduleSlot.module.Center, 0.0f), this.projection, this.view, Matrix.Identity); Vector2 origin = new Vector2((float)(ResourceManager.TextureDict["TacticalIcons/symbol_fighter"].Width / 2), (float)(ResourceManager.TextureDict["TacticalIcons/symbol_fighter"].Height / 2)); float scale = 500f / this.camHeight; this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index], new Vector2(vector3.X, vector3.Y), new Rectangle?(), Color.Blue, ship.Rotation, origin, scale, SpriteEffects.None, 1f); } } else if (!moduleSlot.module.isDummy) { byte num1 = moduleSlot.module.XSIZE; byte num2 = moduleSlot.module.YSIZE; float num3 = 0.0f; if (moduleSlot.state == ShipDesignScreen.ActiveModuleState.Left) num3 = 4.712389f; else if (moduleSlot.state == ShipDesignScreen.ActiveModuleState.Right) num3 = 1.570796f; else if (moduleSlot.state == ShipDesignScreen.ActiveModuleState.Rear) num3 = 3.141593f; Vector2 vector2_2 = (int)moduleSlot.module.XSIZE != 1 || (int)moduleSlot.module.YSIZE != 3 ? ((int)moduleSlot.module.XSIZE != 2 || (int)moduleSlot.module.YSIZE != 5 ? new Vector2(moduleSlot.module.Center.X - 8f + (float)(16 * (int)num1 / 2), moduleSlot.module.Center.Y - 8f + (float)(16 * (int)num2 / 2)) : new Vector2(moduleSlot.module.Center.X - 80f + (float)(16 * (int)num1 / 2), moduleSlot.module.Center.Y - 8f + (float)(16 * (int)num2 / 2))) : new Vector2(moduleSlot.module.Center.X - 50f + (float)(16 * (int)num1 / 2), moduleSlot.module.Center.Y - 8f + (float)(16 * (int)num2 / 2)); Vector2 target = new Vector2(moduleSlot.module.Center.X - 8f, moduleSlot.module.Center.Y - 8f); float angleToTarget = this.findAngleToTarget(vector2_2, target); Vector2 angleAndDistance1 = this.findPointFromAngleAndDistance(moduleSlot.module.Center, MathHelper.ToDegrees(ship.Rotation) - angleToTarget, 8f * (float)Math.Sqrt(2.0)); float num4 = (float)((int)num1 * 16 / 2); float num5 = (float)((int)num2 * 16 / 2); float distance = (float)Math.Sqrt((double)((float)Math.Pow((double)num4, 2.0) + (float)Math.Pow((double)num5, 2.0))); float radians = 3.141593f - (float)Math.Asin((double)num4 / (double)distance) + ship.Rotation; vector2_2 = this.findPointFromAngleAndDistance(angleAndDistance1, MathHelper.ToDegrees(radians), distance); viewport = this.ScreenManager.GraphicsDevice.Viewport; Vector3 vector3_1 = viewport.Project(new Vector3(vector2_2, 0.0f), this.projection, this.view, Matrix.Identity); Vector2 origin1 = new Vector2((float)(ResourceManager.TextureDict[ResourceManager.ShipModulesDict[moduleSlot.module.UID].IconTexturePath].Width / 2), (float)(ResourceManager.TextureDict[ResourceManager.ShipModulesDict[moduleSlot.module.UID].IconTexturePath].Height / 2)); float num6 = moduleSlot.module.Health / moduleSlot.module.HealthMax; string index1 = ResourceManager.ShipModulesDict[moduleSlot.module.UID].IconTexturePath; float scale1 = 0.75f * (float)this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / this.camHeight / (float)(ResourceManager.TextureDict[ResourceManager.ShipModulesDict[moduleSlot.module.UID].IconTexturePath].Width / ((int)ResourceManager.ShipModulesDict[moduleSlot.module.UID].XSIZE * 16)); if (moduleSlot.module.ModuleType == ShipModuleType.PowerConduit) { origin1 = new Vector2((float)(ResourceManager.TextureDict[moduleSlot.module.IconTexturePath].Width / 2), (float)(ResourceManager.TextureDict[moduleSlot.module.IconTexturePath].Width / 2)); float num7 = (float)(ResourceManager.TextureDict[moduleSlot.module.IconTexturePath].Width / 16); float scale2 = 0.75f * (float)this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / this.camHeight / num7; this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[moduleSlot.module.IconTexturePath], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.White, ship.Rotation, origin1, scale2, SpriteEffects.None, 1f); if (moduleSlot.module.Powered) { string index2 = moduleSlot.module.IconTexturePath + "_power"; float scale3 = 0.75f * (float)this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / this.camHeight / num7; this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index2], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.White, ship.Rotation, origin1, scale3, SpriteEffects.None, 1f); } } else { if ((double)num6 >= 0.899999976158142) this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index1], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.White, ship.Rotation + num3, origin1, scale1, SpriteEffects.None, 1f); else if ((double)num6 >= 0.649999976158142) this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index1], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.GreenYellow, ship.Rotation + num3, origin1, scale1, SpriteEffects.None, 1f); else if ((double)num6 >= 0.449999988079071) this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index1], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.Yellow, ship.Rotation + num3, origin1, scale1, SpriteEffects.None, 1f); else if ((double)num6 >= 0.150000005960464) this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index1], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.OrangeRed, ship.Rotation + num3, origin1, scale1, SpriteEffects.None, 1f); else if ((double)num6 <= 0.150000005960464 && (double)num6 > 0.0) this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index1], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.Red, ship.Rotation + num3, origin1, scale1, SpriteEffects.None, 1f); else this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[index1], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.Black, ship.Rotation + num3, origin1, scale1, SpriteEffects.None, 1f); if (flag) { Vector2 center = new Vector2(vector3_1.X, vector3_1.Y); Vector2 vector2_3 = vector2_2 + new Vector2(8f, 0.0f); viewport = this.ScreenManager.GraphicsDevice.Viewport; Vector3 vector3_2 = viewport.Project(new Vector3(vector2_3.X, vector2_3.Y, 0.0f), this.projection, this.view, Matrix.Identity); float radius = Vector2.Distance(center, new Vector2(vector3_2.X, vector3_2.Y)); Primitives2D.DrawCircle(this.ScreenManager.SpriteBatch, center, radius, 50, Color.Red, 3f); } } if (ship.isPlayerShip() && (double)moduleSlot.module.FieldOfFire != 0.0 && moduleSlot.module.InstalledWeapon != null) { float num7 = moduleSlot.module.FieldOfFire / 2f; Vector2 angleAndDistance2 = this.findPointFromAngleAndDistance(vector2_2, (float)((double)MathHelper.ToDegrees(ship.Rotation) + (double)moduleSlot.module.facing + -(double)num7), moduleSlot.module.InstalledWeapon.Range); Vector2 angleAndDistance3 = this.findPointFromAngleAndDistance(vector2_2, MathHelper.ToDegrees(ship.Rotation) + moduleSlot.module.facing + num7, moduleSlot.module.InstalledWeapon.Range); viewport = this.ScreenManager.GraphicsDevice.Viewport; Vector3 vector3_2 = viewport.Project(new Vector3(angleAndDistance2, 0.0f), this.projection, this.view, Matrix.Identity); viewport = this.ScreenManager.GraphicsDevice.Viewport; Vector3 vector3_3 = viewport.Project(new Vector3(angleAndDistance3, 0.0f), this.projection, this.view, Matrix.Identity); Vector2 point1 = new Vector2(vector3_1.X, vector3_1.Y); Vector2 point2_1 = new Vector2(vector3_2.X, vector3_2.Y); Vector2 point2_2 = new Vector2(vector3_3.X, vector3_3.Y); float num8 = Vector2.Distance(point1, point2_1); Color color1 = new Color(byte.MaxValue, (byte)165, (byte)0, (byte)100); Vector2 origin2 = new Vector2(250f, 250f); if (moduleSlot.module.InstalledWeapon.WeaponType == "Flak" || moduleSlot.module.InstalledWeapon.WeaponType == "Vulcan") { Color color2 = new Color(byte.MaxValue, byte.MaxValue, (byte)0, byte.MaxValue); Rectangle destinationRectangle = new Rectangle((int)point1.X, (int)point1.Y, (int)num8 * 2, (int)num8 * 2); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Arcs/Arc90"], destinationRectangle, new Rectangle?(), color2, MathHelper.ToRadians(moduleSlot.module.facing) + ship.Rotation, origin2, SpriteEffects.None, (float)(1.0 - (double)moduleSlot.module.InstalledWeapon.Range / 99999.0)); } else if (moduleSlot.module.InstalledWeapon.WeaponType == "Laser" || moduleSlot.module.InstalledWeapon.WeaponType == "HeavyLaser") { Color color2 = new Color(byte.MaxValue, (byte)0, (byte)0, byte.MaxValue); Rectangle destinationRectangle = new Rectangle((int)point1.X, (int)point1.Y, (int)num8 * 2, (int)num8 * 2); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Arcs/Arc90"], destinationRectangle, new Rectangle?(), color2, MathHelper.ToRadians(moduleSlot.module.facing) + ship.Rotation, origin2, SpriteEffects.None, (float)(1.0 - (double)moduleSlot.module.InstalledWeapon.Range / 99999.0)); } else if (moduleSlot.module.InstalledWeapon.WeaponType == "PhotonCannon") { Color color2 = new Color((byte)0, (byte)0, byte.MaxValue, byte.MaxValue); Rectangle destinationRectangle = new Rectangle((int)point1.X, (int)point1.Y, (int)num8 * 2, (int)num8 * 2); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Arcs/Arc90"], destinationRectangle, new Rectangle?(), color2, MathHelper.ToRadians(moduleSlot.module.facing) + ship.Rotation, origin2, SpriteEffects.None, (float)(1.0 - (double)moduleSlot.module.InstalledWeapon.Range / 99999.0)); } else { Primitives2D.DrawLine(this.ScreenManager.SpriteBatch, point1, point2_1, new Color(byte.MaxValue, (byte)0, (byte)0, (byte)75), 1f); Primitives2D.DrawLine(this.ScreenManager.SpriteBatch, point1, point2_2, new Color(byte.MaxValue, (byte)0, (byte)0, (byte)75), 1f); } } if (!moduleSlot.module.Powered && (double)moduleSlot.module.PowerDraw > 0.0 && moduleSlot.module.ModuleType != ShipModuleType.PowerConduit) { Vector2 origin2 = new Vector2(8f, 8f); float scale2 = 1250f / this.camHeight; this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/lightningBolt"], new Vector2(vector3_1.X, vector3_1.Y), new Rectangle?(), Color.White, 0.0f, origin2, scale2, SpriteEffects.None, 1f); } } } }